source: branches/gui/eml/stage_separators/condenser.mso @ 767

Last change on this file since 767 was 767, checked in by gerson bicca, 13 years ago

added control ports for pressure control

File size: 12.3 KB
Line 
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* Author: Paula B. Staudt
17* $Id: condenser.mso 555 2008-07-18 19:01:13Z rafael $
18*--------------------------------------------------------------------*#
19
20using "streams";
21
22Model condenser
23        ATTRIBUTES
24        Pallete         = true;
25        Icon            = "icon/Condenser";
26        Brief           = "Model of a dynamic condenser.";
27        Info            =
28"== Assumptions ==
29* perfect mixing of both phases;
30* thermodynamics equilibrium.
31       
32== Specify ==
33* the inlet stream;
34* the outlet flows: OutletVapour.F and OutletLiquid.F;
35* the heat supply.
36       
37== Initial Conditions ==
38* the condenser temperature (OutletLiquid.T);
39* the condenser liquid level (Level);
40* (NoComps - 1) OutletLiquid (OR OutletVapour) compositions.
41";     
42       
43PARAMETERS
44        outer PP                        as Plugin       (Brief = "External Physical Properties", Type="PP");
45        outer NComp     as Integer;
46
47        V                       as volume       (Brief="Condenser total volume");
48        Across  as area                         (Brief="Cross Section Area of reboiler");
49       
50        Initial_Level                           as length                       (Brief="Initial Level of liquid phase");
51        Initial_Temperature                     as temperature          (Brief="Initial Temperature of Condenser");
52        Initial_Composition(NComp)      as fraction             (Brief="Initial Liquid Composition");
53       
54VARIABLES
55in              InletVapour             as stream                               (Brief="Vapour inlet stream", PosX=0.15, PosY=0, Symbol="_{inV}");
56out     OutletLiquid    as liquid_stream                (Brief="Liquid outlet stream", PosX=0.4513, PosY=1, Symbol="_{outL}");
57out     OutletVapour    as vapour_stream        (Brief="Vapour outlet stream", PosX=0.4723, PosY=0, Symbol="_{outV}");
58in              InletQ          as power                                (Brief="Cold supplied", PosX=1, PosY=0, Symbol="_{in}");
59
60        M(NComp)        as mol                          (Brief="Molar Holdup in the tray");
61        ML                              as mol                          (Brief="Molar liquid holdup");
62        MV                              as mol                          (Brief="Molar vapour holdup");
63        E                                       as energy                       (Brief="Total Energy Holdup on tray");
64        vL                              as volume_mol   (Brief="Liquid Molar Volume");
65        vV                              as volume_mol   (Brief="Vapour Molar volume");
66        Level                   as length                       (Brief="Level of liquid phase");
67
68INITIAL
69
70        Level                                   = Initial_Level;
71        OutletLiquid.T                          = Initial_Temperature;
72        OutletLiquid.z(1:NComp-1)       = Initial_Composition(1:NComp-1)/sum(Initial_Composition);
73       
74EQUATIONS
75"Component Molar Balance"
76        diff(M) = InletVapour.F*InletVapour.z - OutletLiquid.F*OutletLiquid.z- OutletVapour.F*OutletVapour.z;
77
78"Energy Balance"
79        diff(E) = InletVapour.F*InletVapour.h - OutletLiquid.F*OutletLiquid.h- OutletVapour.F*OutletVapour.h + InletQ;
80
81"Molar Holdup"
82        M = ML*OutletLiquid.z + MV*OutletVapour.z;
83       
84"Energy Holdup"
85        E = ML*OutletLiquid.h + MV*OutletVapour.h - OutletVapour.P*V;
86       
87"Mol fraction normalisation"
88        sum(OutletLiquid.z)=1.0;
89        sum(OutletLiquid.z)=sum(OutletVapour.z);
90
91"Liquid Volume"
92        vL = PP.LiquidVolume(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z);
93       
94"Vapour Volume"
95        vV = PP.VapourVolume(OutletVapour.T, OutletVapour.P, OutletVapour.z);
96
97"Chemical Equilibrium"
98        PP.LiquidFugacityCoefficient(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z)*OutletLiquid.z =
99                PP.VapourFugacityCoefficient(OutletVapour.T, OutletVapour.P, OutletVapour.z)*OutletVapour.z;
100
101"Thermal Equilibrium"
102        OutletLiquid.T = OutletVapour.T;
103
104"Mechanical Equilibrium"
105        OutletVapour.P = OutletLiquid.P;
106
107"Geometry Constraint"
108        V = ML*vL + MV*vV;
109
110"Level of liquid phase"
111        Level = ML*vL/Across;
112
113end
114
115
116#*----------------------------------------------------------------------
117* Model of a  Steady State condenser with no thermodynamics equilibrium
118*---------------------------------------------------------------------*#
119Model condenserSteady
120        ATTRIBUTES
121        Pallete         = true;
122        Icon            = "icon/CondenserSteady";
123        Brief           = "Model of a  Steady State condenser with no thermodynamics equilibrium.";
124        Info            =
125"== Assumptions ==
126* perfect mixing of both phases;
127* no thermodynamics equilibrium.
128       
129== Specify ==
130* the inlet stream;
131* the pressure drop in the condenser;
132* the heat supply.
133";
134
135PARAMETERS
136        outer PP                as Plugin       (Brief = "External Physical Properties", Type="PP");
137        outer NComp as Integer;
138
139VARIABLES
140in      InletVapour             as stream                               (Brief="Vapour inlet stream", PosX=0.3431, PosY=0, Symbol="_{inV}");
141out     OutletLiquid as liquid_stream           (Brief="Liquid outlet stream", PosX=0.34375, PosY=1, Symbol="_{outL}");
142in      InletQ          as power                                (Brief="Cold supplied", PosX=1, PosY=0.5974, Symbol="_{in}");
143        DP                      as press_delta          (Brief="Pressure Drop in the condenser",Default=0);
144
145EQUATIONS
146
147"Molar Balance"
148        InletVapour.F = OutletLiquid.F;
149        InletVapour.z = OutletLiquid.z;
150
151"Energy Balance"
152        InletVapour.F*InletVapour.h = OutletLiquid.F*OutletLiquid.h + InletQ;
153
154"Pressure"
155        DP = InletVapour.P - OutletLiquid.P;
156
157end
158
159#*-------------------------------------------------------------------
160* Condenser with reaction in liquid phase
161*--------------------------------------------------------------------*#
162Model condenserReact
163        ATTRIBUTES
164        Pallete         = false;
165        Icon            = "icon/Condenser";
166        Brief           = "Model of a Condenser with reaction in liquid phase.";
167        Info            =
168"== Assumptions ==
169* perfect mixing of both phases;
170* thermodynamics equilibrium;
171* the reaction only takes place in liquid phase.
172       
173== Specify ==
174* the reaction related variables;
175* the inlet stream;
176* the outlet flows: OutletVapour.F and OutletLiquid.F;
177* the heat supply.
178
179== Initial Conditions ==
180* the condenser temperature (OutletLiquid.T);
181* the condenser liquid level (Level);
182* (NoComps - 1) OutletLiquid (OR OutletVapour) compositions.
183";
184       
185PARAMETERS
186        outer PP        as Plugin(Type="PP");
187        outer NComp as Integer;
188       
189        V               as volume (Brief="Condenser total volume");
190        Across  as area         (Brief="Cross Section Area of reboiler");
191
192        stoic(NComp)    as Real                 (Brief="Stoichiometric matrix");
193        Hr                              as energy_mol;
194        Initial_Level                           as length                       (Brief="Initial Level of liquid phase");
195        Initial_Temperature                     as temperature          (Brief="Initial Temperature of Condenser");
196        Initial_Composition(NComp)      as fraction             (Brief="Initial Liquid Composition");
197       
198VARIABLES
199
200in      InletVapour             as stream                       (Brief="Vapour inlet stream", PosX=0.1164, PosY=0, Symbol="_{inV}");
201out     OutletLiquid    as liquid_stream        (Brief="Liquid outlet stream", PosX=0.4513, PosY=1, Symbol="_{outL}");
202out     OutletVapour    as vapour_stream        (Brief="Vapour outlet stream", PosX=0.4723, PosY=0, Symbol="_{outV}");
203        InletQ          as power                        (Brief="Cold supplied", PosX=1, PosY=0.6311, Symbol="_{in}");
204
205        M(NComp)        as mol                  (Brief="Molar Holdup in the tray");
206        ML                      as mol                  (Brief="Molar liquid holdup");
207        MV                      as mol                  (Brief="Molar vapour holdup");
208        E                       as energy               (Brief="Total Energy Holdup on tray");
209        vL                      as volume_mol   (Brief="Liquid Molar Volume");
210        vV                      as volume_mol   (Brief="Vapour Molar volume");
211        Level           as length               (Brief="Level of liquid phase");
212        Vol             as volume;
213        r3                      as reaction_mol (Brief="Reaction Rates", DisplayUnit = 'mol/l/s');
214        C(NComp)        as conc_mol     (Brief="Molar concentration", Lower = -1);
215
216INITIAL
217
218        Level                                   = Initial_Level;
219        OutletLiquid.T                          = Initial_Temperature;
220        OutletLiquid.z(1:NComp-1)       = Initial_Composition(1:NComp-1)/sum(Initial_Composition);
221
222EQUATIONS
223"Molar Concentration"
224        OutletLiquid.z = vL * C;
225       
226"Reaction"
227        r3 = exp(-7150*'K'/OutletLiquid.T)*(4.85e4*C(1)*C(2) - 1.23e4*C(3)*C(4)) * 'l/mol/s';
228       
229"Component Molar Balance"
230        diff(M) = InletVapour.F*InletVapour.z - OutletLiquid.F*OutletLiquid.z - OutletVapour.F*OutletVapour.z + stoic*r3*ML*vL;
231
232"Energy Balance"
233        diff(E) = InletVapour.F*InletVapour.h - OutletLiquid.F*OutletLiquid.h- OutletVapour.F*OutletVapour.h + InletQ + Hr * r3 * ML*vL;
234
235"Molar Holdup"
236        M = ML*OutletLiquid.z + MV*OutletVapour.z;
237       
238"Energy Holdup"
239        E = ML*OutletLiquid.h + MV*OutletVapour.h - OutletVapour.P*V;
240       
241"Mol fraction normalisation"
242        sum(OutletLiquid.z)=1.0;
243
244"Liquid Volume"
245        vL = PP.LiquidVolume(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z);
246
247"Vapour Volume"
248        vV = PP.VapourVolume(OutletVapour.T, OutletVapour.P, OutletVapour.z);
249
250"Thermal Equilibrium"
251        OutletLiquid.T = OutletVapour.T;
252
253"Mechanical Equilibrium"
254        OutletVapour.P = OutletLiquid.P;
255
256"Geometry Constraint"
257        V = ML*vL + MV*vV;
258
259        Vol = ML*vL;
260       
261"Level of liquid phase"
262        Level = ML*vL/Across;
263       
264"Chemical Equilibrium"
265        PP.LiquidFugacityCoefficient(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z)*OutletLiquid.z =
266        PP.VapourFugacityCoefficient(OutletVapour.T, OutletVapour.P, OutletVapour.z)*OutletVapour.z;
267
268        sum(OutletLiquid.z)=sum(OutletVapour.z);
269
270end
271
272Model condenser_column
273        ATTRIBUTES
274        Pallete         = true;
275        Icon            = "icon/Condenser_column2";
276        Brief           = "Model of a  dynamic condenser with control.";
277        Info            =
278"== Assumptions ==
279* perfect mixing of both phases;
280* thermodynamics equilibrium.
281       
282== Specify ==
283* the inlet stream;
284* the outlet flows: OutletVapour.F and OutletLiquid.F;
285* the model requires an energy stream.
286       
287== Initial Conditions ==
288* Initial_Temperature :  the condenser temperature (OutletLiquid.T);
289* Initial_Level : the condenser liquid level (Level);
290* Initial_Composition : (NoComps) OutletLiquid compositions.
291";     
292       
293PARAMETERS
294        outer PP                        as Plugin       (Brief = "External Physical Properties", Type="PP");
295        outer NComp     as Integer (Brief="Number of Components");
296
297        V                       as volume       (Brief="Condenser total volume");
298        Across  as area                 (Brief="Cross Section Area of condenser");
299       
300        Initial_Level                                                           as length                               (Brief="Initial Level of liquid phase");
301        Initial_Temperature                                     as temperature  (Brief="Initial Temperature of Condenser");
302        Initial_Composition(NComp)      as positive                     (Brief="Initial Liquid Composition", Lower=1E-6);
303       
304VARIABLES
305
306in              InletVapour             as stream                                       (Brief="Vapour inlet stream", PosX=0, PosY=0.5, Symbol="_{inV}");
307out     OutletLiquid    as liquid_stream                (Brief="Liquid outlet stream", PosX=0.5, PosY=1, Symbol="_{outL}");
308out     OutletVapour    as vapour_stream                (Brief="Vapour outlet stream", PosX=0.5, PosY=0, Symbol="_{outV}");
309in              InletQ                          as power                                        (Brief="Heat supplied", Protected = true, PosX=1, PosY=0.6, Symbol="_{in}");
310
311        out     TCI as control_signal   (Brief="Temperature  Indicator of Condenser", Protected = true, PosX=1, PosY=0.40);
312        out     LCI as control_signal   (Brief="Level  Indicator of Condenser", Protected = true, PosX=1, PosY=0.25);
313        out     PCI as control_signal   (Brief="Pressure  Indicator of Condenser", Protected = true, PosX=1, PosY=0.10);
314
315        M(NComp)        as mol                                  (Brief="Molar Holdup in the tray");
316        ML                              as mol                                  (Brief="Molar liquid holdup");
317        MV                              as mol                                  (Brief="Molar vapour holdup");
318        E                                       as energy                       (Brief="Total Energy Holdup on tray");
319        vL                              as volume_mol   (Brief="Liquid Molar Volume");
320        vV                              as volume_mol   (Brief="Vapour Molar volume");
321        Level                   as length                               (Brief="Level of liquid phase");
322
323INITIAL
324
325"Initial Level"
326        Level                                                                   = Initial_Level;
327
328"Initial Temperature"
329        OutletLiquid.T                                          = Initial_Temperature;
330
331"Initial Composition"
332        OutletLiquid.z(1:NComp-1)   = Initial_Composition(1:NComp-1)/sum(Initial_Composition);
333       
334EQUATIONS
335"Component Molar Balance"
336        diff(M) = InletVapour.F*InletVapour.z - OutletLiquid.F*OutletLiquid.z- OutletVapour.F*OutletVapour.z;
337
338"Energy Balance"
339        diff(E) = InletVapour.F*InletVapour.h - OutletLiquid.F*OutletLiquid.h- OutletVapour.F*OutletVapour.h + InletQ;
340
341"Molar Holdup"
342        M = ML*OutletLiquid.z + MV*OutletVapour.z;
343       
344"Energy Holdup"
345        E = ML*OutletLiquid.h + MV*OutletVapour.h - OutletVapour.P*V;
346       
347"Mol fraction normalisation"
348        sum(OutletLiquid.z)=1.0;
349
350"Mol fraction Constraint"
351        sum(OutletLiquid.z)=sum(OutletVapour.z);
352
353"Liquid Volume"
354        vL = PP.LiquidVolume(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z);
355       
356"Vapour Volume"
357        vV = PP.VapourVolume(OutletVapour.T, OutletVapour.P, OutletVapour.z);
358
359"Chemical Equilibrium"
360        PP.LiquidFugacityCoefficient(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z)*OutletLiquid.z =
361                PP.VapourFugacityCoefficient(OutletVapour.T, OutletVapour.P, OutletVapour.z)*OutletVapour.z;
362
363"Thermal Equilibrium"
364        OutletLiquid.T = OutletVapour.T;
365
366"Mechanical Equilibrium"
367        OutletVapour.P = OutletLiquid.P;
368
369"Geometry Constraint"
370        V = ML*vL + MV*vV;
371
372"Level of liquid phase"
373        Level = ML*vL/Across;
374
375"Temperature indicator"
376        TCI * 'K' = OutletLiquid.T;
377
378"Pressure indicator"
379        PCI * 'atm' = OutletLiquid.P;
380
381"Level indicator"
382        LCI*V = Level*Across;
383       
384end
Note: See TracBrowser for help on using the repository browser.