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 Copyright (C) 2004 - 2007 ALSOC, original code |
---|
9 | * from http://www.rps.eng.br Copyright (C) 2002-2004. |
---|
10 | * All rights reserved. |
---|
11 | * |
---|
12 | * EMSO is distributed under the therms of the ALSOC LICENSE as |
---|
13 | * available at http://www.enq.ufrgs.br/alsoc. |
---|
14 | * |
---|
15 | * |
---|
16 | *------------------------------------------------------------------- |
---|
17 | * Sample file for tanks level control |
---|
18 | * |
---|
19 | *------------------------------------------------------------------- |
---|
20 | * Author: Tiago Osório |
---|
21 | * $Id: sample_tanks_pid.mso 114 2007-01-15 14:20:51Z rafael $ |
---|
22 | *-----------------------------------------------------------------*# |
---|
23 | |
---|
24 | using "stage_separators/tank"; |
---|
25 | using "controllers/PIDs"; |
---|
26 | using "controllers/PIDIncr"; |
---|
27 | |
---|
28 | |
---|
29 | FlowSheet Tanque_inc |
---|
30 | DEVICES |
---|
31 | Tanque1 as tank_cylindrical; |
---|
32 | PID as PIDIncr_Ideal_AWBT; |
---|
33 | |
---|
34 | PARAMETERS |
---|
35 | h_max as Real (Brief="Altura máxima do nível do tanque", Unit="m"); |
---|
36 | h_min as Real (Brief="Altura mínima do nível do tanque", Unit="m"); |
---|
37 | |
---|
38 | VARIABLES |
---|
39 | h_ad as Real (Brief="Altura adimensional do nível do tanque", Lower=0,Upper=1); |
---|
40 | Qin as heat_rate; |
---|
41 | |
---|
42 | CONNECTIONS |
---|
43 | Qin to Tanque1.Q; |
---|
44 | |
---|
45 | SET |
---|
46 | Tanque1.radius = 1.1 * "m"; |
---|
47 | Tanque1.L = 6 * "m"; |
---|
48 | h_max = 2 * "m"; |
---|
49 | h_min = 0 * "m"; |
---|
50 | |
---|
51 | EQUATIONS |
---|
52 | PID.Parameters.tau = 1*"s"; |
---|
53 | PID.Parameters.tauSet = 1*"s"; |
---|
54 | PID.Parameters.alpha = 0.3; |
---|
55 | PID.Parameters.bias = 0; |
---|
56 | PID.Parameters.gamma = 1; |
---|
57 | PID.Parameters.beta = 1; |
---|
58 | PID.Options.action = -1; |
---|
59 | PID.Options.clip=1; |
---|
60 | PID.Options.autoMan = 0; |
---|
61 | PID.Parameters.intTime=5000*"s"; |
---|
62 | PID.Parameters.gain = 3.5; |
---|
63 | PID.Parameters.derivTime=1*"s"; |
---|
64 | PID.Ports.input = h_ad; |
---|
65 | h_ad = (Tanque1.Level-h_min)/(h_max-h_min); |
---|
66 | Tanque1.Outlet = 8*"m^3/h"*PID.Ports.output; |
---|
67 | |
---|
68 | #Perturbação servo |
---|
69 | #Nível desejado=1*"m" |
---|
70 | PID.Ports.setPoint=0.5; |
---|
71 | |
---|
72 | #Perturbação regulatória |
---|
73 | if time<10*"h" then |
---|
74 | Tanque1.Inlet= 3*"m^3/h"; |
---|
75 | else |
---|
76 | Tanque1.Inlet= 1.5*"m^3/h"; |
---|
77 | end |
---|
78 | |
---|
79 | Tanque1.Q = 0 * "J/s"; |
---|
80 | |
---|
81 | INITIAL |
---|
82 | "altura inicial" |
---|
83 | Tanque1.Level = 0.2 * "m"; |
---|
84 | |
---|
85 | OPTIONS |
---|
86 | DAESolver = "dassl"; |
---|
87 | time = [0:0.1:30] * "h" ; |
---|
88 | end |
---|
89 | |
---|
90 | FlowSheet Tanque |
---|
91 | DEVICES |
---|
92 | Tanque1 as tank; |
---|
93 | PID as PID_Ideal_AWBT; |
---|
94 | |
---|
95 | PARAMETERS |
---|
96 | h_max as Real (Brief="Altura máxima do nível do tanque", Unit="m"); |
---|
97 | h_min as Real (Brief="Altura mínima do nível do tanque", Unit="m"); |
---|
98 | |
---|
99 | VARIABLES |
---|
100 | h_ad as Real (Brief="Altura adimensional do nível do tanque", Lower=0,Upper=1); |
---|
101 | |
---|
102 | CONNECTIONS |
---|
103 | |
---|
104 | SET |
---|
105 | Tanque1.A = 8 * "m^2"; |
---|
106 | h_max = 2 * "m"; |
---|
107 | h_min = 0 * "m"; |
---|
108 | |
---|
109 | EQUATIONS |
---|
110 | PID.Parameters.tau = 1*"s"; |
---|
111 | PID.Parameters.tauSet = 1*"s"; |
---|
112 | PID.Parameters.alpha = 0.3; |
---|
113 | PID.Parameters.bias = 0; |
---|
114 | PID.Parameters.gamma = 1; |
---|
115 | PID.Parameters.beta = 1; |
---|
116 | PID.Parameters.intTime=5000*"s"; |
---|
117 | PID.Parameters.gain =3.5; |
---|
118 | PID.Parameters.derivTime=1*"s"; |
---|
119 | PID.Options.action = -1; |
---|
120 | PID.Options.clip=1; |
---|
121 | PID.Options.autoMan = 0; |
---|
122 | PID.Ports.input = h_ad; |
---|
123 | h_ad = (Tanque1.h-h_min)/(h_max-h_min); |
---|
124 | Tanque1.k = 8*"m^2.5/h"*PID.Ports.output; |
---|
125 | |
---|
126 | #Perturbação servo |
---|
127 | #Nível desejado=1*"m" |
---|
128 | PID.Ports.setPoint=0.5; |
---|
129 | |
---|
130 | #Perturbação regulatória |
---|
131 | if time<10*"h" then |
---|
132 | Tanque1.Fin= 3*"m^3/h"; |
---|
133 | else |
---|
134 | Tanque1.Fin= 1.5*"m^3/h"; |
---|
135 | end |
---|
136 | |
---|
137 | INITIAL |
---|
138 | "altura inicial" |
---|
139 | Tanque1.h = 0.2 * "m"; |
---|
140 | |
---|
141 | OPTIONS |
---|
142 | NLASolver = "sundials"; |
---|
143 | time = [0:0.1:30] * "h" ; |
---|
144 | end |
---|
145 | |
---|
146 | |
---|
147 | |
---|