diff options
-rw-r--r-- | DisplayClass.cpp | 2 | ||||
-rw-r--r-- | House.cpp | 22 | ||||
-rw-r--r-- | main.cpp | 4 |
3 files changed, 12 insertions, 16 deletions
diff --git a/DisplayClass.cpp b/DisplayClass.cpp index a031946..5f14a7f 100644 --- a/DisplayClass.cpp +++ b/DisplayClass.cpp @@ -33,7 +33,7 @@ void DisplayClass::renderScene(unsigned long delta, const Keyset &keys) { // static Temparray temp(20, x, y, z); - static House house(20, x, y, z, 100, 400, 53.55, 0.82, 2.82, 0.0047, 40, 45, 1900, 3, 11500); + static House house(20, x, y, z, 100, 300, 53.55, 0.82, 2.82, 0.0047, 40, 45, 1900, 4, 11500); triangles=house.getTriangles(); house.controller(); // temp.calcTemp(); @@ -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){ @@ -425,7 +425,7 @@ int main(int argc, char *argv[]) { GLint samples; glGetIntegerv(GL_SAMPLES, &samples); - std::cerr << "Using " << samples << " samples" << std::endl; +// std::cerr << "Using " << samples << " samples" << std::endl; bool running = true; @@ -540,7 +540,7 @@ int main(int argc, char *argv[]) { frames++; tocks += delta*1000; if(tocks > 1000000) { - std::cerr << frames << " fps; slept a total of " << slept << " ms" << std::endl; +// std::cerr << frames << " fps; slept a total of " << slept << " ms" << std::endl; frames = 0; tocks -= 1000000; slept = 0; |