96 lines
1.7 KiB
C++
96 lines
1.7 KiB
C++
/*
|
|
Kamer.cpp
|
|
Copyright (c) 2014 Kenneth van Ewijk. All right reserved.
|
|
*/
|
|
|
|
// include this library's description file
|
|
#include "Kamer.h"
|
|
|
|
Kamer::Kamer(void)
|
|
{
|
|
// initialize this instance's variables
|
|
volume = 0;
|
|
temp = 0;
|
|
wallSurface = 0;
|
|
windowSurface = 0;
|
|
surfaceArea = 0;
|
|
heatFlow = 0;
|
|
deltaTemp = 0;
|
|
}
|
|
|
|
|
|
//Set Room Properties
|
|
void Kamer::setVolume(int givenVolume)
|
|
{
|
|
volume = givenVolume;
|
|
}
|
|
|
|
void Kamer::setTemp(double givenTemp)
|
|
{
|
|
temp = givenTemp;
|
|
}
|
|
|
|
void Kamer::setSurfaceArea(int givenWall, int givenWindow)
|
|
{
|
|
wallSurface = givenWall;
|
|
windowSurface = givenWindow;
|
|
surfaceArea = wallSurface + windowSurface;
|
|
}
|
|
|
|
|
|
//Calc Room Properties
|
|
void Kamer::calcTemp(int outsideTemp)
|
|
{
|
|
calcHeatFlow(outsideTemp);
|
|
|
|
deltaTemp = heatFlow / ( (volume * 1.43) * 920);
|
|
double newTemp = temp - deltaTemp;
|
|
|
|
temp = newTemp;
|
|
}
|
|
|
|
void Kamer::calcHeatFlow(int outsideTemp)
|
|
{
|
|
double deltaTemp2 = temp - outsideTemp;
|
|
|
|
//Make sure deltaTemp is positive
|
|
double heatFlowWall = 0.6 * wallSurface * (deltaTemp2 / 20);
|
|
double heatFlowIsolation = 0.08 * wallSurface * (deltaTemp2 / 0.5);
|
|
|
|
double heatFlowWallTotal = 1 / ( (1 / heatFlowWall) + (1 / heatFlowIsolation) );
|
|
|
|
double heatFlowWindow = 0.98 * windowSurface * (deltaTemp2 / 12);
|
|
double heatFlowAir = 0.025 * windowSurface * (deltaTemp2 / 12);
|
|
|
|
double heatFlowWindowTotal = 1 / ( (1 / heatFlowWindow) + (1 / heatFlowAir) );
|
|
|
|
heatFlow = heatFlowWindowTotal + heatFlowWallTotal;
|
|
heatFlow = heatFlow * 60;
|
|
}
|
|
|
|
|
|
//Get Room Properties
|
|
int Kamer::getVolume(void)
|
|
{
|
|
return volume;
|
|
}
|
|
|
|
double Kamer::getTemp(void)
|
|
{
|
|
return temp;
|
|
}
|
|
|
|
int Kamer::getSurfaceArea(void)
|
|
{
|
|
return surfaceArea;
|
|
}
|
|
|
|
double Kamer::getHeatFlow(void)
|
|
{
|
|
return heatFlow;
|
|
}
|
|
|
|
double Kamer::getDeltaTemp(void)
|
|
{
|
|
return deltaTemp;
|
|
} |