ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cal/cal/sun.cal
Revision: 1.1
Committed: Sat Feb 22 02:07:21 2003 UTC (21 years, 2 months ago) by greg
Branch: MAIN
CVS Tags: rad5R2, rad4R2P2, rad5R0, rad5R1, rad3R7P2, rad3R7P1, rad4R2, rad4R1, rad4R0, rad3R5, rad3R6, rad3R6P1, rad3R8, rad3R9, rad4R2P1
Log Message:
Changes and check-in for 3.5 release
Includes new source files and modifications not recorded for many years
See ray/doc/notes/ReleaseNotes for notes between 3.1 and 3.5 release

File Contents

# User Rev Content
1 greg 1.1 {*
2     * SOLAR CALCULATIONS
3     *
4     * 7/25/84
5     * 10/10/86
6     *
7     *}
8    
9     RLAT = 0.66; {* Site latitude (radians) *}
10    
11     RLON = 2.13; {* Site longitude (radians) *}
12    
13     RSM = 120 * PI/180; {* Standard meridian (radians) *}
14    
15    
16     stadj(jd) {* solar time adjustment (hours) *}
17     { jd is days into year }
18     =
19     0.170 * sin( 4*PI/373 * (jd - 80) ) -
20     0.129 * sin( 2*PI/355 * (jd - 8 ) ) +
21     12*(RSM-RLON)/PI
22     ;
23    
24    
25     sdec(jd) {* solar declination angle (radians) *}
26     { jd is days into year }
27     =
28     0.4093 * sin( 2*PI/368 * (jd - 81) )
29     ;
30    
31    
32     salt(sd, st) {* solar altitude (radians) *}
33     { sd is solar declination, st is solar time (hours) }
34     =
35     asin( sin(RLAT) * sin(sd) - cos(RLAT) * cos(sd) *
36     cos(st*PI/12) )
37     ;
38    
39    
40     sazi(sd, st) {* the solar azimuth (radians) *}
41     { sd is solar declination, st is solar time (hours) }
42     =
43     -atan2( cos(sd) * sin(st*PI/12),
44     -cos(RLAT)*sin(sd) -
45     sin(RLAT)*cos(sd)*cos(st*PI/12) )
46     ;
47    
48    
49     SAZI = sazi(SDEC, STIME) * 180/PI;
50    
51     SALT = salt(SDEC, STIME) * 180/PI;
52    
53     SDEC = sdec(JDATE);
54    
55     STIME = TIME + stadj(JDATE);
56    
57     JDATE = DAY + select(MONTH,0,31,59,90,120,151,181,212,243,273,304,334);