Wiki source code of 11 PID Control Instruction

Version 2.7 by Iris on 2025/09/17 19:49

Show last authors
1 == **PID/PID calculation** ==
2
3 **PID**
4
5 This instruction is used to perform PID control that changes the output value according to the amount of input change.
6
7 -[PID (s1)(s2)(s3)(d)]
8
9 **Content, range and data type**
10
11 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
12 |(s1)|Device number for storing the target value (SV)|-32767 to 32767|Signed BIN 16 bit|ANY16
13 |(s2)|Device number for storing the measured value (PV)|-32767 to 32767|Signed BIN 16 bit|ANY16
14 |(s3)|Device number for storing parameters|1 to 32767|Signed BIN 16 bit|ANY16
15 |(d)|Device number for storing output value (MV)|-32767 to 32767|Signed BIN 16 bit|ANY16
16
17 **Device used**
18
19 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="3" %)**Devices**|(((
20 **Offset modification**
21 )))|(((
22 **Pulse extension**
23 )))
24 |**D**|**R**|**SD**|**[D]**|**XXP**
25 |(% rowspan="4" %)PID|Parameter 1|●|●|●| |
26 |Parameter 2|●|●|●| |
27 |Parameter 3|●|●|●| |
28 |Parameter 4|●|●|●| |
29
30 **Features**
31
32 This instruction is to complete the PID operation and is used to control the parameters of the closed-loop control system. PID control has a wide range of applications in mechanical equipment, pneumatic equipment, constant pressure water supply and electronic equipment, etc. among them:
33
34 [[image:11_html_1c6bb88c06ac24cf.png]] is the target value of PID control;
35
36 [[image:11_html_fb5122fb6e3a43d5.png]] is the measured feedback value;
37
38 [[image:11_html_6c3fad4a32a3db43.png]] The starting address of the buffer area for setting parameters required for PID operation and saving intermediate results, occupies a total of 26 variable units in the subsequent addresses, the value range is D0 to D7974, it is best to specify the power failure retention area, which will remain after the power is OFF Set the value, otherwise the buffer area needs to be assigned value before starting the operation for the first time. The function and parameter description of each unit are described in this section;
39
40 [[image:11_html_b126b1b2673dc1f4.png]] is the storage unit of the PID calculation result. Please designate [[image:11_html_d47cd1f59b766ed3.png]] as a non-battery holding area, otherwise it needs to be initialized and cleared before starting the calculation for the first time.
41
42 **Programming example**
43
44 [[image:1758108900843-990.png]]
45
46 The parameter description is as follows:
47
48 What is stored in D9 is the target value of PID adjustment, and D10 is the closed-loop feedback value. Note that D9 and D10 must be of the same dimension, such as both 0.01MPa units, or 1℃ units, etc.;
49
50 A total of 26 units of D200 to D225 are used to store the set value and process value of PID operation. These values must be set item by item before the first PID calculation;
51
52 The D130 unit is used to store the calculated control output value to control the execution of the action.
53
54 The function and setting method of the parameter value of each unit about starting of [[image:11_html_6c3fad4a32a3db43.png]] are described in the following table:
55
56 |**Unit**|**Features**|**Setting instructions**
57 |[[image:11_html_6c3fad4a32a3db43.png]]|Sampling time (TS)|The setting range is 1 to 32767 (ms), but it needs to be greater than the PLC program scan period
58 |[[image:11_html_6c3fad4a32a3db43.png]] +1|Action direction (ACT)|(((
59 bit0: 0 = positive action; 1 = reverse action bit3: 0 = unidirectional; 1 = bidirectional
60
61 bit4: 0 = auto-tuning does not work; 1 = auto-tuning is executed, others cannot be used.
62 )))
63 |[[image:11_html_6c3fad4a32a3db43.png]] +2|Maximum ascent rate (DeltaT)|Setting range 0 to 32000 is the threshold of integral increment
64 |[[image:11_html_6c3fad4a32a3db43.png]] +3|Proportional gain (Kp)|Setting range 0 to 32767, note that this value is enlarged by 256 times, the actual value is Kp/256
65 |[[image:11_html_6c3fad4a32a3db43.png]] +4|Integral gain (Ki)|Setting range 0 to 32767, Ki=16384Ts/Ti, Ti is the integral time
66 |[[image:11_html_6c3fad4a32a3db43.png]] +5|Differential gain (Kd)|Setting range 0 to 32767, Kd≈Td/Ts, Td is the derivative time
67 |[[image:11_html_6c3fad4a32a3db43.png]] +6|Filtering (C0)|Setting range 0 to 1023, integral part filtering
68 |[[image:11_html_6c3fad4a32a3db43.png]] +7|Output lower limit|(((
69 Recommended setting range -2000 to 2000
70
71 {{id name="OLE_LINK630"/}}When bit3 of S3+1=0, set to 0; When bit3 of S3+1=1, set to -2000;
72 )))
73 |[[image:11_html_6c3fad4a32a3db43.png]] +8|Output upper limit|Recommended setting value 2000
74 |[[image:11_html_6c3fad4a32a3db43.png]] +9|Reserved|Reserved
75 |︙|︙|︙
76 |[[image:11_html_6c3fad4a32a3db43.png]] +25|Reserved|Reserved
77
78 **Auto tuning example**
79
80 (% style="text-align:center" %)
81 [[image:11_html_c64303b9c6a47ae9.png||class="img-thumbnail"]]
82
83 **✎Note:**
84
85 ● When multiple instructions are used, the device number of (d) cannot be repeated.
86
87 ● During the execution of auto-tuning, the (s3) parameter space cannot be modified.
88
89 ● The instruction occupies 26 point devices from the device specified in (s3).
90
91 ● PID instruction can be used multiple times in the program and can be executed at the same time, but the variable area used in each PID instruction should not overlap; it can also be used in step instructions, jump instructions, timing interrupts, and subroutines, in this case When executing the PID instruction, the (s3)+9 cache unit must be cleared in advance.
92
93 ● The maximum error of the sampling time Ts is -(1 operation cycle +1ms) +(1 operation cycle). If the sampling time Ts ≤ 1 operation cycle of the programmable controller, the following PID operation error (4D86H) will occur, and the PID operation will be executed with TS = operation cycle. In this case, it is recommended to use constant scan mode or use PID instruction in timer interrupt.
94
95 **Error code**
96
97 |**Error code**|**Content**
98 |4085H|When the device specified in the read application instructions (s1), (s2), (s3), (d) exceeds the range of the corresponding device.
99 |4086H|When the device specified in the write application instruction (s3) and (d) exceeds the range of the corresponding device.
100 |4D80H|The sampling time is out of range.​(T,,S,,≤0)
101 |4D81H|Input filter constant (,, ,,α ) is out of range (α​<0 or α>1023)
102 |4D82H|The maximum ascent rate (△T) is out of range.(△T​<0 or △T​>1023)
103 |4D83H|The proportional gain (K//p//) is out of range.​​​​(K//p//<0)
104 |4D84H|The integral gain (K//i//) is out of range.(K//i​//<0)
105 |4D85H|The differential gain (K//d//) is out of range.​​​​(K//d//<0)
106 |4D86H|The sampling time (T//s//) is less than the operation cycle.​​​​(T//s//<Scan cycle)
107
108 **Example**
109
110 See manual.
111
112 == {{id name="_Toc32463"/}}{{id name="_Toc21837"/}}{{id name="_Toc31152"/}}**CCPID/CCPID calculation** ==
113
114 **CCPID**
115
116 This instruction is used to perform PID control that changes the output value according to the amount of input change.
117
118 -[CCPID (s1) (s2) (s3) (d)]
119
120 **Content, range and data type**
121
122 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
123 |(s1)|Device number for storing the target value (SV)|-32767 to 32767|Signed BIN 16 bit|ANY16
124 |(s2)|Device number for storing the measured value (PV)|-32767 to 32767|Signed BIN 16 bit|ANY16
125 |(s3)|Device number for storing parameters|1 to 32767|Signed BIN 16 bit|ANY16
126 |(d)|Device number for storing output value (MV)|-32767 to 32767|Signed BIN 16 bit|ANY16
127
128 **Device used**
129
130 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="3" %)**Devices**|(((
131 **Offset modification**
132 )))|(((
133 **Pulse extension**
134 )))
135 |**D**|**R**|**SD**|**[D]**|**XXP**
136 |(% rowspan="4" %)CCPID|Parameter 1|●|●|●| |
137 |Parameter 2|●|●|●| |
138 |Parameter 3|●|●|●| |
139 |Parameter 4|●|●|●| |
140
141 **Features**
142
143 After setting target value (s1), measured value (s2), parameter (s3) to (s3) +12 and executing the program, the calculation result (MV) will be stored to the output according to the first sampling time (s3) in the parameter Value (d). For details, please refer to the user manual of "Wecon CC Series ccpid Function Description v1.4".
144
145 **✎Note:**
146
147 It can be executed multiple times at the same time (there is no limit to the number of loops), but please note that the device numbers (s3) and (d) used in the calculation cannot be repeated.
148
149 The instruction occupies 52 points of devices starting from the device specified in (s3).
150
151 During the execution of auto-tuning, the (s3) parameter space cannot be modified.
152
153 **Error code**
154
155 |**Error code**|**Content**
156 |4085H|When the device specified in the read application instructions (s1), (s2), (s3), (d) exceeds the range of the corresponding device.
157 |4086H|When the device specified in the write application instruction (s3) and (d) exceeds the range of the corresponding device.
158 |4D80H|The sampling time is out of range.​(T,,S,,≤0)
159 |4D81H|Input filter constant (Co) is out of range (Co<0 or Co≥1023)
160 |4D82H|The maximum ascent rate (△//T//) is out of range.(△//T//​<0 or △//T//​>32000)
161 |4D83H|(((
162 The proportional gain (Kp) is out of range. Kp<0[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps287.png]]
163 )))
164 |(((
165 4D84H
166 )))|(((
167 The integral gain (Ki) is out of range. Ki<0[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps288.png]]
168 )))
169 |4D85H|(((
170 The differential gain (Kd) is out of range. Kd<0[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps289.png]]
171 )))
172 |4D86H|The sampling time (Ts) is less than the operation cycle.​​​​(T//s//<Scan cycle)
173
174 **FPID/FPID calculation**
175
176 **FPID**
177
178 The function of this instruction is to adjust PID control parameters by fuzzy algorithm.
179
180 -[FPID (s) (d1) (d2) (d3)]
181
182 **Content, range and data type**
183
184 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
185 |(s)|Store the start number of the device of the fuzzy parameter table (no input required)|-|Signed BIN 16 bit|ANY16
186 |(d1)|Start number of the device storing the initialization parameters|-|Signed BIN 16 bit|ANY16
187 |(d2)|Store the start number of the device of the input PID parameter|-|Signed BIN 16 bit|ANY16
188 |(d3)|The start number of the device that stores the adjusted PID parameters|-|Signed BIN 16 bit|ANY16
189
190 **Device used**
191
192 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="4" %)**Soft component**|**Offset modification**|(((
193 **Pulse extension**
194 )))
195 |**D**|**R**|**SD**|**LC**|**[D]**|**XXP**
196 |(% rowspan="4" %)FPID|Parameter 1|●|●|●|●| |
197 |Parameter 2|●|●|●|●| |
198 |Parameter 3|●|●|●|●| |
199 |Parameter 4|●|●|●|●| |
200
201 **Features**
202
203 This instruction needs to be used in conjunction with the PID instruction. It completes the fuzzy calculation of the adjustments of the three parameters of PID, Kp, Ki, and Kd. By passing in the three parameters of the PID, the new three parameters are calculated and substituted into the PID for output control.
204
205 **Parameter Description:**
206
207 |(% colspan="6" %)**S parameter setting**
208 |**Parameter**|**Offset address**|**Name**|**Format**|**Instruction**|**Range**
209 |Parameter 1|S|-|-|-|-
210
211 |(% colspan="6" %)**d1 parameter setting**
212 |**Parameter**|**Offset address**|**Name**|**Format**|**Instruction**|**Range**
213 |(% rowspan="2" %)Parameter 1|d1|(% rowspan="2" %)em domain|(% rowspan="2" %)Floating point|(% rowspan="2" %)Temperature difference|(% rowspan="2" %)>0
214 |d1+1
215 |(% rowspan="2" %)Parameter 2|d1+2|(% rowspan="2" %)ecm domain|(% rowspan="2" %)Floating point|(% rowspan="2" %)Temperature difference|(% rowspan="2" %)>0
216 |d1+3
217 |(% rowspan="2" %)Parameter 3|d1+4|(% rowspan="2" %)kpm coefficient|(% rowspan="2" %)Floating point|(% rowspan="2" %)0.5 (fixed) (not set)|(% rowspan="2" %)-
218 |d1+5
219 |(% rowspan="2" %)Parameter 4|d1+6|(% rowspan="2" %)kim coefficient|(% rowspan="2" %)Floating point|(% rowspan="2" %)1 (fixed) (not set)|(% rowspan="2" %)-
220 |d1+7
221 |(% rowspan="2" %)Parameter 5|d1+8|(% rowspan="2" %)kdm coefficient|(% rowspan="2" %)Floating point|(% rowspan="2" %)1 (fixed) (not set)|(% rowspan="2" %)-
222 |d1+9
223 |(% rowspan="2" %)Parameter 6|d1+10|(% rowspan="2" %)EM|(% rowspan="2" %)32-bit integer|(% rowspan="2" %)6 (fixed) (not set)|(% rowspan="2" %)-
224 |d1+11
225 |(% rowspan="2" %)Parameter 7|d1+12|(% rowspan="2" %)ECM|(% rowspan="2" %)32-bit integer|(% rowspan="2" %)6 (fixed) (not set)|(% rowspan="2" %)-
226 |d1+13
227 |(% rowspan="2" %)Parameter 8|d1+14|(% rowspan="2" %)UM|(% rowspan="2" %)32-bit integer|(% rowspan="2" %)6 (fixed) (not set)|(% rowspan="2" %)-
228 |d1+15
229 |(% rowspan="2" %)Parameter 9|d1+16|(% rowspan="2" %)Size_x|(% rowspan="2" %)32-bit integer|(% rowspan="2" %)13 (fixed) (not set)|(% rowspan="2" %)-
230 |d1+17
231 |(% rowspan="2" %)Parameter 10|d1+18|(% rowspan="2" %)Size_y|(% rowspan="2" %)32-bit integer|(% rowspan="2" %)13 (fixed) (not set)|(% rowspan="2" %)-
232 |d1+19
233 |Parameter 11|d1+20|Kpm reserved for internal use|Reserved|Reserved|-
234 |Parameter 12|d1+21|Kim reserved for internal use|Reserved|Reserved|-
235 |Parameter 13|d1+22|Kdm reserved for internal use|Reserved|Reserved|-
236 |Parameter 14|d1+23|Kukp reserved for internal use|Reserved|Reserved|-
237 |Parameter 15|d1+24|Kuki reserved for internal use|Reserved|Reserved|-
238 |Parameter 16|d1+25|Kukd reserved for internal use|Reserved|Reserved|-
239 |︙|︙|︙|︙|Reserved|-
240 |Parameter 20|d1+37|Reserved for internal use|Reserved|Reserved|-
241
242 |(% colspan="6" %)**d2 parameter setting**
243 |**Parameter**|**Offset address**|**Name**|**Format**|**Instruction**|**Range**
244 |Parameter 1|d2|Current Temperature|16-bit integer|Current test temperature|-
245 |Parameter 2|d2+1|set temperature|16-bit integer|Set temperature|-
246 |Parameter 3|d2+2|Calculation period|16-bit integer|Take an integer multiple of the pid sampling time, usually the same|-
247 |Parameter 4|d2+3|Kp|16-bit integer|PID initial Kp value|-
248 |Parameter 5|d2+4|KI|16-bit integer|PID initial Ki value|-
249 |Parameter 6|d2+5|KD|16-bit integer|PID initial Kd value|-
250 |Parameter 7|d2+6|Sampling cycle|16-bit integer|No need to enter|-
251 |Parameter 8|d2+7|Initialization flag|16-bit integer|Reserved for internal use|-
252 |(% rowspan="2" %)Parameter 9|d2+8|(% rowspan="2" %)Last calculation time|(% rowspan="2" %)32-bit integer|(% rowspan="2" %)View usage (not operable)|(% rowspan="2" %)-
253 |d2+9
254 |Parameter 10|d2+10|Last temperature|16-bit integer|View usage (not operable)|-
255 |Parameter 11|d2+11|Reserved|16-bit integer|Reserved|
256 |(% colspan="6" %)**d3 parameter setting**
257 |**Parameter**|**Offset address**|**Name**|**format**|**Instruction**|**Range**
258 |Parameter 1|d3|Current Temperature|16-bit integer|Current test temperature|-
259 |Parameter 2|d3+1|set temperature|16-bit integer|Set temperature|-
260 |Parameter 3|d3+2|Calculation period|16-bit integer|Take an integer multiple of the pid sampling time, usually the same|-
261 |Parameter 4|d3+3|Kp|16-bit integer|Kp value of PID after adjustment|-
262 |Parameter 5|d3+4|KI|16-bit integer|Ki value of PID after adjustment|-
263 |Parameter 6|d3+5|KD|16-bit integer|Kd value of PID after adjustment|-
264 |Parameter 7|d3+6|Sampling cycle|16-bit integer|No need to enter|-
265 |Parameter 8|d3+7|Reserved|16-bit integer|Reserved|-
266
267 **✎Note:**
268
269 The instruction starts from the device specified in (d1) and occupies 38 points of the device, and initializes the parameters. Normally, it only needs to be initialized once before calling (some parameters are fixed) (occupies 38 words space).
270
271 The instruction starts with the device specified in (d2) and occupies 12 points of the device, input parameters, and input the first 6 parameters, where Kp, Ki, Kd are the initial values of the PID control parameters (occupies 12 words space) .
272
273 The instruction starts from the device specified in (d3) and occupies 8 points of soft elements and output parameters, among which Kp, Ki, Kd are the parameter values after fuzzy adaptive calculation, which can be input to the designated position of PID (occupy 8 words space).
274
275 The FPID instruction occupies 58 words. The address of each operand must have a specified interval interval, which cannot be occupied by other instructions.
276
277 **Error code**
278
279 |**Error code**|**Content**
280 |4085H|When the device specified in the read application instructions (d1), (d2), (d3) exceeds the range of the corresponding device.
281 |4086H|When the device specified in the write application instructions (d1), (d2), (d3) exceeds the range of the corresponding device.
282 |4D91H|FPID calculation cycle is less than or equal to 0
283 |4D92H|FPID parameter range error
284 |4D93H|FPID initial flag error
285
286 **Example**
287
288 ~1. Parameter d1
289
290 (% style="text-align:center" %)
291 [[image:11_html_93e9f66475d6eb0c.png||class="img-thumbnail"]]
292
293 2. Parameter d2
294
295 (% style="text-align:center" %)
296 [[image:11_html_548b859bc5568099.png||class="img-thumbnail"]]
297
298 3. Invoke FPID
299
300 (% style="text-align:center" %)
301 [[image:11_html_599ccfa817c379fd.png||class="img-thumbnail"]]
302
303 == **CCPID instruction introduction manual** ==
304
305 **Background and purpose**
306
307 (1) Background:
308
309 PID (proportion, integral, derivative) controller has been the earliest practical controller for nearly a hundred years, and it is still the most widely used industrial controller. The PID controller is simple and easy to understand, and does not require precise system models and other prerequisites in use, making it the most widely used controller.
310
311 (2) Purpose:
312
313 You might not be familiar with the parameter settings in the new series of CCPID for the first time, this manual could let you quickly understand the meaning of each parameter in the CCPID and the influence on the control effect, so that you can quickly learn the CCPID.
314
315 **Description of the host CCPID instruction**
316
317 **Instruction description**
318
319 **Content, range and data type**
320
321 |**Name**|**Features**|**Bits (bits)**|**Whether pulse type**|**Instruction format**|**Step count**
322 |CCPID|PID Operation|16|No|CCPID [[image:11_html_253eb1176b58e989.png]] [[image:11_html_80fccb1046bf8776.png]] [[image:11_html_8760537828f7beaf.png]] [[image:11_html_8b4fbd61f8ea9808.png]]|9
323
324 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="3" %)**Devices**|**Offset modification**|**Pulse extension**
325 |**D**|**R**|**SD**|**[D]**|**XXP**
326 |(% rowspan="4" %)CCPID|Parameter 1|●|●|●| |
327 |Parameter 2|●|●|●| |
328 |Parameter 3|●|●|●| |
329 |Parameter 4|●|●|●| |
330
331 **Device used**
332
333 [[image:11_html_954290ac172c672b.jpg]] is the target value (SV) of PID control;
334
335 [[image:11_html_31f47ac5eec30067.jpg]] is the measured feedback value (PV);
336
337 [[image:11_html_6dcdd8fc88703a47.jpg]] is the start address of the buffer area for setting parameters required for PID operation and saving intermediate results, occupying a total of 52 variable units of subsequent addresses (recommended to reserve 100 continuous spaces).The value range is D0 to D7,948, it is better to specify power failure retention, and the setting value remains after power supply is off. Otherwise,the buffer needs to be assigned value before starting the calculation for the first time. The function and parameter description of each unit are described in this section;
338
339 [[image:11_html_7e06d96423d5de52.jpg]] is the storage unit (MV) of the PID calculation result. Please specify it as a non-battery retentive area, otherwise it needs to be initialized and cleared before the first start of calculation.
340
341 (% style="text-align:center" %)
342 [[image:11_html_8eeef07485b91193.jpg||class="img-thumbnail"]]
343
344 **Programming example**
345
346 The parameter description is as follows:
347
348 In D9, the target value of PID adjustment is stored, and D10 is the closed-loop feedback value. Note that D9 and D10 must be of the same dimension, such as both 0.01MPa units, or 1℃ units, etc.;
349
350 A total of 52 units of D200 to D251 are used to store the set value and process value of PID operation. These values must be set item by item before the first PID calculation;
351
352 D130 unit is used to store the calculated control output value to control the execution of the action.
353
354 The functions and setting methods of the parameter values of each unit used by [[image:11_html_6dcdd8fc88703a47.jpg]] are described in the following table:
355
356 [[image:11_html_6dcdd8fc88703a47.jpg]] to [[image:11_html_6dcdd8fc88703a47.jpg]] +14 is the parameter range that can be set (parameters set when CCPID is executed).
357
358 [[image:11_html_6dcdd8fc88703a47.jpg]] +15 to [[image:11_html_6dcdd8fc88703a47.jpg]] +21 is the space used internally by CCPID control.
359
360 [[image:11_html_6dcdd8fc88703a47.jpg]] +22 to [[image:11_html_6dcdd8fc88703a47.jpg]] +51 is the parameter space used in the auto-tuning process.
361
362 |**Unit**|**Features**|**Setting instructions**|**Supplement**
363 | |Sample time (TS)|The set range is 1 to 32,767 (ms), but greater than PLC program scan cycle.|It is how often the instruction calculates and updates the output value (MV). When TS is less than one scan time, PID instruction is executed with one scan time and alarm 4D86H. When TS ≤ 0, alarm 4D80H and no execution.
364 |+1|Action direction (ACT)|(((
365 bit0: 0=positive action; 1=reverse action bit2: auto-tuning transition zone switch. 0=not open;1=open
366
367 bit3: 0=unidirection; 1=bidirection
368
369 Bit4: 0=auto-tuning does not execute; 1=execute auto-tuning
370
371 [Bit6:0=Two-stage auto-tuning does not execute. 1=Execute two-stage auto-tuning (bit4 must be set to 1).
372
373 bit7: 0=Three-stage auto-tuning does not execute. 1=Execute three-stage auto-tuning (bit4 must be set to 1 )]
374
375 The Others cannot be used.
376 )))|(((
377 bit0: Positive action: similar heating system, when the temperature is lower than the set value, increases the output ; Reverse action: similar cooling system, when the temperature is greater than the set value, increases the output.
378
379 bit2: Self-tuning transition zone switch. There is a transition zone size of 1.5℃ when opened.
380
381 bit3: Bidirection indicates that outputs the positive and negative values to the heating system or the cooling system to control two external systems by one PID.
382
383 bit4: **✎**When bit4=1 and bit6 and bit7 are not 1, auto-tuning is not executed. **✎**When bit4=0 and one of bit6 and bit7 is 1, auto-tuning is not executed. **✎**When bit4=1 and bit6 and bit7 are both 1, auto-tuning is executed
384 )))
385 |+2|Filter coefficient|The first-order inertia filter of feedback amount (0 to 100%) has a range of 0 to100|When the value is greater than or equal to 100, it will be executed as 0, that is, no filtering will be executed;
386 |+3|Proportional gain(Kp)|Set range: 0 to 30,000[%]|Overrun error 4D87H
387 |+4|Integration time (Ti)|Ti is integration time, and the range is 0 to 3,600 (s)|Overrun error 4D88H
388 |+5|Differential time (Td)|Td is derivative time, and the range is 0 to 1,000 (s)|Overrun error 4D89H
389 |+6|Working interval|Operating temperature setting enabled by PID (0 indicates no effect) The range is 0 to 1,000|It is recommended to be greater than 5°C, that is, 50 (precision 0.1°C). If it exceeds the range, the boundary value will be taken.
390 |+7|Output low limit|(((
391 Range: -10,000 to 10,000.
392
393 Recommended setting range: -2,000 or 0 (when S3+1 bit3=0, the lower limit = 0;
394
395 when bit3=1, the lower limit = -2,000)
396 )))|(((
397 ~1. Self-tuning initialization:
398
399 ① Unidirection control: the lower limit is 0;
400
401 ② Bidirection control: If the lower limit is greater than 0, adjust the lower limit to 0; if the upper limit and the lower limit are equal to 0, the default lower limit is -2,000. **✎**Note: If set to -2,000, and the output value (MV) is less than -2,000, it will output -2,000.
402
403 2. During the control process, the lower limit is dynamically adjustable. If the lower limit is greater than or equal to the upper limit, error 4D90H will be reported.
404 )))
405 |+8|Output upper limit|(((
406 Value range: -10,000 to 10,000.
407
408 Recommended setting value is 2,000
409 )))|(((
410 ~1. Self-tuning initialization:
411
412 ① Unidirection control: If the upper limit is less than 0, the default upper limit is 2,000;
413
414 ② Bidirection control: If the upper limit is less than 0, adjust the upper limit to 0; if the upper limit and the lower limit are equal to 0, the default upper limit is -2,000. **✎**Note: If set to -2,000 and the output value (MV) is greater than -2,000, it will output 2,000.
415
416 2. During the control process, the upper limit is dynamically adjustable. If the lower limit is greater than or equal to the upper limit, error 4D90H will be reported.
417 )))
418 |+9|Mode setting|(((
419 0: Overshoot allowed
420
421 1: Slight overshoot or no overshoot
422
423 2: Dynamic setting
424 )))|(((
425 0:Overshoot allowed (ukd = 100)
426
427 1: Slight overshoot or no overshoot mode (ukd = 300)
428 )))
429 |+10|(((
430 Scale factor
431
432 (ukp)
433 )))|Typically sets value to 100 (default 100) [enabled when S3+9 is set to 2].The range is 1 to 500.|When the value is less than or equal to 0, or greater than 500, the boundary value will be taken.
434 |+11|Integral coefficient (uki)|Typically sets value to 50 (default 50) [enabled when S3+9 is set to 2]. The range is 1 to 300.|When the value is less than or equal to 0, or greater than 300, the boundary value will be taken.
435 |+12|Differential coefficient (ukd)|Typically sets value to 50 (default 100. 300 to 400 can be set when slight overshoot is required) [Enable when S3+9 is set to 2]. The range is 1 to 500.|When the value is less than or equal to 0, or greater than 500, the boundary value will be taken.
436 |+13|Maximum ascent rate (DeltaT)|The range is 0 to 32,000, which is the threshold of integral increment|Overrun error 4D82H
437 |+14|Filtering (C0)|The range is 0 to 1,023, integral part filtering|Overrun error 4D81H
438 |+15|(% rowspan="3" %)reserved for internal control|(% rowspan="3" %)Internal control space occupation|(% rowspan="3" %)
439 |┆
440 |+21
441 |+22|(% rowspan="3" %)used space for self-tuning|(% rowspan="3" %)New self-tuning space for internal use|(% rowspan="3" %)
442 |┆
443 |+51
444
445 1) The auto-tuning process occupies the space of S3+22 to S3+51. When the auto-tuning is successful, the adjusted parameters will be written into the space of S3+2 to S3+21.
446
447 2) +2 filter coefficient α: Processing in first-order inertial filter
448
449 Formula: **T,,now,,=(100-α)×T,,α,,+α×T,,old,,**
450
451 T,,α ,,is the currently measured temperature. T,,old ,,is the temperature that participated in the PID calculation last time. T,,now ,,is the temperature used for the current PID calculation. α is the filter coefficient (when α=0, no filtering is performed, and the range of α is 0 to 100.(If there is a temperature with a small overshoot but a long stabilization time, the parameter can be set to 80, and analyze the specific problems in detail)
452
453 3) +6 work range: Twork(example: 170 represents 17℃)
454
455 (% style="text-align:center" %)
456 [[image:11_html_7ab814bb49fffa5a.gif||class="img-thumbnail"]]
457
458 4) +9 working mode:
459
460 0: Working mode that allows overshoot
461
462 1: Slight overshoot or no overshoot working mode
463
464 2: Custom settings; to achieve by setting +10, +11, +12 three coefficients.
465
466 5) +1 bit2 self-tuning transition zone switch: (upper limit 1℃, low limit 0.5℃)
467
468 The transition zone description in forward control:
469
470 (% style="text-align:center" %)
471 [[image:11_html_d90c24627566bf2f.gif||class="img-thumbnail"]]
472
473 In the heating process, when PV≤SV+1℃, 100% power output; when PV>SV+1℃, no output.
474
475 In the cooling process, when PV<SV-0.5℃, 100% power output; When PV≥SV-0.5℃, no output.
476
477 The transition zone description in reverse control:
478
479 (% style="text-align:center" %)
480 [[image:11_html_d3c25044a54c62ce.gif||class="img-thumbnail"]]
481
482 In the cooling process, when PV≥SV-1℃, 100% power output; when PV<SV-1℃, no output.
483
484 In the heating process, when PV>SV+0.5℃, 100% power output; When PV≤SV+0.5℃, no output.
485
486 The transition zone description in bidirectional control:
487
488 (% style="text-align:center" %)
489 [[image:11_html_9eb35607c95b1580.gif||class="img-thumbnail"]]
490
491 In the heating process, when PV≤SV+1℃, 100% power heating output; when PV>SV+1℃, 100% power cooling output.
492
493 In the cooling process, when PV<SV-0.5℃, 100% power heating output. When PV≥SV-0.5℃, 100% power cooling output
494
495 **Programming case**
496
497 **CCPID application configuration**
498
499 (1) Parameter setting
500
501 (% style="text-align:center" %)
502 [[image:11_html_36a152ee534a7f24.png||class="img-thumbnail"]]
503
504 (2) CCPID control process setting
505
506 (% style="text-align:center" %)
507 [[image:11_html_51d50fa8b154baca.png||class="img-thumbnail"]]
508
509 (% style="text-align:center" %)
510 [[image:11_html_66c8a636f6176c1f.png||class="img-thumbnail"]]
511
512 (3) Bidirection control
513
514 (% style="text-align:center" %)
515 [[image:11_html_234093eac2fe184d.png||class="img-thumbnail"]]
516
517 **✎Note:**
518
519 ~1. CCPID is a special instruction for operation control. CCPID operation will be executed only after the sample time is reached.
520
521 2. There is no limit to the number of times the CCPID instruction can be used, but+51 cannot be repeated.
522
523 3. Before CCPID instruction is executed, CCPID parameters need to be set.
524
525 **Case analysis**
526
527 **(1) Control requirements**
528
529 The control environment of this example is a kettle. The configuration is controlled by PLC-5V2416 host with 4PT module, and PI8070 screen is used for data storage and process curve viewing.
530
531 **(2) Sample program**
532
533 (% style="text-align:center" %)
534 [[image:11_html_f0a22955a8da7129.png||class="img-thumbnail"]]
535
536 (% style="text-align:center" %)
537 [[image:11_html_ad08c65bd672c66e.png||class="img-thumbnail"]]
538
539 **(3) Parameter description**
540
541 |**PLC device**|**Control instructions**
542 |M0|Set auto tuning
543 |M1|CCPID instruction calculation start
544 |M2|CCPID operating status
545 |Y0|Pulse output with adjustable pulse width
546 |D0|Temperature measured value
547 |D1|Temperature setting value
548 |D100|sample time
549 |D101|Control detail settings
550 |D102|First-order inertial filter coefficient
551 |D106|Working interval
552 |D109|Operating mode
553
554 **(4) Parameter control effect description**
555
556 1) Boiling water experiment
557
558 ① Auto-tuning process and control process (no transition zone setting), take two-stage auto-tuning as an example
559
560 (% style="text-align:center" %)
561 [[image:11_html_9149b1e837158a17.gif||class="img-thumbnail"]]
562
563 Figure 1 Auto-tuning process curve without transition zone
564
565 When the control system is a single temperature control system or a system where environmental interference does not cause large fluctuations. Generally the automatic tuning without transition zone is selected, so that the self-tuning process can be completed more quickly than the method with transition zone.
566
567 ②Self-tuning process and control process (transition zone setting)
568
569 (% style="text-align:center" %)
570 [[image:11_html_a1e8ad7a31bb04af.gif||class="img-thumbnail"]]
571
572 Figure 2 Self-tuning process curve with transition zone
573
574 It is more suitable in a two-way control system with transition zone self-tuning process. The transition zone has a range of 1.5°C. The upper limit is 1°C, and the lower limit is 0.5°C.
575
576 2) Difference in working interval setting
577
578 (% style="text-align:center" %)
579 [[image:11_html_4140432ce11883ad.gif||class="img-thumbnail"]]
580
581 Figure 3 Process curve under different working interval parameters
582
583 (% style="text-align:center" %)
584 [[image:11_html_f742d80c8cc95f35.gif||class="img-thumbnail"]]
585
586 Figure 4 Process curve without different working interval parameters (heating process diagram)
587
588 It can be seen from the partially enlarged graph that the parameters of the working interval have a certain influence on the overshoot and the stable time. In the case of allowing overshoot, setting the working interval parameters can make the overshoot smaller. This is because the deviation E of PID starting to work is relatively small, and the integration accumulation will not quickly saturate.
589
590 3) Result of filter coefficient setting
591
592 (% style="text-align:center" %)
593 [[image:11_html_815ec6c129ae3891.gif||class="img-thumbnail"]]
594
595 Figure 5 Process curve under different filtering parameters
596
597 The figure above is the experimental result under the small overshoot coefficient, the sample time is 1s. The coefficients of the first-order inertial filtering are (20, 50, 70, 80, 90). After adding the inertia coefficient, the stability time of system control is greatly accelerated, and it is increased by about 6 minutes for the boiling water experiment. The overshoot is about 1.2°C to 1.7°C.
598
599 Therefore, the introduction of first-order inertial filtering could greatly improve the PID environment where the temperature fluctuates to a certain extent and increase stabilization time.
600
601 **✎Note: **This parameter of filter coefficient is helpful for systems with not very large hysteresis or the control effect of the phenomenon that the control amount fluctuates back and forth has been greatly improved.
602
603 4) The difference in mode selection
604
605 0: Overshoot allowed(ukd = 100)
606
607 1: Small overshoot or no overshoot (ukd = 300)
608
609 (% style="text-align:center" %)
610 [[image:11_html_3a7b42c8f4672ce4.gif||class="img-thumbnail"]]
611
612 Figure 6 Process curves in different working modes
613
614 When selecting mode 1 (small overshoot or no overshoot), the stable temperature may be slightly higher than the set temperature (fluctuates above the set temperature).
615
616 5) The function of the coefficient
617
618 (% style="text-align:center" %)
619 [[image:11_html_74a7527eace55103.gif||class="img-thumbnail"]]
620
621
622 **11.6 LAGCDL Large time-delay temperature control instruction**
623
624 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps243.png]]**LAGCDL**
625
626 This instruction is used to perform large time-delay system temperature control that changes the output value according to changes in the input.
627
628 -[LAGCDL (s1) (s2)  (s3) (d)]
629
630 **Content, range and data type**
631
632 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
633 |(s1)|The device number that stores the target value (SV)|-32767 to 32767|Signed BIN 16 bit|ANY16
634 |(s2)|The device number that stores the measured value (SV)|-32767 to 32767|Signed BIN 16 bit|ANY16
635 |(s3)|The device number that stores parameters|1 to 32767|Signed BIN 16 bit|ANY16
636 |(d)|The device number that stores the output value (SV)|-32767 to 32767|Signed BIN 16 bit|ANY16
637
638 **Device used**
639
640 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|(((
641 **Offset**
642
643 **modification**
644 )))|(((
645 **Pulse**
646
647 **extension**
648 )))
649 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
650 |(% rowspan="4" %)LAGCDL|Parameter 1| | | | | | | | | | | | | | | | |●|●|●| | | | | | |
651 |Parameter 2| | | | | | | | | | | | | | | | |●|●|●| | | | | | |
652 |Parameter 3| | | | | | | | | | | | | | | | |●|●|●| | | | | | |
653 |Parameter 4| | | | | | | | | | | | | | | | |●|●|●| | | | | | |
654
655 **Features**
656
657 This instruction is to complete large time-delay system control operation, and used to control the parameters of the closed-loop control system.
658
659 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps244.png]] is the target value of CCPID SHT control (SV).
660
661 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps245.png]] is the measured feedback value (PV).
662
663 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps246.png]] is the start address of the cache where the parameters required by LAGCDL operation and intermediate results are saved,
664
665 occupying a total of 634 variable units of subsequent addresses. The value range is from D0 to D7974 or from R0 to R35000. It is better to specify power failure retention, and the setting value remains after power supply is off. Otherwise, the cache needs to be assigned value before starting the calculation for the first time. The function and parameter description of each unit are described in this section.
666
667 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps247.png]] is the storage unit of the LAGCDL calculation result. Please specify it as a non-battery retentive area, otherwise it needs to be initialized and cleared before the first start of calculation.
668
669 **Programming example**
670
671 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps248.jpg]]
672
673 The parameter description is as follows:
674
675 The target value of LAGCDL adjustment is stored in D1, and D0 is the closed-loop feedback value. Note that D0 and D9 must be of the same dimension, such as both 0.01MPa units, or 1℃ units, etc..
676
677 A total of 634 units of D1000 to D1633 are used to store the set value and process value of LAGCDL operation. These values must be set item by item before the first LAGCDL calculation.
678
679 D100 unit is used to store the calculated control output value to control the execution of the action.
680
681 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps249.png]] to [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps250.png]]+15 is the parameter range that can be set (parameters set when LAGCDL is executed). [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps251.png]]+28 to [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps252.png]]+631 is the historical data space for LAGCDL control internal use. [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps253.png]]+4 to [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps254.png]]+27 is the parameter space used in the self-tuning process. (This space is multiplexed with the parameter space during control)
682
683 The functions and setting methods of the parameter values of each unit started by [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps255.png]] are described in the following table:
684
685
686
687 |**Unit**|**Function**|**Description**
688 |[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps256.png]]|Sampling time (TS)|Range: 1 to 32767 (ms). It must be longer than PLC program scan cycle.
689 |[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps257.png]]+1|Control flag bit|(((
690 bit0: 0=Forward action; 1=Reverse action
691
692 bit1: Overshoot power limit output enable bit. 0=no limit; 1=limited
693
694 Bit2: Reset historical data. 0=reset; 1=no reset. This bit must be 0 before each execution.
695
696 bit4: 0=Self-tuning does not act; 1=Perform self-tuning and the others are not available.
697
698 Bit14:Historical data initialization flag bit. When initialization is complete, it is set to 1.
699
700 Bit15: The instruction initializes the flag bit. When initialization is complete, it is set to 1.
701 )))
702 |[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps258.png]]+2|Output lower limit|Range: -32000 to 32000. Recommended setting range: -2000 or 0.
703 |[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps259.png]]+3|Output upper limit|Range: 0 to 32000. Recommended setting value is 2000. When the upper and lower limits are both 0, the upper limit becomes 2000 and the lower limit becomes 0.
704 |[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps260.png]]+4|Full power output boundary|The suggested value can be obtained by self-tuning, and can also be adjusted according to the actual situation.
705 |[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps261.png]]+5|Half-power output boundary|The suggested value can be obtained by self-tuning, and can also be adjusted according to the actual situation.
706 |[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps262.png]]+6|Stop output boundary|The suggested value can be obtained by self-tuning, and can also be adjusted according to the actual situation.
707 |[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps263.png]]+7|The maximum rate of increase of the controlled system|Given by self-tuning
708 |[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps264.png]]+8|The lagged time of the controlled system|Given by self-tuning. Unit: s
709 |[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps265.png]]+9|The time constant of the controlled system|Given by self-tuning. Unit: s
710 |[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps266.png]]+10|Ideal closed-loop time constant|Given by self-tuning. Unit: s
711 |[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps267.png]]+11|Ideal closed-loop sampling time|Given by self-tuning. This parameter can be adjusted during the control process. Unit: s
712 |[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps268.png]]+12|Maximum temperature difference during setting|Given by self-tuning. (for your reference)
713 |[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps269.png]]+13|The temperature difference between the residual heat and temperature rise|Given by self-tuning. (for your reference)
714 |[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps270.png]]+14|Heating time|Given by self-tuning. (for your reference)
715 |[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps271.png]]+15|Setting time|Given by self-tuning. (for your reference)
716 |[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps272.png]]+16|(% rowspan="3" %)Self-tuning use space|(% rowspan="3" %)Reserved for internal use
717 |┇
718 |[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps273.png]]+27
719 |[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps274.png]]+28|Current temperature difference|Used during control
720 |[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps275.png]]+29|Previous temperature difference|Used during control
721 |[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps276.png]]+30|The 1st operation flag bit|Used during control
722 |[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps277.png]]+31|Number of valid history outputs|Used during control
723 |[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps278.png]]+32|(% rowspan="3" %)Historical output data|(% rowspan="3" %)Used during control
724 |┇
725 |[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps279.png]]+631
726 |[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps280.png]]+632|(% rowspan="2" %)Previous sampling time stamp|(% rowspan="2" %)Reserved for internal use
727 |[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps281.png]]+633
728
729 **Error code**
730
731 |**Error code**|**Content**
732 |4085H|Read application instruction (S1), (S2), (S3) and (d) output results exceed the range of device.
733 |4086H|The devices specified in write application instruction (S3) and (d) exceed the range of the corresponding device.
734 |4D86H|Sampling time (Ts) < operation cycle
735 |4DA1H|Power limit boundary (s3+4), (s3+5) and (s3+6) exceed the range.
736 |4DA2H|System parameters (s3+7), (s3+8) and (s3+9) exceed the range.
737 |4DA3H|Control parameters (s3+10) and (s3+11) exceed the range.
738 |4DA4H|The output upper limit is smaller than the lower limit
739
740 **Example**
741
742 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml11524\wps282.png]]
743
744
745 == **PRUN/Octal digit transmission (16-bit data)** ==
746
747 ----
748
749 PRUN(P)
750
751 After processing the device numbers of (s) and (d) with specified digits as octal numbers, transfer the data.
752
753 -[PRUN (s) (d)]
754
755 Content, range and data type
756
757 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**|=**Custom variable type**
758 |(s)|Digit specification*1|-|BIN16 bit|ANY16|~-~-
759 |(d)|Transfer target device number*1|-|BIN16 bit|ANY16|~-~-
760
761 Device used
762
763 |=(% style="width: 64px;" %)**Instruction**|=(% style="width: 128px;" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=**Pulse expansion**
764 |(% style="width:64px" %) |(% style="width:128px" %) |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|(% style="width:32px" %)**HSC(bit)**|(% style="width:94px" %)**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|(% style="width:41px" %)**SD**|(% style="width:42px" %)**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
765 |(% colspan="1" rowspan="2" style="width:64px" %)PRUN|(% style="width:128px" %)Parameter 1| | | | | | | | |(% style="width:32px" %) |(% style="width:94px" %) |●| |●| | | | | |(% style="width:41px" %) |(% style="width:42px" %) | | | | |●|●
766 |(% style="width:128px" %)Parameter 2| | | | | | | | |(% style="width:32px" %) |(% style="width:94px" %) | |●|●| | | | | |(% style="width:41px" %) |(% style="width:42px" %) | | | | |●|●
767
768 Function
769
770 • Octal digit device→ decimal digit device
771
772 (% style="text-align:center" %)
773 [[image:1709790843788-781.png]]
774
775 • Decimal digit device → octal digit device
776
777 (% style="text-align:center" %)
778 [[image:1709790863850-104.png]]
779
780 Error code
781
782 |=**Error code**|=**Content**
783 |4085H|When the specified device range for reading exceeds the range of the corresponding device
784 |4086H|When the specified device range for writing exceeds the range of the corresponding device
785
786 Example
787
788 (% style="text-align:center" %)
789 [[image:1709790902188-165.png]]
790
791 As shown in the above ladder diagram: X0~~X17 takes the value of octal digits and pass it to the devices corresponding to M.
792
793 (% style="text-align:center" %)
794 [[image:1709790924438-346.png]]
795
796
797 == **TRH/Wet and dry bulb temperature and humidity conversion** ==
798
799 ----
800
801 [[image:file:///C:\Users\ADMINI~~1\AppData\Local\Temp\ksohtml13328\wps3.png]]TRH
802
803 This command completes the conversion of dry bulb temperature, wet bulb temperature and corresponding humidity.
804
805 -[TRH (d1) (s) (d2) (n)]
806
807 Content, range and data type
808
809 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**|=**Custom variable type**
810 |(d1)|Humidity|0~~100|Single-precision floating point|ANYREAL_32|REAL
811 |(s)|Dry bulb temperature|-|Single-precision floating point|ANYREAL_32|REAL
812 |(d2)|Wet bulb temperature|-|Single-precision floating point|ANYREAL_32|REAL
813 |(n)|Mode|0 to 1|Signed BIN 32 bit|ANY32|DINT
814
815 Device used
816
817 |=**Instruction**|=**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=**Pulse expansion**
818 | | |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
819 |(% colspan="1" rowspan="4" %)TRH|Parameter 1| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|
820 |Parameter 2| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|
821 |Parameter 3| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|
822 |Parameter 4| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
823
824 Function
825
826 There are two modes to choose from (n):
827
828 Mode 0: Calculate the corresponding humidity by wet bulb temperature and dry bulb temperature.
829
830 Mode 1: Calculate the corresponding wet bulb temperature by dry bulb temperature and humidity.
831
832 The conversion process formula is as follows:
833
834 Assuming that the wet bulb temperature is A, the dry bulb temperature is B, and the corresponding current humidity is C, which meet the following conditions:
835
836 (% style="text-align:center" %)
837 [[image:1709791199711-348.png||height="101" width="342"]]
838
839
840 Precautions
841
842 ·The wet bulb temperature is not greater than the dry bulb temperature. When they are the same, the humidity reaches the maximum value 100%.
843
844 ·The unit of dry and wet bulb temperature is (^^o^^C).
845
846 ·The general value range of dry bulb is between 0~~100^^o^^C, and the command does not judge its range, so pay special attention when using this command.
847
848 Error code
849
850 |=**Error code**|=**Content**
851 |(% rowspan="4" %)4084H|When the value specified in (n) exceeds the following range. 0 to 1
852 |The value specified in (d1) exceeds the following range. 0 to 100
853 |A negative value is specified in (s).
854 |A negative value is specified in (d2).
855 |4085H|The output result of (d1)(s)(d2)(n) in the read application command exceeds the device range.
856 |4086H|The output result of the write application command (d1) and (d2) exceeds the device range.
857
858 Example
859
860 (% style="text-align:center" %)
861 [[image:1709791591456-917.png]]
862
863 Dry and wet bulb temperature/humidity conversion table
864
865 (% style="text-align:center" %)
866 [[image:1709791607332-438.png]]