PID Controller

From SysCAD Documentation
Jump to: navigation, search

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.

Video Links

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

Diagram

Models-Controlle1-image001.gif

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).

PID 9.3 137.png

Inputs and Outputs

There are no connections to this unit.

Model Theory

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

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

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.

PID

Tag / Symbol Input/ Calc Description

Common Data on First Tab Page

On Tick Box The Overall PID unit will be enabled or disabled using this box. This means that all of the independent PID controllers in the unit will be disabled.
The following message and field is visible when upgrading the project with existing PID Controllers from SysCAD 9.2 (or earlier) to SysCAD 9.3.
Change numbering to start from 1 instead of 0.
NB this affects Tags. Example: xxx.Cfg[0].Meas becomes xxx.Cfg[1].Meas
ChangeNumbering Button Update Numbering to Start from 1 instead of 0. Only visible if the PID Controller was added in SysCAD 9.2 or earlier version.
NB: this may affect external tag references such as reports, PGM, please adjust the external references appropriately if updating the controller numbering.
ShowCnv Tick Box With this option selected, SysCAD will display engineering units for tags such as Spt, Meas, Output, InMin/Max and OutMin/Max. Note that these will only be displayed after SysCAD has completed at least one iteration.
Count Input The number of independent PID controllers required. This may be any number from 1 upwards. The user may also change this number at any time. The unit will always add new PID controllers after existing ones.
In SysCAD 9.3 the user may delete individual PIDs using the 'Delete Me' button.
In SysCAD 9.2 and previous versions when a user decreased the number of PIDs in a unit, the last controller(s) would be deleted. e.g. if you have 5 PIDs set up and you change this to 4, PID number 5 will be deleted. So if you do not want PID number 1, the best is to turn this off individually or use the priority field to change its display order.
Check Tags Button SysCAD will perform a check on the validity of the tags and functions used in the PID controllers.
Summary This is only available in SysCAD 9.3 and shows two summary tables with the following values for each individual PID in the unit.

PIDSummary 137.png

First Summary Table:
PID Display The PID number
On Tickbox The user may enable or disable each individual PID on the first page.
SptUsed Display The actual set point for the individual PID.
Meas Display The measured value for each individual PID.
OutUsed Display The output value for each individual PID.
RelError Display The relative error for each individual PID - i.e. the error between the set point and the measured value.
Second Summary Table:
PropBand Input The Proportional Band (inverse of the Gain) for each individual PID. The user may change this value here or on the page for the individual PID.
SptUnitTag Display The SysCAD Tag used for the SetPoint. Only visible if one or more of the PIDs have the UseSetPointTag option enabled.
MeasUnitTag Display The SysCAD Tag used for the Measured Value.
OutputUnitTag Display The SysCAD Tag used for the Output Value.

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.
Tag (Long/Short) Input / Calc Description

Tag.Cfg.[PID number]

On Tick Box This can be used to enable or disable the independent PID.
Name Input The user may give the PID a name that describes the control, e.g. Autoclave steam control.
Type Clark This method is recommended for most applications.
Clark FF This method refers to controller Direct/Reverse acting in the form of Process Gain, as well as having extra fields such as Bias for Proportional control and Feed Forward cross reference.
Description Input Only available in Build 137 or later. The user may enter a description of the PID controller as text. This field is handled by SysCAD like a normal tag, therefore it can reported and set via Excel.
UseSetPointTag Tickbox If this is enabled, then the user can use a SysCAD tag/function as the setpoint. If this is not ticked, then a constant value is expected for the setpoint.
Current values
SetPointValueUsed / SptUsed Output The Set Point value used. The value is either a fixed user defined Set point value or it changes according to the user defined Set Point Tag.
MeasuredValue / Meas Output The measured variable, or more commonly called the Process Variable or PV. The PV is measured and acts as an input to the Controller which takes action based on the value of the PV. Alternatively the PV can be measured and displayed so that the operator can perform manual control.
OutputValueUsed / OutUsed Output The current value of the Controller Output Signal (OP).
RelativeError / RelError Output The relative error - i.e. the error between the set point and the measured value.
SetPoint
SetPoint / Spt Input The Target Value of the Process Variable (Meas), it should be between the minimum and maximum input values.

Note: This field is only visible if the UseSetPointTag option is Disabled.

SetPointTag Input

This can either be a SysCAD tag or a function:

  • Any SysCAD tag may be copied to this field as the set point tag.
  • The user may type a function into this field. The first character must be an '=' followed by a valid expression. (See the PGM documentation for the required syntax.)

The value of the calculated set point will be displayed in the SetPoint box.
Note: This field is only visible if the UseSetPointTag option is Enabled.

Measured tag (input) and expected range
MeasTag Input The Measured variable (sometimes called the Process Variable or PV). The Measured variable acts as an input to the Controller which takes action based on the difference between the Measured variable and the Set Point.

The Measured variable can either be a valid SysCAD tag or a function. If it is a function, the first character must be an '=' followed by a valid expression. See the PGM documentation for the required syntax.

MinimumInput / InMin Input The expected minimum value of the Measured variable. If the relative difference between this Minimum value and the Set Point is too small, SysCAD will flag a warning and adjust the range that is used to carry out the control.
MaximumInput / InMax Input The expected maximum value of the Measured variable. If the relative difference between this Maximum value and the Set Point is too small, SysCAD will flag a warning and adjust the range that is used to carry out the control.

Note: If the actual value of the Measured variable moves outside of these expected values, the controller will not operate efficiently.

FeedForwardTag Input Only appears for Method Clark FF:
Cross reference tag that specifies the amount of feedforward in units of the control output. Typically this value would be calculated in another controller.
Controlled tag (output) and range limits
OutputTag Input The tag that the PID Controller will set, or the Output Signal (OP). This must be a valid SysCAD tag that can be adjusted by the user, i.e. it MUST be a white field.
OutputValue / Out Input/Output Only available in Build 137 or later. The current value of the Controller Output Signal (OP). This is an input field when the model is stopped or if the PID is in manual mode.
MinimumOutput / OutMin Input The minimum value that the PID controller may send to the Output tag, or Output Controller Signal (OP). Ignored if PID is in manual mode.
MaximumOutput / OutMax Input The maximum value that the PID controller may send to the Output tag, or Output Controller Signal (OP). Ignored if PID is in manual mode.
Settings
Auto Tick Box This emulates the auto/manual function of a controller. If this option is switched off, then the controller is in manual and will no longer control automatically. Instead, the user may set the output of the controller to a fixed value. This value may exceed the output range.
SptTrk Tick Box This field only appears in a dynamic project. If the controller is in manual (Auto check box is unchecked), then if this option is switched on, the setpoint of the controller will set to the measured value.
TrackMinMaxMeas Tick Box This field only appears in a dynamic project. If this option is disabled then the user will stop receiving warnings when the measured value is outside the specified range of InMin to InMax.
TrackMinMaxOut Tick Box This field only appears in a dynamic project. If this option is disabled then the user will stop receiving warnings when the output value is at either of the specified limits (OutMin or OutMax).
ReverseActing / Reverse Tick Box The direction in which the PID controller will operate.

For Method - Clark:

This refers to the process response, which is opposite of what the control engineers' definition of process gain. For example, for this model to work properly, the line of thinking should be as such:

1) 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.

2) 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.

For Method - Clark FF:

Direct/Reverse Acting is implemented in the traditional way, thus opposite of what the Original and Clark method does.

3) Reverse Acting (SP - PV) Used when the process gain is +ve. A process measurement increase causes a control output decrease. For example Inlet Flow to Tank Level - if the Tank Level is above Setpoint then we need to reduce the inlet flow.

4) Direct Acting (PV - SP) Used when the process gain is -ve. A process measurement increase causes a control output increase. For example Outlet Flow to Tank Level, if the Tank Level is above setpoint we need to increase the outlet flow.

Gain Input This uses the Proportional Control which is the main and principal method of control. It calculates a control action proportional to the error. Where Error is the difference between PV and SP. The Gain is applied to scale the size of the control action based on error. Using Proportional Control alone cannot eliminate the error completely.

Gain represents the power of the control action. The larger the Gain, the stronger the control (or more difficult to control). Therefore, user must not use a Gain larger than really necessary as it affects the stability of the process.

PropBand Input The proportional band (PB) of the Proportional control. It is calculated as PB(%) = 100 / Gain. User only need to enter values for either Gain or PB, the other is calculated using the above formula.
Integral Input The integral time constant of the Integral control. Integral control is used to control towards no error, thus to assist the Proportional control. When a value is input in this field, we are using the PI Control.

For Method - Clark:

The integral term can not be turned off.

Its value is set to max(Integral,m_Period/2) where Integral is the selected integral reset time and m_Period is the period of execution of the PID controller. Integral action cannot be turned off in the PID3 implementation as there is not a Bias.

For Method - Clark FF:

Integral action is turned off when Integral=0.0

If Integral is non zero the Integral reset time used by the PID is set to max(Integral,m_Period/2) where Integral is the selected integral reset time and m_Period is the period of execution of the PID controller. When you do not use integral action you usually need to specify a Bias signal for the P Only or PD controller output to operate around.

Derivative Input The derivative time constant of the Derivative control. Derivative control is used to add stability. Note: This is generally only used in Dynamic mode. This would normally be 0 in ProBal mode.
Bias Input Only appears for Method Clark FF:

For proportional controllers only. The controller output will equal bias when the error is zero, thus bias is adjusted so that the controller output are at their nominal steady state value. It has the same units as the control output.

Options
TrackSptRange Tick Box If this option is disabled then the user will stop receiving warnings when the setpoint value is close to the limits of the specified range of InMin to InMax.
Tune Rule Input The user may select a tuning rule to use when automatic tuning is used. The user may select between Proportional only (P), Proportional and Integral (PI) or Proportional, Integral and Derivative (PID).
Priority Input Only available in SysCAD 9.2 and earlier versions. This is redundant in SysCAD 9.3 due to the buttons described below.
If more than one controller is used, the user may set the priority of the controllers. This changes the order the controllers are displayed. If the user wants to delete an unwanted controller, assign it with the lowest priority (thus the largest number) to move it to the last position.
FeedFwd Output Only appears for Method Clark FF:
The value corresponding to that specified in the FeedForward_Tag.
Buttons The following 3 buttons are only available in SysCAD 9.3.
Delete Button This allows the user to Delete the current individual PID. Please note that there is no 'Undo'!
MoveUp Button This allows the user to increase the Priority of the current individual PID. For example, if the current PID is number 3, the user can change it to 2 or 1 by clicking on this button once or twice.
MoveDown Button This allows the user to decrease the Priority of the current individual PID. For example, if there are 3 PIDs in the unit and the current PID is number 1, the user can change it to 2 or 3 by clicking on this button once or twice.
Control Tolerances
Tol.SigDigits Input Only visible in SysCAD 9.3. Relative Tolerance in the form of Significant Digits. SigDigits = -log(Tol.Rel).
Tol.Rel Input Relative Tolerance, allows user to loosen or tighten the control.
Tol.Abs Input Absolute Tolerance, allows user to loosen or tighten the control.
Referenced Units
SetPointUnitTag Output Returns the Unit Tag for the Set Point Variable, if used.
MeasUnitTag Output Returns the Unit Tag for the Measured Variable.
OutputUnitTag Output Returns the Unit Tag for the Output Variable.

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