Sun position calculation library. Adaptation of Hannes Hassler's Helios class.

Dependents:   sunTracker weather_station_proj weather_station_project weather_station_proj_v1_2

Committer:
acracan
Date:
Sun Jun 24 12:10:33 2018 +0000
Revision:
0:ad31da30ae64
Adaptation of Hannes Hassler's Helios class

Who changed what in which revision?

UserRevisionLine numberNew contents of line
acracan 0:ad31da30ae64 1 /*
acracan 0:ad31da30ae64 2 Helios.h - Library for calculating the solar
acracan 0:ad31da30ae64 3 position.
acracan 0:ad31da30ae64 4 Copyright (c) 2011 Hannes Hassler. All right reserved.
acracan 0:ad31da30ae64 5
acracan 0:ad31da30ae64 6 This library is free software; you can redistribute it and/or
acracan 0:ad31da30ae64 7 modify it under the terms of the GNU Lesser General Public
acracan 0:ad31da30ae64 8 License as published by the Free Software Foundation; either
acracan 0:ad31da30ae64 9 version 2.1 of the License, or (at your option) any later version.
acracan 0:ad31da30ae64 10
acracan 0:ad31da30ae64 11 This library is distributed in the hope that it will be useful,
acracan 0:ad31da30ae64 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
acracan 0:ad31da30ae64 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
acracan 0:ad31da30ae64 14 Lesser General Public License for more details.
acracan 0:ad31da30ae64 15
acracan 0:ad31da30ae64 16 You should have received a copy of the GNU Lesser General Public
acracan 0:ad31da30ae64 17 License along with this library; if not, write to the Free Software
acracan 0:ad31da30ae64 18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
acracan 0:ad31da30ae64 19 */
acracan 0:ad31da30ae64 20 #ifndef Helios_h
acracan 0:ad31da30ae64 21 #define Helios_h
acracan 0:ad31da30ae64 22
acracan 0:ad31da30ae64 23
acracan 0:ad31da30ae64 24 #include <math.h>
acracan 0:ad31da30ae64 25
acracan 0:ad31da30ae64 26 // Declaration of some constants
acracan 0:ad31da30ae64 27 #define pi 3.14159265358979323846
acracan 0:ad31da30ae64 28 #define twopi (2*pi)
acracan 0:ad31da30ae64 29 #define rad (pi/180)
acracan 0:ad31da30ae64 30 #define dEarthMeanRadius 6371.01 // In km
acracan 0:ad31da30ae64 31 #define dAstronomicalUnit 149597890 // In km
acracan 0:ad31da30ae64 32
acracan 0:ad31da30ae64 33
acracan 0:ad31da30ae64 34 class Helios
acracan 0:ad31da30ae64 35 {
acracan 0:ad31da30ae64 36 public:
acracan 0:ad31da30ae64 37 Helios(double latitude=47.15845, double longitude=27.60144, int tzOffset=0);
acracan 0:ad31da30ae64 38 void updatePosition();
acracan 0:ad31da30ae64 39 void setLocalLatitude(double latitude);
acracan 0:ad31da30ae64 40 void setLocalLongitude(double longitude);
acracan 0:ad31da30ae64 41 void setLocalTimeZoneOffset(int tzOffset);
acracan 0:ad31da30ae64 42 double azimuth();
acracan 0:ad31da30ae64 43 double elevation();
acracan 0:ad31da30ae64 44 private:
acracan 0:ad31da30ae64 45 int iTzOffset;
acracan 0:ad31da30ae64 46 double dLongitude;
acracan 0:ad31da30ae64 47 double dLatitude;
acracan 0:ad31da30ae64 48 double dCos_Latitude;
acracan 0:ad31da30ae64 49 double dSin_Latitude;
acracan 0:ad31da30ae64 50
acracan 0:ad31da30ae64 51 double dAzimuth;
acracan 0:ad31da30ae64 52 double dElevation;
acracan 0:ad31da30ae64 53 };
acracan 0:ad31da30ae64 54 #endif