Creating a PID in control basic to avoid reset windup

I’m working to develop a PID loop that prevents windup and I need to be know the time between each cycle of the program. Does anyone know how I can read that?

The time between program cycles is not fixed, it will depend on the amount of basic running, communications and other tasks the controller is taking care of.

When you mention PID windup, and I confirmed this recently with Chelsea, our developer on the project, the integral term is hard limited once the PID hits 100% it cannot go any higher. As soon as the process hits setpoint the integral term and hence the full PID value will start going down right away.

You could test this for yourself by setting up a trend log and using some step impulses to the setpoint. Or you could suss through the source code yourself, its here:

And finally, if you do have a program you would like to run on a determinstic schedule you can use the time-on, time-off and interval statements. They are good up to one second resolution which should cover you for HVAC type applications.

10 IF INVERTVAL( 0:0:01 ) THEN GOTO 20 ELSE GOTO 40
20 REM ***** DO SOME STUFF HERE EVERY ONE SECOND***
30 REM ***** THIS STUFF RUNS EVERY SECOND OR TWO ***
40 REM ****************************************************************

Maurice,

I am using the PID loops in the T3-BB but I do see what appears to me to be “wind-up”. I’m doing this all through simulation but on a live controller. When I set up a PID with a 70°F setpoint and 70.1°F process variable and leave it that way for about 30 minutes after the PID output hits 100%, it takes too long to get the PID to come off 100% when I lower the process variable to 65°F. So long that I end up setting the Integral value to zero to get it move at all.

I’ve tried a combination of Proportional and Integral values from 1 and 1, 1 and 10, 4 and 4, 5 and 25, etc. Are there recommended value to start with based on the process i.e. discharge air temp control, static pressure control, room temp control etc?

I put together this logic and it seems promising. I don’t see the “wind-up” I’m seeing in the packaged PID’s.

1 REM “ON_TIME” HAS A VALUE OF10
2 REM “KP” HAS AN INTIAL VALUE OF 5
3 REM “KI” HAS AND INITIAL VALUE OF 0.10
4 REM “KD” HAS AN INITIAL VALUE OF 0.0

10 REM GET THE ERROR*
20 ERROR = RM_T - RMT_SP

30 REM CALCULATE PROPORTIONAL TERM*
40 PTERM = 100 / KP * ERROR

50 REM CALCULATE INTEGRAL TERM ( WITH ANTI-WINDUP )****
60 IF PRE_OUT > MIN_OUT AND PRE_OUT < MAX_OUT THEN ITERM = ITERM + KI / 10 * ERROR * ON_TIME

70 REM *********CALCULATE DERIVATIVE TERM **************
80 DTERM = KD * ( ERROR - P_ERROR ) / ON_TIME

90 REM COMPUTE PID OUTPUT*****
100 PID_OUT = PTERM + ITERM + DTERM

110 REM APPLY PID_OUT LIMITS****
120 IF PID_OUT > MAX_OUT THEN PID_OUT = MAX_OUT
130 IF PID_OUT < MIN_OUT THEN PID_OUT = MIN_OUT

140 REM SAVE VALUES FOR THE NEXT ITERATION*****
150 P_ERROR = ERROR
160 PRE_OUT = PID_OUT

170 REM OPTIONAL***********
180 PHTG_DMD = MAX ( PRE_OUT * -1 , 0 )
190 PECO_DMD = MIN ( 100 , MAX ( 0 , PID_OUT ) )
200 PCLG_DMD = MIN ( 100 , MAX ( 0 , PID_OUT - 100 ) )

Note I’m very new to the T3 so I may be missing something.

Our program code runs every 500ms, and the interval is not very precise.I recommend that you use our own PID function. With this function you can control the whole system yourself by simply adjusting the parameters. You can see T3000->HELP->contents

Here is my test demo, PID response is very fast.


However, Chelsea, your I term is set to zero, this is good for setting up your system during the commissioning phase and am glad to have you showing us this graph here.

Try the graph again wth some I term in this time.

This graph shows two PIDs and the setpoint changing over time in response to some step changes in the setpoint which is in green. We can focus attention on the red line which represents the heating PID loop.

At Tab3 we lowered the green setpoint, and as expected the red PID at Tab1 starts decreasing. The slope of the line is directly related to the I term building up over time. The red line keeps decreasing till it hits 0% at Tab5 and the blue cooling PID is at 100% at Tab4. The system is left for a few minutes and the red PID is left to windup.

There’s some jumping around with the setpoint but finally at Tab6 we can see the setpoint is lowered and immediately the red cooling PID is going down with no delay. If there were some windup we would see it here.

Conclusion: There is no reset windup in the T3000 PID loops.

The source code backs this up as well, the I term is clipped once the PID hits 100%. If you would care to dig around in the source code you can see this for yourself.

1 Like