summaryrefslogtreecommitdiffstats
path: root/House.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'House.cpp')
-rw-r--r--House.cpp44
1 files changed, 24 insertions, 20 deletions
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;
}