diff options
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | House.cpp | 44 | ||||
-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.bmp | bin | 0 -> 4070 bytes | |||
-rw-r--r-- | Sun.cpp | 1 | ||||
-rw-r--r-- | Sun.h | 24 | ||||
-rw-r--r-- | main.cpp | 6 |
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 @@ -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 Binary files differnew file mode 100644 index 0000000..83c0c23 --- /dev/null +++ b/NOTNEEDED/Verlauf.bmp @@ -0,0 +1 @@ +#include "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; @@ -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); |