Skip to content

Commit

Permalink
Merge pull request #162 from LBNL-ETA/GapDeflectionInterfaceCleanup
Browse files Browse the repository at this point in the history
Gap deflection interface cleanup
  • Loading branch information
vidanovic authored Aug 18, 2023
2 parents 610cc20 + e7278c5 commit 8028484
Show file tree
Hide file tree
Showing 34 changed files with 598 additions and 510 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ else()
endif()

if( BUILD_WCE_TESTING )
if( ${BUILD_WCE_COMMON} )

if( ${BUILD_WCE_COMMON} )
include_directories( src/Common/include )
file( GLOB all_test_src RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "src/Common/tst/units/*.cpp" )
LIST( APPEND test_src ${all_test_src} )
Expand Down
5 changes: 5 additions & 0 deletions src/Common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ install(TARGETS ${target_name}
)

if( BUILD_WCE_TESTING )
# common helper files for the testing
include_directories( ../helper )
file( GLOB all_test_src RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "../helper/*.hpp" )
file( GLOB all_test_src RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "../helper/*.cpp" )
LIST( APPEND test_src ${all_test_src} )
include_directories( include )
file( GLOB all_test_src RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" tst/units/*.cpp )
set( test_src ${all_test_src} )
Expand Down
5 changes: 5 additions & 0 deletions src/Gases/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ install(TARGETS ${target_name}
)

if( BUILD_WCE_TESTING )
# common helper files for the testing
include_directories( ../helper )
file( GLOB all_test_src RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "../helper/*.hpp" )
file( GLOB all_test_src RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "../helper/*.cpp" )
LIST( APPEND test_src ${all_test_src} )
include_directories( include )
file( GLOB all_test_src RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" tst/units/*.cpp )
set( test_src ${all_test_src} )
Expand Down
11 changes: 8 additions & 3 deletions src/MultiLayerOptics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,15 @@ install(TARGETS ${target_name}
)

if( BUILD_WCE_TESTING )
# common helper files for the testing
include_directories( ../helper )
file( GLOB all_test_src RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "../helper/*.hpp" )
file( GLOB all_test_src RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "../helper/*.cpp" )
LIST( APPEND test_src ${all_test_src} )
include_directories( include )
file( GLOB all_test_src RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" tst/units/*.cpp )
set( test_src ${all_test_src} )
CREATE_TEST_TARGETS_WCE( ${target_name} "${test_src}" "" )
file( GLOB all_test_src RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" tst/units/*.cpp )
set( test_src ${all_test_src} )
CREATE_TEST_TARGETS_WCE( ${target_name} "${test_src}" "" )
endif ()

warning_level_update_wce()
5 changes: 5 additions & 0 deletions src/SingleLayerOptics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ install(TARGETS ${target_name}
)

if( BUILD_WCE_TESTING )
# common helper files for the testing
include_directories( ../helper )
file( GLOB all_test_src RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "../helper/*.hpp" )
file( GLOB all_test_src RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "../helper/*.cpp" )
LIST( APPEND test_src ${all_test_src} )
include_directories( include )
file( GLOB all_test_src RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" tst/units/*.cpp )
set( test_src ${all_test_src} )
Expand Down
5 changes: 5 additions & 0 deletions src/SpectralAveraging/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ install(TARGETS ${target_name}
)

if( BUILD_WCE_TESTING )
# common helper files for the testing
include_directories( ../helper )
file( GLOB all_test_src RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "../helper/*.hpp" )
file( GLOB all_test_src RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "../helper/*.cpp" )
LIST( APPEND test_src ${all_test_src} )
include_directories( include )
file( GLOB all_test_src RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" tst/units/*.cpp )
set( test_src ${all_test_src} )
Expand Down
6 changes: 6 additions & 0 deletions src/Tarcog/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ install(TARGETS ${target_name}
)

if( BUILD_WCE_TESTING )
# common helper files for the testing
include_directories( ../helper )
file( GLOB all_test_src RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "../helper/*.hpp" )
file( GLOB all_test_src RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "../helper/*.cpp" )
LIST( APPEND test_src ${all_test_src} )

include_directories( include )
file( GLOB all_test_src RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" tst/units/*.cpp )
set( test_src ${all_test_src} )
Expand Down
1 change: 0 additions & 1 deletion src/Tarcog/include/WCETarcog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "../src/Environments.hpp"
#include "../src/HeatFlowBalance.hpp"
#include "../src/IGU.hpp"
#include "../src/IGUGapDeflection.hpp"
#include "../src/IGUGapLayer.hpp"
#include "../src/IGUSolidDeflection.hpp"
#include "../src/IGUSolidLayer.hpp"
Expand Down
14 changes: 0 additions & 14 deletions src/Tarcog/src/BaseIGULayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,6 @@ namespace Tarcog
return getSurface(t_Position)->J();
}

double CBaseIGULayer::getMaxDeflection() const
{
assert(getSurface(Side::Front)->getMaxDeflection()
== getSurface(Side::Back)->getMaxDeflection());
return getSurface(Side::Front)->getMaxDeflection();
}

double CBaseIGULayer::getMeanDeflection() const
{
assert(getSurface(Side::Front)->getMeanDeflection()
== getSurface(Side::Back)->getMeanDeflection());
return getSurface(Side::Front)->getMeanDeflection();
}

double CBaseIGULayer::getConductivity()
{
return getConductionConvectionCoefficient() * m_Thickness;
Expand Down
4 changes: 2 additions & 2 deletions src/Tarcog/src/BaseIGULayer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ namespace Tarcog
double getThickness() const override;
double getTemperature(FenestrationCommon::Side t_Position) const;
double J(FenestrationCommon::Side t_Position) const;
double getMaxDeflection() const;
double getMeanDeflection() const;
virtual double getMaxDeflection() const = 0;
virtual double getMeanDeflection() const = 0;

double getConductivity();

Expand Down
71 changes: 51 additions & 20 deletions src/Tarcog/src/IGU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "IGUGapLayer.hpp"
#include "Surface.hpp"
#include "IGUSolidDeflection.hpp"
#include "IGUGapDeflection.hpp"
#include "IGUVentilatedGapLayer.hpp"
#include "BaseShade.hpp"
#include "Environment.hpp"
Expand Down Expand Up @@ -48,11 +47,7 @@ namespace Tarcog
addLayer(aLayer);
}

if(t_IGU.m_DeflectionFromE1300Curves != nullptr)
{
m_DeflectionFromE1300Curves =
std::make_unique<Deflection::DeflectionE1300>(*t_IGU.m_DeflectionFromE1300Curves);
}
m_DeflectionFromE1300Curves = t_IGU.m_DeflectionFromE1300Curves;

return *this;
}
Expand Down Expand Up @@ -120,7 +115,7 @@ namespace Tarcog
}
m_Tilt = t_Tilt;

if(m_DeflectionFromE1300Curves != nullptr)
if(m_DeflectionFromE1300Curves.has_value())
{
m_DeflectionFromE1300Curves->setIGUTilt(t_Tilt);
}
Expand All @@ -134,7 +129,7 @@ namespace Tarcog
}
m_Width = t_Width;

if(m_DeflectionFromE1300Curves != nullptr)
if(m_DeflectionFromE1300Curves.has_value())
{
m_DeflectionFromE1300Curves->setDimensions(m_Width, m_Height);
}
Expand All @@ -148,7 +143,7 @@ namespace Tarcog
}
m_Height = t_Height;

if(m_DeflectionFromE1300Curves != nullptr)
if(m_DeflectionFromE1300Curves.has_value())
{
m_DeflectionFromE1300Curves->setDimensions(m_Width, m_Height);
}
Expand Down Expand Up @@ -237,7 +232,7 @@ namespace Tarcog
return aRadiosities;
}

std::vector<double> CIGU::getMaxDeflections() const
std::vector<double> CIGU::getMaxLayerDeflections() const
{
std::vector<double> aMaxDeflections;

Expand All @@ -249,7 +244,7 @@ namespace Tarcog
return aMaxDeflections;
}

std::vector<double> CIGU::getMeanDeflections() const
std::vector<double> CIGU::getMeanLayerDeflections() const
{
std::vector<double> aMeanDeflections;

Expand All @@ -261,11 +256,47 @@ namespace Tarcog
return aMeanDeflections;
}

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

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

return aMaxDeflections;
}

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

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

return aMeanDeflections;
}

std::vector<double> CIGU::getGapPressures() const
{
std::vector<double> aPressures;

for(auto const & layer : getGapLayers())
{
aPressures.push_back(layer->getPressure());
}

return aPressures;
}

std::vector<double> CIGU::getPanesLoad()
{
std::vector<double> paneLoad(getSolidLayers().size());

if(m_DeflectionFromE1300Curves != nullptr)
if(m_DeflectionFromE1300Curves.has_value())
{
paneLoad = m_DeflectionFromE1300Curves->results().paneLoad;
}
Expand Down Expand Up @@ -365,13 +396,13 @@ namespace Tarcog
}

std::vector<Deflection::GapData> gapData;
for(const auto & gap : getGapLayers())
for(auto & gap : getGapLayers())
{
gap->setSealedGapProperties(t_Tini, t_Pini);
gapData.emplace_back(gap->getThickness(), t_Tini, t_Pini);
}

m_DeflectionFromE1300Curves =
std::make_unique<Deflection::DeflectionE1300>(m_Width, m_Height, layerData, gapData);
m_DeflectionFromE1300Curves = Deflection::DeflectionE1300(m_Width, m_Height, layerData, gapData);

m_DeflectionFromE1300Curves->setIGUTilt(m_Tilt);
m_DeflectionFromE1300Curves->setInteriorPressure(t_InsidePressure);
Expand Down Expand Up @@ -402,7 +433,7 @@ namespace Tarcog
// In case user sets the deflection properties as pressure and temperauture and then
// reset this back to measured deflection should delete calculator for the deflection
// from E1300 curves.
m_DeflectionFromE1300Curves = nullptr;
m_DeflectionFromE1300Curves = std::nullopt;

if(t_MeasuredDeflections.size() != getNumOfLayers() - 1)
{
Expand All @@ -429,7 +460,7 @@ namespace Tarcog

void CIGU::updateDeflectionState()
{
if(m_DeflectionFromE1300Curves != nullptr)
if(m_DeflectionFromE1300Curves.has_value())
{
const auto gapLayers{getGapLayers()};
std::vector<double> gapTemperatures(gapLayers.size());
Expand Down Expand Up @@ -585,13 +616,13 @@ namespace Tarcog

void CIGU::clearDeflection()
{
m_DeflectionFromE1300Curves = nullptr;
m_DeflectionFromE1300Curves = std::nullopt;
}

void CIGU::setAppliedLoad(std::vector<double> t_AppliedLoad)
{
m_DeflectionAppliedLoad = t_AppliedLoad;
if(m_DeflectionFromE1300Curves != nullptr)
if(m_DeflectionFromE1300Curves.has_value())
{
m_DeflectionFromE1300Curves->setAppliedLoad(std::move(t_AppliedLoad));
}
Expand Down
31 changes: 17 additions & 14 deletions src/Tarcog/src/IGU.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef TARIGU_H
#define TARIGU_H
#pragma once

#include <memory>
#include <vector>
Expand Down Expand Up @@ -49,12 +48,17 @@ namespace Tarcog

[[nodiscard]] std::vector<double> getTemperatures() const;
[[nodiscard]] std::vector<double> getRadiosities() const;
[[nodiscard]] std::vector<double> getMaxDeflections() const;
[[nodiscard]] std::vector<double> getMeanDeflections() const;

[[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> getGapPressures() const;

//! Function to return pressure difference on each of the layers when using deflection
//! model
[[nodiscard]] std::vector<double> getPanesLoad() const;
[[nodiscard]] std::vector<double> getPanesLoad();

[[nodiscard]] double getTilt() const;
[[nodiscard]] double getWidth() const;
Expand Down Expand Up @@ -84,16 +88,18 @@ namespace Tarcog
void precalculateLayerStates();

private:
// Replces layer in existing construction and keeps correct connections in linked list
// Replaces layer in existing construction and keeps correct connections in linked list
void replaceLayer(const std::shared_ptr<CBaseIGULayer> & t_Original,
const std::shared_ptr<CBaseIGULayer> & t_Replacement);

// Check if layer needs to be decorated with another object
void checkForLayerUpgrades(const std::shared_ptr<CBaseLayer> & t_Layer);

double calculateDeflectionNumerator(const std::vector<double> & t_MeasuredDeflections) const;
double calculateDeflectionDenominator() const;
std::vector<double> calculateLDefMax(const std::vector<double> & t_MeasuredDeflections) const;
[[nodiscard]] double
calculateDeflectionNumerator(const std::vector<double> & t_MeasuredDeflections) const;
[[nodiscard]] double calculateDeflectionDenominator() const;
[[nodiscard]] std::vector<double>
calculateLDefMax(const std::vector<double> & t_MeasuredDeflections) const;

std::vector<std::shared_ptr<CBaseLayer>> m_Layers;

Expand All @@ -107,7 +113,7 @@ namespace Tarcog

//! This is by default set to nullptr since deflection is not turn on by default.
//! Setting deflection properties will enable deflection calculations automatically.
std::unique_ptr<Deflection::DeflectionE1300> m_DeflectionFromE1300Curves;
std::optional<Deflection::DeflectionE1300> m_DeflectionFromE1300Curves{std::nullopt};

//! It is possible that user can set applied load before setting initial parameters for
//! the deflection in which case applied load will not be set automatically. This is
Expand All @@ -117,7 +123,4 @@ namespace Tarcog

} // namespace ISO15099

} // namespace Tarcog


#endif
} // namespace Tarcog
Loading

0 comments on commit 8028484

Please sign in to comment.