-
Notifications
You must be signed in to change notification settings - Fork 4
/
Sun.hpp
86 lines (69 loc) · 4.03 KB
/
Sun.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*-------------------------------------------------------------------------------*/
/* SOLAR - The solar thermal power plant simulator */
/* https://github.com/bbopt/solar */
/* */
/* Miguel Diago, Sebastien Le Digabel, Mathieu Lemyre-Garneau, Bastien Talgorn */
/* */
/* Polytechnique Montreal / GERAD */
/* sebastien.le-digabel@polymtl.ca */
/* */
/* This program is free software: you can redistribute it and/or modify it */
/* under the terms of the GNU Lesser General Public License as published by */
/* the Free Software Foundation, either version 3 of the License, or (at your */
/* option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, but WITHOUT */
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */
/* for more details. */
/* */
/* You should have received a copy of the GNU Lesser General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*-------------------------------------------------------------------------------*/
#ifndef __SUN_H__
#define __SUN_H__
#include "Time_Manager.hpp"
#include "Sunray.hpp"
#include "RNG.hpp"
#include <vector>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <fstream>
class Sun {
private:
double _latitude;
long double _elevation;
long double _azimuth;
double _raysPerSquareMeters;
Time_Manager _time;
int _day;
double _sunDeclination;
std::vector<Sunray*> _listOfSunrays;
public:
Sun ( double latitude, const Time_Manager & time, int day, double raysPerSquareMeters ) :
_latitude ( latitude ) ,
_elevation ( 0.0 ) ,
_azimuth ( 0.0 ) ,
_raysPerSquareMeters ( raysPerSquareMeters ) ,
_time ( time ) ,
_day ( day ) ,
_sunDeclination ( DECLINATION * DEG_TO_RAD * sin((360 * (_day + 284) / 365)*DEG_TO_RAD) ) { fComputeSunPosition(); }
Sun ( const Sun & sun);
~Sun ( void );
void fComputeSunPosition ( void );
void fAddNewSunray ( double Rmax, double thetaMax, double Z );
double get_elevation ( void ) const { return _elevation; }
double get_azimuth ( void ) const { return _azimuth; }
double get_raysPerSquareMeters ( void ) const { return _raysPerSquareMeters; }
void fTimeIncrement ( void ) { _time.fTimeIncrement(); }
void fResetTime ( void ) { _time.fResetTime(); }
int get_incrementsCounter ( void ) const { return _time.get_incrementsCounter (); }
int get_numberOfIncrements ( void ) const { return _time.get_numberOfIncrements(); }
void projectTarget ( int i ) { _listOfSunrays[i]->projectTarget(); }
void set_isIntercepted ( int i, bool b ) { _listOfSunrays[i]->set_isIntercepted(b); }
bool computeCollision ( int i, const Heliostat & h ) { return _listOfSunrays[i]->computeCollision(h); }
size_t get_nb_sunrays ( void ) const { return _listOfSunrays.size(); }
};
#endif