1 |
REQUIRE "johnpye/nrel/julian_day.a4c"; |
2 |
REQUIRE "atoms.a4l"; |
3 |
|
4 |
MODEL location; |
5 |
latitude IS_A angle_constant; |
6 |
longitude IS_A angle_constant; |
7 |
elevation IS_A real_constant; |
8 |
END location; |
9 |
|
10 |
MODEL sunpos_nrel; |
11 |
loc IS_A location; |
12 |
offset IS_A julian_day; |
13 |
|
14 |
t IS_A time; |
15 |
t_offset ALIASES offset.t_JD; |
16 |
|
17 |
p IS_A pressure; |
18 |
T IS_A temperature; |
19 |
|
20 |
zenith, azimuth IS_A angle; |
21 |
|
22 |
solar: sunpos_nrel( |
23 |
t, p, T, t_offset : INPUT; |
24 |
zenith, azimuth : OUTPUT; |
25 |
loc : DATA |
26 |
); |
27 |
|
28 |
altitude IS_A angle; |
29 |
altitude = 0.5{PI} - zenith; |
30 |
END sunpos_nrel; |
31 |
|
32 |
MODEL sunpos_nrel_test REFINES sunpos_nrel; |
33 |
(* greenwich *) |
34 |
loc.latitude :== 51.4778 {deg}; |
35 |
loc.longitude :== 0 {deg}; |
36 |
loc.elevation :== 215.9 {ft}; |
37 |
(*(* albuquerque *) |
38 |
loc.latitude :== +35 {deg} + 6.{deg}/60 + 39.{deg}/3600; |
39 |
loc.longitude :== -106{deg} + 36.{deg}/60 + 36.{deg}/3600; |
40 |
loc.elevation :== 1619 {m}; |
41 |
*) |
42 |
METHODS |
43 |
METHOD on_load; |
44 |
RUN offset.on_load; |
45 |
|
46 |
FIX p, T, t; |
47 |
p := 1 {atm}; |
48 |
T := 20 {K} + 273.15 {K}; |
49 |
t := 0. {d}; |
50 |
|
51 |
(* to plot the analemma with this model, use the 'Observer' to observe |
52 |
t, altitude and azimuth. Run a 'study' with t from 0 to 365 in steps of 1 |
53 |
day. Then click 'plot' and plot altitude vs azimuth. *) |
54 |
END on_load; |
55 |
END sunpos_nrel_test; |