Professional Documents
Culture Documents
PID Unilogic
PID Unilogic
PID Unilogic
Home > Ladder > Ladder Functions (LF) > PID > How to Implement PID
PID
The UniStream PID algorithm is currently the same that is used by Vision series controllers.
PID enables you to use system feedback to continuously control a dynamic process. The purpose of PID control is to
keep a process running as close as possible to a desired Set Point. For more information, check the topic How PID
Works.
Run Autotune
Run PID
Save PID Autotune Data
Load PID Autotune Data
Reset PID Autotune
Force Error Integral
Pause Integral & Derivative Calculation
To implement PID, use the PID Ladder functions as explained in the next section.
In order to ensure proper PID function, you should use the Run PID Autotune function. During the Autotune
process, the function collects certain essential data. Unitronics' proprietary PID algorithm uses this data to run
smooth, accurate PID loops.
The PID Config struct contains all of the parameters you need to configure, tune, and control PID.
A PID Config struct is created by UniLogic when you include a PID Ladder function in your program; you can also right-
click in the Data Tag window to add one.
You use the PID AT Params struct to save the values from running autotune, load these values into the PID Config
struct, and then run your PID loop.
1. Place a Run PID Autotune function in
the Ladder.
You can either create a PID Config struct on the fly, or link an existing one.
2. Save the Autotune parameters into
a PID AT Params struct; use the
condition of the Autotune Complete
bit from the PID Config struct to
ensure that Autotune is complete.
Use this to to initialize or change the error value while the application is running. You can erase wind up error by
writing '0' into the function, which is written into the PID loop's Integral Value in the PID Config struct.
If conditions require, you can suspend these values and prevent them from changing. This may prove useful, for
example, in a temperature application, when an opened oven door can cause a temporary temperature drop.
PID Config Struct Parameters
Note that the PID Status messages are located in the PID struct.
Proportional Band (Kp) UINT16 Defines the proportional band, in units of 0.1%.
The proportional band is a percentage of the total Process Value (PV). It is a range defined around the Set
Point. When the PV is within this range, the PID function is active
Integral Time (Ti) UINT16 Defines the integral time, in units of 1 second.
Integral action responds to the rate of change in the controller’s CV output relative to the change in Error.
The integral time you set is the amount of time, as calculated by the controller, required to bring the
process to Set Point.
Note that integral (wind up) error may be initialized via the Force Error Integral ladder function.
Derivative Time (Td) UINT16 Defines the derivative time, in units of 1 second.
Derivative action responds to the rate and direction of change in the Error. This means that a fast change
in error causes a strong response from the controller. The derivative action ‘anticipates’ the PV’s value in
relation to the Set Point and adjusts the CV accordingly, thus shortening the PID function’s response time.
Sample Time (ST) UINT16 Defines the intervals between PID function updates, in units of 10mSecs.
Input Low Limit (PV) INT32 Defines the lower limit for the Process Value.
Input High Limit (PV) INT32 Defines the upper limit for the Process Value.
Output Low Limit (CV) INT32 Defines the lower limit for the Control Value.
Output High Limit (CV) INT32 Defines the upper limit for the Control Value.
Reverse Action BIT Turn Off to activate Reverse Action (control type = heating), ON to activate Direct Action ( control type =
cooling ).
Control Value (CV) INT32 The Control Value is the output from the PID function. CV is output from the PID function and input to the
process.
Note that this output signal may be an analog or time-proportional variable value.
Status INT16 Use these to implement {ID and to check PID status.
Value Message
0 status OK
4 PID running
5, 6 Setpoint change in progress
7 Integral-wind up
8Iintegral-wind down
9 Pause mode, Integral and Derivative values are not currently being calculated
10, 11 CV exceeds proportional band, no calculation performed
12, 13 AT parameter mismatch
14 Autotune complete
Note that this means that PID will run without Auto-tune. The user may either rewrite the PID values to the
32-MI long Auto-tune vector, or may re-run Auto-tune
PID AT Params Struct
Proportional Band (Kp) UINT16 Defines the proportional band, in units of 0.1%.
The proportional band is a percentage of the total Process Value (PV). It is a range defined around the Set
Point. When the PV is within this range, the PID function is active
Integral Time (Ti) UINT16 Defines the integral time, in units of 1 second.
Integral action responds to the rate of change in the controller’s CV output relative to the change in Error.
The integral time you set is the amount of time, as calculated by the controller, required to bring the
process to Set Point.
Note that integral (wind up) error may be initialized via the Force Error Integral ladder function.
Derivative Time (Td) UINT16 Defines the derivative time, in units of 1 second.
Derivative action responds to the rate and direction of change in the Error. This means that a fast change
in error causes a strong response from the controller. The derivative action ‘anticipates’ the PV’s value in
relation to the Set Point and adjusts the CV accordingly, thus shortening the PID function’s response time.
Sample Time (ST) UINT16 Defines the intervals between PID function updates, in units of 10mSecs.
Input Low Limit (PV) INT32 Defines the lower limit for the Process Value.
Input High Limit (PV) INT32 Defines the upper limit for the Process Value.
Output Low Limit (CV) INT32 Defines the lower limit for the Control Value.
Output High Limit (CV) INT32 Defines the upper limit for the Control Value.
Reverse Action BIT Turn Off to activate Reverse Action (control type = heating), ON to activate Direct Action ( control type =
cooling ).
Related topics