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

Last change on this file since 68 was 46, checked in by Paula Bettio Staudt, 17 years ago

Fixed some sample files

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