daylight  0.1.3
Sunclock.hpp
Go to the documentation of this file.
1 #ifndef DAYLIGHT_SUNCLOCK_HPP
2 #define DAYLIGHT_SUNCLOCK_HPP
3 
4 #include <ctime>
5 
6 class Sunclock {
7 public:
8  Sunclock(double const &latitude_, double const &longitude_, double const &tz_offset_ = 0);
9 
13  double irradiance();
14 
23  double irradiance(time_t when);
24 
28  time_t sunrise();
29 
36  time_t sunrise(time_t date);
37 
41  time_t solar_noon();
42 
49  time_t solar_noon(time_t date);
50 
54  time_t sunset();
55 
62  time_t sunset(time_t date);
63 
64 private:
65  // in decimal degrees, east is positive
66  double const latitude;
67 
68  // in decimal degrees, north is positive
69  double const longitude;
70 
71  // in hours, east is positive, i.e. IST (+05:30) is 5.5
72  double const tz_offset;
73 
78  double time_of_day(time_t date);
79 
80  static int days_since_1900(struct tm *t);
81 
87  static time_t time_from_decimal_day(time_t date, double decimal_day);
88 
98  static double julian_day(struct tm *t, double const &time_of_day, double const &timezone);
99 
103  void prepare_time(time_t const &when, struct tm *ptm);
104 
105  double julian_century(double _julian_day);
106  double mean_long_sun(double _julian_century);
107  double mean_anom_sun(double _julian_century);
108  double sun_eq_of_centre(double _mean_anom_sun, double _julian_century);
109  double eccent_earth_orbit(double _julian_century);
110  double var_y(double _obliq_corr);
111  double mean_obliq_ecliptic(double _julian_century);
112  double sun_true_long(double _mean_long_sun, double _sun_eq_of_centre);
113  double obliq_corr(double _mean_obliq_ecliptic, double _julian_century);
114  double sun_app_long(double _sun_true_long, double _julian_century);
115  double declination(double _obliq_corr, double _sun_app_long);
116  double eq_of_time(double _var_y, double _mean_long_sun, double _eccent_earth_orbit,
117  double _mean_anom_sun);
118  double true_solar_time(double _time_of_day, double _eq_of_time);
119  double hour_angle(double _true_solar_time);
120  double hour_angle_sunrise(double _declination);
121  double solar_zenith(double _declination, double _hour_angle);
122  double solar_elevation(double _solar_zenith);
123 };
124 
125 #endif
time_t sunrise()
Definition: Sunclock.cpp:43
time_t solar_noon()
Definition: Sunclock.cpp:69
double irradiance()
Definition: Sunclock.cpp:18
Definition: Sunclock.hpp:6
time_t sunset()
Definition: Sunclock.cpp:89
Sunclock(double const &latitude_, double const &longitude_, double const &tz_offset_=0)
Definition: Sunclock.cpp:15