Ignore:
Timestamp:
Aug 14, 2007, 2:46:50 PM (16 years ago)
Author:
gerson bicca
Message:

testing a new streamTherm

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/tests/eml/streams.mso

    r325 r339  
    3535
    3636        VARIABLES
    37         F as flow_mol;
    38         T as temperature;
    39         P as pressure;
     37        F as flow_mol(Brief = "Molar Flow");
     38        T as temperature(Brief = "Temperature");
     39        P as pressure(Brief = "Pressure");
    4040        z(NComp) as fraction(Brief = "Overall Molar Fraction");
    41         h as enth_mol;
     41        h as enth_mol(Brief = "Molar Enthalpy");
    4242        v as fraction(Brief = "Vapourization fraction");
     43end
     44
     45Model streamTherm as stream
     46        ATTRIBUTES
     47        Pallete = false;
     48        Brief = "General Material Stream";
     49        Info =
     50        "comments.";
     51       
     52        PARAMETERS
     53        outer NComp as Integer (Brief = "Number of chemical components", Lower = 1);
     54
     55        VARIABLES
     56        x(NComp) as fraction(Brief = "Liquid Molar Fraction");
     57        y(NComp) as fraction(Brief = "Vapour Molar Fraction");
     58
    4359end
    4460
     
    6076        "Liquid stream"
    6177        v = 0;
     78
    6279end
    6380
     
    7996        "Vapour stream"
    8097        v = 1;
    81 end
    82 
    83 Model streamPH as stream
     98
     99end
     100
     101Model streamPH as streamTherm
    84102        ATTRIBUTES
    85103        Brief = "Stream with built-in flash calculation";
     
    99117        PARAMETERS
    100118        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
    101        
    102         VARIABLES
    103         x(NComp) as fraction(Brief = "Liquid Molar Fraction");
    104         y(NComp) as fraction(Brief = "Vapour Molar Fraction");
    105119       
    106120        EQUATIONS
     
    150164
    151165        VARIABLES
    152         out Outlet                      as stream                       (Brief = "Outlet stream", PosX=1, PosY=0.5256);
    153         x(NComp)                        as fraction                     (Brief = "Liquid Molar Fraction");
    154         y(NComp)                        as fraction                     (Brief = "Vapour Molar Fraction");
     166        out Outlet                      as streamTherm                  (Brief = "Outlet stream", PosX=1, PosY=0.5256);
    155167        hl                                      as enth_mol;
    156168        hv                                      as enth_mol;
     
    165177        EQUATIONS
    166178        "Flash Calculation"
    167         [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z);
     179        [Outlet.v, Outlet.x, Outlet.y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z);
    168180       
    169181        "Overall Enthalpy"
    170         Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, x) +
    171                 Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, y);
    172        
    173         hl = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x);
    174         hv = PP.VapourEnthalpy(Outlet.T, Outlet.P, y);
     182        Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, Outlet.x) +
     183                Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, Outlet.y);
     184       
     185        hl = PP.LiquidEnthalpy(Outlet.T, Outlet.P, Outlet.x);
     186        hv = PP.VapourEnthalpy(Outlet.T, Outlet.P, Outlet.y);
    175187       
    176188        "Average Molecular Weight"
     
    184196                case "correlation":
    185197        "Mass Density"
    186                 rho*((1-Outlet.v)/PP.LiquidDensity(Outlet.T,Outlet.P,x) + Outlet.v/PP.VapourDensity(Outlet.T,Outlet.P,y)) = 1;
     198                rho*((1-Outlet.v)/PP.LiquidDensity(Outlet.T,Outlet.P,Outlet.x) + Outlet.v/PP.VapourDensity(Outlet.T,Outlet.P,Outlet.y)) = 1;
    187199        end
    188200       
     
    194206
    195207        "Molar Volume"
    196         vm = (1-Outlet.v)*PP.LiquidVolume(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourVolume(Outlet.T,Outlet.P,y);
     208        vm = (1-Outlet.v)*PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.x) + Outlet.v*PP.VapourVolume(Outlet.T,Outlet.P,Outlet.y);
    197209       
    198210        "Volumetric Flow"
     
    226238       
    227239        VARIABLES
    228         out Outlet                      as stream               (Brief = "Outlet stream", PosX=1, PosY=0.5256);
    229         x(NComp)                        as fraction             (Brief = "Liquid Molar Fraction");
    230         y(NComp)                        as fraction             (Brief = "Vapour Molar Fraction");
     240        out Outlet                      as streamTherm          (Brief = "Outlet stream", PosX=1, PosY=0.5256);
    231241        hl                                      as enth_mol;
    232242        hv                                      as enth_mol;
     
    234244        EQUATIONS
    235245        "Flash Calculation"
    236         [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z);
     246        [Outlet.v, Outlet.x, Outlet.y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z);
    237247       
    238248        "Overall Enthalpy"
    239         Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, x) +
    240                 Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, y);
    241 
    242         hl = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x);
    243         hv = PP.VapourEnthalpy(Outlet.T, Outlet.P, y);
     249        Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, Outlet.x) +
     250                Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, Outlet.y);
     251
     252        hl = PP.LiquidEnthalpy(Outlet.T, Outlet.P, Outlet.x);
     253        hv = PP.VapourEnthalpy(Outlet.T, Outlet.P, Outlet.y);
    244254end
    245255
     
    274284       
    275285        VARIABLES
    276         in Inlet                as stream               (Brief = "Inlet Stream", PosX=0, PosY=0.5308);
    277         v                               as fraction             (Brief = "Vapourization fraction");
    278         x(NComp)                as fraction             (Brief = "Liquid Molar Fraction");
    279         y(NComp)                as fraction             (Brief = "Vapour Molar Fraction");
     286        in Inlet                as streamTherm          (Brief = "Inlet Stream", PosX=0, PosY=0.5308);
    280287        zmass(NComp)    as fraction             (Brief = "Mass Fraction");
    281288        Mw                              as molweight    (Brief = "Average Mol Weight");
     
    287294       
    288295        EQUATIONS
    289         "Flash Calculation"
    290         [v, x, y] = PP.FlashPH(Inlet.P, Inlet.h, Inlet.z);
    291        
    292296        "Average Molecular Weight"
    293297        Mw = sum(M*Inlet.z);
     
    300304                case "correlation":
    301305        "Mass Density"
    302                 rho * ((1-v)/PP.LiquidDensity(Inlet.T,Inlet.P,x) + v/PP.VapourDensity(Inlet.T,Inlet.P,y)) = 1;
     306                rho * ((1-Inlet.v)/PP.LiquidDensity(Inlet.T,Inlet.P,Inlet.x) + Inlet.v/PP.VapourDensity(Inlet.T,Inlet.P,Inlet.y)) = 1;
    303307        end
    304308       
     
    310314
    311315        "Molar Volume"
    312         vm = (1-v)*PP.LiquidVolume(Inlet.T, Inlet.P, x) + v*PP.VapourVolume(Inlet.T,Inlet.P,y);
     316        vm = (1-Inlet.v)*PP.LiquidVolume(Inlet.T, Inlet.P, Inlet.x) + Inlet.v*PP.VapourVolume(Inlet.T,Inlet.P,Inlet.y);
    313317       
    314318        "Volumetric Flow"
Note: See TracChangeset for help on using the changeset viewer.