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

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

icon changed / updates in column model

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