Changeset 117 for branches/newlanguage


Ignore:
Timestamp:
Jan 15, 2007, 4:43:56 PM (17 years ago)
Author:
Rafael de Pelegrini Soares
Message:

Updated streams and flash models to the new language being proposed

Location:
branches/newlanguage
Files:
3 edited

Legend:

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

    r72 r117  
    4141Model flash
    4242        PARAMETERS
    43 ext PP as CalcObject;
    44 ext NComp as Integer;
     43        outer PP as Plugin(Brief = "External Physical Properties");
     44        outer NComp as Integer (Brief = "Number of chemical components", Lower = 1);
    4545        V as volume(Brief="Total Volume of the flash");
    4646        Mw(NComp) as molweight;
     
    5151       
    5252        VARIABLES
    53 in      Inlet as stream; #(Brief="Feed Stream");
    54 out     OutletL as stream_therm; #(Brief="Liquid outlet stream");
    55 out     OutletV as stream_therm; #(Brief="Vapour outlet stream");
    56 in      Q as heat_rate (Brief="Rate of heat supply");
     53        in      Inlet as stream(Brief="Feed Stream");
     54        out     OutletL as liquid_stream(Brief="Liquid outlet stream");
     55        out     OutletV as vapour_stream(Brief="Vapour outlet stream");
     56        in      Q as heat_rate (Brief="Rate of heat supply");
    5757
    5858        M(NComp) as mol (Brief="Molar Holdup in the tray");
     
    101101        "Liquid Level"
    102102        ML* vL = Across * Level;
    103        
    104         "vaporization fraction "
    105         OutletV.v = 1.0;
    106         "vaporization fraction "
    107         OutletL.v = 0.0;
    108 
    109103end
    110104
     
    112106* Model of a  Steady State flash
    113107*---------------------------------------------------------------------*#
    114 Model flash_Steady
     108Model flash_steady
    115109        PARAMETERS
    116 ext PP as CalcObject;
    117 ext NComp as Integer;
     110        outer PP as Plugin(Brief = "External Physical Properties");
    118111       
    119112        VARIABLES
    120 in      Inlet as stream; #(Brief="Feed Stream");
    121 out     OutletL as stream_therm; #(Brief="Liquid outlet stream");
    122 out     OutletV as stream_therm; #(Brief="Vapour outlet stream");
    123 in      Q as heat_rate (Brief="Rate of heat supply");
     113        in      Inlet as stream(Brief="Feed Stream");
     114        out     OutletL as liquid_stream(Brief="Liquid outlet stream");
     115        out     OutletV as vapour_stream(Brief="Vapour outlet stream");
     116        in      Q as heat_rate (Brief="Rate of heat supply");
    124117        vfrac as fraction;
    125118
     
    130123        "Global Molar Balance"
    131124        Inlet.F = OutletV.F + OutletL.F;
     125        "Vaporisation Fraction"
    132126        OutletV.F = Inlet.F * vfrac;
    133                
     127       
    134128        "Energy Balance"
    135129        Inlet.F*Inlet.h  + Q = OutletL.F*OutletL.h + OutletV.F*OutletV.h;
     
    140134        "Mechanical Equilibrium"
    141135        OutletV.P = OutletL.P;
    142        
    143         "vaporization fraction "
    144         OutletV.v = 1.0;
    145         "vaporization fraction "
    146         OutletL.v = 0.0;
    147136end
    148 
  • branches/newlanguage/eml/streams.mso

    r79 r117  
    2323
    2424Model stream
     25        ATTRIBUTES
     26        Pallete = false;
     27        Brief = "General Material Stream";
     28        Documentation =
     29        "This is the basic building block for the EML models.
     30        Every model should have input and output streams derived
     31        from this model.";
     32       
    2533        PARAMETERS
    26 ext     NComp as Integer (Brief = "Number of chemical components", Lower = 1);
     34        outer NComp as Integer (Brief = "Number of chemical components", Lower = 1);
    2735
    2836        VARIABLES
     
    3038        T as temperature;
    3139        P as pressure;
    32         z(NComp) as fraction (Brief = "Molar Fraction");
     40        z(NComp) as fraction(Brief = "Overall Molar Fraction");
    3341        h as enth_mol;
    34         v as fraction (Brief = "Vapourisation fraction");
     42        v as fraction(Brief = "Vapourisation fraction");
    3543end
    3644
    37 Model stream_therm as stream
     45Model liquid_stream as stream
     46        ATTRIBUTES
     47        Pallete = false;
     48        Brief = "Liquid Material Stream";
     49        Documentation =
     50        "Model for liquid material streams.
     51        This model should be used only when the phase of the stream
     52        is known ''a priori''.";
     53
    3854        PARAMETERS
    39         ext  PP   as CalcObject (Brief = "External Physical Properties");
     55        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
    4056       
    4157        EQUATIONS
    42         h = (1-v)*PP.LiquidEnthalpy(T, P, z) + v*PP.VapourEnthalpy(T, P, z);
     58        "Liquid Enthalpy"
     59        h = PP.LiquidEnthalpy(T, P, z);
     60        "Liquid stream"
     61        v = 0;
    4362end
    4463
    45 Model streamTP as stream_therm
     64Model vapour_stream as stream
     65        ATTRIBUTES
     66        Pallete = false;
     67        Brief = "Vapour Material Stream";
     68        Documentation =
     69        "Model for vapour material streams.
     70        This model should be used only when the phase of the stream
     71        is known ''a priori''.";
     72
    4673        PARAMETERS
    47         ext  PP   as CalcObject (Brief = "External Physical Properties");
     74        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
    4875       
    4976        EQUATIONS
    50         v = PP.VapourFraction(T, P, z);
     77        "Vapour Enthalpy"
     78        h = PP.VapourEnthalpy(T, P, z);
     79        "Vapour stream"
     80        v = 1;
    5181end
    5282
     83Model source
     84        ATTRIBUTES
     85        Documentation =
     86        "Material stream source.
     87        This model should be used for boundary streams.
     88        Usually these streams are known and come from another process
     89        units.";
     90
     91        PARAMETERS
     92        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
     93        outer NComp as Integer (Brief = "Number of chemical components", Lower = 1);
     94       
     95        VARIABLES
     96        out Outlet as stream;
     97        x(NComp) as fraction(Brief = "Liquid Molar Fraction");
     98        y(NComp) as fraction(Brief = "Vapour Molar Fraction");
     99       
     100        EQUATIONS
     101        "Flash Calculation"
     102        [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z);
     103        "Overall Enthalpy"
     104        Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, x) +
     105                Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, y);
     106end
     107
     108Model sink
     109        ATTRIBUTES
     110        Documentation =
     111        "Material stream sink.
     112        This model should be used for boundary streams.";
     113
     114        PARAMETERS
     115        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
     116        outer NComp as Integer (Brief = "Number of chemical components", Lower = 1);
     117       
     118        VARIABLES
     119        in Inlet as stream;
     120        v as fraction;
     121        x(NComp) as fraction(Brief = "Liquid Molar Fraction");
     122        y(NComp) as fraction(Brief = "Vapour Molar Fraction");
     123       
     124        EQUATIONS
     125        "Flash Calculation"
     126        [v, x, y] = PP.PHFlash(Inlet.P, Inlet.h, Inlet.z);
     127end
  • branches/newlanguage/sample/stage_separators/sample_flash.mso

    r86 r117  
    2828FlowSheet flash_Test
    2929        PARAMETERS
    30         PP      as CalcObject(Brief="Physical Properties",File="vrpp");
    31         NComp   as Integer;
     30        PP as Plugin(Brief="Physical Properties",File="vrpp");
     31        NComp as Integer;
    3232
    3333        VARIABLES
     
    4242        DEVICES
    4343        fl as flash;
    44         s1 as streamTP;
     44        s1 as source;
    4545       
    4646        CONNECTIONS
     
    5252       
    5353        SPECIFY
    54         s1.F = 496.3 * "kmol/h";
    55         s1.T = 338 * "K";
    56         s1.P = 507.1 * "kPa";
     54        s1.Outlet.F = 496.3 * "kmol/h";
     55        s1.Outlet.T = 338 * "K";
     56        s1.Outlet.P = 507.1 * "kPa";
    5757        #s1.v = 0.1380;
    58         s1.z = [0.2379,0.3082,0.09958,0.1373,0.08872,0.1283];
     58        s1.Outlet.z = [0.2379,0.3082,0.09958,0.1373,0.08872,0.1283];
    5959
    6060        fl.OutletV.F = 68.5 * "kmol/h";
     
    7575       
    7676        OPTIONS
    77         relativeAccuracy = 1e-7;
    78         absoluteAccuracy = 1e-9;
    79         #mode="steady";
    80         time = [0:0.1:20]*"h";
     77        RelativeAccuracy = 1e-7;
     78        AbsoluteAccuracy = 1e-9;
     79        Dynamic = true;
     80        TimeStep = 0.1;
     81        TimeEnd = 20;
     82        TimeUnit = "h";
    8183end
    8284
     
    8486FlowSheet flashSteady_Test
    8587        PARAMETERS
    86         PP      as CalcObject(Brief="Physical Properties",File="vrpp");
    87         NComp   as Integer;
     88        PP as Plugin(Brief="Physical Properties",File="vrpp");
     89        NComp as Integer;
    8890
    8991        VARIABLES
     
    9799       
    98100        DEVICES
    99         fl as flash_Steady;
    100         s1 as streamTP;
     101        fl as flash_steady;
     102        s1 as source;
    101103       
    102104        CONNECTIONS
     
    104106        Q to fl.Q;
    105107       
    106        
    107108        SPECIFY
    108         s1.F = 496.3 * "kmol/h";
    109         s1.T = 338 * "K";
    110         s1.P = 507.1 * "kPa";
    111         #s1.v = 0.1380;
    112         s1.z = [0.2379,0.3082,0.09959,0.1373,0.08872,0.1283];
     109        s1.Outlet.F = 496.3 * "kmol/h";
     110        s1.Outlet.T = 338 * "K";
     111        s1.Outlet.P = 507.1 * "kPa";
     112        #s1.Outlet.v = 0.1380;
     113        s1.Outlet.z = [0.2379,0.3082,0.09959,0.1373,0.08872,0.1283];
    113114       
    114115        fl.OutletL.P = 2.5 * "atm";
     
    118119       
    119120        OPTIONS
    120         mode = "steady";
     121        Dynamic = false;
    121122end
Note: See TracChangeset for help on using the changeset viewer.