Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ZoneInfiltration:DesignFlowRate FT when Space FT enabled #4593

Merged
merged 5 commits into from
May 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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