File failed to load: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/extensions/ams.js
ALMaSS  1.2 (after EcoStack, March 2024)
The Animal, Landscape and Man Simulation System
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SunSet Class Reference

#include <sunset.h>

Public Member Functions

 SunSet ()
 
 SunSet (double, double, int)
 
 SunSet (double, double, double)
 
 ~SunSet ()
 
void setPosition (double, double, int)
 
void setPosition (double, double, double)
 
void setTZOffset (int)
 
void setTZOffset (double)
 
double setCurrentDate (int, int, int)
 
double calcNauticalSunrise () const
 
double calcNauticalSunset () const
 
double calcCivilSunrise () const
 
double calcCivilSunset () const
 
double calcAstronomicalSunrise () const
 
double calcAstronomicalSunset () const
 
double calcCustomSunrise (double) const
 
double calcCustomSunset (double) const
 
double calcSunriseUTC ()
 
double calcSunsetUTC ()
 
double calcSunrise () const
 
double calcSunset () const
 
int moonPhase (int) const
 
int moonPhase () const
 

Static Public Attributes

static constexpr double SUNSET_OFFICIAL = 90.833
 
static constexpr double SUNSET_NAUTICAL = 102.0
 
static constexpr double SUNSET_CIVIL = 96.0
 
static constexpr double SUNSET_ASTONOMICAL = 108.0
 

Private Member Functions

double degToRad (double) const
 
double radToDeg (double) const
 
double calcMeanObliquityOfEcliptic (double) const
 
double calcGeomMeanLongSun (double) const
 
double calcObliquityCorrection (double) const
 
double calcEccentricityEarthOrbit (double) const
 
double calcGeomMeanAnomalySun (double) const
 
double calcEquationOfTime (double) const
 
double calcTimeJulianCent (double) const
 
double calcSunTrueLong (double) const
 
double calcSunApparentLong (double) const
 
double calcSunDeclination (double) const
 
double calcHourAngleSunrise (double, double, double) const
 
double calcHourAngleSunset (double, double, double) const
 
double calcJD (int, int, int) const
 
double calcJDFromJulianCent (double) const
 
double calcSunEqOfCenter (double) const
 
double calcAbsSunrise (double) const
 
double calcAbsSunset (double) const
 

Private Attributes

double m_latitude
 
double m_longitude
 
double m_julianDate
 
double m_tzOffset
 
int m_year
 
int m_month
 
int m_day
 

Detailed Description

This class controls all aspects of the operations. The math is done in private functions, and the public API's allow for returning a sunrise/sunset value for the given coordinates and timezone.

The resulting calculations are relative to midnight of the day you set in the setCurrentDate() function. It does not return a time_t value for delta from the current epoch as that would not make sense as the sunrise/sunset can be calculated thousands of years in the past. The library acts on a day timeframe, and doesn't try to assume anything about any other unit of measurement other than the current set day.

You can instantiate this class a few different ways, depending on your needs. It's possible to set your location one time and forget about doing that again if you don't plan to move. Then you only need to change the date and timezone to get correct data. Or, you can simply create an object with no location or time data and then do that later. This is a good mechanism for the setup()/loop() construct.

The most important thing to remember is to make sure the library knows the exact date and timezone for the sunrise/sunset you are trying to calculate. Not doing so means you are going to have very odd results. It's reasonably easy to know when you've forgotten one or the other by looking at the time the sun would rise and noticing that it is X hours earlier or later. That is, if you get a return of 128 minutes (2:08 AM) past midnight when the sun should rise at 308 (6:08 AM), then you probably forgot to set your EST timezone.

The library also has no idea about daylight savings time. If your timezone changes during the year to account for savings time, you must update your timezone accordingly.

Constructor & Destructor Documentation

◆ SunSet() [1/3]

SunSet::SunSet ( )

Default constructor taking no arguments. It will default all values to zero. It is possible to call calcSunrise() on this type of initialization and it will not fail, but it is unlikely you are at 0,0, TZ=0. This also will not include an initialized date to work from.

35  : m_latitude(0.0), m_longitude(0.0), m_julianDate(0.0), m_tzOffset(0.0)
36 {
37 }

◆ SunSet() [2/3]

SunSet::SunSet ( double  lat,
double  lon,
int  tz 
)
Parameters
latDouble Latitude for this object
lonDouble Longitude for this object
tzInteger based timezone for this object

This will create an object for a location with an integer based timezone value. This constructor is a relic of the original design. It is not deprecated, as this is a valid construction, but the double is preferred for correctness.

50  : m_latitude(lat), m_longitude(lon), m_julianDate(0.0), m_tzOffset(tz)
51 {
52 }

◆ SunSet() [3/3]

SunSet::SunSet ( double  lat,
double  lon,
double  tz 
)
Parameters
latDouble Latitude for this object
lonDouble Longitude for this object
tzDouble based timezone for this object

This will create an object for a location with a double based timezone value.

63  : m_latitude(lat), m_longitude(lon), m_julianDate(0.0), m_tzOffset(tz)
64 {
65 }

◆ ~SunSet()

SunSet::~SunSet ( )

The destructor has no value and does nothing.

73 {
74 }

Member Function Documentation

◆ calcAbsSunrise()

double SunSet::calcAbsSunrise ( double  offset) const
private
Parameters
offsetDouble The specific angle to use when calculating sunrise
Returns
Returns the time in minutes past midnight in UTC for sunrise at your location

This does a bunch of work to get to an accurate angle. Note that it does it 2x, once to get a rough position, and then it doubles back and redoes the calculations to refine the value. The first time through, it will be off by as much as 2 minutes, but the second time through, it will be nearly perfect.

Note that this is the base calculation for all sunrise calls. The others just modify the offset angle to account for the different needs.

300 {
301  double t = calcTimeJulianCent(m_julianDate);
302  // *** First pass to approximate sunrise
303  double eqTime = calcEquationOfTime(t);
304  double solarDec = calcSunDeclination(t);
305  double hourAngle = calcHourAngleSunrise(m_latitude, solarDec, offset);
306  double delta = m_longitude + radToDeg(hourAngle);
307  double timeDiff = 4 * delta; // in minutes of time
308  double timeUTC = 720 - timeDiff - eqTime; // in minutes
309  double newt = calcTimeJulianCent(calcJDFromJulianCent(t) + timeUTC/1440.0);
310 
311  eqTime = calcEquationOfTime(newt);
312  solarDec = calcSunDeclination(newt);
313 
314  hourAngle = calcHourAngleSunrise(m_latitude, solarDec, offset);
315  delta = m_longitude + radToDeg(hourAngle);
316  timeDiff = 4 * delta;
317  timeUTC = 720 - timeDiff - eqTime; // in minutes
318  return timeUTC; // return time in minutes from midnight
319 }

References calcEquationOfTime(), calcHourAngleSunrise(), calcJDFromJulianCent(), calcSunDeclination(), calcTimeJulianCent(), m_julianDate, m_latitude, m_longitude, and radToDeg().

Referenced by calcCustomSunrise(), and calcSunriseUTC().

◆ calcAbsSunset()

double SunSet::calcAbsSunset ( double  offset) const
private
Parameters
offsetDouble The specific angle to use when calculating sunset
Returns
Returns the time in minutes past midnight in UTC for sunset at your location

This does a bunch of work to get to an accurate angle. Note that it does it 2x, once to get a rough position, and then it doubles back and redoes the calculations to refine the value. The first time through, it will be off by as much as 2 minutes, but the second time through, it will be nearly perfect.

Note that this is the base calculation for all sunset calls. The others just modify the offset angle to account for the different needs.

335 {
336  double t = calcTimeJulianCent(m_julianDate);
337  // *** First pass to approximate sunset
338  double eqTime = calcEquationOfTime(t);
339  double solarDec = calcSunDeclination(t);
340  double hourAngle = calcHourAngleSunset(m_latitude, solarDec, offset);
341  double delta = m_longitude + radToDeg(hourAngle);
342  double timeDiff = 4 * delta; // in minutes of time
343  double timeUTC = 720 - timeDiff - eqTime; // in minutes
344  double newt = calcTimeJulianCent(calcJDFromJulianCent(t) + timeUTC/1440.0);
345 
346  eqTime = calcEquationOfTime(newt);
347  solarDec = calcSunDeclination(newt);
348 
349  hourAngle = calcHourAngleSunset(m_latitude, solarDec, offset);
350  delta = m_longitude + radToDeg(hourAngle);
351  timeDiff = 4 * delta;
352  timeUTC = 720 - timeDiff - eqTime; // in minutes
353 
354  return timeUTC; // return time in minutes from midnight
355 }

References calcEquationOfTime(), calcHourAngleSunset(), calcJDFromJulianCent(), calcSunDeclination(), calcTimeJulianCent(), m_julianDate, m_latitude, m_longitude, and radToDeg().

Referenced by calcCustomSunset(), and calcSunsetUTC().

◆ calcAstronomicalSunrise()

double SunSet::calcAstronomicalSunrise ( ) const
Returns
Returns the Astronomical sunrise in fractional minutes past midnight

This function will return the Astronomical sunrise in local time for your location

390 {
392 }

References calcCustomSunrise(), and SUNSET_ASTONOMICAL.

◆ calcAstronomicalSunset()

double SunSet::calcAstronomicalSunset ( ) const
Returns
Returns the Astronomical sunset in fractional minutes past midnight

This function will return the Astronomical sunset in local time for your location

401 {
403 }

References calcCustomSunset(), and SUNSET_ASTONOMICAL.

◆ calcCivilSunrise()

double SunSet::calcCivilSunrise ( ) const
Returns
Returns the Civil sunrise in fractional minutes past midnight

This function will return the Civil sunrise in local time for your location

412 {
414 }

References calcCustomSunrise(), and SUNSET_CIVIL.

◆ calcCivilSunset()

double SunSet::calcCivilSunset ( ) const
Returns
Returns the Civil sunset in fractional minutes past midnight

This function will return the Civil sunset in local time for your location

423 {
425 }

References calcCustomSunset(), and SUNSET_CIVIL.

◆ calcCustomSunrise()

double SunSet::calcCustomSunrise ( double  angle) const
Parameters
angleThe angle in degrees over the horizon at which to calculate the sunset time
Returns
Returns sunrise at angle degrees in minutes past midnight.

This function will return the sunrise in local time for your location for any angle over the horizon, where < 90 would be above the horizon, and > 90 would be at or below.

480 {
481  return calcAbsSunrise(angle) + (60 * m_tzOffset);
482 }

References calcAbsSunrise(), and m_tzOffset.

Referenced by calcAstronomicalSunrise(), calcCivilSunrise(), calcNauticalSunrise(), and calcSunrise().

◆ calcCustomSunset()

double SunSet::calcCustomSunset ( double  angle) const
Parameters
angleThe angle in degrees over the horizon at which to calculate the sunset time
Returns
Returns sunset at angle degrees in minutes past midnight.

This function will return the sunset in local time for your location for any angle over the horizon, where < 90 would be above the horizon, and > 90 would be at or below.

493 {
494  return calcAbsSunset(angle) + (60 * m_tzOffset);
495 }

References calcAbsSunset(), and m_tzOffset.

Referenced by calcAstronomicalSunset(), calcCivilSunset(), calcNauticalSunset(), and calcSunset().

◆ calcEccentricityEarthOrbit()

double SunSet::calcEccentricityEarthOrbit ( double  t) const
private
164 {
165  double e = 0.016708634 - t * (0.000042037 + 0.0000001267 * t);
166  return e; // unitless
167 }

Referenced by calcEquationOfTime().

◆ calcEquationOfTime()

double SunSet::calcEquationOfTime ( double  t) const
private
176 {
177  double epsilon = calcObliquityCorrection(t);
178  double l0 = calcGeomMeanLongSun(t);
179  double e = calcEccentricityEarthOrbit(t);
180  double m = calcGeomMeanAnomalySun(t);
181  double y = tan(degToRad(epsilon)/2.0);
182 
183  y *= y;
184 
185  double sin2l0 = sin(2.0 * degToRad(l0));
186  double sinm = sin(degToRad(m));
187  double cos2l0 = cos(2.0 * degToRad(l0));
188  double sin4l0 = sin(4.0 * degToRad(l0));
189  double sin2m = sin(2.0 * degToRad(m));
190  double Etime = y * sin2l0 - 2.0 * e * sinm + 4.0 * e * y * sinm * cos2l0 - 0.5 * y * y * sin4l0 - 1.25 * e * e * sin2m;
191  return radToDeg(Etime)*4.0; // in minutes of time
192 }

References calcEccentricityEarthOrbit(), calcGeomMeanAnomalySun(), calcGeomMeanLongSun(), calcObliquityCorrection(), degToRad(), and radToDeg().

Referenced by calcAbsSunrise(), and calcAbsSunset().

◆ calcGeomMeanAnomalySun()

double SunSet::calcGeomMeanAnomalySun ( double  t) const
private
170 {
171  double M = 357.52911 + t * (35999.05029 - 0.0001537 * t);
172  return M; // in degrees
173 }

Referenced by calcEquationOfTime(), and calcSunEqOfCenter().

◆ calcGeomMeanLongSun()

double SunSet::calcGeomMeanLongSun ( double  t) const
private
145 {
146  if (std::isnan(t)) {
147  return nan("");
148  }
149  double L = 280.46646 + t * (36000.76983 + 0.0003032 * t);
150 
151  return std::fmod(L, 360.0);
152 }

Referenced by calcEquationOfTime(), and calcSunTrueLong().

◆ calcHourAngleSunrise()

double SunSet::calcHourAngleSunrise ( double  lat,
double  solarDec,
double  offset 
) const
private
229 {
230  double latRad = degToRad(lat);
231  double sdRad = degToRad(solarDec);
232  double HA = (acos(cos(degToRad(offset))/(cos(latRad)*cos(sdRad))-tan(latRad) * tan(sdRad)));
233 
234  return HA; // in radians
235 }

References degToRad().

Referenced by calcAbsSunrise().

◆ calcHourAngleSunset()

double SunSet::calcHourAngleSunset ( double  lat,
double  solarDec,
double  offset 
) const
private
238 {
239  double latRad = degToRad(lat);
240  double sdRad = degToRad(solarDec);
241  double HA = (acos(cos(degToRad(offset))/(cos(latRad)*cos(sdRad))-tan(latRad) * tan(sdRad)));
242 
243  return -HA; // in radians
244 }

References degToRad().

Referenced by calcAbsSunset().

◆ calcJD()

double SunSet::calcJD ( int  y,
int  m,
int  d 
) const
private
Parameters
yInteger year as a 4 digit value
mInteger month, not 0 based
dInteger day, not 0 based
Returns
Returns the Julian date as a double for the calculations

A well known JD calculator

256 {
257  if (m <= 2) {
258  y -= 1;
259  m += 12;
260  }
261  double A = floor(y/100);
262  double B = 2.0 - A + floor(A/4);
263 
264  double JD = floor(365.25*(y + 4716)) + floor(30.6001*(m+1)) + d + B - 1524.5;
265  return JD;
266 }

Referenced by setCurrentDate().

◆ calcJDFromJulianCent()

double SunSet::calcJDFromJulianCent ( double  t) const
private
269 {
270  double JD = t * 36525.0 + 2451545.0;
271  return JD;
272 }

Referenced by calcAbsSunrise(), and calcAbsSunset().

◆ calcMeanObliquityOfEcliptic()

double SunSet::calcMeanObliquityOfEcliptic ( double  t) const
private
137 {
138  double seconds = 21.448 - t*(46.8150 + t*(0.00059 - t*(0.001813)));
139  double e0 = 23.0 + (26.0 + (seconds/60.0))/60.0;
140 
141  return e0; // in degrees
142 }

Referenced by calcObliquityCorrection().

◆ calcNauticalSunrise()

double SunSet::calcNauticalSunrise ( ) const
Returns
Returns the Nautical sunrise in fractional minutes past midnight

This function will return the Nautical sunrise in local time for your location

434 {
436 }

References calcCustomSunrise(), and SUNSET_NAUTICAL.

◆ calcNauticalSunset()

double SunSet::calcNauticalSunset ( ) const
Returns
Returns the Nautical sunset in fractional minutes past midnight

This function will return the Nautical sunset in local time for your location

445 {
447 }

References calcCustomSunset(), and SUNSET_NAUTICAL.

◆ calcObliquityCorrection()

double SunSet::calcObliquityCorrection ( double  t) const
private
155 {
156  double e0 = calcMeanObliquityOfEcliptic(t);
157  double omega = 125.04 - 1934.136 * t;
158  double e = e0 + 0.00256 * cos(degToRad(omega));
159 
160  return e; // in degrees
161 }

References calcMeanObliquityOfEcliptic(), and degToRad().

Referenced by calcEquationOfTime(), and calcSunDeclination().

◆ calcSunApparentLong()

double SunSet::calcSunApparentLong ( double  t) const
private
210 {
211  double o = calcSunTrueLong(t);
212 
213  double omega = 125.04 - 1934.136 * t;
214  double lambda = o - 0.00569 - 0.00478 * sin(degToRad(omega));
215  return lambda; // in degrees
216 }

References calcSunTrueLong(), and degToRad().

Referenced by calcSunDeclination().

◆ calcSunDeclination()

double SunSet::calcSunDeclination ( double  t) const
private
219 {
220  double e = calcObliquityCorrection(t);
221  double lambda = calcSunApparentLong(t);
222 
223  double sint = sin(degToRad(e)) * sin(degToRad(lambda));
224  double theta = radToDeg(asin(sint));
225  return theta; // in degrees
226 }

References calcObliquityCorrection(), calcSunApparentLong(), degToRad(), and radToDeg().

Referenced by calcAbsSunrise(), and calcAbsSunset().

◆ calcSunEqOfCenter()

double SunSet::calcSunEqOfCenter ( double  t) const
private
275 {
276  double m = calcGeomMeanAnomalySun(t);
277  double mrad = degToRad(m);
278  double sinm = sin(mrad);
279  double sin2m = sin(mrad+mrad);
280  double sin3m = sin(mrad+mrad+mrad);
281  double C = sinm * (1.914602 - t * (0.004817 + 0.000014 * t)) + sin2m * (0.019993 - 0.000101 * t) + sin3m * 0.000289;
282 
283  return C; // in degrees
284 }

References calcGeomMeanAnomalySun(), and degToRad().

Referenced by calcSunTrueLong().

◆ calcSunrise()

double SunSet::calcSunrise ( ) const
Returns
Returns local sunrise in minutes past midnight.

This function will return the Official sunrise in local time for your location

456 {
458 }

References calcCustomSunrise(), and SUNSET_OFFICIAL.

Referenced by Calendar::CreateDaylength().

◆ calcSunriseUTC()

double SunSet::calcSunriseUTC ( )
Returns
Returns the UTC time when sunrise occurs in the location provided

This is a holdover from the original implementation and to me doesn't seem to be very useful, it's just confusing. This function is deprecated but won't be removed unless that becomes necessary.

366 {
368 }

References calcAbsSunrise(), and SUNSET_OFFICIAL.

◆ calcSunset()

double SunSet::calcSunset ( ) const
Returns
Returns local sunset in minutes past midnight.

This function will return the Official sunset in local time for your location

467 {
469 }

References calcCustomSunset(), and SUNSET_OFFICIAL.

Referenced by Calendar::CreateDaylength().

◆ calcSunsetUTC()

double SunSet::calcSunsetUTC ( )
Returns
Returns the UTC time when sunset occurs in the location provided

This is a holdover from the original implementation and to me doesn't seem to be very useful, it's just confusing. This function is deprecated but won't be removed unless that becomes necessary.

379 {
381 }

References calcAbsSunset(), and SUNSET_OFFICIAL.

◆ calcSunTrueLong()

double SunSet::calcSunTrueLong ( double  t) const
private
201 {
202  double l0 = calcGeomMeanLongSun(t);
203  double c = calcSunEqOfCenter(t);
204 
205  double O = l0 + c;
206  return O; // in degrees
207 }

References calcGeomMeanLongSun(), and calcSunEqOfCenter().

Referenced by calcSunApparentLong().

◆ calcTimeJulianCent()

double SunSet::calcTimeJulianCent ( double  jd) const
private
195 {
196  double T = ( jd - 2451545.0)/36525.0;
197  return T;
198 }

Referenced by calcAbsSunrise(), and calcAbsSunset().

◆ degToRad()

double SunSet::degToRad ( double  angleDeg) const
private

◆ moonPhase() [1/2]

int SunSet::moonPhase ( ) const

Overload to set the moonphase for right now

583 {
584  time_t t = std::time(0);
585  return moonPhase(static_cast<int>(t));
586 }

◆ moonPhase() [2/2]

int SunSet::moonPhase ( int  fromepoch) const
Parameters
fromepochtime_t seconds from epoch to calculate the moonphase for

This is a simple calculation to tell us roughly what the moon phase is locally. It does not give position. It's roughly accurate, but not great.

The return value is 0 to 29, with 0 and 29 being hidden and 14 being full.

566 {
567  int moonepoch = 614100;
568  int phase = (fromepoch - moonepoch) % 2551443;
569  int res = static_cast<int>(floor(phase / (24 * 3600))) + 1;
570 
571  if (res == 30)
572  res = 0;
573 
574  return res;
575 }

◆ radToDeg()

double SunSet::radToDeg ( double  angleRad) const
private
132 {
133  return (180.0 * angleRad / M_PI);
134 }

References M_PI.

Referenced by calcAbsSunrise(), calcAbsSunset(), calcEquationOfTime(), and calcSunDeclination().

◆ setCurrentDate()

double SunSet::setCurrentDate ( int  y,
int  m,
int  d 
)

double SunSet::setCurrentDate(int y, int m, int d)

Parameters
yInteger year, must be 4 digits
mInteger month, not zero based (Jan = 1)
dInteger day of month, not zero based (month starts on day 1)
Returns
Returns the result of the Julian Date conversion if you want to save it

Since these calculations are done based on the Julian Calendar, we must convert our year month day into Julian before we use it. You get the Julian value for free if you want it.

509 {
510  m_year = y;
511  m_month = m;
512  m_day = d;
513  m_julianDate = calcJD(y, m, d);
514  return m_julianDate;
515 }

References calcJD(), m_day, m_julianDate, m_month, and m_year.

Referenced by Calendar::CreateDaylength().

◆ setPosition() [1/2]

void SunSet::setPosition ( double  lat,
double  lon,
double  tz 
)
Parameters
latDouble Latitude value
lonDouble Longitude value
tzDouble Timezone offset

This will set the location the library uses for it's math. The timezone is included in this as it's not valid to call any of the calc functions until you have set a timezone. It is possible to simply call setPosition one time, with a timezone and not use the setTZOffset() function ever, if you never change timezone values.

117 {
118  m_latitude = lat;
119  m_longitude = lon;
120  if (tz >= -12 && tz <= 14)
121  m_tzOffset = tz;
122  else
123  m_tzOffset = 0.0;
124 }

References m_latitude, m_longitude, and m_tzOffset.

◆ setPosition() [2/2]

void SunSet::setPosition ( double  lat,
double  lon,
int  tz 
)
Parameters
latDouble Latitude value
lonDouble Longitude value
tzInteger Timezone offset

This will set the location the library uses for it's math. The timezone is included in this as it's not valid to call any of the calc functions until you have set a timezone. It is possible to simply call setPosition one time, with a timezone and not use the setTZOffset() function ever, if you never change timezone values.

This is the old version of the setPosition using an integer timezone, and will not be deprecated. However, it is preferred to use the double version going forward.

94 {
95  m_latitude = lat;
96  m_longitude = lon;
97  if (tz >= -12 && tz <= 14)
98  m_tzOffset = tz;
99  else
100  m_tzOffset = 0.0;
101 }

References m_latitude, m_longitude, and m_tzOffset.

Referenced by Calendar::CreateDaylength().

◆ setTZOffset() [1/2]

void SunSet::setTZOffset ( double  tz)
Parameters
tzDouble timezone, may be positive or negative

Critical to set your timezone so results are accurate for your time and date. This function is critical to make sure the system works correctly. If you do not set the timezone correctly, the return value will not be correct for your location. Forgetting this will result in return values that may actually be negative in some cases.

549 {
550  if (tz >= -12 && tz <= 14)
551  m_tzOffset = tz;
552  else
553  m_tzOffset = 0.0;
554 }

References m_tzOffset.

◆ setTZOffset() [2/2]

void SunSet::setTZOffset ( int  tz)
Parameters
tzInteger timezone, may be positive or negative

Critical to set your timezone so results are accurate for your time and date. This function is critical to make sure the system works correctly. If you do not set the timezone correctly, the return value will not be correct for your location. Forgetting this will result in return values that may actually be negative in some cases.

This function is a holdover from the previous design using an integer timezone and will not be deprecated. It is preferred to use the setTZOffset(doubble).

531 {
532  if (tz >= -12 && tz <= 14)
533  m_tzOffset = static_cast<double>(tz);
534  else
535  m_tzOffset = 0.0;
536 }

References m_tzOffset.

Member Data Documentation

◆ m_day

int SunSet::m_day
private

Referenced by setCurrentDate().

◆ m_julianDate

double SunSet::m_julianDate
private

◆ m_latitude

double SunSet::m_latitude
private

◆ m_longitude

double SunSet::m_longitude
private

◆ m_month

int SunSet::m_month
private

Referenced by setCurrentDate().

◆ m_tzOffset

double SunSet::m_tzOffset
private

◆ m_year

int SunSet::m_year
private

Referenced by setCurrentDate().

◆ SUNSET_ASTONOMICAL

constexpr double SunSet::SUNSET_ASTONOMICAL = 108.0
staticconstexpr

Astronomical sun angle for sunset

Referenced by calcAstronomicalSunrise(), and calcAstronomicalSunset().

◆ SUNSET_CIVIL

constexpr double SunSet::SUNSET_CIVIL = 96.0
staticconstexpr

Civil sun angle for sunset

Referenced by calcCivilSunrise(), and calcCivilSunset().

◆ SUNSET_NAUTICAL

constexpr double SunSet::SUNSET_NAUTICAL = 102.0
staticconstexpr

Nautical sun angle for sunset

Referenced by calcNauticalSunrise(), and calcNauticalSunset().

◆ SUNSET_OFFICIAL

constexpr double SunSet::SUNSET_OFFICIAL = 90.833
staticconstexpr

Standard sun angle for sunset

Referenced by calcSunrise(), calcSunriseUTC(), calcSunset(), and calcSunsetUTC().


The documentation for this class was generated from the following files:
SunSet::calcAbsSunset
double calcAbsSunset(double) const
Definition: sunset.cpp:334
M_PI
#define M_PI
Definition: sunset.h:33
SunSet::radToDeg
double radToDeg(double) const
Definition: sunset.cpp:131
SunSet::calcHourAngleSunset
double calcHourAngleSunset(double, double, double) const
Definition: sunset.cpp:237
SunSet::calcEquationOfTime
double calcEquationOfTime(double) const
Definition: sunset.cpp:175
SunSet::calcMeanObliquityOfEcliptic
double calcMeanObliquityOfEcliptic(double) const
Definition: sunset.cpp:136
SunSet::SUNSET_ASTONOMICAL
static constexpr double SUNSET_ASTONOMICAL
Definition: sunset.h:76
SunSet::calcSunDeclination
double calcSunDeclination(double) const
Definition: sunset.cpp:218
SunSet::calcTimeJulianCent
double calcTimeJulianCent(double) const
Definition: sunset.cpp:194
SunSet::m_month
int m_month
Definition: sunset.h:124
SunSet::m_longitude
double m_longitude
Definition: sunset.h:120
SunSet::m_tzOffset
double m_tzOffset
Definition: sunset.h:122
SunSet::calcCustomSunset
double calcCustomSunset(double) const
Definition: sunset.cpp:492
SunSet::calcCustomSunrise
double calcCustomSunrise(double) const
Definition: sunset.cpp:479
SunSet::calcEccentricityEarthOrbit
double calcEccentricityEarthOrbit(double) const
Definition: sunset.cpp:163
SunSet::m_day
int m_day
Definition: sunset.h:125
SunSet::m_latitude
double m_latitude
Definition: sunset.h:119
SunSet::calcAbsSunrise
double calcAbsSunrise(double) const
Definition: sunset.cpp:299
SunSet::calcJDFromJulianCent
double calcJDFromJulianCent(double) const
Definition: sunset.cpp:268
SunSet::m_julianDate
double m_julianDate
Definition: sunset.h:121
SunSet::calcSunTrueLong
double calcSunTrueLong(double) const
Definition: sunset.cpp:200
SunSet::SUNSET_OFFICIAL
static constexpr double SUNSET_OFFICIAL
Definition: sunset.h:73
SunSet::calcGeomMeanAnomalySun
double calcGeomMeanAnomalySun(double) const
Definition: sunset.cpp:169
SunSet::calcObliquityCorrection
double calcObliquityCorrection(double) const
Definition: sunset.cpp:154
SunSet::calcSunApparentLong
double calcSunApparentLong(double) const
Definition: sunset.cpp:209
SunSet::SUNSET_NAUTICAL
static constexpr double SUNSET_NAUTICAL
Definition: sunset.h:74
SunSet::calcSunEqOfCenter
double calcSunEqOfCenter(double) const
Definition: sunset.cpp:274
SunSet::degToRad
double degToRad(double) const
Definition: sunset.cpp:126
SunSet::calcGeomMeanLongSun
double calcGeomMeanLongSun(double) const
Definition: sunset.cpp:144
SunSet::calcHourAngleSunrise
double calcHourAngleSunrise(double, double, double) const
Definition: sunset.cpp:228
SunSet::moonPhase
int moonPhase() const
Definition: sunset.cpp:582
SunSet::SUNSET_CIVIL
static constexpr double SUNSET_CIVIL
Definition: sunset.h:75
SunSet::m_year
int m_year
Definition: sunset.h:123
SunSet::calcJD
double calcJD(int, int, int) const
Definition: sunset.cpp:255