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

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

added column model

File size: 61.0 KB
Line 
1#*-------------------------------------------------------------------
2* EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC.
3*
4* This LIBRARY is free software; you can distribute it and/or modify
5* it under the therms of the ALSOC FREE LICENSE as available at
6* http://www.enq.ufrgs.br/alsoc.
7*
8* EMSO Copyright (C) 2004 - 2007 ALSOC, original code
9* from http://www.rps.eng.br Copyright (C) 2002-2004.
10* All rights reserved.
11*
12* EMSO is distributed under the therms of the ALSOC LICENSE as
13* available at http://www.enq.ufrgs.br/alsoc.
14*
15*----------------------------------------------------------------------
16* File containg models of columns: distillation, stripping, absorbers
17* rectifier, ....
18*
19* The default nomenclature is:
20*               Type_Column_reboilertype_condensertyper
21*
22* where:
23*       Type = refluxed or reboiled or section
24*       Column = Stripping, Absorption, Rectifier, Distillation
25*       Reboiler type (if exists) = kettle or thermosyphon
26*       Condenser type (if exists) = with subccoling or without subcooling
27*
28*-----------------------------------------------------------------------
29* Author: Paula B. Staudt
30* $Id: column.mso 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        CondenserVapourFlow 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 CondenserVapourFlow
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 Rectifier as Section_ColumnBasic
802
803ATTRIBUTES
804        Pallete         = true;
805        Icon            = "icon/RefluxedCond";
806        Brief           = "Model of a rectifier column with dynamic condenser.";
807        Info            =
808"== Specify ==
809* the feed stream of each tray (Inlet);
810* the Murphree eficiency for each tray Emv;
811* the InletV stream of the bottom tray unless its flow;
812* the pump pressure difference;
813* the heat supllied in the condenser;
814* the condenser vapor outlet flow (OutletV.F);
815* both splitter outlet flows OR one of the splitter outlet flows and the splitter frac.
816       
817== Initial Conditions ==
818* the trays temperature (OutletL.T);
819* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
820* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
821       
822* the condenser temperature (OutletL.T);
823* the condenser liquid level (Level);
824* (NoComps - 1) OutletL (OR OutletV) compositions;
825";
826
827PARAMETERS
828        CondenserVapourFlow as Switcher(Valid = ["on", "off"], Default = "on",Hidden=true);
829
830VARIABLES
831        CondenserUnity as condenser;
832        SplitterTop as splitter;
833        PumpUnity as pump;
834        alfaTopo as Real;
835
836        in              VapourInlet             as stream                               (Brief="Vapour Inlet in the section", PosX=0.18, PosY=1);
837        out     LiquidOutlet            as liquid_stream                (Brief="Liquid Outlet in the section", PosX=0.25, PosY=1);
838       
839        out             HeatToCondenser         as power                                (Brief="Heat supplied to Condenser",Hidden=true);
840       
841        VapourConnector as stream       (Brief="Vapour connection at the middle trays", PosX=0.55, PosY=0,Hidden=true);
842       
843EQUATIONS
844
845switch CondenserVapourFlow
846
847        case "on":
848                CondenserUnity.InletV.F*trays(1).vV = alfaTopo * Ah * sqrt(2*(trays(1).OutletV.P -
849                CondenserUnity.OutletL.P + 1e-8 * 'atm') / (alfa*trays(1).rhoV));
850                when CondenserUnity.InletV.F < 1e-6 * 'kmol/h' switchto "off";
851               
852        case "off":
853                CondenserUnity.InletV.F = 0 * 'mol/s';
854                when trays(1).OutletV.P > CondenserUnity.OutletL.P + 1e-1 * 'atm' switchto "on";
855
856end     
857
858        LiquidOutlet.F= trays(NumberOfTrays).OutletL.F;
859        LiquidOutlet.T = trays(NumberOfTrays).OutletL.T;
860        LiquidOutlet.P = trays(NumberOfTrays).OutletL.P;
861        LiquidOutlet.z = trays(NumberOfTrays).OutletL.z;
862
863        VapourConnector.F= VapourInlet.F;
864        VapourConnector.T = VapourInlet.T;
865        VapourConnector.P = VapourInlet.P;
866        VapourConnector.z = VapourInlet.z;
867        VapourConnector.v = VapourInlet.v;
868        VapourConnector.h = VapourInlet.h;
869
870CONNECTIONS
871#vapor
872        trays(1).OutletV to CondenserUnity.InletV;
873
874#liquid
875        CondenserUnity.OutletL to SplitterTop.Inlet;   
876        SplitterTop.Outlet2 to PumpUnity.Inlet;
877        PumpUnity.Outlet to trays(1).InletL;
878
879#Connectors
880HeatToCondenser         to CondenserUnity.InletQ;
881VapourConnector to trays(NumberOfTrays).InletV;
882
883end
884
885
886#* -------------------------------------------------------------------
887* Rectifier Column with:
888*
889*       - NumberOfTrays like tray;
890*       - a steady state condenser with subcooling;
891*       - a vessel drum (layed cilinder);
892*       - a splitter which separate reflux and distillate;
893*       - a pump in reflux stream.
894*
895* ------------------------------------------------------------------*#
896
897Model Rectifier_subcooling as Section_ColumnBasic
898
899ATTRIBUTES
900        Pallete         = true;
901        Icon            = "icon/RefluxedSubcooling";
902        Brief           = "Model of a rectifier column with steady condenser.";
903        Info            =
904"== Specify ==
905* the feed stream of each tray (Inlet);
906* the Murphree eficiency for each tray Emv;
907* the InletV stream of the bottom tray unless its flow;
908* the pump head;
909* the condenser pressure drop;
910* the heat supllied in  the top tank;
911* the heat supllied in condenser;
912* both  top splitter outlet flows OR one of the splitter outlet flows and the splitter frac.
913       
914== Initial Conditions ==
915* the trays temperature (OutletL.T);
916* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
917* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
918       
919* the top tank temperature (OutletL.T);
920* the top tank liquid level (Level);
921* (NoComps - 1) OutletL (OR OutletV) compositions;
922";
923       
924PARAMETERS
925        CondenserVapourFlow             as Switcher     (Valid = ["on", "off"], Default = "on",Hidden=true);
926
927VARIABLES
928        CondenserUnity as condenserSteady;
929        TopVessel               as tank_cylindrical;
930        SplitterTop             as splitter;
931        PumpUnity               as pump;
932        alfaTopo                        as Real;
933
934        in              VapourInlet             as stream                               (Brief="Vapour Inlet in the section", PosX=0.18, PosY=1);
935        out     LiquidOutlet            as liquid_stream                (Brief="Liquid Outlet in the section", PosX=0.25, PosY=1);
936
937        out             HeatToCondenser         as power                                (Brief="Heat supplied to Condenser",Hidden=true);
938        out     LiquidDistillate                                as liquid_stream                (Brief="Liquid outlet stream From Top Splitter", PosX=1, PosY=0.47);
939        in              ConnectorSplitterTop            as stream                               (Brief="Connector for Liquid outlet stream From Top Splitter", Hidden=true);
940        out             HeatToTopVessel         as power                                (Brief="Heat supplied to Top Vessel",Hidden=true);
941
942        VapourConnector as stream               (Brief="Vapour connection at the middle trays", PosX=0.55, PosY=0,Hidden=true);
943
944EQUATIONS
945
946        LiquidOutlet.F= trays(NumberOfTrays).OutletL.F;
947        LiquidOutlet.T = trays(NumberOfTrays).OutletL.T;
948        LiquidOutlet.P = trays(NumberOfTrays).OutletL.P;
949        LiquidOutlet.z = trays(NumberOfTrays).OutletL.z;
950
951        VapourConnector.F= VapourInlet.F;
952        VapourConnector.T = VapourInlet.T;
953        VapourConnector.P = VapourInlet.P;
954        VapourConnector.z = VapourInlet.z;
955        VapourConnector.v = VapourInlet.v;
956        VapourConnector.h = VapourInlet.h;
957       
958# Splitter Connector Equations
959        ConnectorSplitterTop.T = LiquidDistillate.T;
960        ConnectorSplitterTop.P = LiquidDistillate.P;
961        ConnectorSplitterTop.F = LiquidDistillate.F;
962        ConnectorSplitterTop.z = LiquidDistillate.z;
963
964switch CondenserVapourFlow
965
966        case "on":
967                CondenserUnity.InletV.F*trays(1).vV = alfaTopo *Ah * sqrt(2*(trays(1).OutletV.P -
968                CondenserUnity.OutletL.P + 1e-8 * 'atm') / (alfa*trays(1).rhoV));
969        when CondenserUnity.InletV.F < 1e-6 * 'kmol/h' switchto "off";
970               
971        case "off":
972                CondenserUnity.InletV.F = 0 * 'mol/s';
973        when trays(1).OutletV.P > CondenserUnity.OutletL.P + 1e-1 * 'atm' switchto "on";
974
975end     
976       
977CONNECTIONS
978#vapor
979        trays(1).OutletV to CondenserUnity.InletV;
980       
981#liquid
982        CondenserUnity.OutletL to TopVessel.Inlet;     
983        TopVessel.Outlet                        to SplitterTop.Inlet;
984        SplitterTop.Outlet2             to PumpUnity.Inlet;     
985        PumpUnity.Outlet                        to trays(1).InletL;
986
987#Connectors
988        VapourConnector                 to trays(NumberOfTrays).InletV;
989        HeatToCondenser                 to CondenserUnity.InletQ;
990        SplitterTop.Outlet1     to ConnectorSplitterTop;
991        HeatToTopVessel         to TopVessel.InletQ;
992       
993end
994
995
996#*----------------------------------------------------------------------
997* Model of a  Refluxed Stripping column containing:
998*       - NumberOfTrays like tray;
999*       - dymamic condenser without subcooling;
1000*       - a splitter which separate reflux and distillate;
1001*       - a pump in reflux stream;
1002*---------------------------------------------------------------------*
1003Model Refluxed_StrippingTeste
1004        ATTRIBUTES
1005        Pallete         = true;
1006        Icon            = "icon/RefluxedCond";
1007        Brief           = "Model of a refluxed stripping column with dynamic condenser.";
1008        Info            =
1009"== Specify ==
1010* the feed stream of each tray (Inlet);
1011* the Murphree eficiency for each tray Emv;
1012* the InletV stream of the bottom tray unless its flow;
1013* the pump pressure difference;
1014* the heat supllied in the condenser;
1015* the condenser vapor outlet flow (OutletV.F);
1016* both splitter outlet flows OR one of the splitter outlet flows and the splitter frac.
1017       
1018== Initial Conditions ==
1019* the trays temperature (OutletL.T);
1020* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
1021* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
1022       
1023* the condenser temperature (OutletL.T);
1024* the condenser liquid level (Level);
1025* (NoComps - 1) OutletL (OR OutletV) compositions;
1026";
1027       
1028        PARAMETERS
1029        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
1030        outer NComp as Integer;
1031        NumberOfTrays as Integer(Brief="Number of trays", Default=2);
1032        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
1033        top as Integer(Brief="Number of top tray");
1034        bot as Integer(Brief="Number of bottom tray");
1035        VapourFlow as Switcher(Valid = ["on", "off"], Default = "on");
1036
1037        SET
1038        top = (NumberOfTrays-1)*(1-topdown)/2+1;
1039        bot = NumberOfTrays/top;
1040       
1041        VARIABLES
1042        trays(NumberOfTrays) as trayTeste;
1043        cond as condenser;
1044        sptop as splitter;
1045        pump1 as pump;
1046        alfaTopo as Real;
1047
1048        EQUATIONS
1049        switch VapourFlow
1050                case "on":
1051                cond.InletV.F*trays(top).vV = alfaTopo * trays(top).Ah * sqrt(2*(trays(top).OutletV.P -
1052                cond.OutletL.P + 1e-8 * 'atm') / (trays(top).alfa*trays(top).rhoV));
1053                when cond.InletV.F < 1e-6 * 'kmol/h' switchto "off";
1054               
1055                case "off":
1056                cond.InletV.F = 0 * 'mol/s';
1057                when trays(top).OutletV.P > cond.OutletL.P + 1e-1 * 'atm' switchto "on";
1058        end
1059       
1060        CONNECTIONS
1061        #vapor
1062        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
1063        trays(top).OutletV to cond.InletV;
1064       
1065        #liquid
1066        cond.OutletL to sptop.Inlet;   
1067        sptop.Outlet2 to pump1.Inlet;   
1068        pump1.Outlet to trays(top).InletL;
1069        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
1070end
1071
1072
1073#* -------------------------------------------------------------------
1074* Refluxed Stripping Column with:
1075*
1076*       - NumberOfTrays like tray;
1077*       - a steady state condenser (with subcooling);
1078*       - a vessel drum (layed cilinder);
1079*       - a splitter which separate reflux and distillate;
1080*       - a pump in reflux stream.
1081*
1082* ------------------------------------------------------------------*
1083Model Refluxed_Stripping_subcoolingTeste
1084        ATTRIBUTES
1085        Pallete         = true;
1086        Icon            = "icon/RefluxedSubcooling";
1087        Brief           = "Model of a refluxed stripping column with steady condenser.";
1088        Info            =
1089"== Specify ==
1090* the feed stream of each tray (Inlet);
1091* the Murphree eficiency for each tray Emv;
1092* the InletV stream of the bottom tray unless its flow;
1093* the pump head;
1094* the condenser pressure drop;
1095* the heat supllied in  the top tank;
1096* the heat supllied in condenser;
1097* both  top splitter outlet flows OR one of the splitter outlet flows and the splitter frac.
1098       
1099== Initial Conditions ==
1100* the trays temperature (OutletL.T);
1101* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
1102* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
1103       
1104* the top tank temperature (OutletL.T);
1105* the top tank liquid level (Level);
1106* (NoComps - 1) OutletL (OR OutletV) compositions;
1107";
1108       
1109        PARAMETERS
1110        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
1111        outer NComp as Integer;
1112        NumberOfTrays as Integer(Brief="Number of trays", Default=2);
1113        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
1114        top as Integer(Brief="Number of top tray");
1115        bot as Integer(Brief="Number of bottom tray");
1116        VapourFlow as Switcher(Valid = ["on", "off"], Default = "on");
1117
1118        SET
1119        top = (NumberOfTrays-1)*(1-topdown)/2+1;
1120        bot = NumberOfTrays/top;
1121       
1122        VARIABLES
1123        trays(NumberOfTrays) as trayTeste;
1124        cond as condenserSteady;
1125        ttop as tank_cylindrical;
1126        sptop as splitter;
1127        pump1 as pump;
1128        alfaTopo as Real;
1129
1130        EQUATIONS
1131        switch VapourFlow
1132                case "on":
1133                cond.InletV.F*trays(top).vV = alfaTopo * trays(top).Ah * sqrt(2*(trays(top).OutletV.P -
1134                cond.OutletL.P + 1e-8 * 'atm') / (trays(top).alfa*trays(top).rhoV));
1135                when cond.InletV.F < 1e-6 * 'kmol/h' switchto "off";
1136               
1137                case "off":
1138                cond.InletV.F = 0 * 'mol/s';
1139                when trays(top).OutletV.P > cond.OutletL.P + 1e-1 * 'atm' switchto "on";
1140        end
1141       
1142        CONNECTIONS
1143        #vapor
1144        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
1145        trays(top).OutletV to cond.InletV;
1146       
1147        #liquid
1148        cond.OutletL to ttop.Inlet;     
1149        ttop.Outlet to sptop.Inlet;
1150        sptop.Outlet2 to pump1.Inlet;   
1151        pump1.Outlet to trays(top).InletL;
1152        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
1153end
1154
1155
1156#*----------------------------------------------------------------------
1157* Model of a  Refluxed Absorption column containing:
1158*       - NumberOfTrays like tray;
1159*       - dymamic condenser without subcooling;
1160*       - a splitter which separate reflux and distillate;
1161*       - a pump in reflux stream;
1162*---------------------------------------------------------------------*
1163Model Refluxed_AbsorptionTeste
1164        ATTRIBUTES
1165        Pallete         = true;
1166        Icon            = "icon/RefluxedCond";
1167        Brief           = "Model of a refluxed absorption column with dynamic condenser.";
1168        Info            =
1169"== Specify ==
1170* the feed stream of each tray (Inlet);
1171* the Murphree eficiency for each tray Emv;
1172* the InletV stream of the bottom tray unless its flow;
1173* the pump pressure difference;
1174* the heat supllied in the condenser;
1175* the condenser vapor outlet flow (OutletV.F);
1176* both splitter outlet flows OR one of the splitter outlet flows and the splitter frac.
1177       
1178== Initial Conditions ==
1179* the trays temperature (OutletL.T);
1180* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
1181* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
1182       
1183* the condenser temperature (OutletL.T);
1184* the condenser liquid level (Level);
1185* (NoComps - 1) OutletL (OR OutletV) compositions;
1186";
1187       
1188        PARAMETERS
1189        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
1190        outer NComp as Integer;
1191        NumberOfTrays as Integer(Brief="Number of trays", Default=2);
1192        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
1193        top as Integer(Brief="Number of top tray");
1194        bot as Integer(Brief="Number of bottom tray");
1195        VapourFlow as Switcher(Valid = ["on", "off"], Default = "on");
1196
1197        SET
1198        top = (NumberOfTrays-1)*(1-topdown)/2+1;
1199        bot = NumberOfTrays/top;
1200       
1201        VARIABLES
1202        trays(NumberOfTrays) as trayTeste;
1203        cond as condenser;
1204        sptop as splitter;
1205        pump1 as pump;
1206        alfaTopo as Real;
1207
1208        EQUATIONS
1209        switch VapourFlow
1210                case "on":
1211                cond.InletV.F*trays(top).vV = alfaTopo * trays(top).Ah * sqrt(2*(trays(top).OutletV.P -
1212                cond.OutletL.P + 1e-8 * 'atm') / (trays(top).alfa*trays(top).rhoV));
1213                when cond.InletV.F < 1e-6 * 'kmol/h' switchto "off";
1214               
1215                case "off":
1216                cond.InletV.F = 0 * 'mol/s';
1217                when trays(top).OutletV.P > cond.OutletL.P + 1e-1 * 'atm' switchto "on";
1218        end
1219       
1220        CONNECTIONS
1221        #vapor
1222        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
1223        trays(top).OutletV to cond.InletV;
1224       
1225        #liquid
1226        cond.OutletL to cond.InletV;   
1227        cond.OutletL to sptop.Inlet;
1228        sptop.Outlet2 to pump1.Inlet;   
1229        pump1.Outlet to trays(top).InletL;
1230        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
1231end
1232
1233
1234#* -------------------------------------------------------------------
1235* Refluxed Absorption Column with:
1236*
1237*       - NumberOfTrays like tray;
1238*       - a steady state condenser (with subcooling);
1239*       - a vessel drum (layed cilinder);
1240*       - a splitter which separate reflux and distillate;
1241*       - a pump in reflux stream.
1242*
1243* ------------------------------------------------------------------*
1244Model Refluxed_Absorption_subcoolingTeste
1245        ATTRIBUTES
1246        Pallete         = true;
1247        Icon            = "icon/RefluxedSubcooling";
1248        Brief           = "Model of a refluxed absorption column with steady condenser.";
1249        Info            =
1250"== Specify ==
1251* the feed stream of each tray (Inlet);
1252* the Murphree eficiency for each tray Emv;
1253* the InletV stream of the bottom tray unless its flow;
1254* the pump head;
1255* the condenser pressure drop;
1256* the heat supllied in  the top tank;
1257* the heat supllied in condenser;
1258* both  top splitter outlet flows OR one of the splitter outlet flows and the splitter frac.
1259       
1260== Initial Conditions ==
1261* the trays temperature (OutletL.T);
1262* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
1263* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
1264       
1265* the top tank temperature (OutletL.T);
1266* the top tank liquid level (Level);
1267* (NoComps - 1) OutletL (OR OutletV) compositions;
1268";
1269       
1270        PARAMETERS
1271        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
1272        outer NComp as Integer;
1273        NumberOfTrays as Integer(Brief="Number of trays", Default=2);
1274        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
1275        top as Integer(Brief="Number of top tray");
1276        bot as Integer(Brief="Number of bottom tray");
1277        VapourFlow as Switcher(Valid = ["on", "off"], Default = "on");
1278
1279        SET
1280        top = (NumberOfTrays-1)*(1-topdown)/2+1;
1281        bot = NumberOfTrays/top;
1282       
1283        VARIABLES
1284        trays(NumberOfTrays) as trayTeste;
1285        cond as condenserSteady;
1286        ttop as tank_cylindrical;
1287        sptop as splitter;
1288        pump1 as pump;
1289        alfaTopo as Real;
1290
1291        EQUATIONS
1292        switch VapourFlow
1293                case "on":
1294                cond.InletV.F*trays(top).vV = alfaTopo * trays(top).Ah * sqrt(2*(trays(top).OutletV.P -
1295                cond.OutletL.P + 1e-8 * 'atm') / (trays(top).alfa*trays(top).rhoV));
1296                when cond.InletV.F < 1e-6 * 'kmol/h' switchto "off";
1297               
1298                case "off":
1299                cond.InletV.F = 0 * 'mol/s';
1300                when trays(top).OutletV.P > cond.OutletL.P + 1e-1 * 'atm' switchto "on";
1301        end     
1302       
1303        CONNECTIONS
1304        #vapor
1305        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
1306        trays(top).OutletV to cond.InletV;
1307       
1308        #liquid
1309        cond.OutletL to ttop.Inlet;     
1310        ttop.Outlet to sptop.Inlet;
1311        sptop.Outlet2 to pump1.Inlet;   
1312        pump1.Outlet to trays(top).InletL;
1313        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
1314end
1315
1316
1317#* -------------------------------------------------------------------
1318* Reboiled Stripping Column model with:
1319*
1320*       - NumberOfTrays like tray;
1321*       - a kettle reboiler;
1322*
1323* ------------------------------------------------------------------*
1324Model Reboiled_Stripping_kettleTeste
1325        ATTRIBUTES
1326        Pallete         = true;
1327        Icon            = "icon/ReboiledKettle";
1328        Brief           = "Model of a reboiled stripping column with dynamic reboiler.";
1329        Info            =
1330"== Specify ==
1331* the feed stream of each tray (Inlet);
1332* the Murphree eficiency for each tray Emv;
1333* the vapour flow leaving the top of the column;
1334* the InletL stream of the top tray;
1335* the heat supllied in the reboiler;
1336* the reboiler liquid outlet flow (OutletL.F);
1337       
1338== Initial Conditions ==
1339* the trays temperature (OutletL.T);
1340* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
1341* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
1342       
1343* the reboiler temperature (OutletL.T);
1344* the reboiler liquid level (Level);
1345* (NoComps - 1) OutletL (OR OutletV) compositions.
1346";
1347
1348        PARAMETERS
1349        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
1350        outer NComp as Integer;
1351        NumberOfTrays as Integer(Brief="Number of trays", Default=2);
1352        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
1353        top as Integer(Brief="Number of top tray");
1354        bot as Integer(Brief="Number of bottom tray");
1355
1356        SET
1357        top = (NumberOfTrays-1)*(1-topdown)/2+1;
1358        bot = NumberOfTrays/top;
1359       
1360        VARIABLES
1361        trays(NumberOfTrays) as trayTeste;
1362        reb as reboiler;
1363
1364        CONNECTIONS
1365        #vapor
1366        reb.OutletV to trays(bot).InletV;
1367        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
1368       
1369        #liquid
1370        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
1371        trays(bot).OutletL to reb.InletL;
1372end
1373
1374
1375#* -------------------------------------------------------------------
1376* Reboiled Stripping Column model with:
1377*
1378*       - NumberOfTrays like tray;
1379*       - a vessel in the bottom of column;
1380*       - a splitter which separate the bottom product and the stream to reboiler;
1381*       - steady state reboiler (thermosyphon);
1382*
1383* ------------------------------------------------------------------*
1384Model Reboiled_Stripping_thermosyphonTeste
1385        ATTRIBUTES
1386        Pallete         = true;
1387        Icon            = "icon/ReboiledThermosyphon";
1388        Brief           = "Model of a reboiled stripping column with steady reboiler.";
1389        Info            =
1390"== Specify ==
1391* the feed stream of each tray (Inlet);
1392* the Murphree eficiency for each tray (Emv);
1393* the vapour flow leaving the top of the column;
1394* the InletL stream of the top tray;
1395* the heat supllied in bottom tank;
1396* the heat supllied in the reboiler;
1397* the Outlet1 flow in the bottom splitter (spbottom.Outlet1.F) that corresponds to the bottom product;
1398       
1399== Initial Conditions ==
1400* the trays temperature (OutletL.T);
1401* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
1402* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
1403
1404* the bottom tank temperature (OutletL.T);
1405* the bottom tank liquid level (Level);
1406* (NoComps - 1) OutletL (OR OutletV) compositions.
1407";
1408       
1409        PARAMETERS
1410        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
1411        outer NComp as Integer;
1412        NumberOfTrays as Integer(Brief="Number of trays", Default=2);
1413        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
1414        top as Integer(Brief="Number of top tray");
1415        bot as Integer(Brief="Number of bottom tray");
1416
1417        SET
1418        top = (NumberOfTrays-1)*(1-topdown)/2+1;
1419        bot = NumberOfTrays/top;
1420       
1421        VARIABLES
1422        trays(NumberOfTrays) as trayTeste;
1423        reb as reboilerSteady;
1424        spbottom as splitter;
1425        tbottom as tank;
1426
1427        CONNECTIONS
1428        #vapor
1429        reb.OutletV to trays(bot).InletV;
1430        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
1431       
1432        #liquid
1433        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
1434        trays(bot).OutletL to tbottom.Inlet;
1435        tbottom.Outlet to spbottom.Inlet;
1436        spbottom.Outlet2 to reb.InletL;
1437end
1438
1439
1440#* -------------------------------------------------------------------
1441* Reboiled Absorption Column model with:
1442*
1443*       - NumberOfTrays like tray;
1444*       - a kettle reboiler;
1445*
1446* ------------------------------------------------------------------*
1447Model Reboiled_Absorption_kettleTeste
1448        ATTRIBUTES
1449        Pallete         = true;
1450        Icon            = "icon/ReboiledKettle";
1451        Brief           = "Model of a reboiled absorption column with dynamic reboiler.";
1452        Info            =
1453"== Specify ==
1454* the feed stream of each tray (Inlet);
1455* the Murphree eficiency for each tray Emv;
1456* the vapour flow leaving the top of the column;
1457* the InletL stream of the top tray;
1458* the heat supllied in the reboiler;
1459* the reboiler liquid outlet flow (OutletL.F);
1460       
1461== Initial Conditions ==
1462* the trays temperature (OutletL.T);
1463* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
1464* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
1465       
1466* the reboiler temperature (OutletL.T);
1467* the reboiler liquid level (Level);
1468* (NoComps - 1) OutletL (OR OutletV) compositions.
1469";
1470       
1471        PARAMETERS
1472        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
1473        outer NComp as Integer;
1474        NumberOfTrays as Integer(Brief="Number of trays", Default=2);
1475        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
1476        top as Integer(Brief="Number of top tray");
1477        bot as Integer(Brief="Number of bottom tray");
1478
1479        SET
1480        top = (NumberOfTrays-1)*(1-topdown)/2+1;
1481        bot = NumberOfTrays/top;
1482       
1483        VARIABLES
1484        trays(NumberOfTrays) as trayTeste;
1485        reb as reboiler;
1486
1487        CONNECTIONS
1488        #vapor
1489        reb.OutletV to trays(bot).InletV;
1490        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
1491       
1492        #liquid
1493        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
1494        trays(bot).OutletL to reb.InletL;
1495end
1496
1497
1498#* -------------------------------------------------------------------
1499* Reboiled Absorption Column model with:
1500*
1501*       - NumberOfTrays like tray;
1502*       - a vessel in the bottom of column;
1503*       - a splitter which separate the bottom product and the stream to reboiler;
1504*       - steady state reboiler (thermosyphon);
1505*
1506* ------------------------------------------------------------------*
1507Model Reboiled_Absorption_thermosyphonTeste
1508        ATTRIBUTES
1509        Pallete         = true;
1510        Icon            = "icon/ReboiledThermosyphon";
1511        Brief           = "Model of a reboiled absorption column with steady reboiler.";
1512        Info            =
1513"== Specify ==
1514* the feed stream of each tray (Inlet);
1515* the Murphree eficiency for each tray (Emv);
1516* the vapour flow leaving the top of the column;
1517* the InletL stream of the top tray;
1518* the heat supllied in bottom tank;
1519* the heat supllied in the reboiler;
1520* the Outlet1 flow in the bottom splitter (spbottom.Outlet1.F) that corresponds to the bottom product;
1521       
1522== Initial Conditions ==
1523* the trays temperature (OutletL.T);
1524* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
1525* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
1526
1527* the bottom tank temperature (OutletL.T);
1528* the bottom tank liquid level (Level);
1529* (NoComps - 1) OutletL (OR OutletV) compositions.
1530";
1531       
1532        PARAMETERS
1533        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
1534        outer NComp as Integer;
1535        NumberOfTrays as Integer(Brief="Number of trays", Default=2);
1536        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
1537        top as Integer(Brief="Number of top tray");
1538        bot as Integer(Brief="Number of bottom tray");
1539
1540        SET
1541        top = (NumberOfTrays-1)*(1-topdown)/2+1;
1542        bot = NumberOfTrays/top;
1543       
1544        VARIABLES
1545        trays(NumberOfTrays) as trayTeste;
1546        reb as reboilerSteady;
1547        spbottom as splitter;
1548        tbottom as tank;
1549       
1550        CONNECTIONS
1551        #vapor
1552        reb.OutletV to trays(bot).InletV;
1553        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
1554       
1555        #liquid
1556        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
1557        trays(bot).OutletL to tbottom.Inlet;
1558        tbottom.Outlet to spbottom.Inlet;
1559        spbottom.Outlet2 to reb.InletL;
1560end
1561
1562#* -------------------------------------------------------------------
1563*  Reactive Distillation Column
1564*
1565* ------------------------------------------------------------------*
1566Model ReactiveDistillationTeste
1567        ATTRIBUTES
1568        Pallete         = true;
1569        Icon            = "icon/DistillationKettleCond";
1570        Brief           = "Model of a reactive distillation column with dynamic condenser and reboiler.";
1571        Info            =
1572"== Specify ==
1573* the reaction related variables for each tray, condenser and reboiler;
1574* the feed stream of each tray (Inlet);
1575* the Murphree eficiency for each tray Emv;
1576* the pump pressure difference;
1577* the heat supllied in reboiler and condenser;
1578* the condenser vapor outlet flow (OutletV.F);
1579* the reboiler liquid outlet flow (OutletL.F);
1580* both splitter outlet flows OR one of the splitter outlet flows and the splitter frac.
1581       
1582== Initial Conditions ==
1583* the trays temperature (OutletL.T);
1584* the trays liquid level (Level) OR the trays liquid flow (OutletL.F);
1585* (NoComps - 1) OutletL (OR OutletV) compositions for each tray;
1586       
1587* the condenser temperature (OutletL.T);
1588* the condenser liquid level (Level);
1589* (NoComps - 1) OutletL (OR OutletV) compositions;
1590       
1591* the reboiler temperature (OutletL.T);
1592* the reboiler liquid level (Level);
1593* (NoComps - 1) OutletL (OR OutletV) compositions.
1594";
1595       
1596        PARAMETERS
1597        outer PP as Plugin(Type="PP");
1598        outer NComp as Integer;
1599        NumberOfTrays as Integer(Brief="Number of trays", Default=2);
1600        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
1601        top as Integer(Brief="Number of top tray");
1602        bot as Integer(Brief="Number of bottom tray");
1603        alfacond as Real;
1604
1605        VapourFlow as Switcher(Valid = ["on", "off"], Default = "off");
1606       
1607        SET
1608        top = (NumberOfTrays-1)*(1-topdown)/2+1;
1609        bot = NumberOfTrays/top;
1610       
1611        VARIABLES
1612        trays(NumberOfTrays) as trayReactTeste;
1613        cond as condenserReact;
1614        reb as reboilerReact;
1615        sp as splitter;
1616        p as pump;
1617       
1618        EQUATIONS
1619       
1620        switch VapourFlow
1621                case "on":
1622                "Pressure Drop through the condenser"
1623                cond.InletV.F*trays(top).vV / 'm^2' =
1624                        sqrt((trays(top).OutletV.P - cond.OutletL.P + 1e-8 * 'atm')/(trays(top).rhoV*alfacond));
1625                when trays(top).OutletV.P < cond.OutletL.P switchto "off";
1626               
1627                case "off":
1628                "Prato selado"
1629                cond.InletV.F = 0.0 * 'mol/s';
1630                when trays(top).OutletV.P > cond.OutletL.P + 1e-3 * 'atm' switchto "on";
1631        end
1632
1633        CONNECTIONS
1634        #vapor
1635        reb.OutletV to trays(bot).InletV;
1636        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
1637        trays(top).OutletV to cond.InletV;
1638       
1639        #liquid
1640        cond.OutletL to sp.Inlet;       
1641        sp.Outlet2 to p.Inlet;
1642        p.Outlet to trays(top).InletL;
1643        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
1644        trays(bot).OutletL to reb.InletL;
1645       
1646end
1647
1648#*----------------------------------------------------------------------
1649* Model of a  packed column section with:
1650*       - NStages = theoretical number of equilibrium stages.
1651*
1652*---------------------------------------------------------------------*
1653Model Packed_Section_ColumnTeste
1654        ATTRIBUTES
1655        Pallete         = true;
1656        Icon            = "icon/PackedSectionColumn";
1657        Brief           = "Model of a packed column section.";
1658        Info            =
1659"== Model of a packed column section containing ==
1660* NStages theoretical stages.
1661       
1662== Specify ==
1663* the feed stream of each tray (Inlet);
1664* the InletL stream of the top tray;
1665* the InletV stream of the bottom tray;
1666* the total pressure drop (dP) of the section.
1667       
1668== Initial Conditions ==
1669* the stages temperature (OutletL.T);
1670* the stages liquid holdup;
1671* (NoComps - 1) OutletL (OR OutletV) compositions for each tray.
1672";
1673       
1674        PARAMETERS
1675        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
1676        outer NComp as Integer;
1677        NStages as Integer(Brief="Number of trays", Default=2);
1678        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
1679        top as Integer(Brief="Number of top tray");
1680        bot as Integer(Brief="Number of bottom tray");
1681        H as length (Brief="Height of packing");
1682
1683        VARIABLES
1684        stage(NStages) as packedStageTeste;
1685        dP as pressure;
1686       
1687        SET
1688        top = (NStages-1)*(1-topdown)/2+1;
1689        bot = NStages/top;
1690        stage.hs = H/NStages;   
1691        stage.V = stage.hs * stage.d^2*3.14159/4;
1692       
1693        EQUATIONS
1694        stage.deltaP = dP/NStages;
1695       
1696        CONNECTIONS
1697        stage([top+topdown:topdown:bot]).OutletV to stage([top:topdown:bot-topdown]).InletV;
1698        stage([top:topdown:bot-topdown]).OutletL to stage([top+topdown:topdown:bot]).InletL;
1699end
1700
1701#*----------------------------------------------------------------------
1702* Model of a  packed distillation column containing:
1703*       - a section with NStages theoretical stages;
1704*       - a kettle reboiler;
1705*       - dymamic condenser;
1706*       - a splitter which separate reflux and distillate;
1707*       - a pump in reflux stream;
1708*---------------------------------------------------------------------*
1709Model PackedDistillation_kettle_cond as Packed_Section_ColumnTeste
1710        ATTRIBUTES
1711        Pallete         = true;
1712        Icon            = "icon/PackedDistillationKettleCond";
1713        Brief           = "Model of a distillation column with dynamic condenser and dynamic reboiler.";
1714        Info            =
1715"== Specify ==
1716* the feed stream of each tray (Inlet);
1717* the pump pressure difference;
1718* the total pressure drop (dP) of the packing;
1719* the heat supllied in reboiler and condenser;
1720* the condenser vapor outlet flow (OutletV.F);
1721* the reboiler liquid outlet flow (OutletL.F);
1722* both splitter outlet flows OR one of the splitter outlet flows and the splitter frac.
1723       
1724== Initial Conditions ==
1725* the stages temperature (OutletL.T);
1726* the stages initial molar holdup;
1727* (NoComps - 1) OutletL (OR OutletV) compositions for each stage;
1728       
1729* the condenser temperature (OutletL.T);
1730* the condenser liquid level (Level);
1731* (NoComps - 1) OutletL (OR OutletV) compositions;
1732       
1733* the reboiler temperature (OutletL.T);
1734* the reboiler liquid level (Level);
1735* (NoComps - 1) OutletL (OR OutletV) compositions.
1736";
1737       
1738        PARAMETERS
1739        VapourFlow as Switcher(Valid = ["on", "off"], Default = "on");
1740       
1741        VARIABLES
1742        cond as condenser;
1743        reb as reboiler;
1744        sptop as splitter;
1745        pump1 as pump;
1746       
1747        CONNECTIONS
1748        #vapor
1749        reb.OutletV to stage(bot).InletV;
1750        stage(top).OutletV to cond.InletV;
1751       
1752        #liquid
1753        cond.OutletL to sptop.Inlet;   
1754        sptop.Outlet2 to pump1.Inlet;
1755        pump1.Outlet to stage(top).InletL;
1756        stage(bot).OutletL to reb.InletL;
1757       
1758        EQUATIONS
1759        switch VapourFlow
1760                case "on":
1761                stage(bot).InletV.F*stage(bot).vV = sqrt((reb.OutletV.P - stage(bot).OutletV.P)/
1762                                        (stage(bot).rhoV*stage(bot).Qsil*20))*(stage(bot).d^2*3.14159/4*stage(bot).e - stage(bot).Al);
1763                when stage(bot).InletV.F < 1e-6 * 'kmol/h' switchto "off";
1764               
1765                case "off":
1766                stage(bot).InletV.F = 0 * 'mol/s';
1767                when reb.OutletV.P > stage(bot).OutletV.P + 1e-1 * 'atm' switchto "on";
1768        end
1769
1770end
1771*#
Note: See TracBrowser for help on using the repository browser.