summaryrefslogtreecommitdiffstats
path: root/House.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'House.cpp')
-rw-r--r--House.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/House.cpp b/House.cpp
index 2242c53..f0de7ba 100644
--- a/House.cpp
+++ b/House.cpp
@@ -85,7 +85,7 @@ void House::calcefficiency() {
b = y[9];
ioffset = 90;
}
- efficiencyflat[i] = a*(i-ioffset)+b;
+ efficiencyflat[i] = fabs(a*(i-ioffset)+b);
}
for(int i=0; i<11; ++i){y[i] = eta0 - (k1/radiation)*i*10 - (k2/radiation)*i*i*100;}
@@ -141,7 +141,7 @@ void House::calcefficiency() {
b = y[9];
ioffset = 90;
}
- efficiencyvacuum[i] = a*(i-ioffset)+b;
+ efficiencyvacuum[i] = fabs(a*(i-ioffset)+b);
}
anglecorrectiontransversal[0] = 1;
anglecorrectiontransversal[1] = 0.998;
@@ -365,7 +365,7 @@ void House::calctemp() {
for(int i=0; i<12; ++i) {
for(int j=0; j<24; ++j) {
tempoutside[i][j] = ((temperatureday[i]-temperaturenight[i])/2)*
- (cos(((j-12)/24)*2*M_PI)+1)+temperaturenight[i];
+ (cos(((float)(j-12)/24)*2*M_PI)+1)+temperaturenight[i];
}
}
tempinside[0] = 18;
@@ -447,6 +447,7 @@ void House::calccollectoroutput(int day, int time, int month) {
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)]
@@ -458,32 +459,27 @@ void House::calccollectoroutput(int day, int time, int month) {
*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) {
- /*static float E;
- calccollectoroutput(day, time, month);
- if(time == 0) E = neededenergy[month][time];
- if(E>=collectoroutput && collectoroutput>0) {E -= collectoroutput; collectoroutput=0;}
- else if(E<collectoroutput && collectoroutput>0) {collectoroutput -= E; E=0;}*/
calccollectoroutput(day, time, month);
-// std::cerr << "Time: " << time << " Output: " << collectoroutput << " Watt" << std::endl;
-// std::cerr << sun.elevationangle(day, time) << std::endl;
collectoroutput-=neededenergy[month][time];
+// std::cerr << sun.azimutangle(day, time) << std::endl;
}
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);
temp.calcTemp();
- std::cerr << day << " " << time << " " << temp.getaverage() << std::endl;
+ //std::cerr << day << " " << time << " " << temp.getaverage() << std::endl;
+ std::cerr << "Time: " << time << " Day of Year: " << day+1 << " Month: " << month+1 << " Output: " << collectoroutput << " Watt" << std::endl;
++time;
if(time > 23){