Skip to content

Commit

Permalink
Merge pull request #165 from LBNL-ETA/SimplifiedAbsorptanceInterface
Browse files Browse the repository at this point in the history
Simplified absorptance interface
  • Loading branch information
vidanovic authored Aug 24, 2023
2 parents 796a283 + 8b606a7 commit fd68258
Show file tree
Hide file tree
Showing 48 changed files with 405 additions and 299 deletions.
32 changes: 23 additions & 9 deletions src/Tarcog/src/IGU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,28 +256,28 @@ namespace Tarcog
return aMeanDeflections;
}

std::vector<double> CIGU::getMaxGapDeflections() const
std::vector<double> CIGU::getMaxGapWidth() const
{
std::vector<double> aMaxDeflections;
std::vector<double> aMaxWidths;

for(auto const & layer : getGapLayers())
{
aMaxDeflections.push_back(layer->getMaxDeflection());
aMaxWidths.push_back(layer->getMaxDeflection());
}

return aMaxDeflections;
return aMaxWidths;
}

std::vector<double> CIGU::getMeanGapDeflections() const
std::vector<double> CIGU::getMeanGapWidth() const
{
std::vector<double> aMeanDeflections;
std::vector<double> aMeanWidths;

for(auto const & layer : getGapLayers())
{
aMeanDeflections.push_back(layer->getMeanDeflection());
aMeanWidths.push_back(layer->getMeanDeflection());
}

return aMeanDeflections;
return aMeanWidths;
}

std::vector<double> CIGU::getGapPressures() const
Expand Down Expand Up @@ -388,6 +388,9 @@ namespace Tarcog
const double t_InsidePressure,
const double t_OutsidePressure)
{
// m_DeflectionFromE1300Curves must be set when surfaces are in non-deflected state.
// Since user might have called IGU previously with different deflection properties
resetSurfaceDeflections();
std::vector<Deflection::LayerData> layerData;
for(const auto & layer : getSolidLayers())
{
Expand Down Expand Up @@ -610,7 +613,7 @@ namespace Tarcog
}
for(size_t i = 0; i < solidLayers.size(); ++i)
{
solidLayers[i]->setSolarAbsorptance(absorptances[i], solarRadiation);
solidLayers[i]->setSolarHeatGain(absorptances[i], solarRadiation);
}
}

Expand Down Expand Up @@ -683,6 +686,17 @@ namespace Tarcog
return LDefMax;
}

void CIGU::resetSurfaceDeflections()
{
for(auto const & aLayer : m_Layers)
{
if(std::dynamic_pointer_cast<CIGUSolidLayer>(aLayer) != nullptr)
{
std::dynamic_pointer_cast<CIGUSolidLayer>(aLayer)->applyDeflection(0, 0);
}
}
}

} // namespace ISO15099

} // namespace Tarcog
7 changes: 5 additions & 2 deletions src/Tarcog/src/IGU.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ namespace Tarcog

[[nodiscard]] std::vector<double> getMaxLayerDeflections() const;
[[nodiscard]] std::vector<double> getMeanLayerDeflections() const;
[[nodiscard]] std::vector<double> getMaxGapDeflections() const;
[[nodiscard]] std::vector<double> getMeanGapDeflections() const;
[[nodiscard]] std::vector<double> getMaxGapWidth() const;
[[nodiscard]] std::vector<double> getMeanGapWidth() const;

[[nodiscard]] std::vector<double> getGapPressures() const;

Expand Down Expand Up @@ -107,6 +107,9 @@ namespace Tarcog
double m_Height; // meters
double m_Tilt; // degrees

// Reset deflection state of all surfaces back to zero.
void resetSurfaceDeflections();

// Routines to calculate deflection coefficients
[[nodiscard]] double Ldmean() const;
[[nodiscard]] double Ldmax() const;
Expand Down
2 changes: 1 addition & 1 deletion src/Tarcog/src/IGUSolidLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ namespace Tarcog
resetCalculated();
}

void CIGUSolidLayer::setSolarAbsorptance(double const t_SolarAbsorptance,
void CIGUSolidLayer::setSolarHeatGain(double const t_SolarAbsorptance,
const double t_SolarRadiation)
{
m_SolarAbsorptance = t_SolarAbsorptance;
Expand Down
2 changes: 1 addition & 1 deletion src/Tarcog/src/IGUSolidLayer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace Tarcog

void setLayerState(double t_Tf, double t_Tb, double t_Jf, double t_Jb);
void setSolarRadiation(double t_SolarRadiation);
void setSolarAbsorptance(double t_SolarAbsorptance, double t_SolarRadiation);
void setSolarHeatGain(double t_SolarAbsorptance, double t_SolarRadiation);

// Radiation flow in solid layer should be eliminated
double getRadiationFlow() override;
Expand Down
8 changes: 4 additions & 4 deletions src/Tarcog/src/SingleSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,14 @@ namespace Tarcog
return m_IGU.getMeanLayerDeflections();
}

std::vector<double> CSingleSystem::getMaxGapDeflections() const
std::vector<double> CSingleSystem::getMaxGapWidth() const
{
return m_IGU.getMaxGapDeflections();
return m_IGU.getMaxGapWidth();
}

std::vector<double> CSingleSystem::getMeanGapDeflections() const
std::vector<double> CSingleSystem::getMeanGapWidth() const
{
return m_IGU.getMeanGapDeflections();
return m_IGU.getMeanGapWidth();
}

std::vector<double> CSingleSystem::getPanesLoad()
Expand Down
4 changes: 2 additions & 2 deletions src/Tarcog/src/SingleSystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ namespace Tarcog

[[nodiscard]] std::vector<double> getMaxLayerDeflections() const;
[[nodiscard]] std::vector<double> getMeanLayerDeflections() const;
[[nodiscard]] std::vector<double> getMaxGapDeflections() const;
[[nodiscard]] std::vector<double> getMeanGapDeflections() const;
[[nodiscard]] std::vector<double> getMaxGapWidth() const;
[[nodiscard]] std::vector<double> getMeanGapWidth() const;
[[nodiscard]] std::vector<double> getPanesLoad();
void setAppliedLoad(std::vector<double> load);

Expand Down
8 changes: 4 additions & 4 deletions src/Tarcog/src/System.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ namespace Tarcog
return m_System.at(t_System)->getMeanLayerDeflections();
}

std::vector<double> CSystem::getMaxGapDeflections(System t_System)
std::vector<double> CSystem::getMaxGapWidth(System t_System)
{
checkSolved();
return m_System.at(t_System)->getMaxGapDeflections();
return m_System.at(t_System)->getMaxGapWidth();
}

std::vector<double> CSystem::getMeanGapDeflections(System t_System)
std::vector<double> CSystem::getMeanGapWidth(System t_System)
{
checkSolved();
return m_System.at(t_System)->getMeanGapDeflections();
return m_System.at(t_System)->getMeanGapWidth();
}

std::vector<double> CSystem::getPanesLoad(System t_System)
Expand Down
4 changes: 2 additions & 2 deletions src/Tarcog/src/System.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ namespace Tarcog

[[nodiscard]] std::vector<double> getMaxLayerDeflections(System t_System);
[[nodiscard]] std::vector<double> getMeanLayerDeflections(System t_System);
[[nodiscard]] std::vector<double> getMaxGapDeflections(System t_System);
[[nodiscard]] std::vector<double> getMeanGapDeflections(System t_System);
[[nodiscard]] std::vector<double> getMaxGapWidth(System t_System);
[[nodiscard]] std::vector<double> getMeanGapWidth(System t_System);
[[nodiscard]] std::vector<double> getPanesLoad(System t_System);
void setAppliedLoad(const std::vector<double> & load);

Expand Down
12 changes: 6 additions & 6 deletions src/Tarcog/tst/units/DoubleClearDeflectionTPDefault.unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ TEST_F(DoubleClearDeflectionTPDefault, U_ValueRun)
testVectors(
"Mean layer deflection", correctMeanLayerDeflection, MeanLayerDeflection, Tolerance);

const auto MaxGapDeflection = tarcogSystem.getMaxGapDeflections();
const auto MaxGapDeflection = tarcogSystem.getMaxGapWidth();
std::vector correctMaxGapDeflection{9.930646e-3};
testVectors("Maximum gap deflection", correctMaxGapDeflection, MaxGapDeflection, 1e-8);

const auto MeanGapDeflection = tarcogSystem.getMeanGapDeflections();
const auto MeanGapDeflection = tarcogSystem.getMeanGapWidth();
std::vector correctMeanGapDeflection{11.539846e-3};
testVectors("Mean gap deflection", correctMeanGapDeflection, MeanGapDeflection, Tolerance);

Expand Down Expand Up @@ -147,10 +147,10 @@ TEST_F(DoubleClearDeflectionTPDefault, SHGC_ValueRun)
auto solidLayerConductance = 1.0;

auto layer1 = Tarcog::ISO15099::Layers::solid(solidLayerThickness1, solidLayerConductance);
layer1->setSolarAbsorptance(0.096058987081, solarRadiation);
layer1->setSolarHeatGain(0.096058987081, solarRadiation);

auto layer2 = Tarcog::ISO15099::Layers::solid(solidLayerThickness2, solidLayerConductance);
layer2->setSolarAbsorptance(0.126891940832, solarRadiation);
layer2->setSolarHeatGain(0.126891940832, solarRadiation);

auto gapThickness = 0.0127;
auto gap = Tarcog::ISO15099::Layers::gap(gapThickness);
Expand Down Expand Up @@ -192,11 +192,11 @@ TEST_F(DoubleClearDeflectionTPDefault, SHGC_ValueRun)
testVectors(
"Mean layer deflection", correctMeanLayerDeflection, MeanLayerDeflection, Tolerance);

const auto MaxGapDeflection = tarcogSystem.getMaxGapDeflections();
const auto MaxGapDeflection = tarcogSystem.getMaxGapWidth();
std::vector correctMaxGapDeflection{0.013286};
testVectors("Maximum gap deflection", correctMaxGapDeflection, MaxGapDeflection, Tolerance);

const auto MeanGapDeflection = tarcogSystem.getMeanGapDeflections();
const auto MeanGapDeflection = tarcogSystem.getMeanGapWidth();
std::vector correctMeanGapDeflection{0.012945};
testVectors("Mean gap deflection", correctMeanGapDeflection, MeanGapDeflection, Tolerance);

Expand Down
4 changes: 2 additions & 2 deletions src/Tarcog/tst/units/DoubleClearLeeward.unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ class TestDoubleClearLeeward : public testing::Test
auto solidLayerConductance = 1.0;

auto layer1 = Tarcog::ISO15099::Layers::solid(solidLayerThickness, solidLayerConductance);
layer1->setSolarAbsorptance(0.166707709432, solarRadiation);
layer1->setSolarHeatGain(0.166707709432, solarRadiation);

auto layer2 = Tarcog::ISO15099::Layers::solid(solidLayerThickness, solidLayerConductance);
layer2->setSolarAbsorptance(0.112737670541, solarRadiation);
layer2->setSolarHeatGain(0.112737670541, solarRadiation);

auto gapThickness = 0.012;
auto gap = Tarcog::ISO15099::Layers::gap(gapThickness);
Expand Down
4 changes: 2 additions & 2 deletions src/Tarcog/tst/units/DoubleClearSingleSystemWithSun.unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ class TestDoubleClearSingleSystemWithSun : public testing::Test
auto solarAbsorptance = 0.187443971634;

auto layer1 = Tarcog::ISO15099::Layers::solid(solidLayerThickness, solidLayerConductance);
layer1->setSolarAbsorptance(solarAbsorptance, solarRadiation);
layer1->setSolarHeatGain(solarAbsorptance, solarRadiation);

solarAbsorptance = 0.054178960621;
auto layer2 = Tarcog::ISO15099::Layers::solid(solidLayerThickness, solidLayerConductance);
layer2->setSolarAbsorptance(solarAbsorptance, solarRadiation);
layer2->setSolarHeatGain(solarAbsorptance, solarRadiation);

auto gapThickness = 0.012;
auto m_GapLayer = Tarcog::ISO15099::Layers::gap(gapThickness);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,11 @@ TEST_F(TestDoubleClear102_102_ForcedVentilation, SummerSystem)
constexpr auto nfrcSolarRadiation{783.0}; // [W/m2]
constexpr auto solarAbsorptanceCoefficientLayer1{0.09649835037305263}; // [-]
auto aSolidLayer1{createSolidLayer102()};
aSolidLayer1->setSolarAbsorptance(solarAbsorptanceCoefficientLayer1, nfrcSolarRadiation);
aSolidLayer1->setSolarHeatGain(solarAbsorptanceCoefficientLayer1, nfrcSolarRadiation);

constexpr auto solarAbsorptanceCoefficientLayer2{0.07226476969576598}; // [-]
auto aSolidLayer2{createSolidLayer102()};
aSolidLayer2->setSolarAbsorptance(solarAbsorptanceCoefficientLayer2, nfrcSolarRadiation);
aSolidLayer2->setSolarHeatGain(solarAbsorptanceCoefficientLayer2, nfrcSolarRadiation);
auto forcedGapLayer{createForcedVentilationGap()};

constexpr auto windowWidth = 1.0; // [m]
Expand Down
4 changes: 2 additions & 2 deletions src/Tarcog/tst/units/DoubleClear_DeflectionWithLoad.unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ TEST_F(TestDoubleClearDeflectionWithLoad, U_ValueRun)
constexpr auto solidLayerConductance{1.0}; // [W/m2K]

auto aSolidLayer1 = Tarcog::ISO15099::Layers::solid(solidLayerThickness, solidLayerConductance);
aSolidLayer1->setSolarAbsorptance(0.099839858711, solarRadiation);
aSolidLayer1->setSolarHeatGain(0.099839858711, solarRadiation);

auto aSolidLayer2 = Tarcog::ISO15099::Layers::solid(solidLayerThickness, solidLayerConductance);
aSolidLayer2->setSolarAbsorptance(0.076627746224, solarRadiation);
aSolidLayer2->setSolarHeatGain(0.076627746224, solarRadiation);

constexpr auto gapThickness1{0.006};
const auto gapLayer1 = Tarcog::ISO15099::Layers::gap(gapThickness1);
Expand Down
Loading

0 comments on commit fd68258

Please sign in to comment.