1.3.49
 
Loading...
Searching...
No Matches
SolarPosition Class Reference

Public Member Functions

 SolarPosition (helios::Context *context_ptr)
 Solar position model default constructor. Initializes location based on the location set in the Context.
 
 SolarPosition (float UTC_hrs, float latitude_deg, float longitude_deg, helios::Context *context_ptr)
 Solar position model constructor.
 
helios::Time getSunriseTime () const
 Get the approximate time of sunrise at the current location.
 
helios::Time getSunsetTime () const
 Get the approximate time of sunset at the current location.
 
float getSunElevation () const
 Get the current sun elevation angle in radians for the current location. The sun angle is computed based on the current time and date set in the Helios context.
 
float getSunZenith () const
 Get the current sun zenithal angle in radians for the current location. The sun angle is computed based on the current time and date set in the Helios context.
 
float getSunAzimuth () const
 Get the current sun azimuthal angle in radians for the current location. The sun angle is computed based on the current time and date set in the Helios context.
 
helios::vec3 getSunDirectionVector () const
 Get a unit vector pointing toward the sun for the current location. The sun angle is computed based on the current time and date set in the Helios context.
 
helios::SphericalCoord getSunDirectionSpherical () const
 Get a spherical coordinate vector pointing toward the sun for the current location. The sun angle is computed based on the current time and date set in the Helios context.
 
void setSunDirection (const helios::SphericalCoord &sundirection)
 Override solar position calculation based on time in the Context by using a prescribed solar position.
 
float getSolarFlux (float pressure_Pa, float temperature_K, float humidity_rel, float turbidity) const
 Get the solar radiation flux perpendicular to the sun direction.
 
float getSolarFluxPAR (float pressure_Pa, float temperature_K, float humidity_rel, float turbidity) const
 Get the photosynthetically active (PAR) component of solar radiation flux perpendicular to the sun direction.
 
float getSolarFluxNIR (float pressure_Pa, float temperature_K, float humidity_rel, float turbidity) const
 Get the near-infrared (NIR) component of solar radiation flux perpendicular to the sun direction.
 
float getDiffuseFraction (float pressure_Pa, float temperature_K, float humidity_rel, float turbidity) const
 Get the fraction of solar radiation flux that is diffuse.
 
float getAmbientLongwaveFlux (float temperature_K, float humidity_rel) const
 Calculate the ambient (sky) longwave radiation flux.
 
float calibrateTurbidityFromTimeseries (const std::string &timeseries_shortwave_flux_label_Wm2) const
 Calculate the turbidity value based on a timeseries of net radiation measurements.
 
void enableCloudCalibration (const std::string &timeseries_shortwave_flux_label_Wm2)
 Enable calibration of solar flux and diffuse fraction when possibility of clouds are present against measured solar flux data.
 
void disableCloudCalibration ()
 Disable calibration of solar flux and diffuse fraction for clouds.
 

Static Public Member Functions

static int selfTest (int argc=0, char **argv=nullptr)
 Function to perform a self-test of model functions.
 

Detailed Description

Definition at line 21 of file SolarPosition.h.

Constructor & Destructor Documentation

◆ SolarPosition() [1/2]

SolarPosition::SolarPosition ( helios::Context context_ptr)
explicit

Solar position model default constructor. Initializes location based on the location set in the Context.

Parameters
[in]context_ptrPointer to the Helios context

Definition at line 21 of file SolarPosition.cpp.

◆ SolarPosition() [2/2]

SolarPosition::SolarPosition ( float  UTC_hrs,
float  latitude_deg,
float  longitude_deg,
helios::Context context_ptr 
)

Solar position model constructor.

Parameters
[in]context_ptrPointer to the Helios context
[in]UTC_hrsHours from Coordinated Universal Time (UTC) for location of interest. Convention is that UTC is positive moving Westward.
[in]latitude_degLatitude in degrees for location of interest. Convention is latitude is positive for Northern hemisphere.
[in]longitude_degLongitude in degrees for location of interest. Convention is longitude is positive for Western hemisphere.

Definition at line 29 of file SolarPosition.cpp.

Member Function Documentation

◆ calibrateTurbidityFromTimeseries()

float SolarPosition::calibrateTurbidityFromTimeseries ( const std::string &  timeseries_shortwave_flux_label_Wm2) const

Calculate the turbidity value based on a timeseries of net radiation measurements.

Parameters
[in]timeseries_shortwave_flux_label_Wm2Label of the timeseries variable in the Helios context that contains the net radiation flux measurements
Returns
Turbidity value
Note
The net radiation flux measurements contained in the timeseries should be global shortwave radiation flux on a horizontal plane in W/m^2. The data should contain at least one day with clear sky conditions.

Definition at line 381 of file SolarPosition.cpp.

◆ disableCloudCalibration()

void SolarPosition::disableCloudCalibration ( )

Disable calibration of solar flux and diffuse fraction for clouds.

Definition at line 431 of file SolarPosition.cpp.

◆ enableCloudCalibration()

void SolarPosition::enableCloudCalibration ( const std::string &  timeseries_shortwave_flux_label_Wm2)

Enable calibration of solar flux and diffuse fraction when possibility of clouds are present against measured solar flux data.

Parameters
[in]timeseries_shortwave_flux_label_Wm2Label for timeseries data field containing measured total shortwave flux data (W/m^2).

Definition at line 422 of file SolarPosition.cpp.

◆ getAmbientLongwaveFlux()

float SolarPosition::getAmbientLongwaveFlux ( float  temperature_K,
float  humidity_rel 
) const

Calculate the ambient (sky) longwave radiation flux.

Parameters
[in]temperature_KAir temperature near the ground surface in Kelvin
[in]humidity_relAir relative humidity near the ground surface
Returns
Ambient longwave flux in W/m^2
Note
The longwave flux model is based on Prata (1996).

Definition at line 354 of file SolarPosition.cpp.

◆ getDiffuseFraction()

float SolarPosition::getDiffuseFraction ( float  pressure_Pa,
float  temperature_K,
float  humidity_rel,
float  turbidity 
) const

Get the fraction of solar radiation flux that is diffuse.

Parameters
[in]pressure_PaAtmospheric pressure near ground surface in Pascals
[in]temperature_KAir temperature near the ground surface in Kelvin
[in]humidity_relAir relative humidity near the ground surface
[in]turbidityAngstrom's aerosol turbidity coefficient
Returns
Fraction of global radiation that is diffuse

Definition at line 213 of file SolarPosition.cpp.

◆ getSolarFlux()

float SolarPosition::getSolarFlux ( float  pressure_Pa,
float  temperature_K,
float  humidity_rel,
float  turbidity 
) const

Get the solar radiation flux perpendicular to the sun direction.

Parameters
[in]pressure_PaAtmospheric pressure near ground surface in Pascals
[in]temperature_KAir temperature near the ground surface in Kelvin
[in]humidity_relAir relative humidity near the ground surface
[in]turbidityAngstrom's aerosol turbidity coefficient
Note
The flux given by this function is the flux normal to the sun direction. To get the flux on a horizontal surface, multiply the returned value by cos(theta), where theta can be found by calling the getSunZenith() function.
The solar flux model is based on Gueymard (2008).
Returns
Global solar radiation flux NORMAL TO THE SUN DIRECTION in W/m^2

Definition at line 185 of file SolarPosition.cpp.

◆ getSolarFluxNIR()

float SolarPosition::getSolarFluxNIR ( float  pressure_Pa,
float  temperature_K,
float  humidity_rel,
float  turbidity 
) const

Get the near-infrared (NIR) component of solar radiation flux perpendicular to the sun direction.

Parameters
[in]pressure_PaAtmospheric pressure near ground surface in Pascals
[in]temperature_KAir temperature near the ground surface in Kelvin
[in]humidity_relAir relative humidity near the ground surface
[in]turbidityAngstrom's aerosol turbidity coefficient
Note
The flux given by this function is the flux normal to the sun direction. To get the flux on a horizontal surface, multiply the returned value by cos(theta), where theta can be found by calling the getSunZenith() function.
The solar flux model is based on Gueymard (2008).
Returns
Global solar radiation flux NORMAL TO THE SUN DIRECTION in W/m^2

Definition at line 204 of file SolarPosition.cpp.

◆ getSolarFluxPAR()

float SolarPosition::getSolarFluxPAR ( float  pressure_Pa,
float  temperature_K,
float  humidity_rel,
float  turbidity 
) const

Get the photosynthetically active (PAR) component of solar radiation flux perpendicular to the sun direction.

Parameters
[in]pressure_PaAtmospheric pressure near ground surface in Pascals
[in]temperature_KAir temperature near the ground surface in Kelvin
[in]humidity_relAir relative humidity near the ground surface
[in]turbidityAngstrom's aerosol turbidity coefficient
Note
The flux given by this function is the flux normal to the sun direction. To get the flux on a horizontal surface, multiply the returned value by cos(theta), where theta can be found by calling the getSunZenith() function.
The solar flux model is based on Gueymard (2008).
Returns
Global solar radiation flux NORMAL TO THE SUN DIRECTION in W/m^2

Definition at line 195 of file SolarPosition.cpp.

◆ getSunAzimuth()

float SolarPosition::getSunAzimuth ( ) const

Get the current sun azimuthal angle in radians for the current location. The sun angle is computed based on the current time and date set in the Helios context.

Definition at line 150 of file SolarPosition.cpp.

◆ getSunDirectionSpherical()

SphericalCoord SolarPosition::getSunDirectionSpherical ( ) const

Get a spherical coordinate vector pointing toward the sun for the current location. The sun angle is computed based on the current time and date set in the Helios context.

Definition at line 170 of file SolarPosition.cpp.

◆ getSunDirectionVector()

vec3 SolarPosition::getSunDirectionVector ( ) const

Get a unit vector pointing toward the sun for the current location. The sun angle is computed based on the current time and date set in the Helios context.

Definition at line 160 of file SolarPosition.cpp.

◆ getSunElevation()

float SolarPosition::getSunElevation ( ) const

Get the current sun elevation angle in radians for the current location. The sun angle is computed based on the current time and date set in the Helios context.

Definition at line 130 of file SolarPosition.cpp.

◆ getSunriseTime()

Time SolarPosition::getSunriseTime ( ) const

Get the approximate time of sunrise at the current location.

Definition at line 94 of file SolarPosition.cpp.

◆ getSunsetTime()

Time SolarPosition::getSunsetTime ( ) const

Get the approximate time of sunset at the current location.

Definition at line 112 of file SolarPosition.cpp.

◆ getSunZenith()

float SolarPosition::getSunZenith ( ) const

Get the current sun zenithal angle in radians for the current location. The sun angle is computed based on the current time and date set in the Helios context.

Definition at line 140 of file SolarPosition.cpp.

◆ selfTest()

int SolarPosition::selfTest ( int  argc = 0,
char **  argv = nullptr 
)
static

Function to perform a self-test of model functions.

Definition at line 232 of file selfTest.cpp.

◆ setSunDirection()

void SolarPosition::setSunDirection ( const helios::SphericalCoord sundirection)

Override solar position calculation based on time in the Context by using a prescribed solar position.

Parameters
[in]sundirectionSphericalCoord giving the direction of the sun

Definition at line 180 of file SolarPosition.cpp.


The documentation for this class was generated from the following files: