Skip to content

Commit

Permalink
Idd changes for ZoneAirMassFlowConservation + VT + VT Test
Browse files Browse the repository at this point in the history
  • Loading branch information
jmarrec committed Feb 23, 2021
1 parent d3e08d5 commit 6227f38
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 11 deletions.
27 changes: 19 additions & 8 deletions resources/energyplus/ProposedEnergy+.idd
Original file line number Diff line number Diff line change
Expand Up @@ -799,14 +799,25 @@ ZoneAirMassFlowConservation,
\memo infiltration objects.
\unique-object
\min-fields 3
A1, \field Adjust Zone Mixing For Zone Air Mass Flow Balance
\note If Yes, Zone mixing object flow rates are adjusted to balance the zone air mass flow
\note and additional infiltration air flow may be added if required in order to balance the
\note zone air mass flow.
\type choice
\key Yes
\key No
\default No
A1, \field Adjust Zone Mixing and Return For Air Mass Flow Balance
\note If "AdjustMixingOnly", zone mixing object flow rates are adjusted to balance the zone air mass
\note flow and zone infiltration air flow may be increased or decreased if required in order to balance
\note the zone air mass flow. If "AdjustReturnOnly", zone total return flow rate is adjusted to balance
\note the zone air mass flow and zone infiltration air flow may be increased or decreased if required
\note in order to balance the zone air mass flow. If "AdjustMixingThenReturn", first the zone mixing
\note objects flow rates are adjusted to balance the zone air flow, second zone total return flow rate
\note is adjusted and zone infiltration air flow may be increased or decreased if required in order to
\note balance the zone air mass flow. If "AdjustReturnThenMixing", first zone total return flow rate is
\note adjusted to balance the zone air flow, second the zone mixing object flow rates are adjusted and
\note infiltration air flow may be increased or decreased if required in order to balance the zone
\note air mass flow.
\type choice
\key AdjustMixingOnly
\key AdjustReturnOnly
\key AdjustMixingThenReturn
\key AdjustReturnThenMixing
\key None
\default None
A2, \field Infiltration Balancing Method
\note This input field allows user to choose how zone infiltration flow is treated during
\note the zone air mass flow balance calculation.
Expand Down
9 changes: 6 additions & 3 deletions resources/model/OpenStudio.idd
Original file line number Diff line number Diff line change
Expand Up @@ -707,9 +707,12 @@ OS:ZoneAirMassFlowConservation,
\required-field
A2, \field Adjust Zone Mixing For Zone Air Mass Flow Balance
\type choice
\key Yes
\key No
\default No
\key AdjustMixingOnly
\key AdjustReturnOnly
\key AdjustMixingThenReturn
\key AdjustReturnThenMixing
\key None
\default None
A3, \field Infiltration Balancing Method
\type choice
\key AddInfiltrationFlow
Expand Down
25 changes: 25 additions & 0 deletions src/osversion/VersionTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6258,6 +6258,31 @@ namespace osversion {
m_refactored.push_back(RefactoredObjectData(object, newObject));
ss << newObject;

} else if (iddname == "OS:ZoneAirMassFlowConservation") {

// Field 1 (0-index) 'Yes' becomes 'AdjustMixingOnly' and 'No' becomes 'None'

auto iddObject = idd_3_1_1.getObject(iddname);
IdfObject newObject(iddObject.get());

for (size_t i = 0; i < object.numFields(); ++i) {
if ((value = object.getString(i))) {
if (i == 1) {
std::string cur_choice = value.get();
if (openstudio::istringEqual("Yes", cur_choice)) {
newObject.setString(i, "AdjustMixingOnly");
} else if (openstudio::istringEqual("No", cur_choice)) {
newObject.setString(i, "None");
}
} else {
newObject.setString(i, value.get());
}
}
}

m_refactored.push_back(RefactoredObjectData(object, newObject));
ss << newObject;

// No-op
} else {
ss << object;
Expand Down
11 changes: 11 additions & 0 deletions src/osversion/test/3_1_1/test_vt_ZoneAirMassFlowConservation.osm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

OS:Version,
{66e48ced-5af2-49cf-9c23-eb32a1f3ca1b}, !- Handle
3.1.0; !- Version Identifier

OS:ZoneAirMassFlowConservation,
{c98bd4b2-3efe-4943-8009-c1c81131043a}, !- Handle
Yes, !- Adjust Zone Mixing For Zone Air Mass Flow Balance
AdjustInfiltrationFlow, !- Infiltration Balancing Method
AllZones; !- Infiltration Balancing Zones

12 changes: 12 additions & 0 deletions src/osversion/test/3_1_1/test_vt_ZoneAirMassFlowConservation.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#require '/usr/local/openstudio-3.1.0/Ruby/openstudio'

include OpenStudio::Model

m = Model.new

zc = m.getZoneAirMassFlowConservation()
zc.setAdjustZoneMixingForZoneAirMassFlowBalance(true)
zc.setInfiltrationBalancingMethod("AdjustInfiltrationFlow")
zc.setInfiltrationBalancingZones("AllZones")

m.save('test_vt_ZoneAirMassFlowConservation.osm', true)
19 changes: 19 additions & 0 deletions src/osversion/test/VersionTranslator_GTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1339,3 +1339,22 @@ TEST_F(OSVersionFixture, update_3_1_0_to_3_1_1_ZoneHVACLowTempRadiantVarFlow_Coi
EXPECT_EQ(1.3, coil.getDouble(12, returnDefault).get());
}
}

TEST_F(OSVersionFixture, update_3_1_0_to_3_1_1_ZoneAirMassFlowConservation) {
openstudio::path path = resourcesPath() / toPath("osversion/3_1_1/test_vt_ZoneAirMassFlowConservation.osm");
osversion::VersionTranslator vt;
boost::optional<model::Model> model = vt.loadModel(path);
ASSERT_TRUE(model) << "Failed to load " << path;

openstudio::path outPath = resourcesPath() / toPath("osversion/3_1_1/test_vt_ZoneAirMassFlowConservation_updated.osm");
model->save(outPath, true);

std::vector<WorkspaceObject> zcs = model->getObjectsByType("OS:ZoneAirMassFlowConservation");
ASSERT_EQ(1u, zcs.size());
WorkspaceObject zc = zcs[0];
// Yes becomes AdjustMixingOnly
EXPECT_EQ("AdjustMixingOnly", zc.getString(1).get());
// Unchanged
EXPECT_EQ("AdjustInfiltrationFlow", zc.getString(2).get());
EXPECT_EQ("AllZones", zc.getString(3).get());
}

0 comments on commit 6227f38

Please sign in to comment.