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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 898 - (show annotations) (download) (as text)
Tue Oct 24 13:34:13 2006 UTC (15 years, 8 months ago) by johnpye
File MIME type: text/x-ascend
File size: 1717 byte(s)
Added 'solver notes' to thermalequilibrium.a4c.
Added 'setup_solver' method in listnotes.py
Added 'getLanguage' to Annotation class
Added 'paramname' to SolverParameters popup in PyGTK
Fixed up some commenting in notate.c
Turned on warning about ignored notes in ascParse.y
1 REQUIRE "ivpsystem.a4l";
2 REQUIRE "johnpye/thermo_types.a4c";
3
4 IMPORT "freesteam";
5 IMPORT "johnpye/extpy/extpy";
6 IMPORT "johnpye/listnotes";
7
8 MODEL simple_state;
9 p IS_A pressure;
10 h IS_A specific_enthalpy;
11 T IS_A temperature;
12 s IS_A specific_entropy;
13 iapws97: iapws97_Ts_ph(
14 p, h : INPUT;
15 T, s : OUTPUT
16 );
17 END simple_state;
18
19 (*
20 Enhanced version of johnpye/thermalequilibrium.a4c. This model uses
21 real steam properties from http://freesteam.sf.net/.
22
23 NOTE: set the starting step to 0.1 and the minimum step to 0.01 s, and
24 integrate from 0 to 3000 s.
25 *)
26 ADD NOTES IN thermalequilibrium2;
27 'solver' name {QRSlv}
28 'QRSlv' iterationlimit {50}
29 'QRSlv' singtol {1e-10}
30 'LSODE' minstep {0.01}
31 'LSODE' firststep {0.1}
32 'LSODE' maxstep {2000}
33 'LSODE' duration {3000}
34 END NOTES;
35
36 MODEL thermalequilibrium2;
37 S[1..2] IS_A simple_state;
38 m[1..2] IS_A mass;
39 h IS_A heat_transfer_coefficient;
40 A IS_A area;
41
42 p ALIASES S[1].p;
43 S[2].p = S[1].p;
44
45 Q IS_A energy_rate;
46 Q = h*A*(S[1].T - S[2].T); (* rate of heat transfer from 1 to 2 *)
47 m[1]*dhdt[1] = -Q;
48 m[2]*dhdt[2] = +Q;
49
50 dhdt[1..2] IS_A delta_specific_power;
51
52 t IS_A time;
53 METHODS
54 METHOD on_load;
55 FIX h, A, m[1..2], S[1..2].h, p;
56 A := 1 {m^2};
57 h := 10 {W/m^2/K};
58
59 p := 1 {bar};
60
61 m[1] := 2 {kg};
62 S[1].h := 200 {kJ/kg};
63 m[2] := 10 {kg};
64 S[2].h := 3500 {kJ/kg};
65
66 FOR i IN [1..2] DO
67 S[i].h.ode_id := i;
68 dhdt[i].ode_id := i;
69 S[i].h.ode_type := 1;
70 dhdt[i].ode_type := 2;
71 END FOR;
72
73 Q.obs_id := 2;
74 S[1].T.obs_id := 3;
75 S[2].T.obs_id := 4;
76
77 t.ode_type := -1;
78 t := 0 {s};
79
80 END on_load;
81
82 METHOD listnotes;
83 EXTERNAL listnotes(SELF);
84 END listnotes;
85
86 METHOD setup_solver;
87 EXTERNAL setup_solver(SELF);
88 END setup_solver;
89
90 END thermalequilibrium2;

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