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

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

condenser: parameter changed to variable

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