Changeset 879 for branches/gui/eml


Ignore:
Timestamp:
Nov 9, 2009, 2:11:31 PM (13 years ago)
Author:
gerson bicca
Message:

updated dynamic models

Location:
branches/gui/eml/stage_separators
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/gui/eml/stage_separators/condenser.mso

    r877 r879  
    1818*--------------------------------------------------------------------*#
    1919
    20 using "streams";
     20using "tank";
    2121
    2222Model condenserSteady
     
    303303        outer NComp     as Integer (Brief="Number of Components");
    304304       
    305         pi                      as positive             (Brief="Pi value", Default=3.141593,Hidden=true, Symbol="\pi");
    306         g                               as acceleration (Brief="Gravity Acceleration",Default=9.81,Hidden=true);
    307        
    308         Orientation     as Switcher (Valid=["vertical","horizontal"],Default="vertical");
    309         Heads                   as Switcher (Valid=["elliptical","hemispherical"],Default="elliptical");
    310 
    311         Diameter                as length       (Brief="Vessel diameter", Symbol="D_{i}");
    312         Lenght                  as length       (Brief="Side length of the cylinder shell", Symbol="L_{vessel}");
    313        
    314         Vhead_elliptical                as volume       (Brief="Elliptical Head Total Volume",Hidden=true, Symbol="V_{head}^{elliptical}");
    315         Vhead_hemispherical     as volume       (Brief="Hemispherical Head Total Volume",Hidden=true, Symbol="V_{head}^{hemispherical}");
    316         Vcylinder                               as volume       (Brief="Cylinder Total Volume",Hidden=true, Symbol="V_{cylinder}");
    317         radius                                  as length       (Brief="Vessel radius",Hidden=true, Symbol="R_{cylinder}");
    318        
    319305        Mw(NComp)       as molweight    (Brief = "Component Mol Weight",Hidden=true);
    320306        low_flow        as flow_mol     (Brief = "Low Flow",Default = 1E-6, Hidden=true);
     
    331317       
    332318VARIABLES
     319
     320        Geometry                as VesselVolume (Brief="Vessel Geometry", Symbol=" ");
    333321
    334322in      InletVapour     as stream                       (Brief="Vapour inlet stream", PosX=0.13, PosY=0, Symbol="_{in}^{Vapour}");
     
    348336        vV                      as volume_mol   (Brief="Vapour Molar volume", Protected = true);
    349337        rho                     as dens_mass    (Brief ="Inlet Vapour Mass Density",Hidden=true, Symbol ="\rho");
    350         Level           as length               (Brief="Level of liquid phase", Protected = true);
    351338        Pdrop           as press_delta  (Brief = "Pressure Drop", DisplayUnit = 'kPa', Symbol ="\Delta P", Protected=true);
    352339
    353         Vtotal                  as volume       (Brief="Vessel total volume",Protected=true, Symbol="V_{total}");
    354         Vfilled                 as volume       (Brief="Vessel volume content",Protected=true, Symbol="V_{filled}");
    355         Across                  as area         (Brief="Cross Section Area of condenser",Protected=true);
    356 
    357340SET
    358         pi = 3.141593;
    359         g = 9.81 * 'm/(s^2)';
    360         Vhead_elliptical        = (pi*Diameter^3)/12;
    361         Vhead_hemispherical = (pi*Diameter^3)/6;
    362         Vcylinder = 0.25*(pi*Diameter^2)*Lenght;
    363         radius = 0.5*Diameter;
    364 
    365341        Mw   = PP.MolecularWeight();
    366342        low_flow = 1E-6 * 'kmol/h';
     
    381357EQUATIONS
    382358
    383 switch Orientation
    384 
    385 case "vertical":
    386 
    387 "Vessel Cross Section Area"
    388         Across = 0.25*(pi*Diameter^2);
    389 
    390 switch Heads
    391 
    392 case "elliptical":
    393 
    394 "Vessel Total Volume"
    395         Vtotal = Vhead_elliptical +     Vcylinder;
    396 
    397 if Level < 0.25*Diameter then
    398 
    399 "Vessel Filled Volume"
    400         Vfilled = 0.25*pi*(((Diameter*Level)/(0.25*Diameter))^2)*(0.25*Diameter-Level/3);
    401 
    402 else
    403 
    404 "Vessel Filled Volume"
    405         Vfilled = 0.25*pi*(Diameter^2)*(Level - 0.25*Diameter/3);
    406 
    407 end
    408 
    409 case "hemispherical":
    410 
    411 "Vessel Total Volume"
    412         Vtotal = Vhead_hemispherical + Vcylinder;
    413 
    414 if Level < 0.5*Diameter then
    415 
    416 "Vessel Filled Volume"
    417         Vfilled = 0.25*pi*(Level^2)*(2*Diameter-4*Level/3);
    418 
    419 else
    420 
    421 "Vessel Filled Volume"
    422         Vfilled = 0.25*pi*((2/3)*((0.5*Diameter)^3) - (0.25*(Diameter)^3) + Level*Diameter^2);
    423 
    424 end
    425 
    426 end
    427 
    428 case "horizontal":
    429 
    430 "Vessel Cross Section Area"
    431         Across = (radius^2)*acos((radius-Level)/radius)-(radius-Level)*sqrt((2*radius*Level-Level^2));
    432 
    433 switch Heads
    434 
    435 case "elliptical":
    436 
    437 "Vessel Total Volume"
    438         Vtotal = Vhead_elliptical +     Vcylinder;
    439 
    440 "Vessel Filled Volume"
    441         Vfilled = 0.5236*Level^2*(1.5*Diameter-Level) + Across*Lenght;
    442 
    443 case "hemispherical":
    444 
    445 "Vessel Total Volume"
    446         Vtotal = Vhead_hemispherical + Vcylinder;
    447 
    448 "Vessel Filled Volume"
    449         Vfilled = 1.0472*Level^2*(1.5*Diameter-Level) + Across*Lenght;
    450 
    451 end
    452 
    453 end
    454 
    455359switch VapourFlow
    456360
     
    477381       
    478382"Energy Holdup"
    479         E = ML*OutletLiquid.h + MV*OutletVapour.h - OutletVapour.P*Vtotal;
     383        E = ML*OutletLiquid.h + MV*OutletVapour.h - OutletVapour.P*Geometry.Vtotal;
    480384       
    481385"Mol fraction normalisation"
     
    508412
    509413"Geometry Constraint"
    510         Vtotal = ML*vL + MV*vV;
     414        Geometry.Vtotal = ML*vL + MV*vV;
    511415
    512416"Liquid Level"
    513         ML * vL = Vfilled;
     417        ML * vL = Geometry.Vfilled;
    514418
    515419"Temperature indicator"
     
    520424
    521425"Level indicator"
    522         LI*Vtotal= Vfilled;
     426        LI*Geometry.Vtotal= Geometry.Vfilled;
    523427       
    524428end
  • branches/gui/eml/stage_separators/flash.mso

    r825 r879  
    1717*--------------------------------------------------------------------*#
    1818
    19 using "streams";
     19using "tank";
    2020
    2121Model flash
     
    6161
    6262        Mw(NComp)               as molweight    (Brief="Mol Weight", Hidden=true);
    63         pi                      as positive             (Brief="Pi value", Default=3.141593,Hidden=true, Symbol="\pi");
    64         g                               as acceleration         (Brief="Gravity Acceleration",Default=9.81,Hidden=true);
    65        
    66         Orientation     as Switcher     (Valid=["vertical","horizontal"],Default="vertical");
    67         Heads                   as Switcher     (Valid=["elliptical","hemispherical","flat"],Default="flat");
    68         Diameter                as length               (Brief="Vessel diameter", Symbol="D_{i}");
    69         Lenght                  as length               (Brief="Side length of the cylinder shell", Symbol="L_{vessel}");
    70        
    71         Vhead_elliptical                as volume               (Brief="Elliptical Head Total Volume",Hidden=true, Symbol="V_{head}^{elliptical}");
    72         Vhead_hemispherical     as volume               (Brief="Hemispherical Head Total Volume",Hidden=true, Symbol="V_{head}^{hemispherical}");
    73         Vcylinder                               as volume               (Brief="Cylinder Total Volume",Hidden=true, Symbol="V_{cylinder}");
    74         radius                                  as length               (Brief="Vessel radius",Hidden=true, Symbol="R_{cylinder}");
     63        Gconst          as acceleration (Brief="Gravity Acceleration",Default=9.81,Hidden=true);
    7564       
    7665        Levelpercent_Initial                    as positive     (Brief="Initial liquid height in Percent", Default = 0.70);
     
    8271        Mw=PP.MolecularWeight();
    8372
    84         Vhead_elliptical        = (pi*Diameter^3)/12;
    85         Vhead_hemispherical = (pi*Diameter^3)/6;
    86         Vcylinder = 0.25*(pi*Diameter^2)*Lenght;
    87         radius = 0.5*Diameter;
    88         g = 9.81 * 'm/(s^2)';
     73        Gconst  = 9.81 * 'm/(s^2)';
    8974
    9075VARIABLES
     76
     77        Geometry                as VesselVolume (Brief="Vessel Geometry", Symbol=" ");
    9178
    9279in      Inlet                   as stream                       (Brief="Feed Stream", PosX=0, PosY=0.48, Symbol="_{in}");
     
    9582in      InletQ                  as power                        (Brief="Heat Duty", PosX=1, PosY=0.81, Protected =true,Symbol="Q_{in}");
    9683
    97         Vtotal                  as volume                       (Brief="Vessel total volume",Protected=true, Symbol="V_{total}");
    98         Vfilled                 as volume                       (Brief="Vessel volume content",Protected=true, Symbol="V_{filled}");
    99 
    10084        TotalHoldup(NComp)              as mol  (Brief="Molar Holdup in the Vessel", Protected=true);
    10185        LiquidHoldup                    as mol  (Brief="Molar liquid holdup", Protected=true);
     
    10589        vL                      as volume_mol   (Brief="Liquid Molar Volume", Protected=true);
    10690        vV                      as volume_mol   (Brief="Vapour Molar volume", Protected=true);
    107         Level           as length               (Brief="liquid height", Protected=true);
    108         Across          as area                 (Brief="Vessel cylinder shell Cross section area", Hidden=true, Symbol="A_{cross}");
    10991        vfrac           as positive     (Brief="Vapourization fraction", Symbol="\phi", Protected=true);
    11092        Pratio          as positive             (Brief = "Pressure Ratio", Symbol ="P_{ratio}", Protected=true);       
     
    131113EQUATIONS
    132114
    133 switch Orientation
    134 
    135 case "vertical":
    136 
    137 "Vessel Cross Section Area"
    138         Across = 0.25*(pi*Diameter^2);
    139 
    140 switch Heads
    141 
    142 case "elliptical":
    143 
    144 "Vessel Total Volume"
    145         Vtotal = Vhead_elliptical +     Vcylinder;
    146 
    147 if Level < 0.25*Diameter then
    148 
    149 "Vessel Filled Volume"
    150         Vfilled = 0.25*pi*(((Diameter*Level)/(0.25*Diameter))^2)*(0.25*Diameter-Level/3);
    151 
    152 else
    153 
    154 "Vessel Filled Volume"
    155         Vfilled = 0.25*pi*(Diameter^2)*(Level - 0.25*Diameter/3);
    156 
    157 end
    158 
    159 case "hemispherical":
    160 
    161 "Vessel Total Volume"
    162         Vtotal = Vhead_hemispherical + Vcylinder;
    163 
    164 if Level < 0.5*Diameter then
    165 
    166 "Vessel Filled Volume"
    167         Vfilled = 0.25*pi*(Level^2)*(2*Diameter-4*Level/3);
    168 
    169 else
    170 
    171 "Vessel Filled Volume"
    172         Vfilled = 0.25*pi*((2/3)*((0.5*Diameter)^3) - (0.25*(Diameter)^3) + Level*Diameter^2);
    173 
    174 end
    175 
    176 case "flat":
    177 
    178 "Vessel Total Volume"
    179         Vtotal = Vcylinder;
    180 
    181 "Vessel Filled Volume"
    182         Vfilled = Across*Level;
    183 
    184 end
    185 
    186 case "horizontal":
    187 
    188 "Vessel Cross Section Area"
    189         Across = (radius^2)*acos((radius-Level)/radius)-(radius-Level)*sqrt((2*radius*Level-Level^2));
    190 
    191 switch Heads
    192 
    193 case "elliptical":
    194 
    195 "Vessel Total Volume"
    196         Vtotal = Vhead_elliptical +     Vcylinder;
    197 
    198 "Vessel Filled Volume"
    199         Vfilled = 0.5236*Level^2*(1.5*Diameter-Level) + Across*Lenght;
    200 
    201 case "hemispherical":
    202 
    203 "Vessel Total Volume"
    204         Vtotal = Vhead_hemispherical + Vcylinder;
    205 
    206 "Vessel Filled Volume"
    207         Vfilled = 1.0472*Level^2*(1.5*Diameter-Level) + Across*Lenght;
    208 
    209 case "flat":
    210 
    211 "Vessel Total Volume"
    212         Vtotal = Vcylinder;
    213 
    214 "Vessel Filled Volume"
    215         Vfilled = Across*Lenght;
    216 
    217 end
    218 
    219 end
    220 
    221115"Component Molar Balance"
    222116        diff(TotalHoldup)=Inlet.F*Inlet.z - OutletLiquid.F*OutletLiquid.z - OutletVapour.F*OutletVapour.z;
     
    229123       
    230124"Energy Holdup"
    231         E = LiquidHoldup*OutletLiquid.h + VapourHoldup*OutletVapour.h - OutletLiquid.P*Vtotal;
     125        E = LiquidHoldup*OutletLiquid.h + VapourHoldup*OutletVapour.h - OutletLiquid.P*Geometry.Vtotal;
    232126       
    233127"Mol fraction normalisation"
     
    257151       
    258152"Static Head"   
    259         Pstatic = PP.LiquidDensity(OutletLiquid.T, Peq, OutletLiquid.z) * g * Level;
     153        Pstatic = PP.LiquidDensity(OutletLiquid.T, Peq, OutletLiquid.z) * Gconst * Geometry.Level;
    260154
    261155"Mechanical Equilibrium for the Liquid Phase"
     
    269163
    270164"Geometry Constraint"
    271         Vtotal = LiquidHoldup * vL + VapourHoldup * vV;
     165        Geometry.Vtotal = LiquidHoldup * vL + VapourHoldup * vV;
    272166
    273167"Temperature indicator"
     
    278172
    279173"Level indicator"
    280         LI*Vtotal= Vfilled;
     174        LI*Geometry.Vtotal= Geometry.Vfilled;
    281175
    282176"Liquid Level"
    283         LiquidHoldup * vL = Vfilled;
     177        LiquidHoldup * vL = Geometry.Vfilled;
    284178
    285179end
  • branches/gui/eml/stage_separators/reboiler.mso

    r869 r879  
    1818*--------------------------------------------------------------------*#
    1919
    20 using "streams";
     20using "tank";
    2121
    2222Model thermosyphon
     
    373373        outer NComp     as Integer      (Brief="Number of Components");
    374374       
    375         pi                      as positive             (Brief="Pi value", Default=3.141593,Hidden=true, Symbol="\pi");
    376         g                               as acceleration (Brief="Gravity Acceleration",Default=9.81,Hidden=true);
    377        
    378         Orientation     as Switcher (Valid=["vertical","horizontal"],Default="vertical");
    379         Heads                   as Switcher (Valid=["elliptical","hemispherical"],Default="elliptical");
    380 
    381         Diameter                as length       (Brief="Vessel diameter", Symbol="D_{i}");
    382         Lenght                  as length       (Brief="Side length of the cylinder shell", Symbol="L_{vessel}");
    383        
    384         Vhead_elliptical                as volume       (Brief="Elliptical Head Total Volume",Hidden=true, Symbol="V_{head}^{elliptical}");
    385         Vhead_hemispherical     as volume       (Brief="Hemispherical Head Total Volume",Hidden=true, Symbol="V_{head}^{hemispherical}");
    386         Vcylinder                               as volume       (Brief="Cylinder Total Volume",Hidden=true, Symbol="V_{cylinder}");
    387         radius                                  as length       (Brief="Vessel radius",Hidden=true, Symbol="R_{cylinder}");
    388        
    389375        Levelpercent_Initial            as positive     (Brief="Initial liquid height in Percent", Default = 0.70);
    390376        Initial_Temperature                     as temperature  (Brief="Initial Temperature of Reboiler");
    391377        Initial_Composition(NComp)      as positive     (Brief="Initial Liquid Composition",Lower=1E-6);
    392378
    393 SET
    394         pi = 3.141593;
    395         g = 9.81 * 'm/(s^2)';
    396         Vhead_elliptical        = (pi*Diameter^3)/12;
    397         Vhead_hemispherical = (pi*Diameter^3)/6;
    398         Vcylinder = 0.25*(pi*Diameter^2)*Lenght;
    399         radius = 0.5*Diameter;
    400        
    401379VARIABLES
     380
     381        Geometry                as VesselVolume (Brief="Vessel Geometry", Symbol=" ");
    402382
    403383in      InletLiquid     as stream                       (Brief="Liquid inlet stream", PosX=0.17, PosY=1, Symbol="_{in}^{Liquid}");
     
    417397        vV                      as volume_mol   (Brief="Vapour Molar volume", Protected = true);
    418398        rhoV            as dens_mass    (Brief="Vapour Density", Protected = true, Symbol="\rho");
    419         Level           as length               (Brief="Level of liquid phase", Protected = true);
    420399        Pdrop           as press_delta  (Brief = "Pressure Drop", DisplayUnit = 'kPa', Symbol ="\Delta P", Protected=true);
    421400
    422         Vtotal                  as volume                       (Brief="Vessel total volume",Protected=true, Symbol="V_{total}");
    423         Vfilled                 as volume                       (Brief="Vessel volume content",Protected=true, Symbol="V_{filled}");
    424         Across                  as area         (Brief="Cross Section Area of reboiler",Protected=true);
    425 
    426        
    427401INITIAL
    428402
     
    438412EQUATIONS
    439413
    440 switch Orientation
    441 
    442 case "vertical":
    443 
    444 "Vessel Cross Section Area"
    445         Across = 0.25*(pi*Diameter^2);
    446 
    447 switch Heads
    448 
    449 case "elliptical":
    450 
    451 "Vessel Total Volume"
    452         Vtotal = Vhead_elliptical +     Vcylinder;
    453 
    454 if Level < 0.25*Diameter then
    455 
    456 "Vessel Filled Volume"
    457         Vfilled = 0.25*pi*(((Diameter*Level)/(0.25*Diameter))^2)*(0.25*Diameter-Level/3);
    458 
    459 else
    460 
    461 "Vessel Filled Volume"
    462         Vfilled = 0.25*pi*(Diameter^2)*(Level - 0.25*Diameter/3);
    463 
    464 end
    465 
    466 case "hemispherical":
    467 
    468 "Vessel Total Volume"
    469         Vtotal = Vhead_hemispherical + Vcylinder;
    470 
    471 if Level < 0.5*Diameter then
    472 
    473 "Vessel Filled Volume"
    474         Vfilled = 0.25*pi*(Level^2)*(2*Diameter-4*Level/3);
    475 
    476 else
    477 
    478 "Vessel Filled Volume"
    479         Vfilled = 0.25*pi*((2/3)*((0.5*Diameter)^3) - (0.25*(Diameter)^3) + Level*Diameter^2);
    480 
    481 end
    482 
    483 end
    484 
    485 case "horizontal":
    486 
    487 "Vessel Cross Section Area"
    488         Across = (radius^2)*acos((radius-Level)/radius)-(radius-Level)*sqrt((2*radius*Level-Level^2));
    489 
    490 switch Heads
    491 
    492 case "elliptical":
    493 
    494 "Vessel Total Volume"
    495         Vtotal = Vhead_elliptical +     Vcylinder;
    496 
    497 "Vessel Filled Volume"
    498         Vfilled = 0.5236*Level^2*(1.5*Diameter-Level) + Across*Lenght;
    499 
    500 case "hemispherical":
    501 
    502 "Vessel Total Volume"
    503         Vtotal = Vhead_hemispherical + Vcylinder;
    504 
    505 "Vessel Filled Volume"
    506         Vfilled = 1.0472*Level^2*(1.5*Diameter-Level) + Across*Lenght;
    507 
    508 end
    509 
    510 end
    511 
    512414"Component Molar Balance"
    513415        diff(M)= InletLiquid.F*InletLiquid.z    - OutletLiquid.F*OutletLiquid.z - OutletVapour.F*OutletVapour.z;
     
    520422
    521423"Energy Holdup"
    522         E = ML*OutletLiquid.h + MV*OutletVapour.h - OutletLiquid.P*Vtotal;
     424        E = ML*OutletLiquid.h + MV*OutletVapour.h - OutletLiquid.P*Geometry.Vtotal;
    523425
    524426"Mol Fraction Normalisation"
     
    550452
    551453"Geometry Constraint"
    552         Vtotal = ML*vL + MV*vV;
     454        Geometry.Vtotal = ML*vL + MV*vV;
    553455
    554456"Liquid Level"
    555         ML * vL = Vfilled;
     457        ML * vL = Geometry.Vfilled;
    556458
    557459"Temperature Indicator"
     
    562464
    563465"Level indicator"
    564         LI*Vtotal= Vfilled;
     466        LI*Geometry.Vtotal= Geometry.Vfilled;
    565467
    566468end
  • branches/gui/eml/stage_separators/tank.mso

    r834 r879  
    1919using "streams";
    2020
     21Model VesselVolume
     22
     23ATTRIBUTES
     24        Pallete         = false;
     25        Brief           = "Model to calculate vessel total volume and vessel filled volume from
     26different geometries and orientations.";
     27        Info            =
     28"== SET ==
     29*Orientation: vessel position - vertical or horizontal;
     30*Heads (bottom and top heads are identical)
     31**elliptical: 2:1 elliptical heads (25% of vessel diameter);
     32**hemispherical: hemispherical heads (50% of vessel diameter);
     33**flat: flat heads (0% of vessel diameter);
     34*Diameter: Vessel diameter;
     35*Lenght: Side length of the cylinder shell;
     36";
     37       
     38PARAMETERS
     39        PI                      as positive             (Brief="Pi value", Default=3.141593,Hidden=true, Symbol="\pi");
     40        Gconst                  as acceleration (Brief="Gravity Acceleration",Default=9.81,Hidden=true);
     41
     42        Orientation     as Switcher     (Valid=["vertical","horizontal"],Default="vertical");
     43        Heads                   as Switcher     (Valid=["elliptical","hemispherical","flat"],Default="flat");
     44        Diameter                as length               (Brief="Vessel diameter", Default= 2, Symbol="D_{i}");
     45        Lenght                  as length               (Brief="Side length of the cylinder shell", Default= 6,  Symbol="L_{vessel}");
     46       
     47        Vhead_elliptical                as volume               (Brief="Elliptical Head Total Volume",Hidden=true, Symbol="V_{head}^{elliptical}");
     48        Vhead_hemispherical     as volume               (Brief="Hemispherical Head Total Volume",Hidden=true, Symbol="V_{head}^{hemispherical}");
     49        Vcylinder                               as volume               (Brief="Cylinder Total Volume",Hidden=true, Symbol="V_{cylinder}");
     50        radius                                  as length               (Brief="Vessel radius",Hidden=true, Symbol="R_{cylinder}");
     51
     52SET
     53
     54        Gconst = 9.81 * 'm/(s^2)';
     55        Vhead_elliptical        = (PI*Diameter^3)/12;
     56        Vhead_hemispherical = (PI*Diameter^3)/6;
     57        Vcylinder = 0.25*(PI*Diameter^2)*Lenght;
     58        radius = 0.5*Diameter;
     59       
     60VARIABLES
     61
     62        Vtotal          as volume               (Brief="Vessel total volume",Protected=true, Symbol="V_{total}");
     63        Vfilled         as volume               (Brief="Vessel volume content",Protected=true, Symbol="V_{filled}");
     64        Level           as length               (Brief="liquid height", Protected=true);
     65        Across          as area                 (Brief="Vessel cylinder shell Cross section area", Hidden=true, Symbol="A_{cross}");
     66       
     67EQUATIONS
     68
     69switch Orientation
     70
     71case "vertical":
     72
     73"Vessel Cross Section Area"
     74        Across = 0.25*(PI*Diameter^2);
     75
     76switch Heads
     77
     78case "elliptical":
     79
     80"Vessel Total Volume"
     81        Vtotal = Vhead_elliptical +     Vcylinder;
     82
     83if Level < 0.25*Diameter then
     84
     85"Vessel Filled Volume"
     86        Vfilled = 0.25*PI*(((Diameter*Level)/(0.25*Diameter))^2)*(0.25*Diameter-Level/3);
     87
     88else
     89
     90"Vessel Filled Volume"
     91        Vfilled = 0.25*PI*(Diameter^2)*(Level - 0.25*Diameter/3);
     92
     93end
     94
     95case "hemispherical":
     96
     97"Vessel Total Volume"
     98        Vtotal = Vhead_hemispherical + Vcylinder;
     99
     100if Level < 0.5*Diameter then
     101
     102"Vessel Filled Volume"
     103        Vfilled = 0.25*PI*(Level^2)*(2*Diameter-4*Level/3);
     104
     105else
     106
     107"Vessel Filled Volume"
     108        Vfilled = 0.25*PI*((2/3)*((0.5*Diameter)^3) - (0.25*(Diameter)^3) + Level*Diameter^2);
     109
     110end
     111
     112case "flat":
     113
     114"Vessel Total Volume"
     115        Vtotal = Vcylinder;
     116
     117"Vessel Filled Volume"
     118        Vfilled = Across*Level;
     119
     120end
     121
     122case "horizontal":
     123
     124"Vessel Cross Section Area"
     125        Across = (radius^2)*acos((radius-Level)/radius)-(radius-Level)*sqrt((2*radius*Level-Level^2));
     126
     127switch Heads
     128
     129case "elliptical":
     130
     131"Vessel Total Volume"
     132        Vtotal = Vhead_elliptical +     Vcylinder;
     133
     134"Vessel Filled Volume"
     135        Vfilled = 0.5236*Level^2*(1.5*Diameter-Level) + Across*Lenght;
     136
     137case "hemispherical":
     138
     139"Vessel Total Volume"
     140        Vtotal = Vhead_hemispherical + Vcylinder;
     141
     142"Vessel Filled Volume"
     143        Vfilled = 1.0472*Level^2*(1.5*Diameter-Level) + Across*Lenght;
     144
     145case "flat":
     146
     147"Vessel Total Volume"
     148        Vtotal = Vcylinder;
     149
     150"Vessel Filled Volume"
     151        Vfilled = Across*Lenght;
     152
     153end
     154
     155end
     156
     157end
     158
    21159Model TankVL
    22160
     
    61199
    62200        Mw(NComp)               as molweight    (Brief="Mol Weight", Hidden=true);
    63         pi                      as positive             (Brief="Pi value", Default=3.141593,Hidden=true, Symbol="\pi");
    64         g                               as acceleration (Brief="Gravity Acceleration",Default=9.81,Hidden=true);
    65 
    66        
    67         Orientation     as Switcher     (Valid=["vertical","horizontal"],Default="vertical");
    68         Heads                   as Switcher     (Valid=["elliptical","hemispherical","flat"],Default="flat");
    69         Diameter                as length               (Brief="Vessel diameter", Symbol="D_{i}");
    70         Lenght                  as length               (Brief="Side length of the cylinder shell", Symbol="L_{vessel}");
    71        
    72         Vhead_elliptical                as volume               (Brief="Elliptical Head Total Volume",Hidden=true, Symbol="V_{head}^{elliptical}");
    73         Vhead_hemispherical     as volume               (Brief="Hemispherical Head Total Volume",Hidden=true, Symbol="V_{head}^{hemispherical}");
    74         Vcylinder                               as volume               (Brief="Cylinder Total Volume",Hidden=true, Symbol="V_{cylinder}");
    75         radius                                  as length               (Brief="Vessel radius",Hidden=true, Symbol="R_{cylinder}");
    76        
     201
     202        Gconst          as acceleration (Brief="Gravity Acceleration",Default=9.81,Hidden=true);
    77203        low_flow        as flow_mol     (Brief = "Low Flow",Default = 1E-6, Hidden=true);
    78204        zero_flow       as flow_mol     (Brief = "No Flow",Default = 0, Hidden=true);
     
    89215
    90216        Mw=PP.MolecularWeight();
    91         g = 9.81 * 'm/(s^2)';
    92         Vhead_elliptical        = (pi*Diameter^3)/12;
    93         Vhead_hemispherical = (pi*Diameter^3)/6;
    94         Vcylinder = 0.25*(pi*Diameter^2)*Lenght;
    95         radius = 0.5*Diameter;
    96        
     217        Gconst = 9.81 * 'm/(s^2)';
    97218        low_flow = 1E-6 * 'kmol/h';
    98219        zero_flow = 0 * 'kmol/h';
     
    100221
    101222VARIABLES
     223
     224        Geometry                as VesselVolume (Brief="Vessel Geometry", Symbol=" ");
    102225
    103226in      Inlet                   as stream                       (Brief="Feed Stream", PosX=0.22, PosY=0, Symbol="_{in}");
     
    106229in      InletQ                  as power                        (Brief="Heat Duty", PosX=0.735, PosY=1, Protected =true,Symbol="Q_{in}");
    107230
    108         Vtotal                  as volume                       (Brief="Vessel total volume",Protected=true, Symbol="V_{total}");
    109         Vfilled                 as volume                       (Brief="Vessel volume content",Protected=true, Symbol="V_{filled}");
    110 
    111231        TotalHoldup(NComp)              as mol  (Brief="Molar Holdup in the Vessel", Protected=true);
    112232        LiquidHoldup                    as mol  (Brief="Molar liquid holdup", Protected=true);
     
    116236        vL                      as volume_mol   (Brief="Liquid Molar Volume", Protected=true);
    117237        vV                      as volume_mol   (Brief="Vapour Molar volume", Protected=true);
    118         Level           as length               (Brief="liquid height", Protected=true);
    119         Across          as area                 (Brief="Vessel cylinder shell Cross section area", Hidden=true, Symbol="A_{cross}");
    120238        Pdrop           as press_delta  (Brief = "Pressure Drop", DisplayUnit = 'kPa', Symbol ="\Delta P", Protected=true);
    121239        Peq                     as pressure             (Brief="Equilibrium pressure on the liquid surface", Protected=true, Symbol="\Delta P_{eq}");
     
    139257EQUATIONS
    140258
    141 switch Orientation
    142 
    143 case "vertical":
    144 
    145 "Vessel Cross Section Area"
    146         Across = 0.25*(pi*Diameter^2);
    147 
    148 switch Heads
    149 
    150 case "elliptical":
    151 
    152 "Vessel Total Volume"
    153         Vtotal = Vhead_elliptical +     Vcylinder;
    154 
    155 if Level < 0.25*Diameter then
    156 
    157 "Vessel Filled Volume"
    158         Vfilled = 0.25*pi*(((Diameter*Level)/(0.25*Diameter))^2)*(0.25*Diameter-Level/3);
    159 
    160 else
    161 
    162 "Vessel Filled Volume"
    163         Vfilled = 0.25*pi*(Diameter^2)*(Level - 0.25*Diameter/3);
    164 
    165 end
    166 
    167 case "hemispherical":
    168 
    169 "Vessel Total Volume"
    170         Vtotal = Vhead_hemispherical + Vcylinder;
    171 
    172 if Level < 0.5*Diameter then
    173 
    174 "Vessel Filled Volume"
    175         Vfilled = 0.25*pi*(Level^2)*(2*Diameter-4*Level/3);
    176 
    177 else
    178 
    179 "Vessel Filled Volume"
    180         Vfilled = 0.25*pi*((2/3)*((0.5*Diameter)^3) - (0.25*(Diameter)^3) + Level*Diameter^2);
    181 
    182 end
    183 
    184 case "flat":
    185 
    186 "Vessel Total Volume"
    187         Vtotal = Vcylinder;
    188 
    189 "Vessel Filled Volume"
    190         Vfilled = Across*Level;
    191 
    192 end
    193 
    194 case "horizontal":
    195 
    196 "Vessel Cross Section Area"
    197         Across = (radius^2)*acos((radius-Level)/radius)-(radius-Level)*sqrt((2*radius*Level-Level^2));
    198 
    199 switch Heads
    200 
    201 case "elliptical":
    202 
    203 "Vessel Total Volume"
    204         Vtotal = Vhead_elliptical +     Vcylinder;
    205 
    206 "Vessel Filled Volume"
    207         Vfilled = 0.5236*Level^2*(1.5*Diameter-Level) + Across*Lenght;
    208 
    209 case "hemispherical":
    210 
    211 "Vessel Total Volume"
    212         Vtotal = Vhead_hemispherical + Vcylinder;
    213 
    214 "Vessel Filled Volume"
    215         Vfilled = 1.0472*Level^2*(1.5*Diameter-Level) + Across*Lenght;
    216 
    217 case "flat":
    218 
    219 "Vessel Total Volume"
    220         Vtotal = Vcylinder;
    221 
    222 "Vessel Filled Volume"
    223         Vfilled = Across*Lenght;
    224 
    225 end
    226 
    227 end
    228 
    229259switch NormalFlow
    230260
     
    251281       
    252282"Energy Holdup"
    253         E = LiquidHoldup*OutletLiquid.h + VapourHoldup*OutletVapour.h - OutletLiquid.P*Vtotal;
     283        E = LiquidHoldup*OutletLiquid.h + VapourHoldup*OutletVapour.h - OutletLiquid.P*Geometry.Vtotal;
    254284       
    255285"Mol fraction normalisation"
     
    276306
    277307"Static Head"   
    278         Pstatic = PP.LiquidDensity(OutletLiquid.T, Peq, OutletLiquid.z) * g * Level;
     308        Pstatic = PP.LiquidDensity(OutletLiquid.T, Peq, OutletLiquid.z) * Gconst * Geometry.Level;
    279309
    280310"Mechanical Equilibrium for the Liquid Phase"
     
    285315
    286316"Geometry Constraint"
    287         Vtotal = LiquidHoldup * vL + VapourHoldup * vV;
     317        Geometry.Vtotal = LiquidHoldup * vL + VapourHoldup * vV;
    288318
    289319"Temperature indicator"
     
    294324
    295325"Level indicator"
    296         LI*Vtotal= Vfilled;
     326        LI*Geometry.Vtotal= Geometry.Vfilled;
    297327
    298328"Liquid Level"
    299         LiquidHoldup * vL = Vfilled;
     329        LiquidHoldup * vL = Geometry.Vfilled;
    300330
    301331end
     
    341371outer NComp     as Integer      (Brief = "Number of components", Lower = 1);
    342372
    343         pi                      as positive             (Brief="Pi value", Default=3.141593,Hidden=true, Symbol="\pi");
    344         g                               as acceleration         (Brief="Gravity Acceleration",Default=9.81,Hidden=true);
    345        
    346         Orientation     as Switcher     (Valid=["vertical","horizontal"],Default="vertical");
    347         Heads                   as Switcher     (Valid=["elliptical","hemispherical","flat"],Default="flat");
    348         Diameter                as length               (Brief="Vessel diameter", Symbol="D_{i}");
    349         Lenght                  as length               (Brief="Side length of the cylinder shell", Symbol="L_{vessel}");
    350        
    351         Vhead_elliptical                as volume               (Brief="Elliptical Head Total Volume",Hidden=true, Symbol="V_{head}^{elliptical}");
    352         Vhead_hemispherical     as volume               (Brief="Hemispherical Head Total Volume",Hidden=true, Symbol="V_{head}^{hemispherical}");
    353         Vcylinder                               as volume               (Brief="Cylinder Total Volume",Hidden=true, Symbol="V_{cylinder}");
    354         radius                                  as length               (Brief="Vessel radius",Hidden=true, Symbol="R_{cylinder}");
    355        
     373        Gconst                  as acceleration (Brief="Gravity Acceleration",Default=9.81,Hidden=true);
    356374        low_flow        as flow_mol     (Brief = "Low Flow",Default = 1E-6, Hidden=true);
    357375        zero_flow       as flow_mol     (Brief = "No Flow",Default = 0, Hidden=true);
     
    368386SET
    369387
    370         Vhead_elliptical        = (pi*Diameter^3)/12;
    371         Vhead_hemispherical = (pi*Diameter^3)/6;
    372         Vcylinder = 0.25*(pi*Diameter^2)*Lenght;
    373         radius = 0.5*Diameter;
    374        
     388        Gconst = 9.81 * 'm/(s^2)';
    375389        low_flow = 1E-6 * 'kmol/h';
    376390        zero_flow = 0 * 'kmol/h';
     
    379393VARIABLES
    380394
     395        Geometry                as VesselVolume (Brief="Vessel Geometry", Symbol=" ");
     396
    381397in      Inlet                   as stream                       (Brief="Feed Stream", PosX=0.22, PosY=0, Symbol="_{in}");
    382398out     OutletLiquid    as liquid_stream        (Brief="Liquid outlet stream", PosX=0.43, PosY=1, Symbol="_{out}^{Liquid}");
    383399in      InletQ                  as power                        (Brief="Heat Duty", PosX=0.735, PosY=1, Protected =true,Symbol="Q_{in}");
    384400
    385         Vtotal                  as volume                       (Brief="Vessel total volume",Protected=true, Symbol="V_{total}");
    386         Vfilled                 as volume                       (Brief="Vessel volume content",Protected=true, Symbol="V_{filled}");
    387 
    388401        TotalHoldup(NComp)              as mol  (Brief="Molar Holdup in the Vessel", Protected=true);
    389402       
    390403        E                       as energy               (Brief="Total Energy Holdup in the Vessel", Protected=true);
    391404        vL                      as volume_mol   (Brief="Liquid Molar Volume", Protected=true);
    392         Level           as length               (Brief="liquid height", Protected=true);
    393         Across          as area                 (Brief="Vessel cylinder shell Cross section area", Hidden=true, Symbol="A_{cross}");
    394 
    395405        Pstatic         as pressure             (Brief="Static head at the bottom of the tank", Protected = true, Symbol="P_{static}^{Liquid}");
    396406
     
    412422EQUATIONS
    413423
    414 switch Orientation
    415 
    416 case "vertical":
    417 
    418 "Vessel Cross Section Area"
    419         Across = 0.25*(pi*Diameter^2);
    420 
    421 switch Heads
    422 
    423 case "elliptical":
    424 
    425 "Vessel Total Volume"
    426         Vtotal = Vhead_elliptical +     Vcylinder;
    427 
    428 if Level < 0.25*Diameter then
    429 
    430 "Vessel Filled Volume"
    431         Vfilled = 0.25*pi*(((Diameter*Level)/(0.25*Diameter))^2)*(0.25*Diameter-Level/3);
    432 
    433 else
    434 
    435 "Vessel Filled Volume"
    436         Vfilled = 0.25*pi*(Diameter^2)*(Level - 0.25*Diameter/3);
    437 
    438 end
    439 
    440 case "hemispherical":
    441 
    442 "Vessel Total Volume"
    443         Vtotal = Vhead_hemispherical + Vcylinder;
    444 
    445 if Level < 0.5*Diameter then
    446 
    447 "Vessel Filled Volume"
    448         Vfilled = 0.25*pi*(Level^2)*(2*Diameter-4*Level/3);
    449 
    450 else
    451 
    452 "Vessel Filled Volume"
    453         Vfilled = 0.25*pi*((2/3)*((0.5*Diameter)^3) - (0.25*(Diameter)^3) + Level*Diameter^2);
    454 
    455 end
    456 
    457 case "flat":
    458 
    459 "Vessel Total Volume"
    460         Vtotal = Vcylinder;
    461 
    462 "Vessel Filled Volume"
    463         Vfilled = Across*Level;
    464 
    465 end
    466 
    467 case "horizontal":
    468 
    469 "Vessel Cross Section Area"
    470         Across = (radius^2)*acos((radius-Level)/radius)-(radius-Level)*sqrt((2*radius*Level-Level^2));
    471 
    472 switch Heads
    473 
    474 case "elliptical":
    475 
    476 "Vessel Total Volume"
    477         Vtotal = Vhead_elliptical +     Vcylinder;
    478 
    479 "Vessel Filled Volume"
    480         Vfilled = 0.5236*Level^2*(1.5*Diameter-Level) + Across*Lenght;
    481 
    482 case "hemispherical":
    483 
    484 "Vessel Total Volume"
    485         Vtotal = Vhead_hemispherical + Vcylinder;
    486 
    487 "Vessel Filled Volume"
    488         Vfilled = 1.0472*Level^2*(1.5*Diameter-Level) + Across*Lenght;
    489 
    490 case "flat":
    491 
    492 "Vessel Total Volume"
    493         Vtotal = Vcylinder;
    494 
    495 "Vessel Filled Volume"
    496         Vfilled = Across*Lenght;
    497 
    498 end
    499 
    500 end
    501 
    502424#*
    503425switch NormalFlow
     
    525447
    526448"Static Head"   
    527         Pstatic = PP.LiquidDensity(OutletLiquid.T, Inlet.P, OutletLiquid.z) * g * Level;
     449        Pstatic = PP.LiquidDensity(OutletLiquid.T, Inlet.P, OutletLiquid.z) * Gconst * Geometry.Level;
    528450
    529451"Mechanical Equilibrium"
     
    537459       
    538460"Liquid Level"
    539         Vfilled = sum(TotalHoldup) * vL;
     461        Geometry.Vfilled = sum(TotalHoldup) * vL;
    540462       
    541463"Temperature indicator"
     
    546468
    547469"Level indicator"
    548         LI*Vtotal= Vfilled;
     470        LI*Geometry.Vtotal= Geometry.Vfilled;
    549471
    550472end
Note: See TracChangeset for help on using the changeset viewer.