MeteoIODoc 2.11.0
Sun.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 SUN_H
20#define SUN_H
21
24
25namespace mio {
26
37class SunObject {
38 public:
40 typedef enum POSITION_ALGO {
41 MEEUS
43
45 SunObject(const double& i_latitude, const double& i_longitude, const double& i_altitude);
46 SunObject(const double& i_latitude, const double& i_longitude, const double& i_altitude, const double& i_julian, const double& i_TZ=0.);
47
48 //local julian date and timezone
49 void setDate(const double& i_julian, const double& i_TZ=0.);
50 void setDate(const Date& date) {julian_gmt=date.getJulian(false); TZ=date.getTimeZone();}
51 void setLatLon(const double& i_latitude, const double& i_longitude, const double& i_altitude);
52 void resetAltitude(const double& i_altitude);
53 void setElevationThresh(const double& i_elevation_threshold);
54
55 void calculateRadiation(const double& ta, const double& rh, double pressure, const double& ground_albedo);
56 void calculateRadiation(const double& ta, const double& rh, const double& mean_albedo);
57 void getBeamRadiation(double& R_toa, double& R_direct, double& R_diffuse) const;
58 void getHorizontalRadiation(double& R_toa, double& R_direct, double& R_diffuse) const;
59 void getSlopeRadiation(const double& slope_azi, const double& slope_elev, double& R_toa, double& R_direct, double& R_diffuse) const;
60 double getElevationThresh() const {return elevation_threshold;}
61
62 double getSplittingBoland(const double& toa_h, const double& iswr_measured, const double& t) const;
63 double getSplitting(const double& toa_h, const double& iswr_measured) const;
64 double getSplitting(const double& iswr_measured) const;
65 double getCorrectionFactor(const double& iswr_measured, double &Md, bool &day, bool &night) const;
66 double getCorrectionFactor(const double& iswr_measured) const;
67
68 double getJulian(const double& o_TZ) const {return (julian_gmt+o_TZ*1./24.);}
69 Date getDate() const {return Date(julian_gmt, TZ);}
70 const std::string toString() const;
71
72 //SunTrajectory position;
75
76 private:
77 void getBeamPotential(const double& sun_elevation, const double& Eccentricity_corr,
78 const double& ta, const double& rh, const double& pressure, const double& mean_albedo,
79 double& R_toa, double& R_direct, double& R_diffuse) const;
80 void getClearSky(const double& sun_elevation, const double& R_toa,
81 const double& ta, const double& rh, const double& pressure, const double& ground_albedo,
82 double& R_direct, double& R_diffuse) const;
83
84 private:
85 double julian_gmt, TZ;
86 double latitude, longitude, altitude;
87 double elevation_threshold;
88 double beam_toa, beam_direct, beam_diffuse;
89};
90
91} //end namespace
92
93#endif
A class to handle timestamps. This class handles conversion between different time display formats (I...
Definition: Date.h:87
double getTimeZone() const
Returns timezone.
Definition: Date.cc:401
double getJulian(const bool &gmt=false) const
Return julian date (JD). The julian date is defined as the fractional number of days since -4713-01-0...
Definition: Date.cc:414
Calculate the Sun's position based on the Meeus algorithm. See J. Meeus, "Astronomical Algorithms",...
Definition: Suntrajectory.h:107
A class to calculate Solar radiation characteristics This is largely based on M. Iqbal,...
Definition: Sun.h:37
SunObject(const SunObject::position_algo &alg=MEEUS)
Definition: Sun.cc:36
Date getDate() const
Definition: Sun.h:69
double getJulian(const double &o_TZ) const
Definition: Sun.h:68
void setDate(const double &i_julian, const double &i_TZ=0.)
Definition: Sun.cc:54
void resetAltitude(const double &i_altitude)
Definition: Sun.cc:98
double getSplitting(const double &toa_h, const double &iswr_measured) const
Evaluate the splitting coefficient between direct and diffuse components of the incoming short wave r...
Definition: Sun.cc:306
void getBeamRadiation(double &R_toa, double &R_direct, double &R_diffuse) const
Definition: Sun.cc:271
position_algo
this enum provides the different position algorithms available
Definition: Sun.h:40
@ MEEUS
Jean Meeus' algorithm (Meeus, j. "Astronomical Algorithms", second edition, 1998, Willmann-Bell,...
Definition: Sun.h:41
void setLatLon(const double &i_latitude, const double &i_longitude, const double &i_altitude)
Definition: Sun.cc:72
static const double elevation_dftlThreshold
Definition: Sun.h:74
double getElevationThresh() const
Definition: Sun.h:60
void calculateRadiation(const double &ta, const double &rh, double pressure, const double &ground_albedo)
Definition: Sun.cc:114
static const double rad_threshold
Definition: Sun.h:74
double getCorrectionFactor(const double &iswr_measured, double &Md, bool &day, bool &night) const
Evaluate an atmospheric losses factor. This correction factor is evaluated by comparing the global po...
Definition: Sun.cc:422
void getSlopeRadiation(const double &slope_azi, const double &slope_elev, double &R_toa, double &R_direct, double &R_diffuse) const
Definition: Sun.cc:287
double getSplittingBoland(const double &toa_h, const double &iswr_measured, const double &t) const
Evaluate the splitting coefficient between direct and diffuse components of the incoming short wave r...
Definition: Sun.cc:358
void setElevationThresh(const double &i_elevation_threshold)
Definition: Sun.cc:108
void getHorizontalRadiation(double &R_toa, double &R_direct, double &R_diffuse) const
Definition: Sun.cc:279
SunMeeus position
Definition: Sun.h:73
const std::string toString() const
Definition: Sun.cc:445
void setDate(const Date &date)
Definition: Sun.h:50
Definition: Config.cc:31