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

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

updates

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