The text of a manual · part 40 of 55
Hand-Held Terminal (Catalog Number 1747-PT1) User Manual: 26 - PID Instruction, pages 345 to 352
Pages 345 to 352 of 486, from Hand-Held Terminal (Catalog Number 1747-PT1) User Manual
The original document is the PDF (1.5 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-PT1
Page 345
Chapter
A–B
26
PID Instruction This chapter applies to the SLC 5/02 processor only. It explains the PID instruction. All application examples shown are in the HHT zoom display.
Proportional, Integral, Derivative (PID)
SLC 5/02 Processors Only It is an output instruction that controls physical properties such as temperature, pressure, liquid level, or flow rate of process loops.
26–1
Page 346
Chapter 26 PID Instruction
Proportional Integral Derivative
HHT Ladder Display:
HHT Zoom Display: (monitor mode)
auto
PID
Output Instruction
(PID)
ZOOM on PID –(PID)– 1/2 2.3.0.0.2 NAME: PROP INT DERIV MODE: AUTO GAIN: 255 [/10] OUT LIM: 5% ,95% RESET: 10 [/10 M/R] DEADBND: 5 RATE: 5 [/100 MIN] OUTPUT: 0% SETPOINT: 500 PROCESS: 14 ENTER GAIN: 255 PRG NEXT PG MANUAL F1
F2
F3
F4
ZOOM on PID –(PID)– 1/2 NAME: PROP INT DERIV MODE: PROCESS: 14 SETPOINT: 500 OUTPUT: 0% MIN OUT: 5% MAX OUT: 95% manual
ENTER OUTPUT PCT: 0 NEXT PG AUTO F1
F2
F3
F5 2.3.0.0.2 MANUAL
PRG F4
F5
ZOOM on PID –(PID)– 2/2 2.3.0.0.2 NAME: PROP INT DERIV MODE: AUTO LOOP UPDATE: 50 [x10ms] SET PT RANGE: –100 1000 EN DN PV SP LL UL DB TF SC OL CM AM TM 0 0 0 0 0 0 0 0 0 1 0 0 1 PRG PREV PG F1
F2
F3
F4
Ladder Diagrams and APS Displays: PID PID Control Block Process Variable Control Variable Control Block Length
26–2
N7:2 N7:0 N7:1 23
F5
Page 347
Chapter 26 PID Instruction
The PID instruction normally controls a closed loop using inputs from an analog input module and providing 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 26–20 and 26–22. 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 the rate you set. In the STI mode, the instruction should be placed in an STI interrupt subroutine. It will then update 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.
The PID Concept
PID closed loop control holds a process variable at a desired set point. A flow rate/fluid level example is shown below. FFWD or Bias Set Point
∑
Error
Flow Rate Process Variable
PID Equation
∑ Control Output
Level Detector Control Valve
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 (feedforward or bias) can be added to the control output as an offset. The result of PID calculation (control variable) will drive the process variable you are controlling toward the set point.
26–3
Page 348
Chapter 26 PID Instruction
The PID Equation
The PID instruction uses the following equation: Output + K C [(E) ) 1ńT I
ŕ(E)dt ) T · D(PV)ńdt] ) bias D
Standard Gains constants: Term
Range (Low to High)
Reference
Controller Gain KC
0.1 to 25.5 (dimensionless)
Proportional
Reset Term 1/TI
25.5 to 0.1 (minutes per repeat)
Integral
Rate Term TD
0.01 to 2.55 (minutes)
Derivative
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.
Entering Parameters
Normally, you place the PID instruction on a rung without conditional logic. The output remains at its last value and the integral sum (words 17 and 18) is cleared when the rung is false. The PID instruction is located under CPT/MTH in the HHT instruction set menu. After you select PID, the following display appears: ZOOM on PID –(PID)– 1/3 2.0.0.0.* NAME: PROP INTEGRAL DERIVATIVE CONT BLK: PROCESS: OUTPUT: CONTROL BLOCK SIZE 23 WORDS ENTER CONTROL BLK: F1
F2
F3
F4
F5
This is the first of three data entry displays. The prompt line asks you to enter Control Block, then Process, and then Output. • Control Block – This 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 N7:2 will allocate elements N7:2 through N7:24. The control block layout is shown on page 26–8. 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.
26–4
Page 349
Chapter 26 PID Instruction
• Process (also called the Process Variable, PV) – This 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–16383. • Output (also called Control Variable, CV) – This is an element address that stores the output of the PID instruction. The output value ranges from 0 to 16383, with 16383 corresponding to a control output percent of 100. This is normally an integer value, so that you can scale the PID output range to the particular analog range your application requires. The display below shows typical values entered for these parameters: ZOOM on PID –(PID)– 1/3 2.0.0.0.* NAME: PROP INTEGRAL DERIVATIVE CONT BLK: N7:2 PROCESS: N7:0 OUTPUT: N7:1 CONTROL BLOCK SIZE 23 WORDS ENTER CONTROL BLK: N7:2 NEXT PG F1
F2
F3
F4
F5
Pressing [F1], NEXT_PG brings up the second display: ZOOM on PID –(PID)– 2/3 2.0.0.0.* NAME: PROP INTEGRAL DERIVATIVE GAIN: 0 [/10] MIN OUT: 0% RESET: 0 [/10 M/R] MAX OUT: 0% RATE: 0 [/100 MIN] AUTO/MAN: AUTO SETPOINT: 0 DEADBAND: 0 ENTER GAIN: 0 F1
F2
F3
F4
F5
You enter the following parameters at this display: • Gain (control block word 3) – This is the Proportional gain (kc), ranging from 0.1 to 25.5. A rule of thumb is to set this gain to one half the value needed to cause the output to oscillate when the reset and rate terms (below) are set to zero. Entered range: 1–255. • Reset (control block word 4) – This is the Integral gain (1/TI), ranging from 0.1 to 25.5 minutes per repeat. A rule of thumb is to set the reset time equal to the natural period measured in the above gain calibration. Entered range: 1–255. Note: the value 255 will add the minimum integral term possible into the PID equation. • Rate (control block word 5) – This is the derivative term (TD). The adjustment range is 0.01 to 2.55 minutes. A rule of thumb is to set this value to 1/8 of the integral time above. Entered range: 1–255. • Setpoint (SP) (control block word 2) – This is the desired control point of the process variable. Type in the desired value and press ENTER. You can change this value with instructions in your ladder program. Write the value to the third word in the control block (for example write the value to N7:4 if your control block is N7:2). Without scaling, the range of this value is 0–16383. Otherwise, the range is scaled setpoint min (Smin) (word 8) to scaled setpoint max (Smax) (word 7).
26–5
Page 350
Chapter 26 PID Instruction
• Minimum output (control block word 12) – If you want to use output limiting or alarms, enter a value. If the output limit bit is also set, this value is the minimum control output percent (word 16) that the control variable (CV) obtains or outputs. • Maximum output (control block word 11) – If the output limit bit is also set, the value you enter is the maximum control output percent (word 16) that the control variable (CV) obtains or outputs. • Auto/manual (control block word 0, bit 1) – The default condition is AUTO. This indicates that the PID is controlling the output. MANUAL indicates that the user is setting the output value. When tuning, we recommend that changes be made in the MANUAL mode, followed by a return to AUTO. Output limiting is applied in the MANUAL mode. • Deadband (control block word 9) – Enter a non-negative value. The deadband extends above and below the setpoint by the value you enter. The deadband is entered at the zero crossing of the process variable PV and the setpoint SP. This means that the deadband is in effect only after the process variable PV enters the deadband and passes through the setpoint SP. Range: 0-scaled max, or 0–16383 when no scaling exists. The display below shows typical values entered for these parameters: ZOOM on PID –(PID)– 2/3 2.0.0.0.* NAME: PROP INTEGRAL DERIVATIVE GAIN: 25 [/10] MIN OUT: 5% RESET: 10 [/10 M/R] MAX OUT: 95% RATE: 1 [/100 MIN] AUTO/MAN: AUTO SETPOINT: 500 DEADBAND: 5 ENTER GAIN: 255 NEXT PG F1
F2
F3
F4
F5
Pressing [F1], NEXT_PG brings up the third display: ZOOM on PID –(PID)– 3/3 2.0.0.0.* NAME: PROP INTEGRAL DERIVATIVE LOOP UPDATE: 0 [X10ms] SET PT MIN: 0 SET PT MAX: 0 MODE: STI OUT LIMIT: NO CONTROL: REVERSE ENTER LOOP UPDATE: 0 F1
F2
F3
F4
F5
You enter the following parameters at this display: • Loop update (control block word 13) (Dt) – This is the time interval between PID calculations. The entry is in 0.01 second intervals. A rule of thumb is to enter a loop update time five to ten times faster than the natural period of the load (determined by setting the reset and rate parameters to zero and then increasing the gain until the output begins to oscillate). When in the STI mode, this value must equal the STI time interval value S:30. Entered range: 1–255. In timed mode, the PID loop is only calculated upon time–out of the loop update and not every scan.
26–6
Page 351
Chapter 26 PID Instruction
• Scaled setpoint minimum (Smin) (control block word 8) – If the setpoint is to read in engineering units, then this parameter corresponds to the value of the setpoint in engineering units when the control input is zero. Range: –16383 to +16383. • Scaled setpoint maximum (Smax) (control block word 7) – If the setpoint is to read in engineering units, then this parameter corresponds to the value of the setpoint in engineering units when the control input is 16383. Range: –16383 to +16383. Note: Smin – Smax scaling allows you to enter the setpoint in engineering units. The deadband plus error will also be displayed in engineering units. The process variable PV will still be expected to be within the range 0 –16383. That is, Smin – Smax scaling provides a full resolution PID calculation.
• Mode (control block word 0, bit 0) – STI is the default condition. TIMED indicates that the PID updates its output at the rate specified in the loop update parameter (word 13); STI indicates that the PID updates its output every time it is scanned. When you select STI, the PID instruction should be programmed in an STI interrupt subroutine, and the STI routine should have a time interval (STI period S:30) equal to the setting of the PID “loop update” parameter (word 13). For example, if the loop update time contains the value 10 (for 100 ms), then the STI time interval must also equal 10. • Output limit (control block word 0, bit 3) – Select YES if you want to limit the output to minimum and maximum values: Output
YES Output Limiting Selected
NO Output Limiting Deselected min
The value you enter will be the minimum output percent that the control variable CV will obtain.
The value you enter will determine when the output alarm, lower limit bit is set. If CV drops below this minimum value, the output alarm, lower limit LL bit will be set.
If CV drops below this minimum value, the following will occur:
• CV will be set to the value you entered, and
• the output alarm, lower limit LL bit will be set. max
The value you enter will be the maximum output percent that the control variable CV will obtain. If CV exceeds this maximum value, the following will occur:
• CV will be set to the value you
The value you enter will determine when the output alarm, upper limit bit is set. If CV exceeds this maximum value, the output alarm, upper limit UL bit will be set.
entered, and
• the output alarm, upper limit UL bit will be set.
26–7
Page 352
Chapter 26 PID Instruction
• Control (control block word 0, bit 2) – Reverse, the default condition, corresponds to E=SP–PV. Forward corresponds to E=PV–SP. Direct acting (E=PV–SP) will cause the output CV to increase when the input PV is larger than the setpoint SP (for example, a cooling application). Reverse acting (E=SP–PV) will cause the output CV to increase when the input PV is smaller than the setpoint SP (for example, a heating application). The following display shows typical values entered for these parameters: ZOOM on PID –(PID)– 3/3 2.0.0.0.* NAME: PROP INTEGRAL DERIVATIVE LOOP UPDATE: 50 [X10ms] SET PT MIN: –100 SET PT MAX: 1000 MODE: TIMED OUT LIMIT: YES CONTROL: REVERSE ENTER LOOP UPDATE: 50 NEXT PG PREV PG ACCEPT F1
F2
F3
F4
F5
Press [F5], ACCEPT, to complete the entry of parameters. If you must change any of the parameters, you can run through the entry sequence again before you press ACCEPT.
Control Block Layout
26–8
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 located as shown on the following page.