source: mso/eml/stage_separators/column.mso @ 99

Last change on this file since 99 was 99, checked in by Paula Bettio Staudt, 15 years ago

Fixed column models with termosyphon reboiler

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 31.0 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 99 2007-01-08 18:45:20Z paula $
31*---------------------------------------------------------------------*#
32
33using "tray";
34using "reboiler";
35using "condenser";
36using "mixers_splitters/splitter";
37using "mixers_splitters/mixer";
38using "tank";
39using "pressure_changers/pump";
40
41#*----------------------------------------------------------------------
42* Model of a  column section with:
43*       - NTrays=number of trays trays.
44*
45*---------------------------------------------------------------------*#
46Model Section_Column
47        PARAMETERS
48ext PP as CalcObject;
49ext NComp as Integer;
50        NTrays as Integer(Brief="Number of trays", Default=2);
51        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
52        top as Integer(Brief="Number of top tray");
53        bot as Integer(Brief="Number of bottom tray");
54
55        SET
56        top = (NTrays-1)*(1-topdown)/2+1;
57        bot = NTrays/top;
58       
59        VARIABLES
60        trays(NTrays) as tray;
61
62        EQUATIONS
63        "Pressure Drop through the tray"
64        trays([top:topdown:bot]).OutletV.F = (1 + tanh(1 *
65            (trays([top:topdown:bot]).OutletV.P -
66            trays([top:topdown:bot]).InletL.P)/"Pa"))/2 *
67            trays([top:topdown:bot]).Ah/trays([top:topdown:bot]).vV *
68            sqrt(2*(trays([top:topdown:bot]).OutletV.P -
69                trays([top:topdown:bot]).InletL.P + 1e-8 * "atm") /
70            (trays([top:topdown:bot]).alfa*trays([top:topdown:bot]).rhoV));
71
72        CONNECTIONS
73        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
74        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
75end
76
77
78#*----------------------------------------------------------------------
79* Model of a  distillation column containing:
80*       - NTrays like tray;
81*       - a kettle reboiler;
82*       - dymamic condenser;
83*       - a splitter which separate reflux and distillate;
84*       - a pump in reflux stream;
85*---------------------------------------------------------------------*#
86Model Distillation_kettle_cond
87        PARAMETERS
88ext PP as CalcObject;
89ext NComp as Integer;
90        NTrays as Integer(Brief="Number of trays", Default=2);
91        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
92        top as Integer(Brief="Number of top tray");
93        bot as Integer(Brief="Number of bottom tray");
94
95        SET
96        top = (NTrays-1)*(1-topdown)/2+1;
97        bot = NTrays/top;
98       
99        VARIABLES
100        trays(NTrays) as tray;
101        cond as condenser;
102        reb as reboiler;
103        sptop as splitter;
104        pump1 as pump;
105
106        EQUATIONS
107        if (reb.OutletV.P > reb.InletL.P) then
108                "Pressure Drop through the reboiler"
109                reb.OutletV.F = trays(bot).Ah/reb.vV * sqrt((reb.OutletV.P - trays(bot).OutletL.P)
110                                / (trays(bot).beta*reb.rhoV) );
111        else
112                "No flow in reboiler"
113                reb.OutletV.F = 0.0 * "mol/s";
114        end
115
116        "Pressure Drop through the tray"
117        trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - cond.OutletL.P)/"Pa"))/2 *
118                trays(top).Ah/trays(top).vV * sqrt(2*(trays(top).OutletV.P -
119                cond.OutletL.P + 1e-8 * "atm") / (trays(top).alfa*trays(top).rhoV));
120               
121        trays([top+topdown:topdown:bot]).OutletV.F = (1 + tanh(1 *
122            (trays([top+topdown:topdown:bot]).OutletV.P -
123            trays([top+topdown:topdown:bot]).InletL.P)/"Pa"))/2 *
124            trays([top+topdown:topdown:bot]).Ah/trays([top+topdown:topdown:bot]).vV *
125            sqrt(2*(trays([top+topdown:topdown:bot]).OutletV.P -
126                trays([top+topdown:topdown:bot]).InletL.P + 1e-8 * "atm") /
127            (trays([top+topdown:topdown:bot]).alfa*trays([top+topdown:topdown:bot]).rhoV));
128
129        CONNECTIONS
130        #vapor
131        reb.OutletV to trays(bot).InletV;
132        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
133        trays(top).OutletV to cond.InletV;
134       
135        #liquid
136        cond.OutletL to sptop.Inlet;   
137        sptop.Outlet2 to pump1.Inlet;
138        pump1.Outlet to trays(top).InletL;
139        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
140        trays(bot).OutletL to reb.InletL;
141end
142
143
144#* -------------------------------------------------------------------
145* Distillation Column model with:
146*
147*       - NTrays like tray;
148*       - a vessel in the bottom of column;
149*       - a splitter who separate the bottom product and the stream to reboiler;
150*       - steady state reboiler (thermosyphon);
151*       - a steady state condenser with subcooling;
152*       - a vessel drum (layed cilinder);
153*       - a splitter which separate reflux and distillate;
154*       - a pump in reflux stream.
155*
156* ------------------------------------------------------------------*#
157Model Distillation_thermosyphon_subcooling
158        PARAMETERS
159ext PP as CalcObject;
160ext NComp as Integer;
161        NTrays as Integer(Brief="Number of trays", Default=2);
162        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
163        top as Integer(Brief="Number of top tray");
164        bot as Integer(Brief="Number of bottom tray");
165
166        SET
167        top = (NTrays-1)*(1-topdown)/2+1;
168        bot = NTrays/top;
169       
170        VARIABLES
171        trays(NTrays) as tray;
172        cond as condenserSteady;
173        reb as reboilerSteady;
174        tbottom as tank;
175        ttop as tank_cylindrical;
176        spbottom as splitter;
177        sptop as splitter;
178        pump1 as pump;
179
180        EQUATIONS
181        "Pressure Drop through the tray"
182        trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - ttop.Outlet.P)/"Pa"))/2 *
183                trays(top).Ah/trays(top).vV /2* sqrt(2*(trays(top).OutletV.P -
184                ttop.Outlet.P + 1e-8 * "atm") / (trays(top).alfa*trays(top).rhoV));
185               
186        trays([top+topdown:topdown:bot]).OutletV.F = (1 + tanh(1 *
187            (trays([top+topdown:topdown:bot]).OutletV.P -
188            trays([top+topdown:topdown:bot]).InletL.P)/"Pa"))/2 *
189            trays([top+topdown:topdown:bot]).Ah/trays([top+topdown:topdown:bot]).vV /2*
190            sqrt(2*(trays([top+topdown:topdown:bot]).OutletV.P -
191                trays([top+topdown:topdown:bot]).InletL.P + 1e-8 * "atm") /
192            (trays([top+topdown:topdown:bot]).alfa*trays([top+topdown:topdown:bot]).rhoV));
193       
194        CONNECTIONS
195        #vapor
196        reb.OutletV to trays(bot).InletV;
197        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
198        trays(top).OutletV to cond.InletV;
199       
200        #liquid
201        cond.OutletL to ttop.Inlet;     
202        ttop.Outlet to sptop.Inlet;
203        sptop.Outlet2 to pump1.Inlet;   
204        pump1.Outlet to trays(top).InletL;
205        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
206        trays(bot).OutletL to tbottom.Inlet;
207        tbottom.Outlet to spbottom.Inlet;
208        spbottom.Outlet2 to reb.InletL;
209end
210
211
212#* -------------------------------------------------------------------
213* Distillation Column model with:
214*
215*       - NTrays like tray;
216*       - a vessel in the bottom of column;
217*       - a splitter who separate the bottom product and the stream to reboiler;
218*       - steady state reboiler (thermosyphon);
219*       - a dynamic condenser without subcooling;
220*       - a splitter which separate reflux and distillate;
221*       - a pump in reflux stream.
222*
223* ------------------------------------------------------------------*#
224Model Distillation_thermosyphon_cond
225        PARAMETERS
226ext PP as CalcObject;
227ext NComp as Integer;
228        NTrays as Integer(Brief="Number of trays", Default=2);
229        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
230        top as Integer(Brief="Number of top tray");
231        bot as Integer(Brief="Number of bottom tray");
232
233        SET
234        top = (NTrays-1)*(1-topdown)/2+1;
235        bot = NTrays/top;
236       
237        VARIABLES
238        trays(NTrays) as tray;
239        cond as condenser;
240        reb as reboilerSteady;
241        tbottom as tank;
242        spbottom as splitter;
243        sptop as splitter;
244        pump1 as pump;
245
246        EQUATIONS
247        if (reb.OutletV.P > reb.InletL.P) then
248                "Pressure Drop through the reboiler"
249                reb.OutletV.F = trays(bot).Ah/reb.vV * sqrt((reb.OutletV.P - trays(bot).OutletL.P)
250                                / (trays(bot).alfa*reb.rhoV) );
251        else
252                "No flow in reboiler"
253                reb.OutletV.F = 0.0 * "mol/s";
254        end
255
256        "Pressure Drop through the tray"
257        trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - cond.OutletL.P)/"Pa"))/2 *
258                trays(top).Ah/trays(top).vV * sqrt(2*(trays(top).OutletV.P -
259                cond.OutletL.P + 1e-8 * "atm") / (trays(top).alfa*trays(top).rhoV));
260               
261        trays([top+topdown:topdown:bot]).OutletV.F = (1 + tanh(1 *
262            (trays([top+topdown:topdown:bot]).OutletV.P -
263            trays([top+topdown:topdown:bot]).InletL.P)/"Pa"))/2 *
264            trays([top+topdown:topdown:bot]).Ah/trays([top+topdown:topdown:bot]).vV *
265            sqrt(2*(trays([top+topdown:topdown:bot]).OutletV.P -
266                trays([top+topdown:topdown:bot]).InletL.P + 1e-8 * "atm") /
267            (trays([top+topdown:topdown:bot]).alfa*trays([top+topdown:topdown:bot]).rhoV));
268                       
269        CONNECTIONS
270        #vapor
271        reb.OutletV to trays(bot).InletV;
272        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
273        trays(top).OutletV to cond.InletV;
274       
275        #liquid
276        cond.OutletL to sptop.Inlet;   
277        sptop.Outlet2 to pump1.Inlet;
278        pump1.Outlet to trays(top).InletL;
279        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
280        trays(bot).OutletL to tbottom.Inlet;
281        tbottom.Outlet to spbottom.Inlet;
282        spbottom.Outlet2 to reb.InletL;
283end
284
285#* -------------------------------------------------------------------
286* Distillation Column model with:
287*
288*       - NTrays like tray;
289*       - a kettle reboiler;
290*       - a steady state condenser with subcooling;
291*       - a vessel drum (layed cilinder);
292*       - a splitter which separate reflux and distillate;
293*       - a pump in reflux stream.
294*
295* ------------------------------------------------------------------*#
296Model Distillation_kettle_subcooling
297        PARAMETERS
298ext PP as CalcObject;
299ext NComp as Integer;
300        NTrays as Integer(Brief="Number of trays", Default=2);
301        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
302        top as Integer(Brief="Number of top tray");
303        bot as Integer(Brief="Number of bottom tray");
304
305        SET
306        top = (NTrays-1)*(1-topdown)/2+1;
307        bot = NTrays/top;
308       
309        VARIABLES
310        trays(NTrays) as tray;
311        cond as condenserSteady;
312        reb as reboiler;
313        ttop as tank_cylindrical;
314        sptop as splitter;
315        pump1 as pump;
316
317        EQUATIONS
318        if (reb.OutletV.P > reb.InletL.P) then
319                "Pressure Drop through the reboiler"
320                reb.OutletV.F = trays(bot).Ah/reb.vV * sqrt((reb.OutletV.P - trays(bot).OutletL.P)
321                                / (trays(bot).beta*reb.rhoV) );
322        else
323                "No flow in reboiler"
324                reb.OutletV.F = 0.0 * "mol/s";
325        end
326
327        "Pressure Drop through the tray"
328        trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - ttop.Outlet.P)/"Pa"))/2 *
329                trays(top).Ah/trays(top).vV * sqrt(2*(trays(top).OutletV.P -
330                ttop.Outlet.P + 1e-8 * "atm") / (trays(top).alfa*trays(top).rhoV));
331               
332        trays([top+topdown:topdown:bot]).OutletV.F = (1 + tanh(1 *
333            (trays([top+topdown:topdown:bot]).OutletV.P -
334            trays([top+topdown:topdown:bot]).InletL.P)/"Pa"))/2 *
335            trays([top+topdown:topdown:bot]).Ah/trays([top+topdown:topdown:bot]).vV *
336            sqrt(2*(trays([top+topdown:topdown:bot]).OutletV.P -
337                trays([top+topdown:topdown:bot]).InletL.P + 1e-8 * "atm") /
338            (trays([top+topdown:topdown:bot]).alfa*trays([top+topdown:topdown:bot]).rhoV));
339       
340        CONNECTIONS
341        #vapor
342        reb.OutletV to trays(bot).InletV;
343        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
344        trays(top).OutletV to cond.InletV;
345       
346        #liquid
347        cond.OutletL to ttop.Inlet;     
348        ttop.Outlet to sptop.Inlet;
349        sptop.Outlet2 to pump1.Inlet;   
350        pump1.Outlet to trays(top).InletL;
351        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
352        trays(bot).OutletL to reb.InletL;
353end
354
355
356#*----------------------------------------------------------------------
357* Model of a  rectifier containing:
358*       - NTrays like tray;
359*       - dymamic condenser without subcooling;
360*       - a splitter which separate reflux and distillate;
361*       - a pump in reflux stream;
362*---------------------------------------------------------------------*#
363Model Rectifier
364        PARAMETERS
365ext PP as CalcObject;
366ext NComp as Integer;
367        NTrays as Integer(Brief="Number of trays", Default=2);
368        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
369        top as Integer(Brief="Number of top tray");
370        bot as Integer(Brief="Number of bottom tray");
371
372        SET
373        top = (NTrays-1)*(1-topdown)/2+1;
374        bot = NTrays/top;
375       
376        VARIABLES
377        trays(NTrays) as tray;
378        cond as condenser;
379        sptop as splitter;
380        pump1 as pump;
381
382        EQUATIONS
383        "Pressure Drop through the tray"
384        trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - cond.OutletL.P)/"Pa"))/2 *
385                trays(top).Ah/trays(top).vV * sqrt(2*(trays(top).OutletV.P -
386                cond.OutletL.P + 1e-8 * "atm") / (trays(top).alfa*trays(top).rhoV));
387               
388        trays([top+topdown:topdown:bot]).OutletV.F = (1 + tanh(1 *
389            (trays([top+topdown:topdown:bot]).OutletV.P -
390            trays([top+topdown:topdown:bot]).InletL.P)/"Pa"))/2 *
391            trays([top+topdown:topdown:bot]).Ah/trays([top+topdown:topdown:bot]).vV *
392            sqrt(2*(trays([top+topdown:topdown:bot]).OutletV.P -
393                trays([top+topdown:topdown:bot]).InletL.P + 1e-8 * "atm") /
394            (trays([top+topdown:topdown:bot]).alfa*trays([top+topdown:topdown:bot]).rhoV));
395       
396        CONNECTIONS
397        #vapor
398        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
399        trays(top).OutletV to cond.InletV;
400       
401        #liquid
402        cond.OutletL to sptop.Inlet;   
403        sptop.Outlet2 to pump1.Inlet;   
404        pump1.Outlet to trays(top).InletL;
405        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
406end
407
408
409#* -------------------------------------------------------------------
410* Rectifier Column with:
411*
412*       - NTrays like tray;
413*       - a steady state condenser with subcooling;
414*       - a vessel drum (layed cilinder);
415*       - a splitter which separate reflux and distillate;
416*       - a pump in reflux stream.
417*
418* ------------------------------------------------------------------*#
419Model Rectifier_subcooling
420        PARAMETERS
421ext PP as CalcObject;
422ext NComp as Integer;
423        NTrays as Integer(Brief="Number of trays", Default=2);
424        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
425        top as Integer(Brief="Number of top tray");
426        bot as Integer(Brief="Number of bottom tray");
427
428        SET
429        top = (NTrays-1)*(1-topdown)/2+1;
430        bot = NTrays/top;
431       
432        VARIABLES
433        trays(NTrays) as tray;
434        cond as condenserSteady;
435        ttop as tank_cylindrical;
436        sptop as splitter;
437        pump1 as pump;
438
439        EQUATIONS
440        "Pressure Drop through the tray"
441        trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - ttop.Outlet.P)/"Pa"))/2 *
442                trays(top).Ah/trays(top).vV * sqrt(2*(trays(top).OutletV.P -
443                ttop.Outlet.P + 1e-8 * "atm") / (trays(top).alfa*trays(top).rhoV));
444               
445        trays([top+topdown:topdown:bot]).OutletV.F = (1 + tanh(1 *
446            (trays([top+topdown:topdown:bot]).OutletV.P -
447            trays([top+topdown:topdown:bot]).InletL.P)/"Pa"))/2 *
448            trays([top+topdown:topdown:bot]).Ah/trays([top+topdown:topdown:bot]).vV *
449            sqrt(2*(trays([top+topdown:topdown:bot]).OutletV.P -
450                trays([top+topdown:topdown:bot]).InletL.P + 1e-8 * "atm") /
451            (trays([top+topdown:topdown:bot]).alfa*trays([top+topdown:topdown:bot]).rhoV));
452       
453        CONNECTIONS
454        #vapor
455        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
456        trays(top).OutletV to cond.InletV;
457       
458        #liquid
459        cond.OutletL to ttop.Inlet;     
460        ttop.Outlet to sptop.Inlet;
461        sptop.Outlet2 to pump1.Inlet;   
462        pump1.Outlet to trays(top).InletL;
463        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
464end
465
466
467#*----------------------------------------------------------------------
468* Model of a  Refluxed Stripping column containing:
469*       - NTrays like tray;
470*       - dymamic condenser without subcooling;
471*       - a splitter which separate reflux and distillate;
472*       - a pump in reflux stream;
473*---------------------------------------------------------------------*#
474Model Refluxed_Stripping
475        PARAMETERS
476ext PP as CalcObject;
477ext NComp as Integer;
478        NTrays as Integer(Brief="Number of trays", Default=2);
479        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
480        top as Integer(Brief="Number of top tray");
481        bot as Integer(Brief="Number of bottom tray");
482
483        SET
484        top = (NTrays-1)*(1-topdown)/2+1;
485        bot = NTrays/top;
486       
487        VARIABLES
488        trays(NTrays) as tray;
489        cond as condenser;
490        sptop as splitter;
491        pump1 as pump;
492
493        EQUATIONS
494        "Pressure Drop through the tray"
495        trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - cond.OutletL.P)/"Pa"))/2 *
496                trays(top).Ah/trays(top).vV * sqrt(2*(trays(top).OutletV.P -
497                cond.OutletL.P + 1e-8 * "atm") / (trays(top).alfa*trays(top).rhoV));
498               
499        trays([top+topdown:topdown:bot]).OutletV.F = (1 + tanh(1 *
500            (trays([top+topdown:topdown:bot]).OutletV.P -
501            trays([top+topdown:topdown:bot]).InletL.P)/"Pa"))/2 *
502            trays([top+topdown:topdown:bot]).Ah/trays([top+topdown:topdown:bot]).vV *
503            sqrt(2*(trays([top+topdown:topdown:bot]).OutletV.P -
504                trays([top+topdown:topdown:bot]).InletL.P + 1e-8 * "atm") /
505            (trays([top+topdown:topdown:bot]).alfa*trays([top+topdown:topdown:bot]).rhoV));
506       
507        CONNECTIONS
508        #vapor
509        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
510        trays(top).OutletV to cond.InletV;
511       
512        #liquid
513        cond.OutletL to sptop.Inlet;   
514        sptop.Outlet2 to pump1.Inlet;   
515        pump1.Outlet to trays(top).InletL;
516        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
517end
518
519
520#* -------------------------------------------------------------------
521* Refluxed Stripping Column with:
522*
523*       - NTrays like tray;
524*       - a steady state condenser (with subcooling);
525*       - a vessel drum (layed cilinder);
526*       - a splitter which separate reflux and distillate;
527*       - a pump in reflux stream.
528*
529* ------------------------------------------------------------------*#
530Model Refluxed_Stripping_subcooling
531        PARAMETERS
532ext PP as CalcObject;
533ext NComp as Integer;
534        NTrays as Integer(Brief="Number of trays", Default=2);
535        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
536        top as Integer(Brief="Number of top tray");
537        bot as Integer(Brief="Number of bottom tray");
538
539        SET
540        top = (NTrays-1)*(1-topdown)/2+1;
541        bot = NTrays/top;
542       
543        VARIABLES
544        trays(NTrays) as tray;
545        cond as condenserSteady;
546        ttop as tank_cylindrical;
547        sptop as splitter;
548        pump1 as pump;
549
550        EQUATIONS
551        "Pressure Drop through the tray"
552        trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - ttop.Outlet.P)/"Pa"))/2 *
553                trays(top).Ah/trays(top).vV * sqrt(2*(trays(top).OutletV.P -
554                ttop.Outlet.P + 1e-8 * "atm") / (trays(top).alfa*trays(top).rhoV));
555               
556        trays([top+topdown:topdown:bot]).OutletV.F = (1 + tanh(1 *
557            (trays([top+topdown:topdown:bot]).OutletV.P -
558            trays([top+topdown:topdown:bot]).InletL.P)/"Pa"))/2 *
559            trays([top+topdown:topdown:bot]).Ah/trays([top+topdown:topdown:bot]).vV *
560            sqrt(2*(trays([top+topdown:topdown:bot]).OutletV.P -
561                trays([top+topdown:topdown:bot]).InletL.P + 1e-8 * "atm") /
562            (trays([top+topdown:topdown:bot]).alfa*trays([top+topdown:topdown:bot]).rhoV));
563       
564        CONNECTIONS
565        #vapor
566        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
567        trays(top).OutletV to cond.InletV;
568       
569        #liquid
570        cond.OutletL to ttop.Inlet;     
571        ttop.Outlet to sptop.Inlet;
572        sptop.Outlet2 to pump1.Inlet;   
573        pump1.Outlet to trays(top).InletL;
574        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
575end
576
577
578#*----------------------------------------------------------------------
579* Model of a  Refluxed Absorption column containing:
580*       - NTrays like tray;
581*       - dymamic condenser without subcooling;
582*       - a splitter which separate reflux and distillate;
583*       - a pump in reflux stream;
584*---------------------------------------------------------------------*#
585Model Refluxed_Absorption
586        PARAMETERS
587ext PP as CalcObject;
588ext NComp as Integer;
589        NTrays as Integer(Brief="Number of trays", Default=2);
590        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
591        top as Integer(Brief="Number of top tray");
592        bot as Integer(Brief="Number of bottom tray");
593
594        SET
595        top = (NTrays-1)*(1-topdown)/2+1;
596        bot = NTrays/top;
597       
598        VARIABLES
599        trays(NTrays) as tray;
600        cond as condenser;
601        sptop as splitter;
602        pump1 as pump;
603
604        EQUATIONS
605        "Pressure Drop through the tray"
606        trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - cond.OutletL.P)/"Pa"))/2 *
607                trays(top).Ah/trays(top).vV * sqrt(2*(trays(top).OutletV.P -
608                cond.OutletL.P + 1e-8 * "atm") / (trays(top).alfa*trays(top).rhoV));
609               
610        trays([top+topdown:topdown:bot]).OutletV.F = (1 + tanh(1 *
611            (trays([top+topdown:topdown:bot]).OutletV.P -
612            trays([top+topdown:topdown:bot]).InletL.P)/"Pa"))/2 *
613            trays([top+topdown:topdown:bot]).Ah/trays([top+topdown:topdown:bot]).vV *
614            sqrt(2*(trays([top+topdown:topdown:bot]).OutletV.P -
615                trays([top+topdown:topdown:bot]).InletL.P + 1e-8 * "atm") /
616            (trays([top+topdown:topdown:bot]).alfa*trays([top+topdown:topdown:bot]).rhoV));
617       
618        CONNECTIONS
619        #vapor
620        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
621        trays(top).OutletV to cond.InletV;
622       
623        #liquid
624        cond.OutletL to cond.InletV;   
625        cond.OutletL to sptop.Inlet;
626        sptop.Outlet2 to pump1.Inlet;   
627        pump1.Outlet to trays(top).InletL;
628        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
629end
630
631
632#* -------------------------------------------------------------------
633* Refluxed Absorption Column with:
634*
635*       - NTrays like tray;
636*       - a steady state condenser (with subcooling);
637*       - a vessel drum (layed cilinder);
638*       - a splitter which separate reflux and distillate;
639*       - a pump in reflux stream.
640*
641* ------------------------------------------------------------------*#
642Model Refluxed_Absorption_subcooling
643        PARAMETERS
644ext PP as CalcObject;
645ext NComp as Integer;
646        NTrays as Integer(Brief="Number of trays", Default=2);
647        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
648        top as Integer(Brief="Number of top tray");
649        bot as Integer(Brief="Number of bottom tray");
650
651        SET
652        top = (NTrays-1)*(1-topdown)/2+1;
653        bot = NTrays/top;
654       
655        VARIABLES
656        trays(NTrays) as tray;
657        cond as condenserSteady;
658        ttop as tank_cylindrical;
659        sptop as splitter;
660        pump1 as pump;
661
662        EQUATIONS
663        "Pressure Drop through the tray"
664        trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - ttop.Outlet.P)/"Pa"))/2 *
665                trays(top).Ah/trays(top).vV * sqrt(2*(trays(top).OutletV.P -
666                ttop.Outlet.P + 1e-8 * "atm") / (trays(top).alfa*trays(top).rhoV));
667               
668        trays([top+topdown:topdown:bot]).OutletV.F = (1 + tanh(1 *
669            (trays([top+topdown:topdown:bot]).OutletV.P -
670            trays([top+topdown:topdown:bot]).InletL.P)/"Pa"))/2 *
671            trays([top+topdown:topdown:bot]).Ah/trays([top+topdown:topdown:bot]).vV *
672            sqrt(2*(trays([top+topdown:topdown:bot]).OutletV.P -
673                trays([top+topdown:topdown:bot]).InletL.P + 1e-8 * "atm") /
674            (trays([top+topdown:topdown:bot]).alfa*trays([top+topdown:topdown:bot]).rhoV));
675       
676        CONNECTIONS
677        #vapor
678        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
679        trays(top).OutletV to cond.InletV;
680       
681        #liquid
682        cond.OutletL to ttop.Inlet;     
683        ttop.Outlet to sptop.Inlet;
684        sptop.Outlet2 to pump1.Inlet;   
685        pump1.Outlet to trays(top).InletL;
686        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
687end
688
689
690#* -------------------------------------------------------------------
691* Reboiled Stripping Column model with:
692*
693*       - NTrays like tray;
694*       - a kettle reboiler;
695*
696* ------------------------------------------------------------------*#
697Model Reboiled_Stripping_kettle
698        PARAMETERS
699ext PP as CalcObject;
700ext NComp as Integer;
701        NTrays as Integer(Brief="Number of trays", Default=2);
702        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
703        top as Integer(Brief="Number of top tray");
704        bot as Integer(Brief="Number of bottom tray");
705
706        SET
707        top = (NTrays-1)*(1-topdown)/2+1;
708        bot = NTrays/top;
709       
710        VARIABLES
711        trays(NTrays) as tray;
712        reb as reboiler;
713
714        EQUATIONS
715        if (reb.OutletV.P > reb.InletL.P) then
716                "Pressure Drop through the tray"
717                reb.OutletV.F = trays(bot).Ah/reb.vV * sqrt((reb.OutletV.P - trays(bot).OutletL.P)
718                                / (trays(bot).beta*reb.rhoV) );
719        else
720                "Prato selado"
721                reb.OutletV.F = 0.0 * "mol/s";
722        end
723
724        "Pressure Drop through the tray"
725        trays([top:topdown:bot]).OutletV.F = (1 + tanh(1 *
726            (trays([top:topdown:bot]).OutletV.P -
727            trays([top:topdown:bot]).InletL.P)/"Pa"))/2 *
728            trays([top:topdown:bot]).Ah/trays([top:topdown:bot]).vV *
729            sqrt(2*(trays([top:topdown:bot]).OutletV.P -
730                trays([top:topdown:bot]).InletL.P + 1e-8 * "atm") /
731            (trays([top:topdown:bot]).alfa*trays([top:topdown:bot]).rhoV));
732       
733        CONNECTIONS
734        #vapor
735        reb.OutletV to trays(bot).InletV;
736        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
737       
738        #liquid
739        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
740        trays(bot).OutletL to reb.InletL;
741end
742
743
744#* -------------------------------------------------------------------
745* Reboiled Stripping Column model with:
746*
747*       - NTrays like tray;
748*       - a vessel in the bottom of column;
749*       - a splitter which separate the bottom product and the stream to reboiler;
750*       - steady state reboiler (thermosyphon);
751*
752* ------------------------------------------------------------------*#
753Model Reboiled_Stripping_thermosyphon
754        PARAMETERS
755ext PP as CalcObject;
756ext NComp as Integer;
757        NTrays as Integer(Brief="Number of trays", Default=2);
758        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
759        top as Integer(Brief="Number of top tray");
760        bot as Integer(Brief="Number of bottom tray");
761
762        SET
763        top = (NTrays-1)*(1-topdown)/2+1;
764        bot = NTrays/top;
765       
766        VARIABLES
767        trays(NTrays) as tray;
768        reb as reboilerSteady;
769        spbottom as splitter;
770        tbottom as tank;
771
772        EQUATIONS
773        if (reb.OutletV.P > reb.InletL.P) then
774                "Pressure Drop through the tray"
775                reb.OutletV.F = trays(bot).Ah/reb.vV * sqrt((reb.OutletV.P - trays(bot).OutletL.P)
776                                / (trays(bot).alfa*reb.rhoV) );
777        else
778                "Prato selado"
779                reb.OutletV.F = 0.0 * "mol/s";
780        end
781
782        "Pressure Drop through the tray"
783        trays([top:topdown:bot]).OutletV.F = (1 + tanh(1 *
784            (trays([top:topdown:bot]).OutletV.P -
785            trays([top:topdown:bot]).InletL.P)/"Pa"))/2 *
786            trays([top:topdown:bot]).Ah/trays([top:topdown:bot]).vV *
787            sqrt(2*(trays([top:topdown:bot]).OutletV.P -
788                trays([top:topdown:bot]).InletL.P + 1e-8 * "atm") /
789            (trays([top:topdown:bot]).alfa*trays([top:topdown:bot]).rhoV));
790       
791        CONNECTIONS
792        #vapor
793        reb.OutletV to trays(bot).InletV;
794        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
795       
796        #liquid
797        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
798        trays(bot).OutletL to tbottom.Inlet;
799        tbottom.Outlet to spbottom.Inlet;
800        spbottom.Outlet2 to reb.InletL;
801end
802
803
804#* -------------------------------------------------------------------
805* Reboiled Absorption Column model with:
806*
807*       - NTrays like tray;
808*       - a kettle reboiler;
809*
810* ------------------------------------------------------------------*#
811Model Reboiled_Absorption_kettle
812        PARAMETERS
813ext PP as CalcObject;
814ext NComp as Integer;
815        NTrays as Integer(Brief="Number of trays", Default=2);
816        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
817        top as Integer(Brief="Number of top tray");
818        bot as Integer(Brief="Number of bottom tray");
819
820        SET
821        top = (NTrays-1)*(1-topdown)/2+1;
822        bot = NTrays/top;
823       
824        VARIABLES
825        trays(NTrays) as tray;
826        reb as reboiler;
827
828        EQUATIONS
829        if (reb.OutletV.P > reb.InletL.P) then
830                "Pressure Drop through the tray"
831                reb.OutletV.F = trays(bot).Ah/reb.vV * sqrt((reb.OutletV.P - trays(bot).OutletL.P)
832                                / (trays(bot).beta*reb.rhoV) );
833        else
834                "Prato selado"
835                reb.OutletV.F = 0.0 * "mol/s";
836        end
837
838        "Pressure Drop through the tray"
839        trays([top:topdown:bot]).OutletV.F = (1 + tanh(1 *
840            (trays([top:topdown:bot]).OutletV.P -
841            trays([top:topdown:bot]).InletL.P)/"Pa"))/2 *
842            trays([top:topdown:bot]).Ah/trays([top:topdown:bot]).vV *
843            sqrt(2*(trays([top:topdown:bot]).OutletV.P -
844                trays([top:topdown:bot]).InletL.P + 1e-8 * "atm") /
845            (trays([top:topdown:bot]).alfa*trays([top:topdown:bot]).rhoV));
846       
847        CONNECTIONS
848        #vapor
849        reb.OutletV to trays(bot).InletV;
850        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
851       
852        #liquid
853        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
854        trays(bot).OutletL to reb.InletL;
855end
856
857
858#* -------------------------------------------------------------------
859* Reboiled Absorption Column model with:
860*
861*       - NTrays like tray;
862*       - a vessel in the bottom of column;
863*       - a splitter which separate the bottom product and the stream to reboiler;
864*       - steady state reboiler (thermosyphon);
865*
866* ------------------------------------------------------------------*#
867Model Reboiled_Absorption_thermosyphon
868        PARAMETERS
869ext PP as CalcObject;
870ext NComp as Integer;
871        NTrays as Integer(Brief="Number of trays", Default=2);
872        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
873        top as Integer(Brief="Number of top tray");
874        bot as Integer(Brief="Number of bottom tray");
875
876        SET
877        top = (NTrays-1)*(1-topdown)/2+1;
878        bot = NTrays/top;
879       
880        VARIABLES
881        trays(NTrays) as tray;
882        reb as reboilerSteady;
883        spbottom as splitter;
884        tbottom as tank;
885
886        EQUATIONS
887        if (reb.OutletV.P > reb.InletL.P) then
888                "Pressure Drop through the tray"
889                reb.OutletV.F = trays(bot).Ah/reb.vV * sqrt((reb.OutletV.P - trays(bot).OutletL.P)
890                                / (trays(bot).alfa*reb.rhoV) );
891        else
892                "Prato selado"
893                reb.OutletV.F = 0.0 * "mol/s";
894        end
895
896        "Pressure Drop through the tray"
897        trays([top:topdown:bot]).OutletV.F = (1 + tanh(1 *
898            (trays([top:topdown:bot]).OutletV.P -
899            trays([top:topdown:bot]).InletL.P)/"Pa"))/2 *
900            trays([top:topdown:bot]).Ah/trays([top:topdown:bot]).vV *
901            sqrt(2*(trays([top:topdown:bot]).OutletV.P -
902                trays([top:topdown:bot]).InletL.P + 1e-8 * "atm") /
903            (trays([top:topdown:bot]).alfa*trays([top:topdown:bot]).rhoV));
904       
905        CONNECTIONS
906        #vapor
907        reb.OutletV to trays(bot).InletV;
908        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
909       
910        #liquid
911        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
912        trays(bot).OutletL to tbottom.Inlet;
913        tbottom.Outlet to spbottom.Inlet;
914        spbottom.Outlet2 to reb.InletL;
915end
916
917#* -------------------------------------------------------------------
918*  Reactive Distillation Column
919*
920* ------------------------------------------------------------------*#
921Model ReactiveDistillation
922        PARAMETERS
923ext PP as CalcObject;
924ext NComp as Integer;
925        NTrays as Integer(Brief="Number of trays", Default=2);
926       
927        VARIABLES
928        trays(NTrays) as trayReact;
929        cond as condenserReact;
930        reb as reboilerReact;
931        sp as splitter;
932        p as pump;
933       
934        EQUATIONS
935        if ( reb.OutletV.P > 1 * "atm" ) then
936                "Pressure Drop through the tray"
937                reb.OutletV.F = trays(1).Ah/reb.vV * sqrt((reb.OutletV.P - 1*"atm") / (0.15*reb.rhoV) );
938        else
939                "Prato selado"
940                reb.OutletV.F = 0.0 * "mol/s";
941        end
942       
943        CONNECTIONS
944        #vapor
945        reb.OutletV to trays([NTrays]).InletV;
946        trays([2:NTrays]).OutletV to trays([1:NTrays-1]).InletV;
947        trays(1).OutletV to cond.InletV;
948
949        #liquid
950        cond.OutletL to sp.Inlet;       
951        sp.Outlet2 to p.Inlet;
952        p.Outlet to trays(1).InletL;
953        trays([1:NTrays-1]).OutletL to trays([2:NTrays]).InletL;
954        trays(NTrays).OutletL to reb.InletL;
955end
Note: See TracBrowser for help on using the repository browser.