diff --git a/src/energyplus/ForwardTranslator.cpp b/src/energyplus/ForwardTranslator.cpp index 2a5a03730f..1caf909689 100644 --- a/src/energyplus/ForwardTranslator.cpp +++ b/src/energyplus/ForwardTranslator.cpp @@ -379,9 +379,12 @@ 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 (!openstudio::istringEqual("Flow/Space", infil.designFlowRateCalculationMethod())) { + if (infil.space() && infil.space()->thermalZone() && infil.space()->thermalZone()->spaces().size() > 1) { + infil.hardSize(); // translates to Flow/Zone + } + } } } 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;