Thanks everyone.
After searching around alot I found an algorithm that adds the modulus/remainer of the previous calculation to the regulator output.
Doing this I ended up without a stationary error, whats the logic behind this algorithm?
After searching around alot I found an algorithm that adds the modulus/remainer of the previous calculation to the regulator output.
Code:
error[0] := setpoint - measure;
up := (Kp * (error[0] - error[1])) / K;
ui := (Kp * error[0] + ui_mod[1]) / ((Ti*K)/Ts);
ui_mod[0] := (Kp * error[0] + ui_mod[1]) MOD((Ti*K)/Ts);
u[0] := u[1] + up + ui; (* Output *)
u[1] := u[0]; (* Prev. output *)
ui_mod[1] := ui_mod[0]; (* Prev remainder *)
error[1] := error[0]; (* Prev error *)
Doing this I ended up without a stationary error, whats the logic behind this algorithm?