Changeset 142 for branches/newlanguage/sample/miscellaneous
 Timestamp:
 Jan 30, 2007, 2:05:49 PM (16 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

branches/newlanguage/sample/miscellaneous/sample_switcher.mso
r141 r142 18 18 flow_in as flow_mol; 19 19 flow_out as flow_mol; 20 P as pressure (Default=3);20 P as pressure; 21 21 n as mol; 22 22 … … 40 40 end 41 41 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=1e4); 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 42 FlowSheet BallWithSafetyValveTest 82 43 DEVICES 83 44 ball as BallWithSafetyValve; … … 90 51 91 52 SPECIFY 92 ball.flow_in = 0.1 * "kmol/h";53 ball.flow_in = 50 * "mol/h"; 93 54 94 55 INITIAL 95 ball.P = 1 * "atm";56 ball.P = 1.2 * "atm"; 96 57 97 58 OPTIONS
Note: See TracChangeset
for help on using the changeset viewer.