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

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

updates

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