/[ascend]/trunk/models/johnpye/surgetank.a4c
ViewVC logotype

Contents of /trunk/models/johnpye/surgetank.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 576 - (show annotations) (download) (as text)
Tue May 9 03:42:08 2006 UTC (18 years, 8 months ago) by johnpye
File MIME type: text/x-ascend
File size: 2088 byte(s)
Changed all cases of *.fixed := {TRUE,FALSE} to 'FIX' and 'FREE' statements.
1 REQUIRE "johnpye/ideal_steam.a4c";
2
3 (*
4 Here is a fixed volume of gas confined in a volume.
5 We can see that fixing the mass in the vessel then
6 heating it up will increase the pressure.
7 *)
8 MODEL gas_vessel;
9 S IS_A ideal_steam;
10 T ALIASES S.T;
11 p ALIASES S.p;
12 rho ALIASES S.rho;
13 h ALIASES S.h;
14 m_gas IS_A mass;
15 V_gas IS_A volume;
16
17 m_gas = S.rho * V_gas;
18
19 METHODS
20 METHOD default_self;
21 RUN reset; RUN values;
22 END default_self;
23 METHOD specify;
24 FIX T;
25 FIX p;
26 FREE S.rho;
27 FIX V_gas;
28 END specify;
29 METHOD values;
30 T := 298 {K};
31 p := 1 {bar};
32 V_gas := 1 {m^3};
33 END values;
34 METHOD self_test;
35 ASSERT abs(m_gas - 0.727101 {kg}) < 0.0001 {kg};
36 END self_test;
37 END gas_vessel;
38
39 (*
40 This model adds a variable volume of water at the base
41 of the tank, but makes the tank volume fixed. As a result
42 Pumping water into the tank results in higher pressure
43 for a given fixed mass of gas.
44 *)
45 MODEL vessel_with_water REFINES gas_vessel;
46 m_water IS_A mass;
47 V_water IS_A volume;
48 V_vessel IS_A volume;
49 V_water + V_gas = V_vessel;
50 rho_water IS_A mass_density;
51 m_water = rho_water * V_water; (* incompressible water *)
52 METHODS
53 METHOD default_self;
54 RUN reset; RUN values;
55 END default_self;
56 METHOD specify;
57 FIX rho_water;
58 FIX T;
59 FIX V_vessel;
60 FIX m_gas;
61 FIX m_water;
62 END specify;
63 METHOD values;
64 T := 298 {K};
65 rho_water := 1000 {kg/m^3};
66 V_vessel := 12000 {L};
67 m_gas := 7.27101 {kg};
68 m_water := 2000 {kg};
69 END values;
70 METHOD self_test;
71 ASSERT abs(p - 1 {bar}) < 10 {Pa};
72 END self_test;
73
74 END vessel_with_water;
75
76 (*
77 Surge tank: add mass in and out streams. It will be assumed that the mass
78 flow in balances the mass flow out, but there's got to be some effect
79 of pressure...
80 *)
81
82 MODEL surgetank REFINES vessel_with_water;
83 mdot_water_in IS_A mass_rate;
84 mdot_water_out IS_A mass_rate;
85
86 mdot_water_in = mdot_water_out;
87
88 METHODS
89 METHOD specify;
90 RUN vessel_with_water::specify;
91 FIX mdot_water_in;
92 END specify;
93
94 METHOD values;
95 RUN vessel_with_water::values;
96 mdot_water_in := 1.0 {kg/s};
97 END values;
98
99 METHOD default_self;
100 RUN reset; RUN values;
101 END default_self;
102
103 END surgetank;

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22