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 | * Model of source streams |
---|
17 | *---------------------------------------------------------------------- |
---|
18 | * Author: Paula B. Staudt and Rafael de P. Soares |
---|
19 | * $Id: sources.mso 757 2009-06-03 20:07:22Z bicca $ |
---|
20 | *---------------------------------------------------------------------*# |
---|
21 | |
---|
22 | using "streams"; |
---|
23 | |
---|
24 | Model energy_source |
---|
25 | ATTRIBUTES |
---|
26 | Pallete = true; |
---|
27 | Icon = "icon/energy_source"; |
---|
28 | Brief = "Energy stream source"; |
---|
29 | |
---|
30 | VARIABLES |
---|
31 | out OutletQ as power(Brief = "Outlet energy stream", PosX=1, PosY=0.40, Symbol="_{out}"); |
---|
32 | |
---|
33 | end |
---|
34 | |
---|
35 | Model energy_source2 |
---|
36 | ATTRIBUTES |
---|
37 | Pallete = true; |
---|
38 | Icon = "icon/energy_source2"; |
---|
39 | Brief = "Energy stream source"; |
---|
40 | |
---|
41 | VARIABLES |
---|
42 | out OutletQ as power(Brief = "Outlet energy stream", PosX=0, PosY=0.40, Symbol="_{out}"); |
---|
43 | |
---|
44 | end |
---|
45 | |
---|
46 | Model info_stream |
---|
47 | ATTRIBUTES |
---|
48 | Pallete = true; |
---|
49 | Icon = "icon/Info_Stream"; |
---|
50 | Brief = "Material stream information"; |
---|
51 | Info = " |
---|
52 | This model should be used for middle streams when additional |
---|
53 | information about the stream is desired. |
---|
54 | |
---|
55 | Some of the additional informations calculated by this models are: |
---|
56 | * Mass density |
---|
57 | * Mass flow |
---|
58 | * Mass compostions |
---|
59 | * Specific volume |
---|
60 | * Vapour fraction |
---|
61 | * Volumetric flow |
---|
62 | * Liquid and Vapour compositions |
---|
63 | * Viscosity |
---|
64 | * Heat Capacity |
---|
65 | * Thermal Conductivity |
---|
66 | * Temperature in Celsius Degrees |
---|
67 | "; |
---|
68 | |
---|
69 | PARAMETERS |
---|
70 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
71 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
72 | M(NComp) as molweight (Brief = "Component Mol Weight"); |
---|
73 | |
---|
74 | SET |
---|
75 | |
---|
76 | M = PP.MolecularWeight(); |
---|
77 | |
---|
78 | VARIABLES |
---|
79 | |
---|
80 | in Inlet as stream (Brief = "Inlet Stream", PosX=0, PosY=0.50, Protected=true , Symbol="_{in}"); |
---|
81 | out Outlet as stream (Brief = "Outlet Stream", PosX=1, PosY=0.50, Protected=true , Symbol="_{out}"); |
---|
82 | |
---|
83 | v as fraction (Brief = "Vapourization fraction",Hidden=true); |
---|
84 | x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); |
---|
85 | y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); |
---|
86 | |
---|
87 | F(NComp) as flow_mol (Brief = "Component Molar Flow",Protected=true); |
---|
88 | FwTotal as flow_mass (Brief = "Total Mass Flow",Protected=true); |
---|
89 | Fw(NComp) as flow_mass (Brief = "Component Mass Flow",Protected=true); |
---|
90 | FvolTotal as flow_vol (Brief = "Total Volumetric Flow",Protected=true); |
---|
91 | T_Cdeg as temperature (Brief = "Temperature in °C", Lower=-200,Protected=true); |
---|
92 | |
---|
93 | Mu as viscosity (Brief="Stream Viscosity",Lower=0.0001, Symbol = "\mu",Protected=true); |
---|
94 | Cp as cp_mol (Brief="Stream Molar Heat Capacity", Upper=1e10,Protected=true); |
---|
95 | K as conductivity (Brief="Stream Thermal Conductivity", Default=1.0, Lower=1e-5, Upper=500,Protected=true); |
---|
96 | Mw as molweight (Brief = "Average Mol Weight",Protected=true); |
---|
97 | vm as volume_mol (Brief = "Molar Volume",Protected=true); |
---|
98 | rho as dens_mass (Brief = "Stream Mass Density",Protected=true); |
---|
99 | rhom as dens_mol (Brief = "Stream Molar Density",Protected=true); |
---|
100 | s as entr_mol (Brief = "Stream Entropy",Protected=true); |
---|
101 | zmass(NComp) as fraction (Brief = "Mass Fraction",Protected=true); |
---|
102 | |
---|
103 | EQUATIONS |
---|
104 | |
---|
105 | "Flash Calculation" |
---|
106 | [v, x, y] = PP.FlashPH(Inlet.P, Inlet.h, Inlet.z); |
---|
107 | |
---|
108 | "Average Molecular Weight" |
---|
109 | Mw = sum(M*Inlet.z); |
---|
110 | |
---|
111 | "Mass Density" |
---|
112 | rho * ((1-v)/PP.LiquidDensity(Inlet.T,Inlet.P,x) + v/PP.VapourDensity(Inlet.T,Inlet.P,y)) = 1; |
---|
113 | |
---|
114 | "Mass or Molar Density" |
---|
115 | rhom * Mw = rho; |
---|
116 | |
---|
117 | "Total Flow Mass" |
---|
118 | FwTotal = Mw*Inlet.F; |
---|
119 | |
---|
120 | "Component Flow Mass" |
---|
121 | Fw = FwTotal*zmass; |
---|
122 | |
---|
123 | "Molar Volume" |
---|
124 | vm = (1-v)*PP.LiquidVolume(Inlet.T, Inlet.P, x) + v*PP.VapourVolume(Inlet.T,Inlet.P,y); |
---|
125 | |
---|
126 | "Total Volumetric Flow" |
---|
127 | FvolTotal = Inlet.F*vm ; |
---|
128 | |
---|
129 | "Mass Fraction" |
---|
130 | zmass = M*Inlet.z / Mw; |
---|
131 | |
---|
132 | "Stream Heat Capacity" |
---|
133 | Cp = (1-v)*PP.LiquidCp(Inlet.T, Inlet.P, x) + v*PP.VapourCp(Inlet.T,Inlet.P,y); |
---|
134 | |
---|
135 | "Stream Viscosity" |
---|
136 | Mu = (1-v)*PP.LiquidViscosity(Inlet.T, Inlet.P, x) + v*PP.VapourViscosity(Inlet.T,Inlet.P,y); |
---|
137 | |
---|
138 | "Stream ThermalConductivity" |
---|
139 | K = (1-v)*PP.LiquidThermalConductivity(Inlet.T, Inlet.P, x) + v*PP.VapourThermalConductivity(Inlet.T,Inlet.P,y); |
---|
140 | |
---|
141 | "Stream Overall Entropy" |
---|
142 | s = (1-v)*PP.LiquidEntropy(Inlet.T, Inlet.P, x) + v*PP.VapourEntropy(Inlet.T, Inlet.P, y); |
---|
143 | |
---|
144 | "Temperature in °C" |
---|
145 | T_Cdeg = Inlet.T - 273.15 * 'K'; |
---|
146 | |
---|
147 | "Outlet Flow" |
---|
148 | Outlet.F = Inlet.F; |
---|
149 | |
---|
150 | "Component Molar Flow" |
---|
151 | F = Inlet.F*Inlet.z; |
---|
152 | |
---|
153 | "Outlet Temperature" |
---|
154 | Outlet.T = Inlet.T; |
---|
155 | |
---|
156 | "Outlet Pressure" |
---|
157 | Outlet.P = Inlet.P; |
---|
158 | |
---|
159 | "Outlet Vapour Fraction" |
---|
160 | Outlet.v = Inlet.v; |
---|
161 | |
---|
162 | "Outlet Enthalpy" |
---|
163 | Outlet.h = Inlet.h; |
---|
164 | |
---|
165 | "Outlet Composition" |
---|
166 | Outlet.z= Inlet.z; |
---|
167 | |
---|
168 | end |
---|
169 | |
---|
170 | Model source |
---|
171 | |
---|
172 | ATTRIBUTES |
---|
173 | Pallete = true; |
---|
174 | Icon = "icon/Source"; |
---|
175 | Brief = "Material stream source"; |
---|
176 | Info = " |
---|
177 | This model should be used for boundary streams. |
---|
178 | Usually these streams are known and come from another process |
---|
179 | units. |
---|
180 | |
---|
181 | The user should specify: |
---|
182 | * Total molar (mass or volumetric) flow |
---|
183 | * Temperature |
---|
184 | * Pressure |
---|
185 | * Molar or mass composition |
---|
186 | |
---|
187 | No matter the specification set, the model will calculate some |
---|
188 | additional properties: |
---|
189 | * Mass density |
---|
190 | * Mass flow |
---|
191 | * Mass compostions |
---|
192 | * Specific volume |
---|
193 | * Vapour fraction |
---|
194 | * Volumetric flow |
---|
195 | * Liquid and Vapour compositions |
---|
196 | "; |
---|
197 | |
---|
198 | PARAMETERS |
---|
199 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
200 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
201 | M(NComp) as molweight (Brief = "Component Mol Weight"); |
---|
202 | CompositionBasis as Switcher (Brief = "Molar or Mass Composition", Valid = ["Molar", "Mass"], Default="Molar"); |
---|
203 | ValidPhases as Switcher (Brief = "Valid Phases for Flash Calculation", Valid = ["Vapour-Only", "Liquid-Only","Vapour-Liquid"], Default="Vapour-Liquid"); |
---|
204 | |
---|
205 | |
---|
206 | SET |
---|
207 | |
---|
208 | M = PP.MolecularWeight(); |
---|
209 | |
---|
210 | VARIABLES |
---|
211 | |
---|
212 | out Outlet as stream (Brief = "Outlet stream", PosX=1, PosY=0.5256, Symbol="_{out}",Protected=true); |
---|
213 | |
---|
214 | Composition(NComp) as fraction (Brief = "Stream Composition"); |
---|
215 | SumOfComposition as positive (Brief = "Sum of Stream Composition",Protected=true); |
---|
216 | F as flow_mol (Brief = "Stream Molar Flow Rate"); |
---|
217 | Fw as flow_mass (Brief = "Stream Mass Flow"); |
---|
218 | Fvol as flow_vol (Brief = "Volumetric Flow"); |
---|
219 | T as temperature (Brief = "Stream Temperature"); |
---|
220 | T_Cdeg as temperature (Brief = "Temperature in °C", Lower=-200); |
---|
221 | P as pressure (Brief = "Stream Pressure"); |
---|
222 | |
---|
223 | x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); |
---|
224 | y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); |
---|
225 | |
---|
226 | Mw as molweight (Brief = "Average Mol Weight",Protected=true); |
---|
227 | vm as volume_mol (Brief = "Molar Volume",Protected=true); |
---|
228 | rho as dens_mass (Brief = "Stream Mass Density",Protected=true); |
---|
229 | rhom as dens_mol (Brief = "Stream Molar Density",Protected=true); |
---|
230 | |
---|
231 | zmass(NComp) as fraction (Brief = "Mass Fraction",Protected=true); |
---|
232 | |
---|
233 | EQUATIONS |
---|
234 | |
---|
235 | switch CompositionBasis |
---|
236 | |
---|
237 | case "Molar": |
---|
238 | "Stream Molar Composition" |
---|
239 | Outlet.z = Composition/sum(Composition); |
---|
240 | |
---|
241 | "Stream Mass Composition" |
---|
242 | zmass = M*Outlet.z / Mw; |
---|
243 | |
---|
244 | case "Mass": |
---|
245 | "Stream Mass Composition" |
---|
246 | zmass = Composition/sum(Composition); |
---|
247 | |
---|
248 | "Stream Molar Composition" |
---|
249 | Outlet.z*sum(zmass/M) = zmass/M; |
---|
250 | |
---|
251 | end |
---|
252 | |
---|
253 | switch ValidPhases |
---|
254 | |
---|
255 | case "Liquid-Only": |
---|
256 | |
---|
257 | "Vapour Fraction" |
---|
258 | Outlet.v = 0; |
---|
259 | |
---|
260 | "Liquid Composition" |
---|
261 | x = Outlet.z; |
---|
262 | |
---|
263 | "Vapour Composition" |
---|
264 | y = Outlet.z; |
---|
265 | |
---|
266 | "Overall Enthalpy" |
---|
267 | Outlet.h = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x); |
---|
268 | |
---|
269 | "Molar Volume" |
---|
270 | vm = PP.LiquidVolume(Outlet.T, Outlet.P, x); |
---|
271 | |
---|
272 | case "Vapour-Only": |
---|
273 | |
---|
274 | "Vapor Fraction" |
---|
275 | Outlet.v = 1; |
---|
276 | |
---|
277 | "Liquid Composition" |
---|
278 | x = Outlet.z; |
---|
279 | |
---|
280 | "Vapour Composition" |
---|
281 | y = Outlet.z; |
---|
282 | |
---|
283 | "Overall Enthalpy" |
---|
284 | Outlet.h = PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
285 | |
---|
286 | "Molar Volume" |
---|
287 | vm = PP.VapourVolume(Outlet.T, Outlet.P, y); |
---|
288 | |
---|
289 | |
---|
290 | case "Vapour-Liquid": |
---|
291 | |
---|
292 | "Flash Calculation" |
---|
293 | [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z); |
---|
294 | |
---|
295 | "Overall Enthalpy" |
---|
296 | Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
297 | |
---|
298 | "Molar Volume" |
---|
299 | vm = (1-Outlet.v)*PP.LiquidVolume(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourVolume(Outlet.T,Outlet.P,y); |
---|
300 | |
---|
301 | end |
---|
302 | |
---|
303 | "Sum of Composition" |
---|
304 | SumOfComposition = sum(Composition); |
---|
305 | |
---|
306 | "Molar Density" |
---|
307 | rhom * vm = 1; |
---|
308 | |
---|
309 | "Average Molecular Weight" |
---|
310 | Mw = sum(M*Outlet.z); |
---|
311 | |
---|
312 | "Mass or Molar Density" |
---|
313 | rhom * Mw = rho; |
---|
314 | |
---|
315 | "Flow Mass" |
---|
316 | Fw = Mw*Outlet.F; |
---|
317 | |
---|
318 | "Volumetric Flow" |
---|
319 | Fvol = Outlet.F*vm ; |
---|
320 | |
---|
321 | "Temperature in °C" |
---|
322 | T_Cdeg = Outlet.T - 273.15 * 'K'; |
---|
323 | |
---|
324 | "Equate Flow" |
---|
325 | Outlet.F = F; |
---|
326 | |
---|
327 | "Equate Pressures" |
---|
328 | Outlet.P = P; |
---|
329 | |
---|
330 | "Equate Temperatures" |
---|
331 | Outlet.T = T; |
---|
332 | |
---|
333 | end |
---|
334 | |
---|
335 | Model source2 |
---|
336 | |
---|
337 | ATTRIBUTES |
---|
338 | Pallete = true; |
---|
339 | Icon = "icon/Source2"; |
---|
340 | Brief = "Material stream source"; |
---|
341 | Info = " |
---|
342 | This model should be used for boundary streams. |
---|
343 | Usually these streams are known and come from another process |
---|
344 | units. |
---|
345 | |
---|
346 | The user should specify: |
---|
347 | * Total molar (mass or volumetric) flow |
---|
348 | * Temperature |
---|
349 | * Pressure |
---|
350 | * Molar or mass composition |
---|
351 | |
---|
352 | No matter the specification set, the model will calculate some |
---|
353 | additional properties: |
---|
354 | * Mass density |
---|
355 | * Mass flow |
---|
356 | * Mass compostions |
---|
357 | * Specific volume |
---|
358 | * Vapour fraction |
---|
359 | * Volumetric flow |
---|
360 | * Liquid and Vapour compositions |
---|
361 | "; |
---|
362 | |
---|
363 | PARAMETERS |
---|
364 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
365 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
366 | M(NComp) as molweight (Brief = "Component Mol Weight"); |
---|
367 | CompositionBasis as Switcher (Brief = "Molar or Mass Composition", Valid = ["Molar", "Mass"], Default="Molar"); |
---|
368 | ValidPhases as Switcher (Brief = "Valid Phases for Flash Calculation", Valid = ["Vapour-Only", "Liquid-Only","Vapour-Liquid"], Default="Vapour-Liquid"); |
---|
369 | |
---|
370 | |
---|
371 | SET |
---|
372 | |
---|
373 | M = PP.MolecularWeight(); |
---|
374 | |
---|
375 | VARIABLES |
---|
376 | |
---|
377 | out Outlet as stream (Brief = "Outlet stream", PosX=0, PosY=0.5256, Symbol="_{out}",Protected=true); |
---|
378 | |
---|
379 | Composition(NComp) as fraction (Brief = "Stream Composition"); |
---|
380 | SumOfComposition as positive (Brief = "Sum of Stream Composition",Protected=true); |
---|
381 | F as flow_mol (Brief = "Stream Molar Flow Rate"); |
---|
382 | Fw as flow_mass (Brief = "Stream Mass Flow"); |
---|
383 | Fvol as flow_vol (Brief = "Volumetric Flow"); |
---|
384 | T as temperature (Brief = "Stream Temperature"); |
---|
385 | T_Cdeg as temperature (Brief = "Temperature in °C", Lower=-200); |
---|
386 | P as pressure (Brief = "Stream Pressure"); |
---|
387 | |
---|
388 | x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); |
---|
389 | y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); |
---|
390 | |
---|
391 | Mw as molweight (Brief = "Average Mol Weight",Protected=true); |
---|
392 | vm as volume_mol (Brief = "Molar Volume",Protected=true); |
---|
393 | rho as dens_mass (Brief = "Stream Mass Density",Protected=true); |
---|
394 | rhom as dens_mol (Brief = "Stream Molar Density",Protected=true); |
---|
395 | |
---|
396 | zmass(NComp) as fraction (Brief = "Mass Fraction",Protected=true); |
---|
397 | |
---|
398 | EQUATIONS |
---|
399 | |
---|
400 | switch CompositionBasis |
---|
401 | |
---|
402 | case "Molar": |
---|
403 | "Stream Molar Composition" |
---|
404 | Outlet.z = Composition/sum(Composition); |
---|
405 | |
---|
406 | "Stream Mass Composition" |
---|
407 | zmass = M*Outlet.z / Mw; |
---|
408 | |
---|
409 | case "Mass": |
---|
410 | "Stream Mass Composition" |
---|
411 | zmass = Composition/sum(Composition); |
---|
412 | |
---|
413 | "Stream Molar Composition" |
---|
414 | Outlet.z*sum(zmass/M) = zmass/M; |
---|
415 | |
---|
416 | end |
---|
417 | |
---|
418 | switch ValidPhases |
---|
419 | |
---|
420 | case "Liquid-Only": |
---|
421 | |
---|
422 | "Vapour Fraction" |
---|
423 | Outlet.v = 0; |
---|
424 | |
---|
425 | "Liquid Composition" |
---|
426 | x = Outlet.z; |
---|
427 | |
---|
428 | "Vapour Composition" |
---|
429 | y = Outlet.z; |
---|
430 | |
---|
431 | "Overall Enthalpy" |
---|
432 | Outlet.h = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x); |
---|
433 | |
---|
434 | "Molar Volume" |
---|
435 | vm = PP.LiquidVolume(Outlet.T, Outlet.P, x); |
---|
436 | |
---|
437 | case "Vapour-Only": |
---|
438 | |
---|
439 | "Vapor Fraction" |
---|
440 | Outlet.v = 1; |
---|
441 | |
---|
442 | "Liquid Composition" |
---|
443 | x = Outlet.z; |
---|
444 | |
---|
445 | "Vapour Composition" |
---|
446 | y = Outlet.z; |
---|
447 | |
---|
448 | "Overall Enthalpy" |
---|
449 | Outlet.h = PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
450 | |
---|
451 | "Molar Volume" |
---|
452 | vm = PP.VapourVolume(Outlet.T, Outlet.P, y); |
---|
453 | |
---|
454 | |
---|
455 | case "Vapour-Liquid": |
---|
456 | |
---|
457 | "Flash Calculation" |
---|
458 | [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z); |
---|
459 | |
---|
460 | "Overall Enthalpy" |
---|
461 | Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
462 | |
---|
463 | "Molar Volume" |
---|
464 | vm = (1-Outlet.v)*PP.LiquidVolume(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourVolume(Outlet.T,Outlet.P,y); |
---|
465 | |
---|
466 | end |
---|
467 | |
---|
468 | "Sum of Composition" |
---|
469 | SumOfComposition = sum(Composition); |
---|
470 | |
---|
471 | "Molar Density" |
---|
472 | rhom * vm = 1; |
---|
473 | |
---|
474 | "Average Molecular Weight" |
---|
475 | Mw = sum(M*Outlet.z); |
---|
476 | |
---|
477 | "Mass or Molar Density" |
---|
478 | rhom * Mw = rho; |
---|
479 | |
---|
480 | "Flow Mass" |
---|
481 | Fw = Mw*Outlet.F; |
---|
482 | |
---|
483 | "Volumetric Flow" |
---|
484 | Fvol = Outlet.F*vm ; |
---|
485 | |
---|
486 | "Temperature in °C" |
---|
487 | T_Cdeg = Outlet.T - 273.15 * 'K'; |
---|
488 | |
---|
489 | "Equate Flow" |
---|
490 | Outlet.F = F; |
---|
491 | |
---|
492 | "Equate Pressures" |
---|
493 | Outlet.P = P; |
---|
494 | |
---|
495 | "Equate Temperatures" |
---|
496 | Outlet.T = T; |
---|
497 | |
---|
498 | end |
---|
499 | |
---|
500 | Model simple_source |
---|
501 | |
---|
502 | ATTRIBUTES |
---|
503 | Pallete = true; |
---|
504 | Icon = "icon/Source"; |
---|
505 | Brief = "Simple Material stream source"; |
---|
506 | Info = " |
---|
507 | This model should be used for boundary streams. |
---|
508 | Usually these streams are known and come from another process |
---|
509 | units. |
---|
510 | |
---|
511 | The user should specify: |
---|
512 | * Total molar flow |
---|
513 | * Temperature |
---|
514 | * Pressure |
---|
515 | * Molar composition |
---|
516 | "; |
---|
517 | |
---|
518 | PARAMETERS |
---|
519 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
520 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
521 | M(NComp) as molweight (Brief = "Component Mol Weight"); |
---|
522 | ValidPhases as Switcher (Brief = "Valid Phases for Flash Calculation", Valid = ["Vapour-Only", "Liquid-Only","Vapour-Liquid"], Default="Vapour-Liquid"); |
---|
523 | |
---|
524 | |
---|
525 | SET |
---|
526 | |
---|
527 | M = PP.MolecularWeight(); |
---|
528 | |
---|
529 | VARIABLES |
---|
530 | |
---|
531 | out Outlet as stream (Brief = "Outlet stream", PosX=1, PosY=0.5256, Symbol="_{out}",Protected=true); |
---|
532 | |
---|
533 | MolarComposition(NComp) as fraction (Brief = "Stream Molar Composition"); |
---|
534 | SumOfComposition as positive (Brief = "Sum of Stream Composition",Protected=true); |
---|
535 | F as flow_mol (Brief = "Stream Molar Flow Rate"); |
---|
536 | T as temperature (Brief = "Stream Temperature"); |
---|
537 | T_Cdeg as temperature (Brief = "Temperature in °C", Lower=-200); |
---|
538 | P as pressure (Brief = "Stream Pressure"); |
---|
539 | |
---|
540 | x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); |
---|
541 | y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); |
---|
542 | |
---|
543 | |
---|
544 | EQUATIONS |
---|
545 | |
---|
546 | "Sum of Composition" |
---|
547 | SumOfComposition = sum(MolarComposition); |
---|
548 | |
---|
549 | "Stream Molar Composition" |
---|
550 | Outlet.z = MolarComposition/sum(MolarComposition); |
---|
551 | |
---|
552 | |
---|
553 | switch ValidPhases |
---|
554 | |
---|
555 | case "Liquid-Only": |
---|
556 | |
---|
557 | "Vapour Fraction" |
---|
558 | Outlet.v = 0; |
---|
559 | |
---|
560 | "Liquid Composition" |
---|
561 | x = Outlet.z; |
---|
562 | |
---|
563 | "Vapour Composition" |
---|
564 | y = Outlet.z; |
---|
565 | |
---|
566 | "Overall Enthalpy" |
---|
567 | Outlet.h = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x); |
---|
568 | |
---|
569 | |
---|
570 | case "Vapour-Only": |
---|
571 | |
---|
572 | "Vapor Fraction" |
---|
573 | Outlet.v = 1; |
---|
574 | |
---|
575 | "Liquid Composition" |
---|
576 | x = Outlet.z; |
---|
577 | |
---|
578 | "Vapour Composition" |
---|
579 | y = Outlet.z; |
---|
580 | |
---|
581 | "Overall Enthalpy" |
---|
582 | Outlet.h = PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
583 | |
---|
584 | |
---|
585 | case "Vapour-Liquid": |
---|
586 | |
---|
587 | "Flash Calculation" |
---|
588 | [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z); |
---|
589 | |
---|
590 | "Overall Enthalpy" |
---|
591 | Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
592 | |
---|
593 | |
---|
594 | end |
---|
595 | |
---|
596 | "Temperature in °C" |
---|
597 | T_Cdeg = Outlet.T - 273.15 * 'K'; |
---|
598 | |
---|
599 | "Equate Flow" |
---|
600 | Outlet.F = F; |
---|
601 | |
---|
602 | "Equate Pressures" |
---|
603 | Outlet.P = P; |
---|
604 | |
---|
605 | "Equate Temperatures" |
---|
606 | Outlet.T = T; |
---|
607 | |
---|
608 | end |
---|
609 | |
---|
610 | Model simple_source2 |
---|
611 | |
---|
612 | ATTRIBUTES |
---|
613 | Pallete = true; |
---|
614 | Icon = "icon/Source2"; |
---|
615 | Brief = "Simple Material stream source"; |
---|
616 | Info = " |
---|
617 | This model should be used for boundary streams. |
---|
618 | Usually these streams are known and come from another process |
---|
619 | units. |
---|
620 | |
---|
621 | The user should specify: |
---|
622 | * Total molar flow |
---|
623 | * Temperature |
---|
624 | * Pressure |
---|
625 | * Molar composition |
---|
626 | "; |
---|
627 | |
---|
628 | PARAMETERS |
---|
629 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
630 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
631 | M(NComp) as molweight (Brief = "Component Mol Weight"); |
---|
632 | ValidPhases as Switcher (Brief = "Valid Phases for Flash Calculation", Valid = ["Vapour-Only", "Liquid-Only","Vapour-Liquid"], Default="Vapour-Liquid"); |
---|
633 | |
---|
634 | |
---|
635 | SET |
---|
636 | |
---|
637 | M = PP.MolecularWeight(); |
---|
638 | |
---|
639 | VARIABLES |
---|
640 | |
---|
641 | out Outlet as stream (Brief = "Outlet stream", PosX=1, PosY=0.5256, Symbol="_{out}",Protected=true); |
---|
642 | |
---|
643 | MolarComposition(NComp) as fraction (Brief = "Stream Molar Composition"); |
---|
644 | SumOfComposition as positive (Brief = "Sum of Stream Composition",Protected=true); |
---|
645 | F as flow_mol (Brief = "Stream Molar Flow Rate"); |
---|
646 | T as temperature (Brief = "Stream Temperature"); |
---|
647 | T_Cdeg as temperature (Brief = "Temperature in °C", Lower=-200); |
---|
648 | P as pressure (Brief = "Stream Pressure"); |
---|
649 | |
---|
650 | x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); |
---|
651 | y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); |
---|
652 | |
---|
653 | |
---|
654 | EQUATIONS |
---|
655 | |
---|
656 | "Sum of Composition" |
---|
657 | SumOfComposition = sum(MolarComposition); |
---|
658 | |
---|
659 | "Stream Molar Composition" |
---|
660 | Outlet.z = MolarComposition/sum(MolarComposition); |
---|
661 | |
---|
662 | |
---|
663 | switch ValidPhases |
---|
664 | |
---|
665 | case "Liquid-Only": |
---|
666 | |
---|
667 | "Vapour Fraction" |
---|
668 | Outlet.v = 0; |
---|
669 | |
---|
670 | "Liquid Composition" |
---|
671 | x = Outlet.z; |
---|
672 | |
---|
673 | "Vapour Composition" |
---|
674 | y = Outlet.z; |
---|
675 | |
---|
676 | "Overall Enthalpy" |
---|
677 | Outlet.h = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x); |
---|
678 | |
---|
679 | |
---|
680 | case "Vapour-Only": |
---|
681 | |
---|
682 | "Vapor Fraction" |
---|
683 | Outlet.v = 1; |
---|
684 | |
---|
685 | "Liquid Composition" |
---|
686 | x = Outlet.z; |
---|
687 | |
---|
688 | "Vapour Composition" |
---|
689 | y = Outlet.z; |
---|
690 | |
---|
691 | "Overall Enthalpy" |
---|
692 | Outlet.h = PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
693 | |
---|
694 | |
---|
695 | case "Vapour-Liquid": |
---|
696 | |
---|
697 | "Flash Calculation" |
---|
698 | [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z); |
---|
699 | |
---|
700 | "Overall Enthalpy" |
---|
701 | Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
702 | |
---|
703 | |
---|
704 | end |
---|
705 | |
---|
706 | "Temperature in °C" |
---|
707 | T_Cdeg = Outlet.T - 273.15 * 'K'; |
---|
708 | |
---|
709 | "Equate Flow" |
---|
710 | Outlet.F = F; |
---|
711 | |
---|
712 | "Equate Pressures" |
---|
713 | Outlet.P = P; |
---|
714 | |
---|
715 | "Equate Temperatures" |
---|
716 | Outlet.T = T; |
---|
717 | |
---|
718 | end |
---|
719 | |
---|
720 | Model sourceNoFlow |
---|
721 | |
---|
722 | ATTRIBUTES |
---|
723 | Pallete = true; |
---|
724 | Icon = "icon/SourceNoFlow"; |
---|
725 | Brief = "Simple Material stream source with no flow."; |
---|
726 | Info = " |
---|
727 | This model should be used for boundary streams. |
---|
728 | Usually these streams are known and come from another process |
---|
729 | units."; |
---|
730 | |
---|
731 | PARAMETERS |
---|
732 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
733 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
734 | |
---|
735 | VARIABLES |
---|
736 | |
---|
737 | out Outlet as stream (Brief = "Outlet stream", PosX=1, PosY=0.5256, Symbol="_{out}",Protected=true); |
---|
738 | |
---|
739 | EQUATIONS |
---|
740 | |
---|
741 | "Stream Molar Composition" |
---|
742 | Outlet.z = 1/NComp; |
---|
743 | |
---|
744 | "Stream Molar Enthalpy" |
---|
745 | Outlet.h = 0 * 'J/mol'; |
---|
746 | |
---|
747 | "Stream Temperature" |
---|
748 | Outlet.T = 300 * 'K'; |
---|
749 | |
---|
750 | "Stream Molar Flow" |
---|
751 | Outlet.F = 0 * 'kmol/h'; |
---|
752 | |
---|
753 | "Stream Pressure" |
---|
754 | Outlet.P = 1 * 'atm'; |
---|
755 | |
---|
756 | "Stream Vapour Fraction" |
---|
757 | Outlet.v = 0; |
---|
758 | |
---|
759 | end |
---|
760 | |
---|
761 | Model work_source |
---|
762 | ATTRIBUTES |
---|
763 | Pallete = true; |
---|
764 | Icon = "icon/work_source"; |
---|
765 | Brief = "Work stream source"; |
---|
766 | |
---|
767 | VARIABLES |
---|
768 | out Work as power(Brief = "Outlet work stream", PosX=1, PosY=0.46, Symbol="_{out}"); |
---|
769 | |
---|
770 | end |
---|