adccommunitymod (AutomationDirect) asked a question.

PID Low Pass Filter / Calcualtion

Created Date: August 22,2019

Created By: Towlie03

**** This post has been imported from our legacy forum. Information in this post may be outdated and links contained in the post may no longer work.****

Hello All, Is there any documentation in regards to the the math used under the hood of the PID function? I am mainly looking to find out if a LPF is applied to the derivative, I am dealing with a bit of a noisy signal and looking do some filtering to increase the loop stability.


  • adccommunitymod (AutomationDirect)

    Created Date: August 22,2019

    Created by: Towlie03

    Hello All,

    Is there any documentation in regards to the the math used under the hood of the PID function? I am mainly looking to find out if a LPF is applied to the derivative, I am dealing with a bit of a noisy signal and looking do some filtering to increase the loop stability.

  • adccommunitymod (AutomationDirect)

    Created Date: August 22,2019

    Created by: Towlie03

    To continue with a related issue. I am slowly heating up a liquid by adding steam, which is controlled by the PID. At the end of the process my output is 650, when the cycle is done I disable the pid. When I restart the cycle for a new batch and enable the PID the initial output starts at 650 and climbs down to a reasonable number which is about 100. How do I reset the output between runs?

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: August 26,2019

    Created by: bsinkovich

    Set the Bias Term in the Advance Tab of the PID to zero before enabling. Also try the "Error Squared " in the Advanced Tab.

    Setting this bit will Square the Error . This can be useful for many processes by effectively diminishing the control effect on smaller Errors while maintaining the control effect on larger Errors . This can also be useful for reducing the effect of low frequency electrical noise in your process.

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: September 04,2019

    Created by: DanLuttrell

    I 've had some success with a couple of the smoothing filters described here:

    https://en.wikipedia.org/wiki/Savitzky%E2%80%93Golay_filter

    Don't be put-off by the math they throw out. Go down to the bottom and look at the Appendix. There are tables here showing coefficients to use in the basic formulas just above the tables. What is neat is you can smooth the data points and get the 1st, 2nd, and 3rd derivatives with the coefficients in these tables. I 've used the 1st derivative smoothing filter to provide the D term for a PID loop. You can set the D term in the PID instruction to zero and then add the filtered derivative to the PI output. I 've also used this smoothed derivative for feedforward terms.

    You can also use the AVERAGE instruction to smooth data. It's basically a weighted, moving average filter and works quite well. It doesn't give you a derivative, of course, but you can calculate that from the data over several samples and then use the AVERAGE instruction. The ARRAY STATISTICS function might also be helpful.

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: September 04,2019

    Created by: Towlie03

    Thank you very much for the link, I will give this a good read. I didn't consider doing the derivative separately but that is a path I may follow.