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

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

control ports position of condenser

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