Skip to content

Commit

Permalink
Merge pull request #5278 from NREL/unitary-sys-perf-multispeed-fix
Browse files Browse the repository at this point in the history
Fix AirLoopHVACUnitarySystem FT issues with UnitarySystemPerformanceMultispeed
  • Loading branch information
joseph-robertson authored Oct 29, 2024
2 parents 62f977e + 4a3deb3 commit c8b9868
Show file tree
Hide file tree
Showing 3 changed files with 491 additions and 18 deletions.
1 change: 1 addition & 0 deletions src/energyplus/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,7 @@ set(${target_name}_test_src
Test/ThermalStorageChilledWaterStratified_GTest.cpp
Test/ThermalZone_GTest.cpp
Test/ThermostatSetpointDualSetpoint_GTest.cpp
Test/UnitarySystemPerformanceMultispeed_GTest.cpp
Test/WindowPropertyFrameAndDivider_GTest.cpp
Test/WaterHeaterMixed_GTest.cpp
Test/WaterHeaterSizing_GTest.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,8 @@ namespace energyplus {
boost::optional<model::CoilCoolingDXVariableSpeed> varSpeedDXCooling;
boost::optional<model::CoilCoolingWaterToAirHeatPumpVariableSpeedEquationFit> varSpeedWaterToAirCooling;

int maxStages = 0;
int maxHeatingStages = 0;
int maxCoolingStages = 0;

if (heatingCoil) {
multispeedDXHeating = heatingCoil->optionalCast<model::CoilHeatingDXMultiSpeed>();
Expand All @@ -482,36 +483,36 @@ namespace energyplus {

if (multispeedDXHeating) {
heatingStages = multispeedDXHeating->stages();
maxStages = heatingStages.size();
_unitarySystemPerformance.setInt(UnitarySystemPerformance_MultispeedFields::NumberofSpeedsforHeating, maxStages);
maxHeatingStages = heatingStages.size();
_unitarySystemPerformance.setInt(UnitarySystemPerformance_MultispeedFields::NumberofSpeedsforHeating, maxHeatingStages);
} else if (varSpeedDXHeating) {
varHeatingStages = varSpeedDXHeating->speeds();
maxStages = varHeatingStages.size();
_unitarySystemPerformance.setInt(UnitarySystemPerformance_MultispeedFields::NumberofSpeedsforHeating, maxStages);
maxHeatingStages = varHeatingStages.size();
_unitarySystemPerformance.setInt(UnitarySystemPerformance_MultispeedFields::NumberofSpeedsforHeating, maxHeatingStages);
} else if (multistageGasHeating) {
gasHeatingStages = multistageGasHeating->stages();
maxStages = gasHeatingStages.size();
_unitarySystemPerformance.setInt(UnitarySystemPerformance_MultispeedFields::NumberofSpeedsforHeating, maxStages);
maxHeatingStages = gasHeatingStages.size();
_unitarySystemPerformance.setInt(UnitarySystemPerformance_MultispeedFields::NumberofSpeedsforHeating, maxHeatingStages);
} else if (varSpeedWaterToAirHeating) {
waterToAirHeatingStages = varSpeedWaterToAirHeating->speeds();
maxStages = waterToAirHeatingStages.size();
_unitarySystemPerformance.setInt(UnitarySystemPerformance_MultispeedFields::NumberofSpeedsforHeating, maxStages);
maxHeatingStages = waterToAirHeatingStages.size();
_unitarySystemPerformance.setInt(UnitarySystemPerformance_MultispeedFields::NumberofSpeedsforHeating, maxHeatingStages);
} else {
_unitarySystemPerformance.setInt(UnitarySystemPerformance_MultispeedFields::NumberofSpeedsforHeating, 1);
}

if (multispeedDXCooling) {
coolingStages = multispeedDXCooling->stages();
maxStages = coolingStages.size();
_unitarySystemPerformance.setInt(UnitarySystemPerformance_MultispeedFields::NumberofSpeedsforCooling, maxStages);
maxCoolingStages = coolingStages.size();
_unitarySystemPerformance.setInt(UnitarySystemPerformance_MultispeedFields::NumberofSpeedsforCooling, maxCoolingStages);
} else if (varSpeedDXCooling) {
varCoolingStages = varSpeedDXCooling->speeds();
maxStages = varCoolingStages.size();
_unitarySystemPerformance.setInt(UnitarySystemPerformance_MultispeedFields::NumberofSpeedsforCooling, maxStages);
maxCoolingStages = varCoolingStages.size();
_unitarySystemPerformance.setInt(UnitarySystemPerformance_MultispeedFields::NumberofSpeedsforCooling, maxCoolingStages);
} else if (varSpeedWaterToAirCooling) {
waterToAirCoolingStages = varSpeedWaterToAirCooling->speeds();
maxStages = waterToAirCoolingStages.size();
_unitarySystemPerformance.setInt(UnitarySystemPerformance_MultispeedFields::NumberofSpeedsforCooling, maxStages);
maxCoolingStages = waterToAirCoolingStages.size();
_unitarySystemPerformance.setInt(UnitarySystemPerformance_MultispeedFields::NumberofSpeedsforCooling, maxCoolingStages);
} else {
_unitarySystemPerformance.setInt(UnitarySystemPerformance_MultispeedFields::NumberofSpeedsforCooling, 1);
}
Expand All @@ -529,7 +530,7 @@ namespace energyplus {
}
};

for (int i = 0; i < maxStages; ++i) {
for (int i = 0; i < std::max(maxHeatingStages, maxCoolingStages); ++i) {
auto extensible = _unitarySystemPerformance.pushExtensibleGroup();

if (static_cast<unsigned>(i) < heatingStages.size()) {
Expand Down Expand Up @@ -566,7 +567,7 @@ namespace energyplus {
} else {
extensible.setString(UnitarySystemPerformance_MultispeedExtensibleFields::HeatingSpeedSupplyAirFlowRatio, "Autosize");
}
} else if (i < 2) {
} else {
extensible.setDouble(UnitarySystemPerformance_MultispeedExtensibleFields::HeatingSpeedSupplyAirFlowRatio, 1.0);
}

Expand Down Expand Up @@ -595,7 +596,7 @@ namespace energyplus {
} else {
extensible.setString(UnitarySystemPerformance_MultispeedExtensibleFields::CoolingSpeedSupplyAirFlowRatio, "Autosize");
}
} else if (i < 2) {
} else {
extensible.setDouble(UnitarySystemPerformance_MultispeedExtensibleFields::CoolingSpeedSupplyAirFlowRatio, 1.0);
}
}
Expand Down
Loading

0 comments on commit c8b9868

Please sign in to comment.