summaryrefslogtreecommitdiffstats
path: root/House.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'House.cpp')
-rw-r--r--House.cpp389
1 files changed, 386 insertions, 3 deletions
diff --git a/House.cpp b/House.cpp
index 4b2d83c..82e114a 100644
--- a/House.cpp
+++ b/House.cpp
@@ -1,8 +1,391 @@
#include "House.h"
-House::House (float inittemp0, int earthx0, int earthy0, int earthz0, float collectortemp0,
- float latitude0):
- collectortemp(collectortemp0), latitude(latitude0) {
+House::House(float inittemp0, int earthx0, int earthy0, int earthz0, float collectortemp0,
+ float radiation0, float latitude0, float eta00, float k10, float k20, float collectorarea0,
+ float watthoursperhuman0, int humans0):
+ collectortemp(collectortemp0), latitude(latitude0), radiation(radiation0), eta0(eta00),
+ k1(k10), k2(k20), watthoursperhuman(watthoursperhuman0), humans(humans0),
+ collectorarea(collectorarea0){
Temparray temp0(inittemp0, earthx0, earthy0, earthz0);
temp = temp0;
+ calcefficiency();
+ calctemp();
+}
+
+void House::calcefficiency() {
+ int ioffset;
+ float x[11], y[11], a, b, j;
+
+ for(int i=0; i<11; ++i) x[i] = i*10;
+
+ y[0] = 0.755;
+ y[1] = 0.695;
+ y[2] = 0.635;
+ y[3] = 0.575;
+ y[4] = 0.523;
+ y[5] = 0.468;
+ y[6] = 0.404;
+ y[7] = 0.34;
+ y[8] = 0.282;
+ y[9] = 0.222;
+ y[10] = 0.155;
+
+ for(int i=0; i<100; ++i) {
+ if(i >= x[0] && i < x[1]) {
+ a = (y[1]-y[0])/10;
+ b = y[0];
+ ioffset = 0;
+ }
+ if(i >= x[1] && i < x[2]) {
+ a = (y[2]-y[1])/10;
+ b = y[1];
+ ioffset = 10;
+ }
+ if(i >= x[2] && i < x[3]) {
+ a = (y[3]-y[2])/10;
+ b = y[2];
+ ioffset = 20;
+ }
+ if(i >= x[3] && i < x[4]) {
+ a = (y[4]-y[3])/10;
+ b = y[3];
+ ioffset = 30;
+ }
+ if(i >= x[4] && i < x[5]) {
+ a = (y[5]-y[4])/10;
+ b = y[4];
+ ioffset = 40;
+ }
+ if(i >= x[5] && i < x[6]) {
+ a = (y[6]-y[5])/10;
+ b = y[5];
+ ioffset = 50;
+ }
+ if(i >= x[6] && i < x[7]) {
+ a = (y[7]-y[6])/10;
+ b = y[6];
+ ioffset = 60;
+ }
+ if(i >= x[7] && i < x[8]) {
+ a = (y[8]-y[7])/10;
+ b = y[7];
+ ioffset = 70;
+ }
+ if(i >= x[8] && i < x[9]) {
+ a = (y[9]-y[8])/10;
+ b = y[8];
+ ioffset = 80;
+ }
+ if(i >= x[9] && i < x[10]) {
+ a = (y[10]-y[9])/10;
+ b = y[9];
+ ioffset = 90;
+ }
+ efficiencyflat[i] = a*(i-ioffset)+b;
+ }
+
+ for(int i=0; i<11; ++i){y[i] = eta0 - (k1/radiation)*i*10 - (k2/radiation)*i*i*100;}
+
+ for(int i=0; i<100; ++i) {
+ if(i >= x[0] && i < x[1]) {
+ a = (y[1]-y[0])/10;
+ b = y[0];
+ ioffset = 0;
+ }
+ if(i >= x[1] && i < x[2]) {
+ a = (y[2]-y[1])/10;
+ b = y[1];
+ ioffset = 10;
+ }
+ if(i >= x[2] && i < x[3]) {
+ a = (y[3]-y[2])/10;
+ b = y[2];
+ ioffset = 20;
+ }
+ if(i >= x[3] && i < x[4]) {
+ a = (y[4]-y[3])/10;
+ b = y[3];
+ ioffset = 30;
+ }
+ if(i >= x[4] && i < x[5]) {
+ a = (y[5]-y[4])/10;
+ b = y[4];
+ ioffset = 40;
+ }
+ if(i >= x[5] && i < x[6]) {
+ a = (y[6]-y[5])/10;
+ b = y[5];
+ ioffset = 50;
+ }
+ if(i >= x[6] && i < x[7]) {
+ a = (y[7]-y[6])/10;
+ b = y[6];
+ ioffset = 60;
+ }
+ if(i >= x[7] && i < x[8]) {
+ a = (y[8]-y[7])/10;
+ b = y[7];
+ ioffset = 70;
+ }
+ if(i >= x[8] && i < x[9]) {
+ a = (y[9]-y[8])/10;
+ b = y[8];
+ ioffset = 80;
+ }
+ if(i >= x[9] && i < x[10]) {
+ a = (y[10]-y[9])/10;
+ b = y[9];
+ ioffset = 90;
+ }
+ efficiencyvacuum[i] = a*(i-ioffset)+b;
+ }
+ anglecorrectionfactortransversal[0] = 1;
+ anglecorrectionfactortransversal[1] = 0.998;
+ anglecorrectionfactortransversal[2] = 0.996;
+ anglecorrectionfactortransversal[3] = 0.994;
+ anglecorrectionfactortransversal[4] = 0.992;
+ anglecorrectionfactortransversal[5] = 0.99;
+ anglecorrectionfactortransversal[6] = 0.988;
+ anglecorrectionfactortransversal[7] = 0.986;
+ anglecorrectionfactortransversal[8] = 0.984;
+ anglecorrectionfactortransversal[9] = 0.982;
+ anglecorrectionfactortransversal[10] = 0.98;
+ anglecorrectionfactortransversal[11] = 0.98;
+ anglecorrectionfactortransversal[12] = 0.98;
+ anglecorrectionfactortransversal[13] = 0.98;
+ anglecorrectionfactortransversal[14] = 0.98;
+ anglecorrectionfactortransversal[15] = 0.98;
+ anglecorrectionfactortransversal[16] = 0.982;
+ anglecorrectionfactortransversal[17] = 0.984;
+ anglecorrectionfactortransversal[18] = 0.986;
+ anglecorrectionfactortransversal[19] = 0.988;
+ anglecorrectionfactortransversal[20] = 0.99;
+ anglecorrectionfactortransversal[21] = 0.992;
+ anglecorrectionfactortransversal[22] = 0.994;
+ anglecorrectionfactortransversal[23] = 0.996;
+ anglecorrectionfactortransversal[24] = 0.998;
+ for(int i=25; i<61; i++) anglecorrectionfactortransversal[i] = 1;
+ anglecorrectionfactortransversal[61] = 1.003;
+ anglecorrectionfactortransversal[62] = 1.006;
+ anglecorrectionfactortransversal[63] = 1.009;
+ anglecorrectionfactortransversal[64] = 1.012;
+ anglecorrectionfactortransversal[65] = 1.015;
+ anglecorrectionfactortransversal[66] = 1.022;
+ anglecorrectionfactortransversal[67] = 1.029;
+ anglecorrectionfactortransversal[68] = 1.036;
+ anglecorrectionfactortransversal[69] = 1.043;
+ anglecorrectionfactortransversal[70] = 1.05;
+ anglecorrectionfactortransversal[71] = 1.07;
+ anglecorrectionfactortransversal[72] = 1.09;
+ anglecorrectionfactortransversal[73] = 1.11;
+ anglecorrectionfactortransversal[74] = 1.13;
+ anglecorrectionfactortransversal[75] = 1.15;
+ anglecorrectionfactortransversal[76] = 1.175;
+ anglecorrectionfactortransversal[77] = 1.205;
+ anglecorrectionfactortransversal[78] = 1.240;
+ anglecorrectionfactortransversal[79] = 1.280;
+ anglecorrectionfactortransversal[80] = 1.285;
+ anglecorrectionfactortransversal[81] = 1.265;
+ anglecorrectionfactortransversal[82] = 1.20;
+ anglecorrectionfactortransversal[83] = 1.07;
+ anglecorrectionfactortransversal[84] = 0.95;
+ anglecorrectionfactortransversal[85] = 0.8;
+ anglecorrectionfactortransversal[86] = 0.64;
+ anglecorrectionfactortransversal[87] = 0.48;
+ anglecorrectionfactortransversal[88] = 0.32;
+ anglecorrectionfactortransversal[89] = 0.16;
+ anglecorrectionfactortransversal[90] = 0;
+
+ for(int i=0; i<25; ++i) anglecorrectionfactorlongitudinal[i] = 1;
+ anglecorrectionfactorlongitudinal[26] = 0.999;
+ anglecorrectionfactorlongitudinal[27] = 0.998;
+ anglecorrectionfactorlongitudinal[28] = 0.997;
+ anglecorrectionfactorlongitudinal[29] = 0.996;
+ anglecorrectionfactorlongitudinal[30] = 0.995;
+ anglecorrectionfactorlongitudinal[31] = 0.992;
+ anglecorrectionfactorlongitudinal[32] = 0.989;
+ anglecorrectionfactorlongitudinal[33] = 0.986;
+ anglecorrectionfactorlongitudinal[34] = 0.983;
+ anglecorrectionfactorlongitudinal[35] = 0.98;
+ anglecorrectionfactorlongitudinal[36] = 0.978;
+ anglecorrectionfactorlongitudinal[37] = 0.976;
+ anglecorrectionfactorlongitudinal[38] = 0.974;
+ anglecorrectionfactorlongitudinal[39] = 0.972;
+ anglecorrectionfactorlongitudinal[40] = 0.97;
+ anglecorrectionfactorlongitudinal[41] = 0.968;
+ anglecorrectionfactorlongitudinal[42] = 0.966;
+ anglecorrectionfactorlongitudinal[43] = 0.964;
+ anglecorrectionfactorlongitudinal[44] = 0.962;
+ anglecorrectionfactorlongitudinal[45] = 0.96;
+ anglecorrectionfactorlongitudinal[46] = 0.958;
+ anglecorrectionfactorlongitudinal[47] = 0.956;
+ anglecorrectionfactorlongitudinal[48] = 0.954;
+ anglecorrectionfactorlongitudinal[49] = 0.952;
+ anglecorrectionfactorlongitudinal[50] = 0.95;
+ anglecorrectionfactorlongitudinal[51] = 0.948;
+ anglecorrectionfactorlongitudinal[52] = 0.946;
+ anglecorrectionfactorlongitudinal[53] = 0.944;
+ anglecorrectionfactorlongitudinal[54] = 0.942;
+ anglecorrectionfactorlongitudinal[55] = 0.94;
+ anglecorrectionfactorlongitudinal[56] = 0.938;
+ anglecorrectionfactorlongitudinal[57] = 0.936;
+ anglecorrectionfactorlongitudinal[58] = 0.934;
+ anglecorrectionfactorlongitudinal[59] = 0.932;
+ anglecorrectionfactorlongitudinal[60] = 0.93;
+ anglecorrectionfactorlongitudinal[61] = 0.922;
+ anglecorrectionfactorlongitudinal[62] = 0.914;
+ anglecorrectionfactorlongitudinal[63] = 0.906;
+ anglecorrectionfactorlongitudinal[64] = 0.898;
+ anglecorrectionfactorlongitudinal[65] = 0.89;
+ anglecorrectionfactorlongitudinal[66] = 0.88;
+ anglecorrectionfactorlongitudinal[67] = 0.87;
+ anglecorrectionfactorlongitudinal[68] = 0.86;
+ anglecorrectionfactorlongitudinal[69] = 0.85;
+ anglecorrectionfactorlongitudinal[70] = 0.84;
+ anglecorrectionfactorlongitudinal[71] = 0.824;
+ anglecorrectionfactorlongitudinal[72] = 0.808;
+ anglecorrectionfactorlongitudinal[73] = 0.792;
+ anglecorrectionfactorlongitudinal[74] = 0.776;
+ anglecorrectionfactorlongitudinal[75] = 0.76;
+ anglecorrectionfactorlongitudinal[76] = 0.735;
+ anglecorrectionfactorlongitudinal[77] = 0.71;
+ anglecorrectionfactorlongitudinal[78] = 0.685;
+ anglecorrectionfactorlongitudinal[79] = 0.66;
+ anglecorrectionfactorlongitudinal[80] = 0.635;
+ anglecorrectionfactorlongitudinal[81] = 0.583;
+ anglecorrectionfactorlongitudinal[82] = 0.531;
+ anglecorrectionfactorlongitudinal[83] = 0.479;
+ anglecorrectionfactorlongitudinal[84] = 0.427;
+ anglecorrectionfactorlongitudinal[85] = 0.375;
+ anglecorrectionfactorlongitudinal[86] = 0.3;
+ anglecorrectionfactorlongitudinal[87] = 0.225;
+ anglecorrectionfactorlongitudinal[88] = 0.15;
+ anglecorrectionfactorlongitudinal[89] = 0.075;
+ anglecorrectionfactorlongitudinal[90] = 0;
+
+ for(int i=0; i<25; ++i) anglecorrectionfactorflat[i] = 1;
+ anglecorrectionfactorflat[26] = 0.999;
+ anglecorrectionfactorflat[27] = 0.998;
+ anglecorrectionfactorflat[28] = 0.997;
+ anglecorrectionfactorflat[29] = 0.996;
+ anglecorrectionfactorflat[30] = 0.995;
+ anglecorrectionfactorflat[31] = 0.992;
+ anglecorrectionfactorflat[32] = 0.989;
+ anglecorrectionfactorflat[33] = 0.986;
+ anglecorrectionfactorflat[34] = 0.983;
+ anglecorrectionfactorflat[35] = 0.98;
+ anglecorrectionfactorflat[36] = 0.982;
+ anglecorrectionfactorflat[37] = 0.974;
+ anglecorrectionfactorflat[38] = 0.966;
+ anglecorrectionfactorflat[39] = 0.958;
+ anglecorrectionfactorflat[40] = 0.95;
+ anglecorrectionfactorflat[41] = 0.946;
+ anglecorrectionfactorflat[42] = 0.942;
+ anglecorrectionfactorflat[43] = 0.938;
+ anglecorrectionfactorflat[44] = 0.934;
+ anglecorrectionfactorflat[45] = 0.93;
+ anglecorrectionfactorflat[46] = 0.924;
+ anglecorrectionfactorflat[47] = 0.918;
+ anglecorrectionfactorflat[48] = 0.912;
+ anglecorrectionfactorflat[49] = 0.906;
+ anglecorrectionfactorflat[50] = 0.90;
+ anglecorrectionfactorflat[51] = 0.89;
+ anglecorrectionfactorflat[52] = 0.88;
+ anglecorrectionfactorflat[53] = 0.87;
+ anglecorrectionfactorflat[54] = 0.86;
+ anglecorrectionfactorflat[55] = 0.85;
+ anglecorrectionfactorflat[56] = 0.837;
+ anglecorrectionfactorflat[57] = 0.824;
+ anglecorrectionfactorflat[58] = 0.811;
+ anglecorrectionfactorflat[59] = 0.798;
+ anglecorrectionfactorflat[60] = 0.785;
+ anglecorrectionfactorflat[61] = 0.77;
+ anglecorrectionfactorflat[62] = 0.755;
+ anglecorrectionfactorflat[63] = 0.74;
+ anglecorrectionfactorflat[64] = 0.725;
+ anglecorrectionfactorflat[65] = 0.71;
+ anglecorrectionfactorflat[66] = 0.693;
+ anglecorrectionfactorflat[67] = 0.676;
+ anglecorrectionfactorflat[68] = 0.659;
+ anglecorrectionfactorflat[69] = 0.642;
+ anglecorrectionfactorflat[70] = 0.625;
+ anglecorrectionfactorflat[71] = 0.605;
+ anglecorrectionfactorflat[72] = 0.585;
+ anglecorrectionfactorflat[73] = 0.565;
+ anglecorrectionfactorflat[74] = 0.545;
+ anglecorrectionfactorflat[75] = 0.525;
+ anglecorrectionfactorflat[76] = 0.501;
+ anglecorrectionfactorflat[77] = 0.477;
+ anglecorrectionfactorflat[78] = 0.453;
+ anglecorrectionfactorflat[79] = 0.429;
+ anglecorrectionfactorflat[80] = 0.405;
+ anglecorrectionfactorflat[81] = 0.371;
+ anglecorrectionfactorflat[82] = 0.337;
+ anglecorrectionfactorflat[83] = 0.303;
+ anglecorrectionfactorflat[84] = 0.269;
+ anglecorrectionfactorflat[85] = 0.235;
+ anglecorrectionfactorflat[86] = 0.188;
+ anglecorrectionfactorflat[87] = 0.141;
+ anglecorrectionfactorflat[88] = 0.094;
+ anglecorrectionfactorflat[89] = 0.047;
+ anglecorrectionfactorflat[90] = 0;
+}
+
+void House::calctemp() {
+ float temperatureday[12], temperaturenight[12];
+
+ temperatureday[0] = 3;
+ temperatureday[1] = 4;
+ temperatureday[2] = 8;
+ temperatureday[3] = 13;
+ temperatureday[4] = 18;
+ temperatureday[5] = 20;
+ temperatureday[6] = 22;
+ temperatureday[7] = 22;
+ temperatureday[8] = 18;
+ temperatureday[9] = 13;
+ temperatureday[10] = 7;
+ temperatureday[11] = 4;
+ temperaturenight[0] = -1;
+ temperaturenight[1] = -1;
+ temperaturenight[2] = 2;
+ temperaturenight[3] = 4;
+ temperaturenight[4] = 8;
+ temperaturenight[5] = 11;
+ temperaturenight[6] = 13;
+ temperaturenight[7] = 13;
+ temperaturenight[8] = 10;
+ temperaturenight[9] = 7;
+ temperaturenight[10] = 3;
+ temperaturenight[11] = 0;
+ 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];
+ }
+ }
+ tempinside[0] = 18;
+ tempinside[1] = 18;
+ tempinside[2] = 18;
+ tempinside[3] = 18;
+ tempinside[4] = 18;
+ tempinside[5] = 18;
+ tempinside[6] = 18;
+ tempinside[7] = 20;
+ tempinside[8] = 20;
+ tempinside[9] = 20;
+ tempinside[10] = 20;
+ tempinside[11] = 20;
+ tempinside[12] = 20;
+ tempinside[13] = 20;
+ tempinside[14] = 20;
+ tempinside[15] = 20;
+ tempinside[16] = 20;
+ tempinside[17] = 20;
+ tempinside[18] = 20;
+ tempinside[19] = 20;
+ tempinside[20] = 20;
+ tempinside[21] = 20;
+ tempinside[22] = 20;
+ tempinside[23] = 18;
}