source: branches/gui/eml/stage_separators/columnTeste.mso @ 618

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

updated

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