Last change
on this file since 180 was
180,
checked in by Rafael de Pelegrini Soares, 16 years ago
|
Updated UOM for the new language
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Id
|
File size:
1.0 KB
|
Rev | Line | |
---|
[137] | 1 | |
---|
| 2 | using "types"; |
---|
| 3 | |
---|
| 4 | Model BallWithSafetyValve |
---|
| 5 | ATTRIBUTES |
---|
| 6 | Info = "A fixed volume ball with a safety valve |
---|
| 7 | for the pressure."; |
---|
| 8 | |
---|
| 9 | PARAMETERS |
---|
| 10 | ValveMode as Switcher(Valid = ["closed", "opened"], Default = "closed"); |
---|
[180] | 11 | R as Real(Unit='J/(K*mol)', Default=8.314472); |
---|
[137] | 12 | V as volume; |
---|
| 13 | T as temperature; |
---|
| 14 | Pout as pressure; |
---|
[141] | 15 | k as Real(Default=1e-3); |
---|
[137] | 16 | |
---|
| 17 | VARIABLES |
---|
| 18 | flow_in as flow_mol; |
---|
| 19 | flow_out as flow_mol; |
---|
[142] | 20 | P as pressure; |
---|
[137] | 21 | n as mol; |
---|
| 22 | |
---|
| 23 | EQUATIONS |
---|
| 24 | |
---|
| 25 | "Ideal gas relation" |
---|
| 26 | P*V = n*R*T; |
---|
| 27 | |
---|
| 28 | "Mass balance" |
---|
| 29 | diff(n) = flow_in - flow_out; |
---|
| 30 | |
---|
| 31 | switch ValveMode |
---|
| 32 | case "closed": |
---|
[180] | 33 | flow_out = 0 * 'mol/h'; |
---|
| 34 | when P > 2*'atm' switchto "opened"; |
---|
[137] | 35 | |
---|
| 36 | case "opened": |
---|
| 37 | flow_out = k*sqrt(P - Pout); |
---|
| 38 | when P < Pout * 1.1 switchto "closed"; |
---|
| 39 | end |
---|
| 40 | end |
---|
| 41 | |
---|
[142] | 42 | FlowSheet BallWithSafetyValveTest |
---|
[137] | 43 | DEVICES |
---|
| 44 | ball as BallWithSafetyValve; |
---|
| 45 | |
---|
| 46 | SET |
---|
[180] | 47 | ball.V = 1 * 'l'; |
---|
| 48 | ball.T = 300 * 'K'; |
---|
| 49 | ball.Pout = 1 * 'atm'; |
---|
[141] | 50 | ball.ValveMode = "opened"; |
---|
[137] | 51 | |
---|
| 52 | SPECIFY |
---|
[180] | 53 | ball.flow_in = 50 * 'mol/h'; |
---|
[137] | 54 | |
---|
| 55 | INITIAL |
---|
[180] | 56 | ball.P = 1.2 * 'atm'; |
---|
[141] | 57 | |
---|
| 58 | OPTIONS |
---|
[145] | 59 | TimeStep = 0.05; |
---|
[141] | 60 | TimeEnd = 10; |
---|
[137] | 61 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.