1 | #*--------------------------------------------------------------------- |
---|
2 | * This file is property of the author and cannot be used, copyed |
---|
3 | * or modified without permission. |
---|
4 | * |
---|
5 | * Copyright (C) 2002-2004 the author |
---|
6 | *---------------------------------------------------------------------- |
---|
7 | * Author: Tiago Osório |
---|
8 | * $Id: sample_tanks_pid.mso 17 2006-08-27 20:29:11Z rafael $ |
---|
9 | *---------------------------------------------------------------------- |
---|
10 | * |
---|
11 | * Arquivo de exemplo do EMSO |
---|
12 | * |
---|
13 | * Controle de nível de tanques. |
---|
14 | * |
---|
15 | *-------------------------------------------------------------------*# |
---|
16 | |
---|
17 | using "tanksmodel"; |
---|
18 | using "controllers/PIDs"; |
---|
19 | using "controllers/PIDIncr"; |
---|
20 | |
---|
21 | |
---|
22 | FlowSheet Tanque_inc |
---|
23 | DEVICES |
---|
24 | Tanque1 as tank; |
---|
25 | PID as PIDIncr_Ideal_AWBT; |
---|
26 | |
---|
27 | PARAMETERS |
---|
28 | h_max as Real (Brief="Altura máxima do nível do tanque", Unit="m"); |
---|
29 | h_min as Real (Brief="Altura mínima do nível do tanque", Unit="m"); |
---|
30 | |
---|
31 | VARIABLES |
---|
32 | h_ad as Real (Brief="Altura adimensional do nível do tanque", Lower=0,Upper=1); |
---|
33 | |
---|
34 | CONNECTIONS |
---|
35 | |
---|
36 | SET |
---|
37 | Tanque1.A = 8 * "m^2"; |
---|
38 | h_max = 2 * "m"; |
---|
39 | h_min = 0 * "m"; |
---|
40 | |
---|
41 | EQUATIONS |
---|
42 | PID.Parameters.tau = 1*"s"; |
---|
43 | PID.Parameters.tauSet = 1*"s"; |
---|
44 | PID.Parameters.alpha = 0.3; |
---|
45 | PID.Parameters.bias = 0; |
---|
46 | PID.Parameters.gamma = 1; |
---|
47 | PID.Parameters.beta = 1; |
---|
48 | PID.Options.action = -1; |
---|
49 | PID.Options.clip=1; |
---|
50 | PID.Options.autoMan = 0; |
---|
51 | PID.Parameters.intTime=5000*"s"; |
---|
52 | PID.Parameters.gain = 3.5; |
---|
53 | PID.Parameters.derivTime=1*"s"; |
---|
54 | PID.Ports.input = h_ad; |
---|
55 | h_ad = (Tanque1.h-h_min)/(h_max-h_min); |
---|
56 | Tanque1.k = 8*"m^2.5/h"*PID.Ports.output; |
---|
57 | |
---|
58 | #Perturbação servo |
---|
59 | #Nível desejado=1*"m" |
---|
60 | PID.Ports.setPoint=0.5; |
---|
61 | |
---|
62 | #Perturbação regulatória |
---|
63 | if time<10*"h" |
---|
64 | Tanque1.Fin= 3*"m^3/h"; |
---|
65 | else |
---|
66 | Tanque1.Fin= 1.5*"m^3/h"; |
---|
67 | end |
---|
68 | |
---|
69 | INITIAL |
---|
70 | "altura inicial" |
---|
71 | Tanque1.h = 0.2 * "m"; |
---|
72 | |
---|
73 | OPTIONS |
---|
74 | time = [0:0.1:30] * "h" ; |
---|
75 | outputLevel = "medium"; |
---|
76 | end |
---|
77 | |
---|
78 | FlowSheet Tanque |
---|
79 | DEVICES |
---|
80 | Tanque1 as tank; |
---|
81 | PID as PID_Ideal_AWBT; |
---|
82 | |
---|
83 | PARAMETERS |
---|
84 | h_max as Real (Brief="Altura máxima do nível do tanque", Unit="m"); |
---|
85 | h_min as Real (Brief="Altura mínima do nível do tanque", Unit="m"); |
---|
86 | |
---|
87 | VARIABLES |
---|
88 | h_ad as Real (Brief="Altura adimensional do nível do tanque", Lower=0,Upper=1); |
---|
89 | |
---|
90 | CONNECTIONS |
---|
91 | |
---|
92 | SET |
---|
93 | Tanque1.A = 8 * "m^2"; |
---|
94 | h_max = 2 * "m"; |
---|
95 | h_min = 0 * "m"; |
---|
96 | |
---|
97 | EQUATIONS |
---|
98 | PID.Parameters.tau = 1*"s"; |
---|
99 | PID.Parameters.tauSet = 1*"s"; |
---|
100 | PID.Parameters.alpha = 0.3; |
---|
101 | PID.Parameters.bias = 0; |
---|
102 | PID.Parameters.gamma = 1; |
---|
103 | PID.Parameters.beta = 1; |
---|
104 | PID.Parameters.intTime=5000*"s"; |
---|
105 | PID.Parameters.gain =3.5; |
---|
106 | PID.Parameters.derivTime=1*"s"; |
---|
107 | PID.Options.action = -1; |
---|
108 | PID.Options.clip=1; |
---|
109 | PID.Options.autoMan = 0; |
---|
110 | PID.Ports.input = h_ad; |
---|
111 | h_ad = (Tanque1.h-h_min)/(h_max-h_min); |
---|
112 | Tanque1.k = 8*"m^2.5/h"*PID.Ports.output; |
---|
113 | |
---|
114 | #Perturbação servo |
---|
115 | #Nível desejado=1*"m" |
---|
116 | PID.Ports.setPoint=0.5; |
---|
117 | |
---|
118 | #Perturbação regulatória |
---|
119 | if time<10*"h" |
---|
120 | Tanque1.Fin= 3*"m^3/h"; |
---|
121 | else |
---|
122 | Tanque1.Fin= 1.5*"m^3/h"; |
---|
123 | end |
---|
124 | |
---|
125 | INITIAL |
---|
126 | "altura inicial" |
---|
127 | Tanque1.h = 0.2 * "m"; |
---|
128 | |
---|
129 | OPTIONS |
---|
130 | time = [0:0.1:30] * "h" ; |
---|
131 | outputLevel = "medium"; |
---|
132 | end |
---|
133 | |
---|
134 | |
---|
135 | |
---|