1 |
– |
/* Copyright (c) 1989 Regents of the University of California */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* SOLAR CALCULATIONS |
6 |
|
* |
8 |
|
* |
9 |
|
*/ |
10 |
|
|
11 |
+ |
#include <math.h> |
12 |
+ |
|
13 |
|
#define PI 3.141592654 |
14 |
|
|
15 |
|
double s_latitude = 0.66; /* site latitude (radians) */ |
31 |
|
stadj(jd) /* solar time adjustment from Julian date */ |
32 |
|
int jd; |
33 |
|
{ |
35 |
– |
double sin(); |
36 |
– |
|
34 |
|
return( 0.170 * sin( (4*PI/373) * (jd - 80) ) - |
35 |
|
0.129 * sin( (2*PI/355) * (jd - 8) ) + |
36 |
|
12 * (s_meridian - s_longitude) / PI ); |
41 |
|
sdec(jd) /* solar declination angle from Julian date */ |
42 |
|
int jd; |
43 |
|
{ |
47 |
– |
double sin(); |
48 |
– |
|
44 |
|
return( 0.4093 * sin( (2*PI/368) * (jd - 81) ) ); |
45 |
|
} |
46 |
|
|
49 |
|
salt(sd, st) /* solar altitude from solar declination and solar time */ |
50 |
|
double sd, st; |
51 |
|
{ |
57 |
– |
double sin(), cos(), asin(); |
58 |
– |
|
52 |
|
return( asin( sin(s_latitude) * sin(sd) - |
53 |
|
cos(s_latitude) * cos(sd) * cos(st*(PI/12)) ) ); |
54 |
|
} |
58 |
|
sazi(sd, st) /* solar azimuth from solar declination and solar time */ |
59 |
|
double sd, st; |
60 |
|
{ |
68 |
– |
double sin(), cos(), atan2(); |
69 |
– |
|
61 |
|
return( -atan2( cos(sd)*sin(st*(PI/12)), |
62 |
|
-cos(s_latitude)*sin(sd) - |
63 |
|
sin(s_latitude)*cos(sd)*cos(st*(PI/12)) ) ); |