Wiki source code of 11 Special instructions

Version 1.1 by Leo Wei on 2022/06/08 12:57

Show last authors
1 == {{id name="_Toc16039"/}}**{{id name="_Toc23670"/}}{{id name="_Toc3789"/}}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 (% class="table-bordered" %)
12 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
13 |(s1)|Device number for storing the target value (SV)|-32767 to 32767|Signed BIN 16 bit|ANY16
14 |(s2)|Device number for storing the measured value (PV)|-32767 to 32767|Signed BIN 16 bit|ANY16
15 |(s3)|Device number for storing parameters|1 to 32767|Signed BIN 16 bit|ANY16
16 |(d)|Device number for storing output value (MV)|-32767 to 32767|Signed BIN 16 bit|ANY16
17
18 **Device used**
19
20 (% class="table-bordered" %)
21 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="3" %)**Devices**|(((
22 **Offset modification**
23 )))|(((
24 **Pulse extension**
25 )))
26 |**D**|**R**|**SD**|**[D]**|**XXP**
27 |(% rowspan="4" %)PID|Parameter 1|●|●|●| |
28 |Parameter 2|●|●|●| |
29 |Parameter 3|●|●|●| |
30 |Parameter 4|●|●|●| |
31
32 **Features**
33
34 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:
35
36 [[image:11_html_1c6bb88c06ac24cf.png||class="img-thumbnail"]] is the target value of PID control;
37
38 [[image:11_html_fb5122fb6e3a43d5.png||class="img-thumbnail"]] is the measured feedback value;
39
40 [[image:11_html_6c3fad4a32a3db43.png||class="img-thumbnail"]] 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;
41
42 [[image:11_html_b126b1b2673dc1f4.png||class="img-thumbnail"]] is the storage unit of the PID calculation result. Please designate [[image:11_html_d47cd1f59b766ed3.png||class="img-thumbnail"]] as a non-battery holding area, otherwise it needs to be initialized and cleared before starting the calculation for the first time.
43
44 **Programming example**
45
46 (% style="text-align:center" %)
47 [[image:11_html_888504306151fa15.png||class="img-thumbnail"]]
48
49 The parameter description is as follows:
50
51 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.;
52
53 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;
54
55 The D130 unit is used to store the calculated control output value to control the execution of the action.
56
57 The function and setting method of the parameter value of each unit about starting of [[image:11_html_6c3fad4a32a3db43.png||class="img-thumbnail"]] are described in the following table:
58
59 (% class="table-bordered" %)
60 |**Unit**|**Features**|**Setting instructions**
61 |[[image:11_html_6c3fad4a32a3db43.png||class="img-thumbnail"]]|Sampling time (TS)|The setting range is 1 to 32767 (ms), but it needs to be greater than the PLC program scan period
62 |[[image:11_html_6c3fad4a32a3db43.png||class="img-thumbnail"]] +1|Action direction (ACT)|(((
63 bit0: 0 = positive action; 1 = reverse action bit3: 0 = unidirectional; 1 = bidirectional
64
65 bit4: 0 = auto-tuning does not work; 1 = auto-tuning is executed, others cannot be used.
66 )))
67 |[[image:11_html_6c3fad4a32a3db43.png||class="img-thumbnail"]] +2|Maximum ascent rate (DeltaT)|Setting range 0 to 32000 is the threshold of integral increment
68 |[[image:11_html_6c3fad4a32a3db43.png||class="img-thumbnail"]] +3|Proportional gain (Kp)|Setting range 0 to 32767, note that this value is enlarged by 256 times, the actual value is Kp/256
69 |[[image:11_html_6c3fad4a32a3db43.png||class="img-thumbnail"]] +4|Integral gain (Ki)|Setting range 0 to 32767, Ki=16384Ts/Ti, Ti is the integral time
70 |[[image:11_html_6c3fad4a32a3db43.png||class="img-thumbnail"]] +5|Differential gain (Kd)|Setting range 0 to 32767, Kd≈Td/Ts, Td is the derivative time
71 |[[image:11_html_6c3fad4a32a3db43.png||class="img-thumbnail"]] +6|Filtering (C0)|Setting range 0 to 1023, integral part filtering
72 |[[image:11_html_6c3fad4a32a3db43.png||class="img-thumbnail"]] +7|Output lower limit|(((
73 Recommended setting range -2000 to 2000
74
75 {{id name="OLE_LINK630"/}}When bit3 of S3+1=0, set to 0; When bit3 of S3+1=1, set to -2000;
76 )))
77 |[[image:11_html_6c3fad4a32a3db43.png||class="img-thumbnail"]] +8|Output upper limit|Recommended setting value 2000
78 |[[image:11_html_6c3fad4a32a3db43.png||class="img-thumbnail"]] +9|Reserved|Reserved
79 |︙|︙|︙
80 |[[image:11_html_6c3fad4a32a3db43.png||class="img-thumbnail"]] +25|Reserved|Reserved
81
82 **Auto tuning example**
83
84 (% style="text-align:center" %)
85 [[image:11_html_c64303b9c6a47ae9.png||class="img-thumbnail"]]
86
87 **✎Note:**
88
89 ● When multiple instructions are used, the device number of (d) cannot be repeated.
90
91 ● During the execution of auto-tuning, the (s3) parameter space cannot be modified.
92
93 ● The instruction occupies 26 point devices from the device specified in (s3).
94
95 ● 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.
96
97 ● 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.
98
99 **Error code**
100
101 (% class="table-bordered" %)
102 |**Error code**|**Content**
103 |4085H|When the device specified in the read application instructions (s1), (s2), (s3), (d) exceeds the range of the corresponding device.
104 |4086H|When the device specified in the write application instruction (s3) and (d) exceeds the range of the corresponding device.
105 |4D80H|The sampling time is out of range.[[image:11_html_ba06296a94a7278d.gif]]
106 |4D81H|Input filter constant (,,[[image:11_html_b81ea5473531b171.gif]] ,,) is out of range (.,,[[image:11_html_f00d00cbbb545887.gif]] ,,)
107 |4D82H|The maximum ascent rate ([[image:11_html_b83270b056cb8a08.gif]] ) is out of range.,,[[image:11_html_61c6eece10272380.gif]],,
108 |4D83H|The proportional gain (Kp) is out of range.,,[[image:11_html_23f8e4bf2ee8d30.gif]],,
109 |4D84H|The integral gain (Ki) is out of range.[[image:11_html_f3c81825ddb8fe86.gif]]
110 |4D85H|The differential gain (Kd) is out of range.[[image:11_html_3da2409ae3fe18b8.gif]]
111 |4D86H|The sampling time (Ts) is less than the operation cycle.,,[[image:11_html_70d03c16f47cdb8a.gif]],,
112
113 **Example**
114
115 See manual.
116
117 == {{id name="_Toc32463"/}}{{id name="_Toc21837"/}}{{id name="_Toc31152"/}}**CCPID/CCPID calculation** ==
118
119 **CCPID**
120
121 This instruction is used to perform PID control that changes the output value according to the amount of input change.
122
123 -[CCPID (s1) (s2) (s3) (d)]
124
125 **Content, range and data type**
126
127 (% class="table-bordered" %)
128 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
129 |(s1)|Device number for storing the target value (SV)|-32767 to 32767|Signed BIN 16 bit|ANY16
130 |(s2)|Device number for storing the measured value (PV)|-32767 to 32767|Signed BIN 16 bit|ANY16
131 |(s3)|Device number for storing parameters|1 to 32767|Signed BIN 16 bit|ANY16
132 |(d)|Device number for storing output value (MV)|-32767 to 32767|Signed BIN 16 bit|ANY16
133
134 **Device used**
135
136 (% class="table-bordered" %)
137 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="3" %)**Devices**|(((
138 **Offset modification**
139 )))|(((
140 **Pulse extension**
141 )))
142 |**D**|**R**|**SD**|**[D]**|**XXP**
143 |(% rowspan="4" %)CCPID|Parameter 1|●|●|●| |
144 |Parameter 2|●|●|●| |
145 |Parameter 3|●|●|●| |
146 |Parameter 4|●|●|●| |
147
148 **Features**
149
150 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".
151
152 **✎Note:**
153
154 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.
155
156 The instruction occupies 52 points of devices starting from the device specified in (s3).
157
158 During the execution of auto-tuning, the (s3) parameter space cannot be modified.
159
160 **Error code**
161
162 (% class="table-bordered" %)
163 |**Error code**|**Content**
164 |4085H|When the device specified in the read application instructions (s1), (s2), (s3), (d) exceeds the range of the corresponding device.
165 |4086H|When the device specified in the write application instruction (s3) and (d) exceeds the range of the corresponding device.
166 |4D80H|The sampling time is out of range.[[image:11_html_e20ffef8be00c7de.gif||class="img-thumbnail"]]
167 |4D81H|Input filter constant ([[image:11_html_89233377f23913d1.gif||class="img-thumbnail" height="19" width="24"]] ) is out of range (,,[[image:11_html_fc04053cc1766938.gif||class="img-thumbnail"]] ,,)
168 |4D82H|The maximum ascent rate ([[image:11_html_b83270b056cb8a08.gif||class="img-thumbnail"]] ) is out of range.,,[[image:11_html_6ec55fb8a0806a8a.gif||class="img-thumbnail"]],,
169 |4D86H|The sampling time (Ts) is less than the operation cycle.,,[[image:11_html_5760e7f0e774413a.gif||class="img-thumbnail"]],,
170 |4D87H|The proportional gain (Kp) is out of range.,,[[image:11_html_7ce2946bf919a62d.gif||class="img-thumbnail"]],,
171 |4D88H|The integral time constant (Ti) is out of range.,,[[image:11_html_667c81877b8381e.gif||class="img-thumbnail"]],,
172 |4D89H|The differential time constant (Td) is out of range.,,[[image:11_html_b1f11c46b396094.gif||class="img-thumbnail"]],,
173 |4D90H|The upper limit of CCPID output is less than the lower limit.
174
175 **Example**
176
177 See "__CCPID Instruction Manual__".
178
179 == **{{id name="_Toc8661"/}}{{id name="_Toc13227"/}}{{id name="_Toc18478"/}}{{id name="_Toc29418"/}}{{id name="_Toc5268"/}}{{id name="_Toc5168"/}}{{id name="_Toc307"/}}FPID/FPID calculation** ==
180
181 **FPID**
182
183 The function of this instruction is to adjust PID control parameters by fuzzy algorithm.
184
185 -[FPID (s) (d1) (d2) (d3)]
186
187 **Content, range and data type**
188
189 (% class="table-bordered" %)
190 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
191 |(s)|Store the start number of the device of the fuzzy parameter table (no input required)|-|Signed BIN 16 bit|ANY16
192 |(d1)|Start number of the device storing the initialization parameters|-|Signed BIN 16 bit|ANY16
193 |(d2)|Store the start number of the device of the input PID parameter|-|Signed BIN 16 bit|ANY16
194 |(d3)|The start number of the device that stores the adjusted PID parameters|-|Signed BIN 16 bit|ANY16
195
196 **Device used**
197
198 (% class="table-bordered" %)
199 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="4" %)**Soft component**|**Offset modification**|(((
200 **Pulse extension**
201 )))
202 |**D**|**R**|**SD**|**LC**|**[D]**|**XXP**
203 |(% rowspan="4" %)FPID|Parameter 1|●|●|●|●| |
204 |Parameter 2|●|●|●|●| |
205 |Parameter 3|●|●|●|●| |
206 |Parameter 4|●|●|●|●| |
207
208 **Features**
209
210 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.
211
212 **Parameter Description:**
213
214 (% class="table-bordered" %)
215 |(% colspan="6" %)**S parameter setting**
216 |**Parameter**|**Offset address**|**Name**|**Format**|**Instruction**|**Range**
217 |Parameter 1|S|-|-|-|-
218
219 (% class="table-bordered" %)
220 |(% colspan="6" %)**d1 parameter setting**
221 |**Parameter**|**Offset address**|**Name**|**Format**|**Instruction**|**Range**
222 |(% rowspan="2" %)Parameter 1|d1|(% rowspan="2" %)em domain|(% rowspan="2" %)Floating point|(% rowspan="2" %)Temperature difference|(% rowspan="2" %)>0
223 |d1+1
224 |(% rowspan="2" %)Parameter 2|d1+2|(% rowspan="2" %)ecm domain|(% rowspan="2" %)Floating point|(% rowspan="2" %)Temperature difference|(% rowspan="2" %)>0
225 |d1+3
226 |(% rowspan="2" %)Parameter 3|d1+4|(% rowspan="2" %)kpm coefficient|(% rowspan="2" %)Floating point|(% rowspan="2" %)0.5 (fixed) (not set)|(% rowspan="2" %)-
227 |d1+5
228 |(% rowspan="2" %)Parameter 4|d1+6|(% rowspan="2" %)kim coefficient|(% rowspan="2" %)Floating point|(% rowspan="2" %)1 (fixed) (not set)|(% rowspan="2" %)-
229 |d1+7
230 |(% rowspan="2" %)Parameter 5|d1+8|(% rowspan="2" %)kdm coefficient|(% rowspan="2" %)Floating point|(% rowspan="2" %)1 (fixed) (not set)|(% rowspan="2" %)-
231 |d1+9
232 |(% rowspan="2" %)Parameter 6|d1+10|(% rowspan="2" %)EM|(% rowspan="2" %)32-bit integer|(% rowspan="2" %)6 (fixed) (not set)|(% rowspan="2" %)-
233 |d1+11
234 |(% rowspan="2" %)Parameter 7|d1+12|(% rowspan="2" %)ECM|(% rowspan="2" %)32-bit integer|(% rowspan="2" %)6 (fixed) (not set)|(% rowspan="2" %)-
235 |d1+13
236 |(% rowspan="2" %)Parameter 8|d1+14|(% rowspan="2" %)UM|(% rowspan="2" %)32-bit integer|(% rowspan="2" %)6 (fixed) (not set)|(% rowspan="2" %)-
237 |d1+15
238 |(% rowspan="2" %)Parameter 9|d1+16|(% rowspan="2" %)Size_x|(% rowspan="2" %)32-bit integer|(% rowspan="2" %)13 (fixed) (not set)|(% rowspan="2" %)-
239 |d1+17
240 |(% rowspan="2" %)Parameter 10|d1+18|(% rowspan="2" %)Size_y|(% rowspan="2" %)32-bit integer|(% rowspan="2" %)13 (fixed) (not set)|(% rowspan="2" %)-
241 |d1+19
242 |Parameter 11|d1+20|Kpm reserved for internal use|Reserved|Reserved|-
243 |Parameter 12|d1+21|Kim reserved for internal use|Reserved|Reserved|-
244 |Parameter 13|d1+22|Kdm reserved for internal use|Reserved|Reserved|-
245 |Parameter 14|d1+23|Kukp reserved for internal use|Reserved|Reserved|-
246 |Parameter 15|d1+24|Kuki reserved for internal use|Reserved|Reserved|-
247 |Parameter 16|d1+25|Kukd reserved for internal use|Reserved|Reserved|-
248 |︙|︙|︙|︙|Reserved|-
249 |Parameter 20|d1+37|Reserved for internal use|Reserved|Reserved|-
250
251 (% class="table-bordered" %)
252 |(% colspan="6" %)**d2 parameter setting**
253 |**Parameter**|**Offset address**|**Name**|**Format**|**Instruction**|**Range**
254 |Parameter 1|d2|Current Temperature|16-bit integer|Current test temperature|-
255 |Parameter 2|d2+1|set temperature|16-bit integer|Set temperature|-
256 |Parameter 3|d2+2|Calculation period|16-bit integer|Take an integer multiple of the pid sampling time, usually the same|-
257 |Parameter 4|d2+3|Kp|16-bit integer|PID initial Kp value|-
258 |Parameter 5|d2+4|KI|16-bit integer|PID initial Ki value|-
259 |Parameter 6|d2+5|KD|16-bit integer|PID initial Kd value|-
260 |Parameter 7|d2+6|Sampling cycle|16-bit integer|No need to enter|-
261 |Parameter 8|d2+7|Initialization flag|16-bit integer|Reserved for internal use|-
262 |(% rowspan="2" %)Parameter 9|d2+8|(% rowspan="2" %)Last calculation time|(% rowspan="2" %)32-bit integer|(% rowspan="2" %)View usage (not operable)|(% rowspan="2" %)-
263 |d2+9
264 |Parameter 10|d2+10|Last temperature|16-bit integer|View usage (not operable)|-
265 |Parameter 11|d2+11|Reserved|16-bit integer|Reserved|
266 |(% colspan="6" %)**d3 parameter setting**
267 |**Parameter**|**Offset address**|**Name**|**format**|**Instruction**|**Range**
268 |Parameter 1|d3|Current Temperature|16-bit integer|Current test temperature|-
269 |Parameter 2|d3+1|set temperature|16-bit integer|Set temperature|-
270 |Parameter 3|d3+2|Calculation period|16-bit integer|Take an integer multiple of the pid sampling time, usually the same|-
271 |Parameter 4|d3+3|Kp|16-bit integer|Kp value of PID after adjustment|-
272 |Parameter 5|d3+4|KI|16-bit integer|Ki value of PID after adjustment|-
273 |Parameter 6|d3+5|KD|16-bit integer|Kd value of PID after adjustment|-
274 |Parameter 7|d3+6|Sampling cycle|16-bit integer|No need to enter|-
275 |Parameter 8|d3+7|Reserved|16-bit integer|Reserved|-
276
277 **✎Note:**
278
279 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).
280
281 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) .
282
283 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).
284
285 The FPID instruction occupies 58 words. The address of each operand must have a specified interval interval, which cannot be occupied by other instructions.
286
287 **Error code**
288
289 (% class="table-bordered" %)
290 |**Error code**|**Content**
291 |4085H|When the device specified in the read application instructions (d1), (d2), (d3) exceeds the range of the corresponding device.
292 |4086H|When the device specified in the write application instructions (d1), (d2), (d3) exceeds the range of the corresponding device.
293 |4D91H|FPID calculation cycle is less than or equal to 0
294 |4D92H|FPID parameter range error
295 |4D93H|FPID initial flag error
296
297 **Example**
298
299 ~1. Parameter d1
300
301 (% style="text-align:center" %)
302 [[image:11_html_93e9f66475d6eb0c.png||class="img-thumbnail"]]
303
304 2. Parameter d2
305
306 (% style="text-align:center" %)
307 [[image:11_html_548b859bc5568099.png||class="img-thumbnail"]]
308
309 3. Invoke FPID
310
311 (% style="text-align:center" %)
312 [[image:11_html_599ccfa817c379fd.png||class="img-thumbnail"]]
313
314 == **{{id name="_Toc30590"/}}{{id name="_Toc20656"/}}{{id name="_Toc13618"/}}PRUN/8 digit transmission (16-bit data)** ==
315
316 **PRUN(P)**
317
318 After processing the device numbers of (s) and (d) with designated digits as octal numbers, transfer the data.
319
320 -[PRUN (s) (d)]
321
322 **Content, range and data type**
323
324 (% class="table-bordered" %)
325 |**Parameter**|**Content**|**Range**|**data**|**Data type (label)**
326 |(s)|Digit designation*1|-|BIN16 bit|ANY16
327 |(d)|Transfer destination device number*1|-|BIN16 bit|ANY16
328
329 **Device used**
330
331 (% class="table-bordered" %)
332 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="3" %)**Devices**|(((
333 **Offset modification**
334 )))|(((
335 **Pulse extension**
336 )))
337 |**KnX**|**KnY**|**KnM**|**[D]**|**XXP**
338 |(% rowspan="2" %)PRUN|Parameter 1|●| |●|●|●
339 |Parameter 2| |●|●|●|●
340
341 **Features**
342
343 • 8-digit device → decimal device
344
345 (% style="text-align:center" %)
346 [[image:11_html_3c0c842b3d3c7a4.png||class="img-thumbnail"]]
347
348 • Decimal digit device → octal digit device
349
350 (% style="text-align:center" %)
351 [[image:11_html_437032b41f24ad69.png||class="img-thumbnail"]]
352
353 **Error code**
354
355 (% class="table-bordered" %)
356 |**Error code**|**Content**
357 |4085H|When reading the specified device range exceeds the corresponding device range
358 |4086H|When the specified device range for writing exceeds the range of the corresponding device
359
360 **Example**
361
362 (% style="text-align:center" %)
363 [[image:11_html_e5ea991cf7b84dc0.png||class="img-thumbnail"]]
364
365 As shown in the above Circuit program:
366
367 X0 to X17 take the value of octal digits and pass it to the Devices corresponding to M.
368
369 (% style="text-align:center" %)
370 [[image:11_html_4d9c97b634dc29b1.png||class="img-thumbnail"]]
371
372 == **{{id name="_Toc18093"/}}{{id name="_Toc173"/}}{{id name="_Toc26928"/}}TRH/Conversion of wet and dry bulb temperature and humidity** ==
373
374 **TRH**
375
376 This instruction completes the conversion of dry bulb temperature, wet bulb temperature and corresponding humidity.
377
378 -[TRH (d1) (s) (d2) (N)]
379
380 **Content, range and data type**
381
382 (% class="table-bordered" %)
383 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
384 |(d1)|humidity|0 to 100|Single precision floating point|ANYREAL_32
385 |(s)|Dry bulb temperature|-|Single precision floating point|ANYREAL_32
386 |(d2)|Wet bulb temperature|-|Single precision floating point|ANYREAL_32
387 |(N)|mode|0 to 1|Signed BIN 32 bit|ANY32
388
389 **Device used**
390
391 (% class="table-bordered" %)
392 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="11" %)**Devices**|(((
393 **Offset**
394
395 **modification**
396 )))|(((
397 **Pulse**
398
399 **extension**
400 )))
401 |**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**K**|**H**|**[D]**|**XXP**
402 |(% rowspan="4" %)TRH|Parameter 1| | | | |●|●|●|●|●| | |●|
403 |Parameter 2| | | | |●|●|●|●|●| | |●|
404 |Parameter 3| | | | |●|●|●|●|●| | |●|
405 |Parameter 4|●|●|●|●|●|●|●|●|●|●|●|●|
406
407 **Features**
408
409 (N)There are two modes to choose from:
410
411 Mode 0: Calculate the corresponding humidity by wet bulb temperature and dry bulb temperature.
412
413 Mode 1: Calculate the corresponding wet bulb temperature by dry bulb temperature and humidity.
414
415 The conversion process formula is as follows:
416
417 Assuming that the wet bulb temperature is A, the dry bulb temperature is B, and the corresponding current humidity is C, the three meet the following conditions:
418
419 (% style="text-align:center" %)
420 [[image:11_html_f9763504e639b084.gif||class="img-thumbnail"]]
421
422 (% style="text-align:center" %)
423 [[image:11_html_9eb43b8fba5e28f3.gif||class="img-thumbnail"]]
424
425 (% style="text-align:center" %)
426 [[image:11_html_f8a8e1f6b18e6e61.gif||class="img-thumbnail"]]
427
428 (% style="text-align:center" %)
429 [[image:11_html_c128b23414b3cae9.gif||class="img-thumbnail"]]
430
431 **✎Note:**
432
433 ● The wet bulb temperature is not greater than the dry bulb temperature. When the two are the same, the humidity reaches the maximum 100%.
434
435 ● The unit of dry and wet bulb temperature is (℃).
436
437 ● The general value range of dry bulb is between 0 to 100℃, the command does not judge its range, so pay special attention when using this command.
438
439 **Error code**
440
441 (% class="table-bordered" %)
442 |**Error code**|**Content**
443 |(% rowspan="4" %)4084H|The value specified in (N) is out of the following range. 0 to 1
444 |The value specified in (d1) is out of the following range. 0 to 100
445 |A negative value is specified in (s).
446 |A negative value is specified in (d2).
447 |4085H|The output result of (d1)(s)(d2)(N) in the read application instruction exceeds the device range
448 |4086H|The output result of (d1)(d2) in the writing application instruction exceeds the device range
449
450 Dry and wet bulb humidity comparison table
451
452 (% style="text-align:center" %)
453 [[image:11_html_6cf6e76e6b1a3e12.png||class="img-thumbnail"]]
454
455 **Example**
456
457 (% style="text-align:center" %)
458 [[image:11_html_4acab72ee19939e5.png||class="img-thumbnail"]]
459
460 == **CCPID instruction introduction manual** ==
461
462 **Background and purpose**
463
464 (1) Background:
465
466 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.
467
468 (2) Purpose:
469
470 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.
471
472 **Description of the host CCPID instruction**
473
474 **Instruction description**
475
476 **Content, range and data type**
477
478 (% class="table-bordered" %)
479 |**Name**|**Features**|**Bits (bits)**|**Whether pulse type**|**Instruction format**|**Step count**
480 |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
481
482 (% class="table-bordered" %)
483 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="3" %)**Devices**|**Offset modification**|**Pulse extension**
484 |**D**|**R**|**SD**|**[D]**|**XXP**
485 |(% rowspan="4" %)CCPID|Parameter 1|●|●|●| |
486 |Parameter 2|●|●|●| |
487 |Parameter 3|●|●|●| |
488 |Parameter 4|●|●|●| |
489
490 **Device used**
491
492 [[image:11_html_954290ac172c672b.jpg||class="img-thumbnail"]] is the target value (SV) of PID control;
493
494 [[image:11_html_31f47ac5eec30067.jpg||class="img-thumbnail"]] is the measured feedback value (PV);
495
496 [[image:11_html_6dcdd8fc88703a47.jpg||class="img-thumbnail"]] 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;
497
498 [[image:11_html_7e06d96423d5de52.jpg||class="img-thumbnail"]] 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.
499
500 (% style="text-align:center" %)
501 [[image:11_html_8eeef07485b91193.jpg||class="img-thumbnail"]]
502
503 **Programming example**
504
505 The parameter description is as follows:
506
507 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.;
508
509 A total of 52 units of D200 to D224 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;
510
511 D130 unit is used to store the calculated control output value to control the execution of the action.
512
513 The functions and setting methods of the parameter values of each unit used by [[image:11_html_6dcdd8fc88703a47.jpg||class="img-thumbnail"]] are described in the following table:
514
515 [[image:11_html_6dcdd8fc88703a47.jpg||class="img-thumbnail"]] to [[image:11_html_6dcdd8fc88703a47.jpg||class="img-thumbnail"]] +14 is the parameter range that can be set (parameters set when CCPID is executed).
516
517 [[image:11_html_6dcdd8fc88703a47.jpg||class="img-thumbnail"]] +15 to [[image:11_html_6dcdd8fc88703a47.jpg||class="img-thumbnail"]] +21 is the space used internally by CCPID control.
518
519 [[image:11_html_6dcdd8fc88703a47.jpg||class="img-thumbnail"]] +22 to [[image:11_html_6dcdd8fc88703a47.jpg||class="img-thumbnail"]] +51 is the parameter space used in the auto-tuning process.
520
521 (% class="table-bordered" %)
522 |**Unit**|**Features**|**Setting instructions**|**Supplement**
523 | |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.
524 |+1|Action direction (ACT)|(((
525 bit0: 0=positive action; 1=reverse action bit2: auto-tuning transition zone switch. 0=not open;1=open
526
527 bit3: 0=unidirection; 1=bidirection
528
529 Bit4: 0=auto-tuning does not execute; 1=execute auto-tuning
530
531 [Bit6:0=Two-stage auto-tuning does not execute. 1=Execute two-stage auto-tuning (bit4 must be set to 1).
532
533 bit7: 0=Three-stage auto-tuning does not execute. 1=Execute three-stage auto-tuning (bit4 must be set to 1 )]
534
535 The Others cannot be used.
536 )))|(((
537 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.
538
539 bit2: Self-tuning transition zone switch. There is a transition zone size of 1.5℃ when opened.
540
541 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.
542
543 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
544 )))
545 |+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;
546 |+3|Proportional gain(Kp)|Set range: 0 to 30,000[%]|Overrun error 4D87H
547 |+4|Integration time (Ti)|Ti is integration time, and the range is 0 to 3,600 (s)|Overrun error 4D88H
548 |+5|Differential time (Td)|Td is derivative time, and the range is 0 to 1,000 (s)|Overrun error 4D89H
549 |+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.
550 |+7|Output low limit|(((
551 Range: -10,000 to 10,000.
552
553 Recommended setting range: -2,000 or 0 (when S3+1 bit3=0, the lower limit = 0;
554
555 when bit3=1, the lower limit = -2,000)
556 )))|(((
557 ~1. Self-tuning initialization:
558
559 ① Unidirection control: the lower limit is 0;
560
561 ② 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.
562
563 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.
564 )))
565 |+8|Output upper limit|(((
566 Value range: -10,000 to 10,000.
567
568 Recommended setting value is 2,000
569 )))|(((
570 ~1. Self-tuning initialization:
571
572 ① Unidirection control: If the upper limit is less than 0, the default upper limit is 2,000;
573
574 ② 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.
575
576 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.
577 )))
578 |+9|Mode setting|(((
579 0: Overshoot allowed
580
581 1: Slight overshoot or no overshoot
582
583 2: Dynamic setting
584 )))|(((
585 0:Overshoot allowed (ukd = 100)
586
587 1: Slight overshoot or no overshoot mode (ukd = 300)
588 )))
589 |+10|(((
590 Scale factor
591
592 (ukp)
593 )))|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.
594 |+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.
595 |+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.
596 |+13|Maximum ascent rate (DeltaT)|The range is 0 to 32,000, which is the threshold of integral increment|Overrun error 4D82H
597 |+14|Filtering (C0)|The range is 0 to 1,023, integral part filtering|Overrun error 4D81H
598 |+15|(% rowspan="3" %)reserved for internal control|(% rowspan="3" %)Internal control space occupation|(% rowspan="3" %)
599 |┆
600 |+21
601 |+22|(% rowspan="3" %)used space for self-tuning|(% rowspan="3" %)New self-tuning space for internal use|(% rowspan="3" %)
602 |┆
603 |+51
604
605 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.
606
607 2) +2 filter coefficient α: Processing in first-order inertial filter
608
609 Formula: **T,,now,,=(100-α)×T,,α,,+α×T,,old,,**
610
611 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)
612
613 3) +6 work range: Twork(example: 170 represents 17℃)
614
615 (% style="text-align:center" %)
616 [[image:11_html_7ab814bb49fffa5a.gif||class="img-thumbnail"]]
617
618 4) +9 working mode:
619
620 0: Working mode that allows overshoot
621
622 1: Slight overshoot or no overshoot working mode
623
624 2: Custom settings; to achieve by setting +10, +11, +12 three coefficients.
625
626 5) +1 bit2 self-tuning transition zone switch: (upper limit 1℃, low limit 0.5℃)
627
628 The transition zone description in forward control:
629
630 (% style="text-align:center" %)
631 [[image:11_html_d90c24627566bf2f.gif||class="img-thumbnail"]]
632
633 In the heating process, when PV≤SV+1℃, 100% power output; when PV>SV+1℃, no output.
634
635 In the cooling process, when PV<SV-0.5℃, 100% power output; When PV≥SV-0.5℃, no output.
636
637 The transition zone description in reverse control:
638
639 (% style="text-align:center" %)
640 [[image:11_html_d3c25044a54c62ce.gif||class="img-thumbnail"]]
641
642 In the cooling process, when PV≥SV-1℃, 100% power output; when PV<SV-1℃, no output.
643
644 In the heating process, when PV>SV+0.5℃, 100% power output; When PV≤SV+0.5℃, no output.
645
646 The transition zone description in bidirectional control:
647
648 (% style="text-align:center" %)
649 [[image:11_html_9eb35607c95b1580.gif||class="img-thumbnail"]]
650
651 In the heating process, when PV≤SV+1℃, 100% power heating output; when PV>SV+1℃, 100% power cooling output.
652
653 In the cooling process, when PV<SV-0.5℃, 100% power heating output. When PV≥SV-0.5℃, 100% power cooling output
654
655 **Programming case**
656
657 **CCPID application configuration**
658
659 (1) Parameter setting
660
661 (% style="text-align:center" %)
662 [[image:11_html_36a152ee534a7f24.png||class="img-thumbnail"]]
663
664 (2) CCPID control process setting
665
666 (% style="text-align:center" %)
667 [[image:11_html_51d50fa8b154baca.png||class="img-thumbnail"]]
668
669 (% style="text-align:center" %)
670 [[image:11_html_66c8a636f6176c1f.png||class="img-thumbnail"]]
671
672 (3) Bidirection control
673
674 (% style="text-align:center" %)
675 [[image:11_html_234093eac2fe184d.png||class="img-thumbnail"]]
676
677 **✎Note:**
678
679 ~1. CCPID is a special instruction for operation control. CCPID operation will be executed only after the sample time is reached.
680
681 2. There is no limit to the number of times the CCPID instruction can be used, but+51 cannot be repeated.
682
683 3. Before CCPID instruction is executed, CCPID parameters need to be set.
684
685 **Case analysis**
686
687 **(1) Control requirements**
688
689 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.
690
691 **(2) Sample program**
692
693 (% style="text-align:center" %)
694 [[image:11_html_f0a22955a8da7129.png||class="img-thumbnail"]]
695
696 (% style="text-align:center" %)
697 [[image:11_html_ad08c65bd672c66e.png||class="img-thumbnail"]]
698
699 **(3) Parameter description**
700
701 (% class="table-bordered" %)
702 |**PLC device**|**Control instructions**
703 |M0|Set auto tuning
704 |M1|CCPID instruction calculation start
705 |M2|CCPID operating status
706 |Y0|Pulse output with adjustable pulse width
707 |D0|Temperature measured value
708 |D1|Temperature setting value
709 |D100|sample time
710 |D101|Control detail settings
711 |D102|First-order inertial filter coefficient
712 |D106|Working interval
713 |D109|Operating mode
714
715 **(4) Parameter control effect description**
716
717 1) Boiling water experiment
718
719 ① Auto-tuning process and control process (no transition zone setting), take two-stage auto-tuning as an example
720
721 (% style="text-align:center" %)
722 [[image:11_html_9149b1e837158a17.gif||class="img-thumbnail"]]
723
724 Figure 1 Auto-tuning process curve without transition zone
725
726 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.
727
728 ②Self-tuning process and control process (transition zone setting)
729
730 (% style="text-align:center" %)
731 [[image:11_html_a1e8ad7a31bb04af.gif||class="img-thumbnail"]]
732
733 Figure 2 Self-tuning process curve with transition zone
734
735 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.
736
737 2) Difference in working interval setting
738
739 (% style="text-align:center" %)
740 [[image:11_html_4140432ce11883ad.gif||class="img-thumbnail"]]
741
742 Figure 3 Process curve under different working interval parameters
743
744 (% style="text-align:center" %)
745 [[image:11_html_f742d80c8cc95f35.gif||class="img-thumbnail"]]
746
747 Figure 4 Process curve without different working interval parameters (heating process diagram)
748
749 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.
750
751 3) Result of filter coefficient setting
752
753 (% style="text-align:center" %)
754 [[image:11_html_815ec6c129ae3891.gif||class="img-thumbnail"]]
755
756 Figure 5 Process curve under different filtering parameters
757
758 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.
759
760 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.
761
762 **✎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.
763
764 4) The difference in mode selection
765
766 0: Overshoot allowed(ukd = 100)
767
768 1: Small overshoot or no overshoot (ukd = 300)
769
770 (% style="text-align:center" %)
771 [[image:11_html_3a7b42c8f4672ce4.gif||class="img-thumbnail"]]
772
773 Figure 6 Process curves in different working modes
774
775 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).
776
777 5) The function of the coefficient
778
779 (% style="text-align:center" %)
780 [[image:11_html_74a7527eace55103.gif||class="img-thumbnail"]]
781
782 Figure 7 Process curve under dynamic setting
783
784 When selecting working mode 2, there are three corresponding adjustable parameters: ukp[S3+10], uki[S3+11], ukd[S3+12]. Usually, the default parameters can be used for ukp and uki. Adjust the value of ukd could achieve the control effect.
785
786 Ukp is adjusted when the value of Kp reaches the maximum value, and the default value is usually 100.
787
788 Uki is adjusted when periodic oscillations occur. Gradually increase the value of uki to track the control effect.