The text of a manual · part 10 of 38
DL06 Micro PLC User Manual, Volume 2 of 2, pages 90 to 99
Pages 90 to 99 of 370
The original document is the PDF (6.0 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.
Page 90
Chapter 8: PID Loop Operation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D 8–14
Loop Operating Modes The DL06 loop controller operates in one of two modes, either Manual or Automatic. Manual In manual mode, the control output is determined by the operator, not the loop controller. While in manual mode, the loop controller will still monitor all of the alarms including High-High, High, Low, Low-Low, Yellow deviation, Orange deviation and Rate-of-Change. Automatic In automatic mode, the loop controller computes the control output based on the programmed parameters stored in V-memory. All alarms are monitored while in automatic. Cascade Cascade mode is an option with the DL06 PLC and is used in special control applications. If the cascade feature is used, the loop will operate as it would if in automatic mode except for the fact that a cascaded loop has a setpoint which is the control output from another loop.
Special Loop Calculations Reverse Acting Loop Although the PID algorithm is used in a direct, or forward, acting loop controller, there are times when a reverse acting control output is needed. The DL06 loop controller allows a loop to operate as reverse acting. With a reverse acting loop, the output is driven in the opposite direction of the error. For example, if SP > PV, then a reverse acting controller will decrease the output to increase the PV. Mx = -Ki * en + Mxn-1 M = -Kc * en + Kr(PVn-PVn-1) + Mxn Square Root of the Process Variable Square root is selected whenever the PV is from a device such as an orifice meter which requires this calculation. Error Squared Control Whenever error squared control is selected, the error is calculated as: en = (SP - PVn) * ABS(SP - PVn) A loop using the error squared is less responsive than a loop using just the error, however, it will respond faster with a large error. The smaller the error, the less responsive the loop. Error squared control would typically be used in a PH control application.
DL06 Micro PLC User Manual, 3rd Edition Rev. A
Page 91
Chapter 8: PID Loop Operation Error Deadband Control With error deadband control, no control action is taken if the PV is within the specified deadband area around the setpoint. The error deadband is the same above and below the setpoint. Once the PV is outside of the error deadband around the setpoint, the entire error is used in the loop calculation. en = 0 SP - Deadband_Below_SP < PV < SP - Deadband_Above_SP en = P - PVn otherwise The error will be squared first if both Error Squared and Error Deadband is selected. Derivative Gain Limiting When the coefficient of the derivative term, Kr, is a large value, noise introduced into the PV can result in erratic loop output. This problem is corrected by specifying a derivative gain limiting coefficient, Kd. Derivative gain limiting is a first order filter applied to the derivative term computation, Yn, as shown below.
Y n = Yn-1 +
Ts
Ts + ( Td ) Kd
* (PV n - Y n-1 )
Position Algorithm Mx = Ki * en + Mxn-1 M = Kc * en - Kr * (Yn-Yn-1) + Mx Velocity Algorithm ⌬M = Kc * (en - en-1) + Ki * en - Kr * (Yn - 2 * Yn-1 + Yn-2)
DL06 Micro PLC User Manual, 3rd Edition Rev. A
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
8–15
Page 92
Chapter 8: PID Loop Operation to Successful Process Control 1 Ten Steps Controllers such as the DL06 PLC provide sophisticated process control features. Automated control systems can be difficult to debug, because a given symptom can have many possible 2 causes. We recommend a careful, step-by-step approach to bringing new control loops online: Step 1: Know the Recipe 3 The most important is – how to produce your product. This knowledge is the foundation for designing an effective control system. A good process recipe will do the following: 4 • Identify all relevant Process Variables, such as temperature, pressure, or flow rates, etc. which need precise control. • Plot the desired Setpoint values for each process variables for the duration of one process 5 cycle. Step 2: Plan Loop Control Strategy 6 This simply means choosing the method the machine will use to maintain control over the Process Variables to follow their Setpoints. This involves many issues and trade-offs, such as 7 energy efficiency, equipment costs, ability to service the machine during production, and more. You must also determine how to generate the Setpoint value during the process, and 8 whether a machine operator can change the SP. Step 3: Size and Scale Loop Components 9 Assuming the control strategy is sound, it is still crucial to properly size the actuator and properly scale the sensors. 10 • Choose an actuator (heater, pump. etc.) which matches the size of the load. An oversized actuator will have an overwhelming effect on your process after a SP change. However, an undersized actuator will allow the PV to lag or drift away from the SP after a SP change 11 or process disturbance. • Choose a PV sensor which matches the range of interest (and control) for our process. 12 Decide the resolution of control you need for the PV (such as within and make sure the sensor input value provides the loop with at least 5 times that resolution (at LSB level). However, an over-sensitive sensor can cause control oscillations, etc. The DL06 13 provides 12–bit and 15–bit unipolar and bipolar data format options, and a 16–bit unipolar option. This selection affects SP, PV, Control Output and Integrator sum. 14 Step 4: Select I/O Modules After deciding the number of loops, PV variables to measure, and SP values, you can choose A the appropriate I/O module. Refer to the figure on the next page. In many cases, you will be able to share input or output modules, or use a analog I/O combination module, among several control loops. The example shown sends the PV and Control Output signals for two B loops through the same set of modules. Automationdirect offers DL06 analog input modules with 4 channels per module that accept C 0 – 20mA or 4 – 20mA signals. Also, analog input and output combination modules are now available. Thermocouple and RTD modules can also be used to maintain temperatures to a D 10th of a degree. Refer to the sales catalog for further information on these modules, or find the modules on our website, www.automationdirect.com.
8–16
DL06 Micro PLC User Manual, 3rd Edition Rev. A
Page 93
Chapter 8: PID Loop Operation Input Module
DL06 CPU V-memory
Digital Output
1 2 3 Step 5: Wiring and Installation 4 After selection and procurement of all loop components and I/O module(s), you can perform the wiring and installation. Refer to the wiring guidelines in Chapter 2 of this manual, and to the D0–OPTIONS–M manual. The most common wiring errors when 5 installing PID loop controls are: • Reversing the polarity of sensor or actuator wiring connections. 6 • Incorrect signal ground connections between loop components. Step 6: Loop Parameters 7 After wiring and installation, choose the loop setup parameters. The easiest method for programming the loop tables is using DirectSOFT 5 (5.0 or later). This software provides 8 PID Setup using dialog boxes to simplify the task. Note: It is important to understand the meaning of all loop parameters mentioned in this chapter before choosing values to enter. 9 Step 7: Check Open Loop Performance With the sensor and actuator wiring done, and loop parameters entered, we must manually 10 and carefully check out the new control system using the Manual mode). • Verify that the PV value from the sensor is correct. • If it is safe to do so, gradually increase the control output up above 0%, and see if the PV 11 responds (and moves in the correct direction!). 12 Step 8: Loop Tuning If the Open Loop Test (page 8–40) shows the PV reading is correct and the control output has the proper effect on the process; you can follow the closed loop tuning procedure (see 13 page 8–45). In this step, the loop is tuned so the PV automatically follows the SP. 14 Step 9: Run Process Cycle If the closed loop test shows the PV will follow small changes in the SP, consider running an actual process cycle. You will need to have completed the programming which will generate A the desired SP in real time. In this step, you may want to run a small test batch of product through the machine, watching the SP change according to the recipe. B WARNING: Be sure the Emergency Stop and power-down provision is readily accessible, in case the process goes out of control. Damage to equipment and/or serious injury to personnel can result from C loss of control of some processes. Step 10: Save Parameters D Channel 1
Loop 1 Data PV OUT SP
Channel 1
Process 1
Channel 2
Loop 2 Data SP PV OUT
Channel 2
Process 2
Channel 3 Channel 4
When the loop tests and tuning sessions are complete, be sure to save all loop setup parameters to disk.
DL06 Micro PLC User Manual, 3rd Edition Rev. A
8–17
Page 94
Chapter 8: PID Loop Operation
1 PID Loop Setup Some Things to Do and Know Before Starting 2 Have your analog module installed and operational before beginning the loop setup (refer to the DL05/06 Option Modules User Manual, D0-OPTIONS-M). The DL06 PLC gets its PID loop processing instructions from V-memory tables. There isn’t a PID instruction that 3 can be used in RLL, such as a block, to setup the PID loop control. Instead, the CPU reads the setup parameters from system V-memory locations. These locations are shown in the table 4 below for reference only; they can be used in a RLL program if needed. Address Setup Parameter Data type Ranges Read/Write 5 6 PID Error Flags 7 The CPU reports any programming errors of the setup parameters in V7640 and V7641. It does this by setting the 8 appropriate bits in V7642 on program-to-run mode transitions. 9 If you use the DirectSOFT 5 loop setup dialog box, its automatic range checking prohibits possible setup errors. However, the setup parameters may be written using other methods such as RLL, so the error flag register may be helpful in those cases. The following table lists 10 the errors reported in V7642. 11 Bit Error Description (0 = no error, 1 = error) 12 13 As a quick check, if the CPU is in Run mode and V7642=0000, there are no programming errors. 14 Establishing the Loop Table Size and Location On a PROGRAM-to-RUN mode transition, the CPU reads the loop setup parameters as A pictured below. At that moment, the CPU learns the location of the loop table and the number of loops it configures. Then during the ladder program scan, the PID Loop task uses B the loop data to perform calculations, generate alarms, and so on. There are some loop table parameters the CPU will read or write on every loop calculation. C D V7640 V7641 V7642
Loop Parameter Table Pointer Number of Loops Loop Error Flags
V1200 – V7340 V10000-V17740 1–8 0 or 1
Octal BCD BITS write write read
PID Error Flags, V7642
Bit 15 14 13 12 11 10 9 8
0 1 2 3
6 5
4
3
2 1
The starting address (in V7640) is out of the lower V-memory range. The starting address (in V7640) is out of the upper V-memory range. The number of loops selected (in V7641) is greater than 8. The loop table extends past (straddles) the boundary at V7377. Use an address closer to V1200.
CPU Tasks
V–Memory Space User Data
Ladder Program
READ/ WRITE
LOOP DATA
CONFIGURE/ MONITOR
PID Loop Task
READ (at powerup)
Setup Parameters V7640, V7641 DirectSOFT32 Programming Software
DirectSOFT 5
8–18
7
DL06 Micro PLC User Manual, 3rd Edition Rev. A
0
Page 95
Chapter 8: PID Loop Operation
NOTE: The DL06 CPU’s PID algorithm requires DirectSOFT 5 Version 5.0 (or later) and firmware version 2.1 (or later). See our website for more information: www.automationdirect.com.
1 The Loop Table contains data for only the number of loops 2 that are selected. The address for the table is stored in V7641. Each loop configuration occupies 32 words (0 to 37 octal) in the loop table. 3 For example, consider an application with 4 loops, and V2000 has been chosen as the starting location. The Loop Parameter 4 will occupy V2000 – V2037 for loop 1, V2040 – V2077 for loop 2 and so on. Loop 4 occupies V2140 - V2177. 5 Determine the block of V-memory to be used for each PID loop. Besides being the beginning of the PID parameter memory block, the first address will 6 be the start of loop 1 parameters. Remember, there are 32 words (0 to 37 octal) needed for each loop. Once you have determined the beginning V-memory address to be used, you can setup and store the PID parameters either directly in your RLL program or by the using PID 7 Setup in DirectSOFT 5. NOTE: Whether one or more loops are being setup, this block of V-memory will only be used for the PID 8 loop parameters, do not use this block of memory for anything else in your program. 9 Using DirectSOFT 5 is the simplest way to setup the parameters. To setup the PID parameters, the DL06 must be powered up and connected to the programming computer. The parameters can only be entered in PID setup when the PLC is in the Program mode. 10 Once the parameters have been entered and saved for each loop, changes made through the PID setup can be made, but only in Program Mode. You can type the beginning address in 11 the PID Table Address dialog found when the PID Setup is opened in DirectSOFT 5. This can be seen in the diagram below. After the address has been entered, the memory range will appear. Also, entering the number of PID loops (1 to 8) will set the total V-memory range for 12 the number of loops entered. After the V-memory address has been entered, the necessary PID parameters for a basic loop operation for each loop can be setup with the dialogs made 13 available. 14 A B C D V–Memory
V2000
User Data
LOOP #1 32 words
V2037 V2040
LOOP #2
V2077
32 words
LOOP #3 32 words
LOOP #4 32 words
NOTE: Have an edited program open, then click on PLC > Setup > PID to access the Setup PID dialog.
DL06 Micro PLC User Manual, 3rd Edition Rev. A
8–19
Page 96
Chapter 8: PID Loop Operation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D 8–20
Loop Table Word Definitions These are the loop parameters associated with each of the four loops available in the DL06. The parameters are listed in the following table. The address offset is in octal, to help you locate specific parameters in the loop table. For example, if a table begins at V2000, then the location fo the reset (integral) term is Addr+11, or V2011. Do not use the Word # (in the first column) to calculate addresses. Word #
Address+Offset
Description
Format
Change on-the-fly1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
Addr + 0 Addr + 1 Addr + 2 Addr + 3 Addr + 4 Addr + 5 Addr + 6 Addr + 7 Addr + 10 Addr + 11 Addr + 12 Addr + 13 Addr + 14 Addr + 15 Addr + 16 Addr + 17 Addr + 20 Addr + 21 Addr + 22 Addr + 23 Addr + 24 Addr + 25 Addr + 26 Addr + 27 Addr + 30 Addr + 31 Addr + 32 Addr + 33 Addr + 34 Addr + 35 Addr + 36 Addr + 37
PID Loop Mode Setting 1 PID Loop Mode Setting 2 Setpoint Value (SP) Process Variable (PV) Bias (Integrator) Value Control Output Value Loop Mode and Alarm Status Sample Rate Setting Gain (Proportional) Setting Reset (Integral) Time Setting Rate (Derivative) Time Setting PV Value, Low-low Alarm PV Value, Low Alarm PV Value, High Alarm PV Value, High-high Alarm PV Value, deviation alarm (YELLOW) PV Value, deviation alarm (RED) PV Value, rate-of-change alarm PV Value, alarm hysteresis setting PV Value, error deadband setting PV low-pass filter constant Loop derivative gain limiting factor setting SP value lower limit setting SP value upper limit setting Control output value lower limit setting Control output value upper limit setting Remote SP Value V-Memory Address Pointer Ramp/Soak Setting Flag Ramp/Soak Programming Table Starting Address Ramp/Soak Programming Table Error Flags PV auto transfer, channel number Control output auto transfer, channel number bits bits word/binary word/binary word/binary word/binary bits word/BCD word/BCD word/BCD word/BCD word/binary word/binary word/binary word/binary word/binary word/binary word/binary word/binary word/binary word/BCD word/BCD word/binary word/binary word/binary word/binary word/hex bit word/hex bits word/hex word/hex
Yes Yes Yes Yes Yes Yes – Yes Yes Yes Yes No2 No2 No2 No2 No2 No2 No2 No2 Yes Yes No3 Yes Yes No3 No3 Yes Yes No3 No3 Yes Yes
Notes: 1
“Yes” in the column indicates the PID loop will use an updated PID parameter value immediately. Read data only when alarm enable bit transitions from 0 to 1. 3 Read data only on PLC Mode change. 2
DL06 Micro PLC User Manual, 3rd Edition Rev. A
Page 97
Chapter 8: PID Loop Operation
PID Mode Setting 1 Bit Descriptions (Addr + 00) The individual bit definitions of the PID Mode Setting 1 word (Addr+00) are listed in the following table. Bit
PID Mode Setting 1 Description
Read/Write
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Manual Mode Loop Operation request Automatic Mode Loop Operation request Cascade Mode Loop Operation request Bumpless Transfer select Direct or Reverse-Acting Loop select Position / Velocity Algorithm select PV Linear / Square Root Extract select Error Term Linear / Squared select Error Deadband enable Derivative Gain Limit select Bias (Integrator) Freeze select Ramp/Soak Operation select PV Alarm Monitor select PV Deviation alarm select PV rate-of-change alarm select write write write write write write write write write write write write write write write
15
Loop mode is independent from CPU mode when set write
Bit=0
Bit=1
– 01 request – 01 request – 01 request Mode I Mode II Direct Reverse Position Velocity Linear Sq. root Linear Squared Disable Enable Off On Off On Off On Off On Off On Off On Loop with CPU Loop Independent mode of CPU mode
DL06 Micro PLC User Manual, 3rd Edition Rev. A
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
8–21
Page 98
Chapter 8: PID Loop Operation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D 8–22
PID Mode Setting 2 Bit Descriptions (Addr + 01) The individual bit definitions of the PID Mode Setting 2 word (Addr+01) are listed in the following table. Bit
PID Mode 2 Word Description
(PV) and Control Output Range Unipolar/Bipolar 0 Input select (See Notes 1 and 2) 1 Input/Output Data Format select (See Notes 1 and 2) 2 Analog Input filter 3 SP Input limit enable 4 Integral Gain (Reset) units select 5 Select Auto tune PID algorithm 6 Auto tune selection 7 Auto tune start 8 PID Scan Clock (internal use) Data Format 16-bit select 9 Input/Output (See Notes 1 and 2) separate data format for input and output 10 Select (See Notes 2, and 3) Output Range Unipolar/Bipolar select 11 Control See Notes 2, and 3) 12 Output Data Format select (See Notes 2, and 3) 13 Output data format 16-bit select (See Notes 2, and 3) 14–15 Reserved for future use
Read/Write
Bit=0
Bit=1 write unipolar bipolar write write write write write write read/write read
12 bit 15 bit off on disable enable seconds minutes closed loop open loop PID PI only (rate = 0) auto tune done force start – – write not 16 bit select 16 bit write same format separate formats write unipolar bipolar write write –
12 bit not 16 bit –
15 bit select16 bit –
NOTE 1: If the value in bit 9 is 0, then the values in bits 0 and 1 are read. If the value in bit 9 is 1, then the values in bits 0 and 1 are not read, and bit 9 defines the data format (the range is automatically unipolar). NOTE 2: If the value in bit 10 is 0, then the values in bits 0, 1 and 9 define the input and output ranges and data formats (the values in bits 11, 12, and 13 are not read). If the value in bit 10 is 1, then the values in bits 0, 1, and 9 define only the input range and data format, and bits 11, 12, and 13 are read and difine the output range and data format. NOTE 3: If bit 10 has a value of 1 and bit 13 has a value of 0, then bits 11 and 12 are read and define the output range and data format. If bit 10 and bit 13 each have a value of 1, then bits 11 and 12 are not read, and bit 13 defines the data format, (the output range is automatically unipolar).
DL06 Micro PLC User Manual, 3rd Edition Rev. A
Page 99
Chapter 8: PID Loop Operation
Mode/Alarm Monitoring Word (Addr + 06) The individual bit definitions of the Mode / Alarm monitoring (Addr+06) word is listed in the following table. Bit Mode/Alarm Bit Description Read/Write Bit=0 Bit=1 0 Manual Mode Indication 1 Automatic Mode Indication 2 Cascade Mode Indication 3 PV Input LOW–LOW Alarm 4 PV Input LOW Alarm 5 PV Input HIGH Alarm 6 PV Input HIGH–HIGH Alarm 7 PV Input YELLOW Deviation Alarm 8 PV Input RED Deviation Alarm 9 PV Input Rate-of-Change Alarm 10 Alarm Value Programming Error 11 Loop Calculation Overflow/Underflow 12 Loop in Auto-Tune indication 13 Auto-Tune error indication 14–15 Reserved for Future Use read read read read read read read read read read read read read read –
– – – Off Off Off Off Off Off Off – – Off – –
Manual Auto Cascade On On On On On On On Error Error On Error –
Ramp/Soak Table Flags (Addr + 33) The individual bit definitions of the Ramp/Soak Table Flag (Addr+33) word is listed in the following table. Bit
Ramp/Soak Flag Bit Description
0 Start Ramp / Soak Profile 1 Hold Ramp / Soak Profile 2 Resume Ramp / soak Profile 3 Jog Ramp / Soak Profile 4 Ramp / Soak Profile Complete 5 PV Input Ramp / Soak Deviation 6 Ramp / Soak Profile in Hold 7 Reserved 8–15 Current Step in R/S Profile
Read/Write write write write write read read read read read
Bit=0
Bit=1
– 01 Start – 01 Hold – 01 Resume – 01 Jog – Complete Off On Off On – – decode as byte (hex)
Bits 8–15 must be read as a byte to indicate the current segment number of the Ramp/Soak generator in the profile. This byte will have the values 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, and 10, which represent segments 1 to 16 respectively. If the byte=0, then the Ramp/Soak table is not active.
DL06 Micro PLC User Manual, 3rd Edition Rev. A
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
8–23