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

Last change on this file since 893 was 893, checked in by mamuller, 13 years ago

added simple model for subcooled stationary condensator

File size: 35.8 KB
Line 
1<<<<<<< .mine
2#*-------------------------------------------------------------------
3* EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC.
4*
5* This LIBRARY is free software; you can distribute it and/or modify
6* it under the therms of the ALSOC FREE LICENSE as available at
7* http://www.enq.ufrgs.br/alsoc.
8*
9* EMSO Copyright (C) 2004 - 2007 ALSOC, original code
10* from http://www.rps.eng.br Copyright (C) 2002-2004.
11* All rights reserved.
12*
13* EMSO is distributed under the therms of the ALSOC LICENSE as
14* available at http://www.enq.ufrgs.br/alsoc.
15*
16*----------------------------------------------------------------------
17* Author: Paula B. Staudt
18* $Id: condenser.mso 555 2008-07-18 19:01:13Z rafael $
19*--------------------------------------------------------------------*#
20
21using "tank";
22
23Model condenserSteady
24
25ATTRIBUTES
26        Pallete         = true;
27        Icon            = "icon/CondenserSteady";
28        Brief           = "Model of a  Steady State condenser with no thermodynamics equilibrium.";
29        Info            =
30"== ASSUMPTIONS ==
31* perfect mixing of both phases;
32* no thermodynamics equilibrium.
33
34== SET ==
35* the pressure drop in the condenser;
36
37== SPECIFY ==
38* the InletVapour stream;
39* the InletQ (the model requires an energy stream, also you can use a controller for setting the heat duty using the heat_flow model).
40
41== OPTIONAL ==
42* the condenser model has two control ports
43** TI OutletLiquid Temperature Indicator;
44** PI OutletLiquid Pressure Indicator;
45";
46
47PARAMETERS
48        outer PP        as Plugin       (Brief = "External Physical Properties", Type="PP");
49        outer NComp as Integer  (Brief = "Number of Components");
50
51        Pdrop   as press_delta  (Brief="Pressure Drop in the condenser",Default=0, Symbol="\Delta _P");
52
53VARIABLES
54        in      InletVapour     as stream                       (Brief="Vapour inlet stream", PosX=0.16, PosY=0, Symbol="_{in}^{Vapour}");
55        out     OutletLiquid    as liquid_stream        (Brief="Liquid outlet stream", PosX=0.53, PosY=1, Symbol="_{out}^{Liquid}");
56        in      InletQ                  as power                        (Brief="Heat Duty", PosX=1, PosY=0.08, Symbol="Q_{in}",Protected=true);
57
58        Tbubble as temperature  (Brief ="Bubble Temperature",Protected=true, Symbol ="T_{bubble}");
59        Deg_Subcooled   as temp_delta   (Brief ="Degrees subcooled",Symbol ="\Delta T_{subcooled}");
60
61        out     TI as control_signal    (Brief="Temperature  Indicator of Condenser", Protected = true, PosX=0.50, PosY=0);
62        out     PI as control_signal    (Brief="Pressure  Indicator of Condenser", Protected = true, PosX=0.32, PosY=0);
63
64EQUATIONS
65
66"Molar Flow Balance"
67        InletVapour.F = OutletLiquid.F;
68
69"Molar Composition Balance"
70        InletVapour.z = OutletLiquid.z;
71
72"Energy Balance"
73        InletVapour.F*InletVapour.h  + InletQ = OutletLiquid.F*OutletLiquid.h;
74
75"Pressure Drop"
76        OutletLiquid.P = InletVapour.P - Pdrop;
77
78"Bubble Temperature"
79        Tbubble = PP.BubbleT(OutletLiquid.P,OutletLiquid.z);
80
81"Temperature"
82        OutletLiquid.T = Tbubble-Deg_Subcooled;
83
84"Temperature indicator"
85        TI * 'K' = OutletLiquid.T;
86
87"Pressure indicator"
88        PI * 'atm' = OutletLiquid.P;
89
90end
91
92Model condenserSteady_fakeH
93
94ATTRIBUTES
95        Pallete         = true;
96        Icon            = "icon/CondenserSteady";
97        Brief           = "Model of a  Steady State condenser with fake calculation of outlet conditions.";
98        Info            =
99"Model of a  Steady State condenser with fake calculation of output temperature, but with a real
100calculation of the output stream enthalpy.
101
102== ASSUMPTIONS ==
103* perfect mixing of both phases;
104* no thermodynamics equilibrium.
105
106== SET ==
107* the fake Outlet temperature ;
108* the pressure drop in the condenser;
109
110== SPECIFY ==
111* the InletVapour stream;
112* the InletQ (the model requires an energy stream, also you can use a controller for setting the heat duty using the heat_flow model).
113
114== OPTIONAL ==
115* the condenser model has two control ports
116** TI OutletLiquid Temperature Indicator;
117** PI OutletLiquid Pressure Indicator;
118";
119
120PARAMETERS
121        outer PP        as Plugin       (Brief = "External Physical Properties", Type="PP");
122        outer NComp as Integer  (Brief = "Number of Components");
123
124        Pdrop   as press_delta  (Brief="Pressure Drop in the condenser",Default=0, Symbol="\Delta _P");
125        Fake_Temperature                as temperature  (Brief="Fake temperature", Symbol = "T_{fake}");
126
127
128VARIABLES
129        in      InletVapour     as stream       (Brief="Vapour inlet stream", PosX=0.16, PosY=0, Symbol="_{in}^{Vapour}");
130        out     OutletLiquid    as stream       (Brief="Liquid outlet stream", PosX=0.53, PosY=1, Symbol="_{out}^{Liquid}");
131        in      InletQ                  as power        (Brief="Heat Duty", PosX=1, PosY=0.08, Symbol="Q_{in}",Protected=true);
132
133        out     TI as control_signal    (Brief="Temperature  Indicator of Condenser", Protected = true, PosX=0.50, PosY=0);
134        out     PI as control_signal    (Brief="Pressure  Indicator of Condenser", Protected = true, PosX=0.32, PosY=0);
135
136EQUATIONS
137
138"Molar Flow Balance"
139        InletVapour.F = OutletLiquid.F;
140
141"Molar Composition Balance"
142        InletVapour.z = OutletLiquid.z;
143
144"Energy Balance"
145        InletVapour.F*InletVapour.h  + InletQ = OutletLiquid.F*OutletLiquid.h;
146
147"Pressure Drop"
148        OutletLiquid.P = InletVapour.P - Pdrop;
149
150"Fake Temperature"
151        OutletLiquid.T = Fake_Temperature;
152
153"Vapourisation Fraction"
154        OutletLiquid.v = 0;
155       
156"Temperature indicator"
157        TI * 'K' = OutletLiquid.T;
158
159"Pressure indicator"
160        PI * 'atm' = OutletLiquid.P;
161
162end
163
164Model condenserReact
165        ATTRIBUTES
166        Pallete         = false;
167        Icon            = "icon/Condenser";
168        Brief           = "Model of a Condenser with reaction in liquid phase.";
169        Info            =
170"== Assumptions ==
171* perfect mixing of both phases;
172* thermodynamics equilibrium;
173* the reaction only takes place in liquid phase.
174       
175== Specify ==
176* the reaction related variables;
177* the inlet stream;
178* the outlet flows: OutletVapour.F and OutletLiquid.F;
179* the heat supply.
180
181== Initial Conditions ==
182* the condenser temperature (OutletLiquid.T);
183* the condenser liquid level (Level);
184* (NoComps - 1) OutletLiquid (OR OutletVapour) compositions.
185";
186       
187PARAMETERS
188        outer PP        as Plugin(Type="PP");
189        outer NComp as Integer;
190       
191        V               as volume (Brief="Condenser total volume");
192        Across  as area         (Brief="Cross Section Area of reboiler");
193
194        stoic(NComp)    as Real                 (Brief="Stoichiometric matrix");
195        Hr                              as energy_mol;
196        Initial_Level                           as length                       (Brief="Initial Level of liquid phase");
197        Initial_Temperature                     as temperature          (Brief="Initial Temperature of Condenser");
198        Initial_Composition(NComp)      as fraction             (Brief="Initial Liquid Composition");
199       
200VARIABLES
201
202in      InletVapour             as stream                       (Brief="Vapour inlet stream", PosX=0.1164, PosY=0, Symbol="_{inV}");
203out     OutletLiquid    as liquid_stream        (Brief="Liquid outlet stream", PosX=0.4513, PosY=1, Symbol="_{outL}");
204out     OutletVapour    as vapour_stream        (Brief="Vapour outlet stream", PosX=0.4723, PosY=0, Symbol="_{outV}");
205        InletQ          as power                        (Brief="Cold supplied", PosX=1, PosY=0.6311, Symbol="_{in}");
206
207        M(NComp)        as mol                  (Brief="Molar Holdup in the tray");
208        ML                      as mol                  (Brief="Molar liquid holdup");
209        MV                      as mol                  (Brief="Molar vapour holdup");
210        E                       as energy               (Brief="Total Energy Holdup on tray");
211        vL                      as volume_mol   (Brief="Liquid Molar Volume");
212        vV                      as volume_mol   (Brief="Vapour Molar volume");
213        Level           as length               (Brief="Level of liquid phase");
214        Vol             as volume;
215        r3                      as reaction_mol (Brief="Reaction Rates", DisplayUnit = 'mol/l/s');
216        C(NComp)        as conc_mol     (Brief="Molar concentration", Lower = -1);
217
218INITIAL
219
220        Level                                   = Initial_Level;
221        OutletLiquid.T                          = Initial_Temperature;
222        OutletLiquid.z(1:NComp-1)       = Initial_Composition(1:NComp-1)/sum(Initial_Composition);
223
224EQUATIONS
225"Molar Concentration"
226        OutletLiquid.z = vL * C;
227       
228"Reaction"
229        r3 = exp(-7150*'K'/OutletLiquid.T)*(4.85e4*C(1)*C(2) - 1.23e4*C(3)*C(4)) * 'l/mol/s';
230       
231"Component Molar Balance"
232        diff(M) = InletVapour.F*InletVapour.z - OutletLiquid.F*OutletLiquid.z - OutletVapour.F*OutletVapour.z + stoic*r3*ML*vL;
233
234"Energy Balance"
235        diff(E) = InletVapour.F*InletVapour.h - OutletLiquid.F*OutletLiquid.h- OutletVapour.F*OutletVapour.h + InletQ + Hr * r3 * ML*vL;
236
237"Molar Holdup"
238        M = ML*OutletLiquid.z + MV*OutletVapour.z;
239       
240"Energy Holdup"
241        E = ML*OutletLiquid.h + MV*OutletVapour.h - OutletVapour.P*V;
242       
243"Mol fraction normalisation"
244        sum(OutletLiquid.z)=1.0;
245
246"Liquid Volume"
247        vL = PP.LiquidVolume(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z);
248
249"Vapour Volume"
250        vV = PP.VapourVolume(OutletVapour.T, OutletVapour.P, OutletVapour.z);
251
252"Thermal Equilibrium"
253        OutletLiquid.T = OutletVapour.T;
254
255"Mechanical Equilibrium"
256        OutletVapour.P = OutletLiquid.P;
257
258"Geometry Constraint"
259        V = ML*vL + MV*vV;
260
261        Vol = ML*vL;
262       
263"Level of liquid phase"
264        Level = ML*vL/Across;
265       
266"Chemical Equilibrium"
267        PP.LiquidFugacityCoefficient(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z)*OutletLiquid.z =
268        PP.VapourFugacityCoefficient(OutletVapour.T, OutletVapour.P, OutletVapour.z)*OutletVapour.z;
269
270        sum(OutletLiquid.z)=sum(OutletVapour.z);
271
272end
273
274Model condenser
275
276ATTRIBUTES
277        Pallete         = true;
278        Icon            = "icon/Condenser";
279        Brief           = "Model of a  dynamic condenser with control.";
280        Info            =
281"== ASSUMPTIONS ==
282* perfect mixing of both phases;
283* thermodynamics equilibrium.
284       
285== SPECIFY ==
286* the InletVapour stream;
287* the outlet flows: OutletVapour.F and OutletLiquid.F;
288* the InletQ (the model requires an energy stream, also you can use a controller for setting the heat duty using the heat_flow model).
289
290== OPTIONAL ==
291* the condenser model has three control ports
292** TI OutletLiquid Temperature Indicator;
293** PI OutletLiquid Pressure Indicator;
294** LI Level Indicator of Condenser;
295
296== INITIAL CONDITIONS ==
297* Initial_Temperature :  the condenser temperature (OutletLiquid.T);
298* Levelpercent_Initial : the condenser liquid level in percent (LI);
299* Initial_Composition : (NoComps) OutletLiquid compositions.
300";     
301       
302PARAMETERS
303        outer PP                as Plugin       (Brief = "External Physical Properties", Type="PP");
304        outer NComp     as Integer (Brief="Number of Components");
305       
306        Mw(NComp)       as molweight    (Brief = "Component Mol Weight",Hidden=true);
307        low_flow        as flow_mol     (Brief = "Low Flow",Default = 1E-6, Hidden=true);
308        zero_flow       as flow_mol     (Brief = "No Flow",Default = 0, Hidden=true);
309        KfConst         as area                 (Brief="Constant for K factor pressure drop", Default = 1, Hidden=true);
310       
311        VapourFlow      as Switcher     (Brief="Vapour Flow", Valid = ["on", "off"], Default = "on",Hidden=true);
312
313        Kfactor as positive (Brief="K factor for pressure drop", Lower = 1E-8, Default = 1E-3);
314       
315        Levelpercent_Initial            as positive     (Brief="Initial liquid height in Percent", Default = 0.70);
316        Initial_Temperature                     as temperature  (Brief="Initial Temperature of Condenser");
317        Initial_Composition(NComp)      as positive     (Brief="Initial Liquid Composition", Lower=1E-6);
318       
319VARIABLES
320
321        Geometry                as VesselVolume (Brief="Vessel Geometry", Symbol=" ");
322
323in      InletVapour     as stream                       (Brief="Vapour inlet stream", PosX=0.13, PosY=0, Symbol="_{in}^{Vapour}");
324out     OutletLiquid    as liquid_stream        (Brief="Liquid outlet stream", PosX=0.35, PosY=1, Symbol="_{out}^{Liquid}");
325out     OutletVapour    as vapour_stream        (Brief="Vapour outlet stream", PosX=0.54, PosY=0, Symbol="_{out}^{Vapour}");
326in      InletQ                  as power                        (Brief="Heat supplied", Protected = true, PosX=1, PosY=0.08, Symbol="Q_{in}");
327
328        out     TI as control_signal    (Brief="Temperature  Indicator of Condenser", Protected = true, PosX=0.33, PosY=0);
329        out     LI as control_signal    (Brief="Level  Indicator of Condenser", Protected = true, PosX=0.43, PosY=0);
330        out     PI as control_signal    (Brief="Pressure  Indicator of Condenser", Protected = true, PosX=0.25, PosY=0);
331
332        M(NComp)        as mol                  (Brief="Molar Holdup in the tray", Protected = true);
333        ML                      as mol                  (Brief="Molar liquid holdup", Protected = true);
334        MV                      as mol                  (Brief="Molar vapour holdup", Protected = true);
335        E                       as energy               (Brief="Total Energy Holdup on tray", Protected = true);
336        vL                      as volume_mol   (Brief="Liquid Molar Volume", Protected = true);
337        vV                      as volume_mol   (Brief="Vapour Molar volume", Protected = true);
338        rho                     as dens_mass    (Brief ="Inlet Vapour Mass Density",Hidden=true, Symbol ="\rho");
339        Pdrop           as press_delta  (Brief = "Pressure Drop", DisplayUnit = 'kPa', Symbol ="\Delta P", Protected=true);
340
341SET
342        Mw   = PP.MolecularWeight();
343        low_flow = 1E-6 * 'kmol/h';
344        zero_flow = 0 * 'kmol/h';
345        KfConst = 1*'m^2';
346       
347INITIAL
348
349"Initial level Percent"
350        LI = Levelpercent_Initial;
351
352"Initial Temperature"
353        OutletLiquid.T  = Initial_Temperature;
354
355"Initial Composition"
356        OutletLiquid.z(1:NComp-1) = Initial_Composition(1:NComp-1)/sum(Initial_Composition);
357
358EQUATIONS
359
360switch VapourFlow
361
362case "on":
363        InletVapour.F*sum(Mw*InletVapour.z) = Kfactor *sqrt(Pdrop*rho)*KfConst;
364
365        when InletVapour.F < low_flow switchto "off";
366
367case "off":
368        InletVapour.F = zero_flow;
369
370        when InletVapour.P > OutletLiquid.P switchto "on";
371
372end
373
374"Component Molar Balance"
375        diff(M) = InletVapour.F*InletVapour.z - OutletLiquid.F*OutletLiquid.z- OutletVapour.F*OutletVapour.z;
376
377"Energy Balance"
378        diff(E) = InletVapour.F*InletVapour.h - OutletLiquid.F*OutletLiquid.h- OutletVapour.F*OutletVapour.h + InletQ;
379
380"Molar Holdup"
381        M = ML*OutletLiquid.z + MV*OutletVapour.z;
382       
383"Energy Holdup"
384        E = ML*OutletLiquid.h + MV*OutletVapour.h - OutletVapour.P*Geometry.Vtotal;
385       
386"Mol fraction normalisation"
387        sum(OutletLiquid.z)=1.0;
388
389"Mol fraction Constraint"
390        sum(OutletLiquid.z)=sum(OutletVapour.z);
391
392"Liquid Volume"
393        vL = PP.LiquidVolume(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z);
394       
395"Vapour Volume"
396        vV = PP.VapourVolume(OutletVapour.T, OutletVapour.P, OutletVapour.z);
397
398"Inlet Vapour Density"
399        rho = PP.VapourDensity(InletVapour.T, InletVapour.P, InletVapour.z);
400       
401"Chemical Equilibrium"
402        PP.LiquidFugacityCoefficient(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z)*OutletLiquid.z =
403                PP.VapourFugacityCoefficient(OutletVapour.T, OutletVapour.P, OutletVapour.z)*OutletVapour.z;
404
405"Thermal Equilibrium"
406        OutletLiquid.T = OutletVapour.T;
407
408"Mechanical Equilibrium"
409        OutletVapour.P = OutletLiquid.P;
410
411"Pressure Drop"
412        OutletLiquid.P  = InletVapour.P - Pdrop;
413
414"Geometry Constraint"
415        Geometry.Vtotal = ML*vL + MV*vV;
416
417"Liquid Level"
418        ML * vL = Geometry.Vfilled;
419
420"Temperature indicator"
421        TI * 'K' = OutletLiquid.T;
422
423"Pressure indicator"
424        PI * 'atm' = OutletLiquid.P;
425
426"Level indicator"
427        LI*Geometry.Vtotal= Geometry.Vfilled;
428       
429end
430
431
432Model condenserSubcooled
433
434ATTRIBUTES
435        Pallete         = true;
436        Icon            = "icon/CondenserSteady";
437        Brief           = "Model of a  Steady State total condenser with specified temperature outlet conditions.";
438        Info            =
439"A simple model of a simple Steady State total condenser with specified temperature (or subcooling degree), with a real
440calculation of the output stream enthalpy.
441
442== ASSUMPTIONS ==
443* perfect mixing of both phases;
444* saturated vapour at the Inlet.
445* no thermodynamics equilibrium.
446
447== SET ==
448* the fake Outlet temperature ;
449* the pressure drop in the condenser;
450
451== SPECIFY ==
452* the InletVapour stream;
453* the subcooled temperature OR the the degree of subcooling.
454
455== OPTIONAL ==
456* the condenser model has two control ports
457** TI OutletLiquid Temperature Indicator;
458** PI OutletLiquid Pressure Indicator;
459";
460
461PARAMETERS
462        outer PP        as Plugin       (Brief = "External Physical Properties", Type="PP");
463        outer NComp as Integer  (Brief = "Number of Components");
464
465        Pdrop   as press_delta  (Brief="Pressure Drop in the condenser",Default=0, Symbol="\Delta _P");
466        #Fake_Temperature               as temperature  (Brief="Fake temperature", Symbol = "T_{fake}");
467
468
469VARIABLES
470        in      InletVapour     as stream       (Brief="Vapour inlet stream", PosX=0.16, PosY=0, Symbol="_{in}^{Vapour}");
471        out     OutletLiquid    as stream       (Brief="Liquid outlet stream", PosX=0.53, PosY=1, Symbol="_{out}^{Liquid}");
472        #in     InletQ                  as power        (Brief="Heat Duty", PosX=1, PosY=0.08, Symbol="Q_{in}",Protected=true);
473        T_sub                           as temperature (Brief="Condensate temperature (subcooled)", Symbol = "T_{sub}");
474        #SubcoolingDegree        as temp_delta (Brief="Subcooling Degree", Symbol = "\Delta _{sub}");
475        CondenserDuty           as power (Brief="Calculated condenser duty for desired subcooling", Protected = true, Symbol = "Q_{cond}");
476
477        out     TI as control_signal    (Brief="Temperature  Indicator of Condenser", Protected = true, PosX=0.50, PosY=0);
478        out     PI as control_signal    (Brief="Pressure  Indicator of Condenser", Protected = true, PosX=0.32, PosY=0);
479
480EQUATIONS
481
482"Molar Flow Balance"
483        InletVapour.F = OutletLiquid.F;
484
485"Molar Composition Balance"
486        InletVapour.z = OutletLiquid.z;
487
488#"Energy Balance"
489        #InletVapour.F*InletVapour.h  + InletQ = OutletLiquid.F*OutletLiquid.h;
490
491"Pressure Drop"
492        OutletLiquid.P = InletVapour.P - Pdrop;
493
494"Subcooled Temperature"
495        OutletLiquid.T = T_sub;
496       
497#"Degree of subcooling" 
498 #       SubcoolingDegree = InletVapour.T - T_sub;
499
500"Liquid enthalpy"
501        OutletLiquid.h = PP.LiquidEnthalpy(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z);
502       
503"Condenser Duty"
504        CondenserDuty = OutletLiquid.F*OutletLiquid.h - InletVapour.F*InletVapour.h;
505       
506"Vapourisation Fraction"
507        OutletLiquid.v = 0;
508       
509"Temperature indicator"
510        TI * 'K' = OutletLiquid.T;
511
512"Pressure indicator"
513        PI * 'atm' = OutletLiquid.P;
514
515end
516
517
518=======
519#*-------------------------------------------------------------------
520* EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC.
521*
522* This LIBRARY is free software; you can distribute it and/or modify
523* it under the therms of the ALSOC FREE LICENSE as available at
524* http://www.enq.ufrgs.br/alsoc.
525*
526* EMSO Copyright (C) 2004 - 2007 ALSOC, original code
527* from http://www.rps.eng.br Copyright (C) 2002-2004.
528* All rights reserved.
529*
530* EMSO is distributed under the therms of the ALSOC LICENSE as
531* available at http://www.enq.ufrgs.br/alsoc.
532*
533*----------------------------------------------------------------------
534* Author: Paula B. Staudt
535* $Id: condenser.mso 555 2008-07-18 19:01:13Z rafael $
536*--------------------------------------------------------------------*#
537
538using "tank";
539
540Model condenserSteady
541
542ATTRIBUTES
543        Pallete         = true;
544        Icon            = "icon/CondenserSteady";
545        Brief           = "Model of a  Steady State condenser with no thermodynamics equilibrium.";
546        Info            =
547"== ASSUMPTIONS ==
548* perfect mixing of both phases;
549* no thermodynamics equilibrium.
550
551== SET ==
552* the pressure drop in the condenser;
553
554== SPECIFY ==
555* the InletVapour stream;
556* the InletQ (the model requires an energy stream, also you can use a controller for setting the heat duty using the heat_flow model).
557
558== OPTIONAL ==
559* the condenser model has two control ports
560** TI OutletLiquid Temperature Indicator;
561** PI OutletLiquid Pressure Indicator;
562";
563
564PARAMETERS
565        outer PP        as Plugin       (Brief = "External Physical Properties", Type="PP");
566        outer NComp as Integer  (Brief = "Number of Components");
567
568        Pdrop   as press_delta  (Brief="Pressure Drop in the condenser",Default=0, Symbol="\Delta _P");
569
570VARIABLES
571        in      InletVapour     as stream                       (Brief="Vapour inlet stream", PosX=0.16, PosY=0, Symbol="_{in}^{Vapour}");
572        out     OutletLiquid    as liquid_stream        (Brief="Liquid outlet stream", PosX=0.53, PosY=1, Symbol="_{out}^{Liquid}");
573        in      InletQ                  as power                        (Brief="Heat Duty", PosX=1, PosY=0.08, Symbol="Q_{in}",Protected=true);
574
575        Tbubble as temperature  (Brief ="Bubble Temperature",Protected=true, Symbol ="T_{bubble}");
576        Deg_Subcooled   as temp_delta   (Brief ="Degrees subcooled",Symbol ="\Delta T_{subcooled}");
577
578        out     TI as control_signal    (Brief="Temperature  Indicator of Condenser", Protected = true, PosX=0.50, PosY=0);
579        out     PI as control_signal    (Brief="Pressure  Indicator of Condenser", Protected = true, PosX=0.32, PosY=0);
580
581EQUATIONS
582
583"Molar Flow Balance"
584        InletVapour.F = OutletLiquid.F;
585
586"Molar Composition Balance"
587        InletVapour.z = OutletLiquid.z;
588
589"Energy Balance"
590        InletVapour.F*InletVapour.h  + InletQ = OutletLiquid.F*OutletLiquid.h;
591
592"Pressure Drop"
593        OutletLiquid.P = InletVapour.P - Pdrop;
594
595"Bubble Temperature"
596        Tbubble = PP.BubbleT(OutletLiquid.P,OutletLiquid.z);
597
598"Temperature"
599        OutletLiquid.T = Tbubble-Deg_Subcooled;
600
601"Temperature indicator"
602        TI * 'K' = OutletLiquid.T;
603
604"Pressure indicator"
605        PI * 'atm' = OutletLiquid.P;
606
607end
608
609Model condenserSteady_fakeH
610
611ATTRIBUTES
612        Pallete         = true;
613        Icon            = "icon/CondenserSteady";
614        Brief           = "Model of a  Steady State condenser with fake calculation of outlet conditions.";
615        Info            =
616"Model of a  Steady State condenser with fake calculation of output temperature, but with a real
617calculation of the output stream enthalpy.
618
619== ASSUMPTIONS ==
620* perfect mixing of both phases;
621* no thermodynamics equilibrium.
622
623== SET ==
624* the fake Outlet temperature ;
625* the pressure drop in the condenser;
626
627== SPECIFY ==
628* the InletVapour stream;
629* the InletQ (the model requires an energy stream, also you can use a controller for setting the heat duty using the heat_flow model).
630
631== OPTIONAL ==
632* the condenser model has two control ports
633** TI OutletLiquid Temperature Indicator;
634** PI OutletLiquid Pressure Indicator;
635";
636
637PARAMETERS
638        outer PP        as Plugin       (Brief = "External Physical Properties", Type="PP");
639        outer NComp as Integer  (Brief = "Number of Components");
640
641        Pdrop   as press_delta  (Brief="Pressure Drop in the condenser",Default=0, Symbol="\Delta _P");
642        Fake_Temperature                as temperature  (Brief="Fake temperature", Symbol = "T_{fake}");
643
644
645VARIABLES
646        in      InletVapour     as stream       (Brief="Vapour inlet stream", PosX=0.16, PosY=0, Symbol="_{in}^{Vapour}");
647        out     OutletLiquid    as stream       (Brief="Liquid outlet stream", PosX=0.53, PosY=1, Symbol="_{out}^{Liquid}");
648        in      InletQ                  as power        (Brief="Heat Duty", PosX=1, PosY=0.08, Symbol="Q_{in}",Protected=true);
649
650        out     TI as control_signal    (Brief="Temperature  Indicator of Condenser", Protected = true, PosX=0.50, PosY=0);
651        out     PI as control_signal    (Brief="Pressure  Indicator of Condenser", Protected = true, PosX=0.32, PosY=0);
652
653EQUATIONS
654
655"Molar Flow Balance"
656        InletVapour.F = OutletLiquid.F;
657
658"Molar Composition Balance"
659        InletVapour.z = OutletLiquid.z;
660
661"Energy Balance"
662        InletVapour.F*InletVapour.h  + InletQ = OutletLiquid.F*OutletLiquid.h;
663
664"Pressure Drop"
665        OutletLiquid.P = InletVapour.P - Pdrop;
666
667"Fake Temperature"
668        OutletLiquid.T = Fake_Temperature;
669
670"Vapourisation Fraction"
671        OutletLiquid.v = 0;
672       
673"Temperature indicator"
674        TI * 'K' = OutletLiquid.T;
675
676"Pressure indicator"
677        PI * 'atm' = OutletLiquid.P;
678
679end
680
681Model condenserReact
682        ATTRIBUTES
683        Pallete         = false;
684        Icon            = "icon/Condenser";
685        Brief           = "Model of a Condenser with reaction in liquid phase.";
686        Info            =
687"== Assumptions ==
688* perfect mixing of both phases;
689* thermodynamics equilibrium;
690* the reaction only takes place in liquid phase.
691       
692== Specify ==
693* the reaction related variables;
694* the inlet stream;
695* the outlet flows: OutletVapour.F and OutletLiquid.F;
696* the heat supply.
697
698== Initial Conditions ==
699* the condenser temperature (OutletLiquid.T);
700* the condenser liquid level (Level);
701* (NoComps - 1) OutletLiquid (OR OutletVapour) compositions.
702";
703       
704PARAMETERS
705        outer PP        as Plugin(Type="PP");
706        outer NComp as Integer;
707       
708        V               as volume (Brief="Condenser total volume");
709        Across  as area         (Brief="Cross Section Area of reboiler");
710
711        stoic(NComp)    as Real                 (Brief="Stoichiometric matrix");
712        Hr                              as energy_mol;
713        Initial_Level                           as length                       (Brief="Initial Level of liquid phase");
714        Initial_Temperature                     as temperature          (Brief="Initial Temperature of Condenser");
715        Initial_Composition(NComp)      as fraction             (Brief="Initial Liquid Composition");
716       
717VARIABLES
718
719in      InletVapour             as stream                       (Brief="Vapour inlet stream", PosX=0.1164, PosY=0, Symbol="_{inV}");
720out     OutletLiquid    as liquid_stream        (Brief="Liquid outlet stream", PosX=0.4513, PosY=1, Symbol="_{outL}");
721out     OutletVapour    as vapour_stream        (Brief="Vapour outlet stream", PosX=0.4723, PosY=0, Symbol="_{outV}");
722        InletQ          as power                        (Brief="Cold supplied", PosX=1, PosY=0.6311, Symbol="_{in}");
723
724        M(NComp)        as mol                  (Brief="Molar Holdup in the tray");
725        ML                      as mol                  (Brief="Molar liquid holdup");
726        MV                      as mol                  (Brief="Molar vapour holdup");
727        E                       as energy               (Brief="Total Energy Holdup on tray");
728        vL                      as volume_mol   (Brief="Liquid Molar Volume");
729        vV                      as volume_mol   (Brief="Vapour Molar volume");
730        Level           as length               (Brief="Level of liquid phase");
731        Vol             as volume;
732        r3                      as reaction_mol (Brief="Reaction Rates", DisplayUnit = 'mol/l/s');
733        C(NComp)        as conc_mol     (Brief="Molar concentration", Lower = -1);
734
735INITIAL
736
737        Level                                   = Initial_Level;
738        OutletLiquid.T                          = Initial_Temperature;
739        OutletLiquid.z(1:NComp-1)       = Initial_Composition(1:NComp-1)/sum(Initial_Composition);
740
741EQUATIONS
742"Molar Concentration"
743        OutletLiquid.z = vL * C;
744       
745"Reaction"
746        r3 = exp(-7150*'K'/OutletLiquid.T)*(4.85e4*C(1)*C(2) - 1.23e4*C(3)*C(4)) * 'l/mol/s';
747       
748"Component Molar Balance"
749        diff(M) = InletVapour.F*InletVapour.z - OutletLiquid.F*OutletLiquid.z - OutletVapour.F*OutletVapour.z + stoic*r3*ML*vL;
750
751"Energy Balance"
752        diff(E) = InletVapour.F*InletVapour.h - OutletLiquid.F*OutletLiquid.h- OutletVapour.F*OutletVapour.h + InletQ + Hr * r3 * ML*vL;
753
754"Molar Holdup"
755        M = ML*OutletLiquid.z + MV*OutletVapour.z;
756       
757"Energy Holdup"
758        E = ML*OutletLiquid.h + MV*OutletVapour.h - OutletVapour.P*V;
759       
760"Mol fraction normalisation"
761        sum(OutletLiquid.z)=1.0;
762
763"Liquid Volume"
764        vL = PP.LiquidVolume(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z);
765
766"Vapour Volume"
767        vV = PP.VapourVolume(OutletVapour.T, OutletVapour.P, OutletVapour.z);
768
769"Thermal Equilibrium"
770        OutletLiquid.T = OutletVapour.T;
771
772"Mechanical Equilibrium"
773        OutletVapour.P = OutletLiquid.P;
774
775"Geometry Constraint"
776        V = ML*vL + MV*vV;
777
778        Vol = ML*vL;
779       
780"Level of liquid phase"
781        Level = ML*vL/Across;
782       
783"Chemical Equilibrium"
784        PP.LiquidFugacityCoefficient(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z)*OutletLiquid.z =
785        PP.VapourFugacityCoefficient(OutletVapour.T, OutletVapour.P, OutletVapour.z)*OutletVapour.z;
786
787        sum(OutletLiquid.z)=sum(OutletVapour.z);
788
789end
790
791Model condenser
792
793ATTRIBUTES
794        Pallete         = true;
795        Icon            = "icon/Condenser";
796        Brief           = "Model of a  dynamic condenser with control.";
797        Info            =
798"== ASSUMPTIONS ==
799* perfect mixing of both phases;
800* thermodynamics equilibrium.
801       
802== SPECIFY ==
803* the InletVapour stream;
804* the outlet flows: OutletVapour.F and OutletLiquid.F;
805* the InletQ (the model requires an energy stream, also you can use a controller for setting the heat duty using the heat_flow model).
806
807== OPTIONAL ==
808* the condenser model has three control ports
809** TI OutletLiquid Temperature Indicator;
810** PI OutletLiquid Pressure Indicator;
811** LI Level Indicator of Condenser;
812
813== INITIAL CONDITIONS ==
814* Initial_Temperature :  the condenser temperature (OutletLiquid.T);
815* Levelpercent_Initial : the condenser liquid level in percent (LI);
816* Initial_Composition : (NoComps) OutletLiquid compositions.
817";     
818       
819PARAMETERS
820        outer PP                as Plugin       (Brief = "External Physical Properties", Type="PP");
821        outer NComp     as Integer (Brief="Number of Components");
822       
823        Mw(NComp)       as molweight    (Brief = "Component Mol Weight",Hidden=true);
824        low_flow        as flow_mol     (Brief = "Low Flow",Default = 1E-6, Hidden=true);
825        zero_flow       as flow_mol     (Brief = "No Flow",Default = 0, Hidden=true);
826        KfConst         as area                 (Brief="Constant for K factor pressure drop", Default = 1, Hidden=true);
827       
828        VapourFlow      as Switcher     (Brief="Vapour Flow", Valid = ["on", "off"], Default = "on",Hidden=true);
829
830        Kfactor as positive (Brief="K factor for pressure drop", Lower = 1E-8, Default = 1E-3);
831       
832        Levelpercent_Initial            as positive     (Brief="Initial liquid height in Percent", Default = 0.70);
833        Initial_Temperature                     as temperature  (Brief="Initial Temperature of Condenser");
834        Initial_Composition(NComp)      as positive     (Brief="Initial Liquid Composition", Lower=1E-6);
835       
836VARIABLES
837
838        Geometry                as VesselVolume (Brief="Vessel Geometry", Symbol=" ");
839
840in      InletVapour     as stream                       (Brief="Vapour inlet stream", PosX=0.13, PosY=0, Symbol="_{in}^{Vapour}");
841out     OutletLiquid    as liquid_stream        (Brief="Liquid outlet stream", PosX=0.35, PosY=1, Symbol="_{out}^{Liquid}");
842out     OutletVapour    as vapour_stream        (Brief="Vapour outlet stream", PosX=0.54, PosY=0, Symbol="_{out}^{Vapour}");
843in      InletQ                  as power                        (Brief="Heat supplied", Protected = true, PosX=1, PosY=0.08, Symbol="Q_{in}");
844
845        out     TI as control_signal    (Brief="Temperature  Indicator of Condenser", Protected = true, PosX=0.33, PosY=0);
846        out     LI as control_signal    (Brief="Level  Indicator of Condenser", Protected = true, PosX=0.43, PosY=0);
847        out     PI as control_signal    (Brief="Pressure  Indicator of Condenser", Protected = true, PosX=0.25, PosY=0);
848
849        M(NComp)        as mol                  (Brief="Molar Holdup in the tray", Protected = true);
850        ML                      as mol                  (Brief="Molar liquid holdup", Protected = true);
851        MV                      as mol                  (Brief="Molar vapour holdup", Protected = true);
852        E                       as energy               (Brief="Total Energy Holdup on tray", Protected = true);
853        vL                      as volume_mol   (Brief="Liquid Molar Volume", Protected = true);
854        vV                      as volume_mol   (Brief="Vapour Molar volume", Protected = true);
855        rho                     as dens_mass    (Brief ="Inlet Vapour Mass Density",Hidden=true, Symbol ="\rho");
856        Pdrop           as press_delta  (Brief = "Pressure Drop", DisplayUnit = 'kPa', Symbol ="\Delta P", Protected=true);
857
858SET
859        Mw   = PP.MolecularWeight();
860        low_flow = 1E-6 * 'kmol/h';
861        zero_flow = 0 * 'kmol/h';
862        KfConst = 1*'m^2';
863       
864INITIAL
865
866"Initial level Percent"
867        LI = Levelpercent_Initial;
868
869"Initial Temperature"
870        OutletLiquid.T  = Initial_Temperature;
871
872"Initial Composition"
873        OutletLiquid.z(1:NComp-1) = Initial_Composition(1:NComp-1)/sum(Initial_Composition);
874
875EQUATIONS
876
877switch VapourFlow
878
879case "on":
880        InletVapour.F*sum(Mw*InletVapour.z) = Kfactor *sqrt(Pdrop*rho)*KfConst;
881
882        when InletVapour.F < low_flow switchto "off";
883
884case "off":
885        InletVapour.F = zero_flow;
886
887        when InletVapour.P > OutletLiquid.P switchto "on";
888
889end
890
891"Component Molar Balance"
892        diff(M) = InletVapour.F*InletVapour.z - OutletLiquid.F*OutletLiquid.z- OutletVapour.F*OutletVapour.z;
893
894"Energy Balance"
895        diff(E) = InletVapour.F*InletVapour.h - OutletLiquid.F*OutletLiquid.h- OutletVapour.F*OutletVapour.h + InletQ;
896
897"Molar Holdup"
898        M = ML*OutletLiquid.z + MV*OutletVapour.z;
899       
900"Energy Holdup"
901        E = ML*OutletLiquid.h + MV*OutletVapour.h - OutletVapour.P*Geometry.Vtotal;
902       
903"Mol fraction normalisation"
904        sum(OutletLiquid.z)=1.0;
905
906"Mol fraction Constraint"
907        sum(OutletLiquid.z)=sum(OutletVapour.z);
908
909"Liquid Volume"
910        vL = PP.LiquidVolume(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z);
911       
912"Vapour Volume"
913        vV = PP.VapourVolume(OutletVapour.T, OutletVapour.P, OutletVapour.z);
914
915"Inlet Vapour Density"
916        rho = PP.VapourDensity(InletVapour.T, InletVapour.P, InletVapour.z);
917       
918"Chemical Equilibrium"
919        PP.LiquidFugacityCoefficient(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z)*OutletLiquid.z =
920                PP.VapourFugacityCoefficient(OutletVapour.T, OutletVapour.P, OutletVapour.z)*OutletVapour.z;
921
922"Thermal Equilibrium"
923        OutletLiquid.T = OutletVapour.T;
924
925"Mechanical Equilibrium"
926        OutletVapour.P = OutletLiquid.P;
927
928"Pressure Drop"
929        OutletLiquid.P  = InletVapour.P - Pdrop;
930
931"Geometry Constraint"
932        Geometry.Vtotal = ML*vL + MV*vV;
933
934"Liquid Level"
935        ML * vL = Geometry.Vfilled;
936
937"Temperature indicator"
938        TI * 'K' = OutletLiquid.T;
939
940"Pressure indicator"
941        PI * 'atm' = OutletLiquid.P;
942
943"Level indicator"
944        LI*Geometry.Vtotal= Geometry.Vfilled;
945       
946end
947
948
949Model condenserSubcooled
950
951ATTRIBUTES
952        Pallete         = true;
953        Icon            = "icon/CondenserSteady";
954        Brief           = "Model of a  Steady State total condenser with specified temperature outlet conditions.";
955        Info            =
956"A simple model of a simple Steady State total condenser with specified temperature (or subcooling degree), with a real
957calculation of the output stream enthalpy.
958
959== ASSUMPTIONS ==
960* perfect mixing of both phases;
961* saturated vapour at the Inlet.
962* no thermodynamics equilibrium.
963
964== SET ==
965* the fake Outlet temperature ;
966* the pressure drop in the condenser;
967
968== SPECIFY ==
969* the InletVapour stream;
970* the subcooled temperature OR the the degree of subcooling.
971
972== OPTIONAL ==
973* the condenser model has two control ports
974** TI OutletLiquid Temperature Indicator;
975** PI OutletLiquid Pressure Indicator;
976";
977
978PARAMETERS
979        outer PP        as Plugin       (Brief = "External Physical Properties", Type="PP");
980        outer NComp as Integer  (Brief = "Number of Components");
981
982        Pdrop   as press_delta  (Brief="Pressure Drop in the condenser",Default=0, Symbol="\Delta _P");
983        #Fake_Temperature               as temperature  (Brief="Fake temperature", Symbol = "T_{fake}");
984
985
986VARIABLES
987        in      InletVapour     as stream       (Brief="Vapour inlet stream", PosX=0.16, PosY=0, Symbol="_{in}^{Vapour}");
988        out     OutletLiquid    as stream       (Brief="Liquid outlet stream", PosX=0.53, PosY=1, Symbol="_{out}^{Liquid}");
989        #in     InletQ                  as power        (Brief="Heat Duty", PosX=1, PosY=0.08, Symbol="Q_{in}",Protected=true);
990        T_sub                           as temperature (Brief="Condensate temperature (subcooled)", Symbol = "T_{sub}");
991        SubcoolingDegree        as temp_delta (Brief="Subcooling Degree", Symbol = "\Delta _{sub}");
992        CondenserDuty           as power (Brief="Calculated condenser duty for desired subcooling", Protected = true, Symbol = "Q_{cond}");
993
994        out     TI as control_signal    (Brief="Temperature  Indicator of Condenser", Protected = true, PosX=0.50, PosY=0);
995        out     PI as control_signal    (Brief="Pressure  Indicator of Condenser", Protected = true, PosX=0.32, PosY=0);
996
997EQUATIONS
998
999"Molar Flow Balance"
1000        InletVapour.F = OutletLiquid.F;
1001
1002"Molar Composition Balance"
1003        InletVapour.z = OutletLiquid.z;
1004
1005#"Energy Balance"
1006        #InletVapour.F*InletVapour.h  + InletQ = OutletLiquid.F*OutletLiquid.h;
1007
1008"Pressure Drop"
1009        OutletLiquid.P = InletVapour.P - Pdrop;
1010
1011"Subcooled Temperature"
1012        OutletLiquid.T = T_sub;
1013       
1014"Degree of subcooling" 
1015        SubcoolingDegree = InletVapour.T - T_sub;
1016
1017"Liquid enthalpy"
1018        OutletLiquid.h = PP.LiquidEnthalpy(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z);
1019       
1020"Condenser Duty"
1021        CondenserDuty = OutletLiquid.F*OutletLiquid.h - InletVapour.F*InletVapour.h;
1022       
1023"Vapourisation Fraction"
1024        OutletLiquid.v = 0;
1025       
1026"Temperature indicator"
1027        TI * 'K' = OutletLiquid.T;
1028
1029"Pressure indicator"
1030        PI * 'atm' = OutletLiquid.P;
1031
1032end
1033
1034
1035Model condenserSubcooled2
1036
1037ATTRIBUTES
1038        Pallete         = true;
1039        Icon            = "icon/CondenserSteady";
1040        Brief           = "Model of a  Steady State total condenser with specified temperature outlet conditions.";
1041        Info            =
1042"A simple model of a simple Steady State total condenser with specified temperature (or subcooling degree), with a real
1043calculation of the output stream enthalpy.
1044
1045== ASSUMPTIONS ==
1046* perfect mixing of both phases;
1047* saturated vapour at the Inlet.
1048* no thermodynamics equilibrium.
1049
1050== SET ==
1051* the fake Outlet temperature ;
1052* the pressure drop in the condenser;
1053
1054== SPECIFY ==
1055* the InletVapour stream;
1056* the subcooled temperature OR the the degree of subcooling.
1057
1058== OPTIONAL ==
1059* the condenser model has two control ports
1060** TI OutletLiquid Temperature Indicator;
1061** PI OutletLiquid Pressure Indicator;
1062";
1063
1064PARAMETERS
1065        outer PP        as Plugin       (Brief = "External Physical Properties", Type="PP");
1066        outer NComp as Integer  (Brief = "Number of Components");
1067
1068        Pdrop   as press_delta  (Brief="Pressure Drop in the condenser",Default=0, Symbol="\Delta _P");
1069        #Fake_Temperature               as temperature  (Brief="Fake temperature", Symbol = "T_{fake}");
1070
1071
1072VARIABLES
1073        in      InletVapour     as stream       (Brief="Vapour inlet stream", PosX=0.16, PosY=0, Symbol="_{in}^{Vapour}");
1074        out     OutletLiquid    as stream       (Brief="Liquid outlet stream", PosX=0.53, PosY=1, Symbol="_{out}^{Liquid}");
1075        #in     InletQ                  as power        (Brief="Heat Duty", PosX=1, PosY=0.08, Symbol="Q_{in}",Protected=true);
1076        #SubcoolingDegree       as temp_delta (Brief="Subcooling Degree", Symbol = "\Delta _{sub}");
1077        T_sub                           as temperature (Brief="Condensate temperature (subcooled)", Symbol = "T_{sub}");       
1078        Tbubble                         as temperature (Brief="Bubble point at the condenser conditions", Protected = true, Symbol = "T_{b}");
1079        CondenserDuty           as power (Brief="Calculated condenser duty for desired subcooling", Protected = true, Symbol = "Q_{cond}");
1080
1081        out     TI as control_signal    (Brief="Temperature  Indicator of Condenser", Protected = true, PosX=0.50, PosY=0);
1082        out     PI as control_signal    (Brief="Pressure  Indicator of Condenser", Protected = true, PosX=0.32, PosY=0);
1083
1084EQUATIONS
1085
1086"Molar Flow Balance"
1087        InletVapour.F = OutletLiquid.F;
1088
1089"Molar Composition Balance"
1090        InletVapour.z = OutletLiquid.z;
1091
1092#"Energy Balance"
1093        #InletVapour.F*InletVapour.h  + InletQ = OutletLiquid.F*OutletLiquid.h;
1094
1095"Pressure Drop"
1096        OutletLiquid.P = InletVapour.P - Pdrop;
1097
1098"Subcooled Temperature"
1099        OutletLiquid.T = T_sub;
1100       
1101"Bubble Temperature"
1102        Tbubble = PP.BubbleT(OutletLiquid.P,OutletLiquid.z);
1103
1104#"Degree of subcooling"
1105#       SubcoolingDegree = Tbubble - T_sub;
1106
1107"Liquid enthalpy"
1108        OutletLiquid.h = PP.LiquidEnthalpy(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z);
1109       
1110"Condenser Duty"
1111        CondenserDuty = OutletLiquid.F*OutletLiquid.h - InletVapour.F*InletVapour.h;
1112       
1113"Vapourisation Fraction"
1114        OutletLiquid.v = 0;
1115       
1116"Temperature indicator"
1117        TI * 'K' = OutletLiquid.T;
1118
1119"Pressure indicator"
1120        PI * 'atm' = OutletLiquid.P;
1121
1122end
1123
1124>>>>>>> .r891
Note: See TracBrowser for help on using the repository browser.