The text of a manual · part 35 of 68
Programmable Controllers C200HX-CPU-ZE, C200HG-CPU-ZE, C200HE-CPU-ZE Operation Manual: SECTION 5 Instruction Set, pages 314 to 323
Pages 314 to 323 of 613, from Programmable Controllers C200HX-CPU-ZE, C200HG-CPU-ZE, C200HE-CPU-ZE Operation Manual
The original document is the PDF (3.8 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.
Filed in the catalog under the Omron C200H-SP001 and Omron C200HW-PA204
Page 314
Section 5-22
Special Math Instructions Linear Approximation
APR(069) linear approximation is specified when C is a memory address. Word C is the first word of the continuous block of memory containing the linear approximation data. The content of word C specifies the number of line segments in the approximation, and whether the input and output are in BCD or BIN form. Bits 00 to 07 contain the number of line segments less 1, m–1, as binary data. Bits 14 and 15 determine, respectively, the output and input forms: 0 specifies BCD and 1 specifies BIN.
C: 15 14
Not used.
07 06 05 04 03 02 01 00
Number of coordinates minus one (m–1) Output form Input form
Enter the coordinates of the m+1 end-points, which define the m line segments, as shown in the following table. Enter all coordinates in BIN form. Always enter the coordinates from the lowest X value (X1) to the highest (Xm). X0 is 0000, and does not have to be entered. Y
Word Ym Y4 Y3 Y1 Y2 Y0
X X0
X1
X2 X3
X4
Coordinate
C+1
Xm (max. X value)
C+2
Y0
C+3
X1
C+4
Y1
C+5
X2
C+6
Y2
↓
↓
C+(2m+1)
Xm
C+(2m+2)
Ym
Xm
If bit 13 of C is set to 1, the graph will be reflected from left to right, as shown in the following diagram.
Y
Y
X0
Xm
X
Xm
X0
X
The following example demonstrates the construction of a linear approximation with 12 line segments. The block of data is continuous, as it must be, from DM
302
Page 315
Section 5-22
Special Math Instructions
0000 to DM 0026 (C to C + (2 × 12 + 2)). The input data is taken from IR 010, and the result is output to IR 011. 00000
Address
Instruction
00000 00001
LD APR(069)
APR(069) DM 0000
Operands 00000
010
DM 0000 010 011
011
Content Coordinate
Bit 15
DM 0000 DM 0001 DM 0002 DM 0003 DM 0004 DM 0005 DM 0006
$C00B $05F0 $0000 $0005 $0F00 $001A $0402
1 1 0 0 0 0 0 0 0 0 0 0 1 0 1 1
↓
↓
↓
DM 0025 DM 0026
$05F0 $1F20
X12 Y12
X12 Y0 X1 Y1 X2 Y2
Bit 00
(Output and input both BIN)
(m–1 = 11: 12 line segments)
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
$05F0
X
5-22-6 PID CONTROL – PID(190) Ladder Symbol
Operand Data Areas S: Input word
PID(190) IR, SR, AR, DM, EM, HR, LR, S C D
C: First parameter word IR, SR, DM, EM, HR, LR D: Output word IR, SR, AR, DM, EM, HR, LR
Limitations
C and C+32 must be within the same data area. PID(190) is an expansion instruction. A Programming Device can be used to reassign function code 190 to another expansion instruction.
303
Page 316
Section 5-22
Special Math Instructions
Note Do not program PID(190) in the following situations. Doing so may produce unexpected behavior: In interrupt programs, in subroutines, between IL(002) and ILC(003), between JMP(004) and JME(005), and in step programming (when using STEP(008) and SNXT(009)). Description
PID(190) 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 action 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
0
C+7 to C+32
Note
11 to 8
Input range
PID direct/ reverse designation Time units for Output range the sampling period and Integral/deriv ative times
Work area (Cannot be accessed directly from program.)
1. The actual integral and derivative times are calculated using the values set in C+2 and C+3 and the time units set in C+6. 2. Setting the 2-PID parameter (α) to 000 yields 0.65, the normal value.
Performance Specifications Item
Specifications
PID calculation method
---
Target value filter-type, two degrees of freedom (direct/reverse action)
Number of PID control loops
---
No limit (1 loop per instruction)
Sampling period PID constants Proportional band
τ
0.01 to 102.3 s
Set value
P Tik Tdk SV
0.1 to 999.9% 1 to 8191 (For sampling period multiple), 9999 (No integral action) 1 to 8191 (For sampling period multiple), 0 (No derivative action) 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.)
Manipulated variable
MV
0 to 65,535 (Valid up to the maximum value of the output range.)
Integral constant Derivative constant
304
Page 317
Section 5-22
Special Math Instructions Parameter Settings Item Set value (SV) Proportional band (P) 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 action. As this value increases, the integral strength decreases. 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 action) 1× to 8191× when time unit = 0 or 1 0.1 to 819.1 s when time unit = 8 0.01 to 81.91 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 action. 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 action) 1× to 8191× when time unit = 0 or 1 0.1 to 819.1 s when time unit = 8 0.01 to 81.91 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 action.
0001 to 9999 (4 digits BCD); 0.01 to 99.99 s when time unit = 1 or 9 0.1 to 102.3 s when time unit = 0 or 8
PID direct/reverse designation
This is the parameter that determines the direction of the proportional action.
0: Reverse action 1: Direct action (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 2: 10 bits 7: 15 bits 3: 11 bits 8: 16 bits 4: 12 bits (1 digit BCD)
Time units 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
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 manipulated variable 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 manipulated variable 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. Execution Condition ON The PID action is executed at the intervals based on the sampling period, according to the PID parameters that have been set.
305
Page 318
Section 5-22
Special Math Instructions
Sampling Period and PID Execution Timing The sampling period is the time interval to retrieve the measurement data for carrying out a PID action. PID(190), 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 Actions
As the disturbance response is slowed, the target response worsens.
Proportional Action (P) Proportional action is an action in which a proportional band is established with respect to the set value (SV), and within that band the operation amount (the manipulated variable) is made proportional to the deviation. If the present value (PV) is smaller than the proportional band, the manipulated variable will be 100%. If within the proportional band the manipulated variable is made proportional to the deviation and gradually decreased until the SV and PV match (i.e., until the deviation is 0), the manipulated variable will return to the previous value (reverse action). The proportional band is expressed as a percentage with respect to the total input range. With proportional action 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 Action (Reverse Action) Manipulated variable 100%
Proportional band too narrow (hunting occurring) Offset
SV SV
0%
Proportional band just right Proportional band too wide (large offset) Proportional band
Integral Action (I) Combining integral action with proportional action reduces the offset according to the time that has passed. The strength of the integral action is indicated by the integral time, which is the time required for the integral action amount to reach
306
Page 319
Section 5-22
Special Math Instructions the same level as the proportional action 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 action will be. If the integral time is too short, the correction will be too strong and will cause hunting to occur. Integral Action Step response Deviation
0
Manipulated variable
0 PI Action and Integral Time Step response
Deviation
Manipulated variable
0 PI action I action P action 0 Ti: Integral time
Derivative Action (D) Proportional action and integral action both make corrections with respect to the control results, so there is inevitably a response delay. Derivative action compensates for that drawback. In response to a sudden disturbance it delivers a large manipulated variable and rapidly restores the original status. A correction is executed with the manipulated variable made proportional to the incline (derivative coefficient) caused by the deviation. The strength of the derivative action is indicated by the derivative time, which is the time required for the derivative action amount to reach the same level as the proportional action amount with respect to the ramp deviation, as shown in the following illustration. The longer the derivative time, the stronger the correction by the derivative action will be. Derivative Action Step response Deviation
0
Manipulated variable
0 PD Action and Derivative Time Ramp response
Deviation
Manipulated variable
0
PD action P action D action 0 Td: Derivative time
PID Action PID action combines proportional action (P), integral action (I), and derivative action (D). It produces superior control results even for control objects with dead time. It employs proportional action to provide smooth control without hunting,
307
Page 320
Section 5-22
Special Math Instructions integral action to automatically correct any offset, and derivative action to speed up the response to disturbances.
Step Response of PID Action Step response Deviation
Manipulated variable
0
PID action I action P action D action
0 Ramp Response of PID Action Ramp response
Deviation
Manipulated variable
Direction of Action
0 PID action I action D action P action 0
When using PID action, select either of the following two control directions. • Direct action: Manipulated variable is increased when the PV is larger than the SV. Direct Action Manipulated variable 100% SV 0% Low
High Proportional band
• Reverse action: Manipulated variable is increased when the PV is smaller than the SV. Reverse Action Manipulated variable 100% SV 0% Low
High Proportional band
Adjusting PID Parameters
308
The general relationship between PID parameters and control status is shown below.
Page 321
Section 5-22
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 action is tied up by overshooting and undershooting, it is probably because integral action 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 action is too strong. In that case, set the derivative action lower. Control by measured PID (when hunting occurs in a short period) SV Lower D.
Flags
ER:
The content of an word containing an indirect DM/EM address is not BCD or the DM/EM area boundary has been exceeded. A PID parameter SV is out of range. The PID action was executed but the cycle time was two times the sampling period. PID(190) will be executed for this error only even when ER (SR25503) is ON.
CY: Example 1
The PID action is being executed.
At the rising edge of IR 00000 (OFF to ON), the work area in DM 0209 to DM 0236 is initialized according to the parameters (shown below) set in DM 0207 to DM 0207. After the work area has been initialized, PID control is executed and the manipulated variable is output to IR 020. When IR 00000 is turned 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.
309
Page 322
Section 5-22
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.
DM0200
Parameters
PV: word IR 010
PID control
C: C+1:
DM 0200 012C DM 0201 0100
C+2:
DM 0202 1200
C+3: C+4:
DM 0203 0400 DM 0204 0005
C+5:
DM 0205 0000
C+6:
DM 0206 0888
C+7:
DM 0207 to C+32: DM 0232
Derivative time: 40.0 s Sampling period: 0.5 s Reverse action (bit 00: 0) 2-PID parameter = 0.65 (bits 04 to 15: 000 hex) 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
Set value: 300 Proportional band: 10.0% Integral time: 120.0 s
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 CompoBus/D 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
310
Page 323
Section 5-22
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 value 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
Example 2
This example shows a PID control program using PID(190).
CPU
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 a Analog Output Unit. An amplifier (i.e., a current amplification circuit) is required. Creating the Program 1, 2, 3...
Follow the procedure outlined below in creating the program. 1. Set the target value (binary 0000 to 0FFF) in DM 0000. 2. Input the PV of the temperature sensing element (binary 000 to 0FFF) in bits 0 to 11 of word 101.
311