Wiki source code of 11 PID

Version 10.1 by Devin Chen on 2024/04/15 09:59

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