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

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

updates in column model

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