Changeset 141 for branches/newlanguage
 Timestamp:
 Jan 30, 2007, 1:55:55 PM (16 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

branches/newlanguage/sample/miscellaneous/sample_switcher.mso
r137 r141 13 13 T as temperature; 14 14 Pout as pressure; 15 k as Real ;15 k as Real(Default=1e3); 16 16 17 17 VARIABLES 18 18 flow_in as flow_mol; 19 19 flow_out as flow_mol; 20 P as pressure ;20 P as pressure(Default=3); 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 42 81 FlowSheet Test 43 82 DEVICES … … 48 87 ball.T = 300 * "K"; 49 88 ball.Pout = 1 * "atm"; 50 ball.ValveMode = " closed";89 ball.ValveMode = "opened"; 51 90 52 91 SPECIFY 53 ball.flow_in = 2 * "mol/h";92 ball.flow_in = 0.1 * "kmol/h"; 54 93 55 94 INITIAL 56 ball.P = 0.8 * "atm"; 95 ball.P = 1 * "atm"; 96 97 OPTIONS 98 TimeStep = 0.01; 99 TimeEnd = 10; 57 100 end
Note: See TracChangeset
for help on using the changeset viewer.