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

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

fixed initial condition for Level indicator

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