PIDController

The PIDController is a discrete position form implementation (not incremental) of a PID controller, including anti windup. The algorithm is based on Haugen, Finn "Anvendt reguleringsteknikk"(1992, Tapir) eq. 1.57 p. 92.

The algorithm is as follows:

i[k] = i[k-1] + (Kp*dT/Ti)*e[k]; // integral part

u = Kp*e[k] + i[k] + Kp*Td*(e[k] - 2*e[k-1] + e[k-2])/dT;

Where

i[k]  - is the integral part at time k

e[k] - is control deviation at time k (reference - measurement)

u     - resulting control value

Kp   - proportional gain

Ti    - integral time

Td   - derivate time

dT   - sample time