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

Last change on this file since 353 was 353, checked in by Argimiro Resende Secchi, 15 years ago

Fixing some wiki notation.

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