summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorConstantin Riß <constantin.riss@dre.de>2010-02-11 23:49:11 +0100
committerConstantin Riß <constantin.riss@dre.de>2010-02-11 23:49:11 +0100
commitf5d99faa32348c34d48035a3e3be91ec440c595a (patch)
tree641496d56c6715b6e55cd32b73218e20edd5ea31
parent9952a2ccbeb288cd12d96c405441bef0215d13db (diff)
downloadc3d-f5d99faa32348c34d48035a3e3be91ec440c595a.tar
c3d-f5d99faa32348c34d48035a3e3be91ec440c595a.zip
blablalbaHEADmaster
-rw-r--r--DisplayClass.cpp2
-rw-r--r--House.cpp22
-rw-r--r--main.cpp4
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();
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){
diff --git a/main.cpp b/main.cpp
index a786e85..88363a5 100644
--- a/main.cpp
+++ b/main.cpp
@@ -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;