MeteoIODoc  MeteoIODoc-2.6.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Sun.h
Go to the documentation of this file.
1 /***********************************************************************************/
2 /* Copyright 2009 WSL Institute for Snow and Avalanche Research SLF-DAVOS */
3 /***********************************************************************************/
4 /* This file is part of MeteoIO.
5  MeteoIO is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  MeteoIO is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with MeteoIO. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef SUN_H
19 #define SUN_H
20 
22 
23 namespace mio {
24 
35 class SunObject {
36  public:
38  typedef enum POSITION_ALGO {
40  } position_algo;
41 
42  SunObject(const position_algo alg=MEEUS);
43  SunObject(const double& i_latitude, const double& i_longitude, const double& i_altitude);
44  SunObject(const double& i_latitude, const double& i_longitude, const double& i_altitude, const double& i_julian, const double& i_TZ=0.);
45 
46  //local julian date and timezone
47  void setDate(const double& i_julian, const double& i_TZ=0.);
48  void setLatLon(const double& i_latitude, const double& i_longitude, const double& i_altitude);
49  void resetAltitude(const double& i_altitude);
50  void setElevationThresh(const double& i_elevation_threshold);
51 
52  void calculateRadiation(const double& ta, const double& rh, double pressure, const double& ground_albedo);
53  void calculateRadiation(const double& ta, const double& rh, const double& mean_albedo);
54  void getBeamRadiation(double& R_toa, double& R_direct, double& R_diffuse) const;
55  void getHorizontalRadiation(double& R_toa, double& R_direct, double& R_diffuse) const;
56  void getSlopeRadiation(const double& slope_azi, const double& slope_elev, double& R_toa, double& R_direct, double& R_diffuse) const;
57  double getElevationThresh() const {return elevation_threshold;}
58 
59  double getSplittingBoland(const double& iswr_modeled, const double& iswr_measured, const double& t) const;
60  double getSplitting(const double& iswr_modeled, const double& iswr_measured) const;
61  double getSplitting(const double& iswr_measured) const;
62  double getCorrectionFactor(const double& iswr_measured, double &Md, bool &day, bool &night) const;
63  double getCorrectionFactor(const double& iswr_measured) const;
64 
65  double getJulian(const double& o_TZ) const {return (julian_gmt+o_TZ*1./24.);}
66  const std::string toString() const;
67 
68  //SunTrajectory position;
70  static const double elevation_dftlThreshold, rad_threshold;
71 
72  private:
73  void getBeamPotential(const double& sun_elevation, const double& Eccentricity_corr,
74  const double& ta, const double& rh, const double& pressure, const double& mean_albedo,
75  double& R_toa, double& R_direct, double& R_diffuse) const;
76  void getClearSky(const double& sun_elevation, const double& R_toa,
77  const double& ta, const double& rh, const double& pressure, const double& ground_albedo,
78  double& R_direct, double& R_diffuse) const;
79 
80  private:
81  double julian_gmt, TZ;
82  double latitude, longitude, altitude;
83  double elevation_threshold;
84  double beam_toa, beam_direct, beam_diffuse;
85 };
86 
87 } //end namespace
88 
89 #endif
static const double rad_threshold
Definition: Sun.h:70
double getSplitting(const double &iswr_modeled, const double &iswr_measured) const
Evaluate the splitting coefficient between direct and diffuse components of the incoming short wave r...
Definition: Sun.cc:302
void resetAltitude(const double &i_altitude)
Definition: Sun.cc:97
void setElevationThresh(const double &i_elevation_threshold)
Definition: Sun.cc:107
void setLatLon(const double &i_latitude, const double &i_longitude, const double &i_altitude)
Definition: Sun.cc:71
double getJulian(const double &o_TZ) const
Definition: Sun.h:65
Jean Meeus' algorithm (Meeus, j. "Astronomical Algorithms", second edition, 1998, Willmann-Bell...
Definition: Sun.h:39
void getBeamRadiation(double &R_toa, double &R_direct, double &R_diffuse) const
Definition: Sun.cc:267
double getElevationThresh() const
Definition: Sun.h:57
SunObject(const position_algo alg=MEEUS)
Definition: Sun.cc:35
position_algo
this enum provides the different position algorithms available
Definition: Sun.h:38
void getHorizontalRadiation(double &R_toa, double &R_direct, double &R_diffuse) const
Definition: Sun.cc:275
double getSplittingBoland(const double &iswr_modeled, 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:354
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:418
void setDate(const double &i_julian, const double &i_TZ=0.)
Definition: Sun.cc:53
A class to calculate Solar radiation characteristics This is largely based on M. Iqbal, "An introduction to solar radiation", 1983, Academic Press, ISBN: 0-12-373750-8. The Sun's position is provided by the SunTrajectory class (currently the only implemented algorithm is Meeus). All units are SI. See http://www.meteoexploration.com/products/solarcalc.php for a validation calculator.
Definition: Sun.h:35
void calculateRadiation(const double &ta, const double &rh, double pressure, const double &ground_albedo)
Definition: Sun.cc:113
const std::string toString() const
Definition: Sun.cc:441
static const double elevation_dftlThreshold
Definition: Sun.h:70
void getSlopeRadiation(const double &slope_azi, const double &slope_elev, double &R_toa, double &R_direct, double &R_diffuse) const
Definition: Sun.cc:283
SunMeeus position
Definition: Sun.h:69
Calculate the Sun's position based on the Meeus algorithm. See J. Meeus, "Astronomical Algorithms"...
Definition: Suntrajectory.h:103