SolTrack
SolTrack is a simple, free, fast and accurate C routine to compute the position of the Sun
All Data Structures Files Functions Variables Macros
Functions
SolTrack_RiseSet.c File Reference

(SolTrack version 2.2, revision 13, hash 9f77eee, 2017-09-09)

#include "SolTrack.h"
Include dependency graph for SolTrack_RiseSet.c:

Functions

void SolTrack_RiseSet (struct Time time, struct Location location, struct Position *position, struct RiseSet *riseSet, double rsAlt, int useDegrees, int useNorthEqualsZero)
 Compute rise, transit and set times for the Sun, as well as their azimuths/altitude. More...
 
double rev (double angle)
 Fold an angle to take a value between 0 and 2pi. More...
 
double rev2 (double angle)
 Fold an angle to take a value between -pi and pi. More...
 

Function Documentation

◆ SolTrack_RiseSet()

void SolTrack_RiseSet ( struct Time  time,
struct Location  location,
struct Position position,
struct RiseSet riseSet,
double  rsAlt,
int  useDegrees,
int  useNorthEqualsZero 
)

Compute rise, transit and set times for the Sun, as well as their azimuths/altitude.

Parameters
[in]timeStruct containing date and time to compute the position for, in UT
[in]locationStruct containing the geographic location to compute the position for
[out]positionStruct containing the position of the Sun
[out]riseSetStruct containing the Sun's rise, transit and set data
[in]rsAltAltitude to return rise/set data for (radians; 0. is actual rise/set). rsAlt>pi/2: compute transit only
[in]useDegreesUse degrees for input and output angular variables, rather than radians
[in]useNorthEqualsZeroUse the definition where azimuth=0 denotes north, rather than south

Example Usage:

SolTrack(time, location, &position, 0.0);
Note
  • if rsAlt == 0.0, actual rise and set times are computed
  • if rsAlt != 0.0, the routine calculates when alt = rsAlt is reached
  • returns times, rise/set azimuth and transit altitude in the struct position
See also
  • subroutine riset() in riset.f90 from libTheSky (libthesky.sf.net) for more info

References Position::agst, Time::day, Position::declination, Time::hour, Location::latitude, Location::longitude, Time::minute, Time::month, PI, R2D, R2H, rev(), rev2(), Position::rightAscension, RiseSet::riseAzimuth, RiseSet::riseTime, Time::second, RiseSet::setAzimuth, RiseSet::setTime, SolTrack(), RiseSet::transitAltitude, RiseSet::transitTime, and Time::year.

◆ rev()

double rev ( double  angle)

Fold an angle to take a value between 0 and 2pi.

Parameters
[in]angleAngle to fold (radians)

References MPI, and TWO_PI.

Referenced by SolTrack_RiseSet().

◆ rev2()

double rev2 ( double  angle)

Fold an angle to take a value between -pi and pi.

Parameters
[in]angleAngle to fold (radians)

References MPI, PI, and TWO_PI.

Referenced by SolTrack_RiseSet().