Wiki source code of 11 Special instructions

Version 2.1 by Stone Wu on 2022/06/14 16:53

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 == **CCPID instruction introduction manual** ==
373
374 **Background and purpose**
375
376 (1) Background:
377
378 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.
379
380 (2) Purpose:
381
382 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.
383
384 **Description of the host CCPID instruction**
385
386 **Instruction description**
387
388 **Content, range and data type**
389
390 (% class="table-bordered" %)
391 |**Name**|**Features**|**Bits (bits)**|**Whether pulse type**|**Instruction format**|**Step count**
392 |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
393
394 (% class="table-bordered" %)
395 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="3" %)**Devices**|**Offset modification**|**Pulse extension**
396 |**D**|**R**|**SD**|**[D]**|**XXP**
397 |(% rowspan="4" %)CCPID|Parameter 1|●|●|●| |
398 |Parameter 2|●|●|●| |
399 |Parameter 3|●|●|●| |
400 |Parameter 4|●|●|●| |
401
402 **Device used**
403
404 [[image:11_html_954290ac172c672b.jpg||class="img-thumbnail"]] is the target value (SV) of PID control;
405
406 [[image:11_html_31f47ac5eec30067.jpg||class="img-thumbnail"]] is the measured feedback value (PV);
407
408 [[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;
409
410 [[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.
411
412 (% style="text-align:center" %)
413 [[image:11_html_8eeef07485b91193.jpg||class="img-thumbnail"]]
414
415 **Programming example**
416
417 The parameter description is as follows:
418
419 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.;
420
421 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;
422
423 D130 unit is used to store the calculated control output value to control the execution of the action.
424
425 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:
426
427 [[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).
428
429 [[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.
430
431 [[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.
432
433 (% class="table-bordered" %)
434 |**Unit**|**Features**|**Setting instructions**|**Supplement**
435 | |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.
436 |+1|Action direction (ACT)|(((
437 bit0: 0=positive action; 1=reverse action bit2: auto-tuning transition zone switch. 0=not open;1=open
438
439 bit3: 0=unidirection; 1=bidirection
440
441 Bit4: 0=auto-tuning does not execute; 1=execute auto-tuning
442
443 [Bit6:0=Two-stage auto-tuning does not execute. 1=Execute two-stage auto-tuning (bit4 must be set to 1).
444
445 bit7: 0=Three-stage auto-tuning does not execute. 1=Execute three-stage auto-tuning (bit4 must be set to 1 )]
446
447 The Others cannot be used.
448 )))|(((
449 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.
450
451 bit2: Self-tuning transition zone switch. There is a transition zone size of 1.5℃ when opened.
452
453 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.
454
455 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
456 )))
457 |+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;
458 |+3|Proportional gain(Kp)|Set range: 0 to 30,000[%]|Overrun error 4D87H
459 |+4|Integration time (Ti)|Ti is integration time, and the range is 0 to 3,600 (s)|Overrun error 4D88H
460 |+5|Differential time (Td)|Td is derivative time, and the range is 0 to 1,000 (s)|Overrun error 4D89H
461 |+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.
462 |+7|Output low limit|(((
463 Range: -10,000 to 10,000.
464
465 Recommended setting range: -2,000 or 0 (when S3+1 bit3=0, the lower limit = 0;
466
467 when bit3=1, the lower limit = -2,000)
468 )))|(((
469 ~1. Self-tuning initialization:
470
471 ① Unidirection control: the lower limit is 0;
472
473 ② 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.
474
475 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.
476 )))
477 |+8|Output upper limit|(((
478 Value range: -10,000 to 10,000.
479
480 Recommended setting value is 2,000
481 )))|(((
482 ~1. Self-tuning initialization:
483
484 ① Unidirection control: If the upper limit is less than 0, the default upper limit is 2,000;
485
486 ② 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.
487
488 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.
489 )))
490 |+9|Mode setting|(((
491 0: Overshoot allowed
492
493 1: Slight overshoot or no overshoot
494
495 2: Dynamic setting
496 )))|(((
497 0:Overshoot allowed (ukd = 100)
498
499 1: Slight overshoot or no overshoot mode (ukd = 300)
500 )))
501 |+10|(((
502 Scale factor
503
504 (ukp)
505 )))|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.
506 |+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.
507 |+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.
508 |+13|Maximum ascent rate (DeltaT)|The range is 0 to 32,000, which is the threshold of integral increment|Overrun error 4D82H
509 |+14|Filtering (C0)|The range is 0 to 1,023, integral part filtering|Overrun error 4D81H
510 |+15|(% rowspan="3" %)reserved for internal control|(% rowspan="3" %)Internal control space occupation|(% rowspan="3" %)
511 |┆
512 |+21
513 |+22|(% rowspan="3" %)used space for self-tuning|(% rowspan="3" %)New self-tuning space for internal use|(% rowspan="3" %)
514 |┆
515 |+51
516
517 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.
518
519 2) +2 filter coefficient α: Processing in first-order inertial filter
520
521 Formula: **T,,now,,=(100-α)×T,,α,,+α×T,,old,,**
522
523 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)
524
525 3) +6 work range: Twork(example: 170 represents 17℃)
526
527 (% style="text-align:center" %)
528 [[image:11_html_7ab814bb49fffa5a.gif||class="img-thumbnail"]]
529
530 4) +9 working mode:
531
532 0: Working mode that allows overshoot
533
534 1: Slight overshoot or no overshoot working mode
535
536 2: Custom settings; to achieve by setting +10, +11, +12 three coefficients.
537
538 5) +1 bit2 self-tuning transition zone switch: (upper limit 1℃, low limit 0.5℃)
539
540 The transition zone description in forward control:
541
542 (% style="text-align:center" %)
543 [[image:11_html_d90c24627566bf2f.gif||class="img-thumbnail"]]
544
545 In the heating process, when PV≤SV+1℃, 100% power output; when PV>SV+1℃, no output.
546
547 In the cooling process, when PV<SV-0.5℃, 100% power output; When PV≥SV-0.5℃, no output.
548
549 The transition zone description in reverse control:
550
551 (% style="text-align:center" %)
552 [[image:11_html_d3c25044a54c62ce.gif||class="img-thumbnail"]]
553
554 In the cooling process, when PV≥SV-1℃, 100% power output; when PV<SV-1℃, no output.
555
556 In the heating process, when PV>SV+0.5℃, 100% power output; When PV≤SV+0.5℃, no output.
557
558 The transition zone description in bidirectional control:
559
560 (% style="text-align:center" %)
561 [[image:11_html_9eb35607c95b1580.gif||class="img-thumbnail"]]
562
563 In the heating process, when PV≤SV+1℃, 100% power heating output; when PV>SV+1℃, 100% power cooling output.
564
565 In the cooling process, when PV<SV-0.5℃, 100% power heating output. When PV≥SV-0.5℃, 100% power cooling output
566
567 **Programming case**
568
569 **CCPID application configuration**
570
571 (1) Parameter setting
572
573 (% style="text-align:center" %)
574 [[image:11_html_36a152ee534a7f24.png||class="img-thumbnail"]]
575
576 (2) CCPID control process setting
577
578 (% style="text-align:center" %)
579 [[image:11_html_51d50fa8b154baca.png||class="img-thumbnail"]]
580
581 (% style="text-align:center" %)
582 [[image:11_html_66c8a636f6176c1f.png||class="img-thumbnail"]]
583
584 (3) Bidirection control
585
586 (% style="text-align:center" %)
587 [[image:11_html_234093eac2fe184d.png||class="img-thumbnail"]]
588
589 **✎Note:**
590
591 ~1. CCPID is a special instruction for operation control. CCPID operation will be executed only after the sample time is reached.
592
593 2. There is no limit to the number of times the CCPID instruction can be used, but+51 cannot be repeated.
594
595 3. Before CCPID instruction is executed, CCPID parameters need to be set.
596
597 **Case analysis**
598
599 **(1) Control requirements**
600
601 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.
602
603 **(2) Sample program**
604
605 (% style="text-align:center" %)
606 [[image:11_html_f0a22955a8da7129.png||class="img-thumbnail"]]
607
608 (% style="text-align:center" %)
609 [[image:11_html_ad08c65bd672c66e.png||class="img-thumbnail"]]
610
611 **(3) Parameter description**
612
613 (% class="table-bordered" %)
614 |**PLC device**|**Control instructions**
615 |M0|Set auto tuning
616 |M1|CCPID instruction calculation start
617 |M2|CCPID operating status
618 |Y0|Pulse output with adjustable pulse width
619 |D0|Temperature measured value
620 |D1|Temperature setting value
621 |D100|sample time
622 |D101|Control detail settings
623 |D102|First-order inertial filter coefficient
624 |D106|Working interval
625 |D109|Operating mode
626
627 **(4) Parameter control effect description**
628
629 1) Boiling water experiment
630
631 ① Auto-tuning process and control process (no transition zone setting), take two-stage auto-tuning as an example
632
633 (% style="text-align:center" %)
634 [[image:11_html_9149b1e837158a17.gif||class="img-thumbnail"]]
635
636 Figure 1 Auto-tuning process curve without transition zone
637
638 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.
639
640 ②Self-tuning process and control process (transition zone setting)
641
642 (% style="text-align:center" %)
643 [[image:11_html_a1e8ad7a31bb04af.gif||class="img-thumbnail"]]
644
645 Figure 2 Self-tuning process curve with transition zone
646
647 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.
648
649 2) Difference in working interval setting
650
651 (% style="text-align:center" %)
652 [[image:11_html_4140432ce11883ad.gif||class="img-thumbnail"]]
653
654 Figure 3 Process curve under different working interval parameters
655
656 (% style="text-align:center" %)
657 [[image:11_html_f742d80c8cc95f35.gif||class="img-thumbnail"]]
658
659 Figure 4 Process curve without different working interval parameters (heating process diagram)
660
661 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.
662
663 3) Result of filter coefficient setting
664
665 (% style="text-align:center" %)
666 [[image:11_html_815ec6c129ae3891.gif||class="img-thumbnail"]]
667
668 Figure 5 Process curve under different filtering parameters
669
670 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.
671
672 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.
673
674 **✎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.
675
676 4) The difference in mode selection
677
678 0: Overshoot allowed(ukd = 100)
679
680 1: Small overshoot or no overshoot (ukd = 300)
681
682 (% style="text-align:center" %)
683 [[image:11_html_3a7b42c8f4672ce4.gif||class="img-thumbnail"]]
684
685 Figure 6 Process curves in different working modes
686
687 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).
688
689 5) The function of the coefficient
690
691 (% style="text-align:center" %)
692 [[image:11_html_74a7527eace55103.gif||class="img-thumbnail"]]
693
694 Figure 7 Process curve under dynamic setting
695
696 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.
697
698 Ukp is adjusted when the value of Kp reaches the maximum value, and the default value is usually 100.
699
700 Uki is adjusted when periodic oscillations occur. Gradually increase the value of uki to track the control effect.