source: branches/new_gui/eml/stage_separators/column.mso @ 936

Last change on this file since 936 was 890, checked in by gerson bicca, 13 years ago

added more folders

File size: 27.6 KB
Line 
1#*-------------------------------------------------------------------
2* EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC.
3*
4* This LIBRARY is free software; you can distribute it and/or modify
5* it under the therms of the ALSOC FREE LICENSE as available at
6* http://www.enq.ufrgs.br/alsoc.
7*
8* EMSO Copyright (C) 2004 - 2007 ALSOC, original code
9* from http://www.rps.eng.br Copyright (C) 2002-2004.
10* All rights reserved.
11*
12* EMSO is distributed under the therms of the ALSOC LICENSE as
13* available at http://www.enq.ufrgs.br/alsoc.
14*
15*----------------------------------------------------------------------
16* File containg models of columns: distillation, stripping, absorbers
17* rectifier, ....
18*
19* The default nomenclature is:
20*               Type_Column_reboilertype_condensertyper
21*
22* where:
23*       Type = refluxed or reboiled or section
24*       Column = Stripping, Absorption, Rectifier, Distillation
25*       Reboiler type (if exists) = kettle or thermosyphon
26*       Condenser type (if exists) = with subccoling or without subcooling
27*
28*-----------------------------------------------------------------------
29* Author: Paula B. Staudt
30* $Id: column.mso 511 2008-05-12 17:25:33Z paula $
31*---------------------------------------------------------------------*#
32
33using "tray";
34using "reboiler";
35using "condenser";
36using "mixers_splitters/splitter";
37using "tank";
38using "pressure_changers/pump";
39
40Model ControlSection
41
42ATTRIBUTES
43        Pallete = false;
44        Brief = "Control variables for column section.";
45
46PARAMETERS
47        outer NComp             as Integer      (Brief="Number of components");
48
49        Tindicator_TrayNumber   as Integer      (Brief="Temperature Indicator in the tray");
50        Pindicator_TrayNumber   as Integer      (Brief="Pressure Indicator in the tray");
51
52end
53
54Model InitializeSection
55
56ATTRIBUTES
57        Pallete = false;
58        Brief = "Initial conditions for column section.";
59
60PARAMETERS
61        outer NComp             as Integer      (Brief="Number of components");
62
63        TopTemperature          as temperature  (Brief = "Tray Temperature at Column Top", Default = 300);
64        BottomTemperature       as temperature  (Brief = "Tray Temperature at Column Bottom", Default = 330);
65        LevelFraction           as fraction             (Brief = "Tray Level Fraction", Default = 0.5);
66
67        TopComposition(NComp)           as fraction     (Brief = "Component Molar Fraction at Column Top", Default = 0.30);
68        BottomComposition(NComp)        as fraction     (Brief = "Component Molar Fraction at Column Bottom", Default = 0.30);
69
70end
71
72Model InitializeStage
73
74ATTRIBUTES
75        Pallete = false;
76        Brief = "Initial conditions for Packed column section.";
77
78PARAMETERS
79        outer NComp             as Integer      (Brief="Number of components");
80
81        TopStageTemperature             as temperature  (Brief = "Tray Temperature at Column Top", Default = 300);
82        BottomStageTemperature          as temperature  (Brief = "Tray Temperature at Column Bottom", Default = 300);
83       
84        TopStageComposition(NComp)              as fraction     (Brief = "Component Molar Fraction at Top");
85        BottomStageComposition(NComp)   as fraction     (Brief = "Component Molar Fraction at Bottom");
86        ColumnHoldup                                    as positive (Brief = "Column holdup", Default=0.1);
87
88end
89
90
91Model SectionColumnBasic
92
93ATTRIBUTES
94        Pallete = false;
95        Brief   = "Model of a basic column section.";
96        Info    =
97"Model of a basic column section containing a vetor of TRAYS numbered from the top-down.";
98
99PARAMETERS
100        outer PP                as Plugin               (Brief="External Physical Properties", Type="PP");
101        outer NComp     as Integer              (Brief="Number of components");
102
103        NumberOfFeeds                                           as Integer                      (Brief="Number of Feed Trays",Default=3,Protected=true);
104        FeedTrayLocation(NumberOfFeeds)         as Integer                      (Brief="Feed tray Location",Default=2);
105        NumberOfTrays                                           as Integer                      (Brief="Number of trays", Default=8);
106        LiqSideTrayIndex(NumberOfTrays)         as Integer                      (Brief="Liquid Side Tray Index", Default=0,Hidden=true);
107        VapSideTrayIndex(NumberOfTrays)         as Integer                      (Brief="Vapour Side Tray Index", Default=0,Hidden=true);
108
109        LiquidSideStreamLocation                        as Integer                      (Brief="Liquid Side Stream Location", Default=2);
110        VapourSideStreamLocation                        as Integer                      (Brief="Vapour Side Stream Location", Default=2);
111
112        VapourFlowModel         as Switcher     (Valid = ["Reepmeyer", "Feehery_Fv", "Roffel_Fv", "Klingberg", "Wang_Fv", "Elgue"], Default = "Reepmeyer");
113        LiquidFlowModel         as Switcher     (Valid = ["Francis", "Wang_Fl", "Olsen", "Feehery_Fl", "Roffel_Fl"], Default = "Francis");
114
115        TrayDiameter                    as length               (Brief="Tray Diameter",Default=1.600);
116        TraySpacing                             as length               (Brief="Tray Spacing",Default=0.600);
117        Fraction_HoleArea               as fraction     (Brief="Fraction of the active area that is occupied by the holes with respect to the total tray area",Default=0.10);
118        Fraction_DowncomerArea  as fraction     (Brief="Fraction of the downcomer area with respect to the total tray area",Default=0.20);
119        WeirLength                              as length               (Brief="Weir length", Default = 1);
120        WeirHeight                              as length               (Brief="Weir height", Default= 0.05);
121        TrayLiquidPasses                as positive     (Brief="Number of liquid passes in the tray", Lower = 1,Default=1);
122        HeatSupply                              as heat_rate    (Brief="Rate of heat supply",Default = 0);
123        AerationFraction                as Real                 (Brief="Aeration fraction", Default = 1);
124        DryPdropCoeff                   as Real                 (Brief="Dry pressure drop coefficient", Default= 0.60);
125        MurphreeEff                     as Real                 (Brief="Murphree efficiency for All Trays", Default= 1);
126       
127VARIABLES
128
129        INITIALIZATION as InitializeSection (Brief="Column Model Initialization");
130        CONTROL                 as ControlSection (Brief="Column Model Control");
131       
132        out     TCI as control_signal   (Brief="Temperature  Indicator", Protected = true, PosX=1, PosY=0.73);
133        out     PCI as control_signal   (Brief="Pressure Indicator", Protected = true, PosX=0, PosY=0.24);
134       
135    in  LiquidInlet     as stream         (Brief="Liquid Inlet in the section", PosX=0.70, PosY=0);
136    out VapourOutlet    as vapour_stream  (Brief="Vapour Outlet in the section", PosX=0.30, PosY=0);
137
138    out VapourDrawOff   as vapour_stream  (Brief="Vapour Draw Off Port in the section", PosX=1, PosY=0.35,Protected = true);
139        out LiquidDrawOff   as liquid_stream  (Brief="Liquid Draw Off Port in the section", PosX=1, PosY=0.65,Protected = true);
140       
141        TRAYS(NumberOfTrays)    as tray                 (Brief="Number of trays in the Column Section",Protected=true);
142        VapourDrawOffFlow               as flow_mol     (Brief="Vapour Draw Off Stream Molar Flow Rate");
143        LiquidDrawOffFlow               as flow_mol     (Brief="Vapour Draw Off Stream Molar Flow Rate");
144
145        in      VapourInlet     as stream             (Brief="Vapour Inlet in the section", PosX=0.30, PosY=1);
146        out     LiquidOutlet    as liquid_stream      (Brief="Liquid Outlet in the section", PosX=0.70, PosY=1);
147       
148        LiquidConnector as stream    (Brief="Liquid connection in the middle TRAYS", PosX=0.75, PosY=1,Hidden=true);
149        VapourConnector as stream    (Brief="Vapour connection in the middle TRAYS", PosX=0.55, PosY=0,Hidden=true);
150
151SET
152        VapSideTrayIndex(VapourSideStreamLocation) =1;
153        LiqSideTrayIndex(LiquidSideStreamLocation) =1;
154       
155        TRAYS.TrayDiameter_                             = TrayDiameter;
156        TRAYS.TraySpacing_                              = TraySpacing;
157        TRAYS.Fraction_HoleArea_                = Fraction_HoleArea;
158        TRAYS.Fraction_DowncomerArea_   = Fraction_DowncomerArea;
159        TRAYS.WeirLength_                               = WeirLength;
160        TRAYS.WeirHeight_                               = WeirHeight;
161        TRAYS.TrayLiquidPasses_                 = TrayLiquidPasses;
162        TRAYS.HeatSupply_                               = HeatSupply;
163        TRAYS.AerationFraction_                 = AerationFraction;
164        TRAYS.DryPdropCoeff_                    = DryPdropCoeff;
165        TRAYS.MurphreeEff_                              = MurphreeEff;
166
167CONNECTIONS
168        TRAYS([2:NumberOfTrays]).OutletVapour   to TRAYS([1:NumberOfTrays-1]).InletVapour;
169        TRAYS([1:NumberOfTrays-1]).OutletLiquid to TRAYS([2:NumberOfTrays]).InletLiquid;
170
171    LiquidConnector to TRAYS(1).InletLiquid;
172    VapourConnector to TRAYS(NumberOfTrays).InletVapour;
173
174INITIAL
175
176for i in 1:NumberOfTrays do
177
178"The initial temperature of the TRAYS"
179        TRAYS(i).OutletLiquid.T = INITIALIZATION.TopTemperature+(INITIALIZATION.BottomTemperature-INITIALIZATION.TopTemperature)*((i-1)/(NumberOfTrays-1));
180
181"The initial Level of the TRAYS"
182        TRAYS(i).Level = INITIALIZATION.LevelFraction*WeirHeight;
183end
184
185for i in 1:NComp-1 do
186
187for j in 1:NumberOfTrays do
188
189"The initial composition of the TRAYS - Normalized"
190        TRAYS(j).OutletLiquid.z(i) = INITIALIZATION.TopComposition(i)/sum(INITIALIZATION.TopComposition) +(INITIALIZATION.BottomComposition(i)/sum(INITIALIZATION.BottomComposition)-INITIALIZATION.TopComposition(i)/sum(INITIALIZATION.TopComposition) )*((j-1)/(NumberOfTrays-1));
191end
192
193end
194
195EQUATIONS
196
197"Tray Temperature Indicator"   
198        #TCI*'K' = TRAYS(min([NumberOfTrays, CONTROL.Tindicator_TrayNumber])).OutletVapour.T;
199        TCI*'K' = TRAYS(CONTROL.Tindicator_TrayNumber).OutletVapour.T;
200
201"Tray Pressure Indicator"       
202        #PCI*'atm' = TRAYS(min([NumberOfTrays, CONTROL.Pindicator_TrayNumber])).OutletVapour.P;
203        PCI*'atm' = TRAYS(CONTROL.Pindicator_TrayNumber).OutletVapour.P;
204
205switch LiquidFlowModel
206       
207        case "Francis":
208                TRAYS.LFlowModel = 1;
209        case "Wang_Fl":
210                TRAYS.LFlowModel = 2;
211       
212        case "Olsen":
213                TRAYS.LFlowModel = 3;
214       
215        case "Feehery_Fl":
216                TRAYS.LFlowModel = 4;
217       
218        case "Roffel_Fl":
219                TRAYS.LFlowModel = 5;
220
221end
222       
223switch VapourFlowModel
224
225        case "Reepmeyer":
226                TRAYS.VFlowModel = 1;
227       
228        case "Feehery_Fv":
229                TRAYS.VFlowModel = 2;                   
230       
231        case "Roffel_Fv":
232                TRAYS.VFlowModel = 3;                   
233       
234        case "Klingberg":
235                TRAYS.VFlowModel = 4;                   
236       
237        case "Wang_Fv":
238                TRAYS.VFlowModel = 5;                   
239       
240        case "Elgue":
241                TRAYS.VFlowModel = 6;
242
243end
244
245"Liquid Inlet Flow"     
246        LiquidConnector.F = LiquidInlet.F;
247
248"Liquid Inlet Temperature"             
249        LiquidConnector.T = LiquidInlet.T;
250
251"Liquid Inlet Pressure"         
252        LiquidConnector.P = LiquidInlet.P;
253
254"Liquid Inlet Composition"             
255        LiquidConnector.z = LiquidInlet.z;
256
257"Liquid Inlet Vapour Fraction"         
258        LiquidConnector.v = LiquidInlet.v;
259
260"Liquid Inlet Enthalpy"         
261        LiquidConnector.h = LiquidInlet.h;
262
263"Vapour Inlet Flow"             
264        VapourConnector.F = VapourInlet.F;
265
266"Vapour Inlet Temperature"             
267        VapourConnector.T = VapourInlet.T;
268
269"Vapour Inlet Pressure"         
270        VapourConnector.P = VapourInlet.P;
271
272"Vapour Inlet Composition"             
273        VapourConnector.z = VapourInlet.z;
274
275"Vapour Inlet Vapour Fraction"         
276        VapourConnector.v = VapourInlet.v;
277
278"Vapour Inlet Enthalpy"         
279        VapourConnector.h = VapourInlet.h;
280
281"Liquid Outlet Flow"   
282        LiquidOutlet.F = TRAYS(NumberOfTrays).OutletLiquid.F;
283
284"Liquid Outlet Temperature"     
285        LiquidOutlet.T = TRAYS(NumberOfTrays).OutletLiquid.T;
286
287"Liquid Outlet Pressure"       
288        LiquidOutlet.P = TRAYS(NumberOfTrays).OutletLiquid.P;
289
290"Liquid Outlet Composition"     
291        LiquidOutlet.z = TRAYS(NumberOfTrays).OutletLiquid.z;
292
293"Vapour Outlet Flow"           
294        VapourOutlet.F = TRAYS(1).OutletVapour.F;
295
296"Vapour Outlet Temperature"             
297        VapourOutlet.T = TRAYS(1).OutletVapour.T;
298
299"Vapour Outlet Pressure"               
300        VapourOutlet.P = TRAYS(1).OutletVapour.P;
301
302"Vapour Outlet Composition"             
303        VapourOutlet.z = TRAYS(1).OutletVapour.z;
304
305"Vapour Draw Off Stream - Flow"         
306        VapourDrawOff.F*VapSideTrayIndex= TRAYS.VapourSideStream.F;
307
308"Vapour Draw Off Stream - Temperature"         
309        VapourDrawOff.T = TRAYS(VapourSideStreamLocation).VapourSideStream.T;
310
311"Vapour Draw Off Stream - Pressure"             
312        VapourDrawOff.P = TRAYS(VapourSideStreamLocation).VapourSideStream.P;
313
314"Vapour Draw Off Stream - Composition"         
315        VapourDrawOff.z = TRAYS(VapourSideStreamLocation).VapourSideStream.z;
316
317"Vapour Draw Off Stream"       
318        VapourDrawOffFlow = VapourDrawOff.F;
319
320"Liquid Draw Off Stream - Flow"         
321        LiquidDrawOff.F*LiqSideTrayIndex= TRAYS.LiquidSideStream.F;
322
323"Liquid Draw Off Stream - Temperature" 
324        LiquidDrawOff.T = TRAYS(LiquidSideStreamLocation).LiquidSideStream.T;
325
326"Liquid Draw Off Stream - Pressure"                     
327        LiquidDrawOff.P = TRAYS(LiquidSideStreamLocation).LiquidSideStream.P;
328
329"Liquid Draw Off Stream - Composition" 
330        LiquidDrawOff.z = TRAYS(LiquidSideStreamLocation).LiquidSideStream.z;
331
332"Liquid Draw Off Stream"       
333        LiquidDrawOffFlow = LiquidDrawOff.F;
334
335end
336
337Model Section_Column    as SectionColumnBasic
338
339ATTRIBUTES
340        Pallete         = true;
341        Icon            = "icon/SectionColumn";
342        Brief   = "Model of a column section.";
343        Info            =
344"== Model of a column section containing ==
345* NumberOfTrays TRAYS.
346* One Feed Inlet.
347       
348== Specify ==
349* the feed stream of each tray (Inlet);
350* the Murphree eficiency for each tray Emv;
351* the InletLiquid stream of the top tray;
352* the InletVapour stream of the bottom tray.
353       
354== Initial Conditions ==
355* the TRAYS temperature (OutletLiquid.T);
356* the TRAYS liquid level (Level) OR the TRAYS liquid flow (OutletLiquid.F);
357* (NoComps - 1) OutletLiquid (OR OutletVapour) compositions for each tray.
358";
359
360SET
361        NumberOfFeeds = 1;
362
363VARIABLES
364       
365        in      FeedTray        as stream               (Brief="Feed stream", PosX=0, PosY=0.55);
366
367EQUATIONS
368#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
369# Equating Feed Tray Variables to Trays Variables
370#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
371for i in 1:NumberOfTrays do
372
373if   i equal FeedTrayLocation(1) then   
374
375"FeedTrayTop Inlet Flow"       
376        FeedTray.F= TRAYS(i).Inlet.F;
377
378"FeedTrayTop Inlet Temperature"
379        FeedTray.T = TRAYS(i).Inlet.T;
380
381"FeedTrayTop Inlet Pressure"
382        FeedTray.P = TRAYS(i).Inlet.P;
383
384"FeedTrayTop Inlet Composition"
385        FeedTray.z = TRAYS(i).Inlet.z;
386
387"FeedTrayTop Inlet Vapour Fraction"
388        FeedTray.v = TRAYS(i).Inlet.v;
389
390"FeedTrayTop Inlet Enthalpy"
391        FeedTray.h = TRAYS(i).Inlet.h;
392
393else
394
395"Inlet Tray - Flow Sealed"
396    0*'mol/h'= TRAYS(i).Inlet.F;
397       
398"Inlet Tray -  Temperature"
399    300*'K' = TRAYS(i).Inlet.T;
400       
401"Inlet Tray -  Pressure"
402    1*'atm' = TRAYS(i).Inlet.P;
403       
404"Inlet Tray -  Composition"
405    0.1 = TRAYS(i).Inlet.z;
406       
407"Inlet Tray -  Vapour Fraction"
408    0 = TRAYS(i).Inlet.v;
409       
410"Inlet Tray -  Enthalpy"
411    0*'J/mol' = TRAYS(i).Inlet.h;
412
413end
414
415end
416
417end
418
419Model Section_Column2   as SectionColumnBasic
420
421ATTRIBUTES
422        Pallete         = true;
423        Icon            = "icon/SectionColumn";
424        Brief   = "Model of a column section.";
425        Info            =
426"== Model of a column section containing ==
427* NumberOfTrays TRAYS.
428* Two Feed Inlets.
429       
430== Specify ==
431* the feed stream of each tray (Inlet);
432* the Murphree eficiency for each tray Emv;
433* the InletLiquid stream of the top tray;
434* the InletVapour stream of the bottom tray.
435       
436== Initial Conditions ==
437* the TRAYS temperature (OutletLiquid.T);
438* the TRAYS liquid level (Level) OR the TRAYS liquid flow (OutletLiquid.F);
439* (NoComps - 1) OutletLiquid (OR OutletVapour) compositions for each tray.
440";
441
442SET
443        NumberOfFeeds = 2;
444
445VARIABLES
446       
447        in      FeedTrayOne     as stream               (Brief="Feed stream", PosX=0, PosY=0.45);
448        in      FeedTrayTwo     as stream               (Brief="Feed stream", PosX=0, PosY=0.65);
449
450EQUATIONS
451
452for i in 1:NumberOfTrays do
453
454if   i equal FeedTrayLocation(1) then   
455
456"FeedTrayTop Inlet Flow"       
457        FeedTrayOne.F= TRAYS(i).Inlet.F;
458
459"FeedTrayTop Inlet Temperature"
460        FeedTrayOne.T = TRAYS(i).Inlet.T;
461
462"FeedTrayTop Inlet Pressure"
463        FeedTrayOne.P = TRAYS(i).Inlet.P;
464
465"FeedTrayTop Inlet Composition"
466        FeedTrayOne.z = TRAYS(i).Inlet.z;
467
468"FeedTrayTop Inlet Vapour Fraction"
469        FeedTrayOne.v = TRAYS(i).Inlet.v;
470
471"FeedTrayTop Inlet Enthalpy"
472        FeedTrayOne.h = TRAYS(i).Inlet.h;
473
474else if   i equal FeedTrayLocation(2) then   
475
476"FeedTrayBottom Inlet Flow"     
477        FeedTrayTwo.F= TRAYS(i).Inlet.F;
478
479"FeedTrayBottom Inlet Temperature"
480        FeedTrayTwo.T = TRAYS(i).Inlet.T;
481
482"FeedTrayBottom Inlet Pressure"
483        FeedTrayTwo.P = TRAYS(i).Inlet.P;
484
485"FeedTrayBottom Inlet Composition"
486        FeedTrayTwo.z = TRAYS(i).Inlet.z;
487
488"FeedTrayBottom Inlet Vapour Fraction"
489        FeedTrayTwo.v = TRAYS(i).Inlet.v;
490
491"FeedTrayBottom Inlet Enthalpy"
492        FeedTrayTwo.h = TRAYS(i).Inlet.h;
493
494else
495
496"Inlet Tray - Flow Sealed"
497    0*'mol/h'= TRAYS(i).Inlet.F;
498       
499"Inlet Tray -  Temperature"
500    300*'K' = TRAYS(i).Inlet.T;
501       
502"Inlet Tray -  Pressure"
503    1*'atm' = TRAYS(i).Inlet.P;
504       
505"Inlet Tray -  Composition"
506    0.1 = TRAYS(i).Inlet.z;
507       
508"Inlet Tray -  Vapour Fraction"
509    0 = TRAYS(i).Inlet.v;
510       
511"Inlet Tray -  Enthalpy"
512    0*'J/mol' = TRAYS(i).Inlet.h;
513
514end
515
516end
517
518end
519
520end
521
522Model Section_Column3   as SectionColumnBasic
523
524ATTRIBUTES
525        Pallete         = true;
526        Icon            = "icon/SectionColumn";
527        Brief   = "Model of a column section.";
528        Info            =
529"== Model of a column section containing ==
530* NumberOfTrays TRAYS.
531* Three Feed Inlets.
532       
533== Specify ==
534* the feed stream of each tray (Inlet);
535* the Murphree eficiency for each tray Emv;
536* the InletLiquid stream of the top tray;
537* the InletVapour stream of the bottom tray.
538       
539== Initial Conditions ==
540* the TRAYS temperature (OutletLiquid.T);
541* the TRAYS liquid level (Level) OR the TRAYS liquid flow (OutletLiquid.F);
542* (NoComps - 1) OutletLiquid (OR OutletVapour) compositions for each tray.
543";
544
545SET
546        NumberOfFeeds = 3;
547
548VARIABLES
549       
550        in      FeedTrayOne     as stream               (Brief="Feed stream", PosX=0, PosY=0.45);
551        in      FeedTrayTwo     as stream               (Brief="Feed stream", PosX=0, PosY=0.65);
552        in      FeedTrayThree   as stream               (Brief="Feed stream", PosX=0, PosY=0.85);
553
554EQUATIONS
555
556for i in 1:NumberOfTrays do
557
558if   i equal FeedTrayLocation(1) then   
559
560"FeedTrayTop Inlet Flow"       
561        FeedTrayOne.F= TRAYS(i).Inlet.F;
562
563"FeedTrayTop Inlet Temperature"
564        FeedTrayOne.T = TRAYS(i).Inlet.T;
565
566"FeedTrayTop Inlet Pressure"
567        FeedTrayOne.P = TRAYS(i).Inlet.P;
568
569"FeedTrayTop Inlet Composition"
570        FeedTrayOne.z = TRAYS(i).Inlet.z;
571
572"FeedTrayTop Inlet Vapour Fraction"
573        FeedTrayOne.v = TRAYS(i).Inlet.v;
574
575"FeedTrayTop Inlet Enthalpy"
576        FeedTrayOne.h = TRAYS(i).Inlet.h;
577
578else if   i equal FeedTrayLocation(2) then   
579
580"FeedTrayBottom Inlet Flow"     
581        FeedTrayTwo.F= TRAYS(i).Inlet.F;
582
583"FeedTrayBottom Inlet Temperature"
584        FeedTrayTwo.T = TRAYS(i).Inlet.T;
585
586"FeedTrayBottom Inlet Pressure"
587        FeedTrayTwo.P = TRAYS(i).Inlet.P;
588
589"FeedTrayBottom Inlet Composition"
590        FeedTrayTwo.z = TRAYS(i).Inlet.z;
591
592"FeedTrayBottom Inlet Vapour Fraction"
593        FeedTrayTwo.v = TRAYS(i).Inlet.v;
594
595"FeedTrayBottom Inlet Enthalpy"
596        FeedTrayTwo.h = TRAYS(i).Inlet.h;
597
598else if   i equal FeedTrayLocation(3) then   
599
600"FeedTrayBottom Inlet Flow"     
601        FeedTrayThree.F= TRAYS(i).Inlet.F;
602
603"FeedTrayBottom Inlet Temperature"
604        FeedTrayThree.T = TRAYS(i).Inlet.T;
605
606"FeedTrayBottom Inlet Pressure"
607        FeedTrayThree.P = TRAYS(i).Inlet.P;
608
609"FeedTrayBottom Inlet Composition"
610        FeedTrayThree.z = TRAYS(i).Inlet.z;
611
612"FeedTrayBottom Inlet Vapour Fraction"
613        FeedTrayThree.v = TRAYS(i).Inlet.v;
614
615"FeedTrayBottom Inlet Enthalpy"
616        FeedTrayThree.h = TRAYS(i).Inlet.h;
617
618else
619
620"Inlet Tray - Flow Sealed"
621    0*'mol/h'= TRAYS(i).Inlet.F;
622       
623"Inlet Tray -  Temperature"
624    300*'K' = TRAYS(i).Inlet.T;
625       
626"Inlet Tray -  Pressure"
627    1*'atm' = TRAYS(i).Inlet.P;
628       
629"Inlet Tray -  Composition"
630    0.1 = TRAYS(i).Inlet.z;
631       
632"Inlet Tray -  Vapour Fraction"
633    0 = TRAYS(i).Inlet.v;
634       
635"Inlet Tray -  Enthalpy"
636    0*'J/mol' = TRAYS(i).Inlet.h;
637
638end
639
640end
641
642end
643
644end
645
646end
647
648
649Model Packed_Section_ColumnBasic
650
651ATTRIBUTES
652        Pallete         = false;
653        Icon            = "icon/PackedSectionColumn";
654        Brief           = "Model of a packed column section.";
655        Info            =
656"== Model of a packed column section containing ==
657* NStages theoretical stages.
658       
659== Specify ==
660* the feed stream of each tray (Inlet);
661* the InletLiquid stream of the top tray;
662* the InletVapour stream of the bottom tray;
663* the total pressure drop (dP) of the section.
664       
665== Initial Conditions ==
666* the stages temperature (OutletLiquid.T);
667* the stages liquid holdup;
668* (NoComps - 1) OutletLiquid (OR OutletVapour) compositions for each tray.
669";
670       
671PARAMETERS
672
673        outer PP                as Plugin       (Brief = "External Physical Properties", Type="PP");
674        outer NComp     as Integer      (Brief="Number of components",Protected=true);
675       
676
677        NumberOfFeeds                                           as Integer      (Brief="Number of Feed Stages",Default=3,Protected=true);
678        NumberOfStages                                          as Integer      (Brief="Number of Stages", Default=3);
679        FeedStageLocation(NumberOfFeeds)        as Integer      (Brief="Feed Stage Location",Default=2);
680       
681        PackingHeight           as length               (Brief="Height of packing");
682        HeatSupply                      as heat_rate    (Brief="Rate of heat supply");
683        ColumnDiameter          as length               (Brief="Column diameter");
684        VoidFraction            as Real                 (Brief="Void fraction of packing, (m^3 void space/m^3 packed bed)");
685        ResistanceCoeff         as positive     (Brief="Resistance coefficient on the liquid load", Default=1);
686        AreaPerPackingVol       as Real                 (Brief="surface area per packing volume", Unit='m^2/m^3');
687        HETP                            as length               (Brief="The Height Equivalent to a Theoretical Plate",Protected=true);
688
689VARIABLES
690
691        INITIALIZATION  as InitializeStage      (Brief = "Column Model Initialization");
692        CONTROL                 as ControlSection (Brief="Column Model Control");
693       
694        out     TCI as control_signal   (Brief="Temperature  Indicator", Protected = true, PosX=1, PosY=0.73);
695        out     PCI as control_signal   (Brief="Pressure Indicator", Protected = true, PosX=0, PosY=0.24);
696       
697        in      LiquidInlet             as      stream                          (Brief="Liquid Inlet in the section", PosX=0.70, PosY=0,Protected=true);
698        out     VapourOutlet            as vapour_stream        (Brief="Vapour Outlet in the section", PosX=0.30, PosY=0,Protected=true);
699       
700        in              VapourInlet             as stream                               (Brief="Vapour Inlet in the section", PosX=0.30, PosY=1,Protected=true);
701        out     LiquidOutlet            as liquid_stream                (Brief="Liquid Outlet in the section", PosX=0.70, PosY=1,Protected=true);
702       
703        LiquidConnector as stream       (Brief="Liquid connection at the middle STAGES", PosX=0.75, PosY=1,Hidden=true);
704        VapourConnector as stream       (Brief="Vapour connection at the middle STAGES", PosX=0.55, PosY=0,Hidden=true);
705       
706        STAGES(NumberOfStages) as packedStage (Brief="Column Stages",Protected=true);
707        PressureDrop               as pressure (Brief="Column Pressure Drop", Protected=true);
708
709SET
710
711        STAGES.Number_Stages                            = NumberOfStages;
712        STAGES.HeightOfPacking                          = PackingHeight;
713        STAGES.HeatOnStage                                      = HeatSupply;
714        STAGES.ColumnInternalDiameter           = ColumnDiameter;
715        STAGES.PackingVoidFraction                      = VoidFraction;
716        STAGES.LiquidResistanceCoeff            = ResistanceCoeff ;
717        STAGES.AreaPerPackingVolume             = AreaPerPackingVol;
718       
719        HETP = PackingHeight/NumberOfStages;   
720
721CONNECTIONS
722
723        STAGES([2:NumberOfStages]).OutletVapour         to STAGES([1:NumberOfStages-1]).InletVapour;
724        STAGES([1:NumberOfStages-1]).OutletLiquid       to STAGES([2:NumberOfStages]).InletLiquid;
725        LiquidConnector                                                         to STAGES(1).InletLiquid;
726        VapourConnector                                                         to STAGES(NumberOfStages).InletVapour;
727
728EQUATIONS
729
730        LiquidConnector.F= LiquidInlet.F;
731        LiquidConnector.T = LiquidInlet.T;
732        LiquidConnector.P = LiquidInlet.P;
733        LiquidConnector.z = LiquidInlet.z;
734        LiquidConnector.v = LiquidInlet.v;
735        LiquidConnector.h = LiquidInlet.h;
736       
737        VapourConnector.F= VapourInlet.F;
738        VapourConnector.T = VapourInlet.T;
739        VapourConnector.P = VapourInlet.P;
740        VapourConnector.z = VapourInlet.z;
741        VapourConnector.v = VapourInlet.v;
742        VapourConnector.h = VapourInlet.h;
743       
744        LiquidOutlet.F= STAGES(NumberOfStages).OutletLiquid.F;
745        LiquidOutlet.T = STAGES(NumberOfStages).OutletLiquid.T;
746        LiquidOutlet.P = STAGES(NumberOfStages).OutletLiquid.P;
747        LiquidOutlet.z = STAGES(NumberOfStages).OutletLiquid.z;
748       
749        VapourOutlet.F= STAGES(1).OutletVapour.F;
750        VapourOutlet.T = STAGES(1).OutletVapour.T;
751        VapourOutlet.P = STAGES(1).OutletVapour.P;
752        VapourOutlet.z = STAGES(1).OutletVapour.z;
753
754"Tray Temperature Indicator"   
755        #TCI*'K' = TRAYS(min([NumberOfTrays, CONTROL.Tindicator_TrayNumber])).OutletVapour.T;
756        TCI*'K' = STAGES(CONTROL.Tindicator_TrayNumber).OutletVapour.T;
757
758"Tray Pressure Indicator"       
759        #PCI*'atm' = TRAYS(min([NumberOfTrays, CONTROL.Pindicator_TrayNumber])).OutletVapour.P;
760        PCI*'atm' = STAGES(CONTROL.Pindicator_TrayNumber).OutletVapour.P;
761
762"PressureDrop"
763        PressureDrop = STAGES(NumberOfStages).OutletLiquid.P - STAGES(1).OutletLiquid.P;
764
765INITIAL
766
767for i in 1:NumberOfStages do
768
769"The initial temperature of the STAGES"
770        STAGES(i).OutletLiquid.T = INITIALIZATION.TopStageTemperature+(INITIALIZATION.BottomStageTemperature-INITIALIZATION.TopStageTemperature)*((i-1)/(NumberOfStages-1));
771
772"The Column Holdup of the STAGES"
773        STAGES(i).hl = INITIALIZATION.ColumnHoldup;
774
775end
776
777for i in 1:NComp-1 do
778
779for j in 1:NumberOfStages do
780
781"The initial composition of the TRAYS"
782        STAGES(j).OutletLiquid.z(i) = INITIALIZATION.TopStageComposition(i)/sum(INITIALIZATION.TopStageComposition) +(INITIALIZATION.BottomStageComposition(i)/sum(INITIALIZATION.BottomStageComposition)-INITIALIZATION.TopStageComposition(i)/sum(INITIALIZATION.TopStageComposition) )*((j-1)/(NumberOfStages-1));
783
784end
785
786end
787
788end
789
790Model Packed_Section_Column     as Packed_Section_ColumnBasic
791
792        ATTRIBUTES
793        Pallete         = true;
794        Icon            = "icon/PackedSectionColumn";
795        Brief           = "Model of a packed column section.";
796        Info            =
797"== Model of a packed column section containing ==
798* NStages theoretical stages.
799       
800== Specify ==
801* the feed stream of each tray (Inlet);
802* the InletLiquid stream of the top tray;
803* the InletVapour stream of the bottom tray;
804* the total pressure drop (dP) of the section.
805       
806== Initial Conditions ==
807* the stages temperature (OutletLiquid.T);
808* the stages liquid holdup;
809* (NoComps - 1) OutletLiquid (OR OutletVapour) compositions for each tray.
810";
811
812SET
813        NumberOfFeeds = 1;
814
815VARIABLES
816       
817        in      FeedStage       as stream               (Brief="Feed stream", PosX=0, PosY=0.55);
818
819EQUATIONS
820#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
821# Equating Feed Tray Variables to Trays Variables
822#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
823for i in 1:NumberOfStages do
824
825if   i equal FeedStageLocation(1) then   
826
827"FeedTrayTop Inlet Flow"       
828        FeedStage.F= STAGES(i).Inlet.F;
829
830"FeedTrayTop Inlet Temperature"
831        FeedStage.T = STAGES(i).Inlet.T;
832
833"FeedTrayTop Inlet Pressure"
834        FeedStage.P = STAGES(i).Inlet.P;
835
836"FeedTrayTop Inlet Composition"
837        FeedStage.z = STAGES(i).Inlet.z;
838
839"FeedTrayTop Inlet Vapour Fraction"
840        FeedStage.v = STAGES(i).Inlet.v;
841
842"FeedTrayTop Inlet Enthalpy"
843        FeedStage.h = STAGES(i).Inlet.h;
844
845else
846
847"Inlet Tray - Flow Sealed"
848    0*'mol/h'= STAGES(i).Inlet.F;
849       
850"Inlet Tray -  Temperature"
851    300*'K' = STAGES(i).Inlet.T;
852       
853"Inlet Tray -  Pressure"
854    1*'atm' = STAGES(i).Inlet.P;
855       
856"Inlet Tray -  Composition"
857    0.1 = STAGES(i).Inlet.z;
858       
859"Inlet Tray -  Vapour Fraction"
860    0 = STAGES(i).Inlet.v;
861       
862"Inlet Tray -  Enthalpy"
863    0*'J/mol' = STAGES(i).Inlet.h;
864
865end
866
867end
868
869end
870
871Model Packed_Section_Column2    as Packed_Section_ColumnBasic
872
873        ATTRIBUTES
874        Pallete         = true;
875        Icon            = "icon/PackedSectionColumn";
876        Brief           = "Model of a packed column section.";
877        Info            =
878"== Model of a packed column section containing ==
879* NStages theoretical stages.
880       
881== Specify ==
882* the feed stream of each tray (Inlet);
883* the InletLiquid stream of the top tray;
884* the InletVapour stream of the bottom tray;
885* the total pressure drop (dP) of the section.
886       
887== Initial Conditions ==
888* the stages temperature (OutletLiquid.T);
889* the stages liquid holdup;
890* (NoComps - 1) OutletLiquid (OR OutletVapour) compositions for each tray.
891";
892
893SET
894        NumberOfFeeds = 2;
895
896VARIABLES
897       
898        in      FeedStageOne    as stream               (Brief="Feed stream", PosX=0, PosY=0.45);
899        in      FeedStageTwo    as stream               (Brief="Feed stream", PosX=0, PosY=0.65);
900
901EQUATIONS
902#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
903# Equating Feed Stage Variables to Stages Variables
904#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
905
906for i in 1:NumberOfStages do
907
908if   i equal FeedStageLocation(1) then   
909
910"FeedTrayTop Inlet Flow"       
911        FeedStageOne.F= STAGES(i).Inlet.F;
912
913"FeedTrayTop Inlet Temperature"
914        FeedStageOne.T = STAGES(i).Inlet.T;
915
916"FeedTrayTop Inlet Pressure"
917        FeedStageOne.P = STAGES(i).Inlet.P;
918
919"FeedTrayTop Inlet Composition"
920        FeedStageOne.z = STAGES(i).Inlet.z;
921
922"FeedTrayTop Inlet Vapour Fraction"
923        FeedStageOne.v = STAGES(i).Inlet.v;
924
925"FeedTrayTop Inlet Enthalpy"
926        FeedStageOne.h = STAGES(i).Inlet.h;
927
928else if   i equal FeedStageLocation(2) then   
929
930"FeedTrayBottom Inlet Flow"     
931        FeedStageTwo.F= STAGES(i).Inlet.F;
932
933"FeedTrayBottom Inlet Temperature"
934        FeedStageTwo.T = STAGES(i).Inlet.T;
935
936"FeedTrayBottom Inlet Pressure"
937        FeedStageTwo.P = STAGES(i).Inlet.P;
938
939"FeedTrayBottom Inlet Composition"
940        FeedStageTwo.z = STAGES(i).Inlet.z;
941
942"FeedTrayBottom Inlet Vapour Fraction"
943        FeedStageTwo.v = STAGES(i).Inlet.v;
944
945"FeedTrayBottom Inlet Enthalpy"
946        FeedStageTwo.h = STAGES(i).Inlet.h;
947
948else
949
950"Inlet Tray - Flow Sealed"
951    0*'mol/h'= STAGES(i).Inlet.F;
952       
953"Inlet Tray -  Temperature"
954    300*'K' = STAGES(i).Inlet.T;
955       
956"Inlet Tray -  Pressure"
957    1*'atm' = STAGES(i).Inlet.P;
958       
959"Inlet Tray -  Composition"
960    0.1 = STAGES(i).Inlet.z;
961       
962"Inlet Tray -  Vapour Fraction"
963    0 = STAGES(i).Inlet.v;
964       
965"Inlet Tray -  Enthalpy"
966    0*'J/mol' = STAGES(i).Inlet.h;
967
968end
969
970end
971
972end
973
974end
975
Note: See TracBrowser for help on using the repository browser.