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:eolstyle set to
native

Property svn:keywords set to
Id

File size:
1.0 KB

Line  

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"); 

11  R as Real(Unit='J/(K*mol)', Default=8.314472); 

12  V as volume; 

13  T as temperature; 

14  Pout as pressure; 

15  k as Real(Default=1e3); 

16  

17  VARIABLES 

18  flow_in as flow_mol; 

19  flow_out as flow_mol; 

20  P as pressure; 

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": 

33  flow_out = 0 * 'mol/h'; 

34  when P > 2*'atm' switchto "opened"; 

35  

36  case "opened": 

37  flow_out = k*sqrt(P  Pout); 

38  when P < Pout * 1.1 switchto "closed"; 

39  end 

40  end 

41  

42  FlowSheet BallWithSafetyValveTest 

43  DEVICES 

44  ball as BallWithSafetyValve; 

45  

46  SET 

47  ball.V = 1 * 'l'; 

48  ball.T = 300 * 'K'; 

49  ball.Pout = 1 * 'atm'; 

50  ball.ValveMode = "opened"; 

51  

52  SPECIFY 

53  ball.flow_in = 50 * 'mol/h'; 

54  

55  INITIAL 

56  ball.P = 1.2 * 'atm'; 

57  

58  OPTIONS 

59  TimeStep = 0.05; 

60  TimeEnd = 10; 

61  end 

Note: See
TracBrowser
for help on using the repository browser.