FACT++  1.0
Time Time::GetNextSunRise ( double  horizon) const
Returns
The time of the next sun-rise, relative to given horizon in degree, for the coordinates of the ORM, La Palma. if libnova was not compiled in, it will return the next noon.
Exceptions
aruntime_error exception is thrown if the calculation of the sun-rise by libnova fails (this would happen if libnova thinks the sun is circumpolar which should never happen at La Palma)

Definition at line 346 of file Time.cc.

References JD(), Mjd(), Nova::ORM(), and Time().

Referenced by DataLogger::DataLogger(), StateMachineLidControl< T, S >::Execute(), StateMachineDrive< T, S >::Execute(), StateMachineBias< T, S >::Execute(), and DataLogger::Report().

347 {
348 #ifdef HAVE_LIBNOVA
349  Nova::LnLatPosn obs = Nova::ORM();
350 
351  ln_rst_time sun_day;
352  if (ln_get_solar_rst_horizon(JD()-0.5, &obs, horizon, &sun_day)==1)
353  throw runtime_error("ln_get_solar_rst_horizon reported the sun to be circumpolar at the coordinates of La Palma!");
354 
355  if (Time(sun_day.rise)>=*this)
356  return Time(sun_day.rise);
357 
358  if (ln_get_solar_rst_horizon(JD()+0.5, &obs, horizon, &sun_day)==1)
359  throw runtime_error("ln_get_solar_rst_horizon reported the sun to be circumpolar at the coordinates of La Palma!");
360 
361  return Time(sun_day.rise);
362 #else
363  return Time(floor(Mjd()+0.5))+0.5;
364 #endif
365 }
Time(enum init_t type=utc)
Definition: Time.cc:58
const LnLatPosn & ORM()
Definition: nova.h:66
double JD() const
Definition: Time.h:87
double Mjd() const
Definition: Time.cc:180
ln_lnlat_posn LnLatPosn
Definition: nova.h:12

+ Here is the call graph for this function:

+ Here is the caller graph for this function: