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

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

Included reactive distillation column

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