Changeset 930 for branches/gui


Ignore:
Timestamp:
Apr 23, 2011, 8:08:41 PM (11 years ago)
Author:
Rafael de Pelegrini Soares
Message:

Added a condenser model with a built-in "reflux" variable.

File:
1 edited

Legend:

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

    r929 r930  
    427427
    428428
     429Model condenser2
     430
     431ATTRIBUTES
     432        Pallete         = true;
     433        Icon            = "icon/Condenser";
     434        Brief           = "Model of a  dynamic condenser with control.";
     435        Info            =
     436"== ASSUMPTIONS ==
     437* perfect mixing of both phases;
     438* thermodynamics equilibrium.
     439       
     440== SPECIFY ==
     441* the InletVapour stream;
     442* the outlet flows: Product.F and Reflux.F;
     443* the InletQ (the model requires an energy stream, also you can use a controller for setting the heat duty using the heat_flow model).
     444
     445== OPTIONAL ==
     446* the condenser model has three control ports
     447** TI OutletLiquid Temperature Indicator;
     448** PI OutletLiquid Pressure Indicator;
     449** LI Level Indicator of Condenser;
     450
     451== INITIAL CONDITIONS ==
     452* Initial_Temperature :  the condenser temperature (OutletLiquid.T);
     453* Levelpercent_Initial : the condenser liquid level in percent (LI);
     454* Initial_Composition : (NoComps) OutletLiquid compositions.
     455";     
     456       
     457PARAMETERS
     458        outer PP                as Plugin       (Brief = "External Physical Properties", Type="PP");
     459        outer NComp     as Integer (Brief="Number of Components");
     460       
     461        Mw(NComp)       as molweight    (Brief = "Component Mol Weight",Hidden=true);
     462        low_flow        as flow_mol     (Brief = "Low Flow",Default = 1E-6, Hidden=true);
     463        zero_flow       as flow_mol     (Brief = "No Flow",Default = 0, Hidden=true);
     464
     465        CondenserType   as Switcher     (Brief="Condenser type", Valid = ["partial", "total"], Default = "partial");
     466        VapourFlow              as Switcher     (Brief="Vapour Flow", Valid = ["on", "off"], Default = "on",Hidden=true);
     467
     468        Kfactor as positive (Brief="K factor for pressure drop", Lower = 1E-8, Default = 1E-3);
     469       
     470        Levelpercent_Initial            as positive     (Brief="Initial liquid height in Percent", Default = 0.70);
     471        Initial_Temperature                     as temperature  (Brief="Initial Temperature of Condenser");
     472        Initial_Composition(NComp)      as positive     (Brief="Initial Liquid Composition", Lower=1E-6);
     473       
     474VARIABLES
     475
     476        Geometry                as VesselVolume (Brief="Vessel Geometry", Symbol=" ");
     477
     478in      InletVapour     as stream                       (Brief="Vapour inlet stream", PosX=0.13, PosY=0, Symbol="_{in}^{Vapour}");
     479out     OutletLiquid    as liquid_stream        (Brief="Liquid outlet stream", PosX=0.35, PosY=1, Symbol="_{out}^{Liquid}");
     480        Vapour                  as vapour_stream        (Brief="Vapour outlet stream", Hidden=true, Symbol="_{out}^{Vapour}");
     481out     Product                 as stream                       (Brief="Vapour or Liquid product stream", PosX=0.54, PosY=0, Symbol="_{out}^{Vapour}");
     482in      InletQ                  as power                        (Brief="Heat supplied", Protected = true, PosX=1, PosY=0.08, Symbol="Q_{in}");
     483
     484        RefluxRatio             as positive     (Brief = "Reflux Ratio", Default=10, Lower = 0.05);
     485
     486        out     TI as control_signal    (Brief="Temperature  Indicator of Condenser", Protected = true, PosX=0.33, PosY=0);
     487        out     LI as control_signal    (Brief="Level  Indicator of Condenser", Protected = true, PosX=0.43, PosY=0);
     488        out     PI as control_signal    (Brief="Pressure  Indicator of Condenser", Protected = true, PosX=0.25, PosY=0);
     489
     490        M(NComp)        as mol                  (Brief="Molar Holdup in the tray", Protected = true);
     491        ML                      as mol                  (Brief="Molar liquid holdup", Protected = true);
     492        MV                      as mol                  (Brief="Molar vapour holdup", Protected = true);
     493        E                       as energy               (Brief="Total Energy Holdup on tray", Protected = true);
     494        vL                      as volume_mol   (Brief="Liquid Molar Volume", Protected = true);
     495        vV                      as volume_mol   (Brief="Vapour Molar volume", Protected = true);
     496        rho                     as dens_mass    (Brief ="Inlet Vapour Mass Density",Hidden=true, Symbol ="\rho");
     497        Pdrop           as press_delta  (Brief = "Pressure Drop", DisplayUnit = 'kPa', Symbol ="\Delta P", Protected=true);
     498
     499SET
     500        Mw   = PP.MolecularWeight();
     501        low_flow = 1E-6 * 'kmol/h';
     502        zero_flow = 0 * 'kmol/h';
     503       
     504INITIAL
     505
     506"Initial level Percent"
     507        LI = Levelpercent_Initial;
     508
     509"Initial Temperature"
     510        OutletLiquid.T  = Initial_Temperature;
     511
     512"Initial Composition"
     513        OutletLiquid.z(1:NComp-1) = Initial_Composition(1:NComp-1)/sum(Initial_Composition);
     514
     515EQUATIONS
     516
     517       
     518        Vapour.F = zero_flow;
     519        "Reflux ratio"
     520        RefluxRatio*Product.F = OutletLiquid.F;
     521
     522switch CondenserType
     523
     524case "partial":
     525        Product.v = Vapour.v;
     526        Product.h = Vapour.h;
     527        Product.z = Vapour.z;
     528       
     529case "total":
     530        Product.v = OutletLiquid.v;
     531        Product.h = OutletLiquid.h;
     532        Product.z = OutletLiquid.z;
     533end
     534
     535
     536switch VapourFlow
     537
     538case "on":
     539        InletVapour.F*vV = Kfactor *sqrt(Pdrop/rho)*'m^2';
     540
     541        when InletVapour.F < low_flow switchto "off";
     542
     543case "off":
     544        InletVapour.F = zero_flow;
     545
     546        when InletVapour.P > OutletLiquid.P switchto "on";
     547
     548end
     549
     550"Component Molar Balance"
     551        diff(M) = InletVapour.F*InletVapour.z - OutletLiquid.F*OutletLiquid.z- Product.F*Product.z;
     552
     553"Energy Balance"
     554        diff(E) = InletVapour.F*InletVapour.h - OutletLiquid.F*OutletLiquid.h- Product.F*Product.h + InletQ;
     555
     556"Molar Holdup"
     557        M = ML*OutletLiquid.z + MV*Vapour.z;
     558       
     559"Energy Holdup"
     560        E = ML*OutletLiquid.h + MV*Vapour.h - Vapour.P*Geometry.Vtotal;
     561       
     562"Mol fraction normalisation"
     563        sum(OutletLiquid.z)=1.0;
     564
     565"Mol fraction Constraint"
     566        sum(OutletLiquid.z)=sum(Vapour.z);
     567
     568"Liquid Volume"
     569        vL = PP.LiquidVolume(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z);
     570       
     571"Vapour Volume"
     572        vV = PP.VapourVolume(Vapour.T, Vapour.P, Vapour.z);
     573
     574"Inlet Vapour Density"
     575        rho = PP.VapourDensity(InletVapour.T, InletVapour.P, InletVapour.z);
     576       
     577"Chemical Equilibrium"
     578        PP.LiquidFugacityCoefficient(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z)*OutletLiquid.z =
     579                PP.VapourFugacityCoefficient(Vapour.T, Vapour.P, Vapour.z)*Vapour.z;
     580
     581"Thermal Equilibrium"
     582        OutletLiquid.T = Vapour.T;
     583        OutletLiquid.T = Product.T;
     584
     585"Mechanical Equilibrium"
     586        Vapour.P = OutletLiquid.P;
     587        Vapour.P = Product.P;
     588
     589"Pressure Drop"
     590        OutletLiquid.P  = InletVapour.P - Pdrop;
     591
     592"Geometry Constraint"
     593        Geometry.Vtotal = ML*vL + MV*vV;
     594
     595"Liquid Level"
     596        ML * vL = Geometry.Vfilled;
     597
     598"Temperature indicator"
     599        TI * 'K' = OutletLiquid.T;
     600
     601"Pressure indicator"
     602        PI * 'atm' = OutletLiquid.P;
     603
     604"Level indicator"
     605        LI*Geometry.Vtotal= Geometry.Vfilled;
     606       
     607end
     608
     609
    429610Model condenserSubcooled
    430611
Note: See TracChangeset for help on using the changeset viewer.