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

updated dynamic models

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.