MeteoIODoc 2.11.0
Suntrajectory.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2/***********************************************************************************/
3/* Copyright 2009 WSL Institute for Snow and Avalanche Research SLF-DAVOS */
4/***********************************************************************************/
5/* This file is part of MeteoIO.
6 MeteoIO is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 MeteoIO is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with MeteoIO. If not, see <http://www.gnu.org/licenses/>.
18*/
19#ifndef SUNTAJECTORY_H
20#define SUNTAJECTORY_H
21
22namespace mio {
23
33 public:
35 SunTrajectory(const double& i_latitude, const double& i_longitude);
36
37 virtual ~SunTrajectory() {}
38
44 virtual void setDate(const double& i_julian, const double& i_TZ=0.)=0;
45 virtual void setLatLon(const double& i_latitude, const double& i_longitude)=0;
46 virtual void setAll(const double& i_latitude, const double& i_longitude, const double& i_julian, const double& i_TZ=0.)=0;
47 virtual void reset()=0;
48
51 virtual double getSolarElevation() const=0;
52 virtual double getSolarAzimuth() const=0;
53 virtual void getHorizontalCoordinates(double& azimuth, double& elevation) const=0;
54 virtual void getHorizontalCoordinates(double& azimuth, double& elevation, double& eccentricity) const=0;
55 virtual void getDaylight(double& sunrise, double& sunset, double& daylight)=0;
56 virtual double getSolarTime() const;
57 virtual double getSolarTimeOfDay() const;
58 static void getEaster(const int& year, int &month, int &day);
59
61 virtual void getEquatorialCoordinates(double& right_ascension, double& declination)=0;
62
64 double getAngleOfIncidence(const double& slope_azi, const double& slope_elev) const;
65 double getRadiationOnHorizontal(const double& radiation) const;
66 double getRadiationOnSlope(const double& slope_azi, const double& slope_elev, const double& radiation) const;
67 double getHorizontalOnSlope(const double& slope_azi, const double& slope_elev, const double& H_radiation, const double& elev_threshold=5.) const;
68
70 static double getAngleOfIncidence(const double& sun_azi, const double& sun_elev,
71 const double& slope_azi, const double& slope_elev);
72 static double projectHorizontalToSlope(const double& sun_azi, const double& sun_elev,
73 const double& slope_azi, const double& slope_elev, const double& H_radiation, const double& elev_threshold=5.);
74 static double projectSlopeToHorizontal(const double& sun_azi, const double& sun_elev,
75 const double& slope_azi, const double& slope_elev, const double& S_radiation);
76 static double projectHorizontalToBeam(const double& sun_elev, const double& H_radiation);
77
78 const std::string toString() const;
79
80 protected:
81 virtual void update()=0;
82
83 protected:
84 double julian_gmt, TZ;
90 double HourAngle;
91 static const double nodata;
92};
93
107class SunMeeus : public SunTrajectory {
108 public:
109 SunMeeus();
111 SunMeeus(const double& i_latitude, const double& i_longitude);
112 SunMeeus(const double& i_latitude, const double& i_longitude, const double& i_julian, const double& i_TZ=0.);
113
114 void setDate(const double& i_julian, const double& i_TZ=0.);
115 void setLatLon(const double& i_latitude, const double& i_longitude);
116 void setAll(const double& i_latitude, const double& i_longitude, const double& i_julian, const double& i_TZ=0.);
117 void reset();
118
119 double getSolarElevation() const;
120 double getSolarAzimuth() const;
121 void getHorizontalCoordinates(double& azimuth, double& elevation) const;
122 void getHorizontalCoordinates(double& azimuth, double& elevation, double& eccentricity) const;
123 void getDaylight(double& sunrise, double& sunset, double& MeeusDaylight);
124 void getEquatorialSunVector(double& sunx, double& suny, double& sunz);
125 void getEquatorialCoordinates(double& right_ascension, double& declination);
126
127 static double SideralToLocal(const double& JD);
128 private:
129 void private_init();
130 double getEquationOfTime(const double& julian_century);
131 void update();
132
133 private:
134 double SolarElevationAtm;
135
136};
137
138} //end namespace
139
140#endif
Calculate the Sun's position based on the Meeus algorithm. See J. Meeus, "Astronomical Algorithms",...
Definition: Suntrajectory.h:107
SunMeeus()
Definition: Suntrajectory.cc:269
~SunMeeus()
Definition: Suntrajectory.h:110
double getSolarElevation() const
Definition: Suntrajectory.cc:326
void setAll(const double &i_latitude, const double &i_longitude, const double &i_julian, const double &i_TZ=0.)
Definition: Suntrajectory.cc:310
void setLatLon(const double &i_latitude, const double &i_longitude)
Definition: Suntrajectory.cc:300
void getDaylight(double &sunrise, double &sunset, double &MeeusDaylight)
Definition: Suntrajectory.cc:370
static double SideralToLocal(const double &JD)
Definition: Suntrajectory.cc:414
void getHorizontalCoordinates(double &azimuth, double &elevation) const
Definition: Suntrajectory.cc:350
double getSolarAzimuth() const
Definition: Suntrajectory.cc:338
void getEquatorialSunVector(double &sunx, double &suny, double &sunz)
Definition: Suntrajectory.cc:397
void getEquatorialCoordinates(double &right_ascension, double &declination)
(http://en.wikipedia.org/wiki/Equatorial_coordinate_system)
Definition: Suntrajectory.cc:384
void setDate(const double &i_julian, const double &i_TZ=0.)
Set the date and time if no timezone is specified, GMT is assumed.
Definition: Suntrajectory.cc:290
void reset()
Definition: Suntrajectory.cc:319
A class to calculate the Sun's position This class is purely virtual.
Definition: Suntrajectory.h:32
static const double nodata
Definition: Suntrajectory.h:91
virtual double getSolarAzimuth() const =0
double longitude
Definition: Suntrajectory.h:85
SunTrajectory()
Definition: Suntrajectory.cc:33
virtual void getDaylight(double &sunrise, double &sunset, double &daylight)=0
virtual void reset()=0
virtual double getSolarTime() const
Return the current solar time. Since the Sun reaches its zenith at a time different than the local no...
Definition: Suntrajectory.cc:183
double TZ
Definition: Suntrajectory.h:84
double SolarElevation
Definition: Suntrajectory.h:86
virtual double getSolarTimeOfDay() const
Return the current solar time of day. Since the Sun reaches its zenith at a time different than the l...
Definition: Suntrajectory.cc:198
double SunRise
Definition: Suntrajectory.h:88
virtual void update()=0
virtual void setDate(const double &i_julian, const double &i_TZ=0.)=0
Set the date and time if no timezone is specified, GMT is assumed.
virtual void setLatLon(const double &i_latitude, const double &i_longitude)=0
double SunlightDuration
Definition: Suntrajectory.h:88
static void getEaster(const int &year, int &month, int &day)
Return the date of easter for the given year.
Definition: Suntrajectory.cc:221
double eccentricityEarth
>this is the TRUE solar elevation, not the apparent one
Definition: Suntrajectory.h:87
virtual void getEquatorialCoordinates(double &right_ascension, double &declination)=0
(http://en.wikipedia.org/wiki/Equatorial_coordinate_system)
double latitude
Definition: Suntrajectory.h:85
double SolarNoon
Definition: Suntrajectory.h:88
double getHorizontalOnSlope(const double &slope_azi, const double &slope_elev, const double &H_radiation, const double &elev_threshold=5.) const
Project a given horizontal radiation to a given slope. The sun position is the current one,...
Definition: Suntrajectory.cc:108
static double projectSlopeToHorizontal(const double &sun_azi, const double &sun_elev, const double &slope_azi, const double &slope_elev, const double &S_radiation)
Definition: Suntrajectory.cc:143
double SolarAzimuthAngle
Definition: Suntrajectory.h:86
double getRadiationOnSlope(const double &slope_azi, const double &slope_elev, const double &radiation) const
Definition: Suntrajectory.cc:84
static double projectHorizontalToSlope(const double &sun_azi, const double &sun_elev, const double &slope_azi, const double &slope_elev, const double &H_radiation, const double &elev_threshold=5.)
Definition: Suntrajectory.cc:124
double SunSet
Definition: Suntrajectory.h:88
virtual ~SunTrajectory()
Definition: Suntrajectory.h:37
static double projectHorizontalToBeam(const double &sun_elev, const double &H_radiation)
Definition: Suntrajectory.cc:160
double HourAngle
Definition: Suntrajectory.h:90
virtual void setAll(const double &i_latitude, const double &i_longitude, const double &i_julian, const double &i_TZ=0.)=0
const std::string toString() const
Definition: Suntrajectory.cc:242
double SunDeclination
Definition: Suntrajectory.h:89
double julian_gmt
Definition: Suntrajectory.h:84
virtual void getHorizontalCoordinates(double &azimuth, double &elevation, double &eccentricity) const =0
virtual void getHorizontalCoordinates(double &azimuth, double &elevation) const =0
virtual double getSolarElevation() const =0
double getRadiationOnHorizontal(const double &radiation) const
Definition: Suntrajectory.cc:73
double SunRightAscension
Definition: Suntrajectory.h:89
double getAngleOfIncidence(const double &slope_azi, const double &slope_elev) const
radiation projection methods
Definition: Suntrajectory.cc:54
Definition: Config.cc:31