Professional Documents
Culture Documents
The following deals with PID and related instructions used in basic (single loop)
Process Control Applications. Cascaded and complex loops are best suited for the
CS1W-LC001 card ( loop control unit).
The input and output circuitry for the loop must also be defined to use the following
instructions. The following chart suggests the common use of these instructions and the
related hardware.
INPUT OUTPUT
CS1W-AD041,081,MAD44 CS1W-DA041,08V,08C,MAD44
CJ1W-AD041,081,MAD42 CJ1W-DA021,041,MAD42,081
CS1W-CT021,CT041
CJ1W-CT021,041
CJ1W-TC***
1
ISOLATED INPUT ISOLATED OUTPUT
CS1W-PTS** THERMOCOUPLE/RTD CS1W-PMV01 ANALOG
CS1W-PTW01 TRANSMITTER
CS1W-PDC01 ANALOG
CS1W-PTR01 PWR. TRANSDUCER
CS1W-PTR02 MILLIVOLT
CS1W-PPS01 PULSE
Note : C200H Type cards may be used with CS1 ( i.e. C200H-DA003, AD003)
CJ1W-TC*** is a full closed loop Temperature control card with pulsed out,
PID ladder instruction is not required (but can be used where analog output card is used)
3 Mining
- Pumping of Explosive Emulsion into drilled holes for un-manned
4 Automotive
- Parts Heat-treating, Paint Curing Booths
- Parts Molding - Bumpers
2
Limit Control LMT
Purpose Controls output data according to whether or not input data is within
upper and lower limits. Can be used to filter PID MV output data to analog card,
however, PID has internal MV output upper and lower limits.
Variations
Executed every scan LMT
Executed on rising edge of input condition(s) @LMT
Operands
S SOURCE WORD CIO,W,H,A,T,C,D,E,@D,*D,@E,*E,DR,#,&
C FIRST LIMIT WORD CIO,W,H,A,T,C,D,E,@D,*D,@E,*E
D OUTPUT WORD CIO,W,H,A,T,C,D,E,@D,*D,@E,*E,DR
3
Example Rung ( Captured during Run-Time in CX Programmer ver 3.0 )
The PIDAT instruction outputs 0000 0FFF hex ( 0-4095 decimal UINT) to the
analog output card allocated word, CIO 2001. LMT is used send a filtered copy of this to
CIO 3001 . The Lower Limit is stored in DM2000 (100 UINT ) and the Upper Limit in
DM2001 (3900 UINT). At this moment the PIDAT output is 0 which is below the lower
limit of 100, therefore 100 is output to CIO 3001.
4
Lab Exercise For LMT
2 Create the following Ladder in the new Project, main task ( section 1)., offline.
3 Download the Project to the PLC, note you may use other operands if you wish
provided they are applicable. Input Data could be from an analog input card if the
card is setup and is provided a signal. The upper and lower limits could be entered
from the NS7 screen provided the data type is set to INT or UINT , signed or
unsigned binary expressed in Decimal. The output data could go to an Analog output
card ( DA) provided it is setup in which case a DVM can be used to monitor output.
5
4 After downloading, set the PLC to Monitor Mode, and open the Watch Window
( VIEW/ WINDOWS/ WATCH). Enter the Addresses as shown into the Watch
Window.cells with data type INT.
5 Set the Lower Limit DM1 to 100, and the Upper Limit DM2 to 100.
6 Set DM0 the input data to values below the lower limit, within the limits and above to
Upper Limit . Observe to corresponding Output Data.
6
Dead Band Control BAND
Purpose Controls output data according to whether or not input data is within
upper and lower limits of the range (dead band range).. The input data is 16 bit binary
(INT) .
Variations
Executed every scan BAND
Executed on rising edge of input condition(s) @BAND
Operands
S SOURCE WORD CIO,W,H,A,T,C,D,E,@D,*D,@E,*E,DR,#,&
C FIRST LIMIT WORD CIO,W,H,A,T,C,D,E,@D,*D,@E,*E
D OUTPUT WORD CIO,W,H,A,T,C,D,E,@D,*D,@E,*E,DR
7
Lab Exercise For BAND
1 Use a copy of the file from the last LAB ( LMT ) with Global Symbols .
3 Download the Project to the PLC, note you may use other operands if you wish
provided they are applicable. Input Data could be from an analog input card if the
card is setup and is provided a signal. The upper and lower limits could be entered
from the NS7 screen provided the data type is set to INT or UINT , signed or
unsigned binary expressed in Decimal. The output data could go to an Analog output
card ( DA) provided it is setup in which case a DVM can be used to monitor output.
8
4 After downloading, set the PLC to Monitor Mode, and open the Watch Window
( VIEW/ WINDOWS/ WATCH). Enter the Addresses as shown into the Watch
Window.cells with data type INT.
5 Set the Lower Limit DM1 to 100, and the Upper Limit DM2 to 100.
6 Set DM0 the input data to values below the lower limit, within the limits and above to
Upper Limit . Observe to corresponding Output Data. Note there is no output in the
Dead Band.
9
Scaling SCL
ENGINEERING
UNITS , BCD
Variations
Executed every scan SCL
Executed on rising edge of input condition(s) @SCL
Operands
S SOURCE WORD CIO,W,H,A,T,C,D,E,@D,*D,@E,*E,DR,#,&
P1 FIRST PARAMETER WORD CIO,W,H,A,T,C,D,E,@D,*D,@E,*E
R RESULT WORD CIO,W,H,A,T,C,D,E,@D,*D,@E,*E,DR
10
Common Application
The most common application for the SCL instruction is scaling Analog (AD) input
signal into Engineering Units ( mm, PSI, RPM etc.) In this case the Analog input card
resolution (full scale) is set for P1+1 and P1+3. The desired corresponding minimum
output value and maximum output value are specified in P1 and P1+2.
Create and test the above ladder with Symbols as shown in the Watch Window.
11
Scaling 2 SCL2
Purpose Converts signed binary ( Hex) data to signed BCD data according to
a linear relationship stored in parameter area words P to P1+2.. Unlike SCL, SCL2 uses
an offset and slope to define the linear interpolation. If a negative value is output, the
absolute value is written to the output word and the Carry Flag turned on (CF004).
Variations
Executed every scan SCL2
Executed on rising edge of input condition(s) @SCL2
Operands
S SOURCE WORD CIO,W,H,A,T,C,D,E,@D,*D,@E,*E,DR,#,&
P1 FIRST PARAMETER WORD CIO,W,H,A,T,C,D,E,@D,*D,@E,*E
R RESULT WORD CIO,W,H,A,T,C,D,E,@D,*D,@E,*E,DR
12
Common Application
The most common application for the SCL2 instruction is scaling a 10-10VAnalog
(AD) input signal into Engineering Units ( mm, PSI, RPM etc.) In this case the Analog
input card resolution for 10 to 10V (full scale) is used. The desired corresponding
minimum output value and maximum output value are specified as a delta values .
Create and test the above ladder with Symbols as shown in the Watch Window.
13
Scaling 3 SCL3
Purpose Converts signed BCD data to signed Binary data according to a
linear relationship stored in parameter area words P to P1+4.. Like SCL2, SCL3 uses an
offset and slope to define the linear interpolation. If a negative value is to be output, the
BCD absolute value is written to the source word and the Set Carry instruction executed
STC(40). When positive values are to be output, ensure the Clear Carry instruction is
executed CLC(41).
Variations
Executed every scan SCL3
Executed on rising edge of input condition(s) @SCL3
Operands
S SOURCE WORD CIO,W,H,A,T,C,D,E,@D,*D,@E,*E,DR,#
P1 FIRST PARAMETER WORD CIO,W,H,A,T,C,D,E,@D,*D,@E,*E
R RESULT WORD CIO,W,H,A,T,C,D,E,@D,*D,@E,*E,DR
14
Common Application
The most common application for the SCL3 instruction is scaling any Analog (DA)
Output signal from Engineering Units ( mm, PSI, RPM etc.) to the Analog Output card
resolution (e.g. CJ1W-DA041 0000 FAO h). Either the ladder program or a data input
(BCD) from a touch screen generates the unscaled BCD value in Engineering units and
SCL3 is used to convert this to the units required by the analog output card to generate
the analog signal..
E.G. Output to VFD 0 1750 RPM BCD specified in DM99, CJ1W-DA041, point 1
controlling Drive Speed reference.
CSW-DA041 ANALOG OUTPUT
Setting 0-10V 0-FA0 Hex ( 0-4000 Decimal)
Unit 00 Point 1 CIO Address 2001
Create and test the above ladder with Symbols as shown in the Watch Window.
15
GENERAL PID INFORMATION
CONTROL VARIABLE: The process variable regulated by the process control loop.
SETPOINT SP (SV): An input variable which sets the desired value of the controlled
variable.
1. The input variable may be manually set, automatically set, or programmed.
2. It is expressed in the same units as the controlled variable.
DISTURBANCES: Disturbances are the parameters which affect the controlled variable,
but which are not capable of being controlled by the controlling process.
60
INTEGRAL TIME (sec) = ------------------
RESET (repeats/min)
60
DERIVATIVE TIME (sec) = --------------------
RATE (repeats/min)
16
Power input
(e.g. electricity, steam etc.)
Deviation (error). Output (MV)
Transd
Control Control element.
ucer Load.
circuit.
e.g.: relay, valve
Sensor
Feedback loop
17
PID
Purpose Controls output data according to P, I, D constants , the PID algorithm
and the input data S( PV). The algorithm performs target value filtered PID control with
two degrees of freedom. The controlled output data D is referred to as the MV
(manipulated variable) and is intended for an analog output signal . The SV (set value)
for the loop is specified in the first parameter word C.
Operands
S SOURCE WORD CIO,W,H,A,T,C,D,E,@D,*D,@E,*E,DR,#,&
C FIRST PARAM WORD CIO,W,H,A,T,C,D,E,@D,*D,@E,*E
D OUTPUT WORD CIO,W,H,A,T,C,D,E,@D,*D,@E,*E,DR
The Control words (39) determine how the PID instruction is configured for an
application and MUST be set correctly for the PID instruction to output D. The P,I,D
parameters are constants that are load dependant and we need ball park values to begin
control ( PIDAT is capable of determining these with AutoTuning).
Sampling Period This the rate that the PID algorithm is calculated and
the MV updated (slower than PLC scan time). 10ms- 99.99s
Forward Reverse Forward the MV goes up as the PV goes up(
Cooling) , Reverse the MV goes down as the PV goes up (Heating)
PID Constant refresh, when set on you may change PID on the fly.
MV output setting, when on the MV=50% at PV=SV or 0% MV when
PV=SV ( Is constant power required to keep load at SV once it gets there?)
2 PID Parameter Alpha Leave this at 0 ( Default)
Input and Output Range (Set to 04 for 12 Bit usually with Analog
I/O)
Integral and Derivative Unit
MV output Limit Control enable Use this when MV output limit is
required to prevent adverse load behavior ( eg water hammer).
18
Parameter Area Continued
Output Flags
19
Lab Exercise for PID OPEN LOOP
The above parameters set the loop up for Proportional control only for open
loop bench tests P is not a function of time, I and D are time related and
units are setup as 10*100ms = 1 second.
20
5. Enter the Set Value into D100, 100 representing the Boiling Point for an
imaginary kettle ( 100Deg C = Boiling)
Enter Values into CIO 2021 , PID Input Word simulating temperature
feedback.
Note:
- The Output 0 100% is seen in 2031 as 0000-4095, 12 bit binary
- When the PV=SV, MV=50% (Typical Heating Only Loop)
- C+5 Can be set so that when the PV=SV, MV=0% (Typical Heating
/Cooling Loop)
- A more narrow P Band causes unstable and more responsive loop, a
wider band promotes stability but lessens response
- Theory suggests that the proportional power is linear with the input ,
non linearities however, are handled by the PID algorithm
- The output is proportional to the error signal, the difference between
the PV and SV within the band otherwise 0 or full power is applied
- When I and D terms are added, a weighted sum of their actions
determines the MV output
21
PIDAT
Purpose Controls output data according to P, I, D constants that can be
Autotuned. When the autotune bit (control area) is turned on in closed loop conditions,
the P,I,D values are automatically set to their Optimal values . The autotune proceedure
cycles the loop twice to determine P,I,D and the time required for this depends on the
load dynamics.
Operands
S SOURCE WORD CIO,W,H,A,T,C,D,E,@D,*D,@E,*E,DR,#,&
C FIRST PARAM WORD CIO,W,H,A,T,C,D,E,@D,*D,@E,*E
D OUTPUT WORD CIO,W,H,A,T,C,D,E,@D,*D,@E,*E,DR
The Control words (41) determine how the PIDAT instruction is configured for an
application and MUST be set correctly for the PIDAT instruction to output to D. The
Autotuning bit C+9 Bit 15 executes the autotune command and can be set by ladder or in
the Watch Window. When autotuning is complete, the bit is reset and P,I,D values set.
Sampling Period This the rate that the PIDAT algorithm is calculated
and the MV updated (slower than PLC scan time). 10ms- 99.99s
Forward Reverse Forward the MV goes up as the PV goes up(
Cooling) , Reverse the MV goes down as the PV goes up (Heating)
PID Constant refresh, when set on you may change PID on the fly.
MV output setting, when on the MV=50% at PV=SV or 0% MV when
PV=SV ( Is constant power required to keep load at SV once it gets there?)
2 PID Parameter Alpha Leave this at 0 ( Default)
Input and Output Range (Set to 04 for 12 Bit usually with Analog
I/O)
Integral and Derivative Unit For specifing sample time
MV output Limit Control enable Use this when MV output limit is
required to prevent adverse load behavior ( eg water hammer).
AT Command Bit and AT Calculation Gain AT command bits starts
autotuning and acts as a AT status flag. Autotuning is done about the Set
22
Value when AT started and performed at the set AT Calculation gain (0000
= default AT gain, recommended)
Output Flags
23
Lab Exercise for PIDAT CLOSED LOOP
1. Edit the PID lab project Symbols by adding the AT channel symbol, tcinput 2013
and analogout 2001 to the existing symbols as shown below.
2. Create the Ladder code as shown below, down load to the PLC and set
the PLC mode to Monitor. (Create the I/O Table as required)
Create the rung below for the PID off condition. Note that when the PID
execution condition is off, the output word value will stay at the last
state, With PID off, it is also possible to perform manual control by
outputting values to the output word, 2001.
24
3. Check input circuit with power off to demo;
The CJ1W-TC001 is used only for temperature input. Any analog signal
may be used but must be in binary (INT) and with resolution specified in
C+6 (ie 12 Bit).
Assuming the CJ1W-TC001 is used;
- Set Unit Mach # 01, CIO2010-2019, DM20,100 -199
- Set Input Type to 2, J Type Thermocouple
- Set Dip Switches to 2,3,8 On (Deg F, Binary Data,) 1,4-7 Off
- Wire Thermocouple Negative to A1, Positive to A2
- Apply power, go on-line and monitor CIO 2013
- Carefully touch the thermocouple or apply heat and ensure the value
goes up, if not check thermocouple wiring polarity
- Note that &500 is 25% of maximum (4000) and should turn on the
Light Box partially
5 Set P,I,D to initial values as shown below.
6 Turn on Switch 0.00 to start regular PID control and set the Set value ,
D100 to 100 ( Deg F)
25
7 Once closed loop PID conditions are observed, Autotuning is possible.
- In the Watch Window Set C+9 to a Value of #8000, bit 15 on only.
- Monitor D109 , when it returns to 0000 autotuning is complete
26
10. Below is an example of a Screen for PID generate by CX-Supervisor
Note:
- Green Line Set Point
- Red Line Present Value
- Dark Blue MV, Output Power
- Yellow line Autotuning Status
1. Set Value is increase from 100 deg F to 110 and 30 % power required to
heat up to 110 with little overshoot.
2. At a stable 110 deg F, autotune is executed. The temperature drops and
the loop outputs 2 pulses of 100% power. The time for this depends on
the load thermodynamics.
3. When the auto tune is complete it automatically cancels the AT bit and
writes to the PID parameters.
4. Normal closed loop control resumes.
27
Step Response and Load Disturbance on Tuned System
Note:
- Green Line Set Point
- Red Line Present Value
- Dark Blue MV, Output Power
- Yellow line Autotuning Status
1. Set Value is set at 120 deg F and the switch 0.0 turned on to execute PID
from startup.
2. The MV spikes up to heat the load to the SV . A slight over-shoot
occurs.
3. The next MV pulse is a ringing affect attempting to stabilize the loop.
4. The next pulse, approx. 30% MV is a result of a disturbance, blowing on
the bulb/ thermocouple.
5. The switch is turned off and the PV falls to 114.
28
Training Simulator Loop
Power input
(electricity, 120 VAC.)
Output (MV)
CJ1W-
PIDAT G3PX SSR
TC001 Bulb.
CJ1-DA
E52
Feedback loop
Input Circuit
- E52-IC1D-W1/4 2M J Type Thermocouple
- CJ1W-TC001 Thermocouple Input from Light Bulb (Heat Source)
- CJ1W-TC001 is a complete PID Temp. control 4 loop card being used as input only
- PIDAT command OPW (output word) is set to the Analog Output card
PID Processing
- PIDAT Ladder instruction
Output Circuit
- G3PX-240EUN SSR takes 4-20mA in and sends 120 VAC phase controlled out
Load
- Small 120 VAC heat bulb and socket (Non Omron)
29
Appendix PID Tuning
Here is table showing the possible effects of manually altering various parameters. The
Autotune will derive the Optimal Values, which are a compromise between overshoot
and response (rise time).
Response
PID Parameter
Over/Under-shoot Hunting Response
Proportional Larger Decreases Decreases Longer
Band Smaller Increases Increases Shorter
Larger Decreases Decreases Longer
Integral Term
Smaller Increases Increases Shorter
Larger Decreases Increases Longer
Derivative Term
Smaller Increases Decreases Shorter
The following diagrams illustrate some typical results that may be obtained from
poorly tuned systems, and offer suggestions as to the corrective action that may
be taken: -
a) Overshoot at switch on
b) Hunting
30
Figure 14a.
Overshoot at switch-on.
Countermeasures
31
Figure 14b.
Hunting.
Countermeasures
32
Figure 14c.
Slow response to temperature/load change.
Countermeasures
33
Figure 14d.
Overshoot after temperature/load change.
Countermeasures
34
35