Correct bad index for ZoneList Sensible cooling/heating rate/energy reports#11324
Correct bad index for ZoneList Sensible cooling/heating rate/energy reports#11324
Conversation
|
This is ripe for a unit test. |
…23-zone-index-for-zoneList
|
|
||
| // switch the zone index order in the ZoneList | ||
| state->dataHeatBal->ZoneList(1).Zone(1) = 2; | ||
| state->dataHeatBal->ZoneList(1).Zone(2) = 1; |
There was a problem hiding this comment.
Unit test fails, starting here, in develop if 1-line code change in HVACManager is reverted.
| for (ZoneNum = 1; ZoneNum <= zoneList.NumOfZones; ++ZoneNum) { | ||
| auto const &zoneSysEnergyDemand = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(zoneList.Zone(ZoneNum)); | ||
| Mult = state.dataHeatBal->Zone(ZoneNum).Multiplier; | ||
| Mult = state.dataHeatBal->Zone(zoneList.Zone(ZoneNum)).Multiplier; |
There was a problem hiding this comment.
ZoneNum is the ZoneList index, not the Zone index. So the zone multiplier was not correctly applied to the corresponding energy delivered to the zones in the ZoneList. Specifically this energy (where the reports apply the zone multiplier in this function):
// SNLOAD is the single zone load, without Zone Multiplier or Zone List Multiplier
SNLoad = ZoneEnthalpyIn - (thisSystemNode.MassFlowRate / ZoneMult) * CpAir * thisSystemNode.Temp + this->NonAirSystemResponse / ZoneMult +
this->SysDepZoneLoadsLagged;
state.dataZoneEnergyDemand->ZoneSysEnergyDemand(zoneNum).reportZoneAirSystemSensibleLoads(state, SNLoad);
void ZoneSystemSensibleDemand::reportZoneAirSystemSensibleLoads(EnergyPlusData &state, Real64 const SNLoad)
{
this->airSysHeatRate = max(SNLoad, 0.0);
this->airSysCoolRate = std::abs(min(SNLoad, 0.0));
this->airSysHeatEnergy = this->airSysHeatRate * state.dataHVACGlobal->TimeStepSysSec;
this->airSysCoolEnergy = this->airSysCoolRate * state.dataHVACGlobal->TimeStepSysSec;
}
There was a problem hiding this comment.
ZoneNum is the ZoneList index, not the Zone index.
I'm curious if there are reasons why they should not be the same?
There was a problem hiding this comment.
Never mind. I see it now.
There was a problem hiding this comment.
ZoneNum is the ZoneList index, not the Zone index.
I'm curious if there are reasons why they should not be the same?
The naming is poor. The loop index ZoneNum should really be something like ZoneListItemNum . The actual zone numbers are contained in the zoneList.
Another way to fix this is to use a range-based loop.
for (int const ZoneNum : zoneList.Zone) {
That's assuming the zoneList.Zone arrays are right-sized and not padded on the end.
There was a problem hiding this comment.
Thanks, @mjwitte. May be a good place for a quick tidy-up task.
There was a problem hiding this comment.
It's a right sized array.
// List of zones
state.dataHeatBal->ZoneList(ListNum).NumOfZones = NumAlphas - 1;
state.dataHeatBal->ZoneList(ListNum).Zone.allocate(state.dataHeatBal->ZoneList(ListNum).NumOfZones);
ZoneList,
\extensible:1 - repeat last field, remembering to remove ; from "inner" fields.
A1 , \field Name
\note Name of the ZoneList.
A2 , \field Zone 1 Name
\begin-extensible
A3 , \field Zone 2 Name
|
Looks good. Merging. |
Pull request overview
Description of the purpose of this PR
Incorrect zone multiplier used for ZoneList reporting. Affected ZoneList reports are:
Zone List Sensible Cooling Rate
Zone List Sensible Heating Rate
Zone List Sensible Cooling Energy
Zone List Sensible Heating Energy
Pull Request Author
Reviewer