Ignore:
Timestamp:
Jan 30, 2007, 2:05:49 PM (17 years ago)
Author:
Rafael de Pelegrini Soares
Message:

Better settings for switcher sample

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/newlanguage/sample/miscellaneous/sample_switcher.mso

    r141 r142  
    1818        flow_in as flow_mol;
    1919        flow_out as flow_mol;
    20         P as pressure(Default=3);
     20        P as pressure;
    2121        n as mol;
    2222       
     
    4040end
    4141
    42 
    43 Model BallWithSafetyValve2
    44         ATTRIBUTES
    45         Info = "A fixed volume ball with a safety valve
    46         for the pressure.";
    47        
    48     PARAMETERS
    49     ValveMode as Switcher(Valid = ["closed", "opened"], Default = "closed");
    50         R as Real(Unit="J/(K*mol)", Default=8.314472);
    51         V as volume;
    52         T as temperature;
    53         Pout as pressure;
    54         k as Real(Default=1e-4);
    55 
    56         VARIABLES
    57         flow_in as flow_mol;
    58         flow_out as flow_mol;
    59         P as pressure(Default=3);
    60         n as mol;
    61        
    62     EQUATIONS
    63 
    64         "Ideal gas relation"
    65         P*V = n*R*T;
    66        
    67         "Mass balance"
    68         diff(n) = flow_in - flow_out;
    69        
    70     #switch ValveMode
    71         #case "closed":
    72         #       flow_out = 0 * "mol/h";
    73         #       when P > 2*"atm" switchto "opened";
    74 
    75         #case "opened":
    76                 flow_out = k*sqrt(P - Pout);
    77         #       when P < Pout * 1.1 switchto "closed";
    78         #end
    79 end
    80 
    81 FlowSheet Test
     42FlowSheet BallWithSafetyValveTest
    8243        DEVICES
    8344        ball as BallWithSafetyValve;
     
    9051       
    9152        SPECIFY
    92         ball.flow_in = 0.1 * "kmol/h";
     53        ball.flow_in = 50 * "mol/h";
    9354       
    9455        INITIAL
    95         ball.P = 1 * "atm";
     56        ball.P = 1.2 * "atm";
    9657       
    9758        OPTIONS
Note: See TracChangeset for help on using the changeset viewer.