Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/MeasuredDeflection' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenCzarnecki committed Jul 28, 2023
2 parents 32679cb + f6a7894 commit 401b88e
Show file tree
Hide file tree
Showing 482 changed files with 6,040 additions and 5,908 deletions.
2 changes: 1 addition & 1 deletion CMakeLists-Windows-CalcEngine.txt.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ include(ExternalProject)

ExternalProject_Add(Windows-CalcEngine
GIT_REPOSITORY https://github.com/LBNL-ETA/Windows-CalcEngine.git
GIT_TAG "main"
GIT_TAG "Version_1.0.43"

UPDATE_COMMAND ""
PATCH_COMMAND ""
Expand Down
30 changes: 22 additions & 8 deletions src/glazing_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ namespace wincalc

void Glazing_System::reset_igu()
{
optical_system_for_thermal_calcs = nullptr;
optical_system_for_thermal_calcs = nullptr;
current_igu = std::nullopt;
reset_system();
}
Expand Down Expand Up @@ -177,17 +177,24 @@ namespace wincalc

if(system_type == Tarcog::ISO15099::System::SHGC)
{
auto solar_front_absorptances = get_solar_abs_front(theta, phi);
auto solar_front_absorptances = get_solar_abs_front(theta, phi);
system.setAbsorptances(solar_front_absorptances);
}
return system.getTemperatures(system_type);
}

void Glazing_System::set_deflection_properties(double temperature_initial,
double pressure_initial)
void Glazing_System::set_deflection_properties(double temperature_at_construction,
double pressure_at_construction)
{
initial_pressure = pressure_initial;
initial_temperature = temperature_initial;
deflection_properties =
Temperature_Pressure{temperature_at_construction, pressure_at_construction};
do_deflection_updates(last_theta, last_phi);
}

void
Glazing_System::set_deflection_properties(const std::vector<double> & measured_deflected_gaps)
{
deflection_properties = measured_deflected_gaps;
do_deflection_updates(last_theta, last_phi);
}

Expand Down Expand Up @@ -216,7 +223,14 @@ namespace wincalc
auto & system = get_system(theta, phi);
if(model_deflection)
{
system.setDeflectionProperties(initial_temperature, initial_pressure);
if(auto state_ptr = std::get_if<Temperature_Pressure>(&deflection_properties))
{
system.setDeflectionProperties(state_ptr->temperature, state_ptr->pressure);
}
else if(auto vector_ptr = std::get_if<std::vector<double>>(&deflection_properties))
{
system.setDeflectionProperties(*vector_ptr);
}
}
else
{
Expand Down Expand Up @@ -257,7 +271,7 @@ namespace wincalc
do_deflection_updates(theta, phi);
auto & system = get_system(theta, phi);

auto solar_front_transmittance = get_solar_transmittance_front(theta, phi);
auto solar_front_transmittance = get_solar_transmittance_front(theta, phi);

return system.relativeHeatGain(solar_front_transmittance);
}
Expand Down
23 changes: 17 additions & 6 deletions src/glazing_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,21 @@

namespace wincalc
{
// Some calculations require window data at the moment when it was made. For example, this is
// used to calculate deflection.
struct Temperature_Pressure
{
double temperature{293.15};
double pressure{101325};
};

struct Glazing_System
{
Glazing_System(
window_standards::Optical_Standard const & standard,
std::vector<Product_Data_Optical_Thermal> const & product_data,
std::vector<std::shared_ptr<Tarcog::ISO15099::CIGUGapLayer>> const & gap_values = std::vector<std::shared_ptr<Tarcog::ISO15099::CIGUGapLayer>>(),
std::vector<std::shared_ptr<Tarcog::ISO15099::CIGUGapLayer>> const & gap_values =
std::vector<std::shared_ptr<Tarcog::ISO15099::CIGUGapLayer>>(),
double width = 1.0,
double height = 1.0,
double tilt = 90,
Expand All @@ -35,7 +44,8 @@ namespace wincalc
Glazing_System(
window_standards::Optical_Standard const & standard,
std::vector<OpticsParser::ProductData> const & product_data,
std::vector<std::shared_ptr<Tarcog::ISO15099::CIGUGapLayer>> const & gap_values = std::vector<std::shared_ptr<Tarcog::ISO15099::CIGUGapLayer>>(),
std::vector<std::shared_ptr<Tarcog::ISO15099::CIGUGapLayer>> const & gap_values =
std::vector<std::shared_ptr<Tarcog::ISO15099::CIGUGapLayer>>(),
double width = 1.0,
double height = 1.0,
double tilt = 90,
Expand All @@ -52,7 +62,8 @@ namespace wincalc
window_standards::Optical_Standard const & standard,
std::vector<std::variant<OpticsParser::ProductData, Product_Data_Optical_Thermal>> const &
product_data,
std::vector<std::shared_ptr<Tarcog::ISO15099::CIGUGapLayer>> const & gap_values = std::vector<std::shared_ptr<Tarcog::ISO15099::CIGUGapLayer>>(),
std::vector<std::shared_ptr<Tarcog::ISO15099::CIGUGapLayer>> const & gap_values =
std::vector<std::shared_ptr<Tarcog::ISO15099::CIGUGapLayer>>(),
double width = 1.0,
double height = 1.0,
double tilt = 90,
Expand All @@ -72,7 +83,8 @@ namespace wincalc
double phi = 0);

void enable_deflection(bool model);
void set_deflection_properties(double temperature_initial, double pressure_initial);
void set_deflection_properties(double temperature_at_construction, double pressure_at_construction);
void set_deflection_properties(std::vector<double> const & measured_deflected_gaps);
void set_applied_loads(std::vector<double> const & loads);
Deflection_Results calc_deflection_properties(Tarcog::ISO15099::System system_type,
double theta = 0,
Expand Down Expand Up @@ -134,8 +146,7 @@ namespace wincalc
int number_visible_bands;
int number_solar_bands;
bool model_deflection = false;
double initial_temperature = 293.15;
double initial_pressure = 101325;
std::variant<Temperature_Pressure, std::vector<double>> deflection_properties;
std::vector<double> applied_loads;

void do_deflection_updates(double theta, double phi);
Expand Down
11 changes: 9 additions & 2 deletions test/deflection_triple_clear.unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ class TestDeflectionTripleClear : public testing::Test
Optical_Standard standard = load_optical_standard(standard_path.string());

auto environments = nfrc_u_environments();
environments.outside.air_temperature = 250;
environments.inside.air_temperature = 293;
glazing_system =
std::make_shared<Glazing_System>(standard, products, gaps, 1.0, 1.0, 90, environments);
}
Expand All @@ -74,3 +72,12 @@ TEST_F(TestDeflectionTripleClear, Test_Deflection_On)
test_deflection_results(
"NFRC_102_NFRC_102_NFRC_102", "deflection/deflection_on", glazing_system, update_results);
}

TEST_F(TestDeflectionTripleClear, Test_Deflection_Measured)
{
glazing_system->enable_deflection(true);
const std::vector<double> measured_deflected_gaps = {0.0135, 0.013};
glazing_system->set_deflection_properties(measured_deflected_gaps);
test_deflection_results(
"NFRC_102_NFRC_102_NFRC_102", "deflection/deflection_measured", glazing_system, update_results);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
"absorptance": {
"electricity_diffuse": 0.0,
"electricity_direct": 0.0,
"heat_diffuse": 0.2425233652445944,
"heat_diffuse": 0.24252336524459428,
"heat_direct": 0.24175548255965412,
"total_diffuse": 0.2425233652445944,
"total_diffuse": 0.24252336524459428,
"total_direct": 0.24175548255965412
}
},
"front": {
"absorptance": {
"electricity_diffuse": 0.0,
"electricity_direct": 0.0,
"heat_diffuse": 0.3162918075980192,
"heat_diffuse": 0.3162918075980193,
"heat_direct": 0.2862456341778951,
"total_diffuse": 0.3162918075980192,
"total_diffuse": 0.3162918075980193,
"total_direct": 0.2862456341778951
}
}
Expand All @@ -27,19 +27,19 @@
"absorptance": {
"electricity_diffuse": 0.0,
"electricity_direct": 0.0,
"heat_diffuse": 0.026698101641534643,
"heat_diffuse": 0.026698101641534605,
"heat_direct": 0.022774407540551905,
"total_diffuse": 0.026698101641534643,
"total_diffuse": 0.026698101641534605,
"total_direct": 0.022774407540551905
}
},
"front": {
"absorptance": {
"electricity_diffuse": 0.0,
"electricity_direct": 0.0,
"heat_diffuse": 0.011871410362430725,
"heat_diffuse": 0.011871410362430713,
"heat_direct": 0.011929292834135068,
"total_diffuse": 0.011871410362430725,
"total_diffuse": 0.011871410362430713,
"total_direct": 0.011929292834135068
}
}
Expand All @@ -48,7 +48,7 @@
"system_results": {
"back": {
"reflectance": {
"diffuse_diffuse": 0.28388931756741276,
"diffuse_diffuse": 0.2838893175674128,
"direct_diffuse": 0.0,
"direct_direct": 0.1917724829575637,
"direct_hemispherical": 0.1917724829575637
Expand All @@ -68,7 +68,7 @@
"direct_hemispherical": 0.15812744604573958
},
"transmittance": {
"diffuse_diffuse": 0.44688921554645816,
"diffuse_diffuse": 0.4468892155464582,
"direct_diffuse": 0.0,
"direct_direct": 0.5436976269422304,
"direct_hemispherical": 0.5436976269422304
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
"absorptance": {
"electricity_diffuse": 0.0,
"electricity_direct": 0.0,
"heat_diffuse": 0.28197185286115567,
"heat_diffuse": 0.28197185286115584,
"heat_direct": 0.3086305993398974,
"total_diffuse": 0.28197185286115567,
"total_diffuse": 0.28197185286115584,
"total_direct": 0.3086305993398974
}
},
"front": {
"absorptance": {
"electricity_diffuse": 0.0,
"electricity_direct": 0.0,
"heat_diffuse": 0.32753274457749715,
"heat_diffuse": 0.32753274457749726,
"heat_direct": 0.33106581782176825,
"total_diffuse": 0.32753274457749715,
"total_diffuse": 0.32753274457749726,
"total_direct": 0.33106581782176825
}
}
Expand All @@ -27,19 +27,19 @@
"absorptance": {
"electricity_diffuse": 0.0,
"electricity_direct": 0.0,
"heat_diffuse": 0.14753871024644782,
"heat_diffuse": 0.14753871024644788,
"heat_direct": 0.13412365381677963,
"total_diffuse": 0.14753871024644782,
"total_diffuse": 0.14753871024644788,
"total_direct": 0.13412365381677963
}
},
"front": {
"absorptance": {
"electricity_diffuse": 0.0,
"electricity_direct": 0.0,
"heat_diffuse": 0.007563495685917212,
"heat_diffuse": 0.00756349568591721,
"heat_direct": 0.007575419070430223,
"total_diffuse": 0.007563495685917212,
"total_diffuse": 0.00756349568591721,
"total_direct": 0.007575419070430223
}
}
Expand All @@ -48,13 +48,13 @@
"system_results": {
"back": {
"reflectance": {
"diffuse_diffuse": 0.3977773465676951,
"diffuse_diffuse": 0.39777734656769526,
"direct_diffuse": 0.0,
"direct_direct": 0.3470273899436142,
"direct_hemispherical": 0.3470273899436142
},
"transmittance": {
"diffuse_diffuse": 0.17271209032470128,
"diffuse_diffuse": 0.17271209032470136,
"direct_diffuse": 0.0,
"direct_direct": 0.21021835689970875,
"direct_hemispherical": 0.21021835689970875
Expand All @@ -68,7 +68,7 @@
"direct_hemispherical": 0.4511404062080929
},
"transmittance": {
"diffuse_diffuse": 0.17271209032470128,
"diffuse_diffuse": 0.17271209032470136,
"direct_diffuse": 0.0,
"direct_direct": 0.21021835689970875,
"direct_hemispherical": 0.21021835689970875
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"absorptance": {
"electricity_diffuse": 0.0,
"electricity_direct": 0.0,
"heat_diffuse": 0.3836657641620822,
"heat_diffuse": 0.38366576416208226,
"heat_direct": 0.41980443713030346,
"total_diffuse": 0.3836657641620822,
"total_diffuse": 0.38366576416208226,
"total_direct": 0.41980443713030346
}
},
Expand All @@ -27,19 +27,19 @@
"absorptance": {
"electricity_diffuse": 0.0,
"electricity_direct": 0.0,
"heat_diffuse": 0.11208182287096927,
"heat_diffuse": 0.11208182287096918,
"heat_direct": 0.11150014693629536,
"total_diffuse": 0.11208182287096927,
"total_diffuse": 0.11208182287096918,
"total_direct": 0.11150014693629536
}
},
"front": {
"absorptance": {
"electricity_diffuse": 0.0,
"electricity_direct": 0.0,
"heat_diffuse": 0.006180784286805471,
"heat_diffuse": 0.0061807842868054595,
"heat_direct": 0.00621807535372788,
"total_diffuse": 0.006180784286805471,
"total_diffuse": 0.0061807842868054595,
"total_direct": 0.00621807535372788
}
}
Expand All @@ -62,7 +62,7 @@
},
"front": {
"reflectance": {
"diffuse_diffuse": 0.26937749525369725,
"diffuse_diffuse": 0.2693774952536974,
"direct_diffuse": 0.0,
"direct_direct": 0.20949849790278505,
"direct_hemispherical": 0.20949849790278505
Expand Down
Loading

0 comments on commit 401b88e

Please sign in to comment.