source: trunk/eml/stage_separators/column.mso @ 442

Last change on this file since 442 was 398, checked in by Paula Bettio Staudt, 16 years ago

Updated tray and column models and samples

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 39.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* File containg models of columns: distillation, stripping, absorbers
17* rectifier, ....
18*
19* The default nomenclature is:
20*               Type_Column_reboilertype_condensertyper
21*
22* where:
23*       Type = refluxed or reboiled or section
24*       Column = Stripping, Absorption, Rectifier, Distillation
25*       Reboiler type (if exists) = kettle or thermosyphon
26*       Condenser type (if exists) = with subccoling or without subcooling
27*
28*-----------------------------------------------------------------------
29* Author: Paula B. Staudt
30* $Id: column.mso 398 2007-10-26 14:44:56Z paula $
31*---------------------------------------------------------------------*#
32
33using "tray";
34using "reboiler";
35using "condenser";
36using "mixers_splitters/splitter";
37using "tank";
38using "pressure_changers/pump";
39
40#*----------------------------------------------------------------------
41* Model of a  column section with:
42*       - NTrays=number of trays.
43*
44*---------------------------------------------------------------------*#
45Model Section_Column
46        ATTRIBUTES
47        Pallete         = true;
48        Icon            = "icon/SectionColumn";
49        Brief           = "Model of a column section.";
50        Info            =
51"== Model of a column section containing ==
52* NTrays trays.
53       
54== Specify ==
55* the feed stream of each tray (Inlet);
56* the Murphree eficiency for each tray Emv;
57* the InletL stream of the top tray;
58* the InletV stream of the bottom tray.
59       
60== Initial Conditions ==
61* the trays temperature (OutletL.T);
62* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
63* (NoComps - 1) OutletL (OR OutletV) compositions for each tray.
64";
65       
66        PARAMETERS
67        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
68        outer NComp as Integer;
69        NTrays as Integer(Brief="Number of trays", Default=2);
70        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
71        top as Integer(Brief="Number of top tray");
72        bot as Integer(Brief="Number of bottom tray");
73
74        SET
75        top = (NTrays-1)*(1-topdown)/2+1;
76        bot = NTrays/top;
77       
78        VARIABLES
79        trays(NTrays) as tray;
80
81        CONNECTIONS
82        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
83        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
84end
85
86
87#*----------------------------------------------------------------------
88* Model of a  distillation column containing:
89*       - NTrays like tray;
90*       - a kettle reboiler;
91*       - dymamic condenser;
92*       - a splitter which separate reflux and distillate;
93*       - a pump in reflux stream;
94*---------------------------------------------------------------------*#
95Model Distillation_kettle_cond
96        ATTRIBUTES
97        Pallete         = true;
98        Icon            = "icon/DistillationKettleCond";
99        Brief           = "Model of a distillation column with dynamic condenser and dynamic reboiler.";
100        Info            =
101"== Specify ==
102* the feed stream of each tray (Inlet);
103* the Murphree eficiency for each tray Emv;
104* the pump pressure difference;
105* the heat supllied in reboiler and condenser;
106* the condenser vapor outlet flow (OutletV.F);
107* the reboiler liquid outlet flow (OutletL.F);
108* both splitter outlet flows OR one of the splitter outlet flows and the splitter frac.
109       
110== Initial Conditions ==
111* the trays temperature (OutletL.T);
112* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
113* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
114       
115* the condenser temperature (OutletL.T);
116* the condenser liquid level (Level);
117* (NoComps - 1) OutletL (OR OutletV) compositions;
118       
119* the reboiler temperature (OutletL.T);
120* the reboiler liquid level (Level);
121* (NoComps - 1) OutletL (OR OutletV) compositions.
122";
123       
124        PARAMETERS
125        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
126        outer NComp as Integer;
127        NTrays as Integer(Brief="Number of trays", Default=2);
128        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
129        top as Integer(Brief="Number of top tray");
130        bot as Integer(Brief="Number of bottom tray");
131        VapourFlow as Switcher(Valid = ["on", "off"], Default = "on");
132       
133        SET
134        top = (NTrays-1)*(1-topdown)/2+1;
135        bot = NTrays/top;
136       
137        VARIABLES
138        trays(NTrays) as tray;
139        cond as condenser;
140        reb as reboiler;
141        sptop as splitter;
142        pump1 as pump;
143        alfaTopo as Real;
144       
145        EQUATIONS
146        switch VapourFlow
147                case "on":
148                cond.InletV.F*trays(top).vV = alfaTopo * trays(top).Ah * sqrt(2*(trays(top).OutletV.P -
149                cond.OutletL.P + 1e-8 * 'atm') / (trays(top).alfa*trays(top).rhoV));
150                when cond.InletV.F < 1e-6 * 'kmol/h' switchto "off";
151               
152                case "off":
153                cond.InletV.F = 0 * 'mol/s';
154                when trays(top).OutletV.P > cond.OutletL.P + 1e-1 * 'atm' switchto "on";
155        end     
156
157        CONNECTIONS
158        #vapor
159        reb.OutletV to trays(bot).InletV;
160        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
161        trays(top).OutletV to cond.InletV;
162       
163        #liquid
164        cond.OutletL to sptop.Inlet;   
165        sptop.Outlet2 to pump1.Inlet;
166        pump1.Outlet to trays(top).InletL;
167        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
168        trays(bot).OutletL to reb.InletL;
169end
170
171
172#* -------------------------------------------------------------------
173* Distillation Column model with:
174*
175*       - NTrays like tray;
176*       - a vessel in the bottom of column;
177*       - a splitter who separate the bottom product and the stream to reboiler;
178*       - steady state reboiler (thermosyphon);
179*       - a steady state condenser with subcooling;
180*       - a vessel drum (layed cilinder);
181*       - a splitter which separate reflux and distillate;
182*       - a pump in reflux stream.
183*
184* ------------------------------------------------------------------*#
185Model Distillation_thermosyphon_subcooling
186        ATTRIBUTES
187        Pallete         = true;
188        Icon            = "icon/DistillationThermosyphonSubcooling";
189        Brief           = "Model of a distillation column with steady condenser and steady reboiler.";
190        Info            =
191"== Specify ==
192* the feed stream of each tray (Inlet);
193* the Murphree eficiency for each tray Emv;
194* the pump head;
195* the condenser pressure drop;
196* the heat supllied in top and bottom tanks;
197* the heat supllied in condenser and reboiler;
198* the Outlet1 flow in the bottom splitter (spbottom.Outlet1.F) that corresponds to the bottom product;
199* both  top splitter outlet flows OR one of the splitter outlet flows and the splitter frac.
200       
201== Initial Conditions ==
202* the trays temperature (OutletL.T);
203* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
204* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
205       
206* the top tank temperature (OutletL.T);
207* the top tank liquid level (Level);
208* (NoComps - 1) OutletL (OR OutletV) compositions;
209       
210* the bottom tank temperature (OutletL.T);
211* the bottom tank liquid level (Level);
212* (NoComps - 1) OutletL (OR OutletV) compositions.
213";
214       
215        PARAMETERS
216        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
217        outer NComp as Integer;
218        NTrays as Integer(Brief="Number of trays", Default=2);
219        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
220        top as Integer(Brief="Number of top tray");
221        bot as Integer(Brief="Number of bottom tray");
222        VapourFlow as Switcher(Valid = ["on", "off"], Default = "on");
223
224        SET
225        top = (NTrays-1)*(1-topdown)/2+1;
226        bot = NTrays/top;
227       
228        VARIABLES
229        trays(NTrays) as tray;
230        cond as condenserSteady;
231        reb as reboilerSteady;
232        tbottom as tank;
233        ttop as tank_cylindrical;
234        spbottom as splitter;
235        sptop as splitter;
236        pump1 as pump;
237        alfaTopo as Real;
238
239        EQUATIONS
240        switch VapourFlow
241                case "on":
242                cond.InletV.F*trays(top).vV = alfaTopo * trays(top).Ah * sqrt(2*(trays(top).OutletV.P -
243                cond.OutletL.P + 1e-8 * 'atm') / (trays(top).alfa*trays(top).rhoV));
244                when cond.InletV.F < 1e-6 * 'kmol/h' switchto "off";
245               
246                case "off":
247                cond.InletV.F = 0 * 'mol/s';
248                when trays(top).OutletV.P > cond.OutletL.P + 1e-1 * 'atm' switchto "on";
249        end     
250       
251        CONNECTIONS
252        #vapor
253        reb.OutletV to trays(bot).InletV;
254        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
255        trays(top).OutletV to cond.InletV;
256       
257        #liquid
258        cond.OutletL to ttop.Inlet;     
259        ttop.Outlet to sptop.Inlet;
260        sptop.Outlet2 to pump1.Inlet;   
261        pump1.Outlet to trays(top).InletL;
262        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
263        trays(bot).OutletL to tbottom.Inlet;
264        tbottom.Outlet to spbottom.Inlet;
265        spbottom.Outlet2 to reb.InletL;
266end
267
268
269#* -------------------------------------------------------------------
270* Distillation Column model with:
271*
272*       - NTrays like tray;
273*       - a vessel in the bottom of column;
274*       - a splitter who separate the bottom product and the stream to reboiler;
275*       - steady state reboiler (thermosyphon);
276*       - a dynamic condenser without subcooling;
277*       - a splitter which separate reflux and distillate;
278*       - a pump in reflux stream.
279*
280* ------------------------------------------------------------------*#
281Model Distillation_thermosyphon_cond
282        ATTRIBUTES
283        Pallete         = true;
284        Icon            = "icon/DistillationThermosyphonCond";
285        Brief           = "Model of a distillation column with dynamic condenser and steady reboiler.";
286        Info            =
287"== Specify ==
288* the feed stream of each tray (Inlet);
289* the Murphree eficiency for each tray Emv;
290* the pump head;
291* the condenser vapor outlet flow (OutletV.F);
292* the heat supllied in bottom tank;
293* the heat supllied in condenser and reboiler;
294* the Outlet1 flow in the bottom splitter (spbottom.Outlet1.F) that corresponds to the bottom product;
295       
296== Initial Conditions ==
297* the trays temperature (OutletL.T);
298* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
299* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
300       
301* the condenser temperature (OutletL.T);
302* the condenser liquid level (Level);
303* (NoComps - 1) OutletL (OR OutletV) compositions;
304       
305* the bottom tank temperature (OutletL.T);
306* the bottom tank liquid level (Level);
307* (NoComps - 1) OutletL (OR OutletV) compositions.
308";
309
310        PARAMETERS
311        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
312        outer NComp as Integer;
313        NTrays as Integer(Brief="Number of trays", Default=2);
314        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
315        top as Integer(Brief="Number of top tray");
316        bot as Integer(Brief="Number of bottom tray");
317        VapourFlow as Switcher(Valid = ["on", "off"], Default = "on");
318
319        SET
320        top = (NTrays-1)*(1-topdown)/2+1;
321        bot = NTrays/top;
322       
323        VARIABLES
324        trays(NTrays) as tray;
325        cond as condenser;
326        reb as reboilerSteady;
327        tbottom as tank;
328        spbottom as splitter;
329        sptop as splitter;
330        pump1 as pump;
331        alfaTopo as Real;
332
333        EQUATIONS
334        switch VapourFlow
335                case "on":
336                cond.InletV.F*trays(top).vV = alfaTopo * trays(top).Ah * sqrt(2*(trays(top).OutletV.P -
337                cond.OutletL.P + 1e-8 * 'atm') / (trays(top).alfa*trays(top).rhoV));
338                when cond.InletV.F < 1e-6 * 'kmol/h' switchto "off";
339               
340                case "off":
341                cond.InletV.F = 0 * 'mol/s';
342                when trays(top).OutletV.P > cond.OutletL.P + 1e-1 * 'atm' switchto "on";
343        end     
344                       
345        CONNECTIONS
346        #vapor
347        reb.OutletV to trays(bot).InletV;
348        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
349        trays(top).OutletV to cond.InletV;
350       
351        #liquid
352        cond.OutletL to sptop.Inlet;   
353        sptop.Outlet2 to pump1.Inlet;
354        pump1.Outlet to trays(top).InletL;
355        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
356        trays(bot).OutletL to tbottom.Inlet;
357        tbottom.Outlet to spbottom.Inlet;
358        spbottom.Outlet2 to reb.InletL;
359end
360
361#* -------------------------------------------------------------------
362* Distillation Column model with:
363*
364*       - NTrays like tray;
365*       - a kettle reboiler;
366*       - a steady state condenser with subcooling;
367*       - a vessel drum (layed cilinder);
368*       - a splitter which separate reflux and distillate;
369*       - a pump in reflux stream.
370*
371* ------------------------------------------------------------------*#
372Model Distillation_kettle_subcooling
373        ATTRIBUTES
374        Pallete         = true;
375        Icon            = "icon/DistillationKettleSubcooling";
376        Brief           = "Model of a distillation column with steady condenser and dynamic reboiler.";
377        Info            =
378"== Specify ==
379* the feed stream of each tray (Inlet);
380* the Murphree eficiency for each tray (Emv);
381* the pump pressure difference;
382* the heat supllied in reboiler and condenser;
383* the heat supllied in the top tank;
384* the condenser pressure drop;
385* the reboiler liquid outlet flow (OutletL.F);
386* both splitter outlet flows OR one of the splitter outlet flows and the splitter frac.
387       
388== Initial Conditions ==
389* the trays temperature (OutletL.T);
390* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
391* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
392       
393* the top tank temperature (OutletL.T);
394* the top tank liquid level (Level);
395* (NoComps - 1) OutletL (OR OutletV) compositions;
396       
397* the reboiler temperature (OutletL.T);
398* the reboiler liquid level (Level);
399* (NoComps - 1) OutletL (OR OutletV) compositions.
400";
401       
402        PARAMETERS
403        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
404        outer NComp as Integer;
405        NTrays as Integer(Brief="Number of trays", Default=2);
406        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
407        top as Integer(Brief="Number of top tray");
408        bot as Integer(Brief="Number of bottom tray");
409        VapourFlow as Switcher(Valid = ["on", "off"], Default = "on");
410
411        SET
412        top = (NTrays-1)*(1-topdown)/2+1;
413        bot = NTrays/top;
414       
415        VARIABLES
416        trays(NTrays) as tray;
417        cond as condenserSteady;
418        reb as reboiler;
419        ttop as tank_cylindrical;
420        sptop as splitter;
421        pump1 as pump;
422        alfaTopo as Real;
423
424        EQUATIONS
425        switch VapourFlow
426                case "on":
427                cond.InletV.F*trays(top).vV = alfaTopo * trays(top).Ah * sqrt(2*(trays(top).OutletV.P -
428                cond.OutletL.P + 1e-8 * 'atm') / (trays(top).alfa*trays(top).rhoV));
429                when cond.InletV.F < 1e-6 * 'kmol/h' switchto "off";
430               
431                case "off":
432                cond.InletV.F = 0 * 'mol/s';
433                when trays(top).OutletV.P > cond.OutletL.P + 1e-1 * 'atm' switchto "on";
434        end     
435       
436        CONNECTIONS
437        #vapor
438        reb.OutletV to trays(bot).InletV;
439        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
440        trays(top).OutletV to cond.InletV;
441       
442        #liquid
443        cond.OutletL to ttop.Inlet;     
444        ttop.Outlet to sptop.Inlet;
445        sptop.Outlet2 to pump1.Inlet;   
446        pump1.Outlet to trays(top).InletL;
447        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
448        trays(bot).OutletL to reb.InletL;
449end
450
451
452#*----------------------------------------------------------------------
453* Model of a  rectifier containing:
454*       - NTrays like tray;
455*       - dymamic condenser without subcooling;
456*       - a splitter which separate reflux and distillate;
457*       - a pump in reflux stream;
458*---------------------------------------------------------------------*#
459Model Rectifier
460        ATTRIBUTES
461        Pallete         = true;
462        Icon            = "icon/RefluxedCond";
463        Brief           = "Model of a rectifier column with dynamic condenser.";
464        Info            =
465"== Specify ==
466* the feed stream of each tray (Inlet);
467* the Murphree eficiency for each tray Emv;
468* the InletV stream of the bottom tray unless its flow;
469* the pump pressure difference;
470* the heat supllied in the condenser;
471* the condenser vapor outlet flow (OutletV.F);
472* both splitter outlet flows OR one of the splitter outlet flows and the splitter frac.
473       
474== Initial Conditions ==
475* the trays temperature (OutletL.T);
476* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
477* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
478       
479* the condenser temperature (OutletL.T);
480* the condenser liquid level (Level);
481* (NoComps - 1) OutletL (OR OutletV) compositions;
482";
483
484        PARAMETERS
485        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
486        outer NComp as Integer;
487        NTrays as Integer(Brief="Number of trays", Default=2);
488        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
489        top as Integer(Brief="Number of top tray");
490        bot as Integer(Brief="Number of bottom tray");
491        VapourFlow as Switcher(Valid = ["on", "off"], Default = "on");
492
493        SET
494        top = (NTrays-1)*(1-topdown)/2+1;
495        bot = NTrays/top;
496       
497        VARIABLES
498        trays(NTrays) as tray;
499        cond as condenser;
500        sptop as splitter;
501        pump1 as pump;
502        alfaTopo as Real;
503
504        EQUATIONS
505        switch VapourFlow
506                case "on":
507                cond.InletV.F*trays(top).vV = alfaTopo * trays(top).Ah * sqrt(2*(trays(top).OutletV.P -
508                cond.OutletL.P + 1e-8 * 'atm') / (trays(top).alfa*trays(top).rhoV));
509                when cond.InletV.F < 1e-6 * 'kmol/h' switchto "off";
510               
511                case "off":
512                cond.InletV.F = 0 * 'mol/s';
513                when trays(top).OutletV.P > cond.OutletL.P + 1e-1 * 'atm' switchto "on";
514        end     
515       
516        CONNECTIONS
517        #vapor
518        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
519        trays(top).OutletV to cond.InletV;
520       
521        #liquid
522        cond.OutletL to sptop.Inlet;   
523        sptop.Outlet2 to pump1.Inlet;   
524        pump1.Outlet to trays(top).InletL;
525        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
526end
527
528
529#* -------------------------------------------------------------------
530* Rectifier Column with:
531*
532*       - NTrays like tray;
533*       - a steady state condenser with subcooling;
534*       - a vessel drum (layed cilinder);
535*       - a splitter which separate reflux and distillate;
536*       - a pump in reflux stream.
537*
538* ------------------------------------------------------------------*#
539Model Rectifier_subcooling
540        ATTRIBUTES
541        Pallete         = true;
542        Icon            = "icon/RefluxedSubcooling";
543        Brief           = "Model of a rectifier column with steady condenser.";
544        Info            =
545"== Specify ==
546* the feed stream of each tray (Inlet);
547* the Murphree eficiency for each tray Emv;
548* the InletV stream of the bottom tray unless its flow;
549* the pump head;
550* the condenser pressure drop;
551* the heat supllied in  the top tank;
552* the heat supllied in condenser;
553* both  top splitter outlet flows OR one of the splitter outlet flows and the splitter frac.
554       
555== Initial Conditions ==
556* the trays temperature (OutletL.T);
557* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
558* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
559       
560* the top tank temperature (OutletL.T);
561* the top tank liquid level (Level);
562* (NoComps - 1) OutletL (OR OutletV) compositions;
563";
564       
565        PARAMETERS
566        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
567        outer NComp as Integer;
568        NTrays as Integer(Brief="Number of trays", Default=2);
569        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
570        top as Integer(Brief="Number of top tray");
571        bot as Integer(Brief="Number of bottom tray");
572        VapourFlow as Switcher(Valid = ["on", "off"], Default = "on");
573
574        SET
575        top = (NTrays-1)*(1-topdown)/2+1;
576        bot = NTrays/top;
577       
578        VARIABLES
579        trays(NTrays) as tray;
580        cond as condenserSteady;
581        ttop as tank_cylindrical;
582        sptop as splitter;
583        pump1 as pump;
584        alfaTopo as Real;
585
586        EQUATIONS
587        switch VapourFlow
588                case "on":
589                cond.InletV.F*trays(top).vV = alfaTopo * trays(top).Ah * sqrt(2*(trays(top).OutletV.P -
590                cond.OutletL.P + 1e-8 * 'atm') / (trays(top).alfa*trays(top).rhoV));
591                when cond.InletV.F < 1e-6 * 'kmol/h' switchto "off";
592               
593                case "off":
594                cond.InletV.F = 0 * 'mol/s';
595                when trays(top).OutletV.P > cond.OutletL.P + 1e-1 * 'atm' switchto "on";
596        end     
597       
598        CONNECTIONS
599        #vapor
600        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
601        trays(top).OutletV to cond.InletV;
602       
603        #liquid
604        cond.OutletL to ttop.Inlet;     
605        ttop.Outlet to sptop.Inlet;
606        sptop.Outlet2 to pump1.Inlet;   
607        pump1.Outlet to trays(top).InletL;
608        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
609end
610
611
612#*----------------------------------------------------------------------
613* Model of a  Refluxed Stripping column containing:
614*       - NTrays like tray;
615*       - dymamic condenser without subcooling;
616*       - a splitter which separate reflux and distillate;
617*       - a pump in reflux stream;
618*---------------------------------------------------------------------*#
619Model Refluxed_Stripping
620        ATTRIBUTES
621        Pallete         = true;
622        Icon            = "icon/RefluxedCond";
623        Brief           = "Model of a refluxed stripping column with dynamic condenser.";
624        Info            =
625"== Specify ==
626* the feed stream of each tray (Inlet);
627* the Murphree eficiency for each tray Emv;
628* the InletV stream of the bottom tray unless its flow;
629* the pump pressure difference;
630* the heat supllied in the condenser;
631* the condenser vapor outlet flow (OutletV.F);
632* both splitter outlet flows OR one of the splitter outlet flows and the splitter frac.
633       
634== Initial Conditions ==
635* the trays temperature (OutletL.T);
636* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
637* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
638       
639* the condenser temperature (OutletL.T);
640* the condenser liquid level (Level);
641* (NoComps - 1) OutletL (OR OutletV) compositions;
642";
643       
644        PARAMETERS
645        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
646        outer NComp as Integer;
647        NTrays as Integer(Brief="Number of trays", Default=2);
648        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
649        top as Integer(Brief="Number of top tray");
650        bot as Integer(Brief="Number of bottom tray");
651        VapourFlow as Switcher(Valid = ["on", "off"], Default = "on");
652
653        SET
654        top = (NTrays-1)*(1-topdown)/2+1;
655        bot = NTrays/top;
656       
657        VARIABLES
658        trays(NTrays) as tray;
659        cond as condenser;
660        sptop as splitter;
661        pump1 as pump;
662        alfaTopo as Real;
663
664        EQUATIONS
665        switch VapourFlow
666                case "on":
667                cond.InletV.F*trays(top).vV = alfaTopo * trays(top).Ah * sqrt(2*(trays(top).OutletV.P -
668                cond.OutletL.P + 1e-8 * 'atm') / (trays(top).alfa*trays(top).rhoV));
669                when cond.InletV.F < 1e-6 * 'kmol/h' switchto "off";
670               
671                case "off":
672                cond.InletV.F = 0 * 'mol/s';
673                when trays(top).OutletV.P > cond.OutletL.P + 1e-1 * 'atm' switchto "on";
674        end
675       
676        CONNECTIONS
677        #vapor
678        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
679        trays(top).OutletV to cond.InletV;
680       
681        #liquid
682        cond.OutletL to sptop.Inlet;   
683        sptop.Outlet2 to pump1.Inlet;   
684        pump1.Outlet to trays(top).InletL;
685        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
686end
687
688
689#* -------------------------------------------------------------------
690* Refluxed Stripping Column with:
691*
692*       - NTrays like tray;
693*       - a steady state condenser (with subcooling);
694*       - a vessel drum (layed cilinder);
695*       - a splitter which separate reflux and distillate;
696*       - a pump in reflux stream.
697*
698* ------------------------------------------------------------------*#
699Model Refluxed_Stripping_subcooling
700        ATTRIBUTES
701        Pallete         = true;
702        Icon            = "icon/RefluxedSubcooling";
703        Brief           = "Model of a refluxed stripping column with steady condenser.";
704        Info            =
705"== Specify ==
706* the feed stream of each tray (Inlet);
707* the Murphree eficiency for each tray Emv;
708* the InletV stream of the bottom tray unless its flow;
709* the pump head;
710* the condenser pressure drop;
711* the heat supllied in  the top tank;
712* the heat supllied in condenser;
713* both  top splitter outlet flows OR one of the splitter outlet flows and the splitter frac.
714       
715== Initial Conditions ==
716* the trays temperature (OutletL.T);
717* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
718* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
719       
720* the top tank temperature (OutletL.T);
721* the top tank liquid level (Level);
722* (NoComps - 1) OutletL (OR OutletV) compositions;
723";
724       
725        PARAMETERS
726        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
727        outer NComp as Integer;
728        NTrays as Integer(Brief="Number of trays", Default=2);
729        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
730        top as Integer(Brief="Number of top tray");
731        bot as Integer(Brief="Number of bottom tray");
732        VapourFlow as Switcher(Valid = ["on", "off"], Default = "on");
733
734        SET
735        top = (NTrays-1)*(1-topdown)/2+1;
736        bot = NTrays/top;
737       
738        VARIABLES
739        trays(NTrays) as tray;
740        cond as condenserSteady;
741        ttop as tank_cylindrical;
742        sptop as splitter;
743        pump1 as pump;
744        alfaTopo as Real;
745
746        EQUATIONS
747        switch VapourFlow
748                case "on":
749                cond.InletV.F*trays(top).vV = alfaTopo * trays(top).Ah * sqrt(2*(trays(top).OutletV.P -
750                cond.OutletL.P + 1e-8 * 'atm') / (trays(top).alfa*trays(top).rhoV));
751                when cond.InletV.F < 1e-6 * 'kmol/h' switchto "off";
752               
753                case "off":
754                cond.InletV.F = 0 * 'mol/s';
755                when trays(top).OutletV.P > cond.OutletL.P + 1e-1 * 'atm' switchto "on";
756        end
757       
758        CONNECTIONS
759        #vapor
760        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
761        trays(top).OutletV to cond.InletV;
762       
763        #liquid
764        cond.OutletL to ttop.Inlet;     
765        ttop.Outlet to sptop.Inlet;
766        sptop.Outlet2 to pump1.Inlet;   
767        pump1.Outlet to trays(top).InletL;
768        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
769end
770
771
772#*----------------------------------------------------------------------
773* Model of a  Refluxed Absorption column containing:
774*       - NTrays like tray;
775*       - dymamic condenser without subcooling;
776*       - a splitter which separate reflux and distillate;
777*       - a pump in reflux stream;
778*---------------------------------------------------------------------*#
779Model Refluxed_Absorption
780        ATTRIBUTES
781        Pallete         = true;
782        Icon            = "icon/RefluxedCond";
783        Brief           = "Model of a refluxed absorption column with dynamic condenser.";
784        Info            =
785"== Specify ==
786* the feed stream of each tray (Inlet);
787* the Murphree eficiency for each tray Emv;
788* the InletV stream of the bottom tray unless its flow;
789* the pump pressure difference;
790* the heat supllied in the condenser;
791* the condenser vapor outlet flow (OutletV.F);
792* both splitter outlet flows OR one of the splitter outlet flows and the splitter frac.
793       
794== Initial Conditions ==
795* the trays temperature (OutletL.T);
796* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
797* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
798       
799* the condenser temperature (OutletL.T);
800* the condenser liquid level (Level);
801* (NoComps - 1) OutletL (OR OutletV) compositions;
802";
803       
804        PARAMETERS
805        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
806        outer NComp as Integer;
807        NTrays as Integer(Brief="Number of trays", Default=2);
808        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
809        top as Integer(Brief="Number of top tray");
810        bot as Integer(Brief="Number of bottom tray");
811        VapourFlow as Switcher(Valid = ["on", "off"], Default = "on");
812
813        SET
814        top = (NTrays-1)*(1-topdown)/2+1;
815        bot = NTrays/top;
816       
817        VARIABLES
818        trays(NTrays) as tray;
819        cond as condenser;
820        sptop as splitter;
821        pump1 as pump;
822        alfaTopo as Real;
823
824        EQUATIONS
825        switch VapourFlow
826                case "on":
827                cond.InletV.F*trays(top).vV = alfaTopo * trays(top).Ah * sqrt(2*(trays(top).OutletV.P -
828                cond.OutletL.P + 1e-8 * 'atm') / (trays(top).alfa*trays(top).rhoV));
829                when cond.InletV.F < 1e-6 * 'kmol/h' switchto "off";
830               
831                case "off":
832                cond.InletV.F = 0 * 'mol/s';
833                when trays(top).OutletV.P > cond.OutletL.P + 1e-1 * 'atm' switchto "on";
834        end
835       
836        CONNECTIONS
837        #vapor
838        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
839        trays(top).OutletV to cond.InletV;
840       
841        #liquid
842        cond.OutletL to cond.InletV;   
843        cond.OutletL to sptop.Inlet;
844        sptop.Outlet2 to pump1.Inlet;   
845        pump1.Outlet to trays(top).InletL;
846        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
847end
848
849
850#* -------------------------------------------------------------------
851* Refluxed Absorption Column with:
852*
853*       - NTrays like tray;
854*       - a steady state condenser (with subcooling);
855*       - a vessel drum (layed cilinder);
856*       - a splitter which separate reflux and distillate;
857*       - a pump in reflux stream.
858*
859* ------------------------------------------------------------------*#
860Model Refluxed_Absorption_subcooling
861        ATTRIBUTES
862        Pallete         = true;
863        Icon            = "icon/RefluxedSubcooling";
864        Brief           = "Model of a refluxed absorption column with steady condenser.";
865        Info            =
866"== Specify ==
867* the feed stream of each tray (Inlet);
868* the Murphree eficiency for each tray Emv;
869* the InletV stream of the bottom tray unless its flow;
870* the pump head;
871* the condenser pressure drop;
872* the heat supllied in  the top tank;
873* the heat supllied in condenser;
874* both  top splitter outlet flows OR one of the splitter outlet flows and the splitter frac.
875       
876== Initial Conditions ==
877* the trays temperature (OutletL.T);
878* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
879* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
880       
881* the top tank temperature (OutletL.T);
882* the top tank liquid level (Level);
883* (NoComps - 1) OutletL (OR OutletV) compositions;
884";
885       
886        PARAMETERS
887        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
888        outer NComp as Integer;
889        NTrays as Integer(Brief="Number of trays", Default=2);
890        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
891        top as Integer(Brief="Number of top tray");
892        bot as Integer(Brief="Number of bottom tray");
893        VapourFlow as Switcher(Valid = ["on", "off"], Default = "on");
894
895        SET
896        top = (NTrays-1)*(1-topdown)/2+1;
897        bot = NTrays/top;
898       
899        VARIABLES
900        trays(NTrays) as tray;
901        cond as condenserSteady;
902        ttop as tank_cylindrical;
903        sptop as splitter;
904        pump1 as pump;
905        alfaTopo as Real;
906
907        EQUATIONS
908        switch VapourFlow
909                case "on":
910                cond.InletV.F*trays(top).vV = alfaTopo * trays(top).Ah * sqrt(2*(trays(top).OutletV.P -
911                cond.OutletL.P + 1e-8 * 'atm') / (trays(top).alfa*trays(top).rhoV));
912                when cond.InletV.F < 1e-6 * 'kmol/h' switchto "off";
913               
914                case "off":
915                cond.InletV.F = 0 * 'mol/s';
916                when trays(top).OutletV.P > cond.OutletL.P + 1e-1 * 'atm' switchto "on";
917        end     
918       
919        CONNECTIONS
920        #vapor
921        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
922        trays(top).OutletV to cond.InletV;
923       
924        #liquid
925        cond.OutletL to ttop.Inlet;     
926        ttop.Outlet to sptop.Inlet;
927        sptop.Outlet2 to pump1.Inlet;   
928        pump1.Outlet to trays(top).InletL;
929        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
930end
931
932
933#* -------------------------------------------------------------------
934* Reboiled Stripping Column model with:
935*
936*       - NTrays like tray;
937*       - a kettle reboiler;
938*
939* ------------------------------------------------------------------*#
940Model Reboiled_Stripping_kettle
941        ATTRIBUTES
942        Pallete         = true;
943        Icon            = "icon/ReboiledKettle";
944        Brief           = "Model of a reboiled stripping column with dynamic reboiler.";
945        Info            =
946"== Specify ==
947* the feed stream of each tray (Inlet);
948* the Murphree eficiency for each tray Emv;
949* the vapour flow leaving the top of the column;
950* the InletL stream of the top tray;
951* the heat supllied in the reboiler;
952* the reboiler liquid outlet flow (OutletL.F);
953       
954== Initial Conditions ==
955* the trays temperature (OutletL.T);
956* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
957* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
958       
959* the reboiler temperature (OutletL.T);
960* the reboiler liquid level (Level);
961* (NoComps - 1) OutletL (OR OutletV) compositions.
962";
963
964        PARAMETERS
965        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
966        outer NComp as Integer;
967        NTrays as Integer(Brief="Number of trays", Default=2);
968        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
969        top as Integer(Brief="Number of top tray");
970        bot as Integer(Brief="Number of bottom tray");
971
972        SET
973        top = (NTrays-1)*(1-topdown)/2+1;
974        bot = NTrays/top;
975       
976        VARIABLES
977        trays(NTrays) as tray;
978        reb as reboiler;
979
980        CONNECTIONS
981        #vapor
982        reb.OutletV to trays(bot).InletV;
983        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
984       
985        #liquid
986        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
987        trays(bot).OutletL to reb.InletL;
988end
989
990
991#* -------------------------------------------------------------------
992* Reboiled Stripping Column model with:
993*
994*       - NTrays like tray;
995*       - a vessel in the bottom of column;
996*       - a splitter which separate the bottom product and the stream to reboiler;
997*       - steady state reboiler (thermosyphon);
998*
999* ------------------------------------------------------------------*#
1000Model Reboiled_Stripping_thermosyphon
1001        ATTRIBUTES
1002        Pallete         = true;
1003        Icon            = "icon/ReboiledThermosyphon";
1004        Brief           = "Model of a reboiled stripping column with steady reboiler.";
1005        Info            =
1006"== Specify ==
1007* the feed stream of each tray (Inlet);
1008* the Murphree eficiency for each tray (Emv);
1009* the vapour flow leaving the top of the column;
1010* the InletL stream of the top tray;
1011* the heat supllied in bottom tank;
1012* the heat supllied in the reboiler;
1013* the Outlet1 flow in the bottom splitter (spbottom.Outlet1.F) that corresponds to the bottom product;
1014       
1015== Initial Conditions ==
1016* the trays temperature (OutletL.T);
1017* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
1018* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
1019
1020* the bottom tank temperature (OutletL.T);
1021* the bottom tank liquid level (Level);
1022* (NoComps - 1) OutletL (OR OutletV) compositions.
1023";
1024       
1025        PARAMETERS
1026        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
1027        outer NComp as Integer;
1028        NTrays as Integer(Brief="Number of trays", Default=2);
1029        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
1030        top as Integer(Brief="Number of top tray");
1031        bot as Integer(Brief="Number of bottom tray");
1032
1033        SET
1034        top = (NTrays-1)*(1-topdown)/2+1;
1035        bot = NTrays/top;
1036       
1037        VARIABLES
1038        trays(NTrays) as tray;
1039        reb as reboilerSteady;
1040        spbottom as splitter;
1041        tbottom as tank;
1042
1043        CONNECTIONS
1044        #vapor
1045        reb.OutletV to trays(bot).InletV;
1046        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
1047       
1048        #liquid
1049        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
1050        trays(bot).OutletL to tbottom.Inlet;
1051        tbottom.Outlet to spbottom.Inlet;
1052        spbottom.Outlet2 to reb.InletL;
1053end
1054
1055
1056#* -------------------------------------------------------------------
1057* Reboiled Absorption Column model with:
1058*
1059*       - NTrays like tray;
1060*       - a kettle reboiler;
1061*
1062* ------------------------------------------------------------------*#
1063Model Reboiled_Absorption_kettle
1064        ATTRIBUTES
1065        Pallete         = true;
1066        Icon            = "icon/ReboiledKettle";
1067        Brief           = "Model of a reboiled absorption column with dynamic reboiler.";
1068        Info            =
1069"== Specify ==
1070* the feed stream of each tray (Inlet);
1071* the Murphree eficiency for each tray Emv;
1072* the vapour flow leaving the top of the column;
1073* the InletL stream of the top tray;
1074* the heat supllied in the reboiler;
1075* the reboiler liquid outlet flow (OutletL.F);
1076       
1077== Initial Conditions ==
1078* the trays temperature (OutletL.T);
1079* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
1080* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
1081       
1082* the reboiler temperature (OutletL.T);
1083* the reboiler liquid level (Level);
1084* (NoComps - 1) OutletL (OR OutletV) compositions.
1085";
1086       
1087        PARAMETERS
1088        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
1089        outer NComp as Integer;
1090        NTrays as Integer(Brief="Number of trays", Default=2);
1091        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
1092        top as Integer(Brief="Number of top tray");
1093        bot as Integer(Brief="Number of bottom tray");
1094
1095        SET
1096        top = (NTrays-1)*(1-topdown)/2+1;
1097        bot = NTrays/top;
1098       
1099        VARIABLES
1100        trays(NTrays) as tray;
1101        reb as reboiler;
1102
1103        CONNECTIONS
1104        #vapor
1105        reb.OutletV to trays(bot).InletV;
1106        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
1107       
1108        #liquid
1109        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
1110        trays(bot).OutletL to reb.InletL;
1111end
1112
1113
1114#* -------------------------------------------------------------------
1115* Reboiled Absorption Column model with:
1116*
1117*       - NTrays like tray;
1118*       - a vessel in the bottom of column;
1119*       - a splitter which separate the bottom product and the stream to reboiler;
1120*       - steady state reboiler (thermosyphon);
1121*
1122* ------------------------------------------------------------------*#
1123Model Reboiled_Absorption_thermosyphon
1124        ATTRIBUTES
1125        Pallete         = true;
1126        Icon            = "icon/ReboiledThermosyphon";
1127        Brief           = "Model of a reboiled absorption column with steady reboiler.";
1128        Info            =
1129"== Specify ==
1130* the feed stream of each tray (Inlet);
1131* the Murphree eficiency for each tray (Emv);
1132* the vapour flow leaving the top of the column;
1133* the InletL stream of the top tray;
1134* the heat supllied in bottom tank;
1135* the heat supllied in the reboiler;
1136* the Outlet1 flow in the bottom splitter (spbottom.Outlet1.F) that corresponds to the bottom product;
1137       
1138== Initial Conditions ==
1139* the trays temperature (OutletL.T);
1140* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
1141* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
1142
1143* the bottom tank temperature (OutletL.T);
1144* the bottom tank liquid level (Level);
1145* (NoComps - 1) OutletL (OR OutletV) compositions.
1146";
1147       
1148        PARAMETERS
1149        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
1150        outer NComp as Integer;
1151        NTrays as Integer(Brief="Number of trays", Default=2);
1152        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
1153        top as Integer(Brief="Number of top tray");
1154        bot as Integer(Brief="Number of bottom tray");
1155
1156        SET
1157        top = (NTrays-1)*(1-topdown)/2+1;
1158        bot = NTrays/top;
1159       
1160        VARIABLES
1161        trays(NTrays) as tray;
1162        reb as reboilerSteady;
1163        spbottom as splitter;
1164        tbottom as tank;
1165       
1166        CONNECTIONS
1167        #vapor
1168        reb.OutletV to trays(bot).InletV;
1169        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
1170       
1171        #liquid
1172        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
1173        trays(bot).OutletL to tbottom.Inlet;
1174        tbottom.Outlet to spbottom.Inlet;
1175        spbottom.Outlet2 to reb.InletL;
1176end
1177
1178#* -------------------------------------------------------------------
1179*  Reactive Distillation Column
1180*
1181* ------------------------------------------------------------------*#
1182Model ReactiveDistillation
1183        ATTRIBUTES
1184        Pallete         = true;
1185        Icon            = "icon/DistillationKettleCond";
1186        Brief           = "Model of a reactive distillation column with dynamic condenser and reboiler.";
1187        Info            =
1188"== Specify ==
1189* the reaction related variables for each tray, condenser and reboiler;
1190* the feed stream of each tray (Inlet);
1191* the Murphree eficiency for each tray Emv;
1192* the pump pressure difference;
1193* the heat supllied in reboiler and condenser;
1194* the condenser vapor outlet flow (OutletV.F);
1195* the reboiler liquid outlet flow (OutletL.F);
1196* both splitter outlet flows OR one of the splitter outlet flows and the splitter frac.
1197       
1198== Initial Conditions ==
1199* the trays temperature (OutletL.T);
1200* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
1201* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
1202       
1203* the condenser temperature (OutletL.T);
1204* the condenser liquid level (Level);
1205* (NoComps - 1) OutletL (OR OutletV) compositions;
1206       
1207* the reboiler temperature (OutletL.T);
1208* the reboiler liquid level (Level);
1209* (NoComps - 1) OutletL (OR OutletV) compositions.
1210";
1211       
1212        PARAMETERS
1213        outer PP as Plugin(Type="PP");
1214        outer NComp as Integer;
1215        NTrays as Integer(Brief="Number of trays", Default=2);
1216        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
1217        top as Integer(Brief="Number of top tray");
1218        bot as Integer(Brief="Number of bottom tray");
1219        alfacond as Real;
1220
1221        VapourFlow as Switcher(Valid = ["on", "off"], Default = "off");
1222       
1223        SET
1224        top = (NTrays-1)*(1-topdown)/2+1;
1225        bot = NTrays/top;
1226       
1227        VARIABLES
1228        trays(NTrays) as trayReact;
1229        cond as condenserReact;
1230        reb as reboilerReact;
1231        sp as splitter;
1232        p as pump;
1233       
1234        EQUATIONS
1235       
1236        switch VapourFlow
1237                case "on":
1238                "Pressure Drop through the condenser"
1239                cond.InletV.F*trays(top).vV / 'm^2' =
1240                        sqrt((trays(top).OutletV.P - cond.OutletL.P + 1e-8 * 'atm')/(trays(top).rhoV*alfacond));
1241                when trays(top).OutletV.P < cond.OutletL.P switchto "off";
1242               
1243                case "off":
1244                "Prato selado"
1245                cond.InletV.F = 0.0 * 'mol/s';
1246                when trays(top).OutletV.P > cond.OutletL.P + 1e-3 * 'atm' switchto "on";
1247        end
1248
1249        CONNECTIONS
1250        #vapor
1251        reb.OutletV to trays(bot).InletV;
1252        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
1253        trays(top).OutletV to cond.InletV;
1254       
1255        #liquid
1256        cond.OutletL to sp.Inlet;       
1257        sp.Outlet2 to p.Inlet;
1258        p.Outlet to trays(top).InletL;
1259        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
1260        trays(bot).OutletL to reb.InletL;
1261       
1262end
Note: See TracBrowser for help on using the repository browser.