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

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

updated icon for column section

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