source: branches/gui/eml/stage_separators/columnTeste.mso @ 636

Last change on this file since 636 was 636, checked in by gerson bicca, 14 years ago

added initialization mode for column model (temperature and composition)

File size: 53.7 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 511 2008-05-12 17:25:33Z paula $
31*---------------------------------------------------------------------*#
32
33using "trayTeste";
34using "reboilerTeste";
35using "condenser";
36using "mixers_splitters/splitter";
37using "tank";
38using "pressure_changers/pump";
39
40#*----------------------------------------------------------------------
41* Model of a  column section with:
42*       - NumberOfTrays=number of trays.
43*
44*---------------------------------------------------------------------*#
45Model Section_ColumnTeste
46
47ATTRIBUTES
48        Pallete         = true;
49        Icon            = "icon/SectionColumn";
50        Brief   = "Model of a column section.";
51        Info            =
52"== Model of a column section containing ==
53* NumberOfTrays 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
67PARAMETERS
68        outer PP                                                                                as Plugin                       (Brief="External Physical Properties", Type="PP");
69        outer NComp                                                             as Integer                      (Brief="Number of components");
70        NumberOfTrays                                                           as Integer                      (Brief="Number of trays", Default=8);
71        SpecialTrayIndex(NumberOfTrays)         as Integer                      (Brief="Number of trays", Default=0,Hidden=true);
72        FeedTrayLocation                                                        as Integer                      (Brief="Feed tray Location", Default=2);
73        g                                                                                                       as acceleration         (Brief="Gravity Acceleration",Default=9.81,Hidden=true);
74        Mw(NComp)                                                                       as molweight    (Brief="Component Mol Weight",Hidden=true);
75       
76        VapourFlowModel         as Switcher     (Valid = ["Reepmeyer", "Feehery_Fv", "Roffel_Fv", "Klingberg", "Wang_Fv", "Elgue"], Default = "Reepmeyer");
77        LiquidFlowModel                 as Switcher     (Valid = ["default", "Wang_Fl", "Olsen", "Feehery_Fl", "Roffel_Fl"], Default = "default");
78
79        VolumeOfTray            as volume               (Brief="Total Volume of the tray");
80        HeatSupply                      as heat_rate    (Brief="Rate of heat supply");
81        PlateArea                               as area                         (Brief="Plate area = Atray - Adowncomer");
82
83        HolesArea                       as area                                 (Brief="Total holes area");
84        WeirLength                      as length                       (Brief="Weir length");
85        WeirHeight                      as length                       (Brief="Weir height");
86        FeeheryCoeff            as Real                         (Brief="Feeherys correlation coefficient", Unit='1/m^4', Default=1);
87        ElgueCoeff                      as Real                         (Brief="Elgues correlation coefficient", Unit='kg/m/mol^2', Default=1);
88        OlsenCoeff                      as Real                         (Brief="Olsens correlation coefficient", Default=1);
89        TrayLiquidPasses        as Real                         (Brief="Number of liquid passes in the tray", Default=1);
90       
91        TopTemperature          as temperature;
92        TbottomTemperature      as temperature;
93        TopComposition(NComp)                   as fraction     (Brief = "Component Molar Fraction at Top");
94        BottomComposition(NComp)                as fraction     (Brief = "Component Molar Fraction at Bottom");
95       
96        V                                       as volume               (Brief="Total Volume of the tray",Hidden=true);
97        Q                                       as heat_rate    (Brief="Rate of heat supply",Hidden=true);
98        Ap                              as area                         (Brief="Plate area = Atray - Adowncomer",Hidden=true);
99
100        Ah                              as area                                 (Brief="Total holes area",Hidden=true);
101        lw                              as length                       (Brief="Weir length",Hidden=true);
102        hw                              as length                       (Brief="Weir height",Hidden=true);
103        beta                            as fraction             (Brief="Aeration fraction");
104        alfa                            as fraction             (Brief="Dry pressure drop coefficient");
105        w                                       as Real                         (Brief="Feeherys correlation coefficient", Unit='1/m^4', Default=1,Hidden=true);
106        btray                   as Real                         (Brief="Elgues correlation coefficient", Unit='kg/m/mol^2', Default=1,Hidden=true);
107        fw                              as Real                         (Brief="Olsens correlation coefficient", Default=1,Hidden=true);
108        Np                              as Real                         (Brief="Number of liquid passes in the tray", Default=1,Hidden=true);
109       
110        VapourFlow      as Switcher     (Valid = ["on", "off"], Default = "on",Hidden=true);
111        LiquidFlow      as Switcher     (Valid = ["on", "off"], Default = "on",Hidden=true);
112
113SET
114        SpecialTrayIndex(FeedTrayLocation) =1;
115        Mw = PP.MolecularWeight();
116
117        V=VolumeOfTray;
118        Q=HeatSupply;
119        Ap=PlateArea;
120        Ah=HolesArea;
121        lw=WeirLength;
122        hw=WeirHeight ;
123        w=FeeheryCoeff;
124        btray=ElgueCoeff;
125        fw=OlsenCoeff;
126        Np=TrayLiquidPasses;
127
128VARIABLES
129
130        in      FeedTray                                as stream                               (Brief="Feed stream", PosX=0, PosY=0.55);
131       
132        in              LiquidInlet             as      stream                          (Brief="Liquid Inlet in the section", PosX=0.80, PosY=0);
133        out     VapourOutlet            as vapour_stream        (Brief="Vapour Outlet in the section", PosX=0.30, PosY=0);
134       
135        trays(NumberOfTrays) as trayTeste                       (Brief="Number of trays");
136
137        in              VapourInlet             as stream                               (Brief="Vapour Inlet in the section", PosX=0.30, PosY=1);
138        out     LiquidOutlet            as liquid_stream                (Brief="Liquid Outlet in the section", PosX=0.80, PosY=1);
139       
140        LiquidConnector as stream       (Brief="Liquid connection at the middle trays", PosX=0.75, PosY=1,Hidden=true);
141        VapourConnector as stream       (Brief="Vapour connection at the middle trays", PosX=0.55, PosY=0,Hidden=true);
142
143        MurphreeEff                                             as Real         (Brief = "Murphree efficiency");
144
145CONNECTIONS
146
147        trays([2:NumberOfTrays]).OutletV        to trays([1:NumberOfTrays-1]).InletV;
148        trays([1:NumberOfTrays-1]).OutletL      to trays([2:NumberOfTrays]).InletL;
149       
150        LiquidConnector to trays(1).InletL;
151        VapourConnector to trays(NumberOfTrays).InletV;
152       
153EQUATIONS
154
155        LiquidConnector.F= LiquidInlet.F;
156        LiquidConnector.T = LiquidInlet.T;
157        LiquidConnector.P = LiquidInlet.P;
158        LiquidConnector.z = LiquidInlet.z;
159        LiquidConnector.v = LiquidInlet.v;
160        LiquidConnector.h = LiquidInlet.h;
161       
162        VapourConnector.F= VapourInlet.F;
163        VapourConnector.T = VapourInlet.T;
164        VapourConnector.P = VapourInlet.P;
165        VapourConnector.z = VapourInlet.z;
166        VapourConnector.v = VapourInlet.v;
167        VapourConnector.h = VapourInlet.h;
168       
169        LiquidOutlet.F= trays(NumberOfTrays).OutletL.F;
170        LiquidOutlet.T = trays(NumberOfTrays).OutletL.T;
171        LiquidOutlet.P = trays(NumberOfTrays).OutletL.P;
172        LiquidOutlet.z = trays(NumberOfTrays).OutletL.z;
173       
174        VapourOutlet.F= trays(1).OutletV.F;
175        VapourOutlet.T = trays(1).OutletV.T;
176        VapourOutlet.P = trays(1).OutletV.P;
177        VapourOutlet.z = trays(1).OutletV.z;
178
179# Connecting Trays
180        FeedTray.F*SpecialTrayIndex= trays.Inlet.F;
181        FeedTray.T = trays.Inlet.T;
182        FeedTray.P = trays.Inlet.P;
183        FeedTray.z = trays.Inlet.z;
184        FeedTray.v = trays.Inlet.v;
185        FeedTray.h = trays.Inlet.h;
186       
187for i in [1:NumberOfTrays] do
188
189"Murphree Efficiency"
190        trays(i).OutletV.z =  MurphreeEff * (trays(i).yideal - trays(i).InletV.z) + trays(i).InletV.z;
191
192"Level of clear liquid over the weir"
193        trays(i).Level = trays(i).ML*trays(i).vL/Ap;
194
195"Geometry Constraint"
196        V = trays(i).ML* trays(i).vL + trays(i).MV*trays(i).vV;
197
198"Energy Holdup"
199        trays(i).E = trays(i).ML*trays(i).OutletL.h + trays(i).MV*trays(i).OutletV.h - trays(i).OutletL.P*V;
200
201"Energy Balance"
202        diff(trays(i).E) = ( trays(i).Inlet.F*trays(i).Inlet.h + trays(i).InletL.F*trays(i).InletL.h + trays(i).InletV.F*trays(i).InletV.h- trays(i).OutletL.F*trays(i).OutletL.h - trays(i).OutletV.F*trays(i).OutletV.h + Q );
203
204switch LiquidFlow
205                case "on":
206                        switch LiquidFlowModel
207                                case "default":
208                                "Francis Equation"
209                                trays(i).OutletL.F*trays(i).vL = 1.84*'1/s'*lw*((trays(i).Level-(beta*hw))/(beta))^2;
210                       
211                                case "Wang_Fl":
212                                trays(i).OutletL.F*trays(i).vL = 1.84*'m^0.5/s'*lw*((trays(i).Level-(beta*hw))/(beta))^1.5;
213                       
214                                case "Olsen":
215                                trays(i).OutletL.F / 'mol/s'= lw*Np*trays(i).rhoL/sum(Mw*trays(i).OutletV.z)/(0.665*fw)^1.5 * ((trays(i).ML*sum(Mw*trays(i).OutletL.z)/trays(i).rhoL/Ap)-hw)^1.5 * 'm^0.5/mol';
216                       
217                                case "Feehery_Fl":
218                                trays(i).OutletL.F = lw*trays(i).rhoL/sum(Mw*trays(i).OutletL.z) * ((trays(i).Level-hw)/750/'mm')^1.5 * 'm^2/s';
219                       
220                                case "Roffel_Fl":
221                                trays(i).OutletL.F = 2/3*sqrt(2*g)*trays(i).rhoL/sum(Mw*trays(i).OutletL.z)*lw*(2*trays(i).btemp-1)*(trays(i).ML*sum(Mw*trays(i).OutletL.z)/(Ap*1.3)/trays(i).rhoL/(2*trays(i).btemp-1))^1.5;
222                        end
223                when trays(i).Level < (beta *hw) switchto "off";
224               
225                case "off":
226                "Low level"
227                trays(i).OutletL.F = 0 * 'mol/h';
228                when trays(i).Level > (beta * hw) + 1e-6*'m' switchto "on";
229        end
230       
231        trays(i).btemp = 1 - 0.3593/'Pa^0.0888545'*abs(trays(i).OutletV.F*sum(Mw*trays(i).OutletV.z)/(Ap*1.3)/sqrt(trays(i).rhoV))^0.177709; #/'(kg/m)^0.0888545/s^0.177709';
232
233switch VapourFlow
234                case "on":
235                        switch VapourFlowModel
236                                case "Reepmeyer":
237                                trays(i).InletV.F*trays(i).vV = sqrt((trays(i).InletV.P - trays(i).OutletV.P)/(trays(i).rhoV*alfa))*Ah;
238                       
239                                case "Feehery_Fv":
240                                trays(i).InletV.F = trays(i).rhoV/Ap/w/sum(Mw*trays(i).OutletV.z) * sqrt(((trays(i).InletV.P - trays(i).OutletV.P)-(trays(i).rhoV*g*trays(i).ML*trays(i).vL/Ap))/trays(i).rhoV);
241                       
242                                case "Roffel_Fv":
243                                trays(i).InletV.F^1.08 * 0.0013 * 'kg/m/mol^1.08/s^0.92*1e5' = (trays(i).InletV.P - trays(i).OutletV.P)*1e5 - (beta*sum(trays(i).M*Mw)/(Ap*1.3)*g*1e5) * (trays(i).rhoV*Ah/sum(Mw*trays(i).OutletV.z))^1.08 * 'm^1.08/mol^1.08';
244                       
245                                case "Klingberg":
246                                trays(i).InletV.F * trays(i).vV = Ap * sqrt(((trays(i).InletV.P - trays(i).OutletV.P)-trays(i).rhoL*g*trays(i).Level)/trays(i).rhoV);
247                       
248                                case "Wang_Fv":
249                                trays(i).InletV.F * trays(i).vV = Ap * sqrt(((trays(i).InletV.P - trays(i).OutletV.P)-trays(i).rhoL*g*trays(i).Level)/trays(i).rhoV*alfa);
250                               
251                                case "Elgue":
252                                trays(i).InletV.F  = sqrt((trays(i).InletV.P - trays(i).OutletV.P)/btray);
253                        end
254                when trays(i).InletV.F < 1e-6 * 'kmol/h' switchto "off";
255               
256                case "off":
257                trays(i).InletV.F = 0 * 'mol/s';
258                when trays(i).InletV.P > trays(i).OutletV.P + trays(i).Level*g*trays(i).rhoL + 1e-1 * 'atm' switchto "on";
259        end
260
261end
262
263INITIAL
264
265# The initial temperature of the trays
266for i in 1:NumberOfTrays do
267       
268"The initial temperature of the trays"
269        trays(i).OutletL.T = TopTemperature+(TbottomTemperature-TopTemperature)*((i-1)/(NumberOfTrays-1));
270
271end
272
273for i in 1:NComp-1 do
274       
275for j in 1:NumberOfTrays do
276
277"The initial composition of the trays"
278        trays(j).OutletL.z(i) = TopComposition(i) +(BottomComposition(i)-TopComposition(i) )*((j-1)/(NumberOfTrays-1));
279
280end
281
282end
283
284end
285
286#*----------------------------------------------------------------------
287* Model of a  distillation column containing:
288*       - NumberOfTrays like tray;
289*       - a kettle reboiler;
290*       - dymamic condenser;
291*       - a splitter which separate reflux and distillate;
292*       - a pump in reflux stream;
293*---------------------------------------------------------------------
294Model Distillation_kettle_condTeste
295        ATTRIBUTES
296        Pallete         = true;
297        Icon            = "icon/DistillationKettleCond";
298        Brief           = "Model of a distillation column with dynamic condenser and dynamic reboiler.";
299        Info            =
300"== Specify ==
301* the feed stream of each tray (Inlet);
302* the Murphree eficiency for each tray Emv;
303* the pump pressure difference;
304* the heat supllied in reboiler and condenser;
305* the condenser vapor outlet flow (OutletV.F);
306* the reboiler liquid outlet flow (OutletL.F);
307* both splitter outlet flows OR one of the splitter outlet flows and the splitter frac.
308       
309== Initial Conditions ==
310* the trays temperature (OutletL.T);
311* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
312* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
313       
314* the condenser temperature (OutletL.T);
315* the condenser liquid level (Level);
316* (NoComps - 1) OutletL (OR OutletV) compositions;
317       
318* the reboiler temperature (OutletL.T);
319* the reboiler liquid level (Level);
320* (NoComps - 1) OutletL (OR OutletV) compositions.
321";
322       
323PARAMETERS
324        outer PP                        as Plugin               (Brief = "External Physical Properties", Type="PP");
325        outer NComp     as Integer;
326        NumberOfTrays                           as Integer              (Brief="Number of trays", Default=2);
327        topdown                         as Integer              (Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
328        top                                     as Integer              (Brief="Number of top tray");
329        bot                                     as Integer              (Brief="Number of bottom tray");
330        VapourFlow              as Switcher     (Valid = ["on", "off"], Default = "on");
331       
332SET
333        top = (NumberOfTrays-1)*(1-topdown)/2+1;
334        bot = NumberOfTrays/top;
335       
336VARIABLES
337        trays(NumberOfTrays)    as trayTeste;
338        cond                            as condenser;
339        reb                                     as reboiler;
340        sptop                           as splitter;
341        pump1                           as pump;
342        alfaTopo                        as Real;
343       
344EQUATIONS
345
346        switch VapourFlow
347                case "on":
348                cond.InletV.F*trays(top).vV = alfaTopo * trays(top).Ah * sqrt(2*(trays(top).OutletV.P -
349                cond.OutletL.P + 1e-8 * 'atm') / (trays(top).alfa*trays(top).rhoV));
350                when cond.InletV.F < 1e-6 * 'kmol/h' switchto "off";
351               
352                case "off":
353                cond.InletV.F = 0 * 'mol/s';
354                when trays(top).OutletV.P > cond.OutletL.P + 1e-1 * 'atm' switchto "on";
355        end     
356
357CONNECTIONS
358#vapor
359        reb.OutletV to trays(bot).InletV;
360        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
361        trays(top).OutletV to cond.InletV;
362
363#liquid
364        cond.OutletL to sptop.Inlet;   
365        sptop.Outlet2 to pump1.Inlet;
366        pump1.Outlet to trays(top).InletL;
367        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
368        trays(bot).OutletL to reb.InletL;
369
370end
371
372
373#* -------------------------------------------------------------------
374* Distillation Column model with:
375*
376*       - NumberOfTrays like tray;
377*       - a vessel in the bottom of column;
378*       - a splitter who separate the bottom product and the stream to reboiler;
379*       - steady state reboiler (thermosyphon);
380*       - a steady state condenser with subcooling;
381*       - a vessel drum (layed cilinder);
382*       - a splitter which separate reflux and distillate;
383*       - a pump in reflux stream.
384*
385* ------------------------------------------------------------------
386Model Distillation_thermosyphon_subcoolingTeste
387        ATTRIBUTES
388        Pallete         = true;
389        Icon            = "icon/DistillationThermosyphonSubcooling";
390        Brief           = "Model of a distillation column with steady condenser and steady reboiler.";
391        Info            =
392"== Specify ==
393* the feed stream of each tray (Inlet);
394* the Murphree eficiency for each tray Emv;
395* the pump head;
396* the condenser pressure drop;
397* the heat supllied in top and bottom tanks;
398* the heat supllied in condenser and reboiler;
399* the Outlet1 flow in the bottom splitter (spbottom.Outlet1.F) that corresponds to the bottom product;
400* both  top splitter outlet flows OR one of the splitter outlet flows and the splitter frac.
401       
402== Initial Conditions ==
403* the trays temperature (OutletL.T);
404* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
405* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
406       
407* the top tank temperature (OutletL.T);
408* the top tank liquid level (Level);
409* (NoComps - 1) OutletL (OR OutletV) compositions;
410       
411* the bottom tank temperature (OutletL.T);
412* the bottom tank liquid level (Level);
413* (NoComps - 1) OutletL (OR OutletV) compositions.
414";
415       
416        PARAMETERS
417        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
418        outer NComp as Integer;
419        NumberOfTrays as Integer(Brief="Number of trays", Default=2);
420        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
421        top as Integer(Brief="Number of top tray");
422        bot as Integer(Brief="Number of bottom tray");
423        VapourFlow as Switcher(Valid = ["on", "off"], Default = "on");
424
425        SET
426        top = (NumberOfTrays-1)*(1-topdown)/2+1;
427        bot = NumberOfTrays/top;
428       
429        VARIABLES
430        trays(NumberOfTrays) as trayTeste;
431        cond as condenserSteady;
432        reb as reboilerSteady;
433        tbottom as tank;
434        ttop as tank_cylindrical;
435        spbottom as splitter;
436        sptop as splitter;
437        pump1 as pump;
438        alfaTopo as Real;
439
440        EQUATIONS
441        switch VapourFlow
442                case "on":
443                cond.InletV.F*trays(top).vV = alfaTopo * trays(top).Ah * sqrt(2*(trays(top).OutletV.P -
444                cond.OutletL.P + 1e-8 * 'atm') / (trays(top).alfa*trays(top).rhoV));
445                when cond.InletV.F < 1e-6 * 'kmol/h' switchto "off";
446               
447                case "off":
448                cond.InletV.F = 0 * 'mol/s';
449                when trays(top).OutletV.P > cond.OutletL.P + 1e-1 * 'atm' switchto "on";
450        end     
451       
452        CONNECTIONS
453        #vapor
454        reb.OutletV to trays(bot).InletV;
455        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
456        trays(top).OutletV to cond.InletV;
457       
458        #liquid
459        cond.OutletL to ttop.Inlet;     
460        ttop.Outlet to sptop.Inlet;
461        sptop.Outlet2 to pump1.Inlet;   
462        pump1.Outlet to trays(top).InletL;
463        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
464        trays(bot).OutletL to tbottom.Inlet;
465        tbottom.Outlet to spbottom.Inlet;
466        spbottom.Outlet2 to reb.InletL;
467end
468
469
470#* -------------------------------------------------------------------
471* Distillation Column model with:
472*
473*       - NumberOfTrays like tray;
474*       - a vessel in the bottom of column;
475*       - a splitter who separate the bottom product and the stream to reboiler;
476*       - steady state reboiler (thermosyphon);
477*       - a dynamic condenser without subcooling;
478*       - a splitter which separate reflux and distillate;
479*       - a pump in reflux stream.
480*
481* ------------------------------------------------------------------*
482Model Distillation_thermosyphon_condTeste
483        ATTRIBUTES
484        Pallete         = true;
485        Icon            = "icon/DistillationThermosyphonCond";
486        Brief           = "Model of a distillation column with dynamic condenser and steady reboiler.";
487        Info            =
488"== Specify ==
489* the feed stream of each tray (Inlet);
490* the Murphree eficiency for each tray Emv;
491* the pump head;
492* the condenser vapor outlet flow (OutletV.F);
493* the heat supllied in bottom tank;
494* the heat supllied in condenser and reboiler;
495* the Outlet1 flow in the bottom splitter (spbottom.Outlet1.F) that corresponds to the bottom product;
496       
497== Initial Conditions ==
498* the trays temperature (OutletL.T);
499* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
500* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
501       
502* the condenser temperature (OutletL.T);
503* the condenser liquid level (Level);
504* (NoComps - 1) OutletL (OR OutletV) compositions;
505       
506* the bottom tank temperature (OutletL.T);
507* the bottom tank liquid level (Level);
508* (NoComps - 1) OutletL (OR OutletV) compositions.
509";
510
511        PARAMETERS
512        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
513        outer NComp as Integer;
514        NumberOfTrays as Integer(Brief="Number of trays", Default=2);
515        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
516        top as Integer(Brief="Number of top tray");
517        bot as Integer(Brief="Number of bottom tray");
518        VapourFlow as Switcher(Valid = ["on", "off"], Default = "on");
519
520        SET
521        top = (NumberOfTrays-1)*(1-topdown)/2+1;
522        bot = NumberOfTrays/top;
523       
524        VARIABLES
525        trays(NumberOfTrays) as trayTeste;
526        cond as condenser;
527        reb as reboilerSteady;
528        tbottom as tank;
529        spbottom as splitter;
530        sptop as splitter;
531        pump1 as pump;
532        alfaTopo as Real;
533
534        EQUATIONS
535        switch VapourFlow
536                case "on":
537                cond.InletV.F*trays(top).vV = alfaTopo * trays(top).Ah * sqrt(2*(trays(top).OutletV.P -
538                cond.OutletL.P + 1e-8 * 'atm') / (trays(top).alfa*trays(top).rhoV));
539                when cond.InletV.F < 1e-6 * 'kmol/h' switchto "off";
540               
541                case "off":
542                cond.InletV.F = 0 * 'mol/s';
543                when trays(top).OutletV.P > cond.OutletL.P + 1e-1 * 'atm' switchto "on";
544        end     
545                       
546        CONNECTIONS
547        #vapor
548        reb.OutletV to trays(bot).InletV;
549        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
550        trays(top).OutletV to cond.InletV;
551       
552        #liquid
553        cond.OutletL to sptop.Inlet;   
554        sptop.Outlet2 to pump1.Inlet;
555        pump1.Outlet to trays(top).InletL;
556        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
557        trays(bot).OutletL to tbottom.Inlet;
558        tbottom.Outlet to spbottom.Inlet;
559        spbottom.Outlet2 to reb.InletL;
560end
561
562#* -------------------------------------------------------------------
563* Distillation Column model with:
564*
565*       - NumberOfTrays like tray;
566*       - a kettle reboiler;
567*       - a steady state condenser with subcooling;
568*       - a vessel drum (layed cilinder);
569*       - a splitter which separate reflux and distillate;
570*       - a pump in reflux stream.
571*
572* ------------------------------------------------------------------*
573Model Distillation_kettle_subcoolingTeste
574        ATTRIBUTES
575        Pallete         = true;
576        Icon            = "icon/DistillationKettleSubcooling";
577        Brief           = "Model of a distillation column with steady condenser and dynamic reboiler.";
578        Info            =
579"== Specify ==
580* the feed stream of each tray (Inlet);
581* the Murphree eficiency for each tray (Emv);
582* the pump pressure difference;
583* the heat supllied in reboiler and condenser;
584* the heat supllied in the top tank;
585* the condenser pressure drop;
586* the reboiler liquid outlet flow (OutletL.F);
587* both splitter outlet flows OR one of the splitter outlet flows and the splitter frac.
588       
589== Initial Conditions ==
590* the trays temperature (OutletL.T);
591* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
592* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
593       
594* the top tank temperature (OutletL.T);
595* the top tank liquid level (Level);
596* (NoComps - 1) OutletL (OR OutletV) compositions;
597       
598* the reboiler temperature (OutletL.T);
599* the reboiler liquid level (Level);
600* (NoComps - 1) OutletL (OR OutletV) compositions.
601";
602       
603        PARAMETERS
604        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
605        outer NComp as Integer;
606        NumberOfTrays as Integer(Brief="Number of trays", Default=2);
607        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
608        top as Integer(Brief="Number of top tray");
609        bot as Integer(Brief="Number of bottom tray");
610        VapourFlow as Switcher(Valid = ["on", "off"], Default = "on");
611
612        SET
613        top = (NumberOfTrays-1)*(1-topdown)/2+1;
614        bot = NumberOfTrays/top;
615       
616        VARIABLES
617        trays(NumberOfTrays) as trayTeste;
618        cond as condenserSteady;
619        reb as reboiler;
620        ttop as tank_cylindrical;
621        sptop as splitter;
622        pump1 as pump;
623        alfaTopo as Real;
624
625        EQUATIONS
626        switch VapourFlow
627                case "on":
628                cond.InletV.F*trays(top).vV = alfaTopo * trays(top).Ah * sqrt(2*(trays(top).OutletV.P -
629                cond.OutletL.P + 1e-8 * 'atm') / (trays(top).alfa*trays(top).rhoV));
630                when cond.InletV.F < 1e-6 * 'kmol/h' switchto "off";
631               
632                case "off":
633                cond.InletV.F = 0 * 'mol/s';
634                when trays(top).OutletV.P > cond.OutletL.P + 1e-1 * 'atm' switchto "on";
635        end     
636       
637        CONNECTIONS
638        #vapor
639        reb.OutletV to trays(bot).InletV;
640        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
641        trays(top).OutletV to cond.InletV;
642       
643        #liquid
644        cond.OutletL to ttop.Inlet;     
645        ttop.Outlet to sptop.Inlet;
646        sptop.Outlet2 to pump1.Inlet;   
647        pump1.Outlet to trays(top).InletL;
648        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
649        trays(bot).OutletL to reb.InletL;
650end
651
652
653#*----------------------------------------------------------------------
654* Model of a  rectifier containing:
655*       - NumberOfTrays like tray;
656*       - dymamic condenser without subcooling;
657*       - a splitter which separate reflux and distillate;
658*       - a pump in reflux stream;
659*---------------------------------------------------------------------*
660Model RectifierTeste
661        ATTRIBUTES
662        Pallete         = true;
663        Icon            = "icon/RefluxedCond";
664        Brief           = "Model of a rectifier column with dynamic condenser.";
665        Info            =
666"== Specify ==
667* the feed stream of each tray (Inlet);
668* the Murphree eficiency for each tray Emv;
669* the InletV stream of the bottom tray unless its flow;
670* the pump pressure difference;
671* the heat supllied in the condenser;
672* the condenser vapor outlet flow (OutletV.F);
673* both splitter outlet flows OR one of the splitter outlet flows and the splitter frac.
674       
675== Initial Conditions ==
676* the trays temperature (OutletL.T);
677* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
678* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
679       
680* the condenser temperature (OutletL.T);
681* the condenser liquid level (Level);
682* (NoComps - 1) OutletL (OR OutletV) compositions;
683";
684
685        PARAMETERS
686        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
687        outer NComp as Integer;
688        NumberOfTrays as Integer(Brief="Number of trays", Default=2);
689        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
690        top as Integer(Brief="Number of top tray");
691        bot as Integer(Brief="Number of bottom tray");
692        VapourFlow as Switcher(Valid = ["on", "off"], Default = "on");
693
694        SET
695        top = (NumberOfTrays-1)*(1-topdown)/2+1;
696        bot = NumberOfTrays/top;
697       
698        VARIABLES
699        trays(NumberOfTrays) as trayTeste;
700        cond as condenser;
701        sptop as splitter;
702        pump1 as pump;
703        alfaTopo as Real;
704
705        EQUATIONS
706        switch VapourFlow
707                case "on":
708                cond.InletV.F*trays(top).vV = alfaTopo * trays(top).Ah * sqrt(2*(trays(top).OutletV.P -
709                cond.OutletL.P + 1e-8 * 'atm') / (trays(top).alfa*trays(top).rhoV));
710                when cond.InletV.F < 1e-6 * 'kmol/h' switchto "off";
711               
712                case "off":
713                cond.InletV.F = 0 * 'mol/s';
714                when trays(top).OutletV.P > cond.OutletL.P + 1e-1 * 'atm' switchto "on";
715        end     
716       
717        CONNECTIONS
718        #vapor
719        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
720        trays(top).OutletV to cond.InletV;
721       
722        #liquid
723        cond.OutletL to sptop.Inlet;   
724        sptop.Outlet2 to pump1.Inlet;   
725        pump1.Outlet to trays(top).InletL;
726        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
727end
728
729
730#* -------------------------------------------------------------------
731* Rectifier Column with:
732*
733*       - NumberOfTrays like tray;
734*       - a steady state condenser with subcooling;
735*       - a vessel drum (layed cilinder);
736*       - a splitter which separate reflux and distillate;
737*       - a pump in reflux stream.
738*
739* ------------------------------------------------------------------*
740Model Rectifier_subcoolingTeste
741        ATTRIBUTES
742        Pallete         = true;
743        Icon            = "icon/RefluxedSubcooling";
744        Brief           = "Model of a rectifier column with steady condenser.";
745        Info            =
746"== Specify ==
747* the feed stream of each tray (Inlet);
748* the Murphree eficiency for each tray Emv;
749* the InletV stream of the bottom tray unless its flow;
750* the pump head;
751* the condenser pressure drop;
752* the heat supllied in  the top tank;
753* the heat supllied in condenser;
754* both  top splitter outlet flows OR one of the splitter outlet flows and the splitter frac.
755       
756== Initial Conditions ==
757* the trays temperature (OutletL.T);
758* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
759* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
760       
761* the top tank temperature (OutletL.T);
762* the top tank liquid level (Level);
763* (NoComps - 1) OutletL (OR OutletV) compositions;
764";
765       
766        PARAMETERS
767        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
768        outer NComp as Integer;
769        NumberOfTrays as Integer(Brief="Number of trays", Default=2);
770        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
771        top as Integer(Brief="Number of top tray");
772        bot as Integer(Brief="Number of bottom tray");
773        VapourFlow as Switcher(Valid = ["on", "off"], Default = "on");
774
775        SET
776        top = (NumberOfTrays-1)*(1-topdown)/2+1;
777        bot = NumberOfTrays/top;
778       
779        VARIABLES
780        trays(NumberOfTrays) as trayTeste;
781        cond as condenserSteady;
782        ttop as tank_cylindrical;
783        sptop as splitter;
784        pump1 as pump;
785        alfaTopo as Real;
786
787        EQUATIONS
788        switch VapourFlow
789                case "on":
790                cond.InletV.F*trays(top).vV = alfaTopo * trays(top).Ah * sqrt(2*(trays(top).OutletV.P -
791                cond.OutletL.P + 1e-8 * 'atm') / (trays(top).alfa*trays(top).rhoV));
792                when cond.InletV.F < 1e-6 * 'kmol/h' switchto "off";
793               
794                case "off":
795                cond.InletV.F = 0 * 'mol/s';
796                when trays(top).OutletV.P > cond.OutletL.P + 1e-1 * 'atm' switchto "on";
797        end     
798       
799        CONNECTIONS
800        #vapor
801        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
802        trays(top).OutletV to cond.InletV;
803       
804        #liquid
805        cond.OutletL to ttop.Inlet;     
806        ttop.Outlet to sptop.Inlet;
807        sptop.Outlet2 to pump1.Inlet;   
808        pump1.Outlet to trays(top).InletL;
809        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
810end
811
812
813#*----------------------------------------------------------------------
814* Model of a  Refluxed Stripping column containing:
815*       - NumberOfTrays like tray;
816*       - dymamic condenser without subcooling;
817*       - a splitter which separate reflux and distillate;
818*       - a pump in reflux stream;
819*---------------------------------------------------------------------*
820Model Refluxed_StrippingTeste
821        ATTRIBUTES
822        Pallete         = true;
823        Icon            = "icon/RefluxedCond";
824        Brief           = "Model of a refluxed stripping column with dynamic condenser.";
825        Info            =
826"== Specify ==
827* the feed stream of each tray (Inlet);
828* the Murphree eficiency for each tray Emv;
829* the InletV stream of the bottom tray unless its flow;
830* the pump pressure difference;
831* the heat supllied in the condenser;
832* the condenser vapor outlet flow (OutletV.F);
833* both splitter outlet flows OR one of the splitter outlet flows and the splitter frac.
834       
835== Initial Conditions ==
836* the trays temperature (OutletL.T);
837* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
838* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
839       
840* the condenser temperature (OutletL.T);
841* the condenser liquid level (Level);
842* (NoComps - 1) OutletL (OR OutletV) compositions;
843";
844       
845        PARAMETERS
846        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
847        outer NComp as Integer;
848        NumberOfTrays as Integer(Brief="Number of trays", Default=2);
849        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
850        top as Integer(Brief="Number of top tray");
851        bot as Integer(Brief="Number of bottom tray");
852        VapourFlow as Switcher(Valid = ["on", "off"], Default = "on");
853
854        SET
855        top = (NumberOfTrays-1)*(1-topdown)/2+1;
856        bot = NumberOfTrays/top;
857       
858        VARIABLES
859        trays(NumberOfTrays) as trayTeste;
860        cond as condenser;
861        sptop as splitter;
862        pump1 as pump;
863        alfaTopo as Real;
864
865        EQUATIONS
866        switch VapourFlow
867                case "on":
868                cond.InletV.F*trays(top).vV = alfaTopo * trays(top).Ah * sqrt(2*(trays(top).OutletV.P -
869                cond.OutletL.P + 1e-8 * 'atm') / (trays(top).alfa*trays(top).rhoV));
870                when cond.InletV.F < 1e-6 * 'kmol/h' switchto "off";
871               
872                case "off":
873                cond.InletV.F = 0 * 'mol/s';
874                when trays(top).OutletV.P > cond.OutletL.P + 1e-1 * 'atm' switchto "on";
875        end
876       
877        CONNECTIONS
878        #vapor
879        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
880        trays(top).OutletV to cond.InletV;
881       
882        #liquid
883        cond.OutletL to sptop.Inlet;   
884        sptop.Outlet2 to pump1.Inlet;   
885        pump1.Outlet to trays(top).InletL;
886        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
887end
888
889
890#* -------------------------------------------------------------------
891* Refluxed Stripping Column with:
892*
893*       - NumberOfTrays like tray;
894*       - a steady state condenser (with subcooling);
895*       - a vessel drum (layed cilinder);
896*       - a splitter which separate reflux and distillate;
897*       - a pump in reflux stream.
898*
899* ------------------------------------------------------------------*
900Model Refluxed_Stripping_subcoolingTeste
901        ATTRIBUTES
902        Pallete         = true;
903        Icon            = "icon/RefluxedSubcooling";
904        Brief           = "Model of a refluxed stripping column with steady condenser.";
905        Info            =
906"== Specify ==
907* the feed stream of each tray (Inlet);
908* the Murphree eficiency for each tray Emv;
909* the InletV stream of the bottom tray unless its flow;
910* the pump head;
911* the condenser pressure drop;
912* the heat supllied in  the top tank;
913* the heat supllied in condenser;
914* both  top splitter outlet flows OR one of the splitter outlet flows and the splitter frac.
915       
916== Initial Conditions ==
917* the trays temperature (OutletL.T);
918* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
919* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
920       
921* the top tank temperature (OutletL.T);
922* the top tank liquid level (Level);
923* (NoComps - 1) OutletL (OR OutletV) compositions;
924";
925       
926        PARAMETERS
927        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
928        outer NComp as Integer;
929        NumberOfTrays as Integer(Brief="Number of trays", Default=2);
930        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
931        top as Integer(Brief="Number of top tray");
932        bot as Integer(Brief="Number of bottom tray");
933        VapourFlow as Switcher(Valid = ["on", "off"], Default = "on");
934
935        SET
936        top = (NumberOfTrays-1)*(1-topdown)/2+1;
937        bot = NumberOfTrays/top;
938       
939        VARIABLES
940        trays(NumberOfTrays) as trayTeste;
941        cond as condenserSteady;
942        ttop as tank_cylindrical;
943        sptop as splitter;
944        pump1 as pump;
945        alfaTopo as Real;
946
947        EQUATIONS
948        switch VapourFlow
949                case "on":
950                cond.InletV.F*trays(top).vV = alfaTopo * trays(top).Ah * sqrt(2*(trays(top).OutletV.P -
951                cond.OutletL.P + 1e-8 * 'atm') / (trays(top).alfa*trays(top).rhoV));
952                when cond.InletV.F < 1e-6 * 'kmol/h' switchto "off";
953               
954                case "off":
955                cond.InletV.F = 0 * 'mol/s';
956                when trays(top).OutletV.P > cond.OutletL.P + 1e-1 * 'atm' switchto "on";
957        end
958       
959        CONNECTIONS
960        #vapor
961        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
962        trays(top).OutletV to cond.InletV;
963       
964        #liquid
965        cond.OutletL to ttop.Inlet;     
966        ttop.Outlet to sptop.Inlet;
967        sptop.Outlet2 to pump1.Inlet;   
968        pump1.Outlet to trays(top).InletL;
969        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
970end
971
972
973#*----------------------------------------------------------------------
974* Model of a  Refluxed Absorption column containing:
975*       - NumberOfTrays like tray;
976*       - dymamic condenser without subcooling;
977*       - a splitter which separate reflux and distillate;
978*       - a pump in reflux stream;
979*---------------------------------------------------------------------*
980Model Refluxed_AbsorptionTeste
981        ATTRIBUTES
982        Pallete         = true;
983        Icon            = "icon/RefluxedCond";
984        Brief           = "Model of a refluxed absorption column with dynamic condenser.";
985        Info            =
986"== Specify ==
987* the feed stream of each tray (Inlet);
988* the Murphree eficiency for each tray Emv;
989* the InletV stream of the bottom tray unless its flow;
990* the pump pressure difference;
991* the heat supllied in the condenser;
992* the condenser vapor outlet flow (OutletV.F);
993* both splitter outlet flows OR one of the splitter outlet flows and the splitter frac.
994       
995== Initial Conditions ==
996* the trays temperature (OutletL.T);
997* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
998* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
999       
1000* the condenser temperature (OutletL.T);
1001* the condenser liquid level (Level);
1002* (NoComps - 1) OutletL (OR OutletV) compositions;
1003";
1004       
1005        PARAMETERS
1006        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
1007        outer NComp as Integer;
1008        NumberOfTrays as Integer(Brief="Number of trays", Default=2);
1009        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
1010        top as Integer(Brief="Number of top tray");
1011        bot as Integer(Brief="Number of bottom tray");
1012        VapourFlow as Switcher(Valid = ["on", "off"], Default = "on");
1013
1014        SET
1015        top = (NumberOfTrays-1)*(1-topdown)/2+1;
1016        bot = NumberOfTrays/top;
1017       
1018        VARIABLES
1019        trays(NumberOfTrays) as trayTeste;
1020        cond as condenser;
1021        sptop as splitter;
1022        pump1 as pump;
1023        alfaTopo as Real;
1024
1025        EQUATIONS
1026        switch VapourFlow
1027                case "on":
1028                cond.InletV.F*trays(top).vV = alfaTopo * trays(top).Ah * sqrt(2*(trays(top).OutletV.P -
1029                cond.OutletL.P + 1e-8 * 'atm') / (trays(top).alfa*trays(top).rhoV));
1030                when cond.InletV.F < 1e-6 * 'kmol/h' switchto "off";
1031               
1032                case "off":
1033                cond.InletV.F = 0 * 'mol/s';
1034                when trays(top).OutletV.P > cond.OutletL.P + 1e-1 * 'atm' switchto "on";
1035        end
1036       
1037        CONNECTIONS
1038        #vapor
1039        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
1040        trays(top).OutletV to cond.InletV;
1041       
1042        #liquid
1043        cond.OutletL to cond.InletV;   
1044        cond.OutletL to sptop.Inlet;
1045        sptop.Outlet2 to pump1.Inlet;   
1046        pump1.Outlet to trays(top).InletL;
1047        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
1048end
1049
1050
1051#* -------------------------------------------------------------------
1052* Refluxed Absorption Column with:
1053*
1054*       - NumberOfTrays like tray;
1055*       - a steady state condenser (with subcooling);
1056*       - a vessel drum (layed cilinder);
1057*       - a splitter which separate reflux and distillate;
1058*       - a pump in reflux stream.
1059*
1060* ------------------------------------------------------------------*
1061Model Refluxed_Absorption_subcoolingTeste
1062        ATTRIBUTES
1063        Pallete         = true;
1064        Icon            = "icon/RefluxedSubcooling";
1065        Brief           = "Model of a refluxed absorption column with steady condenser.";
1066        Info            =
1067"== Specify ==
1068* the feed stream of each tray (Inlet);
1069* the Murphree eficiency for each tray Emv;
1070* the InletV stream of the bottom tray unless its flow;
1071* the pump head;
1072* the condenser pressure drop;
1073* the heat supllied in  the top tank;
1074* the heat supllied in condenser;
1075* both  top splitter outlet flows OR one of the splitter outlet flows and the splitter frac.
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 top tank temperature (OutletL.T);
1083* the top tank 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        NumberOfTrays 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        VapourFlow as Switcher(Valid = ["on", "off"], Default = "on");
1095
1096        SET
1097        top = (NumberOfTrays-1)*(1-topdown)/2+1;
1098        bot = NumberOfTrays/top;
1099       
1100        VARIABLES
1101        trays(NumberOfTrays) as trayTeste;
1102        cond as condenserSteady;
1103        ttop as tank_cylindrical;
1104        sptop as splitter;
1105        pump1 as pump;
1106        alfaTopo as Real;
1107
1108        EQUATIONS
1109        switch VapourFlow
1110                case "on":
1111                cond.InletV.F*trays(top).vV = alfaTopo * trays(top).Ah * sqrt(2*(trays(top).OutletV.P -
1112                cond.OutletL.P + 1e-8 * 'atm') / (trays(top).alfa*trays(top).rhoV));
1113                when cond.InletV.F < 1e-6 * 'kmol/h' switchto "off";
1114               
1115                case "off":
1116                cond.InletV.F = 0 * 'mol/s';
1117                when trays(top).OutletV.P > cond.OutletL.P + 1e-1 * 'atm' switchto "on";
1118        end     
1119       
1120        CONNECTIONS
1121        #vapor
1122        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
1123        trays(top).OutletV to cond.InletV;
1124       
1125        #liquid
1126        cond.OutletL to ttop.Inlet;     
1127        ttop.Outlet to sptop.Inlet;
1128        sptop.Outlet2 to pump1.Inlet;   
1129        pump1.Outlet to trays(top).InletL;
1130        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
1131end
1132
1133
1134#* -------------------------------------------------------------------
1135* Reboiled Stripping Column model with:
1136*
1137*       - NumberOfTrays like tray;
1138*       - a kettle reboiler;
1139*
1140* ------------------------------------------------------------------*
1141Model Reboiled_Stripping_kettleTeste
1142        ATTRIBUTES
1143        Pallete         = true;
1144        Icon            = "icon/ReboiledKettle";
1145        Brief           = "Model of a reboiled stripping column with dynamic reboiler.";
1146        Info            =
1147"== Specify ==
1148* the feed stream of each tray (Inlet);
1149* the Murphree eficiency for each tray Emv;
1150* the vapour flow leaving the top of the column;
1151* the InletL stream of the top tray;
1152* the heat supllied in the reboiler;
1153* the reboiler liquid outlet flow (OutletL.F);
1154       
1155== Initial Conditions ==
1156* the trays temperature (OutletL.T);
1157* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
1158* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
1159       
1160* the reboiler temperature (OutletL.T);
1161* the reboiler liquid level (Level);
1162* (NoComps - 1) OutletL (OR OutletV) compositions.
1163";
1164
1165        PARAMETERS
1166        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
1167        outer NComp as Integer;
1168        NumberOfTrays as Integer(Brief="Number of trays", Default=2);
1169        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
1170        top as Integer(Brief="Number of top tray");
1171        bot as Integer(Brief="Number of bottom tray");
1172
1173        SET
1174        top = (NumberOfTrays-1)*(1-topdown)/2+1;
1175        bot = NumberOfTrays/top;
1176       
1177        VARIABLES
1178        trays(NumberOfTrays) as trayTeste;
1179        reb as reboiler;
1180
1181        CONNECTIONS
1182        #vapor
1183        reb.OutletV to trays(bot).InletV;
1184        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
1185       
1186        #liquid
1187        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
1188        trays(bot).OutletL to reb.InletL;
1189end
1190
1191
1192#* -------------------------------------------------------------------
1193* Reboiled Stripping Column model with:
1194*
1195*       - NumberOfTrays like tray;
1196*       - a vessel in the bottom of column;
1197*       - a splitter which separate the bottom product and the stream to reboiler;
1198*       - steady state reboiler (thermosyphon);
1199*
1200* ------------------------------------------------------------------*
1201Model Reboiled_Stripping_thermosyphonTeste
1202        ATTRIBUTES
1203        Pallete         = true;
1204        Icon            = "icon/ReboiledThermosyphon";
1205        Brief           = "Model of a reboiled stripping column with steady reboiler.";
1206        Info            =
1207"== Specify ==
1208* the feed stream of each tray (Inlet);
1209* the Murphree eficiency for each tray (Emv);
1210* the vapour flow leaving the top of the column;
1211* the InletL stream of the top tray;
1212* the heat supllied in bottom tank;
1213* the heat supllied in the reboiler;
1214* the Outlet1 flow in the bottom splitter (spbottom.Outlet1.F) that corresponds to the bottom product;
1215       
1216== Initial Conditions ==
1217* the trays temperature (OutletL.T);
1218* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
1219* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
1220
1221* the bottom tank temperature (OutletL.T);
1222* the bottom tank liquid level (Level);
1223* (NoComps - 1) OutletL (OR OutletV) compositions.
1224";
1225       
1226        PARAMETERS
1227        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
1228        outer NComp as Integer;
1229        NumberOfTrays as Integer(Brief="Number of trays", Default=2);
1230        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
1231        top as Integer(Brief="Number of top tray");
1232        bot as Integer(Brief="Number of bottom tray");
1233
1234        SET
1235        top = (NumberOfTrays-1)*(1-topdown)/2+1;
1236        bot = NumberOfTrays/top;
1237       
1238        VARIABLES
1239        trays(NumberOfTrays) as trayTeste;
1240        reb as reboilerSteady;
1241        spbottom as splitter;
1242        tbottom as tank;
1243
1244        CONNECTIONS
1245        #vapor
1246        reb.OutletV to trays(bot).InletV;
1247        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
1248       
1249        #liquid
1250        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
1251        trays(bot).OutletL to tbottom.Inlet;
1252        tbottom.Outlet to spbottom.Inlet;
1253        spbottom.Outlet2 to reb.InletL;
1254end
1255
1256
1257#* -------------------------------------------------------------------
1258* Reboiled Absorption Column model with:
1259*
1260*       - NumberOfTrays like tray;
1261*       - a kettle reboiler;
1262*
1263* ------------------------------------------------------------------*
1264Model Reboiled_Absorption_kettleTeste
1265        ATTRIBUTES
1266        Pallete         = true;
1267        Icon            = "icon/ReboiledKettle";
1268        Brief           = "Model of a reboiled absorption column with dynamic reboiler.";
1269        Info            =
1270"== Specify ==
1271* the feed stream of each tray (Inlet);
1272* the Murphree eficiency for each tray Emv;
1273* the vapour flow leaving the top of the column;
1274* the InletL stream of the top tray;
1275* the heat supllied in the reboiler;
1276* the reboiler liquid outlet flow (OutletL.F);
1277       
1278== Initial Conditions ==
1279* the trays temperature (OutletL.T);
1280* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
1281* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
1282       
1283* the reboiler temperature (OutletL.T);
1284* the reboiler liquid level (Level);
1285* (NoComps - 1) OutletL (OR OutletV) compositions.
1286";
1287       
1288        PARAMETERS
1289        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
1290        outer NComp as Integer;
1291        NumberOfTrays as Integer(Brief="Number of trays", Default=2);
1292        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
1293        top as Integer(Brief="Number of top tray");
1294        bot as Integer(Brief="Number of bottom tray");
1295
1296        SET
1297        top = (NumberOfTrays-1)*(1-topdown)/2+1;
1298        bot = NumberOfTrays/top;
1299       
1300        VARIABLES
1301        trays(NumberOfTrays) as trayTeste;
1302        reb as reboiler;
1303
1304        CONNECTIONS
1305        #vapor
1306        reb.OutletV to trays(bot).InletV;
1307        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
1308       
1309        #liquid
1310        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
1311        trays(bot).OutletL to reb.InletL;
1312end
1313
1314
1315#* -------------------------------------------------------------------
1316* Reboiled Absorption Column model with:
1317*
1318*       - NumberOfTrays like tray;
1319*       - a vessel in the bottom of column;
1320*       - a splitter which separate the bottom product and the stream to reboiler;
1321*       - steady state reboiler (thermosyphon);
1322*
1323* ------------------------------------------------------------------*
1324Model Reboiled_Absorption_thermosyphonTeste
1325        ATTRIBUTES
1326        Pallete         = true;
1327        Icon            = "icon/ReboiledThermosyphon";
1328        Brief           = "Model of a reboiled absorption column with steady reboiler.";
1329        Info            =
1330"== Specify ==
1331* the feed stream of each tray (Inlet);
1332* the Murphree eficiency for each tray (Emv);
1333* the vapour flow leaving the top of the column;
1334* the InletL stream of the top tray;
1335* the heat supllied in bottom tank;
1336* the heat supllied in the reboiler;
1337* the Outlet1 flow in the bottom splitter (spbottom.Outlet1.F) that corresponds to the bottom product;
1338       
1339== Initial Conditions ==
1340* the trays temperature (OutletL.T);
1341* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
1342* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
1343
1344* the bottom tank temperature (OutletL.T);
1345* the bottom tank liquid level (Level);
1346* (NoComps - 1) OutletL (OR OutletV) compositions.
1347";
1348       
1349        PARAMETERS
1350        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
1351        outer NComp as Integer;
1352        NumberOfTrays as Integer(Brief="Number of trays", Default=2);
1353        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
1354        top as Integer(Brief="Number of top tray");
1355        bot as Integer(Brief="Number of bottom tray");
1356
1357        SET
1358        top = (NumberOfTrays-1)*(1-topdown)/2+1;
1359        bot = NumberOfTrays/top;
1360       
1361        VARIABLES
1362        trays(NumberOfTrays) as trayTeste;
1363        reb as reboilerSteady;
1364        spbottom as splitter;
1365        tbottom as tank;
1366       
1367        CONNECTIONS
1368        #vapor
1369        reb.OutletV to trays(bot).InletV;
1370        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
1371       
1372        #liquid
1373        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
1374        trays(bot).OutletL to tbottom.Inlet;
1375        tbottom.Outlet to spbottom.Inlet;
1376        spbottom.Outlet2 to reb.InletL;
1377end
1378
1379#* -------------------------------------------------------------------
1380*  Reactive Distillation Column
1381*
1382* ------------------------------------------------------------------*
1383Model ReactiveDistillationTeste
1384        ATTRIBUTES
1385        Pallete         = true;
1386        Icon            = "icon/DistillationKettleCond";
1387        Brief           = "Model of a reactive distillation column with dynamic condenser and reboiler.";
1388        Info            =
1389"== Specify ==
1390* the reaction related variables for each tray, condenser and reboiler;
1391* the feed stream of each tray (Inlet);
1392* the Murphree eficiency for each tray Emv;
1393* the pump pressure difference;
1394* the heat supllied in reboiler and condenser;
1395* the condenser vapor outlet flow (OutletV.F);
1396* the reboiler liquid outlet flow (OutletL.F);
1397* both splitter outlet flows OR one of the splitter outlet flows and the splitter frac.
1398       
1399== Initial Conditions ==
1400* the trays temperature (OutletL.T);
1401* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
1402* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
1403       
1404* the condenser temperature (OutletL.T);
1405* the condenser liquid level (Level);
1406* (NoComps - 1) OutletL (OR OutletV) compositions;
1407       
1408* the reboiler temperature (OutletL.T);
1409* the reboiler liquid level (Level);
1410* (NoComps - 1) OutletL (OR OutletV) compositions.
1411";
1412       
1413        PARAMETERS
1414        outer PP as Plugin(Type="PP");
1415        outer NComp as Integer;
1416        NumberOfTrays as Integer(Brief="Number of trays", Default=2);
1417        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
1418        top as Integer(Brief="Number of top tray");
1419        bot as Integer(Brief="Number of bottom tray");
1420        alfacond as Real;
1421
1422        VapourFlow as Switcher(Valid = ["on", "off"], Default = "off");
1423       
1424        SET
1425        top = (NumberOfTrays-1)*(1-topdown)/2+1;
1426        bot = NumberOfTrays/top;
1427       
1428        VARIABLES
1429        trays(NumberOfTrays) as trayReactTeste;
1430        cond as condenserReact;
1431        reb as reboilerReact;
1432        sp as splitter;
1433        p as pump;
1434       
1435        EQUATIONS
1436       
1437        switch VapourFlow
1438                case "on":
1439                "Pressure Drop through the condenser"
1440                cond.InletV.F*trays(top).vV / 'm^2' =
1441                        sqrt((trays(top).OutletV.P - cond.OutletL.P + 1e-8 * 'atm')/(trays(top).rhoV*alfacond));
1442                when trays(top).OutletV.P < cond.OutletL.P switchto "off";
1443               
1444                case "off":
1445                "Prato selado"
1446                cond.InletV.F = 0.0 * 'mol/s';
1447                when trays(top).OutletV.P > cond.OutletL.P + 1e-3 * 'atm' switchto "on";
1448        end
1449
1450        CONNECTIONS
1451        #vapor
1452        reb.OutletV to trays(bot).InletV;
1453        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
1454        trays(top).OutletV to cond.InletV;
1455       
1456        #liquid
1457        cond.OutletL to sp.Inlet;       
1458        sp.Outlet2 to p.Inlet;
1459        p.Outlet to trays(top).InletL;
1460        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
1461        trays(bot).OutletL to reb.InletL;
1462       
1463end
1464
1465#*----------------------------------------------------------------------
1466* Model of a  packed column section with:
1467*       - NStages = theoretical number of equilibrium stages.
1468*
1469*---------------------------------------------------------------------*
1470Model Packed_Section_ColumnTeste
1471        ATTRIBUTES
1472        Pallete         = true;
1473        Icon            = "icon/PackedSectionColumn";
1474        Brief           = "Model of a packed column section.";
1475        Info            =
1476"== Model of a packed column section containing ==
1477* NStages theoretical stages.
1478       
1479== Specify ==
1480* the feed stream of each tray (Inlet);
1481* the InletL stream of the top tray;
1482* the InletV stream of the bottom tray;
1483* the total pressure drop (dP) of the section.
1484       
1485== Initial Conditions ==
1486* the stages temperature (OutletL.T);
1487* the stages liquid holdup;
1488* (NoComps - 1) OutletL (OR OutletV) compositions for each tray.
1489";
1490       
1491        PARAMETERS
1492        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
1493        outer NComp as Integer;
1494        NStages as Integer(Brief="Number of trays", Default=2);
1495        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
1496        top as Integer(Brief="Number of top tray");
1497        bot as Integer(Brief="Number of bottom tray");
1498        H as length (Brief="Height of packing");
1499
1500        VARIABLES
1501        stage(NStages) as packedStageTeste;
1502        dP as pressure;
1503       
1504        SET
1505        top = (NStages-1)*(1-topdown)/2+1;
1506        bot = NStages/top;
1507        stage.hs = H/NStages;   
1508        stage.V = stage.hs * stage.d^2*3.14159/4;
1509       
1510        EQUATIONS
1511        stage.deltaP = dP/NStages;
1512       
1513        CONNECTIONS
1514        stage([top+topdown:topdown:bot]).OutletV to stage([top:topdown:bot-topdown]).InletV;
1515        stage([top:topdown:bot-topdown]).OutletL to stage([top+topdown:topdown:bot]).InletL;
1516end
1517
1518#*----------------------------------------------------------------------
1519* Model of a  packed distillation column containing:
1520*       - a section with NStages theoretical stages;
1521*       - a kettle reboiler;
1522*       - dymamic condenser;
1523*       - a splitter which separate reflux and distillate;
1524*       - a pump in reflux stream;
1525*---------------------------------------------------------------------*
1526Model PackedDistillation_kettle_cond as Packed_Section_ColumnTeste
1527        ATTRIBUTES
1528        Pallete         = true;
1529        Icon            = "icon/PackedDistillationKettleCond";
1530        Brief           = "Model of a distillation column with dynamic condenser and dynamic reboiler.";
1531        Info            =
1532"== Specify ==
1533* the feed stream of each tray (Inlet);
1534* the pump pressure difference;
1535* the total pressure drop (dP) of the packing;
1536* the heat supllied in reboiler and condenser;
1537* the condenser vapor outlet flow (OutletV.F);
1538* the reboiler liquid outlet flow (OutletL.F);
1539* both splitter outlet flows OR one of the splitter outlet flows and the splitter frac.
1540       
1541== Initial Conditions ==
1542* the stages temperature (OutletL.T);
1543* the stages initial molar holdup;
1544* (NoComps - 1) OutletL (OR OutletV) compositions for each stage;
1545       
1546* the condenser temperature (OutletL.T);
1547* the condenser liquid level (Level);
1548* (NoComps - 1) OutletL (OR OutletV) compositions;
1549       
1550* the reboiler temperature (OutletL.T);
1551* the reboiler liquid level (Level);
1552* (NoComps - 1) OutletL (OR OutletV) compositions.
1553";
1554       
1555        PARAMETERS
1556        VapourFlow as Switcher(Valid = ["on", "off"], Default = "on");
1557       
1558        VARIABLES
1559        cond as condenser;
1560        reb as reboiler;
1561        sptop as splitter;
1562        pump1 as pump;
1563       
1564        CONNECTIONS
1565        #vapor
1566        reb.OutletV to stage(bot).InletV;
1567        stage(top).OutletV to cond.InletV;
1568       
1569        #liquid
1570        cond.OutletL to sptop.Inlet;   
1571        sptop.Outlet2 to pump1.Inlet;
1572        pump1.Outlet to stage(top).InletL;
1573        stage(bot).OutletL to reb.InletL;
1574       
1575        EQUATIONS
1576        switch VapourFlow
1577                case "on":
1578                stage(bot).InletV.F*stage(bot).vV = sqrt((reb.OutletV.P - stage(bot).OutletV.P)/
1579                                        (stage(bot).rhoV*stage(bot).Qsil*20))*(stage(bot).d^2*3.14159/4*stage(bot).e - stage(bot).Al);
1580                when stage(bot).InletV.F < 1e-6 * 'kmol/h' switchto "off";
1581               
1582                case "off":
1583                stage(bot).InletV.F = 0 * 'mol/s';
1584                when reb.OutletV.P > stage(bot).OutletV.P + 1e-1 * 'atm' switchto "on";
1585        end
1586
1587end
1588
Note: See TracBrowser for help on using the repository browser.