Skip to content

Commit

Permalink
Merge pull request #4450 from NREL/4446_autosizedOccupantDiversity
Browse files Browse the repository at this point in the history
Fix #4446 - add SizingSystem::autosizedOccupantDiversity.
  • Loading branch information
tijcolem authored Sep 30, 2021
2 parents 057a86b + c4c5a98 commit 9279637
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/model/SizingSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,45 @@ namespace model {
return result;
}

boost::optional<double> SizingSystem_Impl::autosizedOccupantDiversity() const {
boost::optional<double> result;

// Note: as of 9.6.0, for some reason, it returns one entry for cooling and one for heating...
// And it's only present in the tabular report 'Standard62.1Summary'
// Both the Heating and Cooling are actually the same underlying value. Cf https://github.com/NREL/OpenStudio/pull/4450#issue-1011104323
std::string tableName = "System Ventilation Requirements for Cooling";

// Get the parent AirLoopHVAC
AirLoopHVAC parAirLoop = airLoopHVAC();

// Get the object name and transform to the way it is recorded
// in the sql file
std::string sqlName = parAirLoop.nameString();
boost::to_upper(sqlName);

// Check that the model has a sql file
if (!model().sqlFile()) {
LOG(Warn, "This model has no sql file, cannot retrieve the autosized " + tableName + " - 'Occupant Diversity - D'.");
return result;
}

// Query the Initialization Summary -> System Sizing table to get
// the row names that contains information for this component.
std::string rowsQuery = R"(
SELECT Value FROM TabularDataWithStrings
WHERE ReportName = 'Standard62.1Summary'
AND ReportForString = 'Entire Facility'
AND ColumnName = 'Occupant Diversity - D'
AND TableName = ?
AND RowName = ?;
)";

result = model().sqlFile().get().execAndReturnFirstDouble(rowsQuery,
// Bind args
tableName, sqlName);
return result;
}

void SizingSystem_Impl::autosize() {
autosizeDesignOutdoorAirFlowRate();
autosizeCoolingDesignCapacity();
Expand Down Expand Up @@ -982,6 +1021,11 @@ namespace model {
if (val) {
setCentralHeatingMaximumSystemAirFlowRatio(val.get());
}

val = autosizedOccupantDiversity();
if (val) {
setOccupantDiversity(val.get());
}
}

std::vector<EMSActuatorNames> SizingSystem_Impl::emsActuatorNames() const {
Expand Down Expand Up @@ -1584,6 +1628,10 @@ namespace model {
return getImpl<detail::SizingSystem_Impl>()->autosizedCentralHeatingMaximumSystemAirFlowRatio();
}

boost::optional<double> SizingSystem::autosizedOccupantDiversity() const {
return getImpl<detail::SizingSystem_Impl>()->autosizedOccupantDiversity();
}

// DEPRECATED: TODO REMOVE as soon as standards > 0.29.0 is relased
boost::optional<double> SizingSystem::minimumSystemAirFlowRatio() const {
return getImpl<detail::SizingSystem_Impl>()->centralHeatingMaximumSystemAirFlowRatio();
Expand Down
1 change: 1 addition & 0 deletions src/model/SizingSystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ namespace model {
boost::optional<double> autosizedCentralHeatingMaximumSystemAirFlowRatio() const;
boost::optional<double> autosizedCoolingDesignCapacity() const;
boost::optional<double> autosizedHeatingDesignCapacity() const;
boost::optional<double> autosizedOccupantDiversity() const;

void autosize();

Expand Down
2 changes: 2 additions & 0 deletions src/model/SizingSystem_Impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ namespace model {

boost::optional<double> autosizedHeatingDesignCapacity() const;

boost::optional<double> autosizedOccupantDiversity() const;

void autosize();

void applySizingValues();
Expand Down

0 comments on commit 9279637

Please sign in to comment.