summaryrefslogtreecommitdiffstats
path: root/Sun.h
diff options
context:
space:
mode:
authorConstantin Riß <constantin.riss@dre.de>2010-01-31 20:21:17 +0100
committerConstantin Riß <constantin.riss@dre.de>2010-01-31 20:21:17 +0100
commit932a190de286e50797f474aacd0f207e87d29da1 (patch)
tree994dae627d1a7649e69c4ec2d033c1b3a283ad4f /Sun.h
parentfd3c8843d0acc1d27a9bcaea475ea864508fb64d (diff)
downloadc3d-932a190de286e50797f474aacd0f207e87d29da1.tar
c3d-932a190de286e50797f474aacd0f207e87d29da1.zip
Kollektor bearbeitet...
Diffstat (limited to 'Sun.h')
-rw-r--r--Sun.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/Sun.h b/Sun.h
index e2191c9..9e6f144 100644
--- a/Sun.h
+++ b/Sun.h
@@ -7,10 +7,13 @@ class Sun
{
public:
Sun(float latitude0): latitude(latitude0){};
+ Sun(){};
+
+ void setlatitude(float latitude0){latitude=latitude0;};
float declination(int day) {return 23.4*sin(2*M_PI*(284+day)/365);}
- float hourangle(float time) {return 15*(time-12);}
- float evelationangle(int day, float time) {
+ float hourangle(int time) {return 15*(time-12);}
+ float elevationangle(int day, int time) {
return asin(sin(declination(day)*M_PI/180)*
sin(latitude*M_PI/180)*
cos(hourangle(time)*M_PI/180)*
@@ -18,15 +21,15 @@ class Sun
cos(latitude*M_PI/180))
*180/M_PI;
}
- float azimutangle(int day, float time){
+ float azimutangle(int day, int time){
float tau, sin_tau, cos_tau, sin_phi, cos_phi, tan_dec;
+ tan_dec = tan(declination(day)*M_PI/180);
tau = hourangle(time)*M_PI/180;
sin_tau = sin(tau);
cos_tau = cos(tau);
sin_phi = sin(latitude*M_PI/180);
cos_phi = cos(latitude*M_PI/180);
- tan_dec = tan(declination(day)*M_PI/180);
return atan2(sin_tau, cos_tau*sin_phi-tan_dec*cos_phi)/180*M_PI;
}