navit  0.5.3-trunk
sunriset.h File Reference

Go to the source code of this file.

Macros

#define TMOD(x)   ((x)<0?(x)+24:((x)>=24?(x)-24:(x)))
 
#define DAYSOFF(x)   ((x)<0?"(-1) ":((x)>=24?"(+1) ":""))
 
#define HOURS(h)   ((int)(floor(h)))
 
#define MINUTES(h)   ((int)(60*(h-floor(h))))
 
#define ABS(x)   ((x)<0?-(x):(x))
 
#define days_since_2000_Jan_0(y, m, d)    (367L*(y)-((7*((y)+(((m)+9)/12)))/4)+((275*(m))/9)+(d)-730530L)
 
#define PI   3.1415926535897932384
 
#define RADEG   ( 180.0 / PI )
 
#define DEGRAD   ( PI / 180.0 )
 
#define sind(x)   sin((x)*DEGRAD)
 
#define cosd(x)   cos((x)*DEGRAD)
 
#define tand(x)   tan((x)*DEGRAD)
 
#define atand(x)   (RADEG*atan(x))
 
#define asind(x)   (RADEG*asin(x))
 
#define acosd(x)   (RADEG*acos(x))
 
#define atan2d(y, x)   (RADEG*atan2(y,x))
 
#define day_length(year, month, day, lon, lat)    __daylen__( year, month, day, lon, lat, -50.0/60.0, 1 )
 
#define day_civil_twilight_length(year, month, day, lon, lat)    __daylen__( year, month, day, lon, lat, -6.0, 0 )
 
#define day_nautical_twilight_length(year, month, day, lon, lat)    __daylen__( year, month, day, lon, lat, -12.0, 0 )
 
#define day_astronomical_twilight_length(year, month, day, lon, lat)    __daylen__( year, month, day, lon, lat, -18.0, 0 )
 
#define sun_rise_set(year, month, day, lon, lat, rise, set)    __sunriset__( year, month, day, lon, lat, -35.0/60.0, 1, rise, set )
 
#define civil_twilight(year, month, day, lon, lat, start, end)    __sunriset__( year, month, day, lon, lat, -6.0, 0, start, end )
 
#define nautical_twilight(year, month, day, lon, lat, start, end)    __sunriset__( year, month, day, lon, lat, -12.0, 0, start, end )
 
#define astronomical_twilight(year, month, day, lon, lat, start, end)    __sunriset__( year, month, day, lon, lat, -18.0, 0, start, end )
 

Functions

double __daylen__ (int year, int month, int day, double lon, double lat, double altit, int upper_limb)
 
int __sunriset__ (int year, int month, int day, double lon, double lat, double altit, int upper_limb, double *rise, double *set)
 
void sunpos (double d, double *lon, double *r)
 
void sun_RA_dec (double d, double *RA, double *dec, double *r)
 
double revolution (double x)
 
double rev180 (double x)
 
double GMST0 (double d)
 

Variables

const char * timezone_name
 
long int timezone_offset
 

Macro Definition Documentation

◆ ABS

#define ABS (   x)    ((x)<0?-(x):(x))

◆ acosd

#define acosd (   x)    (RADEG*acos(x))

◆ asind

#define asind (   x)    (RADEG*asin(x))

◆ astronomical_twilight

#define astronomical_twilight (   year,
  month,
  day,
  lon,
  lat,
  start,
  end 
)     __sunriset__( year, month, day, lon, lat, -18.0, 0, start, end )

◆ atan2d

#define atan2d (   y,
 
)    (RADEG*atan2(y,x))

◆ atand

#define atand (   x)    (RADEG*atan(x))

◆ civil_twilight

#define civil_twilight (   year,
  month,
  day,
  lon,
  lat,
  start,
  end 
)     __sunriset__( year, month, day, lon, lat, -6.0, 0, start, end )

◆ cosd

#define cosd (   x)    cos((x)*DEGRAD)

◆ day_astronomical_twilight_length

#define day_astronomical_twilight_length (   year,
  month,
  day,
  lon,
  lat 
)     __daylen__( year, month, day, lon, lat, -18.0, 0 )

◆ day_civil_twilight_length

#define day_civil_twilight_length (   year,
  month,
  day,
  lon,
  lat 
)     __daylen__( year, month, day, lon, lat, -6.0, 0 )

◆ day_length

#define day_length (   year,
  month,
  day,
  lon,
  lat 
)     __daylen__( year, month, day, lon, lat, -50.0/60.0, 1 )

◆ day_nautical_twilight_length

#define day_nautical_twilight_length (   year,
  month,
  day,
  lon,
  lat 
)     __daylen__( year, month, day, lon, lat, -12.0, 0 )

◆ days_since_2000_Jan_0

#define days_since_2000_Jan_0 (   y,
  m,
 
)     (367L*(y)-((7*((y)+(((m)+9)/12)))/4)+((275*(m))/9)+(d)-730530L)

◆ DAYSOFF

#define DAYSOFF (   x)    ((x)<0?"(-1) ":((x)>=24?"(+1) ":""))

◆ DEGRAD

#define DEGRAD   ( PI / 180.0 )

◆ HOURS

#define HOURS (   h)    ((int)(floor(h)))

◆ MINUTES

#define MINUTES (   h)    ((int)(60*(h-floor(h))))

◆ nautical_twilight

#define nautical_twilight (   year,
  month,
  day,
  lon,
  lat,
  start,
  end 
)     __sunriset__( year, month, day, lon, lat, -12.0, 0, start, end )

◆ PI

#define PI   3.1415926535897932384

◆ RADEG

#define RADEG   ( 180.0 / PI )

◆ sind

#define sind (   x)    sin((x)*DEGRAD)

◆ sun_rise_set

#define sun_rise_set (   year,
  month,
  day,
  lon,
  lat,
  rise,
  set 
)     __sunriset__( year, month, day, lon, lat, -35.0/60.0, 1, rise, set )

◆ tand

#define tand (   x)    tan((x)*DEGRAD)

◆ TMOD

#define TMOD (   x)    ((x)<0?(x)+24:((x)>=24?(x)-24:(x)))

Function Documentation

◆ __daylen__()

double __daylen__ ( int  year,
int  month,
int  day,
double  lon,
double  lat,
double  altit,
int  upper_limb 
)

◆ __sunriset__()

int __sunriset__ ( int  year,
int  month,
int  day,
double  lon,
double  lat,
double  altit,
int  upper_limb,
double *  rise,
double *  set 
)

◆ GMST0()

double GMST0 ( double  d)

References revolution().

Referenced by __sunriset__().

◆ rev180()

double rev180 ( double  x)

References INV360.

Referenced by __sunriset__().

◆ revolution()

double revolution ( double  x)

References INV360.

Referenced by __sunriset__(), GMST0(), and sunpos().

◆ sun_RA_dec()

void sun_RA_dec ( double  d,
double *  RA,
double *  dec,
double *  r 
)

References atan2d, cosd, sind, and sunpos().

Referenced by __sunriset__().

◆ sunpos()

void sunpos ( double  d,
double *  lon,
double *  r 
)

References atan2d, cosd, M, RADEG, revolution(), and sind.

Referenced by __daylen__(), and sun_RA_dec().

Variable Documentation

◆ timezone_name

const char* timezone_name
extern

◆ timezone_offset

long int timezone_offset
extern