# Practical implementation of the I_PARAMETER for PID control

• posted

Hello, I'm looking for the best choice to implement fast PID controllers using limited computational resources. The performance of these controllers need not be the optimal, but reasonable and off course, it should allow easy tuning to stabllity.

As i understand the I_PARAMETER term is usually created by applying the P_PARAMETER to a LP filter. In my case this is too costly in terms of computational power, it is much more easy to apply the P_PARAMETER into a FIFO buffer and calculate the average value of all the records inside this FIFO for each PID Control Tick/

Is this approach may supply reasonable result?

The same question about the D_PARAMETER.... if i will just subtract the current P_PARAMETER value with an older one taken from the same FIFO buffer?

• posted

Sorry I've been offline the past couple weeks.

In a PID controller, the control law looks like u=Kp*P + Kd*D + Ki*I

where u = control output

Kp = proportional gain Kd = derivative gain Ki = integral gain

P = sensor position - desired position D = time derivative of P I = time integral of P

As you suggest, a simple approximation of the derivative is D=(P[t]-P[t-1])/dt. The integral may be calculated by accumulating I[t]=I[t-1]+P*dt.

where X[t] = current value of X X[t-1] = previous value of X dt = time between the two values

Better values of D may be obtained by using a more sophisticated derivative filter.

Double-check the above for sanity; it was written rather quickly.

Later, Daniel

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.