1 | #*------------------------------------------------------------------- |
---|
2 | * EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC. |
---|
3 | * |
---|
4 | * This LIBRARY is free software; you can distribute it and/or modify |
---|
5 | * it under the therms of the ALSOC FREE LICENSE as available at |
---|
6 | * http://www.enq.ufrgs.br/alsoc. |
---|
7 | * |
---|
8 | * EMSO is distributed under the terms of the ALSOC LICENSE as |
---|
9 | * available at http://www.enq.ufrgs.br/alsoc. |
---|
10 | *----------------------------------------------------------------------- |
---|
11 | * Author: Jonathan Ospino P. |
---|
12 | * $Id: Tuning.mso 2012$ |
---|
13 | *---------------------------------------------------------------------*# |
---|
14 | |
---|
15 | #* Ideal PID Tuning tool |
---|
16 | |
---|
17 | Brief description |
---|
18 | ------------------ |
---|
19 | |
---|
20 | This tool allows the user to obtain the controller tuning parameters according to some of the |
---|
21 | most common PID tuning rules found in the literature.In order to be used this block, one must supply |
---|
22 | the following parameters: |
---|
23 | |
---|
24 | CASE 1: The parameters of the different elements of the control system are known: |
---|
25 | * Process characterization: Gain(K), Time Constant(Tau), and Dead Time (t0; if present). |
---|
26 | * Sensor-Transmitter: Gain(Km) and Time Constant(Taum). |
---|
27 | * Valve: Gain(Kf) and Time Constant(Tauf). |
---|
28 | |
---|
29 | CASE 2: The parameters of the FODPDT approximation of the response curve are known: |
---|
30 | In this case the process characterization are taken as the parameters of the FODPDT approximation. |
---|
31 | For making the algorithm constistent, the parameters of the other elements of control system must be set to ZERO!!! |
---|
32 | |
---|
33 | |
---|
34 | What results are reported to the user? |
---|
35 | -------------------------------------- |
---|
36 | |
---|
37 | According to the type of controller and the parameters specified, the block does the respective |
---|
38 | calculations and shows the following results for each of the different tuning rules: |
---|
39 | |
---|
40 | * Controller tuning parameters: |
---|
41 | - Controller proportional gain (Kc) |
---|
42 | - Controller integral time (TauI) |
---|
43 | - Controller derivative time (TauD) |
---|
44 | - Controller proportional band (PB) |
---|
45 | - Controller reset rate (TauI_R) |
---|
46 | |
---|
47 | References |
---|
48 | *Corripio and Smith. Principles of Automatic Process Control. 2005 |
---|
49 | *Luyben and Luyben. Essentials of Process Control.1997 |
---|
50 | *Marlin T. Process control : designing processes and control systems for dynamic performance. 2000 |
---|
51 | |
---|
52 | *# |
---|
53 | |
---|
54 | using "types"; |
---|
55 | |
---|
56 | Model PID_Tuning |
---|
57 | |
---|
58 | ATTRIBUTES |
---|
59 | Pallete=true; |
---|
60 | Icon="icon/Tuning"; |
---|
61 | Info="== Ideal PID Tuning == |
---|
62 | |
---|
63 | It computes the tuning parameters of an Ideal PID according to different tuning rules. |
---|
64 | This tool can be used in the following two cases: |
---|
65 | |
---|
66 | (1) If the parameters of the basic elements of the control system are known |
---|
67 | (Gain, time constant, and time delay). |
---|
68 | |
---|
69 | (2) If the parameters of a FODPDT approximation of the response curve are known. |
---|
70 | |
---|
71 | In the first case all the parameters must be specified normally. |
---|
72 | In the second case, however, the parameters of all the basic elements of the control system, |
---|
73 | but the process, must be specified as ZERO. In this case the process parameters are taken |
---|
74 | as the parameters of the FODPDT approximation of the response curve."; |
---|
75 | |
---|
76 | |
---|
77 | PARAMETERS |
---|
78 | |
---|
79 | # QUALITATIVE PARAMETERS |
---|
80 | Controller_Type as Switcher(Valid=["P","PI","PID"],Default="PID"); |
---|
81 | Lopez_et_al_Criterion as Switcher(Valid=["IAE","ISE","ITAE"],Default="IAE"); |
---|
82 | Rovira_et_al_Criterion as Switcher(Valid=["IAE","ITAE"],Default="IAE"); |
---|
83 | |
---|
84 | #PROCESS |
---|
85 | Kp as Real(Brief="<<Process Steady-State Gain>> or <<Gain of the response curve as an approximation to a FODPDT>>",Default=1); |
---|
86 | Taup as Real(Brief="<<Process Time Constant>> or <<Time Constant of the response curve as an approximation to a FODPDT>>",Default=1); |
---|
87 | t0p as Real(Brief="<<Process Time Delay>> or <<Time Delay of the response curve as an approximation to a FODPDT>>",Default=0); |
---|
88 | |
---|
89 | #SENSOR-TRANSMITTER |
---|
90 | Km as Real(Brief="Sensor-Transmitter Gain (NOTE:Set it to ZERO in case of using a Response curve characterization)",Default=1); |
---|
91 | Taum as Real(Brief="Sensor-Transmitter Time Constant (NOTE:Set it to ZERO in case of using a Response curve characterization)",Default=0); |
---|
92 | |
---|
93 | #VALVE |
---|
94 | Kf as Real(Brief="Valve Steady-State Gain (NOTE:Set it to ZERO in case of using a Response curve characterization)",Default=1); |
---|
95 | Tauf as Real(Brief="Valve Time Constant (NOTE:Set it to ZERO in case of using a Response curve characterization)",Default=1); |
---|
96 | |
---|
97 | |
---|
98 | VARIABLES |
---|
99 | |
---|
100 | # PARAMETERS FOR THE Kcu CALCULATION PROCEDURE USING A FIRST-ORDER PADÉ APPROXIMATION |
---|
101 | |
---|
102 | #* Coefficients of the polynomial used for computing the ultimate parameters |
---|
103 | in case of having the FIRST CASE listed below with the presence of time delay.*# |
---|
104 | A as Real(Hidden=true); |
---|
105 | B as Real(Hidden=true); |
---|
106 | C as Real(Hidden=true); |
---|
107 | #* Variables used to store the value of the calculated roots of the wu polynomial*# |
---|
108 | wu12 as Real(Hidden=true); |
---|
109 | wu22 as Real(Hidden=true); |
---|
110 | |
---|
111 | # PARAMETERS OF THE FODPDT APPROXIMATION |
---|
112 | K as Real(Brief="Gain of the FODPDT approximation",Protected=true); |
---|
113 | Tau as Real(Brief="Time Constant of the FODPDT approximation",Protected=true); |
---|
114 | t0 as Real(Brief="Time Delay of the FODPDT approximation",Protected=true); |
---|
115 | |
---|
116 | # PARAMETERS OF THE LOPEZ'S TUNING RULE |
---|
117 | aL1 as Real(Hidden=true); |
---|
118 | bL1 as Real(Hidden=true); |
---|
119 | aL2 as Real(Hidden=true); |
---|
120 | bL2 as Real(Hidden=true); |
---|
121 | aL3 as Real(Hidden=true); |
---|
122 | bL3 as Real(Hidden=true); |
---|
123 | |
---|
124 | # PARAMETERS OF THE ROVIRAS'S TUNING RULE |
---|
125 | aR1 as Real(Hidden=true); |
---|
126 | bR1 as Real(Hidden=true); |
---|
127 | aR2 as Real(Hidden=true); |
---|
128 | bR2 as Real(Hidden=true); |
---|
129 | aR3 as Real(Hidden=true); |
---|
130 | bR3 as Real(Hidden=true); |
---|
131 | |
---|
132 | # Results for each set of Tuning Rules |
---|
133 | ZieglerNichols_ClosedLoop as TunedController(Protected=true); |
---|
134 | TyreusLuyben_ClosedLoop as TunedController(Protected=true); |
---|
135 | ZieglerNichols_OpenLoop as TunedController(Protected=true); |
---|
136 | CohenCoon_OpenLoop as TunedController(Protected=true); |
---|
137 | Lopez_et_al_Performance as TunedController(Protected=true); |
---|
138 | Rovira_et_al_Performance as TunedController(Protected=true); |
---|
139 | Ciancone_Regulatory as TunedController(Protected=true); |
---|
140 | Ciancone_Servo as TunedController(Protected=true); |
---|
141 | |
---|
142 | # Parameters used in the stability criteria |
---|
143 | Kcu as Real(Brief="Controller Ultimate Gain",Protected=true); |
---|
144 | Tu as Real(Brief="Controller Ultimate Period",Protected=true); |
---|
145 | wu as Real(Brief="Controller Ultimate frequency",Protected=true); |
---|
146 | |
---|
147 | |
---|
148 | EQUATIONS |
---|
149 | |
---|
150 | # ******************************************************** |
---|
151 | # *** 1. Previous calculations to the tuning procedure *** |
---|
152 | # ******************************************************** |
---|
153 | |
---|
154 | # ******************************************** |
---|
155 | # *** 1.1. Ultimate parameters calculation *** |
---|
156 | # ******************************************** |
---|
157 | |
---|
158 | if abs(Kp*Kf*Km)>0 then |
---|
159 | ## FIRST CASE: All the parameters of the control system are known |
---|
160 | if t0p<=0 then |
---|
161 | ### Systems without time delay |
---|
162 | if Taum>0 then |
---|
163 | #### Considering the Sensor-Transmitter time constant (3 FOD) |
---|
164 | |
---|
165 | "Direct Substitution Method on a 3FOD system" |
---|
166 | wu=sqrt((Taup+Taum+Tauf)/(Taup*Taum*Tauf)); |
---|
167 | Kcu=((Tauf*Taup+Tauf*Taum+Taum*Taup)*(Tauf+Taup+Taum)-Taup*Tauf*Taum)/(Tauf*Taup*Taum*Kf*Kp*Km); |
---|
168 | Tu=2*3.141592/wu; |
---|
169 | |
---|
170 | # Parameters of the most complex case |
---|
171 | A=0; |
---|
172 | B=0; |
---|
173 | C=0; |
---|
174 | wu12=0; |
---|
175 | wu22=0; |
---|
176 | else |
---|
177 | #### Without considering the Sensor-Transmitter time constant (2 FOD) |
---|
178 | |
---|
179 | "Direct Substitution Method on a 2FOD system" |
---|
180 | wu=0; |
---|
181 | Kcu=-1/(Kf*Kp*Km); #It has to be checked it out!!! |
---|
182 | Tu=0; |
---|
183 | |
---|
184 | # Parameters of the most complex case |
---|
185 | A=0; |
---|
186 | B=0; |
---|
187 | C=0; |
---|
188 | wu12=0; |
---|
189 | wu22=0; |
---|
190 | end |
---|
191 | else |
---|
192 | ### Systems with time delay |
---|
193 | if Taum>0 then |
---|
194 | #### Considering the Sensor-Transmitter time constant (3 FOD + Time Delay) |
---|
195 | |
---|
196 | #* |
---|
197 | By the Direct substitution method coupled with a First-Order Padé approximation |
---|
198 | we can obtain a Fourth-Degree polynomial of wu of the form: |
---|
199 | |
---|
200 | A*wu^4 + B*wu^2 + C= 0 |
---|
201 | |
---|
202 | which can be used for computing wu in a simple way, as follows: |
---|
203 | *# |
---|
204 | |
---|
205 | "Direct Substitution Method on a 2FOD+1FODPDT system" |
---|
206 | A=-(Tauf*Taup*Taum)*t0p^2/2; |
---|
207 | B=t0p*((t0p*(Tauf+Taup+Taum)+2*(Tauf*Taup+Tauf*Taum+Taum*Taup))/2-(t0p*(Tauf*Taup+Tauf*Taum+Taum*Taup)+2*Taup*Taum*Tauf)); |
---|
208 | C=-2*(t0p+Taup+Taum+Tauf); |
---|
209 | wu12=(-B+sqrt(B^2-4*A*C))/(2*A); |
---|
210 | wu22=(-B-sqrt(B^2-4*A*C))/(2*A); |
---|
211 | |
---|
212 | if wu12<=0 then |
---|
213 | if wu22>0 then |
---|
214 | wu=sqrt(wu22); |
---|
215 | else |
---|
216 | wu=0; |
---|
217 | end |
---|
218 | else |
---|
219 | wu=sqrt(wu12); # wu12 is greater than wu22 |
---|
220 | end |
---|
221 | |
---|
222 | Kcu=-(t0p*(Tauf*Taup*Taum)/(2*Kp*Kf*Km))*wu^4+((t0p*(Taup+Taum+Tauf)+2*(Taup*Taum+Taum*Tauf+Tauf*Taup))/(2*Kp*Kf*Km))*wu^2-1/(Kp*Kf*Km); |
---|
223 | if wu>0 then |
---|
224 | Tu=2*3.141592/wu; |
---|
225 | else |
---|
226 | Tu=0; |
---|
227 | end |
---|
228 | else |
---|
229 | #### Without considering the Sensor-Transmitter time constant (TO BE CHECKED !!!) |
---|
230 | |
---|
231 | #* |
---|
232 | By the Direct substitution method coupled with a First-Order Padé approximation |
---|
233 | we can obtain a Quadratic polynomial of wu of the form: |
---|
234 | |
---|
235 | A*wu^2 + B = 0 |
---|
236 | |
---|
237 | which can be used for computing wu in a simple way, as follows: |
---|
238 | *# |
---|
239 | |
---|
240 | "Direct Substitution Method on a 1FOD+1FODPDT system" |
---|
241 | A=-(Tauf*Taup*t0p+t0p*(t0p*Tauf+t0p*Taup+2*Tauf*Taup)/2); |
---|
242 | B=2*(t0p+Tauf+Taup); |
---|
243 | C=0; |
---|
244 | wu12=0; |
---|
245 | wu22=-B/A; # temporarily saves the result |
---|
246 | |
---|
247 | if wu22>0 then |
---|
248 | wu=sqrt(wu22); |
---|
249 | else |
---|
250 | wu=0; |
---|
251 | end |
---|
252 | |
---|
253 | Kcu=((t0p*Tauf+t0p*Taup+2*Tauf*Taup)*wu^2-2)/(2*Kp*Kf*Km); |
---|
254 | |
---|
255 | if wu>0 then |
---|
256 | Tu=2*3.141592/wu; |
---|
257 | else |
---|
258 | Tu=0; |
---|
259 | end |
---|
260 | end |
---|
261 | end |
---|
262 | else |
---|
263 | ## SECOND CASE: The parameters of a FODPDT response curve are known |
---|
264 | if t0p>0 then |
---|
265 | ### System with time delay |
---|
266 | |
---|
267 | "Direct Substitution Method on a FODPDT with a First-Order Padé Approximation" |
---|
268 | wu=(2/t0p)*sqrt(t0p/Taup+1); |
---|
269 | Kcu=(1+2*Taup/t0p)/Kp; |
---|
270 | Tu=2*3.141592/wu; |
---|
271 | |
---|
272 | # Parameters of the most complex case |
---|
273 | A=0; |
---|
274 | B=0; |
---|
275 | C=0; |
---|
276 | wu12=0; |
---|
277 | wu22=0; |
---|
278 | else |
---|
279 | ### System without time delay |
---|
280 | |
---|
281 | "Direct Substitution Method on a FOD" |
---|
282 | wu=0; |
---|
283 | Kcu=-1/Kp; |
---|
284 | Tu=0; |
---|
285 | #* WARNING: |
---|
286 | This case doesn't have an ultimate value. |
---|
287 | User should be capable of understanding this by oneself. |
---|
288 | This equations are put here just for equaling the number |
---|
289 | of the equations in both side of the IF-ELSE sentence*# |
---|
290 | |
---|
291 | # Parameters of the most complex case |
---|
292 | A=0; |
---|
293 | B=0; |
---|
294 | C=0; |
---|
295 | wu12=0; |
---|
296 | wu22=0; |
---|
297 | end |
---|
298 | end |
---|
299 | |
---|
300 | |
---|
301 | # ***************************************************************** |
---|
302 | # *** 1.2. Approximation of a 2FOD+1FODPDT to a FODPDT dynamics *** |
---|
303 | # ***************************************************************** |
---|
304 | if (abs(Kf)<=0) and (abs(Km)<=0) then |
---|
305 | # Case 1: An approximation of the response curve to a FODPDT is provided |
---|
306 | K=Kp; |
---|
307 | Tau=Taup; |
---|
308 | t0=t0p; |
---|
309 | else |
---|
310 | # Case 2: The parameters Kf,Tauf,Kp,Taup,t0p,Km, and Taum are provided |
---|
311 | # The following simple estimation is considered: |
---|
312 | K=Kf*Kp*Km; |
---|
313 | Tau=max([Taup,Tauf,Taum]); |
---|
314 | t0=sum([Taup,Tauf,Taum])-max([Taup,Tauf,Taum]); |
---|
315 | |
---|
316 | end |
---|
317 | |
---|
318 | |
---|
319 | # ****************************************** |
---|
320 | # *** 2. Application of the Tuning Rules *** |
---|
321 | # ****************************************** |
---|
322 | |
---|
323 | # ******************************************** |
---|
324 | # ** 2.1 ZIEGLER-NICHOLS CLOSED-LOOP METHOD ** TO BE CHECKED!! |
---|
325 | # ******************************************** |
---|
326 | switch Controller_Type |
---|
327 | case "P": |
---|
328 | ZieglerNichols_ClosedLoop.Kc=Kcu/2; |
---|
329 | ZieglerNichols_ClosedLoop.TauI=0; # It cannot be calculated |
---|
330 | ZieglerNichols_ClosedLoop.TauD=0; # It cannot be calculated |
---|
331 | case "PI": |
---|
332 | ZieglerNichols_ClosedLoop.Kc=Kcu/2.2; |
---|
333 | ZieglerNichols_ClosedLoop.TauI=Tu/1.2; |
---|
334 | ZieglerNichols_ClosedLoop.TauD=0; # It cannot be calculated |
---|
335 | case "PID": |
---|
336 | ZieglerNichols_ClosedLoop.Kc=1.25*Kcu/1.7; |
---|
337 | ZieglerNichols_ClosedLoop.TauI=5*Tu/8; |
---|
338 | ZieglerNichols_ClosedLoop.TauD=Tu/10; |
---|
339 | end |
---|
340 | |
---|
341 | |
---|
342 | # ****************************************** |
---|
343 | # ** 2.2 TYREUS-LUYBEN CLOSED-LOOP METHOD ** |
---|
344 | # ****************************************** |
---|
345 | # Taken from Luyben & Luyben. Essentials of process control. |
---|
346 | switch Controller_Type |
---|
347 | case "P": |
---|
348 | # This method doesn't have correlations for a Only-P controller |
---|
349 | TyreusLuyben_ClosedLoop.Kc=0; # It cannot be calculated |
---|
350 | TyreusLuyben_ClosedLoop.TauI=0; # It cannot be calculated |
---|
351 | TyreusLuyben_ClosedLoop.TauD=0; # It cannot be calculated |
---|
352 | case "PI": |
---|
353 | TyreusLuyben_ClosedLoop.Kc=Kcu/3.2; |
---|
354 | TyreusLuyben_ClosedLoop.TauI=2.2*Tu; |
---|
355 | TyreusLuyben_ClosedLoop.TauD=0; |
---|
356 | case "PID": |
---|
357 | TyreusLuyben_ClosedLoop.Kc=Kcu/2.2; |
---|
358 | TyreusLuyben_ClosedLoop.TauI=2.2*Tu; |
---|
359 | TyreusLuyben_ClosedLoop.TauD=Tu/6.3; |
---|
360 | end |
---|
361 | |
---|
362 | |
---|
363 | # ****************************************** |
---|
364 | # ** 2.3 ZIEGLER-NICHOLS OPEN-LOOP METHOD ** |
---|
365 | # ****************************************** |
---|
366 | switch Controller_Type |
---|
367 | case "P": |
---|
368 | if t0>0 then |
---|
369 | ZieglerNichols_OpenLoop.Kc=(1/K)*(Tau/t0); |
---|
370 | ZieglerNichols_OpenLoop.TauI=0; # It cannot be calculated |
---|
371 | ZieglerNichols_OpenLoop.TauD=0; # It cannot be calculated |
---|
372 | else |
---|
373 | ZieglerNichols_OpenLoop.Kc=0; |
---|
374 | ZieglerNichols_OpenLoop.TauI=0; # It cannot be calculated |
---|
375 | ZieglerNichols_OpenLoop.TauD=0; # It cannot be calculated |
---|
376 | end |
---|
377 | case "PI": |
---|
378 | if t0>0 then |
---|
379 | ZieglerNichols_OpenLoop.Kc=(0.9/K)*(Tau/t0); |
---|
380 | ZieglerNichols_OpenLoop.TauI=3.3*t0; |
---|
381 | ZieglerNichols_OpenLoop.TauD=0; # It cannot be calculated |
---|
382 | else |
---|
383 | ZieglerNichols_OpenLoop.Kc=0; |
---|
384 | ZieglerNichols_OpenLoop.TauI=0; |
---|
385 | ZieglerNichols_OpenLoop.TauD=0; # It cannot be calculated |
---|
386 | end |
---|
387 | case "PID": |
---|
388 | if t0>0 then |
---|
389 | ZieglerNichols_OpenLoop.Kc=(1.2/K)*(Tau/t0); |
---|
390 | ZieglerNichols_OpenLoop.TauI=2.0*t0; |
---|
391 | ZieglerNichols_OpenLoop.TauD=0.5*t0; |
---|
392 | else |
---|
393 | ZieglerNichols_OpenLoop.Kc=0; |
---|
394 | ZieglerNichols_OpenLoop.TauI=0; |
---|
395 | ZieglerNichols_OpenLoop.TauD=0; |
---|
396 | end |
---|
397 | end |
---|
398 | |
---|
399 | |
---|
400 | # ************************************* |
---|
401 | # ** 2.4 COHEN-COON OPEN-LOOP METHOD ** |
---|
402 | # ************************************* |
---|
403 | switch Controller_Type |
---|
404 | case "P": |
---|
405 | if t0>0 then |
---|
406 | CohenCoon_OpenLoop.Kc=(Tau/(K*t0))*(1+t0/(3*Tau)); |
---|
407 | CohenCoon_OpenLoop.TauI=0; # It cannot be calculated |
---|
408 | CohenCoon_OpenLoop.TauD=0; # It cannot be calculated |
---|
409 | else |
---|
410 | CohenCoon_OpenLoop.Kc=0; |
---|
411 | CohenCoon_OpenLoop.TauI=0; # It cannot be calculated |
---|
412 | CohenCoon_OpenLoop.TauD=0; # It cannot be calculated |
---|
413 | end |
---|
414 | case "PI": |
---|
415 | if t0>0 then |
---|
416 | CohenCoon_OpenLoop.Kc=(Tau/(K*t0))*(0.9+t0/(12*Tau)); |
---|
417 | CohenCoon_OpenLoop.TauI=t0*(30+3*t0/Tau)/(9+20*t0/Tau); |
---|
418 | CohenCoon_OpenLoop.TauD=0; # It cannot be calculated |
---|
419 | else |
---|
420 | CohenCoon_OpenLoop.Kc=0; |
---|
421 | CohenCoon_OpenLoop.TauI=0; |
---|
422 | CohenCoon_OpenLoop.TauD=0; # It cannot be calculated |
---|
423 | end |
---|
424 | case "PID": |
---|
425 | if t0>0 then |
---|
426 | CohenCoon_OpenLoop.Kc=(Tau/(K*t0))*(4/3+t0/(4*Tau)); |
---|
427 | CohenCoon_OpenLoop.TauI=t0*(32+6*t0/Tau)/(13+8*t0/Tau); |
---|
428 | CohenCoon_OpenLoop.TauD=4*t0/(11+2*t0/Tau); |
---|
429 | else |
---|
430 | CohenCoon_OpenLoop.Kc=0; |
---|
431 | CohenCoon_OpenLoop.TauI=0; |
---|
432 | CohenCoon_OpenLoop.TauD=0; |
---|
433 | end |
---|
434 | end |
---|
435 | |
---|
436 | |
---|
437 | # ******************************************************************* |
---|
438 | # ** 2.5 LOPEZ (REGULATORY): TUNING RULES FOR INTEGRAL PERFORMANCE ** |
---|
439 | # ******************************************************************* |
---|
440 | switch Lopez_et_al_Criterion |
---|
441 | case "IAE": |
---|
442 | switch Controller_Type |
---|
443 | case "P": |
---|
444 | aL1=0.902; |
---|
445 | bL1=-0.985; |
---|
446 | aL2=0; # It does not exist |
---|
447 | bL2=0; # It does not exist |
---|
448 | aL3=0; # It does not exist |
---|
449 | bL3=0; # It does not exist |
---|
450 | Lopez_et_al_Performance.Kc=(aL1/K)*(t0/Tau)^(bL1); |
---|
451 | Lopez_et_al_Performance.TauI=0; # It cannot be calculated |
---|
452 | Lopez_et_al_Performance.TauD=0; # It cannot be calculated |
---|
453 | case "PI": |
---|
454 | aL1=0.984; |
---|
455 | bL1=-0.986; |
---|
456 | aL2=0.608; |
---|
457 | bL2=0.707; |
---|
458 | aL3=0; # It does not exist |
---|
459 | bL3=0; # It does not exist |
---|
460 | Lopez_et_al_Performance.Kc=(aL1/K)*(t0/Tau)^(bL1); |
---|
461 | Lopez_et_al_Performance.TauI=(Tau/aL2)*(t0/Tau)^(bL2); |
---|
462 | Lopez_et_al_Performance.TauD=0; # It cannot be calculated |
---|
463 | case "PID": |
---|
464 | aL1=1.435; |
---|
465 | bL1=-0.921; |
---|
466 | aL2=0.878; |
---|
467 | bL2=0.749; |
---|
468 | aL3=0.482; |
---|
469 | bL3=1.137; |
---|
470 | Lopez_et_al_Performance.Kc=(aL1/K)*(t0/Tau)^(bL1); |
---|
471 | Lopez_et_al_Performance.TauI=(Tau/aL2)*(t0/Tau)^(bL2); |
---|
472 | Lopez_et_al_Performance.TauD=aL3*Tau*(t0/Tau)^(bL3); |
---|
473 | end |
---|
474 | case "ISE": |
---|
475 | switch Controller_Type |
---|
476 | case "P": |
---|
477 | aL1=1.411; |
---|
478 | bL1=-0917; |
---|
479 | aL2=0; # It does not exist |
---|
480 | bL2=0; # It does not exist |
---|
481 | aL3=0; # It does not exist |
---|
482 | bL3=0; # It does not exist |
---|
483 | Lopez_et_al_Performance.Kc=(aL1/K)*(t0/Tau)^(bL1); |
---|
484 | Lopez_et_al_Performance.TauI=0; # It cannot be calculated |
---|
485 | Lopez_et_al_Performance.TauD=0; # It cannot be calculated |
---|
486 | case "PI": |
---|
487 | aL1=1.305; |
---|
488 | bL1=-0.959; |
---|
489 | aL2=0.492; |
---|
490 | bL2=0.739; |
---|
491 | aL3=0; # It does not exist |
---|
492 | bL3=0; # It does not exist |
---|
493 | Lopez_et_al_Performance.Kc=(aL1/K)*(t0/Tau)^(bL1); |
---|
494 | Lopez_et_al_Performance.TauI=(Tau/aL2)*(t0/Tau)^(bL2); |
---|
495 | Lopez_et_al_Performance.TauD=0; # It cannot be calculated |
---|
496 | case "PID": |
---|
497 | aL1=1.495; |
---|
498 | bL1=-0.945; |
---|
499 | aL2=1.101; |
---|
500 | bL2=0.771; |
---|
501 | aL3=0.560; |
---|
502 | bL3=1.006; |
---|
503 | Lopez_et_al_Performance.Kc=(aL1/K)*(t0/Tau)^(bL1); |
---|
504 | Lopez_et_al_Performance.TauI=(Tau/aL2)*(t0/Tau)^(bL2); |
---|
505 | Lopez_et_al_Performance.TauD=aL3*Tau*(t0/Tau)^(bL3); |
---|
506 | end |
---|
507 | case "ITAE": |
---|
508 | switch Controller_Type |
---|
509 | case "P": |
---|
510 | aL1=0.490; |
---|
511 | bL1=-1.084; |
---|
512 | aL2=0; # It does not exist |
---|
513 | bL2=0; # It does not exist |
---|
514 | aL3=0; # It does not exist |
---|
515 | bL3=0; # It does not exist |
---|
516 | Lopez_et_al_Performance.Kc=(aL1/K)*(t0/Tau)^(bL1); |
---|
517 | Lopez_et_al_Performance.TauI=0; # It cannot be calculated |
---|
518 | Lopez_et_al_Performance.TauD=0; # It cannot be calculated |
---|
519 | case "PI": |
---|
520 | aL1=0.859; |
---|
521 | bL1=-0.977; |
---|
522 | aL2=0.674; |
---|
523 | bL2=0.680; |
---|
524 | aL3=0; # It does not exist |
---|
525 | bL3=0; # It does not exist |
---|
526 | Lopez_et_al_Performance.Kc=(aL1/K)*(t0/Tau)^(bL1); |
---|
527 | Lopez_et_al_Performance.TauI=(Tau/aL2)*(t0/Tau)^(bL2); |
---|
528 | Lopez_et_al_Performance.TauD=0; # It cannot be calculated |
---|
529 | case "PID": |
---|
530 | aL1=1.357; |
---|
531 | bL1=-0.947; |
---|
532 | aL2=0.842; |
---|
533 | bL2=0.738; |
---|
534 | aL3=0.381; |
---|
535 | bL3=0.995; |
---|
536 | Lopez_et_al_Performance.Kc=(aL1/K)*(t0/Tau)^(bL1); |
---|
537 | Lopez_et_al_Performance.TauI=(Tau/aL2)*(t0/Tau)^(bL2); |
---|
538 | Lopez_et_al_Performance.TauD=aL3*Tau*(t0/Tau)^(bL3); |
---|
539 | end |
---|
540 | end |
---|
541 | |
---|
542 | |
---|
543 | # *************************************************************** |
---|
544 | # ** 2.6 ROVIRA (SERVO): TUNING RULES FOR INTEGRAL PERFORMANCE ** |
---|
545 | # *************************************************************** |
---|
546 | switch Rovira_et_al_Criterion |
---|
547 | case "IAE": |
---|
548 | switch Controller_Type |
---|
549 | case "P": |
---|
550 | aR1=0; # It does not exist |
---|
551 | bR1=0; # It does not exist |
---|
552 | aR2=0; # It does not exist |
---|
553 | bR2=0; # It does not exist |
---|
554 | aR3=0; # It does not exist |
---|
555 | bR3=0; # It does not exist |
---|
556 | Rovira_et_al_Performance.Kc=0; # It cannot be calculated |
---|
557 | Rovira_et_al_Performance.TauI=0; # It cannot be calculated |
---|
558 | Rovira_et_al_Performance.TauD=0; # It cannot be calculated |
---|
559 | case "PI": |
---|
560 | aR1=0.758; |
---|
561 | bR1=-0.861; |
---|
562 | aR2=1.02; |
---|
563 | bR2=-0.323; |
---|
564 | aR3=0; # It does not exist |
---|
565 | bR3=0; # It does not exist |
---|
566 | Rovira_et_al_Performance.Kc=(aR1/K)*(t0/Tau)^(bR1); |
---|
567 | Rovira_et_al_Performance.TauI=Tau/(aR2+bR2*(t0/Tau)); |
---|
568 | Rovira_et_al_Performance.TauD=0; # It cannot be calculated |
---|
569 | case "PID": |
---|
570 | aR1=1.086; |
---|
571 | bR1=-0.869; |
---|
572 | aR2=0.740; |
---|
573 | bR2=-0.130; |
---|
574 | aR3=0.348; |
---|
575 | bR3=0.914; |
---|
576 | Rovira_et_al_Performance.Kc=(aR1/K)*(t0/Tau)^(bR1); |
---|
577 | Rovira_et_al_Performance.TauI=Tau/(aR2+bR2*(t0/Tau)); |
---|
578 | Rovira_et_al_Performance.TauD=aR3*Tau*(t0/Tau)^(bR3); |
---|
579 | end |
---|
580 | case "ITAE": |
---|
581 | switch Controller_Type |
---|
582 | case "P": |
---|
583 | aR1=0; # It does not exist |
---|
584 | bR1=0; # It does not exist |
---|
585 | aR2=0; # It does not exist |
---|
586 | bR2=0; # It does not exist |
---|
587 | aR3=0; # It does not exist |
---|
588 | bR3=0; # It does not exist |
---|
589 | Rovira_et_al_Performance.Kc=0; # It cannot be calculated |
---|
590 | Rovira_et_al_Performance.TauI=0; # It cannot be calculated |
---|
591 | Rovira_et_al_Performance.TauD=0; # It cannot be calculated |
---|
592 | case "PI": |
---|
593 | aR1=0.586; |
---|
594 | bR1=-0.916; |
---|
595 | aR2=1.03; |
---|
596 | bR2=-0.165; |
---|
597 | aR3=0; # It does not exist |
---|
598 | bR3=0; # It does not exist |
---|
599 | Rovira_et_al_Performance.Kc=(aR1/K)*(t0/Tau)^(bR1); |
---|
600 | Rovira_et_al_Performance.TauI=Tau/(aR2+bR2*(t0/Tau)); |
---|
601 | Rovira_et_al_Performance.TauD=0; # It cannot be calculated |
---|
602 | case "PID": |
---|
603 | aR1=0.965; |
---|
604 | bR1=-0.855; |
---|
605 | aR2=0.796; |
---|
606 | bR2=-0.147; |
---|
607 | aR3=0.308; |
---|
608 | bR3=0.9292; |
---|
609 | Rovira_et_al_Performance.Kc=(aR1/K)*(t0/Tau)^(bR1); |
---|
610 | Rovira_et_al_Performance.TauI=Tau/(aR2+bR2*(t0/Tau)); |
---|
611 | Rovira_et_al_Performance.TauD=aR3*Tau*(t0/Tau)^(bR3); |
---|
612 | end |
---|
613 | end |
---|
614 | |
---|
615 | |
---|
616 | # ************************************************************ |
---|
617 | # ** 2.7 CIANCONE (REGULATORY): TUNING RULES BY CORRELATION ** |
---|
618 | # ************************************************************ |
---|
619 | switch Controller_Type |
---|
620 | case "P": |
---|
621 | Ciancone_Regulatory.Kc=0; |
---|
622 | Ciancone_Regulatory.TauI=0; |
---|
623 | Ciancone_Regulatory.TauD=0; |
---|
624 | case "PI": |
---|
625 | if (t0/(t0+Tau)) <= 1.0 then |
---|
626 | if (t0/(t0+Tau)) >= 0.9 then |
---|
627 | (Ciancone_Regulatory.Kc)*K=((0.3-0.35)/(1.0-0.9))*((t0/(t0+Tau))-0.9)+0.35; |
---|
628 | (Ciancone_Regulatory.TauI)/(t0+Tau)=((0.5-0.55)/(1.0-0.9))*((t0/(t0+Tau))-0.9)+0.55; |
---|
629 | (Ciancone_Regulatory.TauD)/(t0+Tau)=0; |
---|
630 | else |
---|
631 | if (t0/(t0+Tau)) >= 0.8 then |
---|
632 | (Ciancone_Regulatory.Kc)*K=((0.35-0.4)/(0.9-0.8))*((t0/(t0+Tau))-0.8)+0.4; |
---|
633 | (Ciancone_Regulatory.TauI)/(t0+Tau)=((0.55-0.58)/(0.9-0.8))*((t0/(t0+Tau))-0.8)+0.58; |
---|
634 | (Ciancone_Regulatory.TauD)/(t0+Tau)=0; |
---|
635 | else |
---|
636 | if (t0/(t0+Tau)) >= 0.7 then |
---|
637 | (Ciancone_Regulatory.Kc)*K=((0.4-0.5)/(0.8-0.7))*((t0/(t0+Tau))-0.7)+0.5; |
---|
638 | (Ciancone_Regulatory.TauI)/(t0+Tau)=((0.58-0.605)/(0.8-0.7))*((t0/(t0+Tau))-0.7)+0.605; |
---|
639 | (Ciancone_Regulatory.TauD)/(t0+Tau)=0; |
---|
640 | else |
---|
641 | if (t0/(t0+Tau)) >= 0.6 then |
---|
642 | (Ciancone_Regulatory.Kc)*K=((0.5-0.6)/(0.7-0.6))*((t0/(t0+Tau))-0.6)+0.6; |
---|
643 | (Ciancone_Regulatory.TauI)/(t0+Tau)=((0.605-0.65)/(0.7-0.6))*((t0/(t0+Tau))-0.6)+0.65; |
---|
644 | (Ciancone_Regulatory.TauD)/(t0+Tau)=0; |
---|
645 | else |
---|
646 | if (t0/(t0+Tau)) >= 0.5 then |
---|
647 | (Ciancone_Regulatory.Kc)*K=((0.6-0.9)/(0.6-0.5))*((t0/(t0+Tau))-0.5)+0.9; |
---|
648 | (Ciancone_Regulatory.TauI)/(t0+Tau)=((0.65-0.7)/(0.6-0.5))*((t0/(t0+Tau))-0.5)+0.7; |
---|
649 | (Ciancone_Regulatory.TauD)/(t0+Tau)=0; |
---|
650 | else |
---|
651 | if (t0/(t0+Tau)) >= 0.4 then |
---|
652 | (Ciancone_Regulatory.Kc)*K=((0.9-1.0)/(0.5-0.4))*((t0/(t0+Tau))-0.4)+1.0; |
---|
653 | (Ciancone_Regulatory.TauI)/(t0+Tau)=((0.7-0.75)/(0.5-0.4))*((t0/(t0+Tau))-0.4)+0.75; |
---|
654 | (Ciancone_Regulatory.TauD)/(t0+Tau)=0; |
---|
655 | else |
---|
656 | if (t0/(t0+Tau)) >= 0.3 then |
---|
657 | (Ciancone_Regulatory.Kc)*K=((1.0-1.13)/(0.4-0.3))*((t0/(t0+Tau))-0.3)+1.13; |
---|
658 | (Ciancone_Regulatory.TauI)/(t0+Tau)=((0.75-0.8)/(0.4-0.3))*((t0/(t0+Tau))-0.3)+0.8; |
---|
659 | (Ciancone_Regulatory.TauD)/(t0+Tau)=0; |
---|
660 | else |
---|
661 | if (t0/(t0+Tau)) >= 0.2 then |
---|
662 | (Ciancone_Regulatory.Kc)*K=((1.13-1.15)/(0.3-0.2))*((t0/(t0+Tau))-0.2)+1.15; |
---|
663 | (Ciancone_Regulatory.TauI)/(t0+Tau)=((0.8-0.52)/(0.3-0.2))*((t0/(t0+Tau))-0.2)+0.52; |
---|
664 | (Ciancone_Regulatory.TauD)/(t0+Tau)=0; |
---|
665 | else |
---|
666 | if (t0/(t0+Tau)) >= 0.1 then |
---|
667 | (Ciancone_Regulatory.Kc)*K=((1.15-1.1)/(0.2-0.1))*((t0/(t0+Tau))-0.1)+1.1; |
---|
668 | (Ciancone_Regulatory.TauI)/(t0+Tau)=((0.52-0.25)/(0.2-0.1))*((t0/(t0+Tau))-0.1)+0.25; |
---|
669 | (Ciancone_Regulatory.TauD)/(t0+Tau)=0; |
---|
670 | else |
---|
671 | (Ciancone_Regulatory.Kc)*K=1.1; |
---|
672 | (Ciancone_Regulatory.TauI)/(t0+Tau)=0.25; |
---|
673 | (Ciancone_Regulatory.TauD)/(t0+Tau)=0; |
---|
674 | end |
---|
675 | end |
---|
676 | end |
---|
677 | end |
---|
678 | end |
---|
679 | end |
---|
680 | end |
---|
681 | end |
---|
682 | end |
---|
683 | else |
---|
684 | Ciancone_Regulatory.Kc=0; |
---|
685 | Ciancone_Regulatory.TauI=0; |
---|
686 | Ciancone_Regulatory.TauD=0; |
---|
687 | end |
---|
688 | case "PID": |
---|
689 | if (t0/(t0+Tau)) <= 1.0 then |
---|
690 | if (t0/(t0+Tau)) >= 0.9 then |
---|
691 | (Ciancone_Regulatory.Kc)*K=((0.3-0.35)/(1.0-0.9))*((t0/(t0+Tau))-0.9)+0.35; |
---|
692 | (Ciancone_Regulatory.TauI)/(t0+Tau)=((0.42-0.46)/(1.0-0.9))*((t0/(t0+Tau))-0.9)+0.46; |
---|
693 | (Ciancone_Regulatory.TauD)/(t0+Tau)=((0.05-0.13)/(1.0-0.9))*((t0/(t0+Tau))-0.9)+0.13; |
---|
694 | else |
---|
695 | if (t0/(t0+Tau)) >= 0.8 then |
---|
696 | (Ciancone_Regulatory.Kc)*K=((0.35-0.45)/(0.9-0.8))*((t0/(t0+Tau))-0.8)+0.45; |
---|
697 | (Ciancone_Regulatory.TauI)/(t0+Tau)=((0.46-0.5)/(0.9-0.8))*((t0/(t0+Tau))-0.8)+0.5; |
---|
698 | (Ciancone_Regulatory.TauD)/(t0+Tau)=((0.13-0.2)/(0.9-0.8))*((t0/(t0+Tau))-0.8)+0.2; |
---|
699 | else |
---|
700 | if (t0/(t0+Tau)) >= 0.7 then |
---|
701 | (Ciancone_Regulatory.Kc)*K=((0.45-0.6)/(0.8-0.7))*((t0/(t0+Tau))-0.7)+0.6; |
---|
702 | (Ciancone_Regulatory.TauI)/(t0+Tau)=((0.5-0.55)/(0.8-0.7))*((t0/(t0+Tau))-0.7)+0.55; |
---|
703 | (Ciancone_Regulatory.TauD)/(t0+Tau)=((0.2-0.15)/(0.8-0.7))*((t0/(t0+Tau))-0.7)+0.15; |
---|
704 | else |
---|
705 | if (t0/(t0+Tau)) >= 0.6 then |
---|
706 | (Ciancone_Regulatory.Kc)*K=((0.6-0.7)/(0.7-0.6))*((t0/(t0+Tau))-0.6)+0.7; |
---|
707 | (Ciancone_Regulatory.TauI)/(t0+Tau)=((0.55-0.6)/(0.7-0.6))*((t0/(t0+Tau))-0.6)+0.6; |
---|
708 | (Ciancone_Regulatory.TauD)/(t0+Tau)=((0.15-0.1)/(0.7-0.6))*((t0/(t0+Tau))-0.6)+0.1; |
---|
709 | else |
---|
710 | if (t0/(t0+Tau)) >= 0.5 then |
---|
711 | (Ciancone_Regulatory.Kc)*K=((0.7-0.9)/(0.6-0.5))*((t0/(t0+Tau))-0.5)+0.9; |
---|
712 | (Ciancone_Regulatory.TauI)/(t0+Tau)=((0.6-0.65)/(0.6-0.5))*((t0/(t0+Tau))-0.5)+0.65; |
---|
713 | (Ciancone_Regulatory.TauD)/(t0+Tau)=((0.1-0.075)/(0.6-0.5))*((t0/(t0+Tau))-0.5)+0.075; |
---|
714 | else |
---|
715 | if (t0/(t0+Tau)) >= 0.4 then |
---|
716 | (Ciancone_Regulatory.Kc)*K=((0.9-1.05)/(0.5-0.4))*((t0/(t0+Tau))-0.4)+1.05; |
---|
717 | (Ciancone_Regulatory.TauI)/(t0+Tau)=((0.65-0.675)/(0.5-0.4))*((t0/(t0+Tau))-0.4)+0.675; |
---|
718 | (Ciancone_Regulatory.TauD)/(t0+Tau)=((0.075-0.05)/(0.5-0.4))*((t0/(t0+Tau))-0.4)+0.05; |
---|
719 | else |
---|
720 | if (t0/(t0+Tau)) >= 0.3 then |
---|
721 | (Ciancone_Regulatory.Kc)*K=((1.05-1.1)/(0.4-0.3))*((t0/(t0+Tau))-0.3)+1.1; |
---|
722 | (Ciancone_Regulatory.TauI)/(t0+Tau)=((0.675-0.7)/(0.4-0.3))*((t0/(t0+Tau))-0.3)+0.7; |
---|
723 | (Ciancone_Regulatory.TauD)/(t0+Tau)=((0.05-0.02)/(0.4-0.3))*((t0/(t0+Tau))-0.3)+0.02; |
---|
724 | else |
---|
725 | if (t0/(t0+Tau)) >= 0.2 then |
---|
726 | (Ciancone_Regulatory.Kc)*K=((1.1-1.2)/(0.3-0.2))*((t0/(t0+Tau))-0.2)+1.2; |
---|
727 | (Ciancone_Regulatory.TauI)/(t0+Tau)=((0.7-0.52)/(0.3-0.2))*((t0/(t0+Tau))-0.2)+0.52; |
---|
728 | (Ciancone_Regulatory.TauD)/(t0+Tau)=((0.02-0.0)/(0.3-0.2))*((t0/(t0+Tau))-0.2)+0; |
---|
729 | else |
---|
730 | if (t0/(t0+Tau)) >= 0.1 then |
---|
731 | (Ciancone_Regulatory.Kc)*K=((1.2-1.1)/(0.2-0.1))*((t0/(t0+Tau))-0.1)+1.1; |
---|
732 | (Ciancone_Regulatory.TauI)/(t0+Tau)=((0.52-0.25)/(0.2-0.1))*((t0/(t0+Tau))-0.1)+0.25; |
---|
733 | (Ciancone_Regulatory.TauD)/(t0+Tau)=0; |
---|
734 | else |
---|
735 | (Ciancone_Regulatory.Kc)*K=1.1; |
---|
736 | (Ciancone_Regulatory.TauI)/(t0+Tau)=0.25; |
---|
737 | (Ciancone_Regulatory.TauD)/(t0+Tau)=0; |
---|
738 | end |
---|
739 | end |
---|
740 | end |
---|
741 | end |
---|
742 | end |
---|
743 | end |
---|
744 | end |
---|
745 | end |
---|
746 | end |
---|
747 | else |
---|
748 | Ciancone_Regulatory.Kc=0; |
---|
749 | Ciancone_Regulatory.TauI=0; |
---|
750 | Ciancone_Regulatory.TauD=0; |
---|
751 | end |
---|
752 | end |
---|
753 | |
---|
754 | |
---|
755 | # ******************************************************* |
---|
756 | # ** 2.8 CIANCONE (SERVO): TUNING RULES BY CORRELATION ** |
---|
757 | # ******************************************************* |
---|
758 | switch Controller_Type |
---|
759 | case "P": |
---|
760 | Ciancone_Servo.Kc=0; |
---|
761 | Ciancone_Servo.TauI=0; |
---|
762 | Ciancone_Servo.TauD=0; |
---|
763 | case "PI": |
---|
764 | if (t0/(t0+Tau)) <= 1.0 then |
---|
765 | if (t0/(t0+Tau)) >= 0.9 then |
---|
766 | (Ciancone_Servo.Kc)*K=((0.63-0.65)/(1.0-0.9))*((t0/(t0+Tau))-0.9)+0.65; |
---|
767 | (Ciancone_Servo.TauI)/(t0+Tau)=((0.43-0.45)/(1.0-0.9))*((t0/(t0+Tau))-0.9)+0.45; |
---|
768 | (Ciancone_Servo.TauD)/(t0+Tau)=0; |
---|
769 | else |
---|
770 | if (t0/(t0+Tau)) >= 0.8 then |
---|
771 | (Ciancone_Servo.Kc)*K=0.65; |
---|
772 | (Ciancone_Servo.TauI)/(t0+Tau)=((0.45-0.5)/(0.9-0.8))*((t0/(t0+Tau))-0.8)+0.5; |
---|
773 | (Ciancone_Servo.TauD)/(t0+Tau)=0; |
---|
774 | else |
---|
775 | if (t0/(t0+Tau)) >= 0.7 then |
---|
776 | (Ciancone_Servo.Kc)*K=0.65; |
---|
777 | (Ciancone_Servo.TauI)/(t0+Tau)=((0.5-0.57)/(0.8-0.7))*((t0/(t0+Tau))-0.7)+0.57; |
---|
778 | (Ciancone_Servo.TauD)/(t0+Tau)=0; |
---|
779 | else |
---|
780 | if (t0/(t0+Tau)) >= 0.6 then |
---|
781 | (Ciancone_Servo.Kc)*K=((0.65-0.7)/(0.7-0.6))*((t0/(t0+Tau))-0.6)+0.7; |
---|
782 | (Ciancone_Servo.TauI)/(t0+Tau)=((0.57-0.64)/(0.7-0.6))*((t0/(t0+Tau))-0.6)+0.64; |
---|
783 | (Ciancone_Servo.TauD)/(t0+Tau)=0; |
---|
784 | else |
---|
785 | if (t0/(t0+Tau)) >= 0.5 then |
---|
786 | (Ciancone_Servo.Kc)*K=((0.7-0.85)/(0.6-0.5))*((t0/(t0+Tau))-0.5)+0.85; |
---|
787 | (Ciancone_Servo.TauI)/(t0+Tau)=((0.64-0.7)/(0.6-0.5))*((t0/(t0+Tau))-0.5)+0.7; |
---|
788 | (Ciancone_Servo.TauD)/(t0+Tau)=0; |
---|
789 | else |
---|
790 | if (t0/(t0+Tau)) >= 0.4 then |
---|
791 | (Ciancone_Servo.Kc)*K=((0.85-0.9)/(0.5-0.4))*((t0/(t0+Tau))-0.4)+0.9; |
---|
792 | (Ciancone_Servo.TauI)/(t0+Tau)=((0.7-0.78)/(0.5-0.4))*((t0/(t0+Tau))-0.4)+0.78; |
---|
793 | (Ciancone_Servo.TauD)/(t0+Tau)=0; |
---|
794 | else |
---|
795 | if (t0/(t0+Tau)) >= 0.3 then |
---|
796 | (Ciancone_Servo.Kc)*K=((0.9-1.0)/(0.4-0.3))*((t0/(t0+Tau))-0.3)+1.0; |
---|
797 | (Ciancone_Servo.TauI)/(t0+Tau)=((0.78-0.86)/(0.4-0.3))*((t0/(t0+Tau))-0.3)+0.86; |
---|
798 | (Ciancone_Servo.TauD)/(t0+Tau)=0; |
---|
799 | else |
---|
800 | if (t0/(t0+Tau)) >= 0.2 then |
---|
801 | (Ciancone_Servo.Kc)*K=((1.0-1.05)/(0.3-0.2))*((t0/(t0+Tau))-0.2)+1.05; |
---|
802 | (Ciancone_Servo.TauI)/(t0+Tau)=((0.86-0.95)/(0.3-0.2))*((t0/(t0+Tau))-0.2)+0.95; |
---|
803 | (Ciancone_Servo.TauD)/(t0+Tau)=0; |
---|
804 | else |
---|
805 | if (t0/(t0+Tau)) >= 0.1 then |
---|
806 | (Ciancone_Servo.Kc)*K=((1.05-1.1)/(0.2-0.1))*((t0/(t0+Tau))-0.1)+1.1; |
---|
807 | (Ciancone_Servo.TauI)/(t0+Tau)=((0.95-0.75)/(0.2-0.1))*((t0/(t0+Tau))-0.1)+0.55; |
---|
808 | (Ciancone_Servo.TauD)/(t0+Tau)=0; |
---|
809 | else |
---|
810 | (Ciancone_Servo.Kc)*K=1.1; |
---|
811 | (Ciancone_Servo.TauI)/(t0+Tau)=0.75; |
---|
812 | (Ciancone_Servo.TauD)/(t0+Tau)=0; |
---|
813 | end |
---|
814 | end |
---|
815 | end |
---|
816 | end |
---|
817 | end |
---|
818 | end |
---|
819 | end |
---|
820 | end |
---|
821 | end |
---|
822 | else |
---|
823 | Ciancone_Servo.Kc=0; |
---|
824 | Ciancone_Servo.TauI=0; |
---|
825 | Ciancone_Servo.TauD=0; |
---|
826 | end |
---|
827 | case "PID": |
---|
828 | if (t0/(t0+Tau)) <= 1.0 then |
---|
829 | if (t0/(t0+Tau)) >= 0.9 then |
---|
830 | (Ciancone_Servo.Kc)*K=0.36; |
---|
831 | (Ciancone_Servo.TauI)/(t0+Tau)=((0.42-0.46)/(1.0-0.9))*((t0/(t0+Tau))-0.9)+0.46; |
---|
832 | (Ciancone_Servo.TauD)/(t0+Tau)=((0.04-0.14)/(1.0-0.9))*((t0/(t0+Tau))-0.9)+0.14; |
---|
833 | else |
---|
834 | if (t0/(t0+Tau)) >= 0.8 then |
---|
835 | (Ciancone_Servo.Kc)*K=((0.36-0.4)/(0.9-0.8))*((t0/(t0+Tau))-0.8)+0.4; |
---|
836 | (Ciancone_Servo.TauI)/(t0+Tau)=((0.46-0.5)/(0.9-0.8))*((t0/(t0+Tau))-0.8)+0.5; |
---|
837 | (Ciancone_Servo.TauD)/(t0+Tau)=((0.14-0.22)/(0.9-0.8))*((t0/(t0+Tau))-0.8)+0.22; |
---|
838 | else |
---|
839 | if (t0/(t0+Tau)) >= 0.7 then |
---|
840 | (Ciancone_Servo.Kc)*K=((0.4-0.5)/(0.8-0.7))*((t0/(t0+Tau))-0.7)+0.5; |
---|
841 | (Ciancone_Servo.TauI)/(t0+Tau)=((0.5-0.55)/(0.8-0.7))*((t0/(t0+Tau))-0.7)+0.55; |
---|
842 | (Ciancone_Servo.TauD)/(t0+Tau)=((0.22-0.16)/(0.8-0.7))*((t0/(t0+Tau))-0.7)+0.16; |
---|
843 | else |
---|
844 | if (t0/(t0+Tau)) >= 0.6 then |
---|
845 | (Ciancone_Servo.Kc)*K=((0.5-0.6)/(0.7-0.6))*((t0/(t0+Tau))-0.6)+0.6; |
---|
846 | (Ciancone_Servo.TauI)/(t0+Tau)=((0.55-0.6)/(0.7-0.6))*((t0/(t0+Tau))-0.6)+0.6; |
---|
847 | (Ciancone_Servo.TauD)/(t0+Tau)=((0.16-0.12)/(0.7-0.6))*((t0/(t0+Tau))-0.6)+0.12; |
---|
848 | else |
---|
849 | if (t0/(t0+Tau)) >= 0.5 then |
---|
850 | (Ciancone_Servo.Kc)*K=((0.6-0.7)/(0.6-0.5))*((t0/(t0+Tau))-0.5)+0.7; |
---|
851 | (Ciancone_Servo.TauI)/(t0+Tau)=((0.6-0.68)/(0.6-0.5))*((t0/(t0+Tau))-0.5)+0.68; |
---|
852 | (Ciancone_Servo.TauD)/(t0+Tau)=((0.12-0.08)/(0.6-0.5))*((t0/(t0+Tau))-0.5)+0.08; |
---|
853 | else |
---|
854 | if (t0/(t0+Tau)) >= 0.4 then |
---|
855 | (Ciancone_Servo.Kc)*K=((0.7-0.9)/(0.5-0.4))*((t0/(t0+Tau))-0.4)+0.9; |
---|
856 | (Ciancone_Servo.TauI)/(t0+Tau)=((0.68-0.8)/(0.5-0.4))*((t0/(t0+Tau))-0.4)+0.8; |
---|
857 | (Ciancone_Servo.TauD)/(t0+Tau)=((0.08-0.06)/(0.5-0.4))*((t0/(t0+Tau))-0.4)+0.06; |
---|
858 | else |
---|
859 | if (t0/(t0+Tau)) >= 0.3 then |
---|
860 | (Ciancone_Servo.Kc)*K=((0.9-1.04)/(0.4-0.3))*((t0/(t0+Tau))-0.3)+1.04; |
---|
861 | (Ciancone_Servo.TauI)/(t0+Tau)=((0.8-0.87)/(0.4-0.3))*((t0/(t0+Tau))-0.3)+0.87; |
---|
862 | (Ciancone_Servo.TauD)/(t0+Tau)=((0.06-0.04)/(0.4-0.3))*((t0/(t0+Tau))-0.3)+0.04; |
---|
863 | else |
---|
864 | if (t0/(t0+Tau)) >= 0.2 then |
---|
865 | (Ciancone_Servo.Kc)*K=((1.04-1.07)/(0.3-0.2))*((t0/(t0+Tau))-0.2)+1.07; |
---|
866 | (Ciancone_Servo.TauI)/(t0+Tau)=((0.87-0.94)/(0.3-0.2))*((t0/(t0+Tau))-0.2)+0.94; |
---|
867 | (Ciancone_Servo.TauD)/(t0+Tau)=((0.04-0.02)/(0.3-0.2))*((t0/(t0+Tau))-0.2)+0.02; |
---|
868 | else |
---|
869 | if (t0/(t0+Tau)) >= 0.1 then |
---|
870 | (Ciancone_Servo.Kc)*K=((1.07-1.1)/(0.2-0.1))*((t0/(t0+Tau))-0.1)+1.1; |
---|
871 | (Ciancone_Servo.TauI)/(t0+Tau)=((0.94-0.74)/(0.2-0.1))*((t0/(t0+Tau))-0.1)+0.74; |
---|
872 | (Ciancone_Servo.TauD)/(t0+Tau)=((0.02-0.0)/(0.2-0.1))*((t0/(t0+Tau))-0.1)+0.0; |
---|
873 | else |
---|
874 | (Ciancone_Servo.Kc)*K=1.1; |
---|
875 | (Ciancone_Servo.TauI)/(t0+Tau)=0.74; |
---|
876 | (Ciancone_Servo.TauD)/(t0+Tau)=0; |
---|
877 | end |
---|
878 | end |
---|
879 | end |
---|
880 | end |
---|
881 | end |
---|
882 | end |
---|
883 | end |
---|
884 | end |
---|
885 | end |
---|
886 | else |
---|
887 | Ciancone_Servo.Kc=0; |
---|
888 | Ciancone_Servo.TauI=0; |
---|
889 | Ciancone_Servo.TauD=0; |
---|
890 | end |
---|
891 | end |
---|
892 | |
---|
893 | end |
---|
894 | |
---|
895 | Model TunedController |
---|
896 | |
---|
897 | VARIABLES |
---|
898 | |
---|
899 | Kc as Real(Brief="Controller Gain",Protected=true); |
---|
900 | TauI as Real(Brief="Controller Integral Time",Protected=true); |
---|
901 | TauD as Real(Brief="Controller Derivative Time",Protected=true); |
---|
902 | PB as Real(Brief="Controller Proportional Band",Protected=true); |
---|
903 | TauI_R as Real(Brief="Controller reset rate",Protected=true); |
---|
904 | |
---|
905 | |
---|
906 | EQUATIONS |
---|
907 | |
---|
908 | if Kc>0 then |
---|
909 | PB=100/Kc; |
---|
910 | else |
---|
911 | PB=0; |
---|
912 | end |
---|
913 | |
---|
914 | if TauI>0 then |
---|
915 | TauI_R=1/TauI; |
---|
916 | else |
---|
917 | TauI_R=0; |
---|
918 | end |
---|
919 | |
---|
920 | end |
---|