The text of a manual · part 14 of 38
DL06 Micro PLC User Manual, Volume 2 of 2, pages 130 to 139
Pages 130 to 139 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 130
Chapter 8: PID Loop Operation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Operator Panel Control of PID Modes Since the modes Manual, Auto and Cascade are the most fundamental and important PID loop controls, you may want to “hard-wire” mode control switches to an operator’s panel. Most applications will need only Manual and Auto selections (Cascade is used in special applications). Remember that mode controls are really mode request bits, and the actual loop mode is indicated elsewhere. The following figure shows an operator’s panel using momentary push-buttons to request PID mode changes. The panel’s mode indicators do not connect to the switches, but interface to the corresponding data locations. Operator’s Panel Manual Auto
Mode Request PID Mode 1 Setting V+00 Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Cascade
Mode Monitoring
Loop Mode and Alarm Status V+06 Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PLC Modes Effect on Loop Modes If you have selected the option for the loops to follow the PLC mode, the PLC modes (Program, Run) interact with the loops as a group. The following summarizes this interaction: • When the PLC is in Program Mode, all loops are placed in Manual Mode and no loop calculations occur. However, note that output modules (including analog outputs) turn off in PLC Program Mode. So, actual manual control is not possible when the PLC is in Program Mode. • The only time the CPU will allow a loop mode change is during PLC Run Mode operation. As such, the CPU records the modes of all 4 loops as the desired mode of operation. If power failure and restoration occurs during PLC Run Mode, the CPU returns all loops to their prior mode (which could be Manual, Auto, or Cascade). • On a Program-to-Run mode transition, the CPU forces each loop to return to its prior mode recorded during the last PLC Run Mode. • You can add and configure new loops only when the PLC is in Program Mode. New loops automatically begin in Manual Mode.
Loop Mode Override In normal conditions the mode of a loop is determined by the request to V+00, bits 0, 1, and 2. However, some conditions exist which will prevent a requested mode change from occurring: • A loop that is not set independent of PLC mode cannot change modes when the PLC is in Program mode. • A major loop of a cascaded pair of loops cannot go from Manual to Auto until its minor loop is in Cascade mode.
In other situations, the PID loop controller will automatically change the mode of the loop to ensure safe operation: • A loop which develops an error condition automatically goes to Manual. • If the minor loop of a cascaded pair of loops leaves Cascade Mode for any reason, its major loop automatically goes to Manual Mode.
8–54
DL06 Micro PLC User Manual, 3rd Edition Rev. A
Page 131
Chapter 8: PID Loop Operation
PV Analog Filter
1 2 3 4 5 6
7 8 9 10 11 Bit 2 of PID Mode Setting 2 provides the enable/disable control for the low-pass PV filter (0=disable, 1=enable). The roll-off frequency of the single-pole low-pass filter is controlled by using register V+24 in the loop parameter table, the filter constant. The data format of the 12 filter constant value is BCD, with an implied decimal point 00X.X, as follows: • The filter constant has a valid range of 000.1 to 001.0. The smaller the filter value, the greater the 13 filtering performed (for example, the value 001.0 provides no filtering.) • DirectSOFT 5 converts values above the valid range to 001.0 and values below this range to 000.1 14 • Values close to 001.0 result in higher roll-off frequencies, while values closer to 000.1 result in lower roll-off frequencies. A We highly recommend using DirectSOFT 5 for the auto tuning interface. The duration of each auto tuning cycle will depend on the mass of your process. A slowly-changing PV will result in a longer auto tune cycle time. B When the auto tuning is complete, the proportional and integral gain values are automatically updated in loop table locations V+10 and V+11 respectively. The derivative is calculated if C you autotune for PID and updated in loop table location V+12. The sample time in V+07 is also updated automatically. You can test the validity of the values the auto tuning procedure D yields by measuring the closed-loop response of the PV to a step change in the output. The A noisy PV signal can make tuning difficult and can cause the control output to be more extreme than necessary, as the output tries to respond to the peaks and valleys of the PV. There are two equivalent methods of filtering the PV input to make the loop more stable. The first method is accomplished using the DL06’s built-in filter. The second method achieves a similar result using ladder logic. The DL06 Built-in Analog Filter The DL06 provides a selectable first-order low-pass PV input filter. We only recommend the use of a filter during auto tuning or PID control if there is noise on the input signal. You may disable the filter after auto tuning is complete, or continue to use it if the PV input signal is noisy. Loop Calculation
+
Control Output
–
0
Unfiltered PV
Process V ariable
1
Filtered PV
P ID Mode 2 Setting V+01
Loop Table
Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PV filter enable/disable
V+24
XXXX
FIlter constant instructions on how to do this are in the section on the manual tuning procedure.
DL06 Micro PLC User Manual, 3rd Edition Rev. A
8–55
Page 132
Chapter 8: PID Loop Operation
8–56 yi = k (xi – yi–1) + yi–1 yi is the current output of the filter xi is the current input to the filter yi–1 is the previous output of the filter k is the PV Analog Input Filter Factor
Creating an Analog Filter in Ladder Logic A similar algorithm can be built in your ladder program. Your analog inputs can be filtered effectively using either method. The following programming example describes the ladder logic you will need. Be sure to change the example memory locations to those that fit your application. Filtering can induce a 1 part in 1000 error in your output because of “rounding.” If your process cannot tolerate a 1 part in 1000 error, do not use filtering. Because of the rounding error, you should not use zero or full scale as alarm points. Additionally, the smaller the filter constant the greater the smoothing effect, but the slower the response time. Be sure a slower response is acceptable in controlling your process. SP1 LD V2000
BIN
BTOR
SUBR V1400
Loads the analog signal, which is a BCD value and has been loaded from V-memory location V2000, into the accumulator. Contact SP1 is always on. Converts the BCD value in the accumulator to binary. This instruction is not needed if the analog value is originally brought in as a binary number. Converts the binary value in the accumulator to a real number.
Subtracts the real number stored in location V1400 from the real number in the accumulator, and stores the result in the accumulator. V1400 is the designated workspace in this example.
MULR R0.2
Multiplies the real number in the accumulator by 0.2 (the filter factor), and stores the result in the accumulator. This is the filtered value.
ADDR V1400
Adds the real number stored in location V1400 to the real number filtered value in the accumulator, and stores the result in the accumulator.
OUTD V1400
RTOB
BCD
OUT V1402
Copies the value in the accumulator to location V1400.
Converts the real number in the accumulator to a binary value, and stores the result in the accumulator. Converts the binary value in the accumulator to a BCD number. Note: the BCD instruction is not needed for PID loop PV (loop PV is a binary number). Loads the BCD number filtered value from the accumulator into location V1402 to use in your application or PID loop.
DL06 Micro PLC User Manual, 3rd Edition Rev. A
Maintenance
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
The algorithm which the built-in filter follows is:
Page 133
Chapter 8: PID Loop Operation
Use the DirectSOFT 5 Filter Intelligent Box Instruction
1 2 3 4 5 6 7 8 9 FilterB Example 10 Following is an example of how the FilterB IBox is used in a ladder program. The instruction is used to filter a binary value that is in V2000. Timer (T1) is set to 0.5 seconds, the rate at 11 which the filter calculation will be performed. The filter constant is set to 3.0. A larger value will increase the smoothing effect of the filter. A value of 1 results with no filtering. The filtered value will be placed in V2100. 12 13 14 A B See Chapter 5, page 242, for more detailed information. C D For those who are using DirectSOFT 5, you have the opportunity to use Intelligent Box (IBox) instruction IB-402, Filter Over Time in Binary (decimal). This IBox will perform a first-order filter on the Raw Data on a defined time interval. The equation is, New = Old + [(Raw - Old) / FDC] where New =New Filtered Value Old = Old Filtered Value FDC = Filter Divisor Constant Raw = Raw Data The Filter Divisor Constant is an integer in the range K1 to K100, such that if it equaled K1, then no filtering is performed. The rate at which the calculation is performed is specified by time in hundreths of a second (0.01 seconds) as the Filter Freq Time parameter. Note that this Timer instruction is embedded in the IBox and must NOT be used any other place in your program. Power flow controls whether the calculation is enabled. If it is disabled, the Filter Value is not updated. On the first scan from Program to Run mode, the Filter Value is initialized to 0 to give the calculation a consistent starting point. Since the following binary filter example does not write directly to the PID PV location, the BCD filter could be used with BCD values and then converted to BIN.
DL06 Micro PLC User Manual, 3rd Edition Rev. A
8–57
Page 134
Chapter 8: PID Loop Operation
1 Ramp/Soak Generator Introduction 2 Our discussion of basic loop operation noted the setpoint for a loop will be generated in various ways, depending on the loop operating mode and programming preferences. In the figure below, the ramp/soak generator is one of the ways the SP may be generated. It is the 3 responsibility of your ladder program to ensure only one source attempts to write the SP value at V+02 at any particular time. 4
5 6 If the SP for your process rarely changes or can tolerate step changes, you probably will not 7 need to use the ramp/soak generator. However, some processes require precisely-controlled SP value changes. The ramp/soak generator can greatly reduce the amount of programming required for these applications. 8 The terms “ramp” and “soak” have special meanings in the process control industry, and refer to desired setpoint (SP) 9 values in temperature control applications. In the figure to the right, the setpoint increases during the ramp segment. 10 It remains steady at one value during the soak segment. Complex SP profiles can be generated by specifying a series 11 of ramp/soak segments. The ramp segments are specified in SP units per second time. The soak time is also programmable in minutes. 12 It is instructive to view the ramp/soak generator as a dedicated function to generate SP values, as shown below. It has two categories of inputs which determine the SP values generated. The ramp/soak table must be programmed in advance, containing the values that will define the 13 ramp/soak profile. The loop reads from the table during each PID calculation as necessary. The ramp/soak controls are bits in a special loop table word that control the real-time 14 start/stop functionality of the ramp/soak generator. The ladder program can monitor the status of the ramp soak profile (current ramp/segment number). A
B C D Setpoint Sources: Operator Input Ramp/soak generator Ladder Program Another loop’s output (cascade)
Setpoint V+02
Loop Calculation
+
Control Output
–
Process Variable
SP
Soak
Ramp slope
Time
Ramp/soak table
Ramp/soak controls
Ramp/soak Generator
Setpoint
Loop Calculation
+
–
Process Variable
8–58
DL06 Micro PLC User Manual, 3rd Edition Rev. A
Control Output
Page 135
Chapter 8: PID Loop Operation Now that we have described the general ramp/soak generator operation, we list its specific features:
1 • You may specify up to eight ramp/soak steps (16 segments). 2 • The ramp soak generator can run anytime the PLC is in Run mode. Its operation is independent of the loop mode (Manual or Auto). 3 • Ramp/soak real-time controls include Start, Hold, Resume, and Jog. • Ramp/soak monitoring includes Profile Complete, Soak Deviation (SP minus PV), and current 4 ramp/soak step number. The following figure shows a SP profile consisting of ramp/soak segment pairs. The segments 5 are individually numbered as steps from 1 to 16. The slope of each of the ramp may be either increasing or decreasing. The ramp/soak generator automatically knows whether to increase or decrease the SP based on the relative values of a ramp’s end points. These values come from 6 the ramp/soak table. 7 16 15 14 13 8 6 5 4 3 2 Step 9 1 SP 10 11 Ramp/Soak Table The parameters which define the ramp/soak 12 profile for a loop are in a ramp/soak table. Each loop may have its own ramp/soak table, but it is optional. Recall the Loop Parameter table consists 13 a 32-word block of memory for each loop, and together they occupy one contiguous memory 14 area. However, the ramp/soak table for a loop is individually located, because it is optional for each loop. An address pointer in location V+34 in the A loop table specifies the starting location of the ramp/soak table. B In the example to the right, the loop parameter tables for Loop #1 and #2 occupy contiguous 32C word blocks as shown. Each has a pointer to its ramp/soak table, independently located elsewhere in user V-memory. Of course, you may locate all D the tables in one group, as long as they do not • Each loop has its own ramp/soak generator (use is optional).
Ramp
Ramp
Ramp
Ramp
Ramp
Soak
Soak
Soak
Soak
Soak
V–Memory Space User Data
V2000
LOOP #1
V2037 V2040
32 words
LOOP #2
V2077
32 words
V3000
Ramp/Soak #1
V2034 = 3000 octal
V2074 = 3600 octal
32 words
V3600
Ramp/Soak #2 32 words overlap.
DL06 Micro PLC User Manual, 3rd Edition Rev. A
8–59
Page 136
Chapter 8: PID Loop Operation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D 8–60
The parameters in the ramp/soak table must be user-defined. the most convenient way is to use DirectSOFT 5, which features a special editor for this table. Four parameters are required to define a ramp and soak segment pair, as pictured below. • Ramp End Value – specifies the destination SP value for the end of the ramp. Use the same data format for this number as you use for the SP. It may be above or below the beginning SP value, so the slope could be up or down (we don’t have to know the starting SP value for ramp #1). • Ramp Slope – specifies the SP increase in counts (units) per second. It is a BCD number from 00.00 to 99.99 (uses implied decimal point). • Soak Duration – specifies the time for the soak segment in minutes, ranging from 000.1 to 999.9 minutes in BCD (implied decimal point). • Soak PV Deviation – (optional) specifies an allowable PV deviation above and below the SP value during the soak period. A PV deviation alarm status bit is generated by the ramp/soak generator. Ramp End SP Value
Slope
SP
Soak PV deviation Soak duration segment becomes active
Ramp/Soak Table V+00
XXXX
Ramp End SP Value
V+01
XXXX
Ramp Slope
V+02
XXXX
Soak Duration
V+03
XXXX
Soak PV Deviation
The ramp segment becomes active when the previous soak segment ends. If the ramp is the first segment, it becomes active when the ramp/soak generator is started, and automatically assumes the present SP as the starting SP. Offset
Step
+ 00 + 01 + 02 + 03 + 04 + 05 + 06 + 07 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8
Description Ramp End SP Value Ramp Slope Soak Duration Soak PV Deviation Ramp End SP Value Ramp Slope Soak Duration Soak PV Deviation Ramp End SP Value Ramp Slope Soak Duration Soak PV Deviation Ramp End SP Value Ramp Slope Soak Duration Soak PV Deviation
Offset
Step
+ 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 30 + 31 + 32 + 33 + 34 + 35 + 36 + 37
9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16
DL06 Micro PLC User Manual, 3rd Edition Rev. A
Description Ramp End SP Value Ramp Slope Soak Duration Soak PV Deviation Ramp End SP Value Ramp Slope Soak Duration Soak PV Deviation Ramp End SP Value Ramp Slope Soak Duration Soak PV Deviation Ramp End SP Value Ramp Slope Soak Duration Soak PV Deviation
Page 137
Chapter 8: PID Loop Operation Many applications do not require all 16 R/S steps. Use all zeros in the table for unused steps. The R/S generator ends the profile when it finds ramp slope = 0.
Ramp/Soak Table Flags 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 1 2 3 4 5 6 7 8–15
Start Ramp / Soak Profile Hold Ramp / Soak Profile Resume Ramp / soak Profile Jog Ramp / Soak Profile Ramp / Soak Profile Complete PV Input Ramp / Soak Deviation Ramp / Soak Profile in Hold Reserved 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 Off On decode as byte (hex)
Ramp/Soak Generator Enable The main enable control to permit ramp/soak generation of the SP value is accomplished with bit 11 in the PID Mode 1 Setting V+00 word, as shown to the right. The other ramp/soak controls in V+33 shown in the table above will not operate unless this bit=1 during the entire ramp/soak process.
PID Mode 1 Setting V+00 Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Ramp/Soak Generator Enable
Ramp/Soak Controls The four main controls for the ramp/soak generator are in bits Ramp/Soak Settings V+33 0 to 3 of the ramp/soak settings word in the loop parameter table. DirectSOFT 5 controls these bits directly from the Jog ramp/soak settings dialog. However, you must use ladder logic Resume Hold to control these bits during program execution. We Start recommend using the bit-of-word instructions. Ladder logic must set a control bit to a “1” to command the corresponding function. When the loop controller reads the ramp/soak value, it automatically turns off the bit for you. Therefore, a reset of the bit is not required, when the CPU is in Run Mode. The example program rung to the right shows how an Start R/S Generator external switch X0 can turn on, and the PD contact uses X0 B2033.0 the leading edge to set the proper control bit to start the SET ramp soak profile. This uses the Set Bit-of-word instruction. Bit 15 14 13 12 11 10 9 8
7
6 5
DL06 Micro PLC User Manual, 3rd Edition Rev. A
4
3
2 1
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
8–61
Page 138
Chapter 8: PID Loop Operation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D 8–62
The normal state for the ramp/soak control bits is all zeros. Ladder logic must set only one control bit at a time. • Start – a 0 to 1 transition will start the ramp soak profile. The CPU must be in Run Mode, and the loop can be in Manual or Auto Mode. If the profile is not interrupted by a Hold or Jog command, it finishes normally. • Hold – a 0 to 1 transition will stop the ramp/soak profile in its current state, and the SP value will be frozen. • Resume – a 0 to 1 transition cause the ramp/soak generator to resume operation if it is in the hold state. The SP values will resume from their previous value. • Jog – a 0 to 1 transition will cause the ramp/soak generator to truncate the current segment (step), and go to the next segment.
Ramp/Soak Profile Monitoring You can monitor the Ramp/Soak profile status using other bits in the Ramp/Soak Settings V+33 word, shown to the right. • R/S Profile Complete – =1 when the last programmed step is done. • Soak PV Deviation – =1 when the error (SP–PV) exceeds the specified deviation in the R/S table.
Ramp/Soak Settings V+33 Bit 15 14 13 12 11 10 9 8
7
6 5
4
3
2 1
0
R/S Profile in Hold Soak PV Deviation R/S Profile Complete
• R/S Profile in Hold – =1 when the profile was active but is now in hold. Ramp/Soak Settings V+33 Ramp/Soak Settings V+33 The number of the current step is available in the upper 8 bits of the Ramp/Soak Settings V+33 word. The bits represent a 2digit hex number, ranging from 1 to 10. Ladder logic can monitor these to synchronize other parts of the program with Current Profile Step, 2–digit hex Value = 01 to 10 hex, the ramp/soak profile. Load this word to the accumulator and or 1 to 16 decimal shift right 8 bits, and you have the step number. Bit 15 14 13 12 11 10 9 8
7
6 5
4
3
2 1
0
Ramp/Soak Programming Errors The starting address for the ramp/soak table must be a valid location. If the address points outside the range of user Vmemory, one of the bits to the right will turn on when the ramp/soak generator is started. We recommend using DirectSOFT 5 to configure the ramp/soak table. It automatically range checks the addresses for you.
Testing Your Ramp/Soak Profile
Ramp/Soak Table Error V+35 Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Starting Address set in reserved system V-memory Starting Address set out of V-memory upper range Starting Address set out of V-memory lower range
It’s a good idea to test your ramp/soak profile before using it to control the process. This is easy to do, because the ramp/soak generator will run even when the loop is in Manual Mode. Using DirectSOFT 5’s PID View will be a real time-saver, because it will draw the profile onscreen for you. Be sure to set the trending timebase slow enough to display completed rampsoak segment pairs in the waveform window.
DL06 Micro PLC User Manual, 3rd Edition Rev. A
Page 139
Chapter 8: PID Loop Operation
DirectSOFT 5 Ramp/Soak Example The following following example will step you through the Ramp/Soak setup.
Setup the Profile in PID Setup The first step is to use Setup PID in DirectSOFT 5 to set the profile of your process. Open the Setup PID window and select the R/S tab, and then enter the Ramp and Soak data.
Program the Ramp/Soak Control in Relay Ladder Refer to the Ramp/Soak Flag Bit Description table on page 8-60 when adding the control rungs to your program similar to the ladder rungs below.
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–63