From 46d76883ee1ad22ecc9b1eaae3aaad1a8b040ee5 Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Mon, 7 Aug 2023 11:23:25 -0500 Subject: [PATCH] Space HVAC - fix space HB diffs for space system node --- src/EnergyPlus/ZoneEquipmentManager.cc | 10 ++++++++++ src/EnergyPlus/ZoneTempPredictorCorrector.cc | 17 +++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/EnergyPlus/ZoneEquipmentManager.cc b/src/EnergyPlus/ZoneEquipmentManager.cc index 3f045061771..cc1fd65f939 100644 --- a/src/EnergyPlus/ZoneEquipmentManager.cc +++ b/src/EnergyPlus/ZoneEquipmentManager.cc @@ -4524,6 +4524,16 @@ void CalcZoneMassBalance(EnergyPlusData &state, bool const FirstHVACIteration) zoneNode.MassFlowRateMaxAvail = TotInletAirMassFlowRateMaxAvail; zoneNode.MassFlowRateMin = TotInletAirMassFlowRateMin; zoneNode.MassFlowRateMinAvail = TotInletAirMassFlowRateMinAvail; + if (state.dataHeatBal->doSpaceHeatBalance) { + for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { + auto &spaceNode = Node(state.dataHeatBal->space(spaceNum).SystemZoneNodeNumber); + spaceNode.MassFlowRate = TotInletAirMassFlowRate; + spaceNode.MassFlowRateMax = TotInletAirMassFlowRateMax; + spaceNode.MassFlowRateMaxAvail = TotInletAirMassFlowRateMaxAvail; + spaceNode.MassFlowRateMin = TotInletAirMassFlowRateMin; + spaceNode.MassFlowRateMinAvail = TotInletAirMassFlowRateMinAvail; + } + } // Calculate standard return air flow rate using default method of inlets minus exhausts adjusted for "balanced" exhaust flow Real64 StdTotalReturnMassFlow = diff --git a/src/EnergyPlus/ZoneTempPredictorCorrector.cc b/src/EnergyPlus/ZoneTempPredictorCorrector.cc index 51803ea04d0..68fd7a7bc4d 100644 --- a/src/EnergyPlus/ZoneTempPredictorCorrector.cc +++ b/src/EnergyPlus/ZoneTempPredictorCorrector.cc @@ -7160,6 +7160,11 @@ void ZoneSpaceHeatBalanceData::calcPredictedSystemLoad(EnergyPlusData &state, Re Real64 LoadToHeatingSetPoint = 0.0; Real64 LoadToCoolingSetPoint = 0.0; + int zoneNodeNum = thisZone.SystemZoneNodeNumber; + if (spaceNum > 0) { + zoneNodeNum = state.dataHeatBal->space(spaceNum).SystemZoneNodeNumber; + } + switch (state.dataHeatBalFanSys->TempControlType(zoneNum)) { case DataHVACGlobals::ThermostatType::Uncontrolled: // Uncontrolled Zone @@ -7307,8 +7312,8 @@ void ZoneSpaceHeatBalanceData::calcPredictedSystemLoad(EnergyPlusData &state, Re totalLoad = LoadToCoolingSetPoint; } else if (LoadToHeatingSetPoint <= 0.0 && LoadToCoolingSetPoint >= 0.0) { // deadband includes zero loads totalLoad = 0.0; - if (thisZone.SystemZoneNodeNumber > 0) { - ZoneSetPoint = state.dataLoopNodes->Node(thisZone.SystemZoneNodeNumber).Temp; + if (zoneNodeNum > 0) { + ZoneSetPoint = state.dataLoopNodes->Node(zoneNodeNum).Temp; ZoneSetPoint = max(ZoneSetPoint, thisZoneThermostatSetPointLo); // trap out of deadband ZoneSetPoint = min(ZoneSetPoint, thisZoneThermostatSetPointHi); // trap out of deadband } @@ -7393,8 +7398,8 @@ void ZoneSpaceHeatBalanceData::calcPredictedSystemLoad(EnergyPlusData &state, Re } else if (LoadToHeatingSetPoint <= 0.0 && LoadToCoolingSetPoint >= 0.0) { // deadband includes zero loads // this turns out to cause instabilities sometimes? that lead to setpoint errors if predictor is off. totalLoad = 0.0; - if (thisZone.SystemZoneNodeNumber > 0) { - ZoneSetPoint = state.dataLoopNodes->Node(thisZone.SystemZoneNodeNumber).Temp; + if (zoneNodeNum > 0) { + ZoneSetPoint = state.dataLoopNodes->Node(zoneNodeNum).Temp; ZoneSetPoint = max(ZoneSetPoint, thisZoneThermostatSetPointLo); // trap out of deadband ZoneSetPoint = min(ZoneSetPoint, thisZoneThermostatSetPointHi); // trap out of deadband } @@ -7504,8 +7509,8 @@ void ZoneSpaceHeatBalanceData::calcPredictedSystemLoad(EnergyPlusData &state, Re } // If the ZoneNodeNum has been set for a Controlled Zone, then the zone setpoint is placed on the node. - if (thisZone.SystemZoneNodeNumber > 0) { - state.dataLoopNodes->Node(thisZone.SystemZoneNodeNumber).TempSetPoint = ZoneSetPoint; + if (zoneNodeNum > 0) { + state.dataLoopNodes->Node(zoneNodeNum).TempSetPoint = ZoneSetPoint; } state.dataZoneEnergyDemand->Setback(zoneNum) = (ZoneSetPoint > this->ZoneSetPointLast);