I am discretizing the PID equation so we have this equation
Now if we separate the integral term we get
Applying backward euler method
Now as we already have a differentiation , by applying backward euler method
and the end equation is something like this
I just want to ask if I did something mathematically wrong or did I miss a step ?
Best Answer
There's nothing wrong with the equations as far as I can tell. Backward Euler is the easiest way to approximate the derivative, so it is suitable for real-time calculations.
Some tips that can still help:
When implementing a PID controller with analog components, the integrated signal is usually naturally limited by the supply voltages. Not limiting this factor will sometimes severely lengthen the recovery time.
When sampling a signal, you inherently introduce some delay in the loop which causes it to be slightly less stable. In extremis, the sampling frequency is too slow to capture the dynamics of the system to be controlled. Any controller you design will not be a good one at that point. Next to that, the extra conversion time for the ADC and DAC can also introduce a delay, having the same effect on the stability/performance of the system.
Whenever you sample a signal using an ADC, you have to keep the Nyquist–Shannon sampling theorem in mind. If your system has a frequency content that extends beyond the Nyquist frequency (\$f_N = \frac{1}{2T_s}\$) then you will want to limit it first to avoid aliasing, by means of an anti-alias filter.