# PID Controller

Navigation: Main Page -> Models -> Control Models

## General Description

The PID unit is used to simulate simple PID plant control functions. If the user requires more complicated controls that involve loops, then the General Controller should be used.

• A single PID controller unit can be used to simulate a number of independent PID controllers on the plant. The user may enter the required number of PID controllers in the Count field on the first page of the Access window.
• The control logic used to manipulate the variables is executed once at the end of each SysCAD iteration.
• The PID controller may be used in Steady State or Dynamic mode.
In Dynamic mode it closely simulates an actual plant PID loop.
In Steady State mode the time dependent factors are not used in the traditional manner, instead each iteration is treated as a "one second time increment".

### The Referenced Tags

The PID Output tag and the Measured tag, will have coloured triangles shown in the access window of those units. When the user right clicks on one of these referenced tags it will indicate which PID is referencing the tag. See Controlled and Referenced Variables.

### Convergence in Steady State

In Steady State, the requirement for the measured value to equal the set-point is included in the convergence criteria. Therefore, the SysCAD Steady State solver will continue with iterations until this objective is met within the defined tolerances for at lease three consecutive iterations.

If the output of a controller is at it's minimum or maximum output limit, then the PID is excluded from these criteria and the solver can stop even though the set-point is not achieved. This is because the output can no longer influence the measured value to achieve the required set-point value. A condition error message is given to alert the user to this.

The following videos are part of the Tutorial showing users how to use PID Controllers:

### Diagram

The diagram shows the default drawing of a PID controller.

This screen dump shows variables used and calculated in the PID Controller (This is for SysCAD 9.3 Build 137).

## Inputs and Outputs

There are no connections to this unit.

## Model Theory

The classical PID algorithm as shown below is used in the model:

$\mathbf {\mathrm{u(t) = K e(t)+\frac{1}{T_i}\int e(t)dt + T_d\frac{de(t)}{dt}}}$

Where:

u(t) = the control action or output variable at time t in seconds;
e(t) = the error (or deviation) w(t) - y(t): the difference between the set point w(t) and the measured variable y(t);
K = the Gain;
Ti = the Integral time;
Td = the Derivative time.

For a full description of the theory, please see the reference below.

### References

Clarke D.W, PID Algorithms and their computer implementation, Dept of Engineering Science, University of Oxford Trans Inst M C Vol 6 No 6 Oct-Dec 1984

### Applying the Measured and Output Range

Each PID implementation works on normalised values. So the measured and setpoint values are scaled between 0 and 1 where 0 is InMin and 1 is InMax. The PID algorithm then works in this scaled values. This scaling needs to be taken into account when computing the effective open loop gain of the process as seen by the PID controller.

• MeasScaled = (Meas-InMin)/(InMax-InMin)
• SetpointScaled = (Setpoint-InMin)/(InMax-InMin)

The PID algorithm is performed on the scaled values and calculates OutScaled.

Then OutScaled is converted to final Output value to be set based on the Output Range:

• Output = OutMin+OutScaled*(OutMax-OutMin)

### SetPoint at or near measured limits

The SetPoint for the PID should be within the measured range. Ideally this should not be "close" to the limits as this does not give a significant error term and hence the PID action can be "inefficient". This setpoint tolerance for "close" is 10% relative to the user specified measured minimum and maximum. SysCAD gives a warning message when the setpoint value is within this tolerance of the defined measured minimum or maximum. In SysCAD, to still give a reasonable error term to drive the PID action when the setpoint is within tolerance of the measured limits, an adjusted measurement minimum or maximum is used. A value equal to the setpoint value less 10% is used for measured minimum when the setpoint is close to the user specified measured minimum. A value equal to the setpoint value plus 10% is used for measured maximum when the setpoint is close to the user specified measured maximum. Therefore the MeasScaled described above is adjusted accordingly.

In the special case where the setpoint is equal to the measured limit and also equal to the measured value, then the PID output is set to the output minimum or maximum (according to measured limit and reverse action). This is because the setpoint has been met and there is no error term to drive the output (and hence any previous output may appear correct when in fact an alternate output value is expected).

## Data Sections

The default PID Controller access window consists of 3 sections. The number of sections in the access window will depend on the number of independent PID controllers required by the user.

In SysCAD 9.3 each independent PID controller is displayed on a separate page.

### Summary of Data Sections

1. PID tab - Contains a summary of all of the individual PIDs contained in the unit. This is only available in SysCAD 9.3.
2. P1 tab - In SysCAD 9.3 each individual PID has it's own page - starting at 1 for the first PID. (Previous versions had 2 individual PIDs per page) This page contains all of the information for each individual PID.
3. Info tab - Contains general settings for the unit and allows the user to include documentation about the unit and create Hyperlinks to external documents.

Unit Type: PID - The first tab page in the access window will have this name.

### P1: Individual PID Data Fields

Each independent PID has the following layout.

• In SysCAD 9.3 each individual PID is displayed one per page.
• In SysCAD 9.2 the first PID is displayed on the first page and each page thereafter displays two PIDs.

## Adding this Model to a Project

Insert into Configuration file

Sort either by DLL or Group.

 DLL: Control1.dll → Units/Links → Control: PID or Group: General → Units/Links → Control: PID

See Project Configuration for more information on adding models to the configuration file.

Insert into Project

 Insert Unit → Control → PID

See Insert Unit for general information on inserting units.

## Hints and Comments

1. If one of the PID controllers contains a tag that is invalid, SysCAD will not begin execution, but will flag that user that there is an error in the PID controller. Check the Messages window for a list of the invalid tags.
2. If a PID controller ceases controlling, it may be that the measured variable is outside of the user defined minimum and maximum values. If this is the case, adjust the minimum or maximum so that the measured variable falls within the limits.
3. If the response of a independent PID is too fast, it will bounce around and never converge. In ProBal mode, increase the proportional band until the response settles down. In dynamic mode, the integration factor should be increased, either alone, or in conjunction with an increase in the proportional band.
4. Users can take advantage of the controller auto-tuning functionality to help tune controllers in the project. This often result in projects converging much faster with well tuned controls and is especially useful if many controllers have been used. To find out how, please refer to Trend Window (with PID Controllers).
5. Control engineers using SysCAD may complain that the PID controller Direct / Reverse action is opposite to what they are used to. This is due to the fact that SysCAD uses the process response to determine the direction, not the process gain. For example, for this model to work properly, the line of thinking should be as such:
a) Steam is added ↑ to raise ↑ the temperature in the tank. So the process response in the same direction, thus this should be left un-ticked.
b) Cooling water is added ↑ to reduce ↓ the temperature in the tank. So the process response is in the opposite direction, thus this should be ticked.
6. The problem above can be rectified by selecting the newly implemented method 4-Clark FF under Type. Reverse Acting (SP - PV) Used when the process gain is positive. Direct Acting (PV - SP) Used when the process gain is negative.
7. Each PID implementation scales the measured variable and control output between 0-100%. The PID algorithm thus works in this scaled range. This scaling needs to be taken into account when computing the effective open loop gain of the process as seen by the PID controller.
• Process Measurement Scaling : Kin = 100/(Inmax-Inmin)
• Control Output Scaling : Kout = (Outmax-Outmin)/100
• Process Gain with Eng Units : Ku
• Unitless Process Gain as Seen by PID : K = Kout*Ku*Kin = (Outmax-Outmin)/(InMax-InMin)*Ku