Ignore:
Timestamp:
Mar 6, 2007, 2:25:34 PM (16 years ago)
Author:
Rafael de Pelegrini Soares
Message:

Updated the ammonia optimization sample

Location:
branches/newlanguage/sample/optimization
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/newlanguage/sample/optimization/ammonia.mso

    r85 r185  
    3131Model Compressor
    3232        PARAMETERS
    33 ext PP as CalcObject;
    34 ext NComp as Integer;
     33outer PP as Plugin;
     34outer NComp as Integer;
    3535       
    3636        VARIABLES
    3737in      Inlet as stream;
    38 out     Outlet as stream_therm;
     38out     Outlet as streamPH;
    3939
    4040        EQUATIONS
     
    4747        "Component Molar Balance"
    4848        Inlet.z = Outlet.z;
    49        
    50         "vaporization fraction "
    51         Outlet.v = 1.0;
    5249end
    5350
     
    5552Model Mixer
    5653        PARAMETERS
    57 ext PP as CalcObject;
    58 ext NComp as Integer;
     54outer PP as Plugin;
     55outer NComp as Integer;
    5956       
    6057        VARIABLES
    6158in      Inlet1 as stream;
    6259in      Inlet2 as stream;
    63 out     Outlet as stream_therm;
     60out     Outlet as streamPH;
    6461
    6562        EQUATIONS
     
    7370        "Component Molar Balance"
    7471        Inlet1.z*Inlet1.F + Inlet2.z*Inlet2.F = Outlet.F * Outlet.z;
    75         "vaporization fraction"
    76         Outlet.v = Inlet1.v;
    7772end
    7873
     
    8075Model Reactor
    8176        PARAMETERS
    82 ext PP as CalcObject;
    83 ext NComp as Integer;
     77outer PP as Plugin;
     78outer NComp as Integer;
    8479        NReac as Integer(Default=1);
    8580        stoic(NComp, NReac) as Real (Brief = "Stoichiometric Matrix");
     
    8883        VARIABLES
    8984in      Inlet as stream;
    90 out     Outlet as stream_therm;
     85out     Outlet as streamPH;
    9186        Outletz(NComp) as fraction;
    9287        X(NReac) as fraction(Brief="Convertion of the key component");
     
    108103
    109104        Outlet.P = Inlet.P;
    110        
    111         "vaporization fraction"
    112         Outlet.v = Inlet.v;
    113105end
    114106
     
    116108FlowSheet Ammonia
    117109        PARAMETERS
    118         PP      as CalcObject(Brief="Physical Properties", File="vrpp");
     110        PP      as Plugin(Brief="Physical Properties", File="vrpp");
    119111        NComp   as Integer;
    120112        SET
     
    125117       
    126118        DEVICES
    127         FEED   as streamTP;
     119        FEED   as source;
    128120        C101   as Compressor;
    129121        R101   as Reactor;
    130         F101   as flash_Steady;
    131         F102   as flash_Steady;
     122        F101   as flash_steady;
     123        F102   as flash_steady;
    132124        S101   as splitter;
    133125        M101   as Mixer;
     
    137129        VARIABLES
    138130        purity as fraction(Brief="Purity of the product");
    139         production as flow_mol(Unit = "lbmol/h", Brief="Ammonia in the product");
    140         loose as flow_mol(Unit = "lbmol/h", Brief="Ammonia in the purge");
     131        production as flow_mol(DisplayUnit = 'lbmol/h', Brief="Ammonia in the product");
     132        loose as flow_mol(DisplayUnit = 'lbmol/h', Brief="Ammonia in the purge");
    141133        Q1 as heat_rate;
    142134        Q2 as heat_rate;
    143135
    144136        CONNECTIONS
    145         FEED           to   M101.Inlet1;
     137        FEED.Outlet    to   M101.Inlet1;
    146138        M101.Outlet    to   C101.Inlet;
    147139        C101.Outlet    to   M102.Inlet1;
     
    162154
    163155        SPECIFY
    164         FEED.F = 2000 * "lbmol/h";
    165         FEED.T = (27 + 273.15) * "K";
    166         FEED.P = 10 * "atm";
    167         FEED.z = [0.74, 0.24, 0.01, 0.01, 0.0];
     156        FEED.Outlet.F = 2000 * 'lbmol/h';
     157        FEED.Outlet.T = (27 + 273.15) * 'K';
     158        FEED.Outlet.P = 10 * 'atm';
     159        FEED.Outlet.z = [0.74, 0.24, 0.01, 0.01, 0.0];
    168160       
    169         C101.Outlet.P = 200 * "atm";
    170         C102.Outlet.P = 200 * "atm";
     161        C101.Outlet.P = 200 * 'atm';
     162        C102.Outlet.P = 200 * 'atm';
    171163       
    172164        R101.X = 0.4; # Convertion of the reactor
    173165       
    174         F101.OutletV.P = 199 * "atm";
    175         F101.OutletV.T = (-34 + 273.15) * "K";
     166        F101.OutletV.P = 199 * 'atm';
     167        F101.OutletV.T = (-34 + 273.15) * 'K';
    176168       
    177         F102.OutletV.P = 10 * "atm";
    178         F102.Q = 0 * "kJ/h";
     169        F102.OutletV.P = 10 * 'atm';
     170        F102.Q = 0 * 'kJ/h';
    179171       
    180172        # We can choose between one of the following specs
    181173        S101.frac = 0.78; # Recycle fraction
    182         #loose = 1 * "lbmol/h"; # Ammonia in the purge
     174        #loose = 1 * 'lbmol/h'; # Ammonia in the purge
    183175       
    184176        EQUATIONS
     
    188180       
    189181        OPTIONS
    190         mode = "steady";
    191         relativeAccuracy = 1e-5;
     182        Dynamic = false;
     183        RelativeAccuracy = 1e-5;
    192184end
    193185
  • branches/newlanguage/sample/optimization/ammonia_opt.mso

    r85 r185  
    4242       
    4343        OPTIONS
    44         relativeAccuracy = 1e-1;
     44        RelativeAccuracy = 1e-1;
    4545end
Note: See TracChangeset for help on using the changeset viewer.