Skip to content

Commit

Permalink
Merge pull request #4593 from NREL/space-ft-zone-infil
Browse files Browse the repository at this point in the history
Fix ZoneInfiltration:DesignFlowRate FT when Space FT enabled
  • Loading branch information
joseph-robertson committed May 24, 2022
2 parents d39d697 + df253e8 commit 9f64a57
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/energyplus/ForwardTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<SpaceInfiltrationDesignFlowRate>()) {
// 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
}
}
}
}

Expand Down
27 changes: 27 additions & 0 deletions src/energyplus/Test/SpaceInfiltrationDesignFlowRate_GTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<WorkspaceObject> 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;
Expand Down

0 comments on commit 9f64a57

Please sign in to comment.