source: branches/gui/eml/stage_separators/column.mso @ 654

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

updates

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