1 |
REQUIRE "steam/iapwssatprops.a4c"; |
2 |
|
3 |
MODEL iapwssat REFINES iapwssatprops; |
4 |
x IS_A fraction; (* ensures we stay in the required region *) |
5 |
h IS_A specific_enthalpy; |
6 |
u IS_A specific_energy; |
7 |
v IS_A specific_volume; |
8 |
|
9 |
h_expr: h = (h_g - h_f) * x + h_f; |
10 |
u_expr: u = (u_g - u_f) * x + u_f; |
11 |
v_expr: v * ( rho_f * rho_g ) = (rho_g + (rho_f - rho_g)*x ); |
12 |
METHODS |
13 |
METHOD default_self; |
14 |
x := 0.5; |
15 |
h := 2800 {kJ/kg}; |
16 |
u := 2300 {kJ/kg}; |
17 |
v := 100 {m^3/kg}; |
18 |
v.nominal := 0.01 {m^3/kg}; |
19 |
RUN iapwssatprops::default_self; |
20 |
END default_self; |
21 |
METHOD bound_self; |
22 |
T.lower_bound := 273 {K}; |
23 |
END bound_self; |
24 |
METHOD specify; |
25 |
FIX x; |
26 |
RUN iapwssatprops::specify; |
27 |
END specify; |
28 |
METHOD values; |
29 |
x := 0.5; |
30 |
RUN iapwssatprops::values; |
31 |
END values; |
32 |
METHOD on_load; |
33 |
RUN default_self; |
34 |
RUN reset; RUN values; |
35 |
RUN bound_self; |
36 |
END on_load; |
37 |
END iapwssat; |
38 |
|
39 |
(* |
40 |
not sure what to do with this test case. We are trying to show that |
41 |
illegal values of quality 'x' will fix themselves up somehow. |
42 |
*) |
43 |
MODEL testiapwssat1 REFINES iapwssat; |
44 |
METHODS |
45 |
METHOD values; |
46 |
RUN iapwssatprops::values; |
47 |
x := 1.01; |
48 |
x.upper_bound := 1.0; |
49 |
x.lower_bound := 0.0; |
50 |
END values; |
51 |
METHOD self_test; |
52 |
ASSERT x <= x.upper_bound; |
53 |
ASSERT x >= x.lower_bound; |
54 |
END self_test; |
55 |
END testiapwssat1; |
56 |
|
57 |
(* |
58 |
test our ability to converge steam properties using the above when |
59 |
(u,v) are fixed. |
60 |
*) |
61 |
MODEL testiapwssatuv REFINES iapwssat; |
62 |
METHODS |
63 |
METHOD specify; |
64 |
FIX u,v; |
65 |
END specify; |
66 |
METHOD values; |
67 |
v := 1.0 / (500 {kg/m^3}); |
68 |
u := 780 {kJ/kg}; |
69 |
END values; |
70 |
METHOD self_test; |
71 |
ASSERT abs(p - 10.540441 {bar}) < 0.000002 {bar}; |
72 |
ASSERT abs(T - (273.15{K} + 182.177917{K})) < 0.000001 {K}; |
73 |
ASSERT abs(x - 0.004734) < 0.000001; |
74 |
END self_test; |
75 |
METHOD values2; |
76 |
v := 1.0 / (450 {kg/m^3}); |
77 |
u := 780 {kJ/kg}; |
78 |
END values2; |
79 |
METHOD self_test2; |
80 |
ASSERT abs(p - 10.426431 {bar}) < 0.000002 {bar}; |
81 |
ASSERT abs(T - (273.15{K} + 181.700586{K})) < 0.000001 {K}; |
82 |
ASSERT abs(x - 0.005885) < 0.000001; |
83 |
END self_test2; |
84 |
|
85 |
END testiapwssatuv; |