Beiträge anzeigen

Diese Sektion erlaubt es ihnen alle Beiträge dieses Mitglieds zu sehen. Beachten sie, dass sie nur solche Beiträge sehen können, zu denen sie auch Zugriffsrechte haben.


Nachrichten - dfreiberger

Seiten: [1]
1
oscat.lib fuer TwinCAT/CoDeSys / Bug in FT_PID
« am: 01. Juli 2020, 03:00:42 »
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 https://github.com/RWTH-EBC/AixOCAT/issues/39

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 https://github.com/dfreiberger/AixOCAT/commit/d8fbb9a371aa5e538c4bfc888e2fbcf68efef849#diff-f3eb3c3882f145dd0b49ddd242c991d5L43-L44 . 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.

Seiten: [1]