Bug in FT_PID

I believe there is a bug in FT_PID. If the TN value was previously not 0, and then is set to 0, it does not reset the the integral term and keeps accumulating if IEN was previously true. This causes unexpected behavior as the control output continues to grow over time even though the integral term is disabled.

Is the intent instead that RST should be TRUE if TN = 0 so that it will clear the integral term?

oscat_basic/POUs/Engineering/Control/FT_PID.TcPOU


 IF TN > 0.0 THEN 
 	integ(IN := IN, K := 1.0 / TN, RUN := IEN, RST := RST, OUT_MIN := ILIM_L, OUT_MAX := ILIM_H); 
 ELSE 
 	integ(RST := FALSE); 
 END_IF; 

I also filed a bug report in Bug in FT_PID · Issue #39 · RWTH-EBC/AixOCAT · GitHub

I can propose a bug fix to the github project if that is the appropriate place to do it.

Edit: I have proposed the change in Fix bug in FT_PID and increment version · dfreiberger/AixOCAT@d8fbb9a · GitHub . I believe this will cause no adverse effects as the integral term will always be set to 0 if TN is 0. I realize there is an IEN input which could be used to turn off the Integral term, however in my case I would prefer to just set the Tn constant to 0 and achieve the same thing (realizing that mathematically this makes no sense given it is a divide by zero). If others don’t agree, then an alternative approach would be to provide some error indication when the TN term is 0 so that the user is aware that the function block will not behave.