1 | #*------------------------------------------------------------------- |
---|
2 | * Biorrefinaria Petrobras |
---|
3 | *-------------------------------------------------------------------- |
---|
4 | * Nome do arquivo: flash_m.mso |
---|
5 | * Projeto: Modelo integrado de producao de etanol 1G/2G |
---|
6 | * Conteudo: tanque flash |
---|
7 | *--------------------------------------------------------------------*# |
---|
8 | |
---|
9 | #*------------------------------------------------------------------- |
---|
10 | * |
---|
11 | * Versao 2.2 |
---|
12 | * Data: 03/2016 |
---|
13 | * Autores: Anderson R. A. Lino e Gabriel C. Fonseca |
---|
14 | * |
---|
15 | *-------------------------------------------------------------------- |
---|
16 | *Descricao: modelo do tanque flash que sera empregado na biorrefinaria |
---|
17 | *-------------------------------------------------------------------- |
---|
18 | |
---|
19 | *-------------------------------------------------------------------- |
---|
20 | *Hipoteses assumidas: 1 - mistura perfeita em ambas as fases |
---|
21 | * 2 - equilibrio termodinamico |
---|
22 | * 3 - modelo estatico |
---|
23 | *-------------------------------------------------------------------- |
---|
24 | |
---|
25 | *-------------------------------------------------------------------- |
---|
26 | *Notas: Foi feito o flowsheet teste para averiguar o modelo. Dependendo |
---|
27 | * das especificacoes, o flash pode funcionar como um evaporador tambem |
---|
28 | *--------------------------------------------------------------------*# |
---|
29 | |
---|
30 | using "main_stream"; |
---|
31 | using "energy_stream"; |
---|
32 | |
---|
33 | Model flash_steady |
---|
34 | |
---|
35 | ATTRIBUTES |
---|
36 | Pallete = false; |
---|
37 | Icon = "icon/flash"; |
---|
38 | Brief = "Flash with 2 Outlet Streams"; |
---|
39 | Info = |
---|
40 | "== GENERAL == |
---|
41 | Model of a steady-state flash tank. |
---|
42 | |
---|
43 | == ASSUMPTIONS == |
---|
44 | * Both phases are perfectly mixed; |
---|
45 | * No solid is dragged in the vapour outlet stream. |
---|
46 | |
---|
47 | == SPECIFY == |
---|
48 | * The inlet stream: |
---|
49 | flow rate |
---|
50 | temperature |
---|
51 | pressure |
---|
52 | stream composition; |
---|
53 | * The pressure Drop (Pdrop); |
---|
54 | * The outlet temperature OR the heat supplied. |
---|
55 | "; |
---|
56 | |
---|
57 | #*------------------------------------------------------------------- |
---|
58 | #Parametros |
---|
59 | *--------------------------------------------------------------------*# |
---|
60 | |
---|
61 | PARAMETERS |
---|
62 | |
---|
63 | outer PP as Plugin (Brief = "External Physical Properties (Fluid Phase)", Type="PP"); |
---|
64 | outer PPS as Plugin (Brief = "External Physical Properties (Solid Phase)", Type="PP"); |
---|
65 | outer NComp as Integer (Brief = "Number of Chemical Components for the Fluid Phase", Lower = 1); |
---|
66 | outer NCompS as Integer (Brief = "Number of Chemical Components for the Solid Phase", Lower = 1); |
---|
67 | |
---|
68 | #*------------------------------------------------------------------- |
---|
69 | * Declaracao de variaveis |
---|
70 | *--------------------------------------------------------------------*# |
---|
71 | |
---|
72 | VARIABLES |
---|
73 | |
---|
74 | in Inlet as main_stream (Brief="Feed Stream", PosX=0, PosY=0.48, Protected = false, Symbol="_{in}"); |
---|
75 | out OutletL as main_stream_eq (Brief="Liquid Outlet Stream", PosX=1, PosY=0.99, Protected = false, Symbol="_{outLiquid}"); |
---|
76 | out OutletV as main_stream_eq (Brief="Vapour Outlet Stream", PosX=1, PosY=0.01, Protected = false, Symbol="_{outVapour}"); |
---|
77 | Q as power (Brief="Heat Duty", Protected = true, Symbol="_{in}"); |
---|
78 | |
---|
79 | vfrac as fraction (Brief = "Vaporization Fraction", Symbol="\phi", Protected =true); |
---|
80 | h as enth_mol (Brief = "Mixture Molar Enthalpy", Hidden =true); |
---|
81 | Pratio as positive (Brief = "Pressure Ratio", Symbol ="P_{ratio}", Protected =true); |
---|
82 | Pdrop as press_delta (Brief = "Pressure Drop", DisplayUnit = 'kPa', Symbol ="\Delta P", Protected =true); |
---|
83 | |
---|
84 | SET |
---|
85 | OutletL.Phase = "Liquid"; |
---|
86 | OutletV.Phase = "Vapour"; |
---|
87 | |
---|
88 | #*------------------------------------------------------------------- |
---|
89 | * Equacoes do modelo |
---|
90 | *--------------------------------------------------------------------*# |
---|
91 | |
---|
92 | EQUATIONS |
---|
93 | |
---|
94 | if vfrac > 0 and vfrac <1 then |
---|
95 | "The Flash Calculation" |
---|
96 | [vfrac, OutletL.Fluid.z, OutletV.Fluid.z] = |
---|
97 | PP.Flash(OutletV.T, OutletV.P, Inlet.Fluid.z); |
---|
98 | else |
---|
99 | "Chemical Equilibrium" |
---|
100 | [vfrac, OutletL.Fluid.z, OutletV.Fluid.z] = |
---|
101 | PP.FlashPH(OutletL.P,h,Inlet.Fluid.z); |
---|
102 | end |
---|
103 | |
---|
104 | "Global Molar Balance (Fluid Phase)" |
---|
105 | Inlet.Fluid.F = OutletV.Fluid.F + OutletL.Fluid.F; |
---|
106 | |
---|
107 | "No Solid in the Vapour Phase" |
---|
108 | OutletV.Solid.F = 1e-6 * 'kmol/h'; |
---|
109 | |
---|
110 | "Vapour Composition (Solid Phase)" |
---|
111 | OutletV.Solid.z = Inlet.Solid.z; |
---|
112 | |
---|
113 | "Global Molar Balance (Solid Phase)" |
---|
114 | Inlet.Solid.F = OutletL.Solid.F; |
---|
115 | |
---|
116 | for i in [1:NCompS] do |
---|
117 | "Component Molar Balance (Solid Phase)" |
---|
118 | Inlet.Solid.F * Inlet.Solid.z(i) = OutletL.Solid.F * OutletL.Solid.z(i); |
---|
119 | end |
---|
120 | |
---|
121 | "Vapour Fraction" |
---|
122 | OutletV.Fluid.F = Inlet.Fluid.F * vfrac; |
---|
123 | |
---|
124 | "Energy Balance" |
---|
125 | Inlet.Fluid.F*(h - Inlet.Fluid.h) = Q; |
---|
126 | |
---|
127 | "Mixture Molar Enthalpy" |
---|
128 | h = (1-vfrac)*OutletL.Fluid.h + vfrac*OutletV.Fluid.h; |
---|
129 | |
---|
130 | "Thermal Equilibrium" |
---|
131 | OutletV.T = OutletL.T; |
---|
132 | |
---|
133 | "Mechanical Equilibrium" |
---|
134 | OutletV.P = OutletL.P; |
---|
135 | |
---|
136 | "Pressure Drop" |
---|
137 | OutletL.P = Inlet.P - Pdrop; |
---|
138 | |
---|
139 | "Pressure Ratio" |
---|
140 | OutletL.P = Inlet.P * Pratio; |
---|
141 | |
---|
142 | end |
---|
143 | |
---|
144 | Model endo_flash as flash_steady |
---|
145 | ATTRIBUTES |
---|
146 | Pallete = true; |
---|
147 | Icon = "icon/flash"; |
---|
148 | Brief = "Flash with 2 Outlet Streams"; |
---|
149 | Info = |
---|
150 | "== GENERAL == |
---|
151 | Model of a steady-state flash tank. |
---|
152 | |
---|
153 | == ASSUMPTIONS == |
---|
154 | * Both phases are perfectly mixed; |
---|
155 | * No solid is dragged in the vapour outlet stream. |
---|
156 | |
---|
157 | == SPECIFY == |
---|
158 | * The inlet stream: |
---|
159 | flow rate |
---|
160 | temperature |
---|
161 | pressure |
---|
162 | stream composition; |
---|
163 | * The pressure Drop (Pdrop); |
---|
164 | * The outlet temperature OR the heat supplied. |
---|
165 | "; |
---|
166 | |
---|
167 | VARIABLES |
---|
168 | in Inlet_q as heat_stream (Brief = "Inlet Heat Stream", PosX=0, PosY=0.81, Symbol="Q_{in}"); |
---|
169 | |
---|
170 | EQUATIONS |
---|
171 | "Equate Heat Stream" |
---|
172 | Inlet_q.Q = Q; |
---|
173 | |
---|
174 | end |
---|
175 | |
---|
176 | Model exo_flash as flash_steady |
---|
177 | ATTRIBUTES |
---|
178 | Pallete = true; |
---|
179 | Icon = "icon/flash"; |
---|
180 | Brief = "Flash with 2 Outlet Streams"; |
---|
181 | Info = |
---|
182 | "== GENERAL == |
---|
183 | Model of a steady-state flash tank. |
---|
184 | |
---|
185 | == ASSUMPTIONS == |
---|
186 | * Both phases are perfectly mixed; |
---|
187 | * No solid is dragged with in the vapour outlet stream. |
---|
188 | |
---|
189 | == SPECIFY == |
---|
190 | * The inlet stream: |
---|
191 | flow rate |
---|
192 | temperature |
---|
193 | pressure |
---|
194 | stream composition; |
---|
195 | * The pressure Drop (Pdrop); |
---|
196 | * The outlet temperature. |
---|
197 | |
---|
198 | == SET == |
---|
199 | * Number of stream components(Ncomp/NcompS). |
---|
200 | "; |
---|
201 | |
---|
202 | VARIABLES |
---|
203 | out Outlet_q as heat_stream (Brief = "Inlet Heat Stream", PosX=0, PosY=0.81, Symbol="Q_{out}"); |
---|
204 | |
---|
205 | EQUATIONS |
---|
206 | "Equate Heat Stream" |
---|
207 | Outlet_q.Q = -Q; |
---|
208 | |
---|
209 | end |
---|
210 | |
---|
211 | FlowSheet teste_endo_flash |
---|
212 | |
---|
213 | #*------------------------------------------------------------------- |
---|
214 | * Declaracao de dispositivos (ou blocos contendo o modelo) |
---|
215 | *--------------------------------------------------------------------*# |
---|
216 | |
---|
217 | DEVICES |
---|
218 | S101 as main_sourceR; |
---|
219 | F101 as endo_flash; |
---|
220 | E101 as heat_sourceR; |
---|
221 | |
---|
222 | #*------------------------------------------------------------------- |
---|
223 | * Especifica as conexoes entre os modelos |
---|
224 | *--------------------------------------------------------------------*# |
---|
225 | |
---|
226 | CONNECTIONS |
---|
227 | S101.Outlet to F101.Inlet; |
---|
228 | E101.Outlet_q to F101.Inlet_q; |
---|
229 | |
---|
230 | #*------------------------------------------------------------------- |
---|
231 | * Define o valor dos parametros declarados no modelo |
---|
232 | *--------------------------------------------------------------------*# |
---|
233 | |
---|
234 | SET |
---|
235 | S101.ValidPhases = "Vapour-Liquid"; |
---|
236 | NComp = PP.NumberOfComponents(); |
---|
237 | NCompS = PPS.NumberOfComponents(); |
---|
238 | |
---|
239 | #*------------------------------------------------------------------- |
---|
240 | * Especifica variaveis definidas no modelo |
---|
241 | *--------------------------------------------------------------------*# |
---|
242 | |
---|
243 | SPECIFY |
---|
244 | S101.Fluid.Fw = 20 * 'kg/h'; |
---|
245 | S101.Solid.Fw = 10 * 'kg/h'; |
---|
246 | S101.T = 380 * 'K'; |
---|
247 | S101.P = 1 * 'atm'; |
---|
248 | S101.CompositionOfSolid = [0.4, 0.3, 0.28, 0.02, 0, 0, 0, 0, 0]; |
---|
249 | S101.CompositionOfFluid = [0.8, 0.01, 0.19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; |
---|
250 | |
---|
251 | F101.Pdrop = 0 * 'atm'; |
---|
252 | F101.OutletL.T = 385 * 'K'; |
---|
253 | |
---|
254 | #*------------------------------------------------------------------- |
---|
255 | #Parametros |
---|
256 | *--------------------------------------------------------------------*# |
---|
257 | |
---|
258 | PARAMETERS |
---|
259 | PP as Plugin (Brief = "External Physical Properties", |
---|
260 | Type="PP", |
---|
261 | Project = "../Flowsheets/v2_2/Fluid_v2_2.vrtherm" |
---|
262 | ); |
---|
263 | PPS as Plugin (Brief = "External Physical Properties", |
---|
264 | Type="PP", |
---|
265 | Project = "../Flowsheets/v2_2/Solid_v2_2.vrtherm" |
---|
266 | ); |
---|
267 | |
---|
268 | NComp as Integer (Brief = "Number of chemical components in the fluid phase"); |
---|
269 | NCompS as Integer (Brief = "Number of chemical components in the solid phase"); |
---|
270 | |
---|
271 | #*------------------------------------------------------------------- |
---|
272 | * Define o valor dos parametros declarados no modelo |
---|
273 | *--------------------------------------------------------------------*# |
---|
274 | |
---|
275 | SET |
---|
276 | NComp = PP.NumberOfComponents(); |
---|
277 | NCompS = PPS.NumberOfComponents(); |
---|
278 | |
---|
279 | #*------------------------------------------------------------------- |
---|
280 | * Condicoes iniciais e opcoes de Solver |
---|
281 | *--------------------------------------------------------------------*# |
---|
282 | |
---|
283 | OPTIONS |
---|
284 | Dynamic = false; |
---|
285 | Integration = "original"; |
---|
286 | NLASolver( |
---|
287 | File = "sundials", |
---|
288 | RelativeAccuracy = 1e-3, |
---|
289 | AbsoluteAccuracy = 1e-6, |
---|
290 | MaxIterations = 100 |
---|
291 | ); |
---|
292 | DAESolver( |
---|
293 | File = "dassl", |
---|
294 | RelativeAccuracy = 1e-3, |
---|
295 | AbsoluteAccuracy = 1e-6, |
---|
296 | EventAccuracy = 1e-2 |
---|
297 | ); |
---|
298 | end |
---|
299 | |
---|
300 | FlowSheet teste_exo_flash |
---|
301 | |
---|
302 | #*------------------------------------------------------------------- |
---|
303 | * Declaracao de dispositivos (ou blocos contendo o modelo) |
---|
304 | *--------------------------------------------------------------------*# |
---|
305 | |
---|
306 | DEVICES |
---|
307 | S101 as main_sourceR; |
---|
308 | F101 as exo_flash; |
---|
309 | |
---|
310 | |
---|
311 | #*------------------------------------------------------------------- |
---|
312 | * Especifica as conexoes entre os modelos |
---|
313 | *--------------------------------------------------------------------*# |
---|
314 | |
---|
315 | CONNECTIONS |
---|
316 | S101.Outlet to F101.Inlet; |
---|
317 | |
---|
318 | #*------------------------------------------------------------------- |
---|
319 | * Define o valor dos parametros declarados no modelo |
---|
320 | *--------------------------------------------------------------------*# |
---|
321 | |
---|
322 | SET |
---|
323 | S101.ValidPhases = "Vapour-Liquid"; |
---|
324 | NComp = PP.NumberOfComponents(); |
---|
325 | NCompS = PPS.NumberOfComponents(); |
---|
326 | |
---|
327 | #*------------------------------------------------------------------- |
---|
328 | * Especifica variaveis definidas no modelo |
---|
329 | *--------------------------------------------------------------------*# |
---|
330 | |
---|
331 | SPECIFY |
---|
332 | S101.Fluid.Fw = 20 * 'kg/h'; |
---|
333 | S101.Solid.Fw = 10 * 'kg/h'; |
---|
334 | S101.T = 380 * 'K'; |
---|
335 | S101.P = 1 * 'atm'; |
---|
336 | S101.CompositionOfSolid = [0.4, 0.3, 0.28, 0.02, 0, 0, 0, 0, 0]; |
---|
337 | S101.CompositionOfFluid = [0.8, 0.01, 0.19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; |
---|
338 | |
---|
339 | F101.Pdrop = 0 * 'atm'; |
---|
340 | F101.OutletL.T = 385 * 'K'; |
---|
341 | |
---|
342 | #*------------------------------------------------------------------- |
---|
343 | #Parametros |
---|
344 | *--------------------------------------------------------------------*# |
---|
345 | |
---|
346 | PARAMETERS |
---|
347 | PP as Plugin (Brief = "External Physical Properties", |
---|
348 | Type="PP", |
---|
349 | Project = "../Flowsheets/v2_2/Fluid_v2_2.vrtherm" |
---|
350 | ); |
---|
351 | PPS as Plugin (Brief = "External Physical Properties", |
---|
352 | Type="PP", |
---|
353 | Project = "../Flowsheets/v2_2/Solid_v2_2.vrtherm" |
---|
354 | ); |
---|
355 | |
---|
356 | NComp as Integer (Brief = "Number of chemical components in the fluid phase"); |
---|
357 | NCompS as Integer (Brief = "Number of chemical components in the solid phase"); |
---|
358 | |
---|
359 | #*------------------------------------------------------------------- |
---|
360 | * Define o valor dos parametros declarados no modelo |
---|
361 | *--------------------------------------------------------------------*# |
---|
362 | |
---|
363 | SET |
---|
364 | NComp = PP.NumberOfComponents(); |
---|
365 | NCompS = PPS.NumberOfComponents(); |
---|
366 | |
---|
367 | #*------------------------------------------------------------------- |
---|
368 | * Condicoes iniciais e opcoes de Solver |
---|
369 | *--------------------------------------------------------------------*# |
---|
370 | |
---|
371 | OPTIONS |
---|
372 | Dynamic = false; |
---|
373 | Integration = "original"; |
---|
374 | NLASolver( |
---|
375 | File = "sundials", |
---|
376 | RelativeAccuracy = 1e-3, |
---|
377 | AbsoluteAccuracy = 1e-6, |
---|
378 | MaxIterations = 100 |
---|
379 | ); |
---|
380 | DAESolver( |
---|
381 | File = "dassl", |
---|
382 | RelativeAccuracy = 1e-3, |
---|
383 | AbsoluteAccuracy = 1e-6, |
---|
384 | EventAccuracy = 1e-2 |
---|
385 | ); |
---|
386 | end |
---|
387 | |
---|