Skip to content

Commit

Permalink
Update to deflection tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
vidanovic committed Aug 18, 2023
1 parent 316a87d commit e7278c5
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 170 deletions.
71 changes: 24 additions & 47 deletions src/Tarcog/tst/units/DoubleClearDeflectionTPTest1.unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
#include <gtest/gtest.h>

#include "WCETarcog.hpp"
#include "WCECommon.hpp"

#include "vectorTesting.hpp"

class DoubleClearDeflectionTPTest1 : public testing::Test
{
Expand All @@ -16,10 +17,10 @@ class DoubleClearDeflectionTPTest1 : public testing::Test
/////////////////////////////////////////////////////////
/// Outdoor
/////////////////////////////////////////////////////////
auto airTemperature = 255.15; // Kelvins
auto airSpeed = 5.5; // meters per second
auto tSky = 255.15; // Kelvins
auto solarRadiation = 0.0;
constexpr auto airTemperature = 255.15; // Kelvins
constexpr auto airSpeed = 5.5; // meters per second
constexpr auto tSky = 255.15; // Kelvins
constexpr auto solarRadiation = 0.0;

auto Outdoor = Tarcog::ISO15099::Environments::outdoor(
airTemperature, airSpeed, solarRadiation, tSky, Tarcog::ISO15099::SkyModel::AllSpecified);
Expand All @@ -30,41 +31,41 @@ class DoubleClearDeflectionTPTest1 : public testing::Test
// Indoor
/////////////////////////////////////////////////////////

auto roomTemperature = 294.15;
constexpr auto roomTemperature = 294.15;

auto Indoor = Tarcog::ISO15099::Environments::indoor(roomTemperature);
ASSERT_TRUE(Indoor != nullptr);

/////////////////////////////////////////////////////////
// IGU
/////////////////////////////////////////////////////////
auto solidLayerThickness1 = 0.003048; // [m]
auto solidLayerThickness2 = 0.005715;
auto solidLayerConductance = 1.0;
constexpr auto solidLayerThickness1 = 0.003048; // [m]
constexpr auto solidLayerThickness2 = 0.005715;
constexpr auto solidLayerConductance = 1.0;

auto aSolidLayer1 =
Tarcog::ISO15099::Layers::solid(solidLayerThickness1, solidLayerConductance);

// Introducing non default deflection properties
auto youngsModulus = 8.1e10;
constexpr auto youngsModulus = 8.1e10;
aSolidLayer1 = Tarcog::ISO15099::Layers::updateMaterialData(aSolidLayer1, youngsModulus);

// Layer will be using default deflection values
auto aSolidLayer2 =
Tarcog::ISO15099::Layers::solid(solidLayerThickness2, solidLayerConductance);

auto gapThickness = 0.0127;
constexpr auto gapThickness = 0.0127;
auto m_GapLayer = Tarcog::ISO15099::Layers::gap(gapThickness);
ASSERT_TRUE(m_GapLayer != nullptr);

double windowWidth = 1;
double windowHeight = 1;
constexpr double windowWidth = 1;
constexpr double windowHeight = 1;
Tarcog::ISO15099::CIGU aIGU(windowWidth, windowHeight);
aIGU.addLayers({aSolidLayer1, m_GapLayer, aSolidLayer2});

// Deflection properties
auto Tini = 303.15;
auto Pini = 101325.0;
constexpr auto Tini = 303.15;
constexpr auto Pini = 101325.0;
aIGU.setDeflectionProperties(Tini, Pini);

/////////////////////////////////////////////////////////
Expand Down Expand Up @@ -95,50 +96,26 @@ TEST_F(DoubleClearDeflectionTPTest1, Test1)
///////////////////////////////////////////////////////////////////////////////
/// Temperatures test
///////////////////////////////////////////////////////////////////////////////
auto Temperature = aSystem->getTemperatures();
std::vector correctTemperature = {258.799454, 259.124627, 279.009121, 279.618821};
ASSERT_EQ(correctTemperature.size(), Temperature.size());

for(auto i = 0u; i < correctTemperature.size(); ++i)
{
EXPECT_NEAR(correctTemperature[i], Temperature[i], Tolerance);
}
std::vector correctTemperature = {258.795861, 259.120713, 279.023351, 279.632449};
testVectors("Temperature", correctTemperature, aSystem->getTemperatures(), Tolerance);

///////////////////////////////////////////////////////////////////////////////
/// Radiosity test
///////////////////////////////////////////////////////////////////////////////
auto Radiosity = aSystem->getRadiosities();
std::vector correctRadiosity = {252.092017, 267.753052, 331.451548, 359.055470};
ASSERT_EQ(correctRadiosity.size(), Radiosity.size());

for(auto i = 0u; i < correctRadiosity.size(); ++i)
{
EXPECT_NEAR(correctRadiosity[i], Radiosity[i], Tolerance);
}
std::vector correctRadiosity = {252.080153, 267.749407, 331.509846, 359.112232};
testVectors("Radiosity", correctRadiosity, aSystem->getRadiosities(), Tolerance);

///////////////////////////////////////////////////////////////////////////////
/// Max deflection test
///////////////////////////////////////////////////////////////////////////////
const auto MaxDeflection = aSystem->getMaxLayerDeflections();
std::vector<double> correctMaxDeflection = {-2.285903e-3, 0.483756e-3};
ASSERT_EQ(correctMaxDeflection.size(), MaxDeflection.size());

for(auto i = 0u; i < correctMaxDeflection.size(); ++i)
{
EXPECT_NEAR(correctMaxDeflection[i], MaxDeflection[i], 1e-8);
}
std::vector<double> correctMaxDeflection = {-2.28568e-3, 0.483674e-3};
testVectors("Max deflection", correctMaxDeflection, aSystem->getMaxLayerDeflections(), 1e-8);

///////////////////////////////////////////////////////////////////////////////
/// Mean deflection test
///////////////////////////////////////////////////////////////////////////////
const auto MeanDeflection = aSystem->getMeanLayerDeflections();
std::vector correctMeanDeflection = {-0.957624e-3, 0.202658e-3};
ASSERT_EQ(correctMeanDeflection.size(), MeanDeflection.size());

for(auto i = 0u; i < correctMaxDeflection.size(); ++i)
{
EXPECT_NEAR(correctMeanDeflection[i], MeanDeflection[i], 1e-8);
}
std::vector correctMeanDeflection = {-0.957531e-3, 0.202624e-3};
testVectors("Mean deflection", correctMeanDeflection, aSystem->getMeanLayerDeflections(), 1e-8);

const auto numOfIter = aSystem->getNumberOfIterations();
EXPECT_EQ(25u, numOfIter);
Expand Down
26 changes: 9 additions & 17 deletions src/Tarcog/tst/units/DoubleClear_DeflectionWithLoad.unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
#include <gtest/gtest.h>

#include "WCETarcog.hpp"
#include "WCECommon.hpp"

#include "vectorTesting.hpp"

class TestDoubleClearDeflectionWithLoad : public testing::Test
{};
Expand Down Expand Up @@ -68,7 +69,6 @@ TEST_F(TestDoubleClearDeflectionWithLoad, U_ValueRun)
tarcogSystem.setAppliedLoad({2000, 1000});
tarcogSystem.setDeflectionProperties(320, 102000);


constexpr auto Tolerance{1e-6};

//////////////////////////////////////////////////////////////////////
Expand All @@ -77,21 +77,13 @@ TEST_F(TestDoubleClearDeflectionWithLoad, U_ValueRun)

constexpr auto aRun = Tarcog::ISO15099::System::Uvalue;

const auto Temperature = tarcogSystem.getTemperatures(aRun);
const std::vector correctTemperature{292.076937, 291.609964, 272.797101, 272.330129};
ASSERT_EQ(correctTemperature.size(), Temperature.size());

for(auto i = 0u; i < correctTemperature.size(); ++i)
{
EXPECT_NEAR(correctTemperature[i], Temperature[i], Tolerance);
}
const std::vector correctTemperature{292.076977, 291.610008, 272.796958, 272.329989};
testVectors(
"U-value temperatures", correctTemperature, tarcogSystem.getTemperatures(aRun), Tolerance);

const std::vector correctDeflection{-55.488195e-3, -54.644421e-3};

const auto deflection{tarcogSystem.getMaxLayerDeflections(Tarcog::ISO15099::System::Uvalue)};

for(auto i = 0u; i < correctDeflection.size(); ++i)
{
EXPECT_NEAR(correctDeflection[i], deflection[i], 1e-8);
}
testVectors("U-value deflection",
correctDeflection,
tarcogSystem.getMaxLayerDeflections(Tarcog::ISO15099::System::Uvalue),
Tolerance);
}
40 changes: 18 additions & 22 deletions src/Tarcog/tst/units/DoubleLoweWithDeflection.unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
#include <gtest/gtest.h>

#include "WCETarcog.hpp"
#include "WCECommon.hpp"

#include "vectorTesting.hpp"

// Example of double clear window with inital guess for solution
class TestDoubleLoweEnvironmentWithDeflection : public testing::Test
Expand Down Expand Up @@ -82,7 +83,8 @@ class TestDoubleLoweEnvironmentWithDeflection : public testing::Test
}

public:
[[nodiscard]] std::shared_ptr<Tarcog::ISO15099::CSystem> GetSystem() const {
[[nodiscard]] std::shared_ptr<Tarcog::ISO15099::CSystem> GetSystem() const
{
return m_TarcogSystem;
}
};
Expand All @@ -95,28 +97,22 @@ TEST_F(TestDoubleLoweEnvironmentWithDeflection, Test1)
constexpr auto DeflectionTolerance = 1e-8;

const auto aSystem = GetSystem();
ASSERT_TRUE(aSystem != nullptr);
ASSERT_TRUE(aSystem != nullptr);

///////////////////////////////////////////////////////////////////////////////
/// Deflection results
///////////////////////////////////////////////////////////////////////////////
const auto MaxDeflectionU = aSystem->getMaxLayerDeflections(Tarcog::ISO15099::System::Uvalue);
const std::vector correctMaxDeflectionU{-1.849981e-3, 0.344021e-3};
ASSERT_EQ(correctMaxDeflectionU.size(), MaxDeflectionU.size());

for(auto i = 0u; i < correctMaxDeflectionU.size(); ++i)
{
EXPECT_NEAR(correctMaxDeflectionU[i], MaxDeflectionU[i], DeflectionTolerance);
}

const auto MaxDeflectionS = aSystem->getMaxLayerDeflections(Tarcog::ISO15099::System::SHGC);
const std::vector correctMaxDeflectionSHGC{-1.385369e-3, 0.253010e-3};
ASSERT_EQ(correctMaxDeflectionSHGC.size(), MaxDeflectionU.size());

for(auto i = 0u; i < correctMaxDeflectionSHGC.size(); ++i)
{
EXPECT_NEAR(correctMaxDeflectionSHGC[i], MaxDeflectionS[i], DeflectionTolerance);
}
const std::vector correctMaxDeflectionU{-1.849876e-3, 0.343977e-3};
testVectors("Max deflection U-value run",
correctMaxDeflectionU,
aSystem->getMaxLayerDeflections(Tarcog::ISO15099::System::Uvalue),
DeflectionTolerance);

const std::vector correctMaxDeflectionSHGC{-1.385198e-3, 0.252978e-3};
testVectors("Max deflection SHGC run",
correctMaxDeflectionSHGC,
aSystem->getMaxLayerDeflections(Tarcog::ISO15099::System::SHGC),
DeflectionTolerance);

//////////////////////////////////////////////////////////////////////
/// General results
Expand All @@ -129,8 +125,8 @@ TEST_F(TestDoubleLoweEnvironmentWithDeflection, Test1)
EXPECT_EQ(26u, numOfIterS);

const auto Uvalue = aSystem->getUValue();
EXPECT_NEAR(Uvalue, 1.695037, Tolerance);
EXPECT_NEAR(Uvalue, 1.693616, Tolerance);

const auto SHGC = aSystem->getSHGC(0.3716);
EXPECT_NEAR(SHGC, 0.425361, Tolerance);
EXPECT_NEAR(SHGC, 0.425337, Tolerance);
}
Loading

0 comments on commit e7278c5

Please sign in to comment.