summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorConstantin Riß <constantin.riss@dre.de>2010-02-07 16:52:50 +0100
committerConstantin Riß <constantin.riss@dre.de>2010-02-07 16:52:50 +0100
commitf53113f02ea5369e50bd33232db3d2b48f64cc1c (patch)
tree5aa4a0a5fb301a9bedd50cc1445c844fb3175210
parentabcf04bac0fe9b7b8358af6ed4e2f11d9bbb0fc8 (diff)
downloadc3d-f53113f02ea5369e50bd33232db3d2b48f64cc1c.tar
c3d-f53113f02ea5369e50bd33232db3d2b48f64cc1c.zip
Cuboid nicht benätigt und NOTNEEDED ordner hinzugefügt und Fehler behoben
-rw-r--r--CMakeLists.txt2
-rw-r--r--House.cpp44
-rw-r--r--NOTNEEDED/Cuboid.cpp (renamed from Cuboid.cpp)0
-rw-r--r--NOTNEEDED/Cuboid.h (renamed from Cuboid.h)0
-rw-r--r--NOTNEEDED/Verlauf.bmpbin0 -> 4070 bytes
-rw-r--r--Sun.cpp1
-rw-r--r--Sun.h24
-rw-r--r--main.cpp6
8 files changed, 41 insertions, 36 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8b7dd82..d68742c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,11 +8,11 @@ include_directories(${OPENGL_INCLUDE_DIR})
add_executable(c3d
BSPTree.cpp BSPTree.h
Cubehole.cpp Cubehole.h
- Cuboid.cpp Cuboid.h
DisplayClass.cpp DisplayClass.h
gl.h
House.h House.cpp
main.cpp
+ Sun.h Sun.cpp
Temparray.h Temparray.cpp
Trapezocube.cpp Trapezocube.h
Triangle.h
diff --git a/House.cpp b/House.cpp
index bf1724c..dca8d44 100644
--- a/House.cpp
+++ b/House.cpp
@@ -442,23 +442,26 @@ float x=0;
// end;
void House::calccollectoroutput(int day, int time, int month) {
- if(collectorstatus == TRANSVERSAL)
- collectoroutput = efficiencyvacuum[(int)(collectortemp-tempoutside[month][time]+0.5)]
- *anglecorrectiontransversal[(int)(fabs(sun.azimutangle(day, time)/2)+0.5)]
- *anglecorrectionlongitudinal[(int)(fabs(roofangle-sun.elevationangle(day, time))+0.5)]
- /**100*/;
- else if(collectorstatus == LONGITUDINAL)
- collectoroutput = efficiencyvacuum[(int)(collectortemp-tempoutside[month][time]+0.5)]
- *anglecorrectionlongitudinal[(int)(fabs(sun.azimutangle(day, time)/2)+0.5)]
- *anglecorrectiontransversal[(int)(fabs(roofangle-sun.elevationangle(day, time))+0.5)]
- /**100*/;
- else if(collectorstatus == FLAT)
- collectoroutput = efficiencyflat[(int)(collectortemp-tempoutside[month][time]+0.5)]
- *anglecorrectionflat[(int)(fabs(sun.azimutangle(day, time)/2)+0.5)]
- *anglecorrectionflat[(int)(fabs(roofangle-sun.elevationangle(day, time))+0.5)]
- /**100*/;
-
- collectoroutput = collectoroutput*collectorarea*radiation;
+ if(sun.elevationangle(day, time) >= 0){
+ if(collectorstatus == TRANSVERSAL)
+ collectoroutput = efficiencyvacuum[(int)(collectortemp-tempoutside[month][time]+0.5)]
+ *anglecorrectiontransversal[(int)(fabs(sun.azimutangle(day, time)/2)+0.5)]
+ *anglecorrectionlongitudinal[(int)(fabs(roofangle-sun.elevationangle(day, time))+0.5)]
+ /**100*/;
+ else if(collectorstatus == LONGITUDINAL)
+ collectoroutput = efficiencyvacuum[(int)(collectortemp-tempoutside[month][time]+0.5)]
+ *anglecorrectionlongitudinal[(int)(fabs(sun.azimutangle(day, time)/2)+0.5)]
+ *anglecorrectiontransversal[(int)(fabs(roofangle-sun.elevationangle(day, time))+0.5)]
+ /**100*/;
+ else if(collectorstatus == FLAT)
+ collectoroutput = efficiencyflat[(int)(collectortemp-tempoutside[month][time]+0.5)]
+ *anglecorrectionflat[(int)(fabs(sun.azimutangle(day, time)/2)+0.5)]
+ *anglecorrectionflat[(int)(fabs(roofangle-sun.elevationangle(day, time))+0.5)]
+ /**100*/;
+
+ collectoroutput = collectoroutput*collectorarea*radiation;
+ }
+ else collectoroutput = 0;
}
void House::calcprobeinput(int day, int time, int month) {
@@ -468,12 +471,13 @@ void House::calcprobeinput(int day, int time, int month) {
if(E>=collectoroutput && collectoroutput>0) {E -= collectoroutput; collectoroutput=0;}
else if(E<collectoroutput && collectoroutput>0) {collectoroutput -= E; E=0;}*/
calccollectoroutput(day, time, month);
- std::cout << collectoroutput << std::endl;
+ std::cerr << "Time: " << time << " Output: " << collectoroutput << " Watt" << std::endl;
+// std::cerr << sun.elevationangle(day, time) << std::endl;
collectoroutput-=neededenergy[month][time];
}
void House::controller(){
- static int day=90, time=0, month=0;
+ static int day=0, time=0, month=0;
calcprobeinput(day, time, month);
temp.setprobetemp(collectortemp);
temp.setinput(collectoroutput);
@@ -481,7 +485,7 @@ void House::controller(){
++time;
if(time > 23){
-// std::cerr << day << " " << temp.getaverage() << std::endl;
+ std::cerr << day << " " << temp.getaverage() << std::endl;
time = 0;
++day;
}
diff --git a/Cuboid.cpp b/NOTNEEDED/Cuboid.cpp
index 5afae93..5afae93 100644
--- a/Cuboid.cpp
+++ b/NOTNEEDED/Cuboid.cpp
diff --git a/Cuboid.h b/NOTNEEDED/Cuboid.h
index d1c600d..d1c600d 100644
--- a/Cuboid.h
+++ b/NOTNEEDED/Cuboid.h
diff --git a/NOTNEEDED/Verlauf.bmp b/NOTNEEDED/Verlauf.bmp
new file mode 100644
index 0000000..83c0c23
--- /dev/null
+++ b/NOTNEEDED/Verlauf.bmp
Binary files differ
diff --git a/Sun.cpp b/Sun.cpp
new file mode 100644
index 0000000..158abbc
--- /dev/null
+++ b/Sun.cpp
@@ -0,0 +1 @@
+#include "Sun.h"
diff --git a/Sun.h b/Sun.h
index a242e5f..6fc7857 100644
--- a/Sun.h
+++ b/Sun.h
@@ -12,26 +12,24 @@ class Sun
void setlatitude(float latitude0){latitude=latitude0;};
float declination(int day) {return 23.4*sin(2*M_PI*(284+day+1)/365);}
- float hourangle(int time) {return 15*(time+1/*-12*/);}
+ float hourangle(int time) {return 15*(time+1-12);}
float elevationangle(int day, int time) {
return asin(sin(declination(day)*M_PI/180)*
- sin(latitude*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;
+ cos(latitude*M_PI/180))*180/M_PI;
}
float azimutangle(int day, int time){
- float tau, sin_tau, cos_tau, sin_phi, cos_phi, tan_dec;
+ float tau = hourangle(time)*M_PI/180;
+ float sin_tau = sin(tau);
+ float cos_tau = cos(tau);
+ float sin_phi = sin(latitude*M_PI/180);
+ float cos_phi = cos(latitude*M_PI/180);
+ float tan_dek = tan(declination(day)*M_PI/180);
- tan_dec = tan(declination(day)*M_PI/180);
- tau = hourangle(time)*M_PI/180;
- sin_tau = sin(tau);
- cos_tau = cos(tau);
- sin_phi = sin(latitude*M_PI/180);
- cos_phi = cos(latitude*M_PI/180);
-
- return atan2(sin_tau, cos_tau*sin_phi-tan_dec*cos_phi)/180*M_PI;
+ return atan2(sin_tau, cos_tau*sin_phi-tan_dek*cos_phi)*180/M_PI;
+// return asin(cos(declination(day))*sin(elevationangle(day, time))/cos(hourangle(time)));
}
private:
float latitude;
diff --git a/main.cpp b/main.cpp
index 8658424..32206e8 100644
--- a/main.cpp
+++ b/main.cpp
@@ -14,8 +14,10 @@
#define MIN_FRAME_DELTA 16
//#define MIN_FRAME_DELTA 41
-#define DEFAULT_WIDTH 640
-#define DEFAULT_HEIGHT 640
+//#define DEFAULT_WIDTH 640
+//#define DEFAULT_HEIGHT 640
+#define DEFAULT_HEIGHT 40
+#define DEFAULT_WIDTH 40
void initGL(bool multisample);
void resize(int width, int height);