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

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

updates in column model

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