PID

(Engine-Level Function)

Description Perform PID Controller Function. This function returns a control value to maintain a parameter at a given setpoint.
Returns Numeric
Usage Steady State only.
Function Groups Variable
Related to: Deriv | Intgr
Format: PID(PV, SP, Mode, Track, LowLimit, HighLimit, P, I, D, Bias, Time)
Parameters  
PV
Required. Any numeric parameter which gives the "process variable" to be maintained at the given setpoint.
SP
Required. Any numeric parameter that gives the value to use for the "setpoint." The PID function will change its return value to make the PV value match the SP value.
Mode
Required. Any numeric parameter giving the manual/auto mode for the function. When the parameter is not equal to 0, the function is in auto mode and uses the PID algorithm to control the output.
When the parameter is equal to 0, the function simply returns the value of the Track parameter. When the mode switches from manual to auto, the PID function implements a "bumpless transfer." This results in a smooth output change rather than an abrupt change.
This is done by forcing the internal integral to assume a value which forces the PID function to output a value which matches the Track parameter at the moment of the change. The integral value will not, however, exceed the value imposed upon it by the LowLimit and HighLimit parameters.

Mode

Algorithm

Derivative

Gains

0

Manual

N/A

N/A

1

Normal

Uses PV

Independent

2

Normal

Uses PV

Dependent

3

Normal

Uses Error

Independent

4

Reverse

Uses Error

Dependent

5

Reverse

Uses PV

Independent

6

Reverse

Uses PV

Dependent

7

Reverse

Uses Error

Independent

The PID function operates in eight automatic modes and one manual mode. These modes are listed in the above table. If in doubt, use mode 1 or 5.
The Action column in the above table indicates whether the PID function operates using normal action (SP - PV) or reverse action (PV - SP). With normal action, when PV increases, the function output decreases. With reverse action, when PV increases, the function output increases also.
The Derivative column in the above table indicates whether the PID function derivative bases its value upon PV or the error between PV and SP. For normal action, the error is (SP - PV). For reverse action, the error is (PV - SP). The difference between the two modes is only clear when the setpoint (SP) is changed. If the derivative uses PV, the response to setpoint changes is normal. If the derivative uses the error, the response to setpoint changes is faster but usually produces an abrupt change in the PID function output which is often undesirable.
The Gains column in the above table indicates which PID equation is used. Refer to the "Comments" section for these equations. The independent gains equation uses seconds as the time base and the gain parameter (P) does not affect either the integral or derivative. The dependent gain equation is the ISA equation. It uses minutes as the time base and the gain parameter (P) affects both the integral and derivative.

Track
Required. Any numeric parameter that gives the function output value when in manual mode (i.e. Mode equal to 0). When in auto mode, this parameter is ignored except at the instant immediately following the change from manual to auto mode.
LowLimit
Required. Any numeric expression giving the minimum value allowed for the PID function. The integral component may grow to a very large value if the setpoint (SP) is outside the controllable range.
Physical plant limitations may prevent the PV value from reaching the SP value. In such situations, the controller will respond very slowly to bringing the SP within the controllable range since it will take a long time for the large integral value to increase to the correct value.
The LowLimit parameter puts a lower bound on the value of the PID function. It does this by limiting the value of the internal integral that results in instantly regaining control after the setpoint is brought back into the controllable range. This feature is sometimes called "anti-reset windup."
HighLimit
Required. Any numeric expression giving the maximum value allowed for the PID function. This is similar to the LowLimit parameter except that it handles the upper limit for the PID function output.
P
Required. Any numeric expression giving the "proportional" or "gain" contribution to the PID output. It has no units (dimensionless).
I
Required. Any numeric expression giving the "integral" or "reset" contribution to the PID output. For independent gains, the units are inverse seconds and the I parameter is used directly as the gain for the integral portion of the PID equation.
For dependent gains, the units are minutes and the P parameter divided by I is used as the gain for the integral portion of the PID equation. Refer to the "Comments" section for the equations.
D
Required. Any numeric expression giving the "derivative" or "rate" contribution to the PID output. For independent gains, the units are seconds and the D parameter is used directly as the gain for the derivative portion of the PID equation.
For dependent gains, the units are minutes and P times D is used as the gain for the derivative portion of the PID equation. Refer to the "Comments" section for the equations.
Bias
Required. Any numeric expression giving the output offset or feed forward input. This value is added to the output value. Refer to the equations in the "Comments" section.
Time
Required. Any numeric expression giving the time interval in seconds between integral and derivative updates for the PID function. This value results in a smoothing of the derivative values for the sampled process data of VTScada .
The longer the time, the greater the smoothing. The shorter the time, the faster the controller response. A suggested time interval is the I/O update time for the PV parameter.
Comments Typically, this function is used to set a variable that controls a process output point. The equations used for this function follow.

Independent Gains Equation:

CV = P * E + I *∫ E dt + D * dA/dt + Bias

Dependent Gains Equation (ISA):

CV = P * (E + 1/I *∫ E dt + D * dA/dt) + Bias

Where:

  • CV PID function output.
  • E Error. E = (SP - PV) for normal action modes and E = (PV - SP) for reverse action modes.
  • A Derivative selection. For modes with the derivative based upon the PV value, A = PV. For modes with the derivative based upon the error value, A = E.

PID control may be done by a PLC or other device rather than VTScada. Setpoints, coefficients, and so forth may be read and written by VTScada I/O drivers. This form of PID control does not involve use of the VTScada PID function. See the reference manual of the PLC or other device and the VTScada I/O driver manual for more.

Example:

{ Valve loop controller for heat exchanger }
valvePos = PID(cooledTemp { Process value },
               cooledSP { Setpoint for cooled temperature },
               Cond(valveManual, 0, 5)
               { Manual or reverse acting deriv
               uses PV, independent gains },
               manValvePos { Track value used in manual mode },
               0, 1 { Lower/upper limits of valve position },
               0.1 { P coefficient - proportional gain },
               0.5 { I coeff - integral gain or reset time },
               0.02 { D coefficient - derivative gain or rate },
               0 { Output bias },
               0.5 { Update loop every half second });

This performs PID control of a heat exchanger. A valve is used to control a temperature given a setpoint. If valveManual is true, the PID simply updates its internal integrators every half second using manValvePos. If valveManual is false, PID control is updated every half second. The P, I, and D gains are constants, but might be variables, to allow online tuning.