The text of a manual · part 30 of 60
C200HX/C200HG/C200HE Programmable Controllers Operation Manual, pages 284 to 293
Pages 284 to 293 of 586
The original document is the PDF (3.4 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 Omron C200HE-CPU42-E
Page 284
Section 5-21
Special Math Instructions
In this case, the input data word, IR 010, contains #0014, and f(0014) = #0726 is output to R, IR 011. Y $1F20
$0F00
(x,y)
$0726 $0402
(0,0)
$0005
$0014
$001A
X
$05F0
5-21-6 PID CONTROL – PID(––) Operand Data Areas
Ladder Symbol
S: Input word PID(––) IR, SR, AR, DM, HR, LR S
C: First parameter word
C
IR, SR, DM, HR, LR
D
D: Output word IR, SR, AR, DM, HR, LR
Limitations
C and C+32 must be within the same data area. Note Do not program PID(––) in the following situations. Doing so may produce unexpected behavior: In interrupt programs, in subroutines, between IL(02) and ILC(03), between JMP(04) and JME(05), and in step programming (when using STEP(08) and SNXT(09)).
Description
PID(––) carries out PID control according to the designated parameters. It takes the specified input range of binary data from the contents of input word S and carries out the PID operation according to the parameters that are set. The results are then stored as the operation output amount in output word D. PID parameter words range from C through C+32. The PID parameters are configured as shown below. Word
15 to 12
7 to 4
3 to 0
C
Set value (SV)
C+1
Proportional band (P)
C+2
Tik = Integral time T1/sampling period γ (See note 1.)
C+3
Tdk = Derivative time Td/sampling period γ (See note 1.)
C+4
Sampling period γ
C+5
2-PID parameter (α) (See note 2.)
C+6
C+7 to C+32
266
11 to 8
0
Input range
Time unit for sampling period and integral/derivative times
PID forward/ reverse designation Output range
Work area (Cannot be accessed directly from program.)
Page 285
Section 5-21
Special Math Instructions Note
1. The actual integral and derivative times are calculated using the values set in C+2 and C+3 and the time unit set in C+6. 2. Setting the 2-PID parameter (α) to 000 yields 0.65, the normal value. 3. The only CQM1 model that can use PID(––) is the
Performance Specifications Item
Specifications
PID calculation method
---
Number of PID control loops
---
Target value filter-type, two degrees of freedom (forward/reverse operation) No limit (1 loop per instruction)
Sampling period PID constants Proportional band t
0.01 to 102.3 s (See note.)
P Tik
Set value
Tdk SV
0.1 to 999.9% 1 to 8191, 9999 (No integral operation for sampling period multiple or 9999.) 0 to 8191 (No derivative operation for sampling period multiple.) 0 to 65,535 (Valid up to the maximum value of the input range.)
Measured value
PV
0 to 65,535 (Valid up to the maximum value of the input range.)
Operation output amount
MV
0 to 65,535 (Valid up to the maximum value of the output range.)
Integral constant Derivative constant
Note For the C200HS and the the sampling period is 0.1 to 102.3 s.
267
Page 286
Section 5-21
Special Math Instructions Parameter Settings Item Set value (SV) Proportional band Integral time (Tik)
Contents This is the target value of the process being controlled. This is the parameter for P control expressing the proportional control range/total control range. This is a constant expressing the strength of the integral operation. As this value increases, the integral strength increases. The time unit parameter determines the setting method.
Setting range Binary data (of the same number of bits as specified for the input range) 0001 to 9999 (4 digits BCD); (0.1% to 999.9%, in units of 0.1%) 0001 to 8191 (4 digits BCD); (9999 = No integral operation) 1× to 8191× when time unit = 0 or 1 0.1 to 819.1 s when time unit = 8 0.1 to 81.9 s when time unit = 9 Set to between 1 and 8191 times the sampling period when a constant time is used.
Derivative time (Tdk)
This is a constant expressing the strength of the derivative operation. As this value increases, the derivative strength increases. The time unit parameter determines the setting method.
0001 to 8191 (4 digits BCD); (0000 = No derivative operation) 1× to 8191× when time unit = 0 or 1 0.1 to 819.1 s when time unit = 8 0.1 to 81.9 s when time unit = 9 Set to between 1 and 8191 times the sampling period when a constant time is used.
Sampling period
This sets the period for executing the PID operation.
C200HX/HG/HE, 0001 to 1023 (4 digits BCD); (0.1 to 102.3 s, in units of 0.1 s) C200HX/HG/HE only: 0001 to 9999 (4 digits BCD); (0.01 to 99.99 s, in units of 0.01 s)
PID forward/reverse designation
This is the parameter that determines the direction of the proportional operation.
0: Reverse operation 1: Forward operation (1 digit BCD)
2-PID parameter (α)
This is the input filter coefficient. Normally use 0.65 (i.e., a setting of 000). The filter efficiency decreases as the coefficient approaches 0.
Input range
This is the number of input data bits.
000: α = 0.65 100 to 199: Rightmost two digits are α, i.e., 0.00 to 0.99. (3 digits BCD) 0: 8 bits 5: 13 bits 1: 9 bits 6: 14 bits 7: 15 bits 2: 10 bits 8: 16 bits 3: 11 bits (1 digit BCD) 4: 12 bits
Time unit for sampling period and integral/derivative times
Specifies the time unit for the sampling period and the method for setting the integral/derivative parameters.
Output range
This is the number of output data bits.
PID CONTROL Operation
268
0, 1, 8, or 9 (1 digit BCD) 0: Constant time, Unit: 100 ms 1: Constant time, Unit: 10 ms 8: Relative time, Unit: 100 ms 9: Relative time, Unit: 10 ms Same as the setting range for the input range.
Execution Condition OFF All data that has been set is retained. Then the execution condition is OFF, the operation amount can be written to the output word (D) to achieve manual control. Rising Edge of the Execution Condition The work area is initialized based on the PID parameters that have been set and the PID control operation is begin. Sudden and radical changes in the operation output amount are not made when starting operation to avoid adverse affect on the controlled system (bumpless operation). When PID parameters are changed, they first become valid when the execution condition changes from OFF to ON.
Page 287
Section 5-21
Special Math Instructions
Execution Condition ON The PID operation is executed at the intervals based on the sampling period, according to the PID parameters that have been set. Sampling Period and PID Execution Timing The sampling period is the time interval to retrieve the measurement data for carrying out a PID operation. PID(––), however, is executed according to the CPU Unit’s sampling time, so there may be cases where the sampling period is exceeded. In such cases, the time interval until the next sampling is reduced. PID Control Method
PID control operations are executed by means of PID control with feed-forward control (two degrees of freedom). When overshooting is prevented with simple PID control, stabilization of disturbances is slowed (1). If stabilization of disturbances is speeded up, on the other hand, overshooting occurs and response toward the target value is slowed (2). With feed-forward PID control, there is no overshooting, and response toward the target value and stabilization of disturbances can both be speeded up (3).
Simple PID Control
Feed-forward PID control
(1)
As the target response is slowed, the disturbance response worsens.
Target response
Disturbance response
(2)
Overshoot
Control Operations
As the disturbance response is slowed, the target response worsens.
Proportional Operation (P) Proportional operation is an operation in which a proportional band is established with respect to the set value (SV), and within that band the operation amount (the control output amount) is made proportional to the deviation. If the present value (PV) is smaller than the proportional band, the operation amount will be 100%. If within the proportional band the operation amount is made proportional to the deviation and gradually decreased until the SV and PV match (i.e., until the deviation is 0), the operation amount will return to the previous value (forward operation). The proportional band is expressed as a percentage with respect to the total input range. With proportional operation an offset (residual deviation) occurs, and the offset is reduced by making the proportional band smaller. If it is made too small, however, hunting will occur. Adjusting the Proportional Band
Proportional Operation (Reverse Operation) Operation amount 100%
Proportional band too narrow (hunting occurring) Offset
SV SV
0%
Proportional band just right Proportional band too wide (large offset) Proportional band
Integral Operation (I) Combining integral operation with proportional operation reduces the offset ac-
269
Page 288
Section 5-21
Special Math Instructions cording to the time that has passed. The strength of the integral operation is indicated by the integral time, which is the time required for the integral operation amount to reach the same level as the proportional operation amount with respect to the step deviation, as shown in the following illustration. The shorter the integral time, the stronger the correction by the integral operation will be. If the integral time is too short, the correction will be too strong and will cause hunting to occur. Integral Operation Step response Deviation
0
Operation 0 amount PI Operation and Integral Time Step response Deviation
Operation amount
0 PI operation I operation P operation 0 Ti: Integral time
Derivative Operation (D) Proportional operation and integral operation both make corrections with respect to the control results, so there is inevitably a response delay. Derivative operation compensates for that drawback. In response to a sudden disturbance it delivers a large operation amount and rapidly restores the original status. A correction is executed with the operation amount made proportional to the incline (derivative coefficient) caused by the deviation. The strength of the derivative operation is indicated by the derivative time, which is the time required for the derivative operation amount to reach the same level as the proportional operation amount with respect to the step deviation, as shown in the following illustration. The longer the derivative time, the stronger the correction by the derivative operation will be. Derivative Operation Step response Deviation 0
Operation 0 amount PD Operation and Derivative Time Ramp response Deviation 0
PD operation P operation D operation
Operation 0 amount Td: Derivative time
270
Page 289
Section 5-21
Special Math Instructions
PID Operation PID operation combines proportional operation (P), integral operation (I), and derivative operation (D). It produces superior control results even for control objects with dead time. It employs proportional operation to provide smooth control without hunting, integral operation to automatically correct any offset, and derivative operation to speed up the response to disturbances. PID Operation Output Step Response Step response Deviation 0
PID operation I operation P operation D operation
Operation 0 amount PID Operation Output Ramp Response Ramp response Deviation 0
PID operation I operation P operation D operation
Operation 0 amount
Direction of Operation
When using PID operation, select either of the following two control directions. In either direction, the operation amount increases as the difference between the SV and the PV increases. • Forward operation: Control amount is increased when the SV is larger than the PV. Forward Operation Operation amount 100% SV 0% Low
High Proportional band
• Reverse operation: Control amount is decreased when the SV is smaller than the PV. Reverse Operation Operation amount 100% SV 0% Low
High Proportional band
Adjusting PID Parameters
The general relationship between PID parameters and control status is shown below.
271
Page 290
Section 5-21
Special Math Instructions
• When it is not a problem if a certain amount of time is required for stabilization (settlement time), but it is important not to cause overshooting, then enlarge the proportional band. Control by measured PID SV When P is enlarged
• When overshooting is not a problem but it is desirable to quickly stabilize control, then narrow the proportional band. If the proportional band is narrowed too much, however, then hunting may occur. When P is narrowed SV Control by measured PID
• When there is broad hunting, or when operation is tied up by overshooting and undershooting, it is probably because integral operation is too strong. The hunting will be reduced if the integral time is increased or the proportional band is enlarged. Control by measured PID (when loose hunting occurs) SV Enlarge I or P.
• If the period is short and hunting occurs, it may be that the control system response is quick and the derivative operation is too strong. In that case, set the derivative operation lower. Control by measured PID (when hunting occurs in a short period) SV Lower D.
Flags
ER:
Content of word is not BCD, or the DM area boundary has been exceeded. A PID parameter SV is out of range. The PID operation was executed but the cycle time was two times the sampling period. PID(––) will be executed for this error only even when ER (SR25503) is ON.
CY: Example 1
272
The PID operation is being executed.
At the rising edge of IR 00000 (OFF to ON), the work area in DM 0207 to DM 0232 is initialized according to the parameters (shown below) set in DM 0200 to DM 0206. After the work area has been initialized, PID control is executed and the manipulated variable is output to IR 020. While IR 00000 is ON, PID control is executed at the sampling period intervals according to the parameters set in DM 0200 to DM 0206. The manipulated variable is output to IR 020.
Page 291
Section 5-21
Special Math Instructions
The PID constants used in PID calculations will not be changed if the proportional band (P), integral constant (Tik), or derivative constant is changed after IR 00000 turns ON.
DM
Parameters
PV: word IR 010
C: DM 0200 C+1: DM 0201
012C 0100
C+2: DM 0202
1200
Set value: 300 Proportional band: 10.0% Integral time: 120.0 s
C+3: DM 0203
0400
Derivative time: 40.0 s
C+4: DM 0204
0005
C+5: DM 0205
0000
C+6: DM 0206
0888
Sampling period: 0.5 s Reverse operation (bit 00: 0) 2-PID parameter = 0.65 (bits 04 to 15: 000 hex)
C+7: DM 0207 PID control to C+32: DM 0232
Manipulated variable output range: 16 bits (bits 00 to 03: 8 hex) Integral/derivative constant: time designation, 100-ms units (bits 04 to 07: 8 hex) Input range: 12 bits (bits 08 to 11: 8 hex)
Note When IR 00000 is OFF, operation can be the same as manual operation by writing to IR 020.
Manipulated variable output: IR 020
Input Values and Manipulated Variable Ranges
Work area
The number of valid input data bits for the measured value is designated by the input range setting in C+6, bits 08 to 11, and the number of valid output data bits for the manipulated variable output is designated by the output range setting in C+6, bits 0 to 3. These ranges are shown in the following table. C+6, bits 08 to 11 or C+6, bits 00 to 03 0
Number of valid bits
Range
8
0000 to 00FF Hex
1
9
0000 to 01FF Hex
2
10
0000 to 03FF Hex
3
11
0000 to 07FF Hex
4
12
0000 to 0FFF Hex
5
13
0000 to 1FFF Hex
6
14
0000 to 3FFF Hex
7
15
0000 to 7FFF Hex
8
16
0000 to FFFF Hex
If the range of data handled by an Analog Input Unit or Analog Output Unit cannot be set accurately by setting the number of valid bits, APR(069) (ARITHMETIC PROCESS) can be used to convert to the proper ranges before and after PID(190). The following program section shows an example for a DRT1-AD04 Analog Input Unit and DRT1-DA02 Analog Output Unit operating as DeviceNet slaves. The data ranges for these two Units is 0000 to 1770 Hex, which cannot be specified merely by setting the valid number of digits. APR(069) is thus used to convert the 0000 to 1770 Hex range of the Analog Input Unit to 0000 to FFFF Hex for input to PID(190) and then the manipulated variable output from PID(190) is
273
Page 292
Section 5-21
Special Math Instructions converted back to the range 0000 to 1770 Hex, again using APR(069), for output from the Analog Output Unit. From Analog Input Unit Execution condition ARP DM 1000 Analog input word DM 2000
PID DM 2000 DM 2500 DM 3000
ARP DM 1500 DM 3000 Analog output word
Control Data C (DM 1000): C000 Hex (binary with one table) C+1 (DM 1001): 1770 Hex (Xm) C+2 (DM 1002): 0000 Hex (Yo) C+3 (DM 1003): 1770 Hex (X1) C+4 (DM 1004): FFFF Hex (Y1) Control Data C+6 (DM 2506):
Valid number of bits: 16 (0000 to FFFF Hex) Valid number of bits: 16 (0000 to FFFF Hex) Control Data C (DM 1500): 0000 Hex (binary with one table) C+1 (DM 1501): FFFF Hex (Xm) C+2 (DM 1502): 0000 Hex (Yo) C+3 (DM 1503): FFFF Hex (X1) C+4 (DM 1504): 1770 Hex (Y1)
To Analog Output Unit Y (Hex)
Y (Hex)
Y1: FFFF
Y1: 1770
Y0: 0000 0000
274
X1: 1770 (x m)
X (Hex)
Y0: 0000 0000
X1: FFFF (x m)
X (Hex)
Page 293
Section 5-21
Special Math Instructions Example 2
This example shows a PID control program using PID(––).
CPU Unit
AD001 DA001
#0
#1
Amplifier (See note below.)
Fan (Output word IR 111)
Temperature sensing element (Output word IR 100)
Amplifier (See note below.) Heater (Output word IR110)
Note Motors and heaters cannot be directly connected from an Analog Output Unit. An amplifier (i.e., a current amplification circuit) is required.
275