I wish that someone may go over the following implementation of a PI controller with anti-windup capability and comment whether it is correct or not: % MATLAB code % ipart, ipart_aw are 2 state variables to represent the integral part of the error and % integral part of anti-windup correction respectively
% K, Ti, Tt are given parameters % meas is a state variable e= setpoint ? meas;
% output u= K*e + ipart + ipart_aw;
% limit output if u 240 ulim=240; end if 0 = < u =< 240 ulim =u; end
% manipulated variable to be inserted into subsequent ODEs equals to limited output % ulim
v=ulim;
% derivative of integral part of the error dipart = K/Ti*e;
% derivative of the integral part due to anti-windup correction dipart_aw = 1/Tt*(ulim-u);
Thank you in advance for your feedback.