summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--House.cpp5
-rw-r--r--House.h6
-rw-r--r--Sun.h23
3 files changed, 30 insertions, 4 deletions
diff --git a/House.cpp b/House.cpp
index d6d28c9..4b2d83c 100644
--- a/House.cpp
+++ b/House.cpp
@@ -1,7 +1,8 @@
#include "House.h"
-House::House (float inittemp0, int earthx0, int earthy0, int earthz0, float collectortemp0):
- collectortemp(collectortemp0) {
+House::House (float inittemp0, int earthx0, int earthy0, int earthz0, float collectortemp0,
+ float latitude0):
+ collectortemp(collectortemp0), latitude(latitude0) {
Temparray temp0(inittemp0, earthx0, earthy0, earthz0);
temp = temp0;
}
diff --git a/House.h b/House.h
index 8a4b325..67d90f2 100644
--- a/House.h
+++ b/House.h
@@ -2,6 +2,7 @@
#define _HOUSE_H_
#include "Temparray.h"
+#include "Sun.h"
#include "Triangle.h"
#include <list>
#include <math.h>
@@ -9,7 +10,8 @@
class House
{
public:
- House(float inittemp0, int earthx0, int earthy0, int earthz0, float collectortemp0);
+ House(float inittemp0, int earthx0, int earthy0, int earthz0, float collectortemp0,
+ float latitude0);
std::list<Triangle> getTriangles(){
std::list<Triangle> triangles = temp.getTriangles();
return triangles;
@@ -17,7 +19,7 @@ class House
private:
Temparray temp;
- float collectortemp;
+ float collectortemp, latitude;
};
#endif /* _HOUSE_H_ */
diff --git a/Sun.h b/Sun.h
new file mode 100644
index 0000000..218f7fa
--- /dev/null
+++ b/Sun.h
@@ -0,0 +1,23 @@
+#ifndef _SUN_H_
+#define _SUN_H_
+
+#include <math.h>
+
+class Sun
+{
+ public:
+ Sun(float latitude0): latitude(latitude0){};
+
+ float declination(int day) {return 23.4*sin(2*M_PI*(284+day)/365);}
+ float hourangle(float time) {return 15*(time-12);}
+ float evelationangle(int day, float time) {return asin(sin(declination(day)*M_PI/180)*
+ sin(latitude*M_PI/180)*
+ cos(hourangle(time)*M_PI/180)*
+ cos(declination(day)*M_PI/180)*
+ cos(latitude*M_PI/180))
+ *180/M_PI;}
+ private:
+ float latitude;
+};
+
+#endif /* _SUN_H_ */