forked from LBNL-ETA/Windows-CalcEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GapBetweenIrradiatedGlassAndInteriorShadingZeroForcedVentilation.unit.cpp
199 lines (160 loc) · 7.67 KB
/
GapBetweenIrradiatedGlassAndInteriorShadingZeroForcedVentilation.unit.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
#include <memory>
#include <gtest/gtest.h>
#include "WCETarcog.hpp"
using Tarcog::ISO15099::CIGUSolidLayer;
using Tarcog::ISO15099::CIGUGapLayer;
using Tarcog::ISO15099::CSingleSystem;
class TestGapBetweenIrradiatedGlassAndInteriorShadingZeroForcedVentilation : public testing::Test
{
private:
std::unique_ptr<CSingleSystem> m_TarcogSystem;
protected:
void SetUp() override
{
/////////////////////////////////////////////////////////
// Outdoor
/////////////////////////////////////////////////////////
auto outdoorAirTemperature = 298.15; // Kelvins
auto outdoorAirSpeed = 2.75; // meters per second
auto tSky = outdoorAirTemperature; // Kelvins
auto solarRadiation = 1000.0;
auto Outdoor = Tarcog::ISO15099::Environments::outdoor(
outdoorAirTemperature, outdoorAirSpeed, solarRadiation, tSky, Tarcog::ISO15099::SkyModel::AllSpecified);
ASSERT_TRUE(Outdoor != nullptr);
Outdoor->setHCoeffModel(Tarcog::ISO15099::BoundaryConditionsCoeffModel::CalculateH);
/////////////////////////////////////////////////////////
/// Indoor
/////////////////////////////////////////////////////////
auto roomTemperature = 298.15;
auto Indoor = Tarcog::ISO15099::Environments::indoor(roomTemperature);
ASSERT_TRUE(Indoor != nullptr);
/////////////////////////////////////////////////////////
/// IGU
/////////////////////////////////////////////////////////
auto windowWidth = 1.0;
auto windowHeight = 1.0;
const auto solidLayerThickness = 0.003048; // [m]
const auto solidLayerConductance = 1.0;
auto solidLayer =
Tarcog::ISO15099::Layers::solid(solidLayerThickness, solidLayerConductance);
solidLayer->setSolarAbsorptance(0.04, solarRadiation);
ASSERT_TRUE(solidLayer != nullptr);
auto gapThickness = 0.05;
auto gapLayer = Tarcog::ISO15099::Layers::gap(gapThickness);
ASSERT_TRUE(gapLayer != nullptr);
auto gapAirSpeed = 0.0;
auto forcedGapLayer =
Tarcog::ISO15099::Layers::forcedVentilationGap(gapLayer, gapAirSpeed, roomTemperature);
ASSERT_TRUE(forcedGapLayer != nullptr);
auto shadeLayerConductance = 0.12;
// make cell geometry
const auto thickness_31111{0.00023};
const auto x = 0.00169; // m
const auto y = 0.00169; // m
const auto radius = 0.00058; // m
const auto CellDimension{
ThermalPermeability::Perforated::diameterToXYDimension(2 * radius)};
const auto frontOpenness{ThermalPermeability::Perforated::openness(
ThermalPermeability::Perforated::Geometry::Circular,
x,
y,
CellDimension.x,
CellDimension.y)};
const auto dl{0.0};
const auto dr{0.0};
const auto dtop{0.0};
const auto dbot{0.0};
EffectiveLayers::ShadeOpenness openness{frontOpenness, dl, dr, dtop, dbot};
EffectiveLayers::EffectiveLayerPerforated effectiveLayerPerforated{
windowWidth, windowHeight, thickness_31111, openness};
EffectiveLayers::EffectiveOpenness effOpenness{
effectiveLayerPerforated.getEffectiveOpenness()};
const auto effectiveThickness{effectiveLayerPerforated.effectiveThickness()};
auto Ef = 0.640892;
auto Eb = 0.623812;
auto Tirf = 0.257367;
auto Tirb = 0.257367;
auto shadeLayer = Tarcog::ISO15099::Layers::shading(
effectiveThickness, shadeLayerConductance, effOpenness, Ef, Tirf, Eb, Tirb);
shadeLayer->setSolarAbsorptance(0.35, solarRadiation);
ASSERT_TRUE(shadeLayer != nullptr);
Tarcog::ISO15099::CIGU aIGU(windowWidth, windowHeight);
aIGU.addLayers({solidLayer, forcedGapLayer, shadeLayer});
/////////////////////////////////////////////////////////
/// System
/////////////////////////////////////////////////////////
m_TarcogSystem = std::make_unique<CSingleSystem>(aIGU, Indoor, Outdoor);
ASSERT_TRUE(m_TarcogSystem != nullptr);
m_TarcogSystem->solve();
}
public:
[[nodiscard]] CIGUSolidLayer * GetFirstLayer() const
{
return m_TarcogSystem->getSolidLayers()[0].get();
};
[[nodiscard]] CIGUGapLayer * GetGap() const
{
return m_TarcogSystem->getGapLayers()[0].get();
};
[[nodiscard]] CIGUSolidLayer * GetSecondLayer() const
{
return m_TarcogSystem->getSolidLayers()[1].get();
};
};
TEST_F(TestGapBetweenIrradiatedGlassAndInteriorShadingZeroForcedVentilation, GapLayerSurfaceIRFlow)
{
SCOPED_TRACE("Begin Test: Test gap layer surface temperatures");
auto aLayer = GetGap();
// Airflow iterations are set to 1e-4 and it cannot exceed that precision
ASSERT_TRUE(aLayer != nullptr);
auto frontIRRadiationFlow = aLayer->J(FenestrationCommon::Side::Front);
auto backIRRadiationFlow = aLayer->J(FenestrationCommon::Side::Back);
EXPECT_NEAR(300.51850897417813, frontIRRadiationFlow, 1e-4);
EXPECT_NEAR(352.30917088728245, backIRRadiationFlow, 1e-4);
}
TEST_F(TestGapBetweenIrradiatedGlassAndInteriorShadingZeroForcedVentilation, GainEnergy)
{
SCOPED_TRACE("Begin Test: Test Forced Ventilated Gap Layer At Edge - Gain Energy");
auto aLayer = GetGap();
// Airflow iterations are set to 1e-4 and it cannot exceed that precision
ASSERT_TRUE(aLayer != nullptr);
auto gainEnergy = aLayer->getGainFlow();
EXPECT_NEAR(123.35122562642526, gainEnergy, 1e-4);
}
TEST_F(TestGapBetweenIrradiatedGlassAndInteriorShadingZeroForcedVentilation, FirstLayerSurfaceTemperatures)
{
SCOPED_TRACE("Begin Test: Test Forced Ventilated Gap Layer At Edge - Solid Temperatures");
auto aLayer = GetFirstLayer();
// Airflow iterations are set to 1e-4 and it cannot exceed that precision
ASSERT_TRUE(aLayer != nullptr);
auto frontTemperature = aLayer->getTemperature(FenestrationCommon::Side::Front);
auto backTemperature = aLayer->getTemperature(FenestrationCommon::Side::Back);
EXPECT_NEAR(263.04855139463018, frontTemperature, 1e-4);
EXPECT_NEAR(263.33651241783423, backTemperature, 1e-4);
}
TEST_F(TestGapBetweenIrradiatedGlassAndInteriorShadingZeroForcedVentilation, GapTemperatures)
{
SCOPED_TRACE("Begin Test: Test Forced Ventilated Gap Layer At Edge - Gap Temperatures");
auto aLayer = GetGap();
// Airflow iterations are set to 1e-4 and it cannot exceed that precision
ASSERT_TRUE(aLayer != nullptr);
auto frontTemperature = aLayer->getTemperature(FenestrationCommon::Side::Front);
auto backTemperature = aLayer->getTemperature(FenestrationCommon::Side::Back);
auto layerTemperature = aLayer->layerTemperature();
auto averageTemperature = aLayer->averageTemperature();
EXPECT_NEAR(263.33651241783423, frontTemperature, 1e-4);
EXPECT_NEAR(282.70879216106016, backTemperature, 1e-4);
EXPECT_NEAR(285.74858839456721, layerTemperature, 1e-4);
EXPECT_NEAR(273.02265228944719, averageTemperature, 1e-4);
}
TEST_F(TestGapBetweenIrradiatedGlassAndInteriorShadingZeroForcedVentilation, SecondLayerSurfaceTemperatures)
{
SCOPED_TRACE("Begin Test: Test Forced Ventilated Gap Layer At Edge - Shade Temperatures");
auto aLayer = GetSecondLayer();
// Airflow iterations are set to 1e-4 and it cannot exceed that precision
ASSERT_TRUE(aLayer != nullptr);
auto frontTemperature = aLayer->getTemperature(FenestrationCommon::Side::Front);
auto backTemperature = aLayer->getTemperature(FenestrationCommon::Side::Back);
EXPECT_NEAR(282.70879216106016, frontTemperature, 1e-4);
EXPECT_NEAR(283.10709823028276, backTemperature, 1e-4);
}