The text of a manual · part 18 of 70
SLC 500 Instruction Set Reference Manual, pages 171 to 180
Pages 171 to 180 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 171
Block Transfer Instructions
8-11
Comparison to the PLC-5 BTR and BTW BTR/BTW in SLC processors are quite similar to the instructions in the PLC-5. However, some differences exist between them, as shown in the table below.
Table 8.6 Block Transfer Comparison Parameter
SLC
PLC-5
Control Block
3-element integer (N) type
5-element integer (N) type or 1-element block transfer (BT) type.
EN (Enable Bit)
Follows BT rung state.
Gets set when BT rung goes true. Remains set until the BT finishes or fails, and the BT rung goes false.
NR (No Response bit)
None
This bit is in control block word 0 bit 9.
CO (Continuous bit)
None
This bit is in control block word 0 bit 11.
FILE (File Number)
None
This word is control block word 3.
ELEM (Element Number)
None
This word is control block word 4.
Error Codes
7 error codes
11 error codes
BTR/BTW number limitation for one scanner/channel
32
64
BT Status Bits
Can only change when BT rung is scanned.
Can change at any point in the program scan.
IMPORTANT
Do not manipulate the I/O image words of the RIO scanner for modules you are block transferring to. These words are used by the RIO scanner and the remote device as block transfer handshake bits. Any manipulation of them by the user program while a block transfer is in progress causes the block transfer to fail.
Publication 1747-RM001G-EN-P - November 2008
Page 172
8-12
Block Transfer Instructions
Notes:
Publication 1747-RM001G-EN-P - November 2008
Page 173
Chapter
9
Proportional Integral Derivative Instruction
This chapter describes the Proportional Integral Derivative (PID) instruction.
This is an output instruction that controls physical properties such as temperature, pressure, liquid level, or flow rate using process loops.
Overview PID PID Control Block Process Variable Control Variable Control Block Length Setup Screen
The PID instruction normally controls a closed loop using inputs from an analog input module and provides an output to an analog output module. For temperature control, you can convert the analog output to a time proportioning on/off output for driving a heater or cooling unit. An example appears on pages 9-30 through 9-31.
N18:0 N18:23 N18:24 23
Fixed SLC SLC SLC SLC SLC 5/01 5/02 5/03 5/04 5/05 •
•
Output Instruction
The PID Concept
•
•
The PID instruction can be operated in the timed mode or the STI mode. In the timed mode, the instruction updates its output periodically at a user-selectable rate. In the STI mode, the instruction should be placed in an STI interrupt subroutine. It then updates its output every time the STI subroutine is scanned. The STI time interval and the PID loop update rate must be the same in order for the equation to execute properly.
PID closed loop control holds a process variable at a desired set point. A flow rate/fluid level example is shown below.
Feed Forward or Bias Set Point
∑
Error
Flow Rate
PID Equation
Process Variable
∑ Control Output
Level Detector Control Valve
1
Publication 1747-RM001G-EN-P - November 2008
Page 174
9-2
Proportional Integral Derivative Instruction
The PID equation controls the process by sending an output signal to the control valve. The greater the error between the setpoint and process variable input, the greater the output signal, and vice versa. An additional value (feed forward/bias) can be added to the control output as an offset. The result of PID calculation (control variable) drives the process variable you are controlling toward the set point.
The PID Equation
The PID instruction uses the following algorithm: Standard equation with dependent gains is shown below.
1 D ( PV ) Output = K C ( E ) + ---- ∫ ( E ) dt + T D ⋅ ---------------- + Feed Forward/Bias TI df
Standard Gains constants are listed in the following table.
Table 9.1 Standard Gain Constants Term
Range (Low to High)
Reference
Controller Gain KC
0.1 to 25.5 (dimensionless)(1)
Proportional
0.01 to 327.67 (dimensionless)(2)
Reset Term 1/TI
25.5 to 0.1 (minutes per repeat)(1) 327.67 to 0.01 (minutes per repeat)(2)
Integral
Rate Term TD
0.1 to 25.5 (minutes)(1)
Derivative
0.01 to 327.67 (minutes)(2) (1)
SLC 5/02 processors.
(2)
Applies to SLC 5/03 and higher processors PID ranges when bit Reset and Gain Range (RG) bit is set to 1.
The derivative term (rate) provides smoothing by means of a low-pass filter. The cutoff frequency of the filter is 16 times greater than the corner frequency of the derivative term.
Publication 1747-RM001G-EN-P - November 2008
Page 175
Proportional Integral Derivative Instruction
The PID Instruction
9-3
The figure below shows a PID instruction with typical addresses for these parameters entered.
PID PID Control Process Control Control
Block Variable Variable Block Length
N10:0 N10:28 N10:29 23
Place the PID instruction on a rung without any conditional logic. If a PID instruction goes false, the integral term is cleared.
TIP
The PID instruction is an integer-only type of PID algorithm and does not allow you to enter floating point values for any of its parameters. If you attempt to move a floating point value to one of the PID parameters using ladder logic, a floating point-to-integer conversion occurs.
During programming, enter the Control Block, Process Variable, and Control Variable addresses after you have placed the PID instruction on a rung.
Entering Parameters • Control Block is a file that stores the data required to operate the instruction. The file length is fixed at 23 words and should be entered as an integer file address. For example, an entry of N10:0 will allocate elements N10:0 through N10:22. The control block layout is shown on page 9-5. Do not write to control block addresses with other instructions in your program except as described later in this chapter. If you are re-using a block of data which was previously allocated for some other use, it is good practice to first zero the data.
TIP
Use a unique data file to contain your PID control blocks (for example, N10:0). This avoids accidental re-use of the PID control block addresses by other instructions in your program.
Publication 1747-RM001G-EN-P - November 2008
Page 176
9-4
Proportional Integral Derivative Instruction
• Process Variable PV is an element address that stores the process input value. This address can be the location of the analog input word where the value of the input A/D is stored. This value could also be an integer value if you choose to pre-scale your input value to the range 0 to 16383. • Control Variable CV is an element address that stores the output of the PID instruction. The output value ranges from 0 to 16383, with 16383 being the 100% on value. This is normally an integer value, so that you can scale the PID output range to the particular analog range your application requires.
Publication 1747-RM001G-EN-P - November 2008
Page 177
Proportional Integral Derivative Instruction
PID Control Block Layout
9-5
The control block length is fixed at 23 words and should be programmed as an integer file. PID instruction flags (word 0) and other parameters are listed in the following table.
Table 9.2 Control Block Structure 15
14
13
12
11
10
09
08
07
06
05
04
03
02
01
00
Word 0
EN
RA(1)
DN
PV
SP
LL
UL
DB
DA(2)
TF
SC
RG(2)
OL(3)
CM(3)
AM(3)
TM(3)
Word 1
PID Sub Error Code (MSbyte)
Word 2
Setpoint SP
Word 3
Gain Kc
Word 4
Reset Ti
Word 5
Rate Td
Word 6
Feed Forward/Bias
Word 7
Setpoint Max (SMax)
Word 8
Setpoint Min (SMin)
Word 9
Deadband
Word 10
Internal Use Do Not Change
Word 11
Output Max
Word 12
Output Min
Word 13
Loop Update
Word 14
Scaled Process Variable
Word 15
Scaled Error SE
Word 16
Output CV% (0 to 100%)
Word 17
MSW Integral Sum
Word 18
LSW Integral Sum
Word 19
Internal Use Do Not Change
Word 20
Internal Use Do Not Change
Word 21
Internal Use Do Not Change
Word 22
Internal Use Do Not Change
(1)
Applies to SLC 5/03 and higher processors with OS Series C FRN 11 and higher firmware.
(2)
Applies to the SLC 5/03 and higher processors.
(3)
You may alter the state of these values with your ladder program.
ATTENTION
Do not alter the state of any PID control block value unless you fully understand its function and related effect on your process.
Publication 1747-RM001G-EN-P - November 2008
Page 178
9-6
Proportional Integral Derivative Instruction
Controller Gain (Kc) Table 9.3 Controller Gain Parameter Tuning Parameter Descriptions
Address
Data Format Range
Type
KC - Controller Gain
Word 3 word (INT)
control
0 to 32,767
User Program Access read/write
Gain Kc (word 3) is the proportional gain, ranging from 0 to 3276.7 (when RG = 0), or 0 to 327.67 (when RG = 1). Set this gain to one-half the value needed to cause the output to oscillate when the reset (Ti) and rate terms (Td) (below) are set to zero.
TIP
Controller gain is affected by the reset and gain range (RG) bit. For information, see Reset and Gain Enhancement Bit (RG) on page 9-10.
Reset Term (Ti) Table 9.4 Reset Term Parameter Tuning Parameter Address Descriptions TI - Reset Term - Ti Word 4
Data Range Format word 0 to 32,767 (INT)
Type control
User Program Access read/write
Reset Term Ti (word 4) is the Integral gain, ranging from 0 to 3276.7 (when RG = 0), or 327.67 (when RG = 1) minutes per repeat. Set the reset time equal to the natural period measured in the above gain calibration. A Kc value of 1 adds the maximum integral term into the PID equation.
TIP
Publication 1747-RM001G-EN-P - November 2008
Reset term is affected by the reset and gain range (RG) bit. For information, see Reset and Gain Enhancement Bit (RG) on page 9-10.
Page 179
Proportional Integral Derivative Instruction
9-7
Rate Term (Td) Table 9.5 Rate Term Parameter Tuning Parameter Address Descriptions TD - Rate Term - Td Word 5
Data Format Range
Type word (INT)
control
0 to 32,767
User Program Access read/write
Rate Td (word 5) is the Derivative term. The adjustment range is 0 to 327.67 minutes. Set this value to 1/8 of the integral gain Ti.
TIP
This word is not affected by the reset and gain range (RG) bit. For information, see Reset and Gain Enhancement Bit (RG) on page 9-10.
Feed Forward/Bias Applications involving transport lags may require that a bias be added to the CV output in anticipation of a disturbance. This bias can be accomplished using the processor by writing a value to the Feed Forward/Bias element, the seventh element (word 6) in the control block file (See page 9-5.) The value you write is added to the output, allowing a feed forward action to take place. You may add a bias by writing a value between -16383 and +16383 to word 6 with your programming terminal or ladder program.
Mode (TM) Table 9.6 Mode Bit Parameter Tuning Parameter Descriptions TM - Mode
Address
Data Format Word 0, Bit 0 binary
Range
Type
0 or 1 control
User Program Access read/write
The mode bit specifies when the PID is in timed mode (1) or STI mode (0). This bit can be set or cleared by instructions in your ladder program. When set for timed mode, the PID executes and updates the CV at the rate specified in the loop update parameter (word 13).
Publication 1747-RM001G-EN-P - November 2008
Page 180
9-8
Proportional Integral Derivative Instruction
When set for STI mode, the PID executes and updates the CV every time the PID instruction is scanned in the control program. When you select STI, program the PID instruction in the STI interrupt subroutine. The STI routine should have a time interval equal to the setting of the PID “loop update” parameter. Set the STI period in word S:30. For example, if the loop update time contains the value 10 (for 100 ms), then the STI time interval must also equal 100 (for 100 ms).
TIP
When using timed mode, your processor scan time should be at least ten times faster than the loop update time to prevent timing inaccuracies or disturbances.
Loop Update Table 9.7 Loop Update Parameter Tuning Parameter Descriptions
Address
Data Format Range
Type
Loop Update
Word 13 word (INT)
control
1 to 1024
User Program Access read/write
The loop update (word 13) is the time interval between PID calculations. The entry is in 0.01 second intervals. Enter a loop update time five to ten times faster than the natural period of the load. The natural period of the load is determined by setting the reset and rate parameters to zero and then increasing the gain until the output begins to oscillate. When in STI mode, this value must equal the STI time interval value loaded in S:30. The valid range is 0.01 to 10.24 seconds. See page 11-12 for help entering STI setpoint.
Deadband Table 9.8 Deadband Parameter Tuning Parameter Descriptions DB - Deadband
Publication 1747-RM001G-EN-P - November 2008
Address Word 9
Data Format word (INT)
Range
Type
0 to 32,767 control
User Program Access read/write