Skip to content

Commit

Permalink
Space HVAC - fix space HB diffs for space system node
Browse files Browse the repository at this point in the history
  • Loading branch information
mjwitte committed Aug 7, 2023
1 parent 6f35ee5 commit 46d7688
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
10 changes: 10 additions & 0 deletions src/EnergyPlus/ZoneEquipmentManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
17 changes: 11 additions & 6 deletions src/EnergyPlus/ZoneTempPredictorCorrector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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);
Expand Down

5 comments on commit 46d7688

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SpaceSizingHVAC (mjwitte) - x86_64-MacOS-10.17-clang-13.0.0: OK (3446 of 3446 tests passed, 771 test warnings)

Messages:\n

  • 771 tests had: AUD diffs.
  • 1 test had: BND diffs.
  • 1 test had: EIO diffs.

Build Badge Test Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SpaceSizingHVAC (mjwitte) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (3487 of 3487 tests passed, 775 test warnings)

Messages:\n

  • 775 tests had: AUD diffs.
  • 1 test had: BND diffs.
  • 1 test had: EIO diffs.

Build Badge Test Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SpaceSizingHVAC (mjwitte) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-UnitTestsCoverage-Debug: OK (1900 of 1900 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SpaceSizingHVAC (mjwitte) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-IntegrationCoverage-Debug: OK (776 of 776 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SpaceSizingHVAC (mjwitte) - Win64-Windows-10-VisualStudio-16: OK (2673 of 2673 tests passed, 0 test warnings)

Build Badge Test Badge

Please sign in to comment.