Skip to content

Commit

Permalink
Merge pull request #25 from LBNL-ETA/VacuumDec2023
Browse files Browse the repository at this point in the history
Vacuum dec2023
  • Loading branch information
StephenCzarnecki authored Jul 24, 2024
2 parents 98f4a62 + 7adfca6 commit fecd21e
Show file tree
Hide file tree
Showing 401 changed files with 11,991 additions and 5,922 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [windows-2019, windows-2022, macos-11.0, ubuntu-latest]
os: [windows-2019, windows-2022, macos-12, macos-14, ubuntu-latest]
# arch: [x86, x64]

steps:
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists-OpticalMeasurementParser.txt.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ include(ExternalProject)

ExternalProject_Add(OpticalMeasurementParser
GIT_REPOSITORY https://github.com/LBNL-ETA/OpticalMeasurementParser.git
GIT_TAG "v2.0.0"
GIT_TAG "v2.2.0"

UPDATE_COMMAND ""
PATCH_COMMAND ""
Expand Down
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 "Version_1.0.46"
GIT_TAG "Version_1.0.47"

UPDATE_COMMAND ""
PATCH_COMMAND ""
Expand Down
39 changes: 19 additions & 20 deletions src/create_wce_objects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,8 @@ namespace wincalc
SpectralAveraging::CSpectralSampleData::create(measured_wavelength_data);

std::shared_ptr<SingleLayerOptics::CMaterial> material =
SingleLayerOptics::Material::nBandMaterial(spectral_sample_data,
product_data.thickness_meters,
product_data.material_type);
SingleLayerOptics::Material::nBandMaterial(
spectral_sample_data, product_data.thickness_meters, product_data.material_type);
return material;
}

Expand All @@ -460,10 +459,8 @@ namespace wincalc
auto pvSample = std::make_shared<SpectralAveraging::PhotovoltaicSampleData>(
measured_wavelength_data, eqef, eqeb);

auto material =
SingleLayerOptics::Material::nBandPhotovoltaicMaterial(pvSample,
product_data.thickness_meters,
product_data.material_type);
auto material = SingleLayerOptics::Material::nBandPhotovoltaicMaterial(
pvSample, product_data.thickness_meters, product_data.material_type);

return material;
}
Expand Down Expand Up @@ -1081,11 +1078,11 @@ namespace wincalc
layer.thermal_data->opening_bottom,
layer.thermal_data->opening_left,
layer.thermal_data->opening_right);
auto effective_openness = effective_thermal_values->getEffectiveOpenness();

auto tarcog_layer =
Tarcog::ISO15099::Layers::shading(effective_thermal_values->effectiveThickness(),
layer.thermal_data->conductivity.value(),
effective_openness,
effective_thermal_values->getEffectiveOpenness(),
ir_results.emissivity_front_hemispheric,
ir_results.transmittance_front_diffuse_diffuse,
ir_results.emissivity_back_hemispheric,
Expand All @@ -1110,15 +1107,17 @@ namespace wincalc
return system;
}

Gases::CGas create_gas(std::vector<std::pair<double, std::variant<Gases::GasDef, Gases::CGasData>>> const& components)
{
auto gas = Gases::CGas();
for(const auto & item : components)
{
auto percent = item.first;
std::visit([&gas, percent](auto arg) { gas.addGasItem(percent, arg); }, item.second);
}

return gas;
}
Gases::CGas create_gas(
std::vector<std::pair<double, std::variant<Gases::GasDef, Gases::CGasData>>> const &
components)
{
auto gas = Gases::CGas();
for(const auto & item : components)
{
auto percent = item.first;
std::visit([&gas, percent](auto arg) { gas.addGasItem(percent, arg); }, item.second);
}

return gas;
}
} // namespace wincalc
21 changes: 21 additions & 0 deletions src/glazing_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,17 @@ namespace wincalc
return product_data;
}

void Glazing_System::gap_layers(std::vector<std::shared_ptr<Tarcog::ISO15099::CIGUGapLayer>> const & layers)
{
reset_igu();
gap_values = layers;
}

std::vector<std::shared_ptr<Tarcog::ISO15099::CIGUGapLayer>> Glazing_System::gap_layers() const
{
return gap_values;
}

void Glazing_System::sort_spectral_data()
{
for(auto & product : product_data)
Expand Down Expand Up @@ -507,6 +518,16 @@ namespace wincalc
return bsdf_hemisphere.has_value();
}

double Glazing_System::overallThickness() const
{
if(current_igu.has_value())
{
return current_igu.value().getThickness();
}

return 0.0;
}


SingleLayerOptics::IScatteringLayer & Glazing_System::get_optical_system_for_thermal_calcs()
{
Expand Down
5 changes: 5 additions & 0 deletions src/glazing_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ namespace wincalc
void solid_layers(std::vector<Product_Data_Optical_Thermal> const & layers);
std::vector<Product_Data_Optical_Thermal> solid_layers() const;

void gap_layers(std::vector<std::shared_ptr<Tarcog::ISO15099::CIGUGapLayer>> const & layers);
std::vector<std::shared_ptr<Tarcog::ISO15099::CIGUGapLayer>> gap_layers() const;

Environments environments() const;
void environments(Environments const & environment);

Expand All @@ -132,6 +135,8 @@ namespace wincalc

bool isBSDF();

[[nodiscard]] double overallThickness() const;


protected:
std::vector<Product_Data_Optical_Thermal> product_data;
Expand Down
51 changes: 29 additions & 22 deletions src/product_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ namespace wincalc
double gap_width_right) const
{
double front_openness =
ThermalPermeability::Venetian::openness(geometry.slat_tilt,
geometry.slat_spacing,
material_optical_data->thickness_meters,
geometry.slat_curvature,
geometry.slat_width);
ThermalPermeability::Venetian::frontOpenness(geometry.slat_tilt,
geometry.slat_spacing,
material_optical_data->thickness_meters,
geometry.slat_curvature,
geometry.slat_width);

EffectiveLayers::ShadeOpenness openness{
front_openness, gap_width_left, gap_width_right, gap_width_top, gap_width_bottom};
Expand Down Expand Up @@ -170,8 +170,8 @@ namespace wincalc
double gap_width_left,
double gap_width_right) const
{
double front_openness =
ThermalPermeability::Woven::openness(geometry.thread_diameter, geometry.thread_spacing);
double front_openness = ThermalPermeability::Woven::frontOpenness(geometry.thread_diameter,
geometry.thread_spacing);
EffectiveLayers::ShadeOpenness openness{
front_openness, gap_width_left, gap_width_right, gap_width_top, gap_width_bottom};

Expand Down Expand Up @@ -201,28 +201,26 @@ namespace wincalc
{
std::map<Perforated_Geometry::Type, std::function<double(void)>> front_openness_calcs;
front_openness_calcs[Perforated_Geometry::Type::CIRCULAR] = [=]() {
auto cell_dimension =
ThermalPermeability::Perforated::diameterToXYDimension(geometry.dimension_x * 2);
return ThermalPermeability::Perforated::openness(
ThermalPermeability::Perforated::Geometry::Circular,
return ThermalPermeability::Perforated::frontOpenness(
ThermalPermeability::Perforated::Type::Circular,
geometry.spacing_x,
geometry.spacing_y,
cell_dimension.x,
cell_dimension.y);
geometry.dimension_x * 2,
geometry.dimension_x * 2);
};

front_openness_calcs[Perforated_Geometry::Type::RECTANGULAR] = [=]() {
return ThermalPermeability::Perforated::openness(
ThermalPermeability::Perforated::Geometry::Rectangular,
return ThermalPermeability::Perforated::frontOpenness(
ThermalPermeability::Perforated::Type::Rectangular,
geometry.spacing_x,
geometry.spacing_y,
geometry.dimension_x,
geometry.dimension_y);
};

front_openness_calcs[Perforated_Geometry::Type::SQUARE] = [=]() {
return ThermalPermeability::Perforated::openness(
ThermalPermeability::Perforated::Geometry::Square,
return ThermalPermeability::Perforated::frontOpenness(
ThermalPermeability::Perforated::Type::Square,
geometry.spacing_x,
geometry.spacing_y,
geometry.dimension_x,
Expand Down Expand Up @@ -265,7 +263,8 @@ namespace wincalc
std::optional<double> emissivity_front,
std::optional<double> emissivity_back,
double permeability_factor,
bool flipped) :
bool flipped,
bool user_defined_effective_values) :
Product_Data_Dual_Band_Optical(thickness_meteres,
ir_transmittance_front,
ir_transmittance_back,
Expand All @@ -281,7 +280,8 @@ namespace wincalc
tf_visible(tf_visible),
tb_visible(tb_visible),
rf_visible(rf_visible),
rb_visible(rb_visible)
rb_visible(rb_visible),
user_defined_effective_values(user_defined_effective_values)
{}

std::unique_ptr<EffectiveLayers::EffectiveLayer>
Expand All @@ -294,9 +294,16 @@ namespace wincalc
{
EffectiveLayers::ShadeOpenness openness{
permeability_factor, gap_width_left, gap_width_right, gap_width_top, gap_width_bottom};

return std::make_unique<EffectiveLayers::EffectiveLayerBSDF>(
width, height, thickness_meters, openness);
if(user_defined_effective_values)
{
return std::make_unique<EffectiveLayers::EffectiveLayerOther>(
width, height, thickness_meters, openness);
}
else
{
return std::make_unique<EffectiveLayers::EffectiveLayerBSDF>(
width, height, thickness_meters, openness);
}
}

Product_Data_Dual_Band_Optical_Hemispheric::Product_Data_Dual_Band_Optical_Hemispheric(
Expand Down
5 changes: 3 additions & 2 deletions src/product_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ namespace wincalc
std::optional<double> emissivity_front = std::optional<double>(),
std::optional<double> emissivity_back = std::optional<double>(),
double permeability_factor = 0,
bool flipped = false);
bool flipped = false,
bool user_defined_effective_values = false);

SingleLayerOptics::BSDFHemisphere bsdf_hemisphere;

Expand All @@ -157,7 +158,7 @@ namespace wincalc
std::vector<std::vector<double>> tb_visible;
std::vector<std::vector<double>> rf_visible;
std::vector<std::vector<double>> rb_visible;

bool user_defined_effective_values;
std::unique_ptr<EffectiveLayers::EffectiveLayer>
effective_thermal_values(double width,
double height,
Expand Down
4 changes: 3 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/googletest-src
EXCLUDE_FROM_ALL)

add_executable(${PROJECT_TEST_NAME}
bsdf_xml_thermal_user_defined_openness.unit.cpp
nfrc_102_nfrc_102_forced_ventilation.unit.cpp
nfrc_102_nfrc_102_vacuum.unit.cpp
deflection_triple_clear.unit.cpp
deflection_youngs_modulus.unit.cpp
deflection.unit.cpp
Expand All @@ -43,7 +45,7 @@ add_executable(${PROJECT_TEST_NAME}
perforated_screen.unit.cpp
#double_layer_perfect_clear_exterior_interior_xml_with_thermal_openings_10mm_all_sides.unit.cpp
#double_layer_interior_xml_with_thermal_openings_10mm_all_sides.unit.cpp
bsdf_xml_thermal_openness.unit.cpp
bsdf_xml_thermal_openness.unit.cpp
CS03_genBSDF.unit.cpp
SEATEX_Midnight.unit.cpp
nfrc_102_as_bsdf.unit.cpp
Expand Down
1 change: 1 addition & 0 deletions test/bsdf_xml_thermal_openness.unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class TestBSDFThermalOpenness : public testing::Test
converted_shade.thermal_data->opening_bottom = 0.01;
converted_shade.thermal_data->opening_left = 0;
converted_shade.thermal_data->opening_right = 0;

products.push_back(clear_3);
products.push_back(converted_shade);

Expand Down
92 changes: 92 additions & 0 deletions test/bsdf_xml_thermal_user_defined_openness.unit.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#include <memory>
#include <gtest/gtest.h>
#include <cstdlib>
#include <memory>
#include <iostream>
#include <filesystem>
#include <fstream>

#include "wincalc/wincalc.h"
#include "optical_calcs.h"
#include "util.h"
#include "convert_optics_parser.h"
#include "paths.h"


using namespace wincalc;
using namespace window_standards;

class TestBSDFThermalUserDefinedOpenness : public testing::Test
{
protected:
std::shared_ptr<Glazing_System> glazing_system_u;
std::shared_ptr<Glazing_System> glazing_system_shgc;

virtual void SetUp()
{
std::filesystem::path clear_3_path(test_dir);
clear_3_path /= "products";
clear_3_path /= "CLEAR_3.json";

std::filesystem::path shade_path(test_dir);
shade_path /= "products";
shade_path /= "2011-SA1.XML";

std::vector<std::variant<OpticsParser::ProductData, wincalc::Product_Data_Optical_Thermal>>
products;

auto clear_3 = OpticsParser::parseJSONFile(clear_3_path.string());
auto shade = OpticsParser::parseBSDFXMLFile(shade_path.string());
auto converted_shade = wincalc::convert_to_solid_layer(shade);
converted_shade.thermal_data->opening_top = 0.01;
converted_shade.thermal_data->opening_bottom = 0.01;
converted_shade.thermal_data->opening_left = 0;
converted_shade.thermal_data->opening_right = 0;

std::dynamic_pointer_cast<Product_Data_Dual_Band_Optical_BSDF>(converted_shade.optical_data)
->user_defined_effective_values = true;
converted_shade.optical_data->permeability_factor = 0.0789;
converted_shade.optical_data->thickness_meters = 0.0123;

products.push_back(clear_3);
products.push_back(converted_shade);

double gap_thickness = 0.0127;
double gap_pressure = Gases::DefaultPressure;
auto air_gap = std::make_shared<Tarcog::ISO15099::CIGUGapLayer>(
gap_thickness, gap_pressure, Gases::CGas({{1.0, Gases::GasDef::Air}}));
std::vector<std::shared_ptr<Tarcog::ISO15099::CIGUGapLayer>> gaps;
gaps.push_back(air_gap);

std::filesystem::path standard_path(test_dir);
standard_path /= "standards";
standard_path /= "W5_NFRC_2003.std";
Optical_Standard standard = load_optical_standard(standard_path.string());

auto bsdf_hemisphere =
SingleLayerOptics::BSDFHemisphere::create(SingleLayerOptics::BSDFBasis::Full);

glazing_system_u = std::make_shared<Glazing_System>(
standard, products, gaps, 1.0, 1.0, 90, nfrc_u_environments(), bsdf_hemisphere);
glazing_system_shgc = std::make_shared<Glazing_System>(
standard, products, gaps, 1.0, 1.0, 90, nfrc_shgc_environments(), bsdf_hemisphere);
}
};

TEST_F(TestBSDFThermalUserDefinedOpenness, Test_Thermal)
{
test_thermal_results("thermal_user_defined_openings_xml_shade_10mm_top_and_bottom",
"thermal_U_Environment",
glazing_system_u,
update_results);
test_thermal_results("thermal_user_defined_openings_xml_shade_10mm_top_and_bottom",
"thermal_SHGC_Environment",
glazing_system_shgc,
update_results);
}

TEST_F(TestBSDFThermalUserDefinedOpenness, Test_Optical)
{
test_optical_results(
"thermal_openings_xml_shade_10mm_top_and_bottom", glazing_system_u, update_results);
}
Loading

0 comments on commit fecd21e

Please sign in to comment.