The text of a manual · part 20 of 70
SLC 500 Instruction Set Reference Manual, pages 191 to 200
Pages 191 to 200 of 694
The original document is the PDF (7.2 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Allen-Bradley 1747-L514
Page 191
Proportional Integral Derivative Instruction
9-19
Control Variable Percent (CV%) Table 9.32 Control Variable Percent Parameter Output Parameter Address Descriptions
Data Format
Range
Type
User Program Access
CV% - Control Variable Percent word (INT)
0 to 100 status read only
Word 16
CV% (Control Variable Percent) displays the control variable as a percentage. The range is 0 to 100%. If the AM bit (word 0, bit 1 of the PID Control Block) is off (automatic mode), this value tracks the control variable (CV) output being calculated by the PID equation. If the AM bit is on (manual mode), this value tracks the value that can be manipulated in the control variable (CV) data word. If no change is made to the CV while in manual mode, the CV% will display the last value calculated by the PID equation.
Output Limiting Enable (OL) Table 9.33 Output Limiting Enable Parameter Output Parameter Descriptions
Address
Data Format
Range
Type
User Program Access
OL - Output Limiting Enable
Word 0, Bit 3 binary
1 = enabled 0 = disabled control read/write
A value of one enables output limiting to the values defined in Control Variable Maximum (Word 11) and Control Variable Minimum (Word 12). A value of zero disables OL (Output Limiting).
Publication 1747-RM001G-EN-P - November 2008
Page 192
9-20
Proportional Integral Derivative Instruction
Output Maximum (CVH) Table 9.34 Output Maximum Parameter Output Parameter Address Descriptions
Data Format
Range
Type
User Program Access
CVH - Output Maximum word (INT)
0 to 100% control read/write
Word 11
When the output limiting bit (OL) word 0, bit 3 of PID Control Block is enabled (1), the CVH (Control Value High) you enter is the maximum output (in percent) that the control variable attains. If the calculated CV exceeds the CVH, the CV is set (overridden) to the CVH value you entered and the upper limit alarm bit (UL) is set. When the output limiting bit (OL) word 0, bit 3 of PID Control Block is disabled (0), the CVH value you enter determines when the upper limit alarm bit (UL) is set. If CV exceeds the maximum value, the output is not overridden and the upper limit alarm bit (UL) is set.
Output Minimum (CVL) Table 9.35 Output Minimum Parameter Output Parameter Descriptions
Address
Data Range Format
Type
User Program Access
CVL - Output Minimum
Word 12 word (INT)
control read/write
0 to 100%
When the output limiting bit (OL) word 0, bit 3 of PID Control Block is enabled (1), the CVL (Control Value Low) you enter is the minimum output (in percent) that the Control Variable attains. If the calculated CV is below the minimum value, the CV is set (overridden) to the CVL value you entered and the lower limit alarm bit (LL) is set. When the output limiting bit (OL) word 0, bit 3 of PID Control Block is disabled (0), the CVL value you enter determines when the lower limit alarm bit (LL) is set. If CV is below the minimum value, the output is not overridden and the lower limit alarm bit (LL) is set.
Publication 1747-RM001G-EN-P - November 2008
Page 193
Proportional Integral Derivative Instruction
9-21
Error code 0036 appears in the status file when a PID instruction runtime error occurs. Code 0036 covers the following PID error conditions, each of which has been assigned a unique single byte code value that appears in the MS byte of the second word of the control block.
Runtime Errors
Table 9.36 PID Instruction Runtime Errors Error Code
Description of Error Condition or Conditions
Corrective Action
11H
SLC 5/02
SLC 5/02
12H
SLC 5/03 and higher
1. Loop update time Dt > 255
1. Loop update time Dt > 1024
2. Loop update time Dt = 0
2. Loop update time Dt = 0
SLC 5/02
SLC 5/03 and higher
1. Proportional gain Kc > 255, or
1. Proportional gain Kc < 0
SLC 5/03 and higher
1. Change loop update time Dt to 0 < Dt < 255
Change loop update time 0 <
Dt < 1024
SLC 5/02
SLC 5/03 and higher
Change proportional gain Kc to
0 < Kc < 255
Change proportional gain Kc to Kc ≥ 0
2. Proportional gain Kc = 0 13H
14H
21H (SLC 5/02 only)
SLC 5/02
SLC 5/03 and higher
SLC 5/02
SLC 5/03 and higher
Integral gain (reset)
Integral gain (reset)
Ti > 255
Ti < 0
Change integral gain (reset) Ti to 0 < Ti < 255
Change integral gain (reset) Ti to Ti ≥ 0
SLC 5/02
SLC 5/03 and higher
SLC 5/02
SLC 5/03 and higher
Derivative gain (rate)
Derivative gain (rate)
Td> 255
Td < 0
Change derivative gain (rate) Td to 0 < Td < 255
Change derivative gain (rate) Td to Td ≥ 0
1. Scaled setpoint max Smax > 16383, or
Change scaled setpoint max Smax to
-16383 < Smax < 16383 2. Scaled setpoint max Smax < -16383
22H (SLC 5/02 only)
1. Scaled setpoint min Smin > 16383, or
Change scaled setpoint min Smin to
-16383 < Smin < Smax < 16383 2. Scaled setpoint min Smin < -16383
23H
31H
Smin > Scaled setpoint max Smax
Change scaled setpoint min Smin to -16383 < Smin < Smax < 16383
If you are using setpoint scaling and Smin > setpoint SP > Smax, or
If you are using setpoint scaling, then change the setpoint SP to Smin < SP < Smax, or
If you are not using setpoint scaling and 0 > setpoint SP > 16383,
If you are not using setpoint scaling, then change
Scaled setpoint min
(SLC 5/03 and higher -32768 to +32767)
the setpoint SP to 0 < SP < 16383.
then during the initial execution of the PID loop, this error occurs and bit 11 of word 0 of the control block is set. However, during subsequent execution of the PID loop if an invalid loop setpoint is entered, the PID loop continues to execute using the old setpoint, and bit 11 of word 0 of the control block is set.
Publication 1747-RM001G-EN-P - November 2008
Page 194
9-22
Proportional Integral Derivative Instruction
Table 9.36 PID Instruction Runtime Errors Error Code
Description of Error Condition or Conditions
Corrective Action
41H
Scaling Selected
Scaling Selected
Scaling Deselected
1. Deadband < 0, or
1. Deadband < 0, or Change deadband to 0 < deadband < (Smax - Smin) < 16383
2. Deadband > (Smax - Smin), or
2. Deadband > 16383
Scaling Deselected Change deadband to 0 < deadband < 16383
3. Deadband > 16383 (5/02 specific) 51H
1. Output high limit < 0, or
Change output high limit to 0 < output high limit < 100
2. Output high limit > 100 52H
1. Output low limit < 0, or
Change output low limit to 0 < output low limit < output high limit < 100
2. Output low limit > 100 53H
Output low limit > output high limit
60H
SLC 5/02 - PID is being entered for the second time. (PID You have at least three PID loops in your program: One in loop was interrupted by an I/O interrupt, which is then the main program or subroutine file, one in an I/O interrupted by the PID STI interrupt. interrupt file, and one in the STI subroutine file. You must alter your ladder program and eliminate the potential nesting of PID loops.
Publication 1747-RM001G-EN-P - November 2008
Change output low limit to 0 < output low limit < output high limit < 100
Page 195
Proportional Integral Derivative Instruction
PID and Analog I/O Scaling
9-23
For the SLC 500 PID instruction, the numerical scale for both the process variable (PV) and the control variable (CV) is 0 to 16383. To use engineering units, such as PSI or degrees, you must first scale your analog I/O ranges within the above numerical scale. To do this, use the Scale (SCL) instruction and follow the steps below. 1. Scale your analog input by calculating the slope (or rate) of the analog input range to the PV range (0 to 16383.) For example, an analog input with a range of 4 to 20mA has a decimal range of 3277 to 16384. The decimal range must be scaled across the range of 0 to 16383 for use as PV. 2. Scale the CV to span evenly across your analog output range. For example, an analog output which is scaled at 4 to 20mA has a decimal range of 6242 to 31208. In this case, 0 to 16383 must be scaled across the range of 6242 to 31208. Once you have scaled your analog I/O ranges to/from the PID instruction, you can enter the minimum and maximum engineering units that apply to your application. For example, if the 4 to 20mA analog input range represents 0 to 300 PSI, you can enter 0 and 300 as the minimum (Smin) and maximum (Smax) parameters respectively. The Process Variable, Error, Setpoint, and Deadband are displayed in engineering units in the PID Data Monitor screen. Setpoint and Deadband can be entered into the PID instruction using engineering units. The following equations show the linear relationship between the input value and the resulting scaled value. Scaled value = (input value x slope) +offset Slope = (scaled MAX. −scaled MIN.) / (input MAX. −input MIN) Offset = scaled MIN. −(input MIN. x slope)
Publication 1747-RM001G-EN-P - November 2008
Page 196
9-24
Proportional Integral Derivative Instruction
Using the SCL Instruction Use the following values in an SCL instruction to scale common analog input ranges to PID process variables
Table 9.37 SLC Instruction Parameter
4 to 20mA
0 to 5V
0 to 10V
Rate/10,000
12,499
10,000
5,000
Offset
-4096
0
0
Use the following values in an SCL instruction to scale control variables to common analog outputs.
Table 9.38 SLC Instruction Parameter
4 to 20mA
0 to 5V
0 to 10V
Rate/10,000
15,239
10,000
19,999
Offset
6242
0
0
Using the SCP Instruction Use the following values in an SCP instruction to scale your analog inputs to the PV range and scale the CV range to your analog output
Table 9.39 SCP Instruction
Publication 1747-RM001G-EN-P - November 2008
Parameter
4 to 20mA
0 to 5V
0 to 10V
Input minimum
3277
0
0
Input maximum
16384
16384
32767
Scaled minimum
0
0
0
Scaled maximum
16383
16383
16383
Page 197
Proportional Integral Derivative Instruction
9-25
Use the following values in an SCP instruction to scale control variables to common analog outputs.
Table 9.40 SCP Instruction Parameter
4 to 20mA
0 to 5V
0 to 10V
Input minimum
0
0
0
Input maximum
16383
16383
16383
Scaled minimum
6242
0
0
Scaled maximum
31208
16384
32764
Example The following ladder diagram shows a typical PID loop that is programmed in the STI mode. This example is provided primarily to show the proper scaling techniques. It shows a 4 to 20mA analog input and a 4 to 20mA analog output. The following parameters are: • STI subroutine file (S:31) = 3. • STI Setpoint (S:30) = 10. • STI Enabled bit (S:2/1) = 1.
Publication 1747-RM001G-EN-P - November 2008
Page 198
9-26
Proportional Integral Derivative Instruction
This rung immediately updates the analog input used for PV.
IIM
Rung 3:0
IMMEDIATE Slot Mask
IN w MASK I:1.0 FFFF
These two rungs ensure the analog input value to be scaled remains within the limits of 3277 to 16384. This is necessary to prevent “out of range” conversion errors in both the SCL and PID instructions. The latch bits can be used elsewhere in your program to identify the particular out of range condition that occurred. Under range LES
Rung 3:1
LESS THAN Source A Source
B
B3 (L) 0
I:1.0 0 3277
MOV MOVE Source
3277
Dest
I:1.0 0
Over range GRT
Rung 3:2
GREATER THAN Source A Source
B
B3 (L) 1
I:1.0 0 16384
MOV MOVE Source
16384
Dest
I:1.0 0
The source to be scaled is the input I:1 and its destination is the process variable of the PID instruction. These values are calculated knowing that the input range is 3277 to 16384, while the scaled range (PV) is 0 to 16383. SCL
Rung 3:3
SCALE Source Rate
Rung 3:4
[/10000]
I:1.0 0 12499
Offset
–4096
Dest
N10:28 0
Block Variable Variable Block Length
N10:0 N10:28 N10:29 23
PID PID Control Process Control Control
The STI routine should have a time interval equal to the setting of the PID “loop update” parameter.
Publication 1747-RM001G-EN-P - November 2008
Page 199
Proportional Integral Derivative Instruction
Application Notes
9-27
The following sections discuss: • input/output ranges. • scaling to engineering units. • output alarms. • output limiting with anti-reset windup. • the manual mode. • PID rung state. • time proportioning outputs.
Input/Output Ranges The input module measuring the process variable (PV) must have a full scale binary range of 0 to 16383. If this value is less than 0 (bit 15 set), then a value of zero is used for PV and the Process var out of range bit is set (bit 12 of word 0 in the control block). If the process variable is >16383 (bit 14 set), then a value of 16383 is used for PV and the Process var out of range bit is set. The Control Variable, calculated by the PID instruction, has the same range of 0 to 16383. The Control Output (word 16 of the control block) has the range of 0 to 100%. You can set lower and upper limits for the instruction’s calculated output values (where an upper limit of 100% corresponds to a Control Variable limit of 16383).
Scaling to Engineering Units Scaling lets you enter the setpoint and zero-crossing deadband values in engineering units, and display the process variable and error values in the same engineering units. Remember, the process variable PV must still be within the range 0-16383. The PV is displayed in engineering units, however. Select scaling as follows: 1. Enter the maximum and minimum scaling values Smax and Smin in the PID control block. Refer to the control block of the PID instruction on page 9-5. The Smin value corresponds to an analog value of zero for the lowest reading of the process variable, and Smax corresponds to an analog value of 16383 for the highest reading. These values reflect the process limits. Setpoint scaling is selected by entering a non-zero value for one or both parameters. If you enter the same value for both parameters, setpoint scaling is disabled.
Publication 1747-RM001G-EN-P - November 2008
Page 200
9-28
Proportional Integral Derivative Instruction
For example, if measuring a full scale temperature range of -270°C (PV=0) to +1000°C (PV=16383), enter a value of -270 for Smin and 1000 for Smax. Remember that inputs to the PID instruction must be 0 to 16383. Signal conversions could be as follows:
Table 9.41 Signal Conversions Parameter
Range
Process limits
− 270 to + 1000 °C
Transmitter output (if used)
+ 4 to + 20 mA
Output of analog input module
0 to 16383
PID instruction, Smin to Smax
− 270 to + 1000 °C
2. Enter the setpoint (word 2) and deadband (word 9) in the same scaled engineering units. Read the scaled process variable and scaled error in these units as well. The control output percentage (word 16) is displayed as a percentage of the 0 to 16383 CV range. The actual value transferred to the CV output is always between 0 and 16383. When you select scaling, the instruction scales the setpoint, deadband, process variable, and error. You must consider the effect on all these variables when you change scaling.
Output Alarms You may set an output alarm on the control output (CO) at a selected value above and/or below a selected output percent. When the instruction detects that the output (CO) has exceeded either value, it sets an alarm bit (bit 10 for lower limit, bit 9 for upper limit) in word 0 of the PID control block. Alarm bits are reset by the instruction when the output (CO) comes back inside the limits. The instruction does not prevent the output (CO) from exceeding the alarm values unless you select output limiting. Select upper and lower output alarms by entering a value for the upper alarm (word 11) and lower alarm (word 12). Alarm values are specified as a percentage of the output. If you do not want alarms, enter zero and 100% respectively for lower and upper alarm values and ignore the alarm bits.
Publication 1747-RM001G-EN-P - November 2008