From a2143fd08709d71fdd3770b275535fae821e7849 Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Mon, 23 May 2022 09:45:25 -0700 Subject: [PATCH 1/5] Add ft test demonstrating bad infil ft when space ft enabled. --- .../SpaceInfiltrationDesignFlowRate_GTest.cpp | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/energyplus/Test/SpaceInfiltrationDesignFlowRate_GTest.cpp b/src/energyplus/Test/SpaceInfiltrationDesignFlowRate_GTest.cpp index 8b78f06b06..d1d2fb8d8a 100644 --- a/src/energyplus/Test/SpaceInfiltrationDesignFlowRate_GTest.cpp +++ b/src/energyplus/Test/SpaceInfiltrationDesignFlowRate_GTest.cpp @@ -90,6 +90,33 @@ TEST_F(EnergyPlusFixture, ForwardTranslator_SpaceInfiltrationDesignFlowRate) { EXPECT_FALSE(objects[0].getDouble(ZoneInfiltration_DesignFlowRateFields::AirChangesperHour)); } +TEST_F(EnergyPlusFixture, ForwardTranslator_SpaceInfiltrationDesignFlowRate_SpaceTranslation) { + Model model; + + ThermalZone zone(model); + + Space space(model); + space.setThermalZone(zone); + + SpaceInfiltrationDesignFlowRate infiltration(model); + infiltration.setAirChangesperHour(0.1); + infiltration.setSpace(space); + + ForwardTranslator ft; + Workspace workspace = ft.translateModel(model); + + std::vector objects = workspace.getObjectsByType(IddObjectType::ZoneInfiltration_DesignFlowRate); + ASSERT_EQ(1u, objects.size()); + + ASSERT_TRUE(objects[0].getString(ZoneInfiltration_DesignFlowRateFields::DesignFlowRateCalculationMethod)); + EXPECT_EQ("AirChanges/Hour", objects[0].getString(ZoneInfiltration_DesignFlowRateFields::DesignFlowRateCalculationMethod).get()); + EXPECT_FALSE(objects[0].getDouble(ZoneInfiltration_DesignFlowRateFields::DesignFlowRate)); + EXPECT_FALSE(objects[0].getDouble(ZoneInfiltration_DesignFlowRateFields::FlowperZoneFloorArea)); + EXPECT_FALSE(objects[0].getDouble(ZoneInfiltration_DesignFlowRateFields::FlowperExteriorSurfaceArea)); + ASSERT_TRUE(objects[0].getDouble(ZoneInfiltration_DesignFlowRateFields::AirChangesperHour)); + EXPECT_EQ(0.1, objects[0].getDouble(ZoneInfiltration_DesignFlowRateFields::AirChangesperHour).get()); +} + TEST_F(EnergyPlusFixture, ForwardTranslator_SpaceInfiltrationDesignFlowRate_SpaceTypes) { Model m; From d1e69aa18b60a1635b2f2a9e53be42c1cef168f5 Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Mon, 23 May 2022 14:20:44 -0700 Subject: [PATCH 2/5] Only hardsize if spaces greater than 1. --- src/energyplus/ForwardTranslator.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/energyplus/ForwardTranslator.cpp b/src/energyplus/ForwardTranslator.cpp index 2a5a03730f..f1f3eba9e0 100644 --- a/src/energyplus/ForwardTranslator.cpp +++ b/src/energyplus/ForwardTranslator.cpp @@ -379,9 +379,10 @@ namespace energyplus { // That includes the Space ones too. // SpaceInfiltrationEffectiveLeakageAreas and SpaceInfiltrationFlowCoefficients don't need it, they are always absolute for (auto& infil : model.getConcreteModelObjects()) { - // TODO: technically we only need to do that if the space it's assigned to is part of a thermalzone with more than one space - // Same reason as above: not doing it for now - infil.hardSize(); + // technically we only need to hardsize if the space it's assigned to is part of a thermalzone with more than one space + if (infil.space() && !openstudio::istringEqual("Flow/Space", infil.designFlowRateCalculationMethod()) && infil.space()->thermalZone().spaces().size() > 1) { + infil.hardSize(); // translates to Flow/Zone + } } } From 073592bd76977a493360847ccadfac23252520c0 Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Mon, 23 May 2022 14:24:04 -0700 Subject: [PATCH 3/5] Clang. --- src/energyplus/ForwardTranslator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/energyplus/ForwardTranslator.cpp b/src/energyplus/ForwardTranslator.cpp index f1f3eba9e0..181bf9b7e0 100644 --- a/src/energyplus/ForwardTranslator.cpp +++ b/src/energyplus/ForwardTranslator.cpp @@ -380,7 +380,8 @@ namespace energyplus { // SpaceInfiltrationEffectiveLeakageAreas and SpaceInfiltrationFlowCoefficients don't need it, they are always absolute for (auto& infil : model.getConcreteModelObjects()) { // technically we only need to hardsize if the space it's assigned to is part of a thermalzone with more than one space - if (infil.space() && !openstudio::istringEqual("Flow/Space", infil.designFlowRateCalculationMethod()) && infil.space()->thermalZone().spaces().size() > 1) { + if (infil.space() && !openstudio::istringEqual("Flow/Space", infil.designFlowRateCalculationMethod()) + && infil.space()->thermalZone().spaces().size() > 1) { infil.hardSize(); // translates to Flow/Zone } } From ed63122d812aed1c22437ad7f6b6074c5a23cc1f Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Mon, 23 May 2022 15:10:01 -0700 Subject: [PATCH 4/5] Fix new check. --- src/energyplus/ForwardTranslator.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/energyplus/ForwardTranslator.cpp b/src/energyplus/ForwardTranslator.cpp index 181bf9b7e0..faf429eb62 100644 --- a/src/energyplus/ForwardTranslator.cpp +++ b/src/energyplus/ForwardTranslator.cpp @@ -380,9 +380,10 @@ namespace energyplus { // SpaceInfiltrationEffectiveLeakageAreas and SpaceInfiltrationFlowCoefficients don't need it, they are always absolute for (auto& infil : model.getConcreteModelObjects()) { // technically we only need to hardsize if the space it's assigned to is part of a thermalzone with more than one space - if (infil.space() && !openstudio::istringEqual("Flow/Space", infil.designFlowRateCalculationMethod()) - && infil.space()->thermalZone().spaces().size() > 1) { - infil.hardSize(); // translates to Flow/Zone + if (!openstudio::istringEqual("Flow/Space", infil.designFlowRateCalculationMethod()) { + if (infil.space() && infil.space()->thermalZone() && infil.space()->thermalZone()->spaces().size() > 1) { + infil.hardSize(); // translates to Flow/Zone + } } } } From df253e846f0de82033e9d38fad1c6765c56080f5 Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Mon, 23 May 2022 15:27:14 -0700 Subject: [PATCH 5/5] Typo. --- src/energyplus/ForwardTranslator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/energyplus/ForwardTranslator.cpp b/src/energyplus/ForwardTranslator.cpp index faf429eb62..1caf909689 100644 --- a/src/energyplus/ForwardTranslator.cpp +++ b/src/energyplus/ForwardTranslator.cpp @@ -380,7 +380,7 @@ namespace energyplus { // SpaceInfiltrationEffectiveLeakageAreas and SpaceInfiltrationFlowCoefficients don't need it, they are always absolute for (auto& infil : model.getConcreteModelObjects()) { // technically we only need to hardsize if the space it's assigned to is part of a thermalzone with more than one space - if (!openstudio::istringEqual("Flow/Space", infil.designFlowRateCalculationMethod()) { + if (!openstudio::istringEqual("Flow/Space", infil.designFlowRateCalculationMethod())) { if (infil.space() && infil.space()->thermalZone() && infil.space()->thermalZone()->spaces().size() > 1) { infil.hardSize(); // translates to Flow/Zone }