Changeset 711 for branches/gui/eml


Ignore:
Timestamp:
Feb 13, 2009, 5:33:49 PM (14 years ago)
Author:
gerson bicca
Message:

updated flash model

File:
1 edited

Legend:

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

    r584 r711  
    2020
    2121Model flash
    22         ATTRIBUTES
     22
     23ATTRIBUTES
    2324        Pallete         = true;
    2425        Icon            = "icon/Flash";
     
    3334
    3435== Initial Conditions ==
    35 * the flash initial temperature (OutletL.T);
    36 * the flash initial level (Level);
    37 * (NoComps - 1) OutletL (OR OutletV) compositions.
     36* The flash initial temperature (Temperature_Initial);
     37* The flash initial level (Levelpercent_Initial);
     38*The Outlet Liquid Composition (Composition_Initial).
    3839";
    3940       
    40         PARAMETERS
    41 outer PP as Plugin (Brief = "External Physical Properties", Type="PP");
    42 outer NComp as Integer (Brief = "Number of chemical components", Lower = 1);
    43         V as volume (Brief="Total Volume of the flash");
    44         Mw(NComp) as molweight(Protected=true);
    45         orientation as Switcher (Valid=["vertical","horizontal"],Default="vertical");
    46         diameter as length (Brief="Vessel diameter");
    47 
    48         SET
     41PARAMETERS
     42
     43outer PP                        as Plugin       (Brief = "External Physical Properties", Type="PP");
     44outer NComp     as Integer      (Brief = "Number of chemical components", Lower = 1);
     45
     46        VesselVolume    as volume               (Brief="Total Volume of the flash");
     47        Mw(NComp)               as molweight    (Hidden=true);
     48        Orientation                     as Switcher     (Valid=["vertical","horizontal"],Default="vertical");
     49        Diameter                        as length               (Brief="Vessel diameter");
     50
     51        Levelpercent_Initial                                    as positive                     (Brief="Initial liquid height in Percent", Default = 0.70);
     52        Temperature_Initial                                             as temperature  (Brief="Initial Liquid Temperature", Default = 330);
     53        Composition_Initial(NComp)              as fraction                     (Brief="Initial Composition", Default = 0.10);
     54       
     55SET
     56
    4957        Mw=PP.MolecularWeight();
    5058
    51         VARIABLES
    52 in      Inlet as stream(Brief="Feed Stream", PosX=0, PosY=0.5421, Symbol="_{in}");
    53 out     OutletL as liquid_stream(Brief="Liquid outlet stream", PosX=0.4790, PosY=1, Symbol="_{outL}");
    54 out     OutletV as vapour_stream(Brief="Vapour outlet stream", PosX=0.4877, PosY=0, Symbol="_{outV}");
    55 in      InletQ as power(Brief="Rate of heat supply", PosX=1, PosY=0.7559, Symbol="_{in}");
    56 
    57         M(NComp) as mol (Brief="Molar Holdup in the tray", Protected=true);
    58         ML as mol (Brief="Molar liquid holdup", Protected=true);
    59         MV as mol (Brief="Molar vapour holdup", Protected=true);
    60         E as energy (Brief="Total Energy Holdup on tray", Protected=true);
    61         vL as volume_mol (Brief="Liquid Molar Volume", Protected=true);
    62         vV as volume_mol (Brief="Vapour Molar volume", Protected=true);
    63         Level as length (Brief="liquid height");
    64         Across as area (Brief="Flash Cross section area", Protected=true);
    65         vfrac as positive (Brief="Vapourization fraction", Symbol="\phi");
    66         Pratio as positive      (Brief = "Pressure Ratio", Symbol ="P_{ratio}");       
    67         Pdrop as press_delta (Brief = "Pressure Drop", DisplayUnit = 'kPa', Symbol ="\Delta P");
    68 
    69 out     TI as control_signal(Brief="Temperature Indicator", PosX=1, PosY=0.2);
    70 out     PI as control_signal(Brief="Pressure Indicator", PosX=1, PosY=0.3);
    71 out     LI as control_signal(Brief="Level Indicator", PosX=1, PosY=0.4);
    72 
    73         EQUATIONS
    74         "Component Molar Balance"
    75         diff(M)=Inlet.F*Inlet.z - OutletL.F*OutletL.z - OutletV.F*OutletV.z;
    76        
    77         "Energy Balance"
    78         diff(E) = Inlet.F*Inlet.h - OutletL.F*OutletL.h - OutletV.F*OutletV.h + InletQ;
    79        
    80         "Molar Holdup"
    81         M = ML*OutletL.z + MV*OutletV.z;
    82        
    83         "Energy Holdup"
    84         E = ML*OutletL.h + MV*OutletV.h - OutletL.P*V;
    85        
    86         "Mol fraction normalisation"
    87         sum(OutletL.z)=1.0;
    88 
    89         "Mol fraction normalisation"
    90         sum(OutletL.z)=sum(OutletV.z);
    91 
    92         "Vaporization Fraction"
    93         OutletV.F = Inlet.F * vfrac;
    94 
    95         "Liquid Volume"
    96         vL = PP.LiquidVolume(OutletL.T, OutletL.P, OutletL.z);
    97 
    98         "Vapour Volume"
    99         vV = PP.VapourVolume(OutletV.T, OutletV.P, OutletV.z);
    100        
    101         "Chemical Equilibrium"
    102         PP.LiquidFugacityCoefficient(OutletL.T, OutletL.P, OutletL.z)*OutletL.z =
    103                 PP.VapourFugacityCoefficient(OutletV.T, OutletV.P, OutletV.z)*OutletV.z;
    104        
    105         "Thermal Equilibrium"
    106         OutletV.T = OutletL.T;
    107        
    108         "Mechanical Equilibrium"
    109         OutletV.P = OutletL.P;
    110 
    111         "Pressure Drop"
    112         OutletL.P  = Inlet.P - Pdrop;
    113 
    114         "Pressure Ratio"
    115         OutletL.P = Inlet.P * Pratio;
    116 
    117         "Geometry Constraint"
    118         V = ML * vL + MV * vV;
    119 
    120         "Temperature indicator"
    121         TI * 'K' = OutletL.T - 273.15*'K';
    122         "Pressure indicator"
    123         PI * 'atm' = OutletL.P;
    124         "Level indicator"
    125         LI*V = Level*Across;
    126 
    127         switch orientation
     59VARIABLES
     60
     61in              Inlet                           as stream                               (Brief="Feed Stream", PosX=0, PosY=0.5421, Symbol="_{in}");
     62out     OutletLiquid    as liquid_stream                (Brief="Liquid outlet stream", PosX=0.4790, PosY=1, Symbol="_{outL}");
     63out     OutletVapour    as vapour_stream        (Brief="Vapour outlet stream", PosX=0.4877, PosY=0, Symbol="_{outV}");
     64in              InletQ                          as power                                        (Brief="Rate of heat supply", PosX=1, PosY=0.7559, Protected =true,Symbol="_{in}");
     65
     66        TotalHoldup(NComp)              as mol  (Brief="Molar Holdup in the Vessel", Protected=true);
     67        LiquidHoldup                                            as mol  (Brief="Molar liquid holdup", Protected=true);
     68        VapourHoldup                                    as mol  (Brief="Molar vapour holdup", Protected=true);
     69       
     70        E                       as energy                       (Brief="Total Energy Holdup in the Vessel", Protected=true);
     71        vL                      as volume_mol   (Brief="Liquid Molar Volume", Protected=true);
     72        vV                      as volume_mol   (Brief="Vapour Molar volume", Protected=true);
     73        Level           as length                       (Brief="liquid height", Protected=true);
     74        Across  as area                                 (Brief="Flash Cross section area", Protected=true);
     75        vfrac           as positive                     (Brief="Vapourization fraction", Symbol="\phi", Protected=true);
     76        Pratio          as positive                     (Brief = "Pressure Ratio", Symbol ="P_{ratio}", Protected=true);       
     77        Pdrop           as press_delta  (Brief = "Pressure Drop", DisplayUnit = 'kPa', Symbol ="\Delta P", Protected=true);
     78
     79out     TI as control_signal    (Brief="Temperature Indicator", PosX=1, PosY=0.2, Protected=true);
     80out     PI as control_signal    (Brief="Pressure Indicator", PosX=1, PosY=0.3, Protected=true);
     81out     LI as control_signal    (Brief="Level Indicator", PosX=1, PosY=0.4, Protected=true);
     82
     83INITIAL
     84
     85# initial level Percent
     86        LI = Levelpercent_Initial;
     87       
     88# initial Outlet Liquid Temperature
     89        OutletLiquid.T = Temperature_Initial;
     90       
     91# initial Outlet Liquid Composition Normalized
     92        OutletLiquid.z(1:NComp - 1) = Composition_Initial(1:NComp - 1)/sum(Composition_Initial);
     93
     94EQUATIONS
     95
     96"Component Molar Balance"
     97        diff(TotalHoldup)=Inlet.F*Inlet.z - OutletLiquid.F*OutletLiquid.z - OutletVapour.F*OutletVapour.z;
     98       
     99"Energy Balance"
     100        diff(E) = Inlet.F*Inlet.h - OutletLiquid.F*OutletLiquid.h - OutletVapour.F*OutletVapour.h + InletQ;
     101       
     102"Molar Holdup"
     103        TotalHoldup = LiquidHoldup*OutletLiquid.z + VapourHoldup*OutletVapour.z;
     104       
     105"Energy Holdup"
     106        E = LiquidHoldup*OutletLiquid.h + VapourHoldup*OutletVapour.h - OutletLiquid.P*VesselVolume;
     107       
     108"Mol fraction normalisation"
     109        sum(OutletLiquid.z)=1.0;
     110
     111"Mol fraction normalisation"
     112        sum(OutletLiquid.z)=sum(OutletVapour.z);
     113
     114"Vaporization Fraction"
     115        OutletVapour.F = Inlet.F * vfrac;
     116
     117"Liquid Volume"
     118        vL = PP.LiquidVolume(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z);
     119
     120"Vapour Volume"
     121        vV = PP.VapourVolume(OutletVapour.T, OutletVapour.P, OutletVapour.z);
     122       
     123"Chemical Equilibrium"
     124        PP.LiquidFugacityCoefficient(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z)*OutletLiquid.z =
     125                PP.VapourFugacityCoefficient(OutletVapour.T, OutletVapour.P, OutletVapour.z)*OutletVapour.z;
     126       
     127"Thermal Equilibrium"
     128        OutletVapour.T = OutletLiquid.T;
     129       
     130"Mechanical Equilibrium"
     131        OutletVapour.P = OutletLiquid.P;
     132
     133"Pressure Drop"
     134        OutletLiquid.P  = Inlet.P - Pdrop;
     135
     136"Pressure Ratio"
     137        OutletLiquid.P = Inlet.P * Pratio;
     138
     139"Geometry Constraint"
     140        VesselVolume = LiquidHoldup * vL + VapourHoldup * vV;
     141
     142"Temperature indicator Celsius Degree"
     143        TI * 'K' = OutletLiquid.T - 273.15*'K';
     144
     145"Pressure indicator"
     146        PI * 'atm' = OutletLiquid.P;
     147
     148"Level indicator"
     149        LI*VesselVolume= Level*Across;
     150
     151switch Orientation
    128152        case "vertical":
    129153        "Cross Section Area"
    130                 Across = 0.5 * asin(1) * diameter^2;
     154                Across = 0.5 * asin(1) * Diameter^2;
    131155       
    132156        "Liquid Level"
    133                 ML * vL = Across * Level;
     157                LiquidHoldup * vL = Across * Level;
    134158               
    135159        case "horizontal":
    136160        "Cylindrical Side Area"
    137                 Across = 0.25*diameter^2 * (asin(1) - asin((diameter - 2*Level)/diameter)) +
    138                                 (Level - 0.5*diameter)*sqrt(Level*(diameter - Level));
     161                Across = 0.25*Diameter^2 * (asin(1) - asin((Diameter - 2*Level)/Diameter)) +
     162                                (Level - 0.5*Diameter)*sqrt(Level*(Diameter - Level));
    139163
    140164        "Liquid Level"
    141                 0.5 * asin(1) * diameter^2 * ML* vL = Across * V;
    142         end
     165                0.5 * asin(1) * Diameter^2 * LiquidHoldup* vL = Across * VesselVolume;
     166end
     167
    143168end
    144169
Note: See TracChangeset for help on using the changeset viewer.