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

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

added source with no flow condition
icons changed

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