summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorConstantin Riß <constantin.riss@dre.de>2010-02-04 19:09:28 +0100
committerConstantin Riß <constantin.riss@dre.de>2010-02-04 19:09:28 +0100
commitf53795458ddf252d08979820a98697cca9327834 (patch)
tree24499155d0e560dc96ecd7b80a0dd001dc4372ed
parenta16b094f23f9d664ec71544b7ef9ff487101af7d (diff)
downloadc3d-f53795458ddf252d08979820a98697cca9327834.tar
c3d-f53795458ddf252d08979820a98697cca9327834.zip
ungewolltes schauspiel...
-rw-r--r--House.cpp1
-rw-r--r--Temparray.cpp95
-rw-r--r--Temparray.h2
-rw-r--r--main.cpp4
4 files changed, 68 insertions, 34 deletions
diff --git a/House.cpp b/House.cpp
index 9ea0a1e..c5dc37b 100644
--- a/House.cpp
+++ b/House.cpp
@@ -480,6 +480,7 @@ void House::controller(){
++time;
if(time > 23){
+ std::cerr << day << std::endl;
time = 0;
++day;
}
diff --git a/Temparray.cpp b/Temparray.cpp
index d2379f2..f2c8fb8 100644
--- a/Temparray.cpp
+++ b/Temparray.cpp
@@ -113,6 +113,65 @@ void Temparray::calcTemp(){
}
}
}
+ for(int h = 0; h < 10; ++h) {
+ for(int i = 0; i < sx; ++i) {
+ for(int j = 0; j < sy; ++j) {
+ for(int k = 0; k < sz; ++k) {
+ for(int l = 0; l < 6; ++l) {
+ for(int m = 0; m < 4; m++) {
+ width = cubehole(i, j, k, l).getWidth();
+ height = cubehole(i, j, k, l).getHeight();
+ depth = cubehole(i, j, k, l).getDepth();
+ innerwidth = cubehole(i, j, k, l).getInnerWidth();
+ innerdepth = cubehole(i, j, k, l).getInnerDepth();
+
+ if(m % 2 == 0)area = (((depth - innerdepth)/2)*((width + innerwidth)/2))
+ / 0.9 * meterperunit;
+ if(m % 2 == 1)area = (((width - innerwidth)/2)*((depth + innerdepth)/2))
+ / 0.9 * meterperunit;
+
+ if(m % 2 == 0)thermalresistance = ((depth - innerdepth)/2)
+ /0.9 * meterperunit /(conductivity * area);
+ if(m % 2 == 1)thermalresistance = ((width - innerwidth)/2)
+ /0.9 * meterperunit /(conductivity * area);
+
+ if(m % 2 == 0)capacity = specificcapacity *((((depth - innerdepth)/2)*
+ ((width + innerwidth)/2)*height)
+ / 0.9 * meterperunit);
+ if(m % 2 == 1)capacity = specificcapacity *((((width - innerwidth)/2)*
+ ((depth + innerdepth)/2)*height)
+ / 0.9 * meterperunit);
+
+ loadableenergy = (probetemp - temperatureold(i, j, k, l, m))/thermalresistance/10;
+ unloadableenergy = (temperatureold(i, j, k, l, m)-21.5)/thermalresistance/10;
+
+ tau12 = capacity * thermalresistance;
+
+ if(input>=0){
+ if(loadableenergy <= 0)
+ inputpower = 0;
+ else if (input >= loadableenergy) {
+ inputpower = loadableenergy;
+ input -= loadableenergy;
+ }
+ else if (input <= loadableenergy) {
+ inputpower = input;
+ input = 0;
+ }
+ if(inputpower > 0) {
+ factor = inputpower/loadableenergy;
+ temperaturenew(i, j, k, l, m) =
+ temperaturenew(i, j, k, l, m) + (probetemp-temperatureold(i, j, k, l, m))
+ *thermalresistance*factor*(1-exp(-(1/tau12)));
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
for(int i = 0; i < sx; ++i) {
for(int j = 0; j < sy; ++j) {
for(int k = 0; k < sz; ++k) {
@@ -124,32 +183,6 @@ void Temparray::calcTemp(){
innerwidth = cubehole(i, j, k, l).getInnerWidth();
innerdepth = cubehole(i, j, k, l).getInnerDepth();
- if(m % 2 == 0)area = (((depth - innerdepth)/2)*((width + innerwidth)/2))
- / 0.9 * meterperunit;
- if(m % 2 == 1)area = (((width - innerwidth)/2)*((depth + innerdepth)/2))
- / 0.9 * meterperunit;
-
- if(m % 2 == 0)thermalresistance = ((depth - innerdepth)/2)
- /0.9 * meterperunit /(conductivity * area);
- if(m % 2 == 1)thermalresistance = ((width - innerwidth)/2)
- /0.9 * meterperunit /(conductivity * area);
-
- if(m % 2 == 0)capacity = specificcapacity *((((depth - innerdepth)/2)*
- ((width + innerwidth)/2)*height)
- / 0.9 * meterperunit);
- if(m % 2 == 1)capacity = specificcapacity *((((width - innerwidth)/2)*
- ((depth + innerdepth)/2)*height)
- / 0.9 * meterperunit);
-
- loadableenergy = (probetemp - temperatureold(i, j, k, l, m))/thermalresistance/10;
- unloadableenergy = (temperatureold(i, j, k, l, m)-21.5)/thermalresistance/10;
-
- tau12 = capacity * thermalresistance;
-
- temperaturenew(i, j, k, l, m) =
- temperaturenew(i, j, k, l, m) - ((temperatureold(i, j, k, l, m) - probetemp)
- *(1-exp(-(1/tau12))));
-
if(j > 0) {
width2 = cubehole(i, j-1, k, l).getWidth();
height2 = cubehole(i, j-1, k, l).getHeight();
@@ -405,7 +438,7 @@ void Temparray::calcTemp(){
mergetemperature();
coloring();
// std::cerr << temperaturenew(2, 2, 2, 1, 2) << std::endl;
-// std::cerr << temperaturenew(2, 2, 2, 2, 2) << std::endl;
+ std::cerr << temperaturenew(2, 2, 2, 2, 2) << std::endl;
// std::cerr << temperaturenew(2, 2, 2, 3, 2) << "\n" << std::endl;
// std::cerr << " " << temperatureold(2, 2, 2, 1, 2) << std::endl;
// std::cerr << temperatureold(2, 2, 2, 2, 1) << " " << temperatureold(2, 2, 2, 2, 2) << " " << temperatureold(2, 2, 2, 2, 3) << std::endl;
@@ -435,11 +468,11 @@ void Temparray::coloring() {
for(int k=0; k<sz; ++k){
for(int l=0; l<6; ++l){
for(int m=0; m<4; ++m){
- if(temperatureold(i, j, k, l, m) >= 25 ) b[m]=0;
- else b[m]=(25-temperatureold(i, j, k, l, m))/25;
- g[m]=fabs((25-temperatureold(i, j, k, l, m))/25);
+ if(temperatureold(i, j, k, l, m) >= 50 ) b[m]=0;
+ else b[m]=1/(50-temperatureold(i, j, k, l, m));
+ g[m]=fabs(1/(50-temperatureold(i, j, k, l, m)));
if(temperatureold(i, j, k, l, m) <= 25 ) r[m]=0;
- else r[m]=(100-temperatureold(i, j, k, l, m))/25;
+ else r[m]=1/(100-temperatureold(i, j, k, l, m));
}
cubehole(i, j, k, l).setColor(vmml::vec4f(r[0], g[0], b[0], 1.0),
vmml::vec4f(r[1], g[1], b[1], 1.0),
diff --git a/Temparray.h b/Temparray.h
index 15eb696..ac96c04 100644
--- a/Temparray.h
+++ b/Temparray.h
@@ -30,7 +30,7 @@ class Temparray
float *temparrayold, *temparraynew;
Cubehole *cubearray;
int sx, sy, sz;
- float averagetemp, earthtemp, probetemp, input;
+ float averagetemp, earthtemp, probetemp, input, inputpower, factor;
Cubehole& cubehole(int x, int y, int z, int line) {
return cubearray[x*sy*sz*6 + y*sz*6 + z*6 + line];
diff --git a/main.cpp b/main.cpp
index 45a9c88..f2c7ddb 100644
--- a/main.cpp
+++ b/main.cpp
@@ -11,8 +11,8 @@
#include <unistd.h>
#endif
-//#define MIN_FRAME_DELTA 16
-#define MIN_FRAME_DELTA 41
+#define MIN_FRAME_DELTA 16
+//#define MIN_FRAME_DELTA 41
#define DEFAULT_WIDTH 640
#define DEFAULT_HEIGHT 640