Changeset 321


Ignore:
Timestamp:
Jul 20, 2007, 11:30:53 AM (15 years ago)
Author:
Argimiro Resende Secchi
Message:

Fix Pallete of streams.mso and add flashPH as another model of flash for devices.

Location:
trunk
Files:
1 added
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/eml/stage_separators/flash.mso

    r310 r321  
    164164        OutletV.P = OutletL.P;
    165165end
     166
     167#*----------------------------------------------------------------------
     168* Model of a steady-state PH flash.
     169*---------------------------------------------------------------------*#
     170Model FlashPHSteady
     171        ATTRIBUTES
     172        Pallete         = true;
     173        Icon            = "icon/Flash";
     174        Brief           = "Model of a static PH flash.";
     175        Info            = "
     176        This model is for using the flashPH
     177        routine available on VRTherm.
     178
     179        Assumptions:
     180         * perfect mixing of both phases;
     181
     182        Specify:
     183         * the feed stream;
     184         * the heat duty;
     185         * the outlet pressure.
     186        ";     
     187
     188        PARAMETERS
     189outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
     190outer NComp as Integer;
     191
     192        VARIABLES
     193in      Inlet as stream (Brief="Feed Stream");
     194out     OutletL as liquid_stream (Brief="Liquid outlet stream");
     195out     OutletV as vapour_stream (Brief="Vapour outlet stream");
     196in      InletQ as energy_stream (Brief="Rate of heat supply");
     197        vfrac as fraction(Brief="Real vaporization fraction");
     198        h as enth_mol(Brief="Mixture enthalpy");
     199
     200        EQUATIONS
     201
     202        "Chemical equilibrium"
     203        [vfrac,OutletL.z,OutletV.z]=PP.FlashPH(OutletL.P,h,Inlet.z);
     204
     205        "Global Molar Balance"
     206        Inlet.F = OutletV.F + OutletL.F;
     207        OutletV.F = Inlet.F * vfrac;
     208
     209        "Energy Balance"
     210        Inlet.F*(h - Inlet.h) = InletQ.Q;
     211        Inlet.F*h = Inlet.F*(1-vfrac)*OutletL.h + Inlet.F*vfrac*OutletV.h;
     212
     213        "Thermal Equilibrium"
     214        OutletV.T = OutletL.T;
     215       
     216        "Mechanical Equilibrium"
     217        OutletV.P = OutletL.P;
     218end
     219
     220#*----------------------------------------------------------------------
     221* Another model of a steady-state PH flash.
     222* It is recommended to use [v,x,y]=PP.FlashPH(P,h,z) instead of.
     223*---------------------------------------------------------------------*#
     224Model FlashPHSteadyA
     225        ATTRIBUTES
     226        Pallete         = true;
     227        Icon            = "icon/Flash";
     228        Brief           = "Another model of a static PH flash.";
     229        Info            = "
     230        This model shows how to model a pressure enthalpy flash
     231        directly with the EMSO modeling language.
     232
     233        This model is for demonstration purposes only, the flashPH
     234        routine available on VRTherm is much more robust.
     235
     236        Assumptions:
     237         * perfect mixing of both phases;
     238
     239        Specify:
     240         * the feed stream;
     241         * the heat duty;
     242         * the outlet pressure.
     243        ";     
     244       
     245        PARAMETERS
     246outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
     247outer NComp as Integer;
     248        B as Real(Default=1000, Brief="Regularization Factor");
     249
     250        VARIABLES
     251in      Inlet as stream (Brief="Feed Stream");
     252out     OutletL as liquid_stream (Brief="Liquid outlet stream");
     253out     OutletV as vapour_stream (Brief="Vapour outlet stream");
     254in      InletQ as energy_stream (Brief="Rate of heat supply");
     255        vfrac as fraction(Brief="Real vaporization fraction");
     256        vsat as Real(Lower=-0.1, Upper=1.1, Brief="Vaporization fraction if saturated");
     257        Tsat as temperature(Lower=173, Upper=1473, Brief="Temperature if saturated");
     258        xsat(NComp) as Real(Lower=0, Upper=1, Brief="Liquid composition if saturated");
     259        ysat(NComp) as Real(Lower=0, Upper=1, Brief="Vapour composition if saturated");
     260       
     261        zero_one as fraction(Brief="Regularization Variable");
     262        one_zero as fraction(Brief="Regularization Variable");
     263
     264        EQUATIONS
     265        "Chemical equilibrium"
     266        PP.LiquidFugacityCoefficient(Tsat, OutletL.P, xsat)*xsat =
     267                PP.VapourFugacityCoefficient(Tsat, OutletV.P, ysat)*ysat;
     268
     269        "Global Molar Balance"
     270        Inlet.F = OutletV.F + OutletL.F;
     271        OutletV.F = Inlet.F * vfrac;
     272
     273        "Component Molar Balance"
     274        Inlet.F*Inlet.z = OutletL.F*xsat + OutletV.F*ysat;
     275        sum(xsat) = sum(ysat);
     276
     277        "Energy Balance if saturated"
     278        Inlet.F*Inlet.h  + InletQ.Q =
     279                Inlet.F*(1-vsat)*PP.LiquidEnthalpy(Tsat, OutletL.P, xsat) +
     280                Inlet.F*vsat*PP.VapourEnthalpy(Tsat, OutletV.P, ysat);
     281
     282        "Real Energy Balance"
     283        Inlet.F*Inlet.h  + InletQ.Q =
     284                Inlet.F*(1-vfrac)*OutletL.h + Inlet.F*vfrac*OutletV.h;
     285
     286        "Thermal Equilibrium"
     287        OutletV.T = OutletL.T;
     288       
     289        "Mechanical Equilibrium"
     290        OutletV.P = OutletL.P;
     291       
     292        # regularization functions
     293        zero_one = (1 + tanh(B * vsat))/2;
     294        one_zero = (1 - tanh(B * (vsat - 1)))/2;
     295       
     296        vfrac = zero_one * one_zero * vsat + 1 - one_zero;
     297        OutletL.z = zero_one*one_zero*xsat + (1-zero_one*one_zero)*Inlet.z;
     298        OutletV.z = zero_one*one_zero*ysat + (1-zero_one*one_zero)*Inlet.z;
     299end
  • trunk/eml/streams.mso

    r313 r321  
    114114Model source
    115115        ATTRIBUTES
     116        Pallete = true;
    116117        Icon = "icon/Source";
    117118        Brief = "Material stream source";
     
    205206Model simple_source
    206207        ATTRIBUTES
     208        Pallete = true;
    207209        Icon = "icon/Source";
    208210        Brief = "Simple material stream source";
     
    244246Model sink
    245247        ATTRIBUTES
     248        Pallete = true;
    246249        Icon = "icon/Sink";
    247250        Brief = "Material stream sink";
     
    319322Model simple_sink
    320323        ATTRIBUTES
     324        Pallete = true;
    321325        Icon = "icon/Sink";
    322326        Brief = "Simple material stream sink";
     
    345349Model energy_source
    346350        ATTRIBUTES
     351        Pallete = true;
    347352        Icon = "icon/energy_source";
    348353        Brief = "Enegry stream source";
Note: See TracChangeset for help on using the changeset viewer.