Sun position
Sun position algorithm
main.c File Reference

main.c - Simple demo program for Sun position using rectangular coordinates More...

Go to the source code of this file.

Macros

#define SITE_LATITUDE_deg   -37.8236
 North lats +ve, south -ve (deg)

 
#define SITE_LONGITUDE_deg   144.9913
 East lons +ve, west -ve (degrees)
 
#define SITE_HEIGHT_m   30.0
 Height above sea level (metres)

 
#define SITE_PRESSURE_hPa   1013.0
 Atmospheric pressure (hPa = mbar)
 
#define SITE_TEMPERATURE_degC   15.0
 Temperature (degrees Celsius)

 
#define SITE_TIMEZONE_h   10.0
 East zones +ve, west -ve (hours)
 

Functions

void demo1 (void)
 Sample code demonstrating the calculation of the position of the Sun using rectangular coordinates. More...
 
void demo2 (void)
 Sample code using the greatly simplified calculation of the position of the Sun using interpolated coordinates. More...
 
void demo4 (void)
 
void sunTopocentricFast (double j2kUtc_d, const Sky_DeltaTs *dTs, const Sky_SiteProp *site, Sky_SiteHorizon *topo)
 Uses previously calculated values of the Sun's apparent coordinates and interpolation to quickly calculate the Sun's topocentric position. More...
 
int main (void)
 

Detailed Description

main.c - Simple demo program for Sun position using rectangular coordinates

Author
David Hoadley vcrum.nosp@m.ble@.nosp@m.westn.nosp@m.et.c.nosp@m.om.au

See the main page (or the end of this source file) for a description of this file.


Definition in file main.c.

Function Documentation

◆ demo1()

void demo1 ( void  )

Sample code demonstrating the calculation of the position of the Sun using rectangular coordinates.


Examples
demo1_sun.c.

Definition at line 131 of file main.c.

◆ demo2()

void demo2 ( void  )

Sample code using the greatly simplified calculation of the position of the Sun using interpolated coordinates.


Examples
demo2_sun_tracking.c.

Definition at line 171 of file main.c.

◆ sunTopocentricFast()

void sunTopocentricFast ( double  j2kUtc_d,
const Sky_DeltaTs dTs,
const Sky_SiteProp site,
Sky_SiteHorizon topo 
)

Uses previously calculated values of the Sun's apparent coordinates and interpolation to quickly calculate the Sun's topocentric position.

Parameters
[in]j2kUtc_dDays since Greenwich noon, 1-Jan-2000, UTC timescale
[in]deltasDelta T values, as set by the sky_initTime() (or sky_initTimeSimple() or sky_initTimeDetailed()) routines
[in]siteProperties of the observing site, particularly its geometric location on the surface of the Earth, as set by the sky_setSiteLocation() function (or sky_setSiteLoc2())
[out]topoTopocentric position, in both rectangular (unit vector) form, and as Azimuth and Elevation (altitude) angles
When to call this function
This function is designed to be called at high frequency (more than once per second, even up to, say, 20 Hz).
Use this function when you have made a previous call to skyfast_init(). Depending on how long a period you want to track the sun using this routine, you may also need to run the function skyfast_backgroundUpdate() as a low frequency, low priority routine, to update the interpolation ranges. If you have not done this, call sun_nrelTopocentric() instead.

Examples
demo2_sun_tracking.c.

Definition at line 82 of file main.c.