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

Last change on this file since 644 was 644, checked in by gerson bicca, 15 years ago

added new type of column distillation

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