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

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

updates in column.mso

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