From a44e81e735abde3a6e2e6421e724053fd4d638fb Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Tue, 10 Sep 2024 15:16:34 -0500 Subject: [PATCH 01/25] Space IV.6 - component loads 1 --- src/EnergyPlus/OutputReportTabular.cc | 400 +++++++++++------- src/EnergyPlus/OutputReportTabular.hh | 23 +- .../unit/OutputReportTabular.unit.cc | 3 +- 3 files changed, 274 insertions(+), 152 deletions(-) diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index bbf5530f5bc..36bbc463c63 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -14955,6 +14955,9 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) Array2D surfDelaySeqHeat; Array2D surfDelaySeqCool; + Array1D SpaceHeatCompLoadTables; // for space level component load summary output tables + Array1D SpaceCoolCompLoadTables; + Array1D ZoneHeatCompLoadTables; // for zone level component load summary output tables Array1D ZoneCoolCompLoadTables; @@ -15008,6 +15011,24 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) surfDelaySeqCool = 0.0; // initialize arrays + if (ort->displayZoneComponentLoadSummary) { + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + SpaceHeatCompLoadTables.allocate(state.dataGlobal->numSpaces); + for (auto &e : SpaceHeatCompLoadTables) { + e.cells.allocate(LoadCompCol::PerArea, LoadCompRow::GrdTot); + e.cells = 0.; + e.cellUsed.allocate(LoadCompCol::PerArea, LoadCompRow::GrdTot); + e.cellUsed = false; + } + SpaceCoolCompLoadTables.allocate(state.dataGlobal->numSpaces); + for (auto &e : SpaceCoolCompLoadTables) { + e.cells.allocate(LoadCompCol::PerArea, LoadCompRow::GrdTot); + e.cells = 0.; + e.cellUsed.allocate(LoadCompCol::PerArea, LoadCompRow::GrdTot); + e.cellUsed = false; + } + } + } if (ort->displayZoneComponentLoadSummary) { ZoneHeatCompLoadTables.allocate(state.dataGlobal->NumOfZones); for (auto &e : ZoneHeatCompLoadTables) { @@ -15086,101 +15107,38 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) } // get the zone areas needed later + Array1D spaceComponentAreas; Array1D ZoneComponentAreas; ZoneComponentAreas.allocate(state.dataGlobal->NumOfZones); - GetZoneComponentAreas(state, ZoneComponentAreas); + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + spaceComponentAreas.allocate(state.dataGlobal->numSpaces); + } + GetZoneComponentAreas(state, ZoneComponentAreas, spaceComponentAreas); // ZoneComponentLoadSummary if (ort->displayZoneComponentLoadSummary) { for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { if (!state.dataZoneEquip->ZoneEquipConfig(iZone).IsControlled) continue; if (allocated(state.dataSize->CalcFinalZoneSizing)) { - auto const &thisCalcFinalZoneSizing = state.dataSize->CalcFinalZoneSizing(iZone); - coolDesSelected = thisCalcFinalZoneSizing.CoolDDNum; - ZoneCoolCompLoadTables(iZone).desDayNum = coolDesSelected; - timeCoolMax = thisCalcFinalZoneSizing.TimeStepNumAtCoolMax; - ZoneCoolCompLoadTables(iZone).timeStepMax = timeCoolMax; - - GetDelaySequences(state, - coolDesSelected, - true, - iZone, - peopleDelaySeqCool, - equipDelaySeqCool, - hvacLossDelaySeqCool, - powerGenDelaySeqCool, - lightDelaySeqCool, - feneSolarDelaySeqCool, - ort->feneCondInstantSeq, - surfDelaySeqCool); - ComputeTableBodyUsingMovingAvg(state, - ZoneCoolCompLoadTables(iZone).cells, - ZoneCoolCompLoadTables(iZone).cellUsed, - coolDesSelected, - timeCoolMax, - iZone, - peopleDelaySeqCool, - equipDelaySeqCool, - hvacLossDelaySeqCool, - powerGenDelaySeqCool, - lightDelaySeqCool, - feneSolarDelaySeqCool, - ort->feneCondInstantSeq, - surfDelaySeqCool); - CollectPeakZoneConditions(state, ZoneCoolCompLoadTables(iZone), coolDesSelected, timeCoolMax, iZone, true); - // send latent load info to coil summary report - state.dataRptCoilSelection->coilSelectionReportObj->setZoneLatentLoadCoolingIdealPeak( - iZone, ZoneCoolCompLoadTables(iZone).cells(LoadCompCol::Latent, LoadCompRow::GrdTot)); - - heatDesSelected = thisCalcFinalZoneSizing.HeatDDNum; - ZoneHeatCompLoadTables(iZone).desDayNum = heatDesSelected; - timeHeatMax = thisCalcFinalZoneSizing.TimeStepNumAtHeatMax; - ZoneHeatCompLoadTables(iZone).timeStepMax = timeHeatMax; - - GetDelaySequences(state, - heatDesSelected, - false, - iZone, - peopleDelaySeqHeat, - equipDelaySeqHeat, - hvacLossDelaySeqHeat, - powerGenDelaySeqHeat, - lightDelaySeqHeat, - feneSolarDelaySeqHeat, - ort->feneCondInstantSeq, - surfDelaySeqHeat); - ComputeTableBodyUsingMovingAvg(state, - ZoneHeatCompLoadTables(iZone).cells, - ZoneHeatCompLoadTables(iZone).cellUsed, - heatDesSelected, - timeHeatMax, - iZone, - peopleDelaySeqHeat, - equipDelaySeqHeat, - hvacLossDelaySeqHeat, - powerGenDelaySeqHeat, - lightDelaySeqHeat, - feneSolarDelaySeqHeat, - ort->feneCondInstantSeq, - surfDelaySeqHeat); - CollectPeakZoneConditions(state, ZoneHeatCompLoadTables(iZone), heatDesSelected, timeHeatMax, iZone, false); - - // send latent load info to coil summary report - state.dataRptCoilSelection->coilSelectionReportObj->setZoneLatentLoadHeatingIdealPeak( - iZone, ZoneHeatCompLoadTables(iZone).cells(LoadCompCol::Latent, LoadCompRow::GrdTot)); - - AddAreaColumnForZone(iZone, ZoneComponentAreas, ZoneCoolCompLoadTables(iZone)); - AddAreaColumnForZone(iZone, ZoneComponentAreas, ZoneHeatCompLoadTables(iZone)); - - AddTotalRowsForLoadSummary(ZoneCoolCompLoadTables(iZone)); - AddTotalRowsForLoadSummary(ZoneHeatCompLoadTables(iZone)); - - ComputePeakDifference(ZoneCoolCompLoadTables(iZone)); - ComputePeakDifference(ZoneHeatCompLoadTables(iZone)); + computeSpaceZoneCompLoads(state, + state.dataSize->CalcFinalZoneSizing(iZone), + ZoneCoolCompLoadTables(iZone), + ZoneHeatCompLoadTables(iZone), + peopleDelaySeqCool, + equipDelaySeqCool, + hvacLossDelaySeqCool, + powerGenDelaySeqCool, + lightDelaySeqCool, + feneSolarDelaySeqCool, + ort->feneCondInstantSeq, + surfDelaySeqCool, + ZoneComponentAreas(iZone), + iZone); // We delay the potential application of SI to IP conversion and actual output until after both the - // AirLoopComponentLoadSummary and FacilityComponentLoadSummary have been processed because below we try to retrieve the info - // directly when the timestamp would match (cf #7356), and if we converted right now, we would apply the conversion twice + // AirLoopComponentLoadSummary and FacilityComponentLoadSummary have been processed because below we try + // to retrieve the info directly when the timestamp would match (cf #7356), and if we converted right + // now, we would apply the conversion twice } } } @@ -15290,7 +15248,7 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) ort->feneCondInstantSeq, surfDelaySeqCool); CollectPeakZoneConditions(state, airLoopZonesCoolCompLoadTables, coolDesSelected, timeCoolMax, iZone, true); - AddAreaColumnForZone(iZone, ZoneComponentAreas, airLoopZonesCoolCompLoadTables); + AddAreaColumnForZone(ZoneComponentAreas(iZone), airLoopZonesCoolCompLoadTables); } if (ort->displayZoneComponentLoadSummary && (airLoopZonesHeatCompLoadTables.desDayNum == ZoneHeatCompLoadTables(iZone).desDayNum) && @@ -15327,7 +15285,7 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) ort->feneCondInstantSeq, surfDelaySeqHeat); CollectPeakZoneConditions(state, airLoopZonesHeatCompLoadTables, heatDesSelected, timeHeatMax, iZone, false); - AddAreaColumnForZone(iZone, ZoneComponentAreas, airLoopZonesHeatCompLoadTables); + AddAreaColumnForZone(ZoneComponentAreas(iZone), airLoopZonesHeatCompLoadTables); } } // combine the zones for each air loop @@ -15445,7 +15403,7 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) ort->feneCondInstantSeq, surfDelaySeqCool); CollectPeakZoneConditions(state, facilityZonesCoolCompLoadTables, coolDesSelected, timeCoolMax, iZone, true); - AddAreaColumnForZone(iZone, ZoneComponentAreas, facilityZonesCoolCompLoadTables); + AddAreaColumnForZone(ZoneComponentAreas(iZone), facilityZonesCoolCompLoadTables); } facilityZonesCoolCompLoadTables.timeStepMax = timeCoolMax; facilityZonesCoolCompLoadTables.desDayNum = coolDesSelected; @@ -15482,7 +15440,7 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) ort->feneCondInstantSeq, surfDelaySeqHeat); CollectPeakZoneConditions(state, facilityZonesHeatCompLoadTables, heatDesSelected, timeHeatMax, iZone, false); - AddAreaColumnForZone(iZone, ZoneComponentAreas, facilityZonesHeatCompLoadTables); + AddAreaColumnForZone(ZoneComponentAreas(iZone), facilityZonesHeatCompLoadTables); } facilityZonesHeatCompLoadTables.timeStepMax = timeHeatMax; facilityZonesHeatCompLoadTables.desDayNum = heatDesSelected; @@ -15531,6 +15489,30 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) produceSQLite); } + // SpaceComponentLoadSummary: Now we convert and Display + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + if (ort->displayZoneComponentLoadSummary) { + for (int iSpace = 1; iSpace <= state.dataGlobal->NumOfZones; ++iSpace) { + if (!state.dataZoneEquip->ZoneEquipConfig(state.dataHeatBal->space(iSpace).zoneNum).IsControlled) continue; + if (allocated(state.dataSize->CalcFinalSpaceSizing)) { + LoadSummaryUnitConversion(state, SpaceCoolCompLoadTables(iSpace), unitsStyle_cur); + LoadSummaryUnitConversion(state, SpaceHeatCompLoadTables(iSpace), unitsStyle_cur); + + OutputCompLoadSummary(state, + OutputType::Space, + SpaceCoolCompLoadTables(iSpace), + SpaceHeatCompLoadTables(iSpace), + iSpace, + unitsStyle_cur, + produceTabular, + produceSQLite); + } + } + } + SpaceHeatCompLoadTables.deallocate(); + SpaceCoolCompLoadTables.deallocate(); + } + // ZoneComponentLoadSummary: Now we convert and Display if (ort->displayZoneComponentLoadSummary) { for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { @@ -15583,6 +15565,103 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) } } +void computeSpaceZoneCompLoads(EnergyPlusData &state, + DataSizing::ZoneSizingData &calcFinalSizing, + CompLoadTablesType &coolCompLoadTables, + CompLoadTablesType &heatCompLoadTables, + Array1D &peopleDelaySeq, + Array1D &equipDelaySeq, + Array1D &hvacLossDelaySeq, + Array1D &powerGenDelaySeq, + Array1D &lightDelaySeq, + Array1D &feneSolarDelaySeq, + Array3D &feneCondInstantSeqLoc, + Array2D &surfDelaySeq, + ZompComponentAreasType &componentAreas, + int iZone) +{ + int coolDesSelected = calcFinalSizing.CoolDDNum; + coolCompLoadTables.desDayNum = coolDesSelected; + int timeCoolMax = calcFinalSizing.TimeStepNumAtCoolMax; + coolCompLoadTables.timeStepMax = timeCoolMax; + + GetDelaySequences(state, + coolDesSelected, + true, + iZone, + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, + feneCondInstantSeqLoc, + surfDelaySeq); + ComputeTableBodyUsingMovingAvg(state, + coolCompLoadTables.cells, + coolCompLoadTables.cellUsed, + coolDesSelected, + timeCoolMax, + iZone, + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, + feneCondInstantSeqLoc, + surfDelaySeq); + CollectPeakZoneConditions(state, coolCompLoadTables, coolDesSelected, timeCoolMax, iZone, true); + // send latent load info to coil summary report + state.dataRptCoilSelection->coilSelectionReportObj->setZoneLatentLoadCoolingIdealPeak( + iZone, coolCompLoadTables.cells(LoadCompCol::Latent, LoadCompRow::GrdTot)); + + int heatDesSelected = calcFinalSizing.HeatDDNum; + heatCompLoadTables.desDayNum = heatDesSelected; + int timeHeatMax = calcFinalSizing.TimeStepNumAtHeatMax; + heatCompLoadTables.timeStepMax = timeHeatMax; + + GetDelaySequences(state, + heatDesSelected, + false, + iZone, + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, + feneCondInstantSeqLoc, + surfDelaySeq); + ComputeTableBodyUsingMovingAvg(state, + heatCompLoadTables.cells, + heatCompLoadTables.cellUsed, + heatDesSelected, + timeHeatMax, + iZone, + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, + feneCondInstantSeqLoc, + surfDelaySeq); + CollectPeakZoneConditions(state, heatCompLoadTables, heatDesSelected, timeHeatMax, iZone, false); + + // send latent load info to coil summary report + state.dataRptCoilSelection->coilSelectionReportObj->setZoneLatentLoadHeatingIdealPeak( + iZone, heatCompLoadTables.cells(LoadCompCol::Latent, LoadCompRow::GrdTot)); + + AddAreaColumnForZone(componentAreas, coolCompLoadTables); + AddAreaColumnForZone(componentAreas, heatCompLoadTables); + + AddTotalRowsForLoadSummary(coolCompLoadTables); + AddTotalRowsForLoadSummary(heatCompLoadTables); + + ComputePeakDifference(coolCompLoadTables); + ComputePeakDifference(heatCompLoadTables); +} // populate the delay sequence arrays for the component load summary table output void GetDelaySequences(EnergyPlusData &state, int const desDaySelected, @@ -16141,114 +16220,133 @@ void ComputeEngineeringChecks(CompLoadTablesType &compLoad) } // gather the areas used in the load component tables -void GetZoneComponentAreas(EnergyPlusData &state, Array1D &areas) +void GetZoneComponentAreas(EnergyPlusData &state, Array1D &znAreas, Array1D &spAreas) { - using namespace DataSurfaces; - for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { - areas(iZone).floor = state.dataHeatBal->Zone(iZone).FloorArea; + znAreas(iZone).floor = state.dataHeatBal->Zone(iZone).FloorArea; + } + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + for (int iSpace = 1; iSpace <= state.dataGlobal->numSpaces; ++iSpace) { + spAreas(iSpace).floor = state.dataHeatBal->space(iSpace).FloorArea; + } } + bool isZone = true; for (auto const &curSurface : state.dataSurface->Surface) { - if (!curSurface.HeatTransSurf) { - continue; - } - bool isExterior = curSurface.ExtBoundCond == ExternalEnvironment || curSurface.ExtBoundCond == OtherSideCondModeledExt; - bool isTouchingGround = - curSurface.ExtBoundCond == Ground || curSurface.ExtBoundCond == GroundFCfactorMethod || curSurface.ExtBoundCond == KivaFoundation; - int curZoneIndex = curSurface.Zone; - // ZoneData curZone = Zone(curSurface.Zone); - if (curSurface.Class == SurfaceClass::Wall) { - if (isExterior) { - areas(curZoneIndex).extWall += curSurface.GrossArea; - } else if (isTouchingGround) { - areas(curZoneIndex).grndCntWall += curSurface.GrossArea; - } else { - areas(curZoneIndex).intZoneWall += curSurface.GrossArea; - } - } else if (curSurface.Class == SurfaceClass::Roof) { - if (isExterior) { - areas(curZoneIndex).roof += curSurface.GrossArea; - } else { - areas(curZoneIndex).ceiling += curSurface.GrossArea; - } - } else if (curSurface.Class == SurfaceClass::Floor) { - if (isExterior) { - areas(curZoneIndex).extFloor += curSurface.GrossArea; - } else if (isTouchingGround) { - areas(curZoneIndex).grndCntFloor += curSurface.GrossArea; - } else { - areas(curZoneIndex).intZoneFloor += curSurface.GrossArea; - } - } else if (curSurface.Class == SurfaceClass::Window || curSurface.Class == SurfaceClass::TDD_Dome) { - areas(curZoneIndex).fenestration += curSurface.GrossArea; - } else if (curSurface.Class == SurfaceClass::Door || curSurface.Class == SurfaceClass::GlassDoor) { - areas(curZoneIndex).door += curSurface.GrossArea; + if (!curSurface.HeatTransSurf) continue; + addSurfaceArea(curSurface, znAreas, isZone); + } + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + isZone = false; + for (auto const &curSurface : state.dataSurface->Surface) { + addSurfaceArea(curSurface, spAreas, isZone); } } } +void addSurfaceArea(DataSurfaces::SurfaceData const &surf, Array1D &areas, bool isZone) +{ + bool isExterior = surf.ExtBoundCond == DataSurfaces::ExternalEnvironment || surf.ExtBoundCond == DataSurfaces::OtherSideCondModeledExt; + bool isTouchingGround = surf.ExtBoundCond == DataSurfaces::Ground || surf.ExtBoundCond == DataSurfaces::GroundFCfactorMethod || + surf.ExtBoundCond == DataSurfaces::KivaFoundation; + int curIndex = (isZone) ? surf.Zone : surf.spaceNum; + switch (surf.Class) { + case DataSurfaces::SurfaceClass::Wall: { + if (isExterior) { + areas(curIndex).extWall += surf.GrossArea; + } else if (isTouchingGround) { + areas(curIndex).grndCntWall += surf.GrossArea; + } else { + areas(curIndex).intZoneWall += surf.GrossArea; + } + } break; + case DataSurfaces::SurfaceClass::Roof: { + if (isExterior) { + areas(curIndex).roof += surf.GrossArea; + } else { + areas(curIndex).ceiling += surf.GrossArea; + } + } break; + case DataSurfaces::SurfaceClass::Floor: { + if (isExterior) { + areas(curIndex).extFloor += surf.GrossArea; + } else if (isTouchingGround) { + areas(curIndex).grndCntFloor += surf.GrossArea; + } else { + areas(curIndex).intZoneFloor += surf.GrossArea; + } + } break; + case DataSurfaces::SurfaceClass::Window: + case DataSurfaces::SurfaceClass::TDD_Dome: { + areas(curIndex).fenestration += surf.GrossArea; + } break; + case DataSurfaces::SurfaceClass::Door: + case DataSurfaces::SurfaceClass::GlassDoor: { + areas(curIndex).door += surf.GrossArea; + } break; + } +} // adds the area column for the load component tables -void AddAreaColumnForZone(int const zoneNum, Array1D const &compAreas, CompLoadTablesType &compLoad) +void AddAreaColumnForZone(ZompComponentAreasType const &compAreas, CompLoadTablesType &compLoad) { - compLoad.cells(LoadCompCol::Area, LoadCompRow::People) = compAreas(zoneNum).floor; + compLoad.cells(LoadCompCol::Area, LoadCompRow::People) = compAreas.floor; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::People) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::Lights) = compAreas(zoneNum).floor; + compLoad.cells(LoadCompCol::Area, LoadCompRow::Lights) = compAreas.floor; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::Lights) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::Equip) = compAreas(zoneNum).floor; + compLoad.cells(LoadCompCol::Area, LoadCompRow::Equip) = compAreas.floor; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::Equip) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::Refrig) = compAreas(zoneNum).floor; + compLoad.cells(LoadCompCol::Area, LoadCompRow::Refrig) = compAreas.floor; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::Refrig) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::WaterUse) = compAreas(zoneNum).floor; + compLoad.cells(LoadCompCol::Area, LoadCompRow::WaterUse) = compAreas.floor; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::WaterUse) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::Infil) = compAreas(zoneNum).extWall; + compLoad.cells(LoadCompCol::Area, LoadCompRow::Infil) = compAreas.extWall; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::Infil) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::Roof) = compAreas(zoneNum).roof; + compLoad.cells(LoadCompCol::Area, LoadCompRow::Roof) = compAreas.roof; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::Roof) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::IntZonCeil) = compAreas(zoneNum).ceiling; + compLoad.cells(LoadCompCol::Area, LoadCompRow::IntZonCeil) = compAreas.ceiling; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::IntZonCeil) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::OtherRoof) = compAreas(zoneNum).roof; + compLoad.cells(LoadCompCol::Area, LoadCompRow::OtherRoof) = compAreas.roof; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::OtherRoof) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::ExtWall) = compAreas(zoneNum).extWall; + compLoad.cells(LoadCompCol::Area, LoadCompRow::ExtWall) = compAreas.extWall; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::ExtWall) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::IntZonWall) = compAreas(zoneNum).intZoneWall; + compLoad.cells(LoadCompCol::Area, LoadCompRow::IntZonWall) = compAreas.intZoneWall; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::IntZonWall) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::GrdWall) = compAreas(zoneNum).grndCntWall; + compLoad.cells(LoadCompCol::Area, LoadCompRow::GrdWall) = compAreas.grndCntWall; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::GrdWall) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::OtherWall) = compAreas(zoneNum).extWall; + compLoad.cells(LoadCompCol::Area, LoadCompRow::OtherWall) = compAreas.extWall; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::OtherWall) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::ExtFlr) = compAreas(zoneNum).extFloor; + compLoad.cells(LoadCompCol::Area, LoadCompRow::ExtFlr) = compAreas.extFloor; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::ExtFlr) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::IntZonFlr) = compAreas(zoneNum).intZoneFloor; + compLoad.cells(LoadCompCol::Area, LoadCompRow::IntZonFlr) = compAreas.intZoneFloor; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::IntZonFlr) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::GrdFlr) = compAreas(zoneNum).grndCntFloor; + compLoad.cells(LoadCompCol::Area, LoadCompRow::GrdFlr) = compAreas.grndCntFloor; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::GrdFlr) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::OtherFlr) = compAreas(zoneNum).intZoneFloor; + compLoad.cells(LoadCompCol::Area, LoadCompRow::OtherFlr) = compAreas.intZoneFloor; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::OtherFlr) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::FeneCond) = compAreas(zoneNum).fenestration; + compLoad.cells(LoadCompCol::Area, LoadCompRow::FeneCond) = compAreas.fenestration; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::FeneCond) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::FeneSolr) = compAreas(zoneNum).fenestration; + compLoad.cells(LoadCompCol::Area, LoadCompRow::FeneSolr) = compAreas.fenestration; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::FeneSolr) = true; - compLoad.cells(LoadCompCol::Area, LoadCompRow::OpqDoor) = compAreas(zoneNum).door; + compLoad.cells(LoadCompCol::Area, LoadCompRow::OpqDoor) = compAreas.door; compLoad.cellUsed(LoadCompCol::Area, LoadCompRow::OpqDoor) = true; } @@ -16496,7 +16594,11 @@ void OutputCompLoadSummary(EnergyPlusData &state, std::string zoneAirLoopFacilityName; bool writeOutput = false; - if (kind == OutputType::Zone && ort->displayZoneComponentLoadSummary) { + if (kind == OutputType::Space && ort->displayZoneComponentLoadSummary) { + reportName = "Space Component Load Summary"; + zoneAirLoopFacilityName = state.dataHeatBal->space(zoneOrAirLoopIndex).Name; + writeOutput = true; + } else if (kind == OutputType::Zone && ort->displayZoneComponentLoadSummary) { reportName = "Zone Component Load Summary"; zoneAirLoopFacilityName = state.dataHeatBal->Zone(zoneOrAirLoopIndex).Name; writeOutput = true; diff --git a/src/EnergyPlus/OutputReportTabular.hh b/src/EnergyPlus/OutputReportTabular.hh index e0b30a2a535..f2236a7f846 100644 --- a/src/EnergyPlus/OutputReportTabular.hh +++ b/src/EnergyPlus/OutputReportTabular.hh @@ -65,6 +65,7 @@ #include #include #include +#include #include #include #include @@ -198,6 +199,7 @@ namespace OutputReportTabular { enum class OutputType { Invalid = -1, + Space, Zone, AirLoop, Facility, @@ -777,6 +779,21 @@ namespace OutputReportTabular { void WriteLoadComponentSummaryTables(EnergyPlusData &state); + void computeSpaceZoneCompLoads(EnergyPlusData &state, + DataSizing::ZoneSizingData &calcFinalSizing, + CompLoadTablesType &coolCompLoadTables, + CompLoadTablesType &heatCompLoadTables, + Array1D &peopleDelaySeq, + Array1D &equipDelaySeq, + Array1D &hvacLossDelaySeq, + Array1D &powerGenDelaySeq, + Array1D &lightDelaySeq, + Array1D &feneSolarDelaySeq, + Array3D &feneCondInstantSeqLoc, + Array2D &surfDelaySeq, + ZompComponentAreasType &componentAreas, + int iZone); + void GetDelaySequences(EnergyPlusData &state, int desDaySelected, bool isCooling, @@ -810,9 +827,11 @@ namespace OutputReportTabular { void ComputeEngineeringChecks(CompLoadTablesType &compLoad); - void GetZoneComponentAreas(EnergyPlusData &state, Array1D &areas); + void GetZoneComponentAreas(EnergyPlusData &state, Array1D &znAreas, Array1D &spAreas); + + void addSurfaceArea(DataSurfaces::SurfaceData const &curSurface, Array1D &areas, bool isZone); - void AddAreaColumnForZone(int zoneNum, Array1D const &compAreas, CompLoadTablesType &compLoadTotal); + void AddAreaColumnForZone(ZompComponentAreasType const &compAreas, CompLoadTablesType &compLoadTotal); void CombineLoadCompResults(CompLoadTablesType &compLoadTotal, CompLoadTablesType const &compLoadPartial, Real64 multiplier); diff --git a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc index 68afb1ad5ec..f87554f7cde 100644 --- a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc +++ b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc @@ -6716,6 +6716,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_ComputeEngineeringChecks_test) TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetZoneComponentAreas_test) { Array1D areas; + Array1D spaceAreas; areas.allocate(1); state->dataHeatBal->Zone.allocate(1); @@ -6802,7 +6803,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetZoneComponentAreas_test) state->dataSurface->Surface(13).Zone = 1; state->dataSurface->Surface(13).HeatTransSurf = true; - GetZoneComponentAreas(*state, areas); + GetZoneComponentAreas(*state, areas, spaceAreas); EXPECT_EQ(12., areas(1).floor); EXPECT_EQ(8., areas(1).roof); From 1151757fc2b999b32089efa0a8679fe4f5438277 Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Wed, 11 Sep 2024 17:10:37 -0500 Subject: [PATCH 02/25] Space IV.6 - component loads 2 --- src/EnergyPlus/OutputReportTabular.cc | 42 ++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index 36bbc463c63..a0c91d2e4f8 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -14446,6 +14446,12 @@ void AddTOCLoadComponentTableSummaries(EnergyPlusData &state) if (state.dataGlobal->CompLoadReportIsReq) { if (ort->displayZoneComponentLoadSummary) { + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + for (int iSpace = 1; iSpace <= state.dataGlobal->NumOfZones; ++iSpace) { + if (!state.dataZoneEquip->ZoneEquipConfig(state.dataHeatBal->space(iSpace).zoneNum).IsControlled) continue; + AddTOCEntry(state, "Space Component Load Summary", state.dataHeatBal->space(iSpace).Name); + } + } for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { if (!state.dataZoneEquip->ZoneEquipConfig(iZone).IsControlled) continue; AddTOCEntry(state, "Zone Component Load Summary", state.dataHeatBal->Zone(iZone).Name); @@ -15028,8 +15034,6 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) e.cellUsed = false; } } - } - if (ort->displayZoneComponentLoadSummary) { ZoneHeatCompLoadTables.allocate(state.dataGlobal->NumOfZones); for (auto &e : ZoneHeatCompLoadTables) { e.cells.allocate(LoadCompCol::PerArea, LoadCompRow::GrdTot); @@ -15117,6 +15121,28 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) // ZoneComponentLoadSummary if (ort->displayZoneComponentLoadSummary) { + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + for (int iSpace = 1; iSpace <= state.dataGlobal->NumOfZones; ++iSpace) { + // Yes, check if the zone is controlled, not the space for this + if (!state.dataZoneEquip->ZoneEquipConfig(state.dataHeatBal->space(iSpace).zoneNum).IsControlled) continue; + if (allocated(state.dataSize->CalcFinalSpaceSizing)) { + computeSpaceZoneCompLoads(state, + state.dataSize->CalcFinalSpaceSizing(iSpace), + SpaceCoolCompLoadTables(iSpace), + SpaceHeatCompLoadTables(iSpace), + peopleDelaySeqCool, + equipDelaySeqCool, + hvacLossDelaySeqCool, + powerGenDelaySeqCool, + lightDelaySeqCool, + feneSolarDelaySeqCool, + ort->feneCondInstantSeq, + surfDelaySeqCool, + spaceComponentAreas(iSpace), + iSpace); + } + } + } for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { if (!state.dataZoneEquip->ZoneEquipConfig(iZone).IsControlled) continue; if (allocated(state.dataSize->CalcFinalZoneSizing)) { @@ -15134,13 +15160,12 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) surfDelaySeqCool, ZoneComponentAreas(iZone), iZone); - - // We delay the potential application of SI to IP conversion and actual output until after both the - // AirLoopComponentLoadSummary and FacilityComponentLoadSummary have been processed because below we try - // to retrieve the info directly when the timestamp would match (cf #7356), and if we converted right - // now, we would apply the conversion twice } } + // We delay the potential application of SI to IP conversion and actual output until after both the + // AirLoopComponentLoadSummary and FacilityComponentLoadSummary have been processed because below we try + // to retrieve the info directly when the timestamp would match (cf #7356), and if we converted right + // now, we would apply the conversion twice } // AirLoopComponentLoadSummary @@ -15492,7 +15517,8 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) // SpaceComponentLoadSummary: Now we convert and Display if (state.dataHeatBal->doSpaceHeatBalanceSizing) { if (ort->displayZoneComponentLoadSummary) { - for (int iSpace = 1; iSpace <= state.dataGlobal->NumOfZones; ++iSpace) { + for (int iSpace = 1; iSpace <= state.dataGlobal->numSpaces; ++iSpace) { + // Test if *zone* is controlled, not space, for sizing if (!state.dataZoneEquip->ZoneEquipConfig(state.dataHeatBal->space(iSpace).zoneNum).IsControlled) continue; if (allocated(state.dataSize->CalcFinalSpaceSizing)) { LoadSummaryUnitConversion(state, SpaceCoolCompLoadTables(iSpace), unitsStyle_cur); From d7ca02898823721819421fe9471127bfbaa5910f Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Wed, 11 Sep 2024 17:36:29 -0500 Subject: [PATCH 03/25] Space IV.6 - component loads 3 - consolidate seq arrays --- src/EnergyPlus/OutputReportTabular.cc | 224 +++++++++++--------------- 1 file changed, 98 insertions(+), 126 deletions(-) diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index a0c91d2e4f8..bc91707d555 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -14946,20 +14946,13 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) // Delayed components are moved into this function so that we can calculate them one zone at a time // with Array1D - Array1D peopleDelaySeqHeat; - Array1D peopleDelaySeqCool; - Array1D lightDelaySeqHeat; - Array1D lightDelaySeqCool; - Array1D equipDelaySeqHeat; - Array1D equipDelaySeqCool; - Array1D hvacLossDelaySeqHeat; - Array1D hvacLossDelaySeqCool; - Array1D powerGenDelaySeqHeat; - Array1D powerGenDelaySeqCool; - Array1D feneSolarDelaySeqHeat; - Array1D feneSolarDelaySeqCool; - Array2D surfDelaySeqHeat; - Array2D surfDelaySeqCool; + Array1D peopleDelaySeq; + Array1D lightDelaySeq; + Array1D equipDelaySeq; + Array1D hvacLossDelaySeq; + Array1D powerGenDelaySeq; + Array1D feneSolarDelaySeq; + Array2D surfDelaySeq; Array1D SpaceHeatCompLoadTables; // for space level component load summary output tables Array1D SpaceCoolCompLoadTables; @@ -14987,34 +14980,20 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) if (produceDualUnitsFlags(iUnitSystem, ort->unitsStyle, ort->unitsStyle_SQLite, unitsStyle_cur, produceTabular, produceSQLite)) break; // adjusted initilization location to after variable declaration for loops 2021-01-11 - peopleDelaySeqHeat.dimension(state.dataGlobal->NumOfTimeStepInHour * 24, 0.0); - peopleDelaySeqHeat = 0.0; - peopleDelaySeqCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); - peopleDelaySeqCool = 0.0; - lightDelaySeqHeat.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); - lightDelaySeqHeat = 0.0; - lightDelaySeqCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); - lightDelaySeqCool = 0.0; - equipDelaySeqHeat.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); - equipDelaySeqHeat = 0.0; - equipDelaySeqCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); - equipDelaySeqCool = 0.0; - hvacLossDelaySeqHeat.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); - hvacLossDelaySeqHeat = 0.0; - hvacLossDelaySeqCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); - hvacLossDelaySeqCool = 0.0; - powerGenDelaySeqHeat.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); - powerGenDelaySeqHeat = 0.0; - powerGenDelaySeqCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); - powerGenDelaySeqCool = 0.0; - feneSolarDelaySeqHeat.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); - feneSolarDelaySeqHeat = 0.0; - feneSolarDelaySeqCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); - feneSolarDelaySeqCool = 0.0; - surfDelaySeqHeat.allocate(state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); - surfDelaySeqHeat = 0.0; - surfDelaySeqCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); - surfDelaySeqCool = 0.0; + peopleDelaySeq.dimension(state.dataGlobal->NumOfTimeStepInHour * 24, 0.0); + peopleDelaySeq = 0.0; + lightDelaySeq.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); + lightDelaySeq = 0.0; + equipDelaySeq.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); + equipDelaySeq = 0.0; + hvacLossDelaySeq.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); + hvacLossDelaySeq = 0.0; + powerGenDelaySeq.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); + powerGenDelaySeq = 0.0; + feneSolarDelaySeq.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); + feneSolarDelaySeq = 0.0; + surfDelaySeq.allocate(state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); + surfDelaySeq = 0.0; // initialize arrays if (ort->displayZoneComponentLoadSummary) { @@ -15130,14 +15109,14 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) state.dataSize->CalcFinalSpaceSizing(iSpace), SpaceCoolCompLoadTables(iSpace), SpaceHeatCompLoadTables(iSpace), - peopleDelaySeqCool, - equipDelaySeqCool, - hvacLossDelaySeqCool, - powerGenDelaySeqCool, - lightDelaySeqCool, - feneSolarDelaySeqCool, + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, ort->feneCondInstantSeq, - surfDelaySeqCool, + surfDelaySeq, spaceComponentAreas(iSpace), iSpace); } @@ -15150,14 +15129,14 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) state.dataSize->CalcFinalZoneSizing(iZone), ZoneCoolCompLoadTables(iZone), ZoneHeatCompLoadTables(iZone), - peopleDelaySeqCool, - equipDelaySeqCool, - hvacLossDelaySeqCool, - powerGenDelaySeqCool, - lightDelaySeqCool, - feneSolarDelaySeqCool, + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, ort->feneCondInstantSeq, - surfDelaySeqCool, + surfDelaySeq, ZoneComponentAreas(iZone), iZone); } @@ -15250,28 +15229,28 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) coolDesSelected, true, iZone, - peopleDelaySeqCool, - equipDelaySeqCool, - hvacLossDelaySeqCool, - powerGenDelaySeqCool, - lightDelaySeqCool, - feneSolarDelaySeqCool, + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, ort->feneCondInstantSeq, - surfDelaySeqCool); + surfDelaySeq); ComputeTableBodyUsingMovingAvg(state, airLoopZonesCoolCompLoadTables.cells, airLoopZonesCoolCompLoadTables.cellUsed, coolDesSelected, timeCoolMax, iZone, - peopleDelaySeqCool, - equipDelaySeqCool, - hvacLossDelaySeqCool, - powerGenDelaySeqCool, - lightDelaySeqCool, - feneSolarDelaySeqCool, + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, ort->feneCondInstantSeq, - surfDelaySeqCool); + surfDelaySeq); CollectPeakZoneConditions(state, airLoopZonesCoolCompLoadTables, coolDesSelected, timeCoolMax, iZone, true); AddAreaColumnForZone(ZoneComponentAreas(iZone), airLoopZonesCoolCompLoadTables); } @@ -15287,28 +15266,28 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) heatDesSelected, false, iZone, - peopleDelaySeqHeat, - equipDelaySeqHeat, - hvacLossDelaySeqHeat, - powerGenDelaySeqHeat, - lightDelaySeqHeat, - feneSolarDelaySeqHeat, + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, ort->feneCondInstantSeq, - surfDelaySeqHeat); + surfDelaySeq); ComputeTableBodyUsingMovingAvg(state, airLoopZonesHeatCompLoadTables.cells, airLoopZonesHeatCompLoadTables.cellUsed, heatDesSelected, timeHeatMax, iZone, - peopleDelaySeqHeat, - equipDelaySeqHeat, - hvacLossDelaySeqHeat, - powerGenDelaySeqHeat, - lightDelaySeqHeat, - feneSolarDelaySeqHeat, + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, ort->feneCondInstantSeq, - surfDelaySeqHeat); + surfDelaySeq); CollectPeakZoneConditions(state, airLoopZonesHeatCompLoadTables, heatDesSelected, timeHeatMax, iZone, false); AddAreaColumnForZone(ZoneComponentAreas(iZone), airLoopZonesHeatCompLoadTables); } @@ -15405,28 +15384,28 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) coolDesSelected, true, iZone, - peopleDelaySeqCool, - equipDelaySeqCool, - hvacLossDelaySeqCool, - powerGenDelaySeqCool, - lightDelaySeqCool, - feneSolarDelaySeqCool, + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, ort->feneCondInstantSeq, - surfDelaySeqCool); + surfDelaySeq); ComputeTableBodyUsingMovingAvg(state, facilityZonesCoolCompLoadTables.cells, facilityZonesCoolCompLoadTables.cellUsed, coolDesSelected, timeCoolMax, iZone, - peopleDelaySeqCool, - equipDelaySeqCool, - hvacLossDelaySeqCool, - powerGenDelaySeqCool, - lightDelaySeqCool, - feneSolarDelaySeqCool, + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, ort->feneCondInstantSeq, - surfDelaySeqCool); + surfDelaySeq); CollectPeakZoneConditions(state, facilityZonesCoolCompLoadTables, coolDesSelected, timeCoolMax, iZone, true); AddAreaColumnForZone(ZoneComponentAreas(iZone), facilityZonesCoolCompLoadTables); } @@ -15442,28 +15421,28 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) heatDesSelected, false, iZone, - peopleDelaySeqHeat, - equipDelaySeqHeat, - hvacLossDelaySeqHeat, - powerGenDelaySeqHeat, - lightDelaySeqHeat, - feneSolarDelaySeqHeat, + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, ort->feneCondInstantSeq, - surfDelaySeqHeat); + surfDelaySeq); ComputeTableBodyUsingMovingAvg(state, facilityZonesHeatCompLoadTables.cells, facilityZonesHeatCompLoadTables.cellUsed, heatDesSelected, timeHeatMax, iZone, - peopleDelaySeqHeat, - equipDelaySeqHeat, - hvacLossDelaySeqHeat, - powerGenDelaySeqHeat, - lightDelaySeqHeat, - feneSolarDelaySeqHeat, + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, ort->feneCondInstantSeq, - surfDelaySeqHeat); + surfDelaySeq); CollectPeakZoneConditions(state, facilityZonesHeatCompLoadTables, heatDesSelected, timeHeatMax, iZone, false); AddAreaColumnForZone(ZoneComponentAreas(iZone), facilityZonesHeatCompLoadTables); } @@ -15574,20 +15553,13 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) FacilityZonesHeatCompLoadTables.deallocate(); FacilityZonesCoolCompLoadTables.deallocate(); - peopleDelaySeqHeat.deallocate(); - peopleDelaySeqCool.deallocate(); - lightDelaySeqHeat.deallocate(); - lightDelaySeqCool.deallocate(); - equipDelaySeqHeat.deallocate(); - equipDelaySeqCool.deallocate(); - hvacLossDelaySeqHeat.deallocate(); - hvacLossDelaySeqCool.deallocate(); - powerGenDelaySeqHeat.deallocate(); - powerGenDelaySeqCool.deallocate(); - feneSolarDelaySeqHeat.deallocate(); - feneSolarDelaySeqCool.deallocate(); - surfDelaySeqHeat.deallocate(); - surfDelaySeqCool.deallocate(); + peopleDelaySeq.deallocate(); + lightDelaySeq.deallocate(); + equipDelaySeq.deallocate(); + hvacLossDelaySeq.deallocate(); + powerGenDelaySeq.deallocate(); + feneSolarDelaySeq.deallocate(); + surfDelaySeq.deallocate(); } } From 6491fc6a0a1ab6fd8a809e2da6c8799587a6094e Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Wed, 11 Sep 2024 21:51:44 -0500 Subject: [PATCH 04/25] Space IV.6 - component loads 4 --- src/EnergyPlus/OutputReportTabular.cc | 128 ++++++++++++++------------ src/EnergyPlus/OutputReportTabular.hh | 8 +- 2 files changed, 74 insertions(+), 62 deletions(-) diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index bc91707d555..52c5906b685 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -15101,9 +15101,10 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) // ZoneComponentLoadSummary if (ort->displayZoneComponentLoadSummary) { if (state.dataHeatBal->doSpaceHeatBalanceSizing) { - for (int iSpace = 1; iSpace <= state.dataGlobal->NumOfZones; ++iSpace) { + for (int iSpace = 1; iSpace <= state.dataGlobal->numSpaces; ++iSpace) { // Yes, check if the zone is controlled, not the space for this - if (!state.dataZoneEquip->ZoneEquipConfig(state.dataHeatBal->space(iSpace).zoneNum).IsControlled) continue; + int zoneNum = state.dataHeatBal->space(iSpace).zoneNum; + if (!state.dataZoneEquip->ZoneEquipConfig(zoneNum).IsControlled) continue; if (allocated(state.dataSize->CalcFinalSpaceSizing)) { computeSpaceZoneCompLoads(state, state.dataSize->CalcFinalSpaceSizing(iSpace), @@ -15118,6 +15119,7 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) ort->feneCondInstantSeq, surfDelaySeq, spaceComponentAreas(iSpace), + zoneNum, iSpace); } } @@ -15564,7 +15566,7 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) } void computeSpaceZoneCompLoads(EnergyPlusData &state, - DataSizing::ZoneSizingData &calcFinalSizing, + DataSizing::ZoneSizingData const &calcFinalSizing, CompLoadTablesType &coolCompLoadTables, CompLoadTablesType &heatCompLoadTables, Array1D &peopleDelaySeq, @@ -15576,7 +15578,8 @@ void computeSpaceZoneCompLoads(EnergyPlusData &state, Array3D &feneCondInstantSeqLoc, Array2D &surfDelaySeq, ZompComponentAreasType &componentAreas, - int iZone) + int const iZone, + int const iSpace) { int coolDesSelected = calcFinalSizing.CoolDDNum; coolCompLoadTables.desDayNum = coolDesSelected; @@ -15609,7 +15612,7 @@ void computeSpaceZoneCompLoads(EnergyPlusData &state, feneSolarDelaySeq, feneCondInstantSeqLoc, surfDelaySeq); - CollectPeakZoneConditions(state, coolCompLoadTables, coolDesSelected, timeCoolMax, iZone, true); + CollectPeakZoneConditions(state, coolCompLoadTables, coolDesSelected, timeCoolMax, iZone, true, iSpace); // send latent load info to coil summary report state.dataRptCoilSelection->coilSelectionReportObj->setZoneLatentLoadCoolingIdealPeak( iZone, coolCompLoadTables.cells(LoadCompCol::Latent, LoadCompRow::GrdTot)); @@ -15645,7 +15648,7 @@ void computeSpaceZoneCompLoads(EnergyPlusData &state, feneSolarDelaySeq, feneCondInstantSeqLoc, surfDelaySeq); - CollectPeakZoneConditions(state, heatCompLoadTables, heatDesSelected, timeHeatMax, iZone, false); + CollectPeakZoneConditions(state, heatCompLoadTables, heatDesSelected, timeHeatMax, iZone, false, iSpace); // send latent load info to coil summary report state.dataRptCoilSelection->coilSelectionReportObj->setZoneLatentLoadHeatingIdealPeak( @@ -16033,14 +16036,21 @@ void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, } // for the load summary report add values the peak conditions subtable -void CollectPeakZoneConditions( - EnergyPlusData &state, CompLoadTablesType &compLoad, int const desDaySelected, int const timeOfMax, int const zoneIndex, bool const isCooling) +void CollectPeakZoneConditions(EnergyPlusData &state, + CompLoadTablesType &compLoad, + int const desDaySelected, + int const timeOfMax, + int const zoneIndex, + bool const isCooling, + int const spaceIndex) { if (timeOfMax != 0) { auto const &thisZone = state.dataHeatBal->Zone(zoneIndex); - auto const &thisCalcFinalZoneSizing = state.dataSize->CalcFinalZoneSizing(zoneIndex); + auto const &szCalcFinalSizing = + (spaceIndex == 0) ? state.dataSize->CalcFinalZoneSizing(zoneIndex) : state.dataSize->CalcFinalSpaceSizing(spaceIndex); + auto const &szFinalSizing = (spaceIndex == 0) ? state.dataSize->FinalZoneSizing(zoneIndex) : state.dataSize->FinalSpaceSizing(spaceIndex); Real64 mult = thisZone.Multiplier * thisZone.ListMultiplier; if (mult == 0.0) mult = 1.0; @@ -16053,53 +16063,49 @@ void CollectPeakZoneConditions( state.dataWeather->DesDayInput(desDaySelected).DayOfMonth, state.dataRptCoilSelection->coilSelectionReportObj->getTimeText(state, timeOfMax)); } else { - compLoad.peakDateHrMin = thisCalcFinalZoneSizing.CoolPeakDateHrMin; + compLoad.peakDateHrMin = szCalcFinalSizing.CoolPeakDateHrMin; } // Outside Dry Bulb Temperature - compLoad.outsideDryBulb = thisCalcFinalZoneSizing.CoolOutTempSeq(timeOfMax); + compLoad.outsideDryBulb = szCalcFinalSizing.CoolOutTempSeq(timeOfMax); // Outside Wet Bulb Temperature // use standard air pressure because air pressure is not tracked with sizing data - if (thisCalcFinalZoneSizing.CoolOutHumRatSeq(timeOfMax) < 1.0 && thisCalcFinalZoneSizing.CoolOutHumRatSeq(timeOfMax) > 0.0) { - compLoad.outsideWetBulb = Psychrometrics::PsyTwbFnTdbWPb(state, - thisCalcFinalZoneSizing.CoolOutTempSeq(timeOfMax), - thisCalcFinalZoneSizing.CoolOutHumRatSeq(timeOfMax), - state.dataEnvrn->StdBaroPress); + if (szCalcFinalSizing.CoolOutHumRatSeq(timeOfMax) < 1.0 && szCalcFinalSizing.CoolOutHumRatSeq(timeOfMax) > 0.0) { + compLoad.outsideWetBulb = Psychrometrics::PsyTwbFnTdbWPb( + state, szCalcFinalSizing.CoolOutTempSeq(timeOfMax), szCalcFinalSizing.CoolOutHumRatSeq(timeOfMax), state.dataEnvrn->StdBaroPress); } // Outside Humidity Ratio at Peak - compLoad.outsideHumRatio = thisCalcFinalZoneSizing.CoolOutHumRatSeq(timeOfMax); + compLoad.outsideHumRatio = szCalcFinalSizing.CoolOutHumRatSeq(timeOfMax); // Zone Dry Bulb Temperature - compLoad.zoneDryBulb = thisCalcFinalZoneSizing.CoolZoneTempSeq(timeOfMax); + compLoad.zoneDryBulb = szCalcFinalSizing.CoolZoneTempSeq(timeOfMax); // Zone Relative Humdity // use standard air pressure because air pressure is not tracked with sizing data - compLoad.zoneRelHum = Psychrometrics::PsyRhFnTdbWPb(state, - thisCalcFinalZoneSizing.CoolZoneTempSeq(timeOfMax), - thisCalcFinalZoneSizing.CoolZoneHumRatSeq(timeOfMax), - state.dataEnvrn->StdBaroPress); + compLoad.zoneRelHum = Psychrometrics::PsyRhFnTdbWPb( + state, szCalcFinalSizing.CoolZoneTempSeq(timeOfMax), szCalcFinalSizing.CoolZoneHumRatSeq(timeOfMax), state.dataEnvrn->StdBaroPress); // Zone Humidity Ratio at Peak - compLoad.zoneHumRatio = thisCalcFinalZoneSizing.CoolZoneHumRatSeq(timeOfMax); + compLoad.zoneHumRatio = szCalcFinalSizing.CoolZoneHumRatSeq(timeOfMax); // Peak Design Sensible Load - compLoad.peakDesSensLoad = thisCalcFinalZoneSizing.DesCoolLoad / mult; // change sign + compLoad.peakDesSensLoad = szCalcFinalSizing.DesCoolLoad / mult; // change sign // Design Peak Load - compLoad.designPeakLoad = state.dataSize->FinalZoneSizing(zoneIndex).DesCoolLoad / mult; + compLoad.designPeakLoad = szFinalSizing.DesCoolLoad / mult; // Supply air temperature - if (thisCalcFinalZoneSizing.ZnCoolDgnSAMethod == DataSizing::SupplyAirTemperature) { - compLoad.supAirTemp = thisCalcFinalZoneSizing.CoolDesTemp; + if (szCalcFinalSizing.ZnCoolDgnSAMethod == DataSizing::SupplyAirTemperature) { + compLoad.supAirTemp = szCalcFinalSizing.CoolDesTemp; } else { - Real64 DeltaTemp = -std::abs(thisCalcFinalZoneSizing.CoolDesTempDiff); - compLoad.supAirTemp = DeltaTemp + thisCalcFinalZoneSizing.ZoneTempAtCoolPeak; + Real64 DeltaTemp = -std::abs(szCalcFinalSizing.CoolDesTempDiff); + compLoad.supAirTemp = DeltaTemp + szCalcFinalSizing.ZoneTempAtCoolPeak; } // Main fan air flow - compLoad.mainFanAirFlow = thisCalcFinalZoneSizing.DesCoolVolFlow; + compLoad.mainFanAirFlow = szCalcFinalSizing.DesCoolVolFlow; } else { // Time of Peak Load @@ -16109,57 +16115,53 @@ void CollectPeakZoneConditions( state.dataWeather->DesDayInput(desDaySelected).DayOfMonth, state.dataRptCoilSelection->coilSelectionReportObj->getTimeText(state, timeOfMax)); } else { - compLoad.peakDateHrMin = thisCalcFinalZoneSizing.HeatPeakDateHrMin; + compLoad.peakDateHrMin = szCalcFinalSizing.HeatPeakDateHrMin; } // Outside Dry Bulb Temperature - compLoad.outsideDryBulb = thisCalcFinalZoneSizing.HeatOutTempSeq(timeOfMax); + compLoad.outsideDryBulb = szCalcFinalSizing.HeatOutTempSeq(timeOfMax); // Outside Wet Bulb Temperature // use standard air pressure because air pressure is not tracked with sizing data - if (thisCalcFinalZoneSizing.HeatOutHumRatSeq(timeOfMax) < 1.0 && thisCalcFinalZoneSizing.HeatOutHumRatSeq(timeOfMax) > 0.0) { - compLoad.outsideWetBulb = Psychrometrics::PsyTwbFnTdbWPb(state, - thisCalcFinalZoneSizing.HeatOutTempSeq(timeOfMax), - thisCalcFinalZoneSizing.HeatOutHumRatSeq(timeOfMax), - state.dataEnvrn->StdBaroPress); + if (szCalcFinalSizing.HeatOutHumRatSeq(timeOfMax) < 1.0 && szCalcFinalSizing.HeatOutHumRatSeq(timeOfMax) > 0.0) { + compLoad.outsideWetBulb = Psychrometrics::PsyTwbFnTdbWPb( + state, szCalcFinalSizing.HeatOutTempSeq(timeOfMax), szCalcFinalSizing.HeatOutHumRatSeq(timeOfMax), state.dataEnvrn->StdBaroPress); } // Outside Humidity Ratio at Peak - compLoad.outsideHumRatio = thisCalcFinalZoneSizing.HeatOutHumRatSeq(timeOfMax); + compLoad.outsideHumRatio = szCalcFinalSizing.HeatOutHumRatSeq(timeOfMax); // Zone Dry Bulb Temperature - compLoad.zoneDryBulb = thisCalcFinalZoneSizing.HeatZoneTempSeq(timeOfMax); + compLoad.zoneDryBulb = szCalcFinalSizing.HeatZoneTempSeq(timeOfMax); // Zone Relative Humdity // use standard air pressure because air pressure is not tracked with sizing data - compLoad.zoneRelHum = Psychrometrics::PsyRhFnTdbWPb(state, - thisCalcFinalZoneSizing.HeatZoneTempSeq(timeOfMax), - thisCalcFinalZoneSizing.HeatZoneHumRatSeq(timeOfMax), - state.dataEnvrn->StdBaroPress); + compLoad.zoneRelHum = Psychrometrics::PsyRhFnTdbWPb( + state, szCalcFinalSizing.HeatZoneTempSeq(timeOfMax), szCalcFinalSizing.HeatZoneHumRatSeq(timeOfMax), state.dataEnvrn->StdBaroPress); // Zone Humidity Ratio at Peak - compLoad.zoneHumRatio = thisCalcFinalZoneSizing.HeatZoneHumRatSeq(timeOfMax); + compLoad.zoneHumRatio = szCalcFinalSizing.HeatZoneHumRatSeq(timeOfMax); // Peak Design Sensible Load - compLoad.peakDesSensLoad = -thisCalcFinalZoneSizing.DesHeatLoad / mult; // change sign + compLoad.peakDesSensLoad = -szCalcFinalSizing.DesHeatLoad / mult; // change sign // Design Peak Load - compLoad.designPeakLoad = -state.dataSize->FinalZoneSizing(zoneIndex).DesHeatLoad / mult; + compLoad.designPeakLoad = -szFinalSizing.DesHeatLoad / mult; // Supply air temperature - if (thisCalcFinalZoneSizing.ZnHeatDgnSAMethod == DataSizing::SupplyAirTemperature) { - compLoad.supAirTemp = thisCalcFinalZoneSizing.HeatDesTemp; + if (szCalcFinalSizing.ZnHeatDgnSAMethod == DataSizing::SupplyAirTemperature) { + compLoad.supAirTemp = szCalcFinalSizing.HeatDesTemp; } else { - Real64 DeltaTemp = -std::abs(thisCalcFinalZoneSizing.HeatDesTempDiff); - compLoad.supAirTemp = DeltaTemp + thisCalcFinalZoneSizing.ZoneTempAtHeatPeak; + Real64 DeltaTemp = -std::abs(szCalcFinalSizing.HeatDesTempDiff); + compLoad.supAirTemp = DeltaTemp + szCalcFinalSizing.ZoneTempAtHeatPeak; } // Main fan air flow - compLoad.mainFanAirFlow = thisCalcFinalZoneSizing.DesHeatVolFlow; + compLoad.mainFanAirFlow = szCalcFinalSizing.DesHeatVolFlow; } // Outside air flow - compLoad.outsideAirFlow = thisCalcFinalZoneSizing.MinOA; + compLoad.outsideAirFlow = szCalcFinalSizing.MinOA; // outside air % if (compLoad.mainFanAirFlow != 0.) { @@ -16184,12 +16186,22 @@ void CollectPeakZoneConditions( } // Number of people - Real64 const totNumPeople = std::accumulate(state.dataHeatBal->People.cbegin(), - state.dataHeatBal->People.cend(), - 0.0, - [&zoneIndex](const Real64 &sum, const DataHeatBalance::PeopleData &people) { - return zoneIndex == people.ZonePtr ? (sum + people.NumberOfPeople) : sum; - }); + Real64 const totNumPeople = 0; + if (spaceIndex == 0) { + std::accumulate(state.dataHeatBal->People.cbegin(), + state.dataHeatBal->People.cend(), + 0.0, + [&zoneIndex](const Real64 &sum, const DataHeatBalance::PeopleData &people) { + return zoneIndex == people.ZonePtr ? (sum + people.NumberOfPeople) : sum; + }); + } else { + std::accumulate(state.dataHeatBal->People.cbegin(), + state.dataHeatBal->People.cend(), + 0.0, + [&spaceIndex](const Real64 &sum, const DataHeatBalance::PeopleData &people) { + return spaceIndex == people.spaceIndex ? (sum + people.NumberOfPeople) : sum; + }); + } compLoad.numPeople = totNumPeople; } } diff --git a/src/EnergyPlus/OutputReportTabular.hh b/src/EnergyPlus/OutputReportTabular.hh index f2236a7f846..457eaf28c0a 100644 --- a/src/EnergyPlus/OutputReportTabular.hh +++ b/src/EnergyPlus/OutputReportTabular.hh @@ -780,7 +780,7 @@ namespace OutputReportTabular { void WriteLoadComponentSummaryTables(EnergyPlusData &state); void computeSpaceZoneCompLoads(EnergyPlusData &state, - DataSizing::ZoneSizingData &calcFinalSizing, + DataSizing::ZoneSizingData const &calcFinalSizing, CompLoadTablesType &coolCompLoadTables, CompLoadTablesType &heatCompLoadTables, Array1D &peopleDelaySeq, @@ -792,7 +792,7 @@ namespace OutputReportTabular { Array3D &feneCondInstantSeqLoc, Array2D &surfDelaySeq, ZompComponentAreasType &componentAreas, - int iZone); + int const iZone, int const iSpace = 0); void GetDelaySequences(EnergyPlusData &state, int desDaySelected, @@ -822,8 +822,8 @@ namespace OutputReportTabular { Array3D const &feneCondInstantSeqLoc, Array2D const &surfDelaySeq); - void - CollectPeakZoneConditions(EnergyPlusData &state, CompLoadTablesType &compLoad, int desDaySelected, int timeOfMax, int zoneIndex, bool isCooling); + void CollectPeakZoneConditions( + EnergyPlusData &state, CompLoadTablesType &compLoad, int desDaySelected, int timeOfMax, int zoneIndex, bool isCooling, int spaceIndex = 0); void ComputeEngineeringChecks(CompLoadTablesType &compLoad); From d9f4b5c66ddf7cb4c0eaeced8bc8bec1f045ed07 Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Wed, 11 Sep 2024 22:07:30 -0500 Subject: [PATCH 05/25] Space IV.6 - component loads 4 fix --- src/EnergyPlus/OutputReportTabular.cc | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index 52c5906b685..f7a4e671e89 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -16186,21 +16186,21 @@ void CollectPeakZoneConditions(EnergyPlusData &state, } // Number of people - Real64 const totNumPeople = 0; + Real64 totNumPeople = 0; if (spaceIndex == 0) { - std::accumulate(state.dataHeatBal->People.cbegin(), - state.dataHeatBal->People.cend(), - 0.0, - [&zoneIndex](const Real64 &sum, const DataHeatBalance::PeopleData &people) { - return zoneIndex == people.ZonePtr ? (sum + people.NumberOfPeople) : sum; - }); + totNumPeople = std::accumulate(state.dataHeatBal->People.cbegin(), + state.dataHeatBal->People.cend(), + 0.0, + [&zoneIndex](const Real64 &sum, const DataHeatBalance::PeopleData &people) { + return zoneIndex == people.ZonePtr ? (sum + people.NumberOfPeople) : sum; + }); } else { - std::accumulate(state.dataHeatBal->People.cbegin(), - state.dataHeatBal->People.cend(), - 0.0, - [&spaceIndex](const Real64 &sum, const DataHeatBalance::PeopleData &people) { - return spaceIndex == people.spaceIndex ? (sum + people.NumberOfPeople) : sum; - }); + totNumPeople = std::accumulate(state.dataHeatBal->People.cbegin(), + state.dataHeatBal->People.cend(), + 0.0, + [&spaceIndex](const Real64 &sum, const DataHeatBalance::PeopleData &people) { + return spaceIndex == people.spaceIndex ? (sum + people.NumberOfPeople) : sum; + }); } compLoad.numPeople = totNumPeople; } From c12a40be92fb4070cb1d5102dbf07a36dafe0eb3 Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Wed, 18 Sep 2024 15:20:33 -0500 Subject: [PATCH 06/25] Space IV.6 - component loads ReportAirHeatBalance --- src/EnergyPlus/DataHeatBalance.hh | 2 + src/EnergyPlus/HVACManager.cc | 848 +++++++++++--------- src/EnergyPlus/HVACManager.hh | 17 +- src/EnergyPlus/HeatBalanceSurfaceManager.cc | 2 + src/EnergyPlus/OutputReportTabular.cc | 2 +- src/EnergyPlus/OutputReportTabular.hh | 3 +- 6 files changed, 469 insertions(+), 405 deletions(-) diff --git a/src/EnergyPlus/DataHeatBalance.hh b/src/EnergyPlus/DataHeatBalance.hh index d0c04f26035..3aeec7e4d19 100644 --- a/src/EnergyPlus/DataHeatBalance.hh +++ b/src/EnergyPlus/DataHeatBalance.hh @@ -1405,6 +1405,8 @@ namespace DataHeatBalance { Real64 MixVdotStdDensity = 0.0; // Mixing volume flow rate of Air {m3/s} at standard density (adjusted for elevation) Real64 MixMass = 0.0; // Mixing mass of air {kg} Real64 MixMdot = 0.0; // Mixing mass flow rate of air {kg/s} + Real64 MixSenLoad = 0.0; // Heat Gain(+)/Loss(-) {J} due to mixing and cross mixing and refrigeration door mixing + Real64 MixLatLoad = 0.0; // Latent Gain(+)/Loss(-) {J} due to mixing and cross mixing and refrigeration door mixing Real64 MixHeatLoss = 0.0; // Heat Gain {J} due to mixing and cross mixing and refrigeration door mixing Real64 MixHeatGain = 0.0; // Heat Loss {J} due to mixing and cross mixing and refrigeration door mixing Real64 MixLatentLoss = 0.0; // Latent Gain {J} due to mixing and cross mixing and refrigeration door mixing diff --git a/src/EnergyPlus/HVACManager.cc b/src/EnergyPlus/HVACManager.cc index 8bc8708c0ed..0e1324b9d65 100644 --- a/src/EnergyPlus/HVACManager.cc +++ b/src/EnergyPlus/HVACManager.cc @@ -2261,58 +2261,28 @@ void ReportAirHeatBalance(EnergyPlusData &state) static constexpr std::string_view RoutineName3("ReportAirHeatBalance:3"); // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Real64 AirDensity; // Density of air (kg/m^3) - Real64 CpAir; // Heat capacity of air (J/kg-C) - Real64 ADSCorrectionFactor; // Correction factor of air flow model values when ADS is simulated - Real64 H2OHtOfVap; // Heat of vaporization of air - Real64 TotalLoad; // Total loss or gain state.dataHeatBal->ZoneTotalExfiltrationHeatLoss = 0.0; state.dataHeatBal->ZoneTotalExhaustHeatLoss = 0.0; - Real64 TimeStepSys = state.dataHVACGlobal->TimeStepSys; - Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; - if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { state.afn->report(); } // Reports zone exhaust loss by exhaust fans - for (int ZoneLoop = 1; ZoneLoop <= state.dataGlobal->NumOfZones; ++ZoneLoop) { // Start of zone loads report variable update loop ... - auto &zone = state.dataHeatBal->Zone(ZoneLoop); - auto &znAirRpt = state.dataHeatBal->ZnAirRpt(ZoneLoop); - auto &zoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(ZoneLoop); - CpAir = Psychrometrics::PsyCpAirFnW(state.dataEnvrn->OutHumRat); - H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(state.dataEnvrn->OutHumRat, zone.OutDryBulbTemp); - ADSCorrectionFactor = 1.0; - if (state.afn->simulation_control.type == AirflowNetwork::ControlType::MultizoneWithDistributionOnlyDuringFanOperation) { - if ((state.dataZoneEquip->ZoneEquipAvail(ZoneLoop) == Avail::Status::CycleOn || - state.dataZoneEquip->ZoneEquipAvail(ZoneLoop) == Avail::Status::CycleOnZoneFansOnly) && - state.afn->AirflowNetworkZoneFlag(ZoneLoop)) { - ADSCorrectionFactor = 0.0; - } - } - - znAirRpt.ExhTotalLoss = 0; - znAirRpt.ExhSensiLoss = 0; - - for (int FanNum = 1; FanNum <= (int)state.dataFans->fans.size(); ++FanNum) { - auto const *thisFan = state.dataFans->fans(FanNum); - // Add reportable vars - if (thisFan->type == HVAC::FanType::Exhaust) { - for (int ExhNum = 1; ExhNum <= zoneEquipConfig.NumExhaustNodes; ExhNum++) { - if (thisFan->inletNodeNum == zoneEquipConfig.ExhaustNode(ExhNum)) { - znAirRpt.ExhTotalLoss += - thisFan->outletAirMassFlowRate * (thisFan->outletAirEnthalpy - state.dataEnvrn->OutEnthalpy) * ADSCorrectionFactor; - znAirRpt.ExhSensiLoss += - thisFan->outletAirMassFlowRate * CpAir * (thisFan->outletAirTemp - zone.OutDryBulbTemp) * ADSCorrectionFactor; - break; - } - } - } + for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) { // Start of zone loads report variable update loop ... + auto &zone = state.dataHeatBal->Zone(zoneNum); + auto &znAirRpt = state.dataHeatBal->ZnAirRpt(zoneNum); + auto &znEquipConfig = state.dataZoneEquip->ZoneEquipConfig(zoneNum); + reportAirHeatBal1(state, znAirRpt, znEquipConfig, zoneNum); + } + if (state.dataHeatBal->doSpaceHeatBalance) { + for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) { + auto &spAirRpt = state.dataHeatBal->spaceAirRpt(spaceNum); + auto &spEquipConfig = state.dataZoneEquip->spaceEquipConfig(spaceNum); + int zoneNum = state.dataHeatBal->space(spaceNum).zoneNum; + reportAirHeatBal1(state, spAirRpt, spEquipConfig, zoneNum, spaceNum); } - - znAirRpt.ExhLatentLoss = znAirRpt.ExhTotalLoss - znAirRpt.ExhSensiLoss; } // Report results for SIMPLE option only @@ -2321,397 +2291,475 @@ void ReportAirHeatBalance(EnergyPlusData &state) return; } - if (state.dataHVACMgr->ReportAirHeatBalanceFirstTimeFlag) { - state.dataHVACMgr->MixSenLoad.allocate(state.dataGlobal->NumOfZones); - state.dataHVACMgr->MixLatLoad.allocate(state.dataGlobal->NumOfZones); - state.dataHVACMgr->ReportAirHeatBalanceFirstTimeFlag = false; - } - ReportInfiltrations(state); - for (int ZoneLoop = 1; ZoneLoop <= state.dataGlobal->NumOfZones; ++ZoneLoop) { // Start of zone loads report variable update loop ... - auto &zone = state.dataHeatBal->Zone(ZoneLoop); - auto &znAirRpt = state.dataHeatBal->ZnAirRpt(ZoneLoop); - auto &zoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(ZoneLoop); - auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneLoop); - auto &mixSenLoad = state.dataHVACMgr->MixSenLoad(ZoneLoop); // Mixing sensible loss or gain - auto &mixLatLoad = state.dataHVACMgr->MixLatLoad(ZoneLoop); // Mixing latent loss or gain + for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) { + auto &znAirRpt = state.dataHeatBal->ZnAirRpt(zoneNum); + auto &znEquipConfig = state.dataZoneEquip->ZoneEquipConfig(zoneNum); + auto &znHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum); + reportAirHeatBal2(state, znAirRpt, znEquipConfig, znHB, zoneNum); + } + if (state.dataHeatBal->doSpaceHeatBalance) { + for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) { + auto &spAirRpt = state.dataHeatBal->spaceAirRpt(spaceNum); + auto &spEquipConfig = state.dataZoneEquip->spaceEquipConfig(spaceNum); + auto &spHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum); + int zoneNum = state.dataHeatBal->space(spaceNum).zoneNum; + reportAirHeatBal2(state, spAirRpt, spEquipConfig, spHB, zoneNum, spaceNum); + } + } +} - // Break the infiltration load into heat gain and loss components - ADSCorrectionFactor = 1.0; +void reportAirHeatBal1(EnergyPlusData &state, + DataHeatBalance::AirReportVars &szAirRpt, + DataZoneEquipment::EquipConfiguration const &szEquipConfig, + int const zoneNum, + int const spaceNum) +{ + Real64 CpAir = Psychrometrics::PsyCpAirFnW(state.dataEnvrn->OutHumRat); // Heat capacity of air (J/kg-C) + Real64 outDB = state.dataHeatBal->Zone(zoneNum).OutDryBulbTemp; + Real64 H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(state.dataEnvrn->OutHumRat, outDB); // Heat of vaporization of air + Real64 ADSCorrectionFactor = 1.0; + if (state.afn->simulation_control.type == AirflowNetwork::ControlType::MultizoneWithDistributionOnlyDuringFanOperation) { + if ((state.dataZoneEquip->ZoneEquipAvail(zoneNum) == Avail::Status::CycleOn || + state.dataZoneEquip->ZoneEquipAvail(zoneNum) == Avail::Status::CycleOnZoneFansOnly) && + state.afn->AirflowNetworkZoneFlag(zoneNum)) { + ADSCorrectionFactor = 0.0; + } + } - if (state.afn->simulation_control.type == AirflowNetwork::ControlType::MultizoneWithDistributionOnlyDuringFanOperation) { - // CR7608 IF (TurnFansOn .AND. AirflowNetworkZoneFlag(ZoneLoop)) ADSCorrectionFactor=0 - if ((state.dataZoneEquip->ZoneEquipAvail(ZoneLoop) == Avail::Status::CycleOn || - state.dataZoneEquip->ZoneEquipAvail(ZoneLoop) == Avail::Status::CycleOnZoneFansOnly) && - state.afn->AirflowNetworkZoneFlag(ZoneLoop)) - ADSCorrectionFactor = 0.0; + szAirRpt.ExhTotalLoss = 0; + szAirRpt.ExhSensiLoss = 0; + + for (int FanNum = 1; FanNum <= (int)state.dataFans->fans.size(); ++FanNum) { + auto const *thisFan = state.dataFans->fans(FanNum); + // Add reportable vars + if (thisFan->type == HVAC::FanType::Exhaust) { + for (int ExhNum = 1; ExhNum <= szEquipConfig.NumExhaustNodes; ExhNum++) { + if (thisFan->inletNodeNum == szEquipConfig.ExhaustNode(ExhNum)) { + szAirRpt.ExhTotalLoss += + thisFan->outletAirMassFlowRate * (thisFan->outletAirEnthalpy - state.dataEnvrn->OutEnthalpy) * ADSCorrectionFactor; + szAirRpt.ExhSensiLoss += thisFan->outletAirMassFlowRate * CpAir * (thisFan->outletAirTemp - outDB) * ADSCorrectionFactor; + break; + } + } } + } - if (thisZoneHB.MAT > zone.OutDryBulbTemp) { + szAirRpt.ExhLatentLoss = szAirRpt.ExhTotalLoss - szAirRpt.ExhSensiLoss; +} +void reportAirHeatBal2(EnergyPlusData &state, + DataHeatBalance::AirReportVars &szAirRpt, + DataZoneEquipment::EquipConfiguration const &szEquipConfig, + ZoneTempPredictorCorrector::ZoneSpaceHeatBalanceData const &szHeatBal, + int const zoneNum, + int const spaceNum) +{ + static constexpr std::string_view RoutineName = "reportAirHeatBal2"; - znAirRpt.InfilHeatLoss = thisZoneHB.MCPI * (thisZoneHB.MAT - zone.OutDryBulbTemp) * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.InfilHeatGain = 0.0; + // Break the infiltration load into heat gain and loss components + Real64 ADSCorrectionFactor = 1.0; - } else { + if (state.afn->simulation_control.type == AirflowNetwork::ControlType::MultizoneWithDistributionOnlyDuringFanOperation) { + // CR7608 IF (TurnFansOn .AND. AirflowNetworkZoneFlag(zoneNum)) ADSCorrectionFactor=0 + if ((state.dataZoneEquip->ZoneEquipAvail(zoneNum) == Avail::Status::CycleOn || + state.dataZoneEquip->ZoneEquipAvail(zoneNum) == Avail::Status::CycleOnZoneFansOnly) && + state.afn->AirflowNetworkZoneFlag(zoneNum)) + ADSCorrectionFactor = 0.0; + } - znAirRpt.InfilHeatGain = thisZoneHB.MCPI * (zone.OutDryBulbTemp - thisZoneHB.MAT) * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.InfilHeatLoss = 0.0; - } - // Report infiltration latent gains and losses - CpAir = Psychrometrics::PsyCpAirFnW(state.dataEnvrn->OutHumRat); - H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(thisZoneHB.airHumRat, thisZoneHB.MAT); - if (thisZoneHB.airHumRat > state.dataEnvrn->OutHumRat) { + Real64 const outDryBulb = state.dataHeatBal->Zone(zoneNum).OutDryBulbTemp; + if (szHeatBal.MAT > outDryBulb) { - znAirRpt.InfilLatentLoss = - thisZoneHB.MCPI / CpAir * (thisZoneHB.airHumRat - state.dataEnvrn->OutHumRat) * H2OHtOfVap * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.InfilLatentGain = 0.0; + szAirRpt.InfilHeatLoss = szHeatBal.MCPI * (szHeatBal.MAT - outDryBulb) * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.InfilHeatGain = 0.0; - } else { + } else { - znAirRpt.InfilLatentGain = - thisZoneHB.MCPI / CpAir * (state.dataEnvrn->OutHumRat - thisZoneHB.airHumRat) * H2OHtOfVap * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.InfilLatentLoss = 0.0; - } - // Total infiltration losses and gains - TotalLoad = znAirRpt.InfilHeatGain + znAirRpt.InfilLatentGain - znAirRpt.InfilHeatLoss - znAirRpt.InfilLatentLoss; - if (TotalLoad > 0) { - znAirRpt.InfilTotalGain = TotalLoad * ADSCorrectionFactor; - znAirRpt.InfilTotalLoss = 0.0; - } else { - znAirRpt.InfilTotalGain = 0.0; - znAirRpt.InfilTotalLoss = -TotalLoad * ADSCorrectionFactor; - } + szAirRpt.InfilHeatGain = szHeatBal.MCPI * (outDryBulb - szHeatBal.MAT) * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.InfilHeatLoss = 0.0; + } + // Report infiltration latent gains and losses + Real64 CpAir = Psychrometrics::PsyCpAirFnW(state.dataEnvrn->OutHumRat); // Heat capacity of air (J/kg-C) + Real64 H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(szHeatBal.airHumRat, szHeatBal.MAT); // Heat of vaporization of air + if (szHeatBal.airHumRat > state.dataEnvrn->OutHumRat) { - // first calculate mass flows using outside air heat capacity for consistency with input to heat balance - znAirRpt.InfilMdot = (thisZoneHB.MCPI / CpAir) * ADSCorrectionFactor; - znAirRpt.InfilMass = znAirRpt.InfilMdot * TimeStepSysSec; - znAirRpt.VentilMdot = (thisZoneHB.MCPV / CpAir) * ADSCorrectionFactor; - znAirRpt.VentilMass = znAirRpt.VentilMdot * TimeStepSysSec; + szAirRpt.InfilLatentLoss = szHeatBal.MCPI / CpAir * (szHeatBal.airHumRat - state.dataEnvrn->OutHumRat) * H2OHtOfVap * + state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.InfilLatentGain = 0.0; - // CR7751 second, calculate using indoor conditions for density property - AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, thisZoneHB.MAT, thisZoneHB.airHumRatAvg, RoutineName3); - znAirRpt.InfilVdotCurDensity = znAirRpt.InfilMdot / AirDensity; - znAirRpt.InfilVolumeCurDensity = znAirRpt.InfilVdotCurDensity * TimeStepSysSec; - znAirRpt.InfilAirChangeRate = znAirRpt.InfilVolumeCurDensity / (TimeStepSys * zone.Volume); - znAirRpt.VentilVdotCurDensity = znAirRpt.VentilMdot / AirDensity; - znAirRpt.VentilVolumeCurDensity = znAirRpt.VentilVdotCurDensity * TimeStepSysSec; - znAirRpt.VentilAirChangeRate = znAirRpt.VentilVolumeCurDensity / (TimeStepSys * zone.Volume); + } else { - // CR7751 third, calculate using standard dry air at nominal elevation - AirDensity = state.dataEnvrn->StdRhoAir; - znAirRpt.InfilVdotStdDensity = znAirRpt.InfilMdot / AirDensity; - znAirRpt.InfilVolumeStdDensity = znAirRpt.InfilVdotStdDensity * TimeStepSysSec; - znAirRpt.VentilVdotStdDensity = znAirRpt.VentilMdot / AirDensity; - znAirRpt.VentilVolumeStdDensity = znAirRpt.VentilVdotStdDensity * TimeStepSysSec; - - // znAirRpt%VentilFanElec = 0.0 - znAirRpt.VentilAirTemp = 0.0; - znAirRpt.VentilHeatLoss = 0.0; - znAirRpt.VentilHeatGain = 0.0; - int VentZoneNum = 0; // Number of ventilation object per zone - Real64 VentZoneMassflow = 0.0; // Total mass flow rate per zone - Real64 VentZoneAirTemp = 0.0; // Average Zone inlet temperature - - for (int VentNum = 1; VentNum <= state.dataHeatBal->TotVentilation; ++VentNum) { - auto const &ventilation = state.dataHeatBal->Ventilation(VentNum); - if (ventilation.ZonePtr == ZoneLoop) { - if (ADSCorrectionFactor > 0) { - znAirRpt.VentilAirTemp += ventilation.AirTemp * ventilation.MCP; - VentZoneMassflow += ventilation.MCP; - VentZoneAirTemp += ventilation.AirTemp; - } else { - znAirRpt.VentilAirTemp = zone.OutDryBulbTemp; - } - // Break the ventilation load into heat gain and loss components - if (thisZoneHB.MAT > ventilation.AirTemp) { - znAirRpt.VentilHeatLoss += ventilation.MCP * (thisZoneHB.MAT - ventilation.AirTemp) * TimeStepSysSec * ADSCorrectionFactor; - } else { - znAirRpt.VentilHeatGain += ventilation.MCP * (ventilation.AirTemp - thisZoneHB.MAT) * TimeStepSysSec * ADSCorrectionFactor; - } + szAirRpt.InfilLatentGain = szHeatBal.MCPI / CpAir * (state.dataEnvrn->OutHumRat - szHeatBal.airHumRat) * H2OHtOfVap * + state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.InfilLatentLoss = 0.0; + } + // Total infiltration losses and gains + Real64 TotalLoad = szAirRpt.InfilHeatGain + szAirRpt.InfilLatentGain - szAirRpt.InfilHeatLoss - szAirRpt.InfilLatentLoss; + if (TotalLoad > 0) { + szAirRpt.InfilTotalGain = TotalLoad * ADSCorrectionFactor; + szAirRpt.InfilTotalLoss = 0.0; + } else { + szAirRpt.InfilTotalGain = 0.0; + szAirRpt.InfilTotalLoss = -TotalLoad * ADSCorrectionFactor; + } - ++VentZoneNum; - if (VentZoneNum > 1) continue; + // first calculate mass flows using outside air heat capacity for consistency with input to heat balance + szAirRpt.InfilMdot = (szHeatBal.MCPI / CpAir) * ADSCorrectionFactor; + szAirRpt.InfilMass = szAirRpt.InfilMdot * state.dataHVACGlobal->TimeStepSysSec; + szAirRpt.VentilMdot = (szHeatBal.MCPV / CpAir) * ADSCorrectionFactor; + szAirRpt.VentilMass = szAirRpt.VentilMdot * state.dataHVACGlobal->TimeStepSysSec; + + // CR7751 second, calculate using indoor conditions for density property + Real64 szVolume = (spaceNum == 0) ? state.dataHeatBal->Zone(zoneNum).Volume : state.dataHeatBal->space(spaceNum).Volume; + Real64 AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, szHeatBal.MAT, szHeatBal.airHumRatAvg, RoutineName); + szAirRpt.InfilVdotCurDensity = szAirRpt.InfilMdot / AirDensity; + szAirRpt.InfilVolumeCurDensity = szAirRpt.InfilVdotCurDensity * state.dataHVACGlobal->TimeStepSysSec; + if (szVolume > 0.0) { + szAirRpt.InfilAirChangeRate = szAirRpt.InfilVolumeCurDensity / (state.dataHVACGlobal->TimeStepSys * szVolume); + } else { + szAirRpt.InfilAirChangeRate = 0.0; + } + szAirRpt.VentilVdotCurDensity = szAirRpt.VentilMdot / AirDensity; + szAirRpt.VentilVolumeCurDensity = szAirRpt.VentilVdotCurDensity * state.dataHVACGlobal->TimeStepSysSec; + if (szVolume > 0.0) { + szAirRpt.VentilAirChangeRate = szAirRpt.VentilVolumeCurDensity / (state.dataHVACGlobal->TimeStepSys * szVolume); + } else { + szAirRpt.VentilAirChangeRate = 0.0; + } - // Report ventilation latent gains and losses - H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(thisZoneHB.airHumRat, thisZoneHB.MAT); - if (thisZoneHB.airHumRat > state.dataEnvrn->OutHumRat) { - znAirRpt.VentilLatentLoss = - znAirRpt.VentilMdot * (thisZoneHB.airHumRat - state.dataEnvrn->OutHumRat) * H2OHtOfVap * TimeStepSysSec; - znAirRpt.VentilLatentGain = 0.0; - } else { - znAirRpt.VentilLatentGain = - znAirRpt.VentilMdot * (state.dataEnvrn->OutHumRat - thisZoneHB.airHumRat) * H2OHtOfVap * TimeStepSysSec; - znAirRpt.VentilLatentLoss = 0.0; - } - // Total ventilation losses and gains - TotalLoad = znAirRpt.VentilHeatGain + znAirRpt.VentilLatentGain - znAirRpt.VentilHeatLoss - znAirRpt.VentilLatentLoss; - if (TotalLoad > 0) { - znAirRpt.VentilTotalGain = TotalLoad * ADSCorrectionFactor; - znAirRpt.VentilTotalLoss = 0.0; - } else { - znAirRpt.VentilTotalGain = 0.0; - znAirRpt.VentilTotalLoss = -TotalLoad * ADSCorrectionFactor; - } + // CR7751 third, calculate using standard dry air at nominal elevation + AirDensity = state.dataEnvrn->StdRhoAir; + szAirRpt.InfilVdotStdDensity = szAirRpt.InfilMdot / AirDensity; + szAirRpt.InfilVolumeStdDensity = szAirRpt.InfilVdotStdDensity * state.dataHVACGlobal->TimeStepSysSec; + szAirRpt.VentilVdotStdDensity = szAirRpt.VentilMdot / AirDensity; + szAirRpt.VentilVolumeStdDensity = szAirRpt.VentilVdotStdDensity * state.dataHVACGlobal->TimeStepSysSec; + + // szAirRpt%VentilFanElec = 0.0 + szAirRpt.VentilAirTemp = 0.0; + szAirRpt.VentilHeatLoss = 0.0; + szAirRpt.VentilHeatGain = 0.0; + int ventCount = 0; // Number of ventilation object per zone or space + Real64 VentZoneMassflow = 0.0; // Total mass flow rate per zone + Real64 VentZoneAirTemp = 0.0; // Average Zone inlet temperature + + for (int VentNum = 1; VentNum <= state.dataHeatBal->TotVentilation; ++VentNum) { + auto const &ventilation = state.dataHeatBal->Ventilation(VentNum); + if (((spaceNum == 0) && (ventilation.ZonePtr == zoneNum)) || (spaceNum == ventilation.spaceIndex)) { + if (ADSCorrectionFactor > 0) { + szAirRpt.VentilAirTemp += ventilation.AirTemp * ventilation.MCP; + VentZoneMassflow += ventilation.MCP; + VentZoneAirTemp += ventilation.AirTemp; + } else { + szAirRpt.VentilAirTemp = outDryBulb; } - } - - if (ADSCorrectionFactor > 0 && VentZoneNum > 1 && VentZoneMassflow > 0.0) { - znAirRpt.VentilAirTemp /= VentZoneMassflow; - } else if (ADSCorrectionFactor > 0 && VentZoneNum == 1) { - znAirRpt.VentilAirTemp = VentZoneAirTemp; - } else { // Just in case - znAirRpt.VentilAirTemp = zone.OutDryBulbTemp; - } - - // Report mixing sensible and latent loads - mixSenLoad = 0.0; // Initialize arrays to zero before starting to sum - mixLatLoad = 0.0; - znAirRpt.MixVolume = 0.0; // zero reported volume prior to summations below - znAirRpt.MixVdotCurDensity = 0.0; // zero reported volume flow rate prior to summations below - znAirRpt.MixVdotStdDensity = 0.0; // zero reported volume flow rate prior to summations below - znAirRpt.MixMass = 0.0; // ! zero reported mass prior to summations below - znAirRpt.MixMdot = 0.0; // ! zero reported mass flow rate prior to summations below - // MixingLoad = 0.0d0 - - for (int MixNum = 1; MixNum <= state.dataHeatBal->TotMixing; ++MixNum) { - auto &mixing = state.dataHeatBal->Mixing(MixNum); - if ((mixing.ZonePtr == ZoneLoop) && mixing.ReportFlag) { - auto const &fromZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(mixing.FromZone); - // MixSenLoad(ZoneLoop) = MixSenLoad(ZoneLoop)+MCPM(ZoneLoop)*MAT(mixing%FromZone) - // H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(ZoneAirHumRat(ZoneLoop), MAT(ZoneLoop)) - // Per Jan 17, 2008 conference call, agreed to use average conditions for Rho, Cp and Hfg - // and to recalculate the report variable using end of time step temps and humrats - AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, - state.dataEnvrn->OutBaroPress, - (thisZoneHB.MAT + fromZoneHB.MAT) / 2.0, - (thisZoneHB.airHumRat + fromZoneHB.airHumRat) / 2.0, - std::string()); - CpAir = Psychrometrics::PsyCpAirFnW((thisZoneHB.airHumRat + fromZoneHB.airHumRat) / 2.0); - znAirRpt.MixVolume += mixing.DesiredAirFlowRate * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.MixVdotCurDensity += mixing.DesiredAirFlowRate * ADSCorrectionFactor; - znAirRpt.MixMass += mixing.DesiredAirFlowRate * AirDensity * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.MixMdot += mixing.DesiredAirFlowRate * AirDensity * ADSCorrectionFactor; - znAirRpt.MixVdotStdDensity += mixing.DesiredAirFlowRate * (AirDensity / state.dataEnvrn->StdRhoAir) * ADSCorrectionFactor; - mixSenLoad += mixing.DesiredAirFlowRate * AirDensity * CpAir * (thisZoneHB.MAT - fromZoneHB.MAT); - H2OHtOfVap = - Psychrometrics::PsyHgAirFnWTdb((thisZoneHB.airHumRat + fromZoneHB.airHumRat) / 2.0, (thisZoneHB.MAT + fromZoneHB.MAT) / 2.0); - // MixLatLoad(ZoneLoop) = MixLatLoad(ZoneLoop)+MixingMassFlowzone*(ZoneAirHumRat(ZoneLoop)- & - // ZoneAirHumRat(mixing%FromZone))*H2OHtOfVap - mixLatLoad += mixing.DesiredAirFlowRate * AirDensity * (thisZoneHB.airHumRat - fromZoneHB.airHumRat) * H2OHtOfVap; + // Break the ventilation load into heat gain and loss components + if (szHeatBal.MAT > ventilation.AirTemp) { + szAirRpt.VentilHeatLoss += + ventilation.MCP * (szHeatBal.MAT - ventilation.AirTemp) * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + } else { + szAirRpt.VentilHeatGain += + ventilation.MCP * (ventilation.AirTemp - szHeatBal.MAT) * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; } - } - for (int MixNum = 1; MixNum <= state.dataHeatBal->TotCrossMixing; ++MixNum) { - auto &crossMixing = state.dataHeatBal->CrossMixing(MixNum); - if ((crossMixing.ZonePtr == ZoneLoop) && crossMixing.ReportFlag) { - auto const &fromZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(crossMixing.FromZone); - // MixSenLoad(ZoneLoop) = MixSenLoad(ZoneLoop)+MCPM(ZoneLoop)*MAT(crossMixing%FromZone) - // Per Jan 17, 2008 conference call, agreed to use average conditions for Rho, Cp and Hfg - // and to recalculate the report variable using end of time step temps and humrats - AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, - state.dataEnvrn->OutBaroPress, - (thisZoneHB.MAT + fromZoneHB.MAT) / 2.0, - (thisZoneHB.airHumRat + fromZoneHB.airHumRat) / 2.0, - std::string()); - CpAir = Psychrometrics::PsyCpAirFnW((thisZoneHB.airHumRat + fromZoneHB.airHumRat) / 2.0); - znAirRpt.MixVolume += crossMixing.DesiredAirFlowRate * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.MixVdotCurDensity += crossMixing.DesiredAirFlowRate * ADSCorrectionFactor; - znAirRpt.MixMass += crossMixing.DesiredAirFlowRate * AirDensity * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.MixMdot += crossMixing.DesiredAirFlowRate * AirDensity * ADSCorrectionFactor; - znAirRpt.MixVdotStdDensity += crossMixing.DesiredAirFlowRate * (AirDensity / state.dataEnvrn->StdRhoAir) * ADSCorrectionFactor; - mixSenLoad += crossMixing.DesiredAirFlowRate * AirDensity * CpAir * (thisZoneHB.MAT - fromZoneHB.MAT); - H2OHtOfVap = - Psychrometrics::PsyHgAirFnWTdb((thisZoneHB.airHumRat + fromZoneHB.airHumRat) / 2.0, (thisZoneHB.MAT + fromZoneHB.MAT) / 2.0); - // MixLatLoad(ZoneLoop) = MixLatLoad(ZoneLoop)+MixingMassFlowzone*(ZoneAirHumRat(ZoneLoop)- & - // ZoneAirHumRat(crossMixing%FromZone))*H2OHtOfVap - mixLatLoad += crossMixing.DesiredAirFlowRate * AirDensity * (thisZoneHB.airHumRat - fromZoneHB.airHumRat) * H2OHtOfVap; + ++ventCount; + if (ventCount > 1) continue; + + // Report ventilation latent gains and losses + H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(szHeatBal.airHumRat, szHeatBal.MAT); + if (szHeatBal.airHumRat > state.dataEnvrn->OutHumRat) { + szAirRpt.VentilLatentLoss = + szAirRpt.VentilMdot * (szHeatBal.airHumRat - state.dataEnvrn->OutHumRat) * H2OHtOfVap * state.dataHVACGlobal->TimeStepSysSec; + szAirRpt.VentilLatentGain = 0.0; + } else { + szAirRpt.VentilLatentGain = + szAirRpt.VentilMdot * (state.dataEnvrn->OutHumRat - szHeatBal.airHumRat) * H2OHtOfVap * state.dataHVACGlobal->TimeStepSysSec; + szAirRpt.VentilLatentLoss = 0.0; } - if ((crossMixing.FromZone == ZoneLoop) && crossMixing.ReportFlag) { - auto const &mixingZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(crossMixing.ZonePtr); - AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, - state.dataEnvrn->OutBaroPress, - (thisZoneHB.MAT + mixingZoneHB.MAT) / 2.0, - (thisZoneHB.airHumRat + mixingZoneHB.airHumRat) / 2.0, - std::string()); - CpAir = Psychrometrics::PsyCpAirFnW((thisZoneHB.airHumRat + mixingZoneHB.airHumRat) / 2.0); - znAirRpt.MixVolume += crossMixing.DesiredAirFlowRate * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.MixVdotCurDensity += crossMixing.DesiredAirFlowRate * ADSCorrectionFactor; - znAirRpt.MixMass += crossMixing.DesiredAirFlowRate * AirDensity * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.MixMdot += crossMixing.DesiredAirFlowRate * AirDensity * ADSCorrectionFactor; - znAirRpt.MixVdotStdDensity += crossMixing.DesiredAirFlowRate * (AirDensity / state.dataEnvrn->StdRhoAir) * ADSCorrectionFactor; - mixSenLoad += crossMixing.DesiredAirFlowRate * AirDensity * CpAir * (thisZoneHB.MAT - mixingZoneHB.MAT); - H2OHtOfVap = - Psychrometrics::PsyHgAirFnWTdb((thisZoneHB.airHumRat + mixingZoneHB.airHumRat) / 2.0, (thisZoneHB.MAT + mixingZoneHB.MAT) / 2.0); - mixLatLoad += crossMixing.DesiredAirFlowRate * AirDensity * (thisZoneHB.airHumRat - mixingZoneHB.airHumRat) * H2OHtOfVap; + // Total ventilation losses and gains + TotalLoad = szAirRpt.VentilHeatGain + szAirRpt.VentilLatentGain - szAirRpt.VentilHeatLoss - szAirRpt.VentilLatentLoss; + if (TotalLoad > 0) { + szAirRpt.VentilTotalGain = TotalLoad * ADSCorrectionFactor; + szAirRpt.VentilTotalLoss = 0.0; + } else { + szAirRpt.VentilTotalGain = 0.0; + szAirRpt.VentilTotalLoss = -TotalLoad * ADSCorrectionFactor; } } + } - if (state.dataHeatBal->TotRefDoorMixing > 0) { - // IF(ZoneLoop .NE. NumOfZones)THEN !Refrigeration Door Mixing - // Note - do each Pair a Single time, so must do increment reports for both zones - // Can't have a pair that has ZoneA zone number = NumOfZones because organized - // in input with lowest zone # first no matter how input in idf - auto &refDoorMixing = state.dataHeatBal->RefDoorMixing(ZoneLoop); - if (refDoorMixing.RefDoorMixFlag) { // .TRUE. for both zoneA and zoneB - if (refDoorMixing.ZonePtr == ZoneLoop) { - for (int j = 1; j <= refDoorMixing.NumRefDoorConnections; ++j) { - // Capture impact when zoneloop is the 'primary zone' - // that is, the zone of a pair with the lower zone number - if (refDoorMixing.VolRefDoorFlowRate(j) > 0.0) { - int ZoneB = refDoorMixing.MateZonePtr(j); - auto const &zoneBHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneB); - AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, - state.dataEnvrn->OutBaroPress, - (thisZoneHB.MAT + zoneBHB.MAT) / 2.0, - (thisZoneHB.airHumRat + zoneBHB.airHumRat) / 2.0, - std::string()); - CpAir = Psychrometrics::PsyCpAirFnW((thisZoneHB.airHumRat + zoneBHB.airHumRat) / 2.0); - H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb((thisZoneHB.airHumRat + zoneBHB.airHumRat) / 2.0, - (thisZoneHB.MAT + zoneBHB.MAT) / 2.0); - znAirRpt.MixVolume += refDoorMixing.VolRefDoorFlowRate(j) * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.MixVdotCurDensity += refDoorMixing.VolRefDoorFlowRate(j) * ADSCorrectionFactor; - znAirRpt.MixMass += refDoorMixing.VolRefDoorFlowRate(j) * AirDensity * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.MixMdot += refDoorMixing.VolRefDoorFlowRate(j) * AirDensity * ADSCorrectionFactor; - znAirRpt.MixVdotStdDensity += - refDoorMixing.VolRefDoorFlowRate(j) * (AirDensity / state.dataEnvrn->StdRhoAir) * ADSCorrectionFactor; - mixSenLoad += refDoorMixing.VolRefDoorFlowRate(j) * AirDensity * CpAir * (thisZoneHB.MAT - zoneBHB.MAT); - mixLatLoad += refDoorMixing.VolRefDoorFlowRate(j) * AirDensity * (thisZoneHB.airHumRat - zoneBHB.airHumRat) * H2OHtOfVap; - } // flow > 0 - } // J-1, numref connections - } // zone A (zoneptr = zoneloop) - for (int ZoneA = 1; ZoneA <= (ZoneLoop - 1); ++ZoneA) { - auto &refDoorMixingA = state.dataHeatBal->RefDoorMixing(ZoneA); - auto const &zoneAHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneA); - // Capture impact when zoneloop is the 'mating zone' - // that is, the zone of a pair with the higher zone number(matezoneptr = zoneloop) - if (refDoorMixingA.RefDoorMixFlag) { - for (int j = 1; j <= refDoorMixingA.NumRefDoorConnections; ++j) { - if (refDoorMixingA.MateZonePtr(j) == ZoneLoop) { - if (refDoorMixingA.VolRefDoorFlowRate(j) > 0.0) { - AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, - state.dataEnvrn->OutBaroPress, - (thisZoneHB.MAT + zoneAHB.MAT) / 2.0, - (thisZoneHB.airHumRat + zoneAHB.airHumRat) / 2.0, - std::string()); - CpAir = Psychrometrics::PsyCpAirFnW((thisZoneHB.airHumRat + zoneAHB.airHumRat) / 2.0); - H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb((thisZoneHB.airHumRat + zoneAHB.airHumRat) / 2.0, - (thisZoneHB.MAT + zoneAHB.MAT) / 2.0); - znAirRpt.MixVolume += refDoorMixingA.VolRefDoorFlowRate(j) * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.MixVdotCurDensity += refDoorMixingA.VolRefDoorFlowRate(j) * ADSCorrectionFactor; - znAirRpt.MixMass += refDoorMixingA.VolRefDoorFlowRate(j) * AirDensity * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.MixMdot += refDoorMixingA.VolRefDoorFlowRate(j) * AirDensity * ADSCorrectionFactor; - znAirRpt.MixVdotStdDensity += - refDoorMixingA.VolRefDoorFlowRate(j) * (AirDensity / state.dataEnvrn->StdRhoAir) * ADSCorrectionFactor; - mixSenLoad += refDoorMixingA.VolRefDoorFlowRate(j) * AirDensity * CpAir * (thisZoneHB.MAT - zoneAHB.MAT); - mixLatLoad += - refDoorMixingA.VolRefDoorFlowRate(j) * AirDensity * (thisZoneHB.airHumRat - zoneAHB.airHumRat) * H2OHtOfVap; - } // volflowrate > 0 - } // matezoneptr (zoneB) = Zonelooop - } // NumRefDoorConnections - } // Refdoormix flag on ZoneA - } // zone A from 1 to (zoneloop - 1) - } // Refdoormix flag on zoneloop - } //(TotRefDoorMixing .GT. 0) - // end refrigeration door mixing reports - - // MixingLoad(ZoneLoop) = MCPM(ZoneLoop)*MAT(ZoneLoop) - MixSenLoad(ZoneLoop) - if (mixSenLoad > 0.0) { - znAirRpt.MixHeatLoss = mixSenLoad * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.MixHeatGain = 0.0; - } else { - znAirRpt.MixHeatLoss = 0.0; - znAirRpt.MixHeatGain = -mixSenLoad * TimeStepSysSec * ADSCorrectionFactor; + if (ADSCorrectionFactor > 0 && ventCount > 1 && VentZoneMassflow > 0.0) { + szAirRpt.VentilAirTemp /= VentZoneMassflow; + } else if (ADSCorrectionFactor > 0 && ventCount == 1) { + szAirRpt.VentilAirTemp = VentZoneAirTemp; + } else { // Just in case + szAirRpt.VentilAirTemp = outDryBulb; + } + + // Report mixing sensible and latent loads + szAirRpt.MixSenLoad = 0.0; // Initialize arrays to zero before starting to sum + szAirRpt.MixLatLoad = 0.0; + szAirRpt.MixVolume = 0.0; // zero reported volume prior to summations below + szAirRpt.MixVdotCurDensity = 0.0; // zero reported volume flow rate prior to summations below + szAirRpt.MixVdotStdDensity = 0.0; // zero reported volume flow rate prior to summations below + szAirRpt.MixMass = 0.0; // ! zero reported mass prior to summations below + szAirRpt.MixMdot = 0.0; // ! zero reported mass flow rate prior to summations below + // MixingLoad = 0.0d0 + + for (int MixNum = 1; MixNum <= state.dataHeatBal->TotMixing; ++MixNum) { + auto &mixing = state.dataHeatBal->Mixing(MixNum); + if ((((spaceNum == 0) && (mixing.ZonePtr == zoneNum)) || (spaceNum == mixing.spaceIndex)) && mixing.ReportFlag) { + Real64 const fromMAT = (mixing.fromSpaceIndex == 0) ? state.dataZoneTempPredictorCorrector->zoneHeatBalance(mixing.FromZone).MAT + : state.dataZoneTempPredictorCorrector->spaceHeatBalance(mixing.fromSpaceIndex).MAT; + Real64 const fromHumRat = (mixing.fromSpaceIndex == 0) + ? state.dataZoneTempPredictorCorrector->zoneHeatBalance(mixing.FromZone).airHumRat + : state.dataZoneTempPredictorCorrector->spaceHeatBalance(mixing.fromSpaceIndex).airHumRat; + // szAirRpt.MixSenLoad(zoneNum) = szAirRpt.MixSenLoad(zoneNum)+MCPM(zoneNum)*MAT(mixing%FromZone) + // H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(ZoneAirHumRat(zoneNum), MAT(zoneNum)) + // Per Jan 17, 2008 conference call, agreed to use average conditions for Rho, Cp and Hfg + // and to recalculate the report variable using end of time step temps and humrats + AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW( + state, state.dataEnvrn->OutBaroPress, (szHeatBal.MAT + fromMAT) / 2.0, (szHeatBal.airHumRat + fromHumRat) / 2.0, std::string()); + CpAir = Psychrometrics::PsyCpAirFnW((szHeatBal.airHumRat + fromHumRat) / 2.0); + szAirRpt.MixVolume += mixing.DesiredAirFlowRate * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.MixVdotCurDensity += mixing.DesiredAirFlowRate * ADSCorrectionFactor; + szAirRpt.MixMass += mixing.DesiredAirFlowRate * AirDensity * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.MixMdot += mixing.DesiredAirFlowRate * AirDensity * ADSCorrectionFactor; + szAirRpt.MixVdotStdDensity += mixing.DesiredAirFlowRate * (AirDensity / state.dataEnvrn->StdRhoAir) * ADSCorrectionFactor; + szAirRpt.MixSenLoad += mixing.DesiredAirFlowRate * AirDensity * CpAir * (szHeatBal.MAT - fromMAT); + H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb((szHeatBal.airHumRat + fromHumRat) / 2.0, (szHeatBal.MAT + fromMAT) / 2.0); + // szAirRpt.MixLatLoad(zoneNum) = szAirRpt.MixLatLoad(zoneNum)+MixingMassFlowzone*(ZoneAirHumRat(zoneNum)- & + // ZoneAirHumRat(mixing%FromZone))*H2OHtOfVap + szAirRpt.MixLatLoad += mixing.DesiredAirFlowRate * AirDensity * (szHeatBal.airHumRat - fromHumRat) * H2OHtOfVap; } - // Report mixing latent loads - // MixingLoad(ZoneLoop) = MixLatLoad(ZoneLoop) - if (mixLatLoad > 0.0) { - znAirRpt.MixLatentLoss = mixLatLoad * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.MixLatentGain = 0.0; - } else { - znAirRpt.MixLatentLoss = 0.0; - znAirRpt.MixLatentGain = -mixLatLoad * TimeStepSysSec * ADSCorrectionFactor; + } + + for (int MixNum = 1; MixNum <= state.dataHeatBal->TotCrossMixing; ++MixNum) { + auto &crossMixing = state.dataHeatBal->CrossMixing(MixNum); + if ((((spaceNum == 0) && (crossMixing.ZonePtr == zoneNum)) || (spaceNum == crossMixing.spaceIndex)) && crossMixing.ReportFlag) { + Real64 const fromMAT = (crossMixing.fromSpaceIndex == 0) + ? state.dataZoneTempPredictorCorrector->zoneHeatBalance(crossMixing.FromZone).MAT + : state.dataZoneTempPredictorCorrector->spaceHeatBalance(crossMixing.fromSpaceIndex).MAT; + Real64 const fromHumRat = (crossMixing.fromSpaceIndex == 0) + ? state.dataZoneTempPredictorCorrector->zoneHeatBalance(crossMixing.FromZone).airHumRat + : state.dataZoneTempPredictorCorrector->spaceHeatBalance(crossMixing.fromSpaceIndex).airHumRat; + // szAirRpt.MixSenLoad(zoneNum) = szAirRpt.MixSenLoad(zoneNum)+MCPM(zoneNum)*MAT(crossMixing%FromZone) + // Per Jan 17, 2008 conference call, agreed to use average conditions for Rho, Cp and Hfg + // and to recalculate the report variable using end of time step temps and humrats + AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW( + state, state.dataEnvrn->OutBaroPress, (szHeatBal.MAT + fromMAT) / 2.0, (szHeatBal.airHumRat + fromHumRat) / 2.0, std::string()); + CpAir = Psychrometrics::PsyCpAirFnW((szHeatBal.airHumRat + fromHumRat) / 2.0); + szAirRpt.MixVolume += crossMixing.DesiredAirFlowRate * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.MixVdotCurDensity += crossMixing.DesiredAirFlowRate * ADSCorrectionFactor; + szAirRpt.MixMass += crossMixing.DesiredAirFlowRate * AirDensity * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.MixMdot += crossMixing.DesiredAirFlowRate * AirDensity * ADSCorrectionFactor; + szAirRpt.MixVdotStdDensity += crossMixing.DesiredAirFlowRate * (AirDensity / state.dataEnvrn->StdRhoAir) * ADSCorrectionFactor; + szAirRpt.MixSenLoad += crossMixing.DesiredAirFlowRate * AirDensity * CpAir * (szHeatBal.MAT - fromMAT); + H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb((szHeatBal.airHumRat + fromHumRat) / 2.0, (szHeatBal.MAT + fromMAT) / 2.0); + // szAirRpt.MixLatLoad(zoneNum) = szAirRpt.MixLatLoad(zoneNum)+MixingMassFlowzone*(ZoneAirHumRat(zoneNum)- & + // ZoneAirHumRat(crossMixing%FromZone))*H2OHtOfVap + szAirRpt.MixLatLoad += crossMixing.DesiredAirFlowRate * AirDensity * (szHeatBal.airHumRat - fromHumRat) * H2OHtOfVap; } - // Total Mixing losses and gains - TotalLoad = znAirRpt.MixHeatGain + znAirRpt.MixLatentGain - znAirRpt.MixHeatLoss - znAirRpt.MixLatentLoss; - if (TotalLoad > 0) { - znAirRpt.MixTotalGain = TotalLoad * ADSCorrectionFactor; - znAirRpt.MixTotalLoss = 0.0; - } else { - znAirRpt.MixTotalGain = 0.0; - znAirRpt.MixTotalLoss = -TotalLoad * ADSCorrectionFactor; + if ((((spaceNum == 0) && (crossMixing.FromZone == zoneNum)) || (spaceNum == crossMixing.fromSpaceIndex)) && crossMixing.ReportFlag) { + Real64 const mixingMAT = (crossMixing.spaceIndex == 0) + ? state.dataZoneTempPredictorCorrector->zoneHeatBalance(crossMixing.ZonePtr).MAT + : state.dataZoneTempPredictorCorrector->spaceHeatBalance(crossMixing.spaceIndex).MAT; + Real64 const mixingHumRat = (crossMixing.fromSpaceIndex == 0) + ? state.dataZoneTempPredictorCorrector->zoneHeatBalance(crossMixing.ZonePtr).airHumRat + : state.dataZoneTempPredictorCorrector->spaceHeatBalance(crossMixing.spaceIndex).airHumRat; + AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW( + state, state.dataEnvrn->OutBaroPress, (szHeatBal.MAT + mixingMAT) / 2.0, (szHeatBal.airHumRat + mixingHumRat) / 2.0, std::string()); + CpAir = Psychrometrics::PsyCpAirFnW((szHeatBal.airHumRat + mixingHumRat) / 2.0); + szAirRpt.MixVolume += crossMixing.DesiredAirFlowRate * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.MixVdotCurDensity += crossMixing.DesiredAirFlowRate * ADSCorrectionFactor; + szAirRpt.MixMass += crossMixing.DesiredAirFlowRate * AirDensity * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.MixMdot += crossMixing.DesiredAirFlowRate * AirDensity * ADSCorrectionFactor; + szAirRpt.MixVdotStdDensity += crossMixing.DesiredAirFlowRate * (AirDensity / state.dataEnvrn->StdRhoAir) * ADSCorrectionFactor; + szAirRpt.MixSenLoad += crossMixing.DesiredAirFlowRate * AirDensity * CpAir * (szHeatBal.MAT - mixingMAT); + H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb((szHeatBal.airHumRat + mixingHumRat) / 2.0, (szHeatBal.MAT + mixingMAT) / 2.0); + szAirRpt.MixLatLoad += crossMixing.DesiredAirFlowRate * AirDensity * (szHeatBal.airHumRat - mixingHumRat) * H2OHtOfVap; } + } - // Reporting combined outdoor air flows - for (int j = 1; j <= state.dataHeatBal->TotZoneAirBalance; ++j) { - if (state.dataHeatBal->ZoneAirBalance(j).BalanceMethod == DataHeatBalance::AirBalance::Quadrature && - ZoneLoop == state.dataHeatBal->ZoneAirBalance(j).ZonePtr) { - if (thisZoneHB.MAT > zone.OutDryBulbTemp) { - znAirRpt.OABalanceHeatLoss = thisZoneHB.MDotCPOA * (thisZoneHB.MAT - zone.OutDryBulbTemp) * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.OABalanceHeatGain = 0.0; - } else { - znAirRpt.OABalanceHeatLoss = 0.0; - znAirRpt.OABalanceHeatGain = -thisZoneHB.MDotCPOA * (thisZoneHB.MAT - zone.OutDryBulbTemp) * TimeStepSysSec * ADSCorrectionFactor; - } - H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(state.dataEnvrn->OutHumRat, zone.OutDryBulbTemp); - if (thisZoneHB.airHumRat > state.dataEnvrn->OutHumRat) { - znAirRpt.OABalanceLatentLoss = - thisZoneHB.MDotOA * (thisZoneHB.airHumRat - state.dataEnvrn->OutHumRat) * H2OHtOfVap * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.OABalanceLatentGain = 0.0; - } else { - znAirRpt.OABalanceLatentGain = - thisZoneHB.MDotOA * (state.dataEnvrn->OutHumRat - thisZoneHB.airHumRat) * H2OHtOfVap * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.OABalanceLatentLoss = 0.0; - } - // Total ventilation losses and gains - TotalLoad = znAirRpt.OABalanceHeatGain + znAirRpt.OABalanceLatentGain - znAirRpt.OABalanceHeatLoss - znAirRpt.OABalanceLatentLoss; - if (TotalLoad > 0) { - znAirRpt.OABalanceTotalGain = TotalLoad * ADSCorrectionFactor; - znAirRpt.OABalanceTotalLoss = 0.0; - } else { - znAirRpt.OABalanceTotalGain = 0.0; - znAirRpt.OABalanceTotalLoss = -TotalLoad * ADSCorrectionFactor; - } - znAirRpt.OABalanceMass = (thisZoneHB.MDotOA) * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.OABalanceMdot = (thisZoneHB.MDotOA) * ADSCorrectionFactor; - AirDensity = - Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, thisZoneHB.MAT, thisZoneHB.airHumRatAvg, std::string()); - znAirRpt.OABalanceVolumeCurDensity = (thisZoneHB.MDotOA / AirDensity) * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.OABalanceAirChangeRate = znAirRpt.OABalanceVolumeCurDensity / (TimeStepSys * zone.Volume); - znAirRpt.OABalanceVdotCurDensity = (thisZoneHB.MDotOA / AirDensity) * ADSCorrectionFactor; - AirDensity = state.dataEnvrn->StdRhoAir; - znAirRpt.OABalanceVolumeStdDensity = (thisZoneHB.MDotOA / AirDensity) * TimeStepSysSec * ADSCorrectionFactor; - znAirRpt.OABalanceVdotStdDensity = (thisZoneHB.MDotOA / AirDensity) * ADSCorrectionFactor; - znAirRpt.OABalanceFanElec = znAirRpt.VentilFanElec; - } - } - // Reports exfiltration loss - H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(state.dataEnvrn->OutHumRat, zone.OutDryBulbTemp); - znAirRpt.SysInletMass = 0; - znAirRpt.SysOutletMass = 0; - if (!zoneEquipConfig.IsControlled) { - for (int k = 1; k <= zoneEquipConfig.NumInletNodes; ++k) { - znAirRpt.SysInletMass += state.dataLoopNodes->Node(zoneEquipConfig.InletNode(k)).MassFlowRate * TimeStepSysSec * ADSCorrectionFactor; + if (state.dataHeatBal->TotRefDoorMixing > 0) { + // IF(zoneNum .NE. NumOfZones)THEN !Refrigeration Door Mixing + // Note - do each Pair a Single time, so must do increment reports for both zones + // Can't have a pair that has ZoneA zone number = NumOfZones because organized + // in input with lowest zone # first no matter how input in idf + auto &refDoorMixing = state.dataHeatBal->RefDoorMixing(zoneNum); + if (refDoorMixing.RefDoorMixFlag) { // .TRUE. for both zoneA and zoneB + if ((spaceNum == 0) && (refDoorMixing.ZonePtr == zoneNum) || (spaceNum == refDoorMixing.spaceIndex)) { + for (int j = 1; j <= refDoorMixing.NumRefDoorConnections; ++j) { + // Capture impact when zoneNum is the 'primary zone' + // that is, the zone of a pair with the lower zone number + if (refDoorMixing.VolRefDoorFlowRate(j) > 0.0) { + // int ZoneB = refDoorMixing.MateZonePtr(j); + // auto const &zoneBHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneB); + Real64 const szBMAT = (refDoorMixing.spaceIndex == 0) + ? state.dataZoneTempPredictorCorrector->zoneHeatBalance(refDoorMixing.ZonePtr).MAT + : state.dataZoneTempPredictorCorrector->spaceHeatBalance(refDoorMixing.spaceIndex).MAT; + Real64 const szBHumRat = (refDoorMixing.fromSpaceIndex == 0) + ? state.dataZoneTempPredictorCorrector->zoneHeatBalance(refDoorMixing.ZonePtr).airHumRat + : state.dataZoneTempPredictorCorrector->spaceHeatBalance(refDoorMixing.spaceIndex).airHumRat; + AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, + state.dataEnvrn->OutBaroPress, + (szHeatBal.MAT + szBMAT) / 2.0, + (szHeatBal.airHumRat + szBHumRat) / 2.0, + std::string()); + CpAir = Psychrometrics::PsyCpAirFnW((szHeatBal.airHumRat + szBHumRat) / 2.0); + H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb((szHeatBal.airHumRat + szBHumRat) / 2.0, (szHeatBal.MAT + szBMAT) / 2.0); + szAirRpt.MixVolume += refDoorMixing.VolRefDoorFlowRate(j) * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.MixVdotCurDensity += refDoorMixing.VolRefDoorFlowRate(j) * ADSCorrectionFactor; + szAirRpt.MixMass += + refDoorMixing.VolRefDoorFlowRate(j) * AirDensity * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.MixMdot += refDoorMixing.VolRefDoorFlowRate(j) * AirDensity * ADSCorrectionFactor; + szAirRpt.MixVdotStdDensity += + refDoorMixing.VolRefDoorFlowRate(j) * (AirDensity / state.dataEnvrn->StdRhoAir) * ADSCorrectionFactor; + szAirRpt.MixSenLoad += refDoorMixing.VolRefDoorFlowRate(j) * AirDensity * CpAir * (szHeatBal.MAT - szBMAT); + szAirRpt.MixLatLoad += refDoorMixing.VolRefDoorFlowRate(j) * AirDensity * (szHeatBal.airHumRat - szBHumRat) * H2OHtOfVap; + } // flow > 0 + } // J-1, numref connections + } // zone A (zoneptr = zoneNum) + for (int ZoneA = 1; ZoneA <= (zoneNum - 1); ++ZoneA) { + auto &refDoorMixingA = state.dataHeatBal->RefDoorMixing(ZoneA); + auto const &zoneAHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneA); + // Capture impact when zoneNum is the 'mating zone' + // that is, the zone of a pair with the higher zone number(matezoneptr = zoneNum) + if (refDoorMixingA.RefDoorMixFlag) { + for (int j = 1; j <= refDoorMixingA.NumRefDoorConnections; ++j) { + if (refDoorMixingA.MateZonePtr(j) == zoneNum) { + if (refDoorMixingA.VolRefDoorFlowRate(j) > 0.0) { + AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, + state.dataEnvrn->OutBaroPress, + (szHeatBal.MAT + zoneAHB.MAT) / 2.0, + (szHeatBal.airHumRat + zoneAHB.airHumRat) / 2.0, + std::string()); + CpAir = Psychrometrics::PsyCpAirFnW((szHeatBal.airHumRat + zoneAHB.airHumRat) / 2.0); + H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb((szHeatBal.airHumRat + zoneAHB.airHumRat) / 2.0, + (szHeatBal.MAT + zoneAHB.MAT) / 2.0); + szAirRpt.MixVolume += + refDoorMixingA.VolRefDoorFlowRate(j) * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.MixVdotCurDensity += refDoorMixingA.VolRefDoorFlowRate(j) * ADSCorrectionFactor; + szAirRpt.MixMass += + refDoorMixingA.VolRefDoorFlowRate(j) * AirDensity * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.MixMdot += refDoorMixingA.VolRefDoorFlowRate(j) * AirDensity * ADSCorrectionFactor; + szAirRpt.MixVdotStdDensity += + refDoorMixingA.VolRefDoorFlowRate(j) * (AirDensity / state.dataEnvrn->StdRhoAir) * ADSCorrectionFactor; + szAirRpt.MixSenLoad += refDoorMixingA.VolRefDoorFlowRate(j) * AirDensity * CpAir * (szHeatBal.MAT - zoneAHB.MAT); + szAirRpt.MixLatLoad += + refDoorMixingA.VolRefDoorFlowRate(j) * AirDensity * (szHeatBal.airHumRat - zoneAHB.airHumRat) * H2OHtOfVap; + } // volflowrate > 0 + } // matezoneptr (zoneB) = Zonelooop + } // NumRefDoorConnections + } // Refdoormix flag on ZoneA + } // zone A from 1 to (zoneNum - 1) + } // Refdoormix flag on zoneNum + } //(TotRefDoorMixing .GT. 0) + // end refrigeration door mixing reports + + // MixingLoad(zoneNum) = MCPM(zoneNum)*MAT(zoneNum) - szAirRpt.MixSenLoad(zoneNum) + if (szAirRpt.MixSenLoad > 0.0) { + szAirRpt.MixHeatLoss = szAirRpt.MixSenLoad * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.MixHeatGain = 0.0; + } else { + szAirRpt.MixHeatLoss = 0.0; + szAirRpt.MixHeatGain = -szAirRpt.MixSenLoad * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + } + // Report mixing latent loads + // MixingLoad(zoneNum) = szAirRpt.MixLatLoad(zoneNum) + if (szAirRpt.MixLatLoad > 0.0) { + szAirRpt.MixLatentLoss = szAirRpt.MixLatLoad * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.MixLatentGain = 0.0; + } else { + szAirRpt.MixLatentLoss = 0.0; + szAirRpt.MixLatentGain = -szAirRpt.MixLatLoad * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + } + // Total Mixing losses and gains + TotalLoad = szAirRpt.MixHeatGain + szAirRpt.MixLatentGain - szAirRpt.MixHeatLoss - szAirRpt.MixLatentLoss; + if (TotalLoad > 0) { + szAirRpt.MixTotalGain = TotalLoad * ADSCorrectionFactor; + szAirRpt.MixTotalLoss = 0.0; + } else { + szAirRpt.MixTotalGain = 0.0; + szAirRpt.MixTotalLoss = -TotalLoad * ADSCorrectionFactor; + } + + // Reporting combined outdoor air flows + for (int j = 1; j <= state.dataHeatBal->TotZoneAirBalance; ++j) { + if (state.dataHeatBal->ZoneAirBalance(j).BalanceMethod == DataHeatBalance::AirBalance::Quadrature && + zoneNum == state.dataHeatBal->ZoneAirBalance(j).ZonePtr) { + if (szHeatBal.MAT > outDryBulb) { + szAirRpt.OABalanceHeatLoss = + szHeatBal.MDotCPOA * (szHeatBal.MAT - outDryBulb) * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.OABalanceHeatGain = 0.0; + } else { + szAirRpt.OABalanceHeatLoss = 0.0; + szAirRpt.OABalanceHeatGain = + -szHeatBal.MDotCPOA * (szHeatBal.MAT - outDryBulb) * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; } - for (int k = 1; k <= zoneEquipConfig.NumExhaustNodes; ++k) { - znAirRpt.SysOutletMass += - state.dataLoopNodes->Node(zoneEquipConfig.ExhaustNode(k)).MassFlowRate * TimeStepSysSec * ADSCorrectionFactor; + H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(state.dataEnvrn->OutHumRat, outDryBulb); + if (szHeatBal.airHumRat > state.dataEnvrn->OutHumRat) { + szAirRpt.OABalanceLatentLoss = szHeatBal.MDotOA * (szHeatBal.airHumRat - state.dataEnvrn->OutHumRat) * H2OHtOfVap * + state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.OABalanceLatentGain = 0.0; + } else { + szAirRpt.OABalanceLatentGain = szHeatBal.MDotOA * (state.dataEnvrn->OutHumRat - szHeatBal.airHumRat) * H2OHtOfVap * + state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.OABalanceLatentLoss = 0.0; } - for (int k = 1; k <= zoneEquipConfig.NumReturnNodes; ++k) { - znAirRpt.SysOutletMass += - state.dataLoopNodes->Node(zoneEquipConfig.ReturnNode(k)).MassFlowRate * TimeStepSysSec * ADSCorrectionFactor; + // Total ventilation losses and gains + TotalLoad = szAirRpt.OABalanceHeatGain + szAirRpt.OABalanceLatentGain - szAirRpt.OABalanceHeatLoss - szAirRpt.OABalanceLatentLoss; + if (TotalLoad > 0) { + szAirRpt.OABalanceTotalGain = TotalLoad * ADSCorrectionFactor; + szAirRpt.OABalanceTotalLoss = 0.0; + } else { + szAirRpt.OABalanceTotalGain = 0.0; + szAirRpt.OABalanceTotalLoss = -TotalLoad * ADSCorrectionFactor; } + szAirRpt.OABalanceMass = (szHeatBal.MDotOA) * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.OABalanceMdot = (szHeatBal.MDotOA) * ADSCorrectionFactor; + AirDensity = + Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, szHeatBal.MAT, szHeatBal.airHumRatAvg, std::string()); + szAirRpt.OABalanceVolumeCurDensity = (szHeatBal.MDotOA / AirDensity) * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.OABalanceAirChangeRate = szAirRpt.OABalanceVolumeCurDensity / (state.dataHVACGlobal->TimeStepSys * szVolume); + szAirRpt.OABalanceVdotCurDensity = (szHeatBal.MDotOA / AirDensity) * ADSCorrectionFactor; + AirDensity = state.dataEnvrn->StdRhoAir; + szAirRpt.OABalanceVolumeStdDensity = (szHeatBal.MDotOA / AirDensity) * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + szAirRpt.OABalanceVdotStdDensity = (szHeatBal.MDotOA / AirDensity) * ADSCorrectionFactor; + szAirRpt.OABalanceFanElec = szAirRpt.VentilFanElec; } + } + // Reports exfiltration loss + H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(state.dataEnvrn->OutHumRat, outDryBulb); + szAirRpt.SysInletMass = 0; + szAirRpt.SysOutletMass = 0; + if (!szEquipConfig.IsControlled) { + for (int k = 1; k <= szEquipConfig.NumInletNodes; ++k) { + szAirRpt.SysInletMass += + state.dataLoopNodes->Node(szEquipConfig.InletNode(k)).MassFlowRate * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + } + for (int k = 1; k <= szEquipConfig.NumExhaustNodes; ++k) { + szAirRpt.SysOutletMass += + state.dataLoopNodes->Node(szEquipConfig.ExhaustNode(k)).MassFlowRate * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + } + for (int k = 1; k <= szEquipConfig.NumReturnNodes; ++k) { + szAirRpt.SysOutletMass += + state.dataLoopNodes->Node(szEquipConfig.ReturnNode(k)).MassFlowRate * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; + } + } - znAirRpt.ExfilMass = znAirRpt.InfilMass + znAirRpt.VentilMass + znAirRpt.MixMass + znAirRpt.OABalanceMass + znAirRpt.SysInletMass - - znAirRpt.SysOutletMass; // kg - // I am not happy with these un-parenthesized divisions and multiplications. Someone clean this up. - znAirRpt.ExfilSensiLoss = znAirRpt.ExfilMass / TimeStepSysSec * (thisZoneHB.MAT - zone.OutDryBulbTemp) * CpAir; // W - znAirRpt.ExfilLatentLoss = znAirRpt.ExfilMass / TimeStepSysSec * (thisZoneHB.airHumRat - state.dataEnvrn->OutHumRat) * H2OHtOfVap; - znAirRpt.ExfilTotalLoss = znAirRpt.ExfilLatentLoss + znAirRpt.ExfilSensiLoss; - - state.dataHeatBal->ZoneTotalExfiltrationHeatLoss += znAirRpt.ExfilTotalLoss * TimeStepSysSec; - state.dataHeatBal->ZoneTotalExhaustHeatLoss += znAirRpt.ExhTotalLoss * TimeStepSysSec; + szAirRpt.ExfilMass = + szAirRpt.InfilMass + szAirRpt.VentilMass + szAirRpt.MixMass + szAirRpt.OABalanceMass + szAirRpt.SysInletMass - szAirRpt.SysOutletMass; // kg + // I am not happy with these un-parenthesized divisions and multiplications. Someone clean this up. + szAirRpt.ExfilSensiLoss = szAirRpt.ExfilMass / state.dataHVACGlobal->TimeStepSysSec * (szHeatBal.MAT - outDryBulb) * CpAir; // W + szAirRpt.ExfilLatentLoss = + szAirRpt.ExfilMass / state.dataHVACGlobal->TimeStepSysSec * (szHeatBal.airHumRat - state.dataEnvrn->OutHumRat) * H2OHtOfVap; + szAirRpt.ExfilTotalLoss = szAirRpt.ExfilLatentLoss + szAirRpt.ExfilSensiLoss; + + // Accumulate only for zones + if (spaceNum == 0) { + state.dataHeatBal->ZoneTotalExfiltrationHeatLoss += szAirRpt.ExfilTotalLoss * state.dataHVACGlobal->TimeStepSysSec; + state.dataHeatBal->ZoneTotalExhaustHeatLoss += szAirRpt.ExhTotalLoss * state.dataHVACGlobal->TimeStepSysSec; } } diff --git a/src/EnergyPlus/HVACManager.hh b/src/EnergyPlus/HVACManager.hh index 89d35831ceb..f550136ed20 100644 --- a/src/EnergyPlus/HVACManager.hh +++ b/src/EnergyPlus/HVACManager.hh @@ -54,6 +54,7 @@ // EnergyPlus Headers #include #include +#include namespace EnergyPlus { @@ -105,6 +106,19 @@ namespace HVACManager { void ReportAirHeatBalance(EnergyPlusData &state); + void reportAirHeatBal1(EnergyPlusData &state, + DataHeatBalance::AirReportVars &szAirRpt, + DataZoneEquipment::EquipConfiguration const &szEquipConfig, + int const zoneNum, + int const spaceNum = 0); + + void reportAirHeatBal2(EnergyPlusData &state, + DataHeatBalance::AirReportVars &szAirRpt, + DataZoneEquipment::EquipConfiguration const &szEquipConfig, + ZoneTempPredictorCorrector::ZoneSpaceHeatBalanceData const &szHeatBal, + int const zoneNum, + int const spaceNum = 0); + void SetHeatToReturnAirFlag(EnergyPlusData &state); void UpdateZoneInletConvergenceLog(EnergyPlusData &state); @@ -128,7 +142,6 @@ struct HVACManagerData : BaseGlobalStruct int RepIterAir = 0; bool SimHVACIterSetup = false; bool TriggerGetAFN = true; - bool ReportAirHeatBalanceFirstTimeFlag = true; bool MyOneTimeFlag = true; bool PrintedWarmup = false; bool MyEnvrnFlag = true; @@ -140,8 +153,6 @@ struct HVACManagerData : BaseGlobalStruct int ErrCount = 0; // Number of times that the maximum iterations was exceeded int MaxErrCount = 0; std::string ErrEnvironmentName; - Array1D MixSenLoad; // Mixing sensible loss or gain - Array1D MixLatLoad; // Mixing latent loss or gain void init_state([[maybe_unused]] EnergyPlusData &state) override { diff --git a/src/EnergyPlus/HeatBalanceSurfaceManager.cc b/src/EnergyPlus/HeatBalanceSurfaceManager.cc index d121537afdd..22116cbe051 100644 --- a/src/EnergyPlus/HeatBalanceSurfaceManager.cc +++ b/src/EnergyPlus/HeatBalanceSurfaceManager.cc @@ -6569,6 +6569,7 @@ void ReportSurfaceHeatBalance(EnergyPlusData &state) } if (state.dataGlobal->ZoneSizingCalc && state.dataGlobal->CompLoadReportIsReq) { + // This is by surface, so it works for both space and zone component loads int TimeStepInDay = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) { for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { @@ -9529,6 +9530,7 @@ void GatherComponentLoadsSurfAbsFact(EnergyPlusData &state) // METHODOLOGY EMPLOYED: // Save sequence of values for report during sizing. + // This is by surface, so it works for both space and zone component loads if (state.dataGlobal->CompLoadReportIsReq && !state.dataGlobal->isPulseZoneSizing) { int TimeStepInDay = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; for (int enclosureNum = 1; enclosureNum <= state.dataViewFactor->NumOfRadiantEnclosures; ++enclosureNum) { diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index f7a4e671e89..e68d1aac84a 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -16048,11 +16048,11 @@ void CollectPeakZoneConditions(EnergyPlusData &state, if (timeOfMax != 0) { auto const &thisZone = state.dataHeatBal->Zone(zoneIndex); + Real64 mult = thisZone.Multiplier * thisZone.ListMultiplier; auto const &szCalcFinalSizing = (spaceIndex == 0) ? state.dataSize->CalcFinalZoneSizing(zoneIndex) : state.dataSize->CalcFinalSpaceSizing(spaceIndex); auto const &szFinalSizing = (spaceIndex == 0) ? state.dataSize->FinalZoneSizing(zoneIndex) : state.dataSize->FinalSpaceSizing(spaceIndex); - Real64 mult = thisZone.Multiplier * thisZone.ListMultiplier; if (mult == 0.0) mult = 1.0; if (isCooling) { diff --git a/src/EnergyPlus/OutputReportTabular.hh b/src/EnergyPlus/OutputReportTabular.hh index 457eaf28c0a..5fb980dbaac 100644 --- a/src/EnergyPlus/OutputReportTabular.hh +++ b/src/EnergyPlus/OutputReportTabular.hh @@ -792,7 +792,8 @@ namespace OutputReportTabular { Array3D &feneCondInstantSeqLoc, Array2D &surfDelaySeq, ZompComponentAreasType &componentAreas, - int const iZone, int const iSpace = 0); + int const iZone, + int const iSpace = 0); void GetDelaySequences(EnergyPlusData &state, int desDaySelected, From 75ccde658c67af52ad56db6e60c94dc492092b60 Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Wed, 18 Sep 2024 16:11:30 -0500 Subject: [PATCH 07/25] Space IV.6 - component loads state reduction --- src/EnergyPlus/OutputReportTabular.cc | 99 ++++++++++++--------------- src/EnergyPlus/OutputReportTabular.hh | 10 --- 2 files changed, 42 insertions(+), 67 deletions(-) diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index e68d1aac84a..9b73311ad36 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -14763,19 +14763,16 @@ void GatherComponentLoadsSurface(EnergyPlusData &state) auto const &ort = state.dataOutRptTab; if (state.dataGlobal->CompLoadReportIsReq && !state.dataGlobal->isPulseZoneSizing) { - state.dataOutRptTab->TimeStepInDayGCLS = - (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; - ort->feneCondInstantSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLS, _) = 0.0; - for (state.dataOutRptTab->iSurfGCLS = 1; state.dataOutRptTab->iSurfGCLS <= state.dataSurface->TotSurfaces; ++state.dataOutRptTab->iSurfGCLS) { - state.dataOutRptTab->ZoneNumGCLS = state.dataSurface->Surface(state.dataOutRptTab->iSurfGCLS).Zone; - if (state.dataOutRptTab->ZoneNumGCLS == 0) continue; - if (state.dataSurface->Surface(state.dataOutRptTab->iSurfGCLS).Class != DataSurfaces::SurfaceClass::Window) continue; + int timeStepInDayGCLS = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; + ort->feneCondInstantSeq(state.dataSize->CurOverallSimDay, timeStepInDayGCLS, _) = 0.0; + for (int iSurfGCLS = 1; iSurfGCLS <= state.dataSurface->TotSurfaces; ++iSurfGCLS) { + int zoneNumGCLS = state.dataSurface->Surface(iSurfGCLS).Zone; + if (zoneNumGCLS == 0) continue; + if (state.dataSurface->Surface(iSurfGCLS).Class != DataSurfaces::SurfaceClass::Window) continue; // IF (.not. ZoneEquipConfig(ZoneNum)%IsControlled) CYCLE - ort->feneCondInstantSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLS, state.dataOutRptTab->ZoneNumGCLS) += - state.dataSurface->SurfWinGainConvGlazToZoneRep(state.dataOutRptTab->iSurfGCLS) + - state.dataSurface->SurfWinConvHeatFlowNatural(state.dataOutRptTab->iSurfGCLS) + - state.dataSurface->SurfWinGainConvShadeToZoneRep(state.dataOutRptTab->iSurfGCLS) + - state.dataSurface->SurfWinGainFrameDividerToZoneRep(state.dataOutRptTab->iSurfGCLS); + ort->feneCondInstantSeq(state.dataSize->CurOverallSimDay, timeStepInDayGCLS, zoneNumGCLS) += + state.dataSurface->SurfWinGainConvGlazToZoneRep(iSurfGCLS) + state.dataSurface->SurfWinConvHeatFlowNatural(iSurfGCLS) + + state.dataSurface->SurfWinGainConvShadeToZoneRep(iSurfGCLS) + state.dataSurface->SurfWinGainFrameDividerToZoneRep(iSurfGCLS); // for now assume zero instant solar - may change related // to how blinds and shades absorb solar radiation and // convect that heat that timestep. @@ -14784,7 +14781,7 @@ void GatherComponentLoadsSurface(EnergyPlusData &state) for (int izone = 1; izone <= state.dataGlobal->NumOfZones; ++izone) { Real64 tubularGain = 0.0; tubularGain = InternalHeatGains::SumInternalConvectionGainsByTypes(state, izone, OutputReportTabular::IntGainTypesTubularGCLS); - ort->feneCondInstantSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLS, izone) += tubularGain; + ort->feneCondInstantSeq(state.dataSize->CurOverallSimDay, timeStepInDayGCLS, izone) += tubularGain; } } } @@ -14794,8 +14791,6 @@ void GatherComponentLoadsHVAC(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR Jason Glazer // DATE WRITTEN September 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Gather values during sizing used for loads component report. @@ -14803,72 +14798,62 @@ void GatherComponentLoadsHVAC(EnergyPlusData &state) // METHODOLOGY EMPLOYED: // Save sequence of values for report during sizing. - // Using/Aliasing - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - if (!(state.dataGlobal->CompLoadReportIsReq && !state.dataGlobal->isPulseZoneSizing)) { return; } auto &ort = state.dataOutRptTab; Real64 const TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; - state.dataOutRptTab->TimeStepInDayGCLH = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; - for (state.dataOutRptTab->iZoneGCLH = 1; state.dataOutRptTab->iZoneGCLH <= state.dataGlobal->NumOfZones; ++state.dataOutRptTab->iZoneGCLH) { - ort->infilInstantSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLH, state.dataOutRptTab->iZoneGCLH) = - ((state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->iZoneGCLH).InfilHeatGain - - state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->iZoneGCLH).InfilHeatLoss) / + int timeStepInDayGCLH = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; + for (int iZoneGCLH = 1; iZoneGCLH <= state.dataGlobal->NumOfZones; ++iZoneGCLH) { + ort->infilInstantSeq(state.dataSize->CurOverallSimDay, timeStepInDayGCLH, iZoneGCLH) = + ((state.dataHeatBal->ZnAirRpt(iZoneGCLH).InfilHeatGain - state.dataHeatBal->ZnAirRpt(iZoneGCLH).InfilHeatLoss) / TimeStepSysSec); // zone infiltration if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { - ort->infilInstantSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLH, state.dataOutRptTab->iZoneGCLH) += - (state.afn->AirflowNetworkReportData(state.dataOutRptTab->iZoneGCLH).MultiZoneInfiSenGainW - - state.afn->AirflowNetworkReportData(state.dataOutRptTab->iZoneGCLH).MultiZoneInfiSenLossW); // air flow network + ort->infilInstantSeq(state.dataSize->CurOverallSimDay, timeStepInDayGCLH, iZoneGCLH) += + (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiSenGainW - + state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiSenLossW); // air flow network } - ort->infilLatentSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLH, state.dataOutRptTab->iZoneGCLH) = - ((state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->iZoneGCLH).InfilLatentGain - - state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->iZoneGCLH).InfilLatentLoss) / + ort->infilLatentSeq(state.dataSize->CurOverallSimDay, timeStepInDayGCLH, iZoneGCLH) = + ((state.dataHeatBal->ZnAirRpt(iZoneGCLH).InfilLatentGain - state.dataHeatBal->ZnAirRpt(iZoneGCLH).InfilLatentLoss) / TimeStepSysSec); // zone infiltration if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { - ort->infilLatentSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLH, state.dataOutRptTab->iZoneGCLH) += - (state.afn->AirflowNetworkReportData(state.dataOutRptTab->iZoneGCLH).MultiZoneInfiLatGainW - - state.afn->AirflowNetworkReportData(state.dataOutRptTab->iZoneGCLH).MultiZoneInfiLatLossW); // air flow network + ort->infilLatentSeq(state.dataSize->CurOverallSimDay, timeStepInDayGCLH, iZoneGCLH) += + (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiLatGainW - + state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiLatLossW); // air flow network } - ort->zoneVentInstantSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLH, state.dataOutRptTab->iZoneGCLH) = - ((state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->iZoneGCLH).VentilHeatGain - - state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->iZoneGCLH).VentilHeatLoss) / + ort->zoneVentInstantSeq(state.dataSize->CurOverallSimDay, timeStepInDayGCLH, iZoneGCLH) = + ((state.dataHeatBal->ZnAirRpt(iZoneGCLH).VentilHeatGain - state.dataHeatBal->ZnAirRpt(iZoneGCLH).VentilHeatLoss) / TimeStepSysSec); // zone ventilation if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { - ort->zoneVentInstantSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLH, state.dataOutRptTab->iZoneGCLH) += - (state.afn->AirflowNetworkReportData(state.dataOutRptTab->iZoneGCLH).MultiZoneVentSenGainW - - state.afn->AirflowNetworkReportData(state.dataOutRptTab->iZoneGCLH).MultiZoneVentSenLossW); // air flow network + ort->zoneVentInstantSeq(state.dataSize->CurOverallSimDay, timeStepInDayGCLH, iZoneGCLH) += + (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentSenGainW - + state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentSenLossW); // air flow network } - ort->zoneVentLatentSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLH, state.dataOutRptTab->iZoneGCLH) = - ((state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->iZoneGCLH).VentilLatentGain - - state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->iZoneGCLH).VentilLatentLoss) / + ort->zoneVentLatentSeq(state.dataSize->CurOverallSimDay, timeStepInDayGCLH, iZoneGCLH) = + ((state.dataHeatBal->ZnAirRpt(iZoneGCLH).VentilLatentGain - state.dataHeatBal->ZnAirRpt(iZoneGCLH).VentilLatentLoss) / TimeStepSysSec); // zone ventilation if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { - ort->zoneVentInstantSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLH, state.dataOutRptTab->iZoneGCLH) += - (state.afn->AirflowNetworkReportData(state.dataOutRptTab->iZoneGCLH).MultiZoneVentLatGainW - - state.afn->AirflowNetworkReportData(state.dataOutRptTab->iZoneGCLH).MultiZoneVentLatLossW); // air flow network + ort->zoneVentInstantSeq(state.dataSize->CurOverallSimDay, timeStepInDayGCLH, iZoneGCLH) += + (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentLatGainW - + state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentLatLossW); // air flow network } - ort->interZoneMixInstantSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLH, state.dataOutRptTab->iZoneGCLH) = - ((state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->iZoneGCLH).MixHeatGain - - state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->iZoneGCLH).MixHeatLoss) / + ort->interZoneMixInstantSeq(state.dataSize->CurOverallSimDay, timeStepInDayGCLH, iZoneGCLH) = + ((state.dataHeatBal->ZnAirRpt(iZoneGCLH).MixHeatGain - state.dataHeatBal->ZnAirRpt(iZoneGCLH).MixHeatLoss) / TimeStepSysSec); // zone mixing if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { - ort->interZoneMixInstantSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLH, state.dataOutRptTab->iZoneGCLH) += - (state.afn->AirflowNetworkReportData(state.dataOutRptTab->iZoneGCLH).MultiZoneMixSenGainW - - state.afn->AirflowNetworkReportData(state.dataOutRptTab->iZoneGCLH).MultiZoneMixSenLossW); // air flow network + ort->interZoneMixInstantSeq(state.dataSize->CurOverallSimDay, timeStepInDayGCLH, iZoneGCLH) += + (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixSenGainW - + state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixSenLossW); // air flow network } - ort->interZoneMixLatentSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLH, state.dataOutRptTab->iZoneGCLH) = - ((state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->iZoneGCLH).MixLatentGain - - state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->iZoneGCLH).MixLatentLoss) / + ort->interZoneMixLatentSeq(state.dataSize->CurOverallSimDay, timeStepInDayGCLH, iZoneGCLH) = + ((state.dataHeatBal->ZnAirRpt(iZoneGCLH).MixLatentGain - state.dataHeatBal->ZnAirRpt(iZoneGCLH).MixLatentLoss) / TimeStepSysSec); // zone mixing if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { - ort->interZoneMixLatentSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLH, state.dataOutRptTab->iZoneGCLH) += - (state.afn->AirflowNetworkReportData(state.dataOutRptTab->iZoneGCLH).MultiZoneMixLatGainW - - state.afn->AirflowNetworkReportData(state.dataOutRptTab->iZoneGCLH).MultiZoneMixLatLossW); // air flow network + ort->interZoneMixLatentSeq(state.dataSize->CurOverallSimDay, timeStepInDayGCLH, iZoneGCLH) += + (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixLatGainW - + state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixLatLossW); // air flow network } } } diff --git a/src/EnergyPlus/OutputReportTabular.hh b/src/EnergyPlus/OutputReportTabular.hh index 5fb980dbaac..d60b9691d61 100644 --- a/src/EnergyPlus/OutputReportTabular.hh +++ b/src/EnergyPlus/OutputReportTabular.hh @@ -1332,11 +1332,6 @@ struct OutputReportTabularData : BaseGlobalStruct int TimeOfPulseCLCDC = 0; int CoolDesSelectedCLCDC = 0; // design day selected for cooling int HeatDesSelectedCLCDC = 0; // design day selected for heating - int iSurfGCLS = 0; - int ZoneNumGCLS = 0; - int TimeStepInDayGCLS = 0; - int iZoneGCLH = 0; - int TimeStepInDayGCLH = 0; Array3D_bool adjFenDone; Real64 BigNumRMG = 0.0; int foundGsui = 0; @@ -1638,11 +1633,6 @@ struct OutputReportTabularData : BaseGlobalStruct this->TimeOfPulseCLCDC = 0; this->CoolDesSelectedCLCDC = 0; // design day selected for cooling this->HeatDesSelectedCLCDC = 0; // design day selected for heating - this->iSurfGCLS = 0; - this->ZoneNumGCLS = 0; - this->TimeStepInDayGCLS = 0; - this->iZoneGCLH = 0; - this->TimeStepInDayGCLH = 0; this->adjFenDone.clear(); this->BigNumRMG = 0.0; this->foundGsui = 0; From ac222b07e8da4de6e24214e55cb7368cc261c28c Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Thu, 19 Sep 2024 16:46:09 -0500 Subject: [PATCH 08/25] Space IV.6 - simple airflow and AirRpt cleanup --- src/EnergyPlus/HVACManager.cc | 22 +++++++---- src/EnergyPlus/HeatBalanceAirManager.cc | 2 +- tst/EnergyPlus/unit/HVACManager.unit.cc | 51 +++++++++++++++++++++---- 3 files changed, 60 insertions(+), 15 deletions(-) diff --git a/src/EnergyPlus/HVACManager.cc b/src/EnergyPlus/HVACManager.cc index 0e1324b9d65..debefd893f2 100644 --- a/src/EnergyPlus/HVACManager.cc +++ b/src/EnergyPlus/HVACManager.cc @@ -2238,7 +2238,12 @@ void ReportInfiltrations(EnergyPlusData &state) AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, thisSpaceHB.MAT, thisSpaceHB.airHumRatAvg, RoutineName); thisInfiltration.InfilVdotCurDensity = thisInfiltration.InfilMdot / AirDensity; thisInfiltration.InfilVolumeCurDensity = thisInfiltration.InfilVdotCurDensity * TimeStepSysSec; - thisInfiltration.InfilAirChangeRate = thisInfiltration.InfilVolumeCurDensity / (TimeStepSys * thisZone.Volume); + Real64 vol = state.dataHeatBal->space(spaceNum).Volume; + if (vol > 0.0) { + thisInfiltration.InfilAirChangeRate = thisInfiltration.InfilVolumeCurDensity / (TimeStepSys * vol); + } else { + thisInfiltration.InfilAirChangeRate = 0.0; + } // CR7751 third, calculate using standard dry air at nominal elevation AirDensity = state.dataEnvrn->StdRhoAir; @@ -2445,7 +2450,7 @@ void reportAirHeatBal2(EnergyPlusData &state, for (int VentNum = 1; VentNum <= state.dataHeatBal->TotVentilation; ++VentNum) { auto const &ventilation = state.dataHeatBal->Ventilation(VentNum); - if (((spaceNum == 0) && (ventilation.ZonePtr == zoneNum)) || (spaceNum == ventilation.spaceIndex)) { + if (((spaceNum == 0) && (ventilation.ZonePtr == zoneNum)) || ((spaceNum > 0) && (spaceNum == ventilation.spaceIndex))) { if (ADSCorrectionFactor > 0) { szAirRpt.VentilAirTemp += ventilation.AirTemp * ventilation.MCP; VentZoneMassflow += ventilation.MCP; @@ -2508,7 +2513,7 @@ void reportAirHeatBal2(EnergyPlusData &state, for (int MixNum = 1; MixNum <= state.dataHeatBal->TotMixing; ++MixNum) { auto &mixing = state.dataHeatBal->Mixing(MixNum); - if ((((spaceNum == 0) && (mixing.ZonePtr == zoneNum)) || (spaceNum == mixing.spaceIndex)) && mixing.ReportFlag) { + if (mixing.ReportFlag && (((spaceNum == 0) && (mixing.ZonePtr == zoneNum)) || ((spaceNum > 0) && (spaceNum == mixing.spaceIndex)))) { Real64 const fromMAT = (mixing.fromSpaceIndex == 0) ? state.dataZoneTempPredictorCorrector->zoneHeatBalance(mixing.FromZone).MAT : state.dataZoneTempPredictorCorrector->spaceHeatBalance(mixing.fromSpaceIndex).MAT; Real64 const fromHumRat = (mixing.fromSpaceIndex == 0) @@ -2536,7 +2541,8 @@ void reportAirHeatBal2(EnergyPlusData &state, for (int MixNum = 1; MixNum <= state.dataHeatBal->TotCrossMixing; ++MixNum) { auto &crossMixing = state.dataHeatBal->CrossMixing(MixNum); - if ((((spaceNum == 0) && (crossMixing.ZonePtr == zoneNum)) || (spaceNum == crossMixing.spaceIndex)) && crossMixing.ReportFlag) { + if (crossMixing.ReportFlag && + ((((spaceNum == 0) && (crossMixing.ZonePtr == zoneNum)) || (spaceNum > 0) && (spaceNum == crossMixing.spaceIndex)))) { Real64 const fromMAT = (crossMixing.fromSpaceIndex == 0) ? state.dataZoneTempPredictorCorrector->zoneHeatBalance(crossMixing.FromZone).MAT : state.dataZoneTempPredictorCorrector->spaceHeatBalance(crossMixing.fromSpaceIndex).MAT; @@ -2560,7 +2566,8 @@ void reportAirHeatBal2(EnergyPlusData &state, // ZoneAirHumRat(crossMixing%FromZone))*H2OHtOfVap szAirRpt.MixLatLoad += crossMixing.DesiredAirFlowRate * AirDensity * (szHeatBal.airHumRat - fromHumRat) * H2OHtOfVap; } - if ((((spaceNum == 0) && (crossMixing.FromZone == zoneNum)) || (spaceNum == crossMixing.fromSpaceIndex)) && crossMixing.ReportFlag) { + if (crossMixing.ReportFlag && + (((spaceNum == 0) && (crossMixing.FromZone == zoneNum)) || ((spaceNum > 0) && (spaceNum == crossMixing.fromSpaceIndex)))) { Real64 const mixingMAT = (crossMixing.spaceIndex == 0) ? state.dataZoneTempPredictorCorrector->zoneHeatBalance(crossMixing.ZonePtr).MAT : state.dataZoneTempPredictorCorrector->spaceHeatBalance(crossMixing.spaceIndex).MAT; @@ -2588,7 +2595,7 @@ void reportAirHeatBal2(EnergyPlusData &state, // in input with lowest zone # first no matter how input in idf auto &refDoorMixing = state.dataHeatBal->RefDoorMixing(zoneNum); if (refDoorMixing.RefDoorMixFlag) { // .TRUE. for both zoneA and zoneB - if ((spaceNum == 0) && (refDoorMixing.ZonePtr == zoneNum) || (spaceNum == refDoorMixing.spaceIndex)) { + if (((spaceNum == 0) && (refDoorMixing.ZonePtr == zoneNum)) || ((spaceNum > 0) && (spaceNum == refDoorMixing.spaceIndex))) { for (int j = 1; j <= refDoorMixing.NumRefDoorConnections; ++j) { // Capture impact when zoneNum is the 'primary zone' // that is, the zone of a pair with the lower zone number @@ -2627,7 +2634,8 @@ void reportAirHeatBal2(EnergyPlusData &state, // that is, the zone of a pair with the higher zone number(matezoneptr = zoneNum) if (refDoorMixingA.RefDoorMixFlag) { for (int j = 1; j <= refDoorMixingA.NumRefDoorConnections; ++j) { - if (refDoorMixingA.MateZonePtr(j) == zoneNum) { + if (((spaceNum == 0) && (refDoorMixingA.MateZonePtr(j) == zoneNum)) || + ((spaceNum == 0) && (refDoorMixingA.fromSpaceIndex == spaceNum))) { if (refDoorMixingA.VolRefDoorFlowRate(j) > 0.0) { AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, diff --git a/src/EnergyPlus/HeatBalanceAirManager.cc b/src/EnergyPlus/HeatBalanceAirManager.cc index 6daa9ff9e43..67b5b948175 100644 --- a/src/EnergyPlus/HeatBalanceAirManager.cc +++ b/src/EnergyPlus/HeatBalanceAirManager.cc @@ -286,7 +286,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err // Following used for reporting state.dataHeatBal->ZnAirRpt.allocate(state.dataGlobal->NumOfZones); - if (state.dataHeatBal->doSpaceHeatBalanceSimulation) { + if (state.dataHeatBal->doSpaceHeatBalance) { state.dataHeatBal->spaceAirRpt.allocate(state.dataGlobal->numSpaces); } diff --git a/tst/EnergyPlus/unit/HVACManager.unit.cc b/tst/EnergyPlus/unit/HVACManager.unit.cc index 14f6ee13dac..3a84eaafda4 100644 --- a/tst/EnergyPlus/unit/HVACManager.unit.cc +++ b/tst/EnergyPlus/unit/HVACManager.unit.cc @@ -141,13 +141,46 @@ TEST_F(EnergyPlusFixture, InfiltrationObjectLevelReport) { std::string const idf_objects = delimited_string({ - "Zone,Zone1;", - - "Zone,Zone2;", - - "Zone,Zone3;", - - "Zone,Zone4;", + " Zone,", + " Zone1, !- Name", + " 0, !- Direction of Relative North {deg}", + " 0, !- X Origin {m}", + " 0, !- Y Origin {m}", + " 0, !- Z Origin {m}", + " 1, !- Type", + " 1, !- Multiplier", + " autocalculate, !- Ceiling Height {m}", + " 100.0; !- Volume {m3}", + " Zone,", + " Zone2, !- Name", + " 0, !- Direction of Relative North {deg}", + " 0, !- X Origin {m}", + " 0, !- Y Origin {m}", + " 0, !- Z Origin {m}", + " 1, !- Type", + " 1, !- Multiplier", + " autocalculate, !- Ceiling Height {m}", + " 200.0; !- Volume {m3}", + " Zone,", + " Zone3, !- Name", + " 0, !- Direction of Relative North {deg}", + " 0, !- X Origin {m}", + " 0, !- Y Origin {m}", + " 0, !- Z Origin {m}", + " 1, !- Type", + " 1, !- Multiplier", + " autocalculate, !- Ceiling Height {m}", + " 300.0; !- Volume {m3}", + " Zone,", + " Zone4, !- Name", + " 0, !- Direction of Relative North {deg}", + " 0, !- X Origin {m}", + " 0, !- Y Origin {m}", + " 0, !- Z Origin {m}", + " 1, !- Type", + " 1, !- Multiplier", + " autocalculate, !- Ceiling Height {m}", + " 400.0; !- Volume {m3}", "ZoneList,", " ZoneList,", @@ -198,6 +231,10 @@ TEST_F(EnergyPlusFixture, InfiltrationObjectLevelReport) bool ErrorsFound(false); ScheduleManager::ProcessScheduleInput(*state); GetZoneData(*state, ErrorsFound); + state->dataHeatBal->space(1).Volume = state->dataHeatBal->Zone(1).Volume; + state->dataHeatBal->space(2).Volume = state->dataHeatBal->Zone(2).Volume; + state->dataHeatBal->space(3).Volume = state->dataHeatBal->Zone(3).Volume; + state->dataHeatBal->space(4).Volume = state->dataHeatBal->Zone(4).Volume; AllocateHeatBalArrays(*state); GetSimpleAirModelInputs(*state, ErrorsFound); From 00f67f0fc50a2314d1c1914b538c1cd185bc02a8 Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Fri, 20 Sep 2024 17:34:34 -0500 Subject: [PATCH 09/25] Space IV.6 - unwind some 3D comp loads arrays --- src/EnergyPlus/InternalHeatGains.cc | 118 ++++---- src/EnergyPlus/InternalHeatGains.hh | 10 +- src/EnergyPlus/OutputReportTabular.cc | 277 +++++++++--------- src/EnergyPlus/OutputReportTabular.hh | 116 ++++---- tst/EnergyPlus/unit/InternalHeatGains.unit.cc | 11 +- .../unit/OutputReportTabular.unit.cc | 161 +++------- 6 files changed, 290 insertions(+), 403 deletions(-) diff --git a/src/EnergyPlus/InternalHeatGains.cc b/src/EnergyPlus/InternalHeatGains.cc index d6d7315043e..08f2ff161b5 100644 --- a/src/EnergyPlus/InternalHeatGains.cc +++ b/src/EnergyPlus/InternalHeatGains.cc @@ -9121,8 +9121,9 @@ namespace InternalHeatGains { Real64 SumReturnAirConvectionGainsByTypes( EnergyPlusData &state, - int const ZoneNum, // zone index pointer for which zone to sum gains for - gsl::span GainTypeARR // variable length 1-d array of integer valued gain types + int const ZoneNum, // zone index pointer for which zone to sum gains for + gsl::span GainTypeARR, // variable length 1-d array of integer valued gain types + int const spaceIndex // space index pointer, sum gains only for this space ) { @@ -9138,16 +9139,27 @@ namespace InternalHeatGains { int NumberOfTypes = GainTypeARR.size(); - for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { - if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) { - continue; + // TODO MJW: This could be refactored to avoid duplicate code, but for now . . . . + if (spaceIndex > 0) { + for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceIndex).numberOfDevices; ++DeviceNum) { + for (int TypeNum = 0; TypeNum < NumberOfTypes; ++TypeNum) { + if (state.dataHeatBal->spaceIntGainDevices(spaceIndex).device(DeviceNum).CompType == GainTypeARR[TypeNum]) { + SumReturnAirGainRate += state.dataHeatBal->spaceIntGainDevices(spaceIndex).device(DeviceNum).ReturnAirConvGainRate; + } + } } + } else { + for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { + if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) { + continue; + } - for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) { - for (int TypeNum = 0; TypeNum < NumberOfTypes; ++TypeNum) { + for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) { + for (int TypeNum = 0; TypeNum < NumberOfTypes; ++TypeNum) { - if (state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CompType == GainTypeARR[TypeNum]) { - SumReturnAirGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).ReturnAirConvGainRate; + if (state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CompType == GainTypeARR[TypeNum]) { + SumReturnAirGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).ReturnAirConvGainRate; + } } } } @@ -9494,7 +9506,23 @@ namespace InternalHeatGains { // Using/Aliasing using namespace DataHeatBalance; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + if (state.dataGlobal->CompLoadReportIsReq && !state.dataGlobal->isPulseZoneSizing) { + int TimeStepInDay = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; + for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { + auto &znCLDayTS = state.dataOutRptTab->znCompLoads[iZone - 1].day[state.dataSize->CurOverallSimDay - 1].ts[TimeStepInDay - 1]; + gatherCompLoadIntGain2(state, znCLDayTS, iZone); + } + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + for (int iSpace = 1; iSpace <= state.dataGlobal->NumOfZones; ++iSpace) { + auto &spCLDayTS = state.dataOutRptTab->spCompLoads[iSpace - 1].day[state.dataSize->CurOverallSimDay - 1].ts[TimeStepInDay - 1]; + gatherCompLoadIntGain2(state, spCLDayTS, state.dataHeatBal->space(iSpace).zoneNum, iSpace); + } + } + } + } + + void gatherCompLoadIntGain2(EnergyPlusData &state, OutputReportTabular::compLoadsTimeStep &szCompLoadDayTS, int const zoneNum, int const spaceNum) + { static constexpr std::array IntGainTypesPeople = {DataHeatBalance::IntGainType::People}; static constexpr std::array IntGainTypesLight = {DataHeatBalance::IntGainType::Lights}; static constexpr std::array IntGainTypesEquip = {DataHeatBalance::IntGainType::ElectricEquipment, @@ -9560,54 +9588,30 @@ namespace InternalHeatGains { assert((int)(size(IntGainTypesPeople) + size(IntGainTypesLight) + size(IntGainTypesEquip) + size(IntGainTypesRefrig) + size(IntGainTypesWaterUse) + size(IntGainTypesHvacLoss) + size(IntGainTypesPowerGen) + size(ExcludedIntGainTypes)) == (int)DataHeatBalance::IntGainType::Num); + szCompLoadDayTS.peopleInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesPeople, spaceNum); + szCompLoadDayTS.peopleLatentSeq = SumInternalLatentGainsByTypes(state, zoneNum, IntGainTypesPeople, spaceNum); + szCompLoadDayTS.peopleRadSeq = SumInternalRadiationGainsByTypes(state, zoneNum, IntGainTypesPeople, spaceNum); - if (state.dataGlobal->CompLoadReportIsReq && !state.dataGlobal->isPulseZoneSizing) { - int TimeStepInDay = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; - for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { - state.dataOutRptTab->peopleInstantSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalConvectionGainsByTypes(state, iZone, IntGainTypesPeople); - state.dataOutRptTab->peopleLatentSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalLatentGainsByTypes(state, iZone, IntGainTypesPeople); - state.dataOutRptTab->peopleRadSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalRadiationGainsByTypes(state, iZone, IntGainTypesPeople); - - state.dataOutRptTab->lightInstantSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalConvectionGainsByTypes(state, iZone, IntGainTypesLight); - state.dataOutRptTab->lightRetAirSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumReturnAirConvectionGainsByTypes(state, iZone, IntGainTypesLight); - state.dataOutRptTab->lightLWRadSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalRadiationGainsByTypes(state, iZone, IntGainTypesLight); - - state.dataOutRptTab->equipInstantSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalConvectionGainsByTypes(state, iZone, IntGainTypesEquip); - state.dataOutRptTab->equipLatentSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalLatentGainsByTypes(state, iZone, IntGainTypesEquip); - state.dataOutRptTab->equipRadSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalRadiationGainsByTypes(state, iZone, IntGainTypesEquip); - - state.dataOutRptTab->refrigInstantSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalConvectionGainsByTypes(state, iZone, IntGainTypesRefrig); - state.dataOutRptTab->refrigRetAirSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumReturnAirConvectionGainsByTypes(state, iZone, IntGainTypesRefrig); - state.dataOutRptTab->refrigLatentSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalLatentGainsByTypes(state, iZone, IntGainTypesRefrig); - - state.dataOutRptTab->waterUseInstantSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalConvectionGainsByTypes(state, iZone, IntGainTypesWaterUse); - state.dataOutRptTab->waterUseLatentSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalLatentGainsByTypes(state, iZone, IntGainTypesWaterUse); - - state.dataOutRptTab->hvacLossInstantSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalConvectionGainsByTypes(state, iZone, IntGainTypesHvacLoss); - state.dataOutRptTab->hvacLossRadSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalRadiationGainsByTypes(state, iZone, IntGainTypesHvacLoss); - - state.dataOutRptTab->powerGenInstantSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalConvectionGainsByTypes(state, iZone, IntGainTypesPowerGen); - state.dataOutRptTab->powerGenRadSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, iZone) = - SumInternalRadiationGainsByTypes(state, iZone, IntGainTypesPowerGen); - } - } + szCompLoadDayTS.lightInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesLight, spaceNum); + szCompLoadDayTS.lightRetAirSeq = SumReturnAirConvectionGainsByTypes(state, zoneNum, IntGainTypesLight, spaceNum); + szCompLoadDayTS.lightLWRadSeq = SumInternalRadiationGainsByTypes(state, zoneNum, IntGainTypesLight, spaceNum); + + szCompLoadDayTS.equipInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesEquip, spaceNum); + szCompLoadDayTS.equipLatentSeq = SumInternalLatentGainsByTypes(state, zoneNum, IntGainTypesEquip, spaceNum); + szCompLoadDayTS.equipRadSeq = SumInternalRadiationGainsByTypes(state, zoneNum, IntGainTypesEquip, spaceNum); + + szCompLoadDayTS.refrigInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesRefrig, spaceNum); + szCompLoadDayTS.refrigRetAirSeq = SumReturnAirConvectionGainsByTypes(state, zoneNum, IntGainTypesRefrig, spaceNum); + szCompLoadDayTS.refrigLatentSeq = SumInternalLatentGainsByTypes(state, zoneNum, IntGainTypesRefrig, spaceNum); + + szCompLoadDayTS.waterUseInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesWaterUse, spaceNum); + szCompLoadDayTS.waterUseLatentSeq = SumInternalLatentGainsByTypes(state, zoneNum, IntGainTypesWaterUse, spaceNum); + + szCompLoadDayTS.hvacLossInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesHvacLoss, spaceNum); + szCompLoadDayTS.hvacLossRadSeq = SumInternalRadiationGainsByTypes(state, zoneNum, IntGainTypesHvacLoss, spaceNum); + + szCompLoadDayTS.powerGenInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesPowerGen, spaceNum); + szCompLoadDayTS.powerGenRadSeq = SumInternalRadiationGainsByTypes(state, zoneNum, IntGainTypesPowerGen, spaceNum); } int GetInternalGainDeviceIndex(EnergyPlusData &state, diff --git a/src/EnergyPlus/InternalHeatGains.hh b/src/EnergyPlus/InternalHeatGains.hh index a44469c5e89..7cadac01e38 100644 --- a/src/EnergyPlus/InternalHeatGains.hh +++ b/src/EnergyPlus/InternalHeatGains.hh @@ -55,6 +55,7 @@ // EnergyPlus Headers #include #include +#include #include namespace EnergyPlus { @@ -166,9 +167,9 @@ namespace InternalHeatGains { Real64 SumReturnAirConvectionGainsByTypes( EnergyPlusData &state, - int const ZoneNum, // zone index pointer for which zone to sum gains for - gsl::span GainTypeARR // variable length 1-d array of enum valued gain types - ); + int const ZoneNum, // zone index pointer for which zone to sum gains for + gsl::span GainTypeARR, // variable length 1-d array of enum valued gain types + int const spaceIndex = 0); // space index pointer, sum gains only for this space Real64 SumAllSpaceInternalRadiationGains(EnergyPlusData &state, int const SpaceNum // space index pointer for which space to sum gains for @@ -221,6 +222,9 @@ namespace InternalHeatGains { void GatherComponentLoadsIntGain(EnergyPlusData &state); + void + gatherCompLoadIntGain2(EnergyPlusData &state, OutputReportTabular::compLoadsTimeStep &szCompLoadDayTS, int const zoneNum, int const spaceNum = 0); + } // namespace InternalHeatGains struct InternalHeatGainsData : BaseGlobalStruct diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index 9b73311ad36..0d05e6100c0 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -14512,84 +14512,27 @@ void AllocateLoadComponentArrays(EnergyPlusData &state) state.dataGlobal->NumOfTimeStepInHour * 24, state.dataViewFactor->NumOfRadiantEnclosures); ort->TMULTseq = 0.0; - ort->peopleInstantSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->peopleInstantSeq = 0.0; - ort->peopleLatentSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->peopleLatentSeq = 0.0; - ort->peopleRadSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->peopleRadSeq = 0.0; - ort->lightInstantSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->lightInstantSeq = 0.0; - ort->lightRetAirSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->lightRetAirSeq = 0.0; - ort->lightLWRadSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->lightLWRadSeq = 0.0; + Real64 numTSinDay = state.dataGlobal->NumOfTimeStepInHour * 24; + + ort->znCompLoads.resize(state.dataGlobal->NumOfZones); + for (auto &zone : ort->znCompLoads) { + zone.day.resize(state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays); + for (auto &day : zone.day) { + day.ts.resize(numTSinDay); + } + } + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + ort->spCompLoads.resize(state.dataGlobal->numSpaces); + for (auto &space : ort->spCompLoads) { + space.day.resize(state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays); + for (auto &day : space.day) { + day.ts.resize(numTSinDay); + } + } + } ort->lightSWRadSeq.allocate( state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); ort->lightSWRadSeq = 0.0; - ort->equipInstantSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->equipInstantSeq = 0.0; - ort->equipLatentSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->equipLatentSeq = 0.0; - ort->equipRadSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->equipRadSeq = 0.0; - ort->refrigInstantSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->refrigInstantSeq = 0.0; - ort->refrigRetAirSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->refrigRetAirSeq = 0.0; - ort->refrigLatentSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->refrigLatentSeq = 0.0; - ort->waterUseInstantSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->waterUseInstantSeq = 0.0; - ort->waterUseLatentSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->waterUseLatentSeq = 0.0; - ort->hvacLossInstantSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->hvacLossInstantSeq = 0.0; - ort->hvacLossRadSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->hvacLossRadSeq = 0.0; - ort->powerGenInstantSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->powerGenInstantSeq = 0.0; - ort->powerGenRadSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->powerGenRadSeq = 0.0; - ort->infilInstantSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->infilInstantSeq = 0.0; - ort->infilLatentSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->infilLatentSeq = 0.0; - ort->zoneVentInstantSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->zoneVentInstantSeq = 0.0; - ort->zoneVentLatentSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->zoneVentLatentSeq = 0.0; - ort->interZoneMixInstantSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->interZoneMixInstantSeq = 0.0; - ort->interZoneMixLatentSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->interZoneMixLatentSeq = 0.0; - ort->feneCondInstantSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); - ort->feneCondInstantSeq = 0.0; ort->feneSolarRadSeq.allocate( state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); ort->feneSolarRadSeq = 0.0; @@ -14764,13 +14707,16 @@ void GatherComponentLoadsSurface(EnergyPlusData &state) if (state.dataGlobal->CompLoadReportIsReq && !state.dataGlobal->isPulseZoneSizing) { int timeStepInDayGCLS = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; - ort->feneCondInstantSeq(state.dataSize->CurOverallSimDay, timeStepInDayGCLS, _) = 0.0; + for (auto &zoneCL : ort->znCompLoads) { + auto &day = zoneCL.day[state.dataSize->CurOverallSimDay - 1]; + day.ts[timeStepInDayGCLS - 1].feneCondInstantSeq = 0.0; + } for (int iSurfGCLS = 1; iSurfGCLS <= state.dataSurface->TotSurfaces; ++iSurfGCLS) { int zoneNumGCLS = state.dataSurface->Surface(iSurfGCLS).Zone; if (zoneNumGCLS == 0) continue; if (state.dataSurface->Surface(iSurfGCLS).Class != DataSurfaces::SurfaceClass::Window) continue; // IF (.not. ZoneEquipConfig(ZoneNum)%IsControlled) CYCLE - ort->feneCondInstantSeq(state.dataSize->CurOverallSimDay, timeStepInDayGCLS, zoneNumGCLS) += + ort->znCompLoads[zoneNumGCLS - 1].day[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLS - 1].feneCondInstantSeq += state.dataSurface->SurfWinGainConvGlazToZoneRep(iSurfGCLS) + state.dataSurface->SurfWinConvHeatFlowNatural(iSurfGCLS) + state.dataSurface->SurfWinGainConvShadeToZoneRep(iSurfGCLS) + state.dataSurface->SurfWinGainFrameDividerToZoneRep(iSurfGCLS); // for now assume zero instant solar - may change related @@ -14778,10 +14724,11 @@ void GatherComponentLoadsSurface(EnergyPlusData &state) // convect that heat that timestep. // feneSolarInstantSeq(ZoneNum,TimeStepInDay,CurOverallSimDay) = 0 } + for (int izone = 1; izone <= state.dataGlobal->NumOfZones; ++izone) { Real64 tubularGain = 0.0; tubularGain = InternalHeatGains::SumInternalConvectionGainsByTypes(state, izone, OutputReportTabular::IntGainTypesTubularGCLS); - ort->feneCondInstantSeq(state.dataSize->CurOverallSimDay, timeStepInDayGCLS, izone) += tubularGain; + ort->znCompLoads[izone - 1].day[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLS - 1].feneCondInstantSeq += tubularGain; } } } @@ -14805,55 +14752,50 @@ void GatherComponentLoadsHVAC(EnergyPlusData &state) Real64 const TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; int timeStepInDayGCLH = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; for (int iZoneGCLH = 1; iZoneGCLH <= state.dataGlobal->NumOfZones; ++iZoneGCLH) { - ort->infilInstantSeq(state.dataSize->CurOverallSimDay, timeStepInDayGCLH, iZoneGCLH) = + auto &compLoadDayTS = ort->znCompLoads[iZoneGCLH - 1].day[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLH - 1]; + compLoadDayTS.infilInstantSeq = ((state.dataHeatBal->ZnAirRpt(iZoneGCLH).InfilHeatGain - state.dataHeatBal->ZnAirRpt(iZoneGCLH).InfilHeatLoss) / TimeStepSysSec); // zone infiltration if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { - ort->infilInstantSeq(state.dataSize->CurOverallSimDay, timeStepInDayGCLH, iZoneGCLH) += - (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiSenGainW - - state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiSenLossW); // air flow network + compLoadDayTS.infilInstantSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiSenGainW - + state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiSenLossW); // air flow network } - ort->infilLatentSeq(state.dataSize->CurOverallSimDay, timeStepInDayGCLH, iZoneGCLH) = + compLoadDayTS.infilLatentSeq = ((state.dataHeatBal->ZnAirRpt(iZoneGCLH).InfilLatentGain - state.dataHeatBal->ZnAirRpt(iZoneGCLH).InfilLatentLoss) / TimeStepSysSec); // zone infiltration if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { - ort->infilLatentSeq(state.dataSize->CurOverallSimDay, timeStepInDayGCLH, iZoneGCLH) += - (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiLatGainW - - state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiLatLossW); // air flow network + compLoadDayTS.infilLatentSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiLatGainW - + state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiLatLossW); // air flow network } - ort->zoneVentInstantSeq(state.dataSize->CurOverallSimDay, timeStepInDayGCLH, iZoneGCLH) = + compLoadDayTS.zoneVentInstantSeq = ((state.dataHeatBal->ZnAirRpt(iZoneGCLH).VentilHeatGain - state.dataHeatBal->ZnAirRpt(iZoneGCLH).VentilHeatLoss) / TimeStepSysSec); // zone ventilation if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { - ort->zoneVentInstantSeq(state.dataSize->CurOverallSimDay, timeStepInDayGCLH, iZoneGCLH) += - (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentSenGainW - - state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentSenLossW); // air flow network + compLoadDayTS.zoneVentInstantSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentSenGainW - + state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentSenLossW); // air flow network } - ort->zoneVentLatentSeq(state.dataSize->CurOverallSimDay, timeStepInDayGCLH, iZoneGCLH) = + compLoadDayTS.zoneVentLatentSeq = ((state.dataHeatBal->ZnAirRpt(iZoneGCLH).VentilLatentGain - state.dataHeatBal->ZnAirRpt(iZoneGCLH).VentilLatentLoss) / TimeStepSysSec); // zone ventilation if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { - ort->zoneVentInstantSeq(state.dataSize->CurOverallSimDay, timeStepInDayGCLH, iZoneGCLH) += - (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentLatGainW - - state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentLatLossW); // air flow network + compLoadDayTS.zoneVentInstantSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentLatGainW - + state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentLatLossW); // air flow network } - ort->interZoneMixInstantSeq(state.dataSize->CurOverallSimDay, timeStepInDayGCLH, iZoneGCLH) = + compLoadDayTS.interZoneMixInstantSeq = ((state.dataHeatBal->ZnAirRpt(iZoneGCLH).MixHeatGain - state.dataHeatBal->ZnAirRpt(iZoneGCLH).MixHeatLoss) / TimeStepSysSec); // zone mixing if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { - ort->interZoneMixInstantSeq(state.dataSize->CurOverallSimDay, timeStepInDayGCLH, iZoneGCLH) += - (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixSenGainW - - state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixSenLossW); // air flow network + compLoadDayTS.interZoneMixInstantSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixSenGainW - + state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixSenLossW); // air flow network } - ort->interZoneMixLatentSeq(state.dataSize->CurOverallSimDay, timeStepInDayGCLH, iZoneGCLH) = + compLoadDayTS.interZoneMixLatentSeq = ((state.dataHeatBal->ZnAirRpt(iZoneGCLH).MixLatentGain - state.dataHeatBal->ZnAirRpt(iZoneGCLH).MixLatentLoss) / TimeStepSysSec); // zone mixing if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { - ort->interZoneMixLatentSeq(state.dataSize->CurOverallSimDay, timeStepInDayGCLH, iZoneGCLH) += - (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixLatGainW - - state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixLatLossW); // air flow network + compLoadDayTS.interZoneMixLatentSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixLatGainW - + state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixLatLossW); // air flow network } } } @@ -15101,7 +15043,7 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) powerGenDelaySeq, lightDelaySeq, feneSolarDelaySeq, - ort->feneCondInstantSeq, + ort->spCompLoads[iSpace - 1], surfDelaySeq, spaceComponentAreas(iSpace), zoneNum, @@ -15122,7 +15064,7 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) powerGenDelaySeq, lightDelaySeq, feneSolarDelaySeq, - ort->feneCondInstantSeq, + ort->znCompLoads[iZone - 1], surfDelaySeq, ZoneComponentAreas(iZone), iZone); @@ -15222,7 +15164,7 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) powerGenDelaySeq, lightDelaySeq, feneSolarDelaySeq, - ort->feneCondInstantSeq, + ort->znCompLoads[iZone - 1], surfDelaySeq); ComputeTableBodyUsingMovingAvg(state, airLoopZonesCoolCompLoadTables.cells, @@ -15236,7 +15178,7 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) powerGenDelaySeq, lightDelaySeq, feneSolarDelaySeq, - ort->feneCondInstantSeq, + ort->znCompLoads[iZone - 1], surfDelaySeq); CollectPeakZoneConditions(state, airLoopZonesCoolCompLoadTables, coolDesSelected, timeCoolMax, iZone, true); AddAreaColumnForZone(ZoneComponentAreas(iZone), airLoopZonesCoolCompLoadTables); @@ -15259,7 +15201,7 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) powerGenDelaySeq, lightDelaySeq, feneSolarDelaySeq, - ort->feneCondInstantSeq, + ort->znCompLoads[iZone - 1], surfDelaySeq); ComputeTableBodyUsingMovingAvg(state, airLoopZonesHeatCompLoadTables.cells, @@ -15273,7 +15215,7 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) powerGenDelaySeq, lightDelaySeq, feneSolarDelaySeq, - ort->feneCondInstantSeq, + ort->znCompLoads[iZone - 1], surfDelaySeq); CollectPeakZoneConditions(state, airLoopZonesHeatCompLoadTables, heatDesSelected, timeHeatMax, iZone, false); AddAreaColumnForZone(ZoneComponentAreas(iZone), airLoopZonesHeatCompLoadTables); @@ -15377,7 +15319,7 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) powerGenDelaySeq, lightDelaySeq, feneSolarDelaySeq, - ort->feneCondInstantSeq, + ort->znCompLoads[iZone - 1], surfDelaySeq); ComputeTableBodyUsingMovingAvg(state, facilityZonesCoolCompLoadTables.cells, @@ -15391,7 +15333,7 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) powerGenDelaySeq, lightDelaySeq, feneSolarDelaySeq, - ort->feneCondInstantSeq, + ort->znCompLoads[iZone - 1], surfDelaySeq); CollectPeakZoneConditions(state, facilityZonesCoolCompLoadTables, coolDesSelected, timeCoolMax, iZone, true); AddAreaColumnForZone(ZoneComponentAreas(iZone), facilityZonesCoolCompLoadTables); @@ -15414,7 +15356,7 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) powerGenDelaySeq, lightDelaySeq, feneSolarDelaySeq, - ort->feneCondInstantSeq, + ort->znCompLoads[iZone - 1], surfDelaySeq); ComputeTableBodyUsingMovingAvg(state, facilityZonesHeatCompLoadTables.cells, @@ -15428,7 +15370,7 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) powerGenDelaySeq, lightDelaySeq, feneSolarDelaySeq, - ort->feneCondInstantSeq, + ort->znCompLoads[iZone - 1], surfDelaySeq); CollectPeakZoneConditions(state, facilityZonesHeatCompLoadTables, heatDesSelected, timeHeatMax, iZone, false); AddAreaColumnForZone(ZoneComponentAreas(iZone), facilityZonesHeatCompLoadTables); @@ -15560,7 +15502,7 @@ void computeSpaceZoneCompLoads(EnergyPlusData &state, Array1D &powerGenDelaySeq, Array1D &lightDelaySeq, Array1D &feneSolarDelaySeq, - Array3D &feneCondInstantSeqLoc, + OutputReportTabular::componentLoads &szCompLoadLoc, Array2D &surfDelaySeq, ZompComponentAreasType &componentAreas, int const iZone, @@ -15581,7 +15523,7 @@ void computeSpaceZoneCompLoads(EnergyPlusData &state, powerGenDelaySeq, lightDelaySeq, feneSolarDelaySeq, - feneCondInstantSeqLoc, + szCompLoadLoc, surfDelaySeq); ComputeTableBodyUsingMovingAvg(state, coolCompLoadTables.cells, @@ -15595,7 +15537,7 @@ void computeSpaceZoneCompLoads(EnergyPlusData &state, powerGenDelaySeq, lightDelaySeq, feneSolarDelaySeq, - feneCondInstantSeqLoc, + szCompLoadLoc, surfDelaySeq); CollectPeakZoneConditions(state, coolCompLoadTables, coolDesSelected, timeCoolMax, iZone, true, iSpace); // send latent load info to coil summary report @@ -15617,7 +15559,7 @@ void computeSpaceZoneCompLoads(EnergyPlusData &state, powerGenDelaySeq, lightDelaySeq, feneSolarDelaySeq, - feneCondInstantSeqLoc, + szCompLoadLoc, surfDelaySeq); ComputeTableBodyUsingMovingAvg(state, heatCompLoadTables.cells, @@ -15631,7 +15573,7 @@ void computeSpaceZoneCompLoads(EnergyPlusData &state, powerGenDelaySeq, lightDelaySeq, feneSolarDelaySeq, - feneCondInstantSeqLoc, + szCompLoadLoc, surfDelaySeq); CollectPeakZoneConditions(state, heatCompLoadTables, heatDesSelected, timeHeatMax, iZone, false, iSpace); @@ -15659,7 +15601,7 @@ void GetDelaySequences(EnergyPlusData &state, Array1D &powerGenDelaySeq, Array1D &lightDelaySeq, Array1D &feneSolarDelaySeq, - Array3D &feneCondInstantSeq, + OutputReportTabular::componentLoads &szCompLoadLoc, Array2D &surfDelaySeq) { @@ -15710,14 +15652,15 @@ void GetDelaySequences(EnergyPlusData &state, for (int mStepBack = 1; mStepBack <= kTimeStep; ++mStepBack) { int sourceStep = kTimeStep - mStepBack + 1; + auto &compLoadTS = szCompLoadLoc.day[desDaySelected - 1].ts[sourceStep - 1]; Real64 thisQRadThermInAbsMult = ort->TMULTseq(desDaySelected, sourceStep, radEnclosureNum) * ort->ITABSFseq(desDaySelected, sourceStep, jSurf) * state.dataSurface->Surface(jSurf).Area * decayCurve(mStepBack, jSurf); - peopleConvFromSurf += ort->peopleRadSeq(desDaySelected, sourceStep, zoneIndex) * thisQRadThermInAbsMult; - equipConvFromSurf += ort->equipRadSeq(desDaySelected, sourceStep, zoneIndex) * thisQRadThermInAbsMult; - hvacLossConvFromSurf += ort->hvacLossRadSeq(desDaySelected, sourceStep, zoneIndex) * thisQRadThermInAbsMult; - powerGenConvFromSurf += ort->powerGenRadSeq(desDaySelected, sourceStep, zoneIndex) * thisQRadThermInAbsMult; - lightLWConvFromSurf += ort->lightLWRadSeq(desDaySelected, sourceStep, zoneIndex) * thisQRadThermInAbsMult; + peopleConvFromSurf += compLoadTS.peopleRadSeq * thisQRadThermInAbsMult; + equipConvFromSurf += compLoadTS.equipRadSeq * thisQRadThermInAbsMult; + hvacLossConvFromSurf += compLoadTS.hvacLossRadSeq * thisQRadThermInAbsMult; + powerGenConvFromSurf += compLoadTS.powerGenRadSeq * thisQRadThermInAbsMult; + lightLWConvFromSurf += compLoadTS.lightLWRadSeq * thisQRadThermInAbsMult; // short wave is already accumulated by surface lightSWConvFromSurf += ort->lightSWRadSeq(desDaySelected, sourceStep, jSurf) * decayCurve(mStepBack, jSurf); feneSolarConvFromSurf += ort->feneSolarRadSeq(desDaySelected, sourceStep, jSurf) * decayCurve(mStepBack, jSurf); @@ -15754,7 +15697,7 @@ void GetDelaySequences(EnergyPlusData &state, feneSolarDelaySeq(kTimeStep) = feneSolarConvIntoZone; // also remove the net radiant component on the instanteous conduction for fenestration if (!state.dataOutRptTab->adjFenDone(desDaySelected, kTimeStep, zoneIndex)) { - feneCondInstantSeq(desDaySelected, kTimeStep, zoneIndex) -= adjFeneSurfNetRadSeq; + szCompLoadLoc.day[desDaySelected - 1].ts[kTimeStep - 1].feneCondInstantSeq -= adjFeneSurfNetRadSeq; state.dataOutRptTab->adjFenDone(desDaySelected, kTimeStep, zoneIndex) = true; } } // for kTimeStep @@ -15777,7 +15720,7 @@ void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, Array1D const &powerGenDelaySeq, Array1D const &lightDelaySeq, Array1D const &feneSolarDelaySeq, - Array3D const &feneCondInstantSeq, + OutputReportTabular::componentLoads &szCompLoadLoc, Array2D const &surfDelaySeq) { Array1D AvgData; // sequence data to be averaging @@ -15786,16 +15729,22 @@ void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, resultCells = 0.; resCellsUsd = false; delayOpaque.allocate(LoadCompRow::GrdTot); - AvgData.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); + Real64 numTSinDay = state.dataGlobal->NumOfTimeStepInHour * 24; + AvgData.allocate(numTSinDay); if (desDaySelected != 0 && timeOfMax != 0) { // Don't update/average original array data // PEOPLE - AvgData = state.dataOutRptTab->peopleInstantSeq(desDaySelected, _, zoneIndex); + auto &compLoadDay = szCompLoadLoc.day[desDaySelected - 1]; + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].peopleInstantSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::People) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::People) = true; - AvgData = state.dataOutRptTab->peopleLatentSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].peopleLatentSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::Latent, LoadCompRow::People) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::Latent, LoadCompRow::People) = true; @@ -15805,11 +15754,15 @@ void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, resCellsUsd(LoadCompCol::SensDelay, LoadCompRow::People) = true; // LIGHTS - AvgData = state.dataOutRptTab->lightInstantSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].lightInstantSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::Lights) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::Lights) = true; - AvgData = state.dataOutRptTab->lightRetAirSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].lightRetAirSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensRA, LoadCompRow::Lights) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensRA, LoadCompRow::Lights) = true; @@ -15819,11 +15772,15 @@ void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, resCellsUsd(LoadCompCol::SensDelay, LoadCompRow::Lights) = true; // EQUIPMENT - AvgData = state.dataOutRptTab->equipInstantSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].equipInstantSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::Equip) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::Equip) = true; - AvgData = state.dataOutRptTab->equipLatentSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].equipLatentSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::Latent, LoadCompRow::Equip) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::Latent, LoadCompRow::Equip) = true; @@ -15833,31 +15790,43 @@ void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, resCellsUsd(LoadCompCol::SensDelay, LoadCompRow::Equip) = true; // REFRIGERATION EQUIPMENT - AvgData = state.dataOutRptTab->refrigInstantSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].refrigInstantSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::Refrig) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::Refrig) = true; - AvgData = state.dataOutRptTab->refrigRetAirSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].refrigRetAirSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensRA, LoadCompRow::Refrig) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensRA, LoadCompRow::Refrig) = true; - AvgData = state.dataOutRptTab->refrigLatentSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].refrigLatentSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::Latent, LoadCompRow::Refrig) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::Latent, LoadCompRow::Refrig) = true; // WATER USE EQUIPMENT - AvgData = state.dataOutRptTab->waterUseInstantSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].waterUseInstantSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::WaterUse) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::WaterUse) = true; - AvgData = state.dataOutRptTab->waterUseLatentSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].waterUseLatentSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::Latent, LoadCompRow::WaterUse) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::Latent, LoadCompRow::WaterUse) = true; // HVAC EQUIPMENT LOSSES - AvgData = state.dataOutRptTab->hvacLossInstantSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].hvacLossInstantSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::HvacLoss) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::HvacLoss) = true; @@ -15867,7 +15836,9 @@ void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, resCellsUsd(LoadCompCol::SensDelay, LoadCompRow::HvacLoss) = true; // POWER GENERATION EQUIPMENT - AvgData = state.dataOutRptTab->powerGenInstantSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].powerGenInstantSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::PowerGen) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::PowerGen) = true; @@ -15886,37 +15857,51 @@ void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, resCellsUsd(LoadCompCol::Latent, LoadCompRow::DOAS) = true; // INFILTRATION - AvgData = state.dataOutRptTab->infilInstantSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].infilInstantSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::Infil) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::Infil) = true; - AvgData = state.dataOutRptTab->infilLatentSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].infilLatentSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::Latent, LoadCompRow::Infil) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::Latent, LoadCompRow::Infil) = true; // ZONE VENTILATION - AvgData = state.dataOutRptTab->zoneVentInstantSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].zoneVentInstantSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::ZoneVent) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::ZoneVent) = true; - AvgData = state.dataOutRptTab->zoneVentLatentSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].zoneVentLatentSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::Latent, LoadCompRow::ZoneVent) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::Latent, LoadCompRow::ZoneVent) = true; // INTERZONE MIXING - AvgData = state.dataOutRptTab->interZoneMixInstantSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].interZoneMixInstantSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::IntZonMix) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::IntZonMix) = true; - AvgData = state.dataOutRptTab->interZoneMixLatentSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].interZoneMixLatentSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::Latent, LoadCompRow::IntZonMix) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::Latent, LoadCompRow::IntZonMix) = true; // FENESTRATION CONDUCTION - AvgData = feneCondInstantSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].feneCondInstantSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::FeneCond) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::FeneCond) = true; diff --git a/src/EnergyPlus/OutputReportTabular.hh b/src/EnergyPlus/OutputReportTabular.hh index d60b9691d61..78e50860040 100644 --- a/src/EnergyPlus/OutputReportTabular.hh +++ b/src/EnergyPlus/OutputReportTabular.hh @@ -491,6 +491,53 @@ namespace OutputReportTabular { } }; + struct compLoadsTimeStep + { + Real64 peopleInstantSeq = 0.0; + Real64 peopleLatentSeq = 0.0; + Real64 peopleRadSeq = 0.0; + + Real64 lightInstantSeq = 0.0; + Real64 lightRetAirSeq = 0.0; + Real64 lightLWRadSeq = 0.0; // long wave thermal radiation + + Real64 equipInstantSeq = 0.0; + Real64 equipLatentSeq = 0.0; + Real64 equipRadSeq = 0.0; + + Real64 refrigInstantSeq = 0.0; + Real64 refrigRetAirSeq = 0.0; + Real64 refrigLatentSeq = 0.0; + + Real64 waterUseInstantSeq = 0.0; + Real64 waterUseLatentSeq = 0.0; + + Real64 hvacLossInstantSeq = 0.0; + Real64 hvacLossRadSeq = 0.0; + + Real64 powerGenInstantSeq = 0.0; + Real64 powerGenRadSeq = 0.0; + Real64 infilInstantSeq = 0.0; + Real64 infilLatentSeq = 0.0; + + Real64 zoneVentInstantSeq = 0.0; + Real64 zoneVentLatentSeq = 0.0; + + Real64 interZoneMixInstantSeq = 0.0; + Real64 interZoneMixLatentSeq = 0.0; + + Real64 feneCondInstantSeq = 0.0; + }; + struct compLoadsDay + { + + std::vector ts; + }; + struct componentLoads + { + std::vector day; + }; + // Functions std::ofstream &open_tbl_stream(EnergyPlusData &state, int const iStyle, fs::path const &filePath, bool output_to_file = true); @@ -789,7 +836,7 @@ namespace OutputReportTabular { Array1D &powerGenDelaySeq, Array1D &lightDelaySeq, Array1D &feneSolarDelaySeq, - Array3D &feneCondInstantSeqLoc, + OutputReportTabular::componentLoads &zsCompLoadLoc, Array2D &surfDelaySeq, ZompComponentAreasType &componentAreas, int const iZone, @@ -805,7 +852,7 @@ namespace OutputReportTabular { Array1D &powerGenDelaySeq, Array1D &lightDelaySeq, Array1D &feneSolarDelaySeq, - Array3D &feneCondInstantSeq, + OutputReportTabular::componentLoads &zsCompLoadLoc, Array2D &surfDelaySeq); void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, @@ -820,7 +867,7 @@ namespace OutputReportTabular { Array1D const &powerGenDelaySeq, Array1D const &lightDelaySeq, Array1D const &feneSolarDelaySeq, - Array3D const &feneCondInstantSeqLoc, + OutputReportTabular::componentLoads &zsCompLoadLoc, Array2D const &surfDelaySeq); void CollectPeakZoneConditions( @@ -1183,43 +1230,12 @@ struct OutputReportTabularData : BaseGlobalStruct Array3D ITABSFseq; // used for determining the radiant fraction on each surface Array3D TMULTseq; // used for determining the radiant fraction on each surface - Array3D peopleInstantSeq; - Array3D peopleLatentSeq; - Array3D peopleRadSeq; - - Array3D lightInstantSeq; - Array3D lightRetAirSeq; - Array3D lightLWRadSeq; // long wave thermal radiation Array3D lightSWRadSeq; // short wave visible radiation - - Array3D equipInstantSeq; - Array3D equipLatentSeq; - Array3D equipRadSeq; - - Array3D refrigInstantSeq; - Array3D refrigRetAirSeq; - Array3D refrigLatentSeq; - - Array3D waterUseInstantSeq; - Array3D waterUseLatentSeq; - - Array3D hvacLossInstantSeq; - Array3D hvacLossRadSeq; - - Array3D powerGenInstantSeq; - Array3D powerGenRadSeq; - Array3D infilInstantSeq; - Array3D infilLatentSeq; - - Array3D zoneVentInstantSeq; - Array3D zoneVentLatentSeq; - - Array3D interZoneMixInstantSeq; - Array3D interZoneMixLatentSeq; - - Array3D feneCondInstantSeq; Array3D feneSolarRadSeq; + std::vector znCompLoads; // Zone component loads + std::vector spCompLoads; // Space component loads + int maxUniqueKeyCount = 0; // for the XML report must keep track fo the active sub-table name and report set by other routines @@ -1497,32 +1513,6 @@ struct OutputReportTabularData : BaseGlobalStruct this->decayCurveHeat.deallocate(); this->ITABSFseq.deallocate(); this->TMULTseq.deallocate(); - this->peopleInstantSeq.deallocate(); - this->peopleLatentSeq.deallocate(); - this->peopleRadSeq.deallocate(); - this->lightInstantSeq.deallocate(); - this->lightRetAirSeq.deallocate(); - this->lightLWRadSeq.deallocate(); - this->lightSWRadSeq.deallocate(); - this->equipInstantSeq.deallocate(); - this->equipLatentSeq.deallocate(); - this->equipRadSeq.deallocate(); - this->refrigInstantSeq.deallocate(); - this->refrigRetAirSeq.deallocate(); - this->refrigLatentSeq.deallocate(); - this->waterUseInstantSeq.deallocate(); - this->waterUseLatentSeq.deallocate(); - this->hvacLossInstantSeq.deallocate(); - this->hvacLossRadSeq.deallocate(); - this->powerGenInstantSeq.deallocate(); - this->powerGenRadSeq.deallocate(); - this->infilInstantSeq.deallocate(); - this->infilLatentSeq.deallocate(); - this->zoneVentInstantSeq.deallocate(); - this->zoneVentLatentSeq.deallocate(); - this->interZoneMixInstantSeq.deallocate(); - this->interZoneMixLatentSeq.deallocate(); - this->feneCondInstantSeq.deallocate(); this->feneSolarRadSeq.deallocate(); this->maxUniqueKeyCount = 0; this->activeSubTableName.clear(); diff --git a/tst/EnergyPlus/unit/InternalHeatGains.unit.cc b/tst/EnergyPlus/unit/InternalHeatGains.unit.cc index d44e21eaff8..8c378658dc0 100644 --- a/tst/EnergyPlus/unit/InternalHeatGains.unit.cc +++ b/tst/EnergyPlus/unit/InternalHeatGains.unit.cc @@ -695,13 +695,10 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_CheckZoneComponentLoadSubtotals) state->dataGlobal->CompLoadReportIsReq = true; state->dataGlobal->isPulseZoneSizing = false; InternalHeatGains::GatherComponentLoadsIntGain(*state); - totConvGains = state->dataOutRptTab->peopleInstantSeq(state->dataSize->CurOverallSimDay, timeStepInDay, zoneNum) + - state->dataOutRptTab->lightInstantSeq(state->dataSize->CurOverallSimDay, timeStepInDay, zoneNum) + - state->dataOutRptTab->equipInstantSeq(state->dataSize->CurOverallSimDay, timeStepInDay, zoneNum) + - state->dataOutRptTab->refrigInstantSeq(state->dataSize->CurOverallSimDay, timeStepInDay, zoneNum) + - state->dataOutRptTab->waterUseInstantSeq(state->dataSize->CurOverallSimDay, timeStepInDay, zoneNum) + - state->dataOutRptTab->hvacLossInstantSeq(state->dataSize->CurOverallSimDay, timeStepInDay, zoneNum) + - state->dataOutRptTab->powerGenInstantSeq(state->dataSize->CurOverallSimDay, timeStepInDay, zoneNum); + auto &znCompLoadDayTS = state->dataOutRptTab->znCompLoads[zoneNum - 1].day[state->dataSize->CurOverallSimDay - 1].ts[timeStepInDay - 1]; + totConvGains = znCompLoadDayTS.peopleInstantSeq + znCompLoadDayTS.lightInstantSeq + znCompLoadDayTS.equipInstantSeq + + znCompLoadDayTS.refrigInstantSeq + znCompLoadDayTS.waterUseInstantSeq + znCompLoadDayTS.hvacLossInstantSeq + + znCompLoadDayTS.powerGenInstantSeq; // Legitimate gain types excluded from this total expectedTotConvGains -= diff --git a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc index f87554f7cde..e1d0d7556dd 100644 --- a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc +++ b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc @@ -539,107 +539,14 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_AllocateLoadComponentArraysTes // TMULTseq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); EXPECT_EQ(state->dataOutRptTab->TMULTseq.size(), 1920u); - // peopleInstantSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->peopleInstantSeq.size(), 1920u); - - // peopleLatentSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->peopleLatentSeq.size(), 1920u); - - // peopleRadSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->peopleRadSeq.size(), 1920u); - - // peopleDelaySeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - // EXPECT_EQ( peopleDelaySeq.size(), 1920u ); - - // lightInstantSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->lightInstantSeq.size(), 1920u); - - // lightRetAirSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->lightRetAirSeq.size(), 1920u); - - // lightLWRadSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->lightLWRadSeq.size(), 1920u); + EXPECT_EQ(state->dataOutRptTab->znCompLoads.size(), 4u); + EXPECT_EQ(state->dataOutRptTab->znCompLoads[0].day.size(), 5u); + EXPECT_EQ(state->dataOutRptTab->znCompLoads[0].day[0].ts.size(), 96u); + EXPECT_EQ(state->dataOutRptTab->znCompLoads[3].day.size(), 5u); + EXPECT_EQ(state->dataOutRptTab->znCompLoads[3].day[4].ts.size(), 96u); // lightSWRadSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, TotSurfaces ); EXPECT_EQ(state->dataOutRptTab->lightSWRadSeq.size(), 3360u); - - // lightDelaySeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - // EXPECT_EQ( lightDelaySeq.size(), 1920u ); - - // equipInstantSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->equipInstantSeq.size(), 1920u); - - // equipLatentSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->equipLatentSeq.size(), 1920u); - - // equipRadSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->equipRadSeq.size(), 1920u); - - // equipDelaySeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - // EXPECT_EQ( equipDelaySeq.size(), 1920u ); - - // refrigInstantSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->refrigInstantSeq.size(), 1920u); - - // refrigRetAirSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->refrigRetAirSeq.size(), 1920u); - - // refrigLatentSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->refrigLatentSeq.size(), 1920u); - - // waterUseInstantSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->waterUseInstantSeq.size(), 1920u); - - // waterUseLatentSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->waterUseLatentSeq.size(), 1920u); - - // hvacLossInstantSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->hvacLossInstantSeq.size(), 1920u); - - // hvacLossRadSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->hvacLossRadSeq.size(), 1920u); - - // hvacLossDelaySeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - // EXPECT_EQ( hvacLossDelaySeq.size(), 1920u ); - - // powerGenInstantSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->powerGenInstantSeq.size(), 1920u); - - // powerGenRadSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->powerGenRadSeq.size(), 1920u); - - // powerGenDelaySeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - // EXPECT_EQ( powerGenDelaySeq.size(), 1920u ); - - // infilInstantSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->infilInstantSeq.size(), 1920u); - - // infilLatentSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->infilLatentSeq.size(), 1920u); - - // zoneVentInstantSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->zoneVentInstantSeq.size(), 1920u); - - // zoneVentLatentSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->zoneVentLatentSeq.size(), 1920u); - - // interZoneMixInstantSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->interZoneMixInstantSeq.size(), 1920u); - - // interZoneMixLatentSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->interZoneMixLatentSeq.size(), 1920u); - - // feneCondInstantSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->feneCondInstantSeq.size(), 1920u); - - // feneSolarRadSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, TotSurfaces ); - EXPECT_EQ(state->dataOutRptTab->feneSolarRadSeq.size(), 3360u); - - // feneSolarDelaySeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - // EXPECT_EQ( feneSolarDelaySeq.size(), 1920u ); - - // surfDelaySeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, TotSurfaces ); - // EXPECT_EQ( surfDelaySeq.size(), 3360u ); } TEST_F(EnergyPlusFixture, OutputReportTabularTest_ConfirmConvertToEscaped) @@ -7030,11 +6937,11 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesTwice_test) feneSolarDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); feneSolarDelaySeqCool = 0.; - Array3D feneCondInstantSeq; - feneCondInstantSeq.allocate(state->dataEnvrn->TotDesDays + state->dataEnvrn->TotRunDesPersDays, - state->dataGlobal->NumOfTimeStepInHour * 24, - state->dataViewFactor->NumOfRadiantEnclosures); - feneCondInstantSeq = 0.0; + //Array3D feneCondInstantSeq; + //feneCondInstantSeq.allocate(state->dataEnvrn->TotDesDays + state->dataEnvrn->TotRunDesPersDays, + // state->dataGlobal->NumOfTimeStepInHour * 24, + // state->dataViewFactor->NumOfRadiantEnclosures); + //feneCondInstantSeq = 0.0; Array2D surfDelaySeqCool; surfDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24, state->dataSurface->TotSurfaces); @@ -7042,7 +6949,8 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesTwice_test) AllocateLoadComponentArrays(*state); - feneCondInstantSeq(coolDesSelected, 1, 1) = 0.88; + auto &znCL = state->dataOutRptTab->znCompLoads[iZone - 1]; + znCL.day[coolDesSelected - 1].ts[0].feneCondInstantSeq = 0.88; state->dataOutRptTab->netSurfRadSeq(coolDesSelected, 1, 1) = 0.05; @@ -7056,10 +6964,11 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesTwice_test) powerGenDelaySeqCool, lightDelaySeqCool, feneSolarDelaySeqCool, - feneCondInstantSeq, + znCL, surfDelaySeqCool); - EXPECT_EQ(0.83, feneCondInstantSeq(coolDesSelected, 1, 1)); // the first time the subtraction operation should have occurred + EXPECT_EQ(0.83, + znCL.day[coolDesSelected - 1].ts[0].feneCondInstantSeq); // the first time the subtraction operation should have occurred GetDelaySequences(*state, coolDesSelected, @@ -7071,14 +6980,12 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesTwice_test) powerGenDelaySeqCool, lightDelaySeqCool, feneSolarDelaySeqCool, - feneCondInstantSeq, + znCL, surfDelaySeqCool); EXPECT_EQ(0.83, - feneCondInstantSeq( - coolDesSelected, - 1, - 1)); // the second time the subtraction should not have happened since it is only adjusted once so the value should be the same. + znCL.day[coolDesSelected - 1].ts[0].feneCondInstantSeq); // the second time the subtraction should not have happened since it is + // only adjusted once so the value should be the same. } TEST_F(SQLiteFixture, OutputReportTabular_WriteLoadComponentSummaryTables_AirLoop_ZeroDesignDay) @@ -7235,10 +7142,7 @@ TEST_F(SQLiteFixture, OutputReportTabular_WriteLoadComponentSummaryTables_AirLoo state->dataSize->SysSizInput.allocate(state->dataSize->NumSysSizInput); state->dataSize->SysSizInput(1).AirLoopNum = 1; state->dataSize->SysSizInput(1).SizingOption = DataSizing::SizingConcurrence::NonCoincident; - auto degC_to_F = [](Real64 celsius) constexpr - { - return celsius * (9.0 / 5.0) + 32.0; - }; + auto degC_to_F = [](Real64 celsius) constexpr { return celsius * (9.0 / 5.0) + 32.0; }; constexpr Real64 coolMixTempSys = 26.2; constexpr Real64 coolMixTempSysIP = degC_to_F(coolMixTempSys); constexpr Real64 heatMixTempSys = -1.7; @@ -8441,16 +8345,18 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesSurfaceOrder_ state->dataSurface->Surface(3).RadEnclIndex = 1; state->dataSurface->Surface(4).RadEnclIndex = 1; + auto &znCL = state->dataOutRptTab->znCompLoads[iZone - 1]; for (int jSurf = 1; jSurf <= 4; ++jSurf) { for (int step = 1; step <= 10; ++step) { + auto &znCLDayTS = znCL.day[coolDesSelected - 1].ts[step - 1]; state->dataOutRptTab->TMULTseq(coolDesSelected, step, radEnclosureNum) = 0.1 * step; state->dataOutRptTab->ITABSFseq(coolDesSelected, step, jSurf) = 0.2 * step * surfBaseValue[jSurf - 1]; state->dataOutRptTab->decayCurveCool(step, jSurf) = 0.3 * step * surfBaseValue[jSurf - 1]; - state->dataOutRptTab->peopleRadSeq(coolDesSelected, step, iZone) = 0.4 * step; - state->dataOutRptTab->equipRadSeq(coolDesSelected, step, iZone) = 0.5 * step; - state->dataOutRptTab->hvacLossRadSeq(coolDesSelected, step, iZone) = 0.6 * step; - state->dataOutRptTab->powerGenRadSeq(coolDesSelected, step, iZone) = 0.7 * step; - state->dataOutRptTab->lightLWRadSeq(coolDesSelected, step, iZone) = 0.8 * step; + znCLDayTS.peopleRadSeq = 0.4 * step; + znCLDayTS.equipRadSeq = 0.5 * step; + znCLDayTS.hvacLossRadSeq = 0.6 * step; + znCLDayTS.powerGenRadSeq = 0.7 * step; + znCLDayTS.lightLWRadSeq = 0.8 * step; } } @@ -8464,7 +8370,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesSurfaceOrder_ powerGenDelaySeqCool, lightDelaySeqCool, feneSolarDelaySeqCool, - feneCondInstantSeq, + znCL, surfDelaySeqCool); // Save some results from first pass @@ -8496,14 +8402,15 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesSurfaceOrder_ for (int jSurf = 1; jSurf <= 4; ++jSurf) { for (int step = 1; step <= 10; ++step) { + auto &znCLDayTS = znCL.day[coolDesSelected - 1].ts[step - 1]; state->dataOutRptTab->TMULTseq(coolDesSelected, step, radEnclosureNum) = 0.1 * step; state->dataOutRptTab->ITABSFseq(coolDesSelected, step, jSurf) = 0.2 * step * surfBaseValue[jSurf - 1]; state->dataOutRptTab->decayCurveCool(step, jSurf) = 0.3 * step * surfBaseValue[jSurf - 1]; - state->dataOutRptTab->peopleRadSeq(coolDesSelected, step, iZone) = 0.4 * step; - state->dataOutRptTab->equipRadSeq(coolDesSelected, step, iZone) = 0.5 * step; - state->dataOutRptTab->hvacLossRadSeq(coolDesSelected, step, iZone) = 0.6 * step; - state->dataOutRptTab->powerGenRadSeq(coolDesSelected, step, iZone) = 0.7 * step; - state->dataOutRptTab->lightLWRadSeq(coolDesSelected, step, iZone) = 0.8 * step; + znCLDayTS.peopleRadSeq = 0.4 * step; + znCLDayTS.equipRadSeq = 0.5 * step; + znCLDayTS.hvacLossRadSeq = 0.6 * step; + znCLDayTS.powerGenRadSeq = 0.7 * step; + znCLDayTS.lightLWRadSeq = 0.8 * step; } } @@ -8517,7 +8424,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesSurfaceOrder_ powerGenDelaySeqCool, lightDelaySeqCool, feneSolarDelaySeqCool, - feneCondInstantSeq, + znCL, surfDelaySeqCool); // Save some results from second pass From a9a35c9a140d26378e2040662f7a639456fdfcfc Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Mon, 23 Sep 2024 10:54:39 -0500 Subject: [PATCH 10/25] Space IV.6 - unwind some 3D comp loads arrays cleanup --- tst/EnergyPlus/unit/OutputReportTabular.unit.cc | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc index e1d0d7556dd..aa9b4598671 100644 --- a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc +++ b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc @@ -6937,12 +6937,6 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesTwice_test) feneSolarDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); feneSolarDelaySeqCool = 0.; - //Array3D feneCondInstantSeq; - //feneCondInstantSeq.allocate(state->dataEnvrn->TotDesDays + state->dataEnvrn->TotRunDesPersDays, - // state->dataGlobal->NumOfTimeStepInHour * 24, - // state->dataViewFactor->NumOfRadiantEnclosures); - //feneCondInstantSeq = 0.0; - Array2D surfDelaySeqCool; surfDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24, state->dataSurface->TotSurfaces); surfDelaySeqCool = 0.0; @@ -8314,12 +8308,6 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesSurfaceOrder_ feneSolarDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); feneSolarDelaySeqCool = 0.; - Array3D feneCondInstantSeq; - feneCondInstantSeq.allocate(state->dataEnvrn->TotDesDays + state->dataEnvrn->TotRunDesPersDays, - state->dataGlobal->NumOfTimeStepInHour * 24, - state->dataViewFactor->NumOfRadiantEnclosures); - feneCondInstantSeq = 0.0; - Array2D surfDelaySeqCool; surfDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24, state->dataSurface->TotSurfaces); surfDelaySeqCool = 0.0; From 634d933f7dc71c3c69a96cd50c1ddc5ebb7d6d43 Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Mon, 23 Sep 2024 12:46:54 -0500 Subject: [PATCH 11/25] Space IV.6 - fix ZoneRefrigerationDoorMixing diffs --- src/EnergyPlus/HVACManager.cc | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/EnergyPlus/HVACManager.cc b/src/EnergyPlus/HVACManager.cc index debefd893f2..a33bc0d7109 100644 --- a/src/EnergyPlus/HVACManager.cc +++ b/src/EnergyPlus/HVACManager.cc @@ -2602,12 +2602,12 @@ void reportAirHeatBal2(EnergyPlusData &state, if (refDoorMixing.VolRefDoorFlowRate(j) > 0.0) { // int ZoneB = refDoorMixing.MateZonePtr(j); // auto const &zoneBHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneB); - Real64 const szBMAT = (refDoorMixing.spaceIndex == 0) - ? state.dataZoneTempPredictorCorrector->zoneHeatBalance(refDoorMixing.ZonePtr).MAT - : state.dataZoneTempPredictorCorrector->spaceHeatBalance(refDoorMixing.spaceIndex).MAT; + Real64 const szBMAT = (refDoorMixing.fromSpaceIndex == 0) + ? state.dataZoneTempPredictorCorrector->zoneHeatBalance(refDoorMixing.MateZonePtr(j)).MAT + : state.dataZoneTempPredictorCorrector->spaceHeatBalance(refDoorMixing.fromSpaceIndex).MAT; Real64 const szBHumRat = (refDoorMixing.fromSpaceIndex == 0) - ? state.dataZoneTempPredictorCorrector->zoneHeatBalance(refDoorMixing.ZonePtr).airHumRat - : state.dataZoneTempPredictorCorrector->spaceHeatBalance(refDoorMixing.spaceIndex).airHumRat; + ? state.dataZoneTempPredictorCorrector->zoneHeatBalance(refDoorMixing.MateZonePtr(j)).airHumRat + : state.dataZoneTempPredictorCorrector->spaceHeatBalance(refDoorMixing.fromSpaceIndex).airHumRat; AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, (szHeatBal.MAT + szBMAT) / 2.0, @@ -2629,7 +2629,6 @@ void reportAirHeatBal2(EnergyPlusData &state, } // zone A (zoneptr = zoneNum) for (int ZoneA = 1; ZoneA <= (zoneNum - 1); ++ZoneA) { auto &refDoorMixingA = state.dataHeatBal->RefDoorMixing(ZoneA); - auto const &zoneAHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneA); // Capture impact when zoneNum is the 'mating zone' // that is, the zone of a pair with the higher zone number(matezoneptr = zoneNum) if (refDoorMixingA.RefDoorMixFlag) { @@ -2637,14 +2636,21 @@ void reportAirHeatBal2(EnergyPlusData &state, if (((spaceNum == 0) && (refDoorMixingA.MateZonePtr(j) == zoneNum)) || ((spaceNum == 0) && (refDoorMixingA.fromSpaceIndex == spaceNum))) { if (refDoorMixingA.VolRefDoorFlowRate(j) > 0.0) { + // auto const &zoneAHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneA); + Real64 const szAMAT = (refDoorMixingA.spaceIndex == 0) + ? state.dataZoneTempPredictorCorrector->zoneHeatBalance(refDoorMixingA.ZonePtr).MAT + : state.dataZoneTempPredictorCorrector->spaceHeatBalance(refDoorMixingA.spaceIndex).MAT; + Real64 const szAHumRat = + (refDoorMixingA.spaceIndex == 0) + ? state.dataZoneTempPredictorCorrector->zoneHeatBalance(refDoorMixingA.ZonePtr).airHumRat + : state.dataZoneTempPredictorCorrector->spaceHeatBalance(refDoorMixingA.spaceIndex).airHumRat; AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, - (szHeatBal.MAT + zoneAHB.MAT) / 2.0, - (szHeatBal.airHumRat + zoneAHB.airHumRat) / 2.0, + (szHeatBal.MAT + szAMAT) / 2.0, + (szHeatBal.airHumRat + szAHumRat) / 2.0, std::string()); - CpAir = Psychrometrics::PsyCpAirFnW((szHeatBal.airHumRat + zoneAHB.airHumRat) / 2.0); - H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb((szHeatBal.airHumRat + zoneAHB.airHumRat) / 2.0, - (szHeatBal.MAT + zoneAHB.MAT) / 2.0); + CpAir = Psychrometrics::PsyCpAirFnW((szHeatBal.airHumRat + szAHumRat) / 2.0); + H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb((szHeatBal.airHumRat + szAHumRat) / 2.0, (szHeatBal.MAT + szAMAT) / 2.0); szAirRpt.MixVolume += refDoorMixingA.VolRefDoorFlowRate(j) * state.dataHVACGlobal->TimeStepSysSec * ADSCorrectionFactor; szAirRpt.MixVdotCurDensity += refDoorMixingA.VolRefDoorFlowRate(j) * ADSCorrectionFactor; @@ -2653,9 +2659,9 @@ void reportAirHeatBal2(EnergyPlusData &state, szAirRpt.MixMdot += refDoorMixingA.VolRefDoorFlowRate(j) * AirDensity * ADSCorrectionFactor; szAirRpt.MixVdotStdDensity += refDoorMixingA.VolRefDoorFlowRate(j) * (AirDensity / state.dataEnvrn->StdRhoAir) * ADSCorrectionFactor; - szAirRpt.MixSenLoad += refDoorMixingA.VolRefDoorFlowRate(j) * AirDensity * CpAir * (szHeatBal.MAT - zoneAHB.MAT); + szAirRpt.MixSenLoad += refDoorMixingA.VolRefDoorFlowRate(j) * AirDensity * CpAir * (szHeatBal.MAT - szAMAT); szAirRpt.MixLatLoad += - refDoorMixingA.VolRefDoorFlowRate(j) * AirDensity * (szHeatBal.airHumRat - zoneAHB.airHumRat) * H2OHtOfVap; + refDoorMixingA.VolRefDoorFlowRate(j) * AirDensity * (szHeatBal.airHumRat - szAHumRat) * H2OHtOfVap; } // volflowrate > 0 } // matezoneptr (zoneB) = Zonelooop } // NumRefDoorConnections From 9d8ee7156a81b2fa8d99656802f581d612a75d5b Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Mon, 23 Sep 2024 17:06:38 -0500 Subject: [PATCH 12/25] Space IV.6 - unwind 3D comp loads arrays fix fenestration --- src/EnergyPlus/OutputReportTabular.cc | 45 ++++++++++++++++++--------- src/EnergyPlus/OutputReportTabular.hh | 3 +- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index 0d05e6100c0..c6a2363c4ed 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -14711,14 +14711,27 @@ void GatherComponentLoadsSurface(EnergyPlusData &state) auto &day = zoneCL.day[state.dataSize->CurOverallSimDay - 1]; day.ts[timeStepInDayGCLS - 1].feneCondInstantSeq = 0.0; } + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + for (auto &spaceCL : ort->spCompLoads) { + auto &day = spaceCL.day[state.dataSize->CurOverallSimDay - 1]; + day.ts[timeStepInDayGCLS - 1].feneCondInstantSeq = 0.0; + } + } for (int iSurfGCLS = 1; iSurfGCLS <= state.dataSurface->TotSurfaces; ++iSurfGCLS) { int zoneNumGCLS = state.dataSurface->Surface(iSurfGCLS).Zone; if (zoneNumGCLS == 0) continue; if (state.dataSurface->Surface(iSurfGCLS).Class != DataSurfaces::SurfaceClass::Window) continue; // IF (.not. ZoneEquipConfig(ZoneNum)%IsControlled) CYCLE - ort->znCompLoads[zoneNumGCLS - 1].day[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLS - 1].feneCondInstantSeq += - state.dataSurface->SurfWinGainConvGlazToZoneRep(iSurfGCLS) + state.dataSurface->SurfWinConvHeatFlowNatural(iSurfGCLS) + - state.dataSurface->SurfWinGainConvShadeToZoneRep(iSurfGCLS) + state.dataSurface->SurfWinGainFrameDividerToZoneRep(iSurfGCLS); + Real64 surfCond = state.dataSurface->SurfWinGainConvGlazToZoneRep(iSurfGCLS) + state.dataSurface->SurfWinConvHeatFlowNatural(iSurfGCLS) + + state.dataSurface->SurfWinGainConvShadeToZoneRep(iSurfGCLS) + + state.dataSurface->SurfWinGainFrameDividerToZoneRep(iSurfGCLS); + ort->znCompLoads[zoneNumGCLS - 1].day[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLS - 1].feneCondInstantSeq += surfCond; + + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + int spaceNum = state.dataSurface->Surface(iSurfGCLS).spaceNum; + ort->spCompLoads[spaceNum - 1].day[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLS - 1].feneCondInstantSeq += surfCond; + } + // for now assume zero instant solar - may change related // to how blinds and shades absorb solar radiation and // convect that heat that timestep. @@ -14728,8 +14741,18 @@ void GatherComponentLoadsSurface(EnergyPlusData &state) for (int izone = 1; izone <= state.dataGlobal->NumOfZones; ++izone) { Real64 tubularGain = 0.0; tubularGain = InternalHeatGains::SumInternalConvectionGainsByTypes(state, izone, OutputReportTabular::IntGainTypesTubularGCLS); + Real64 fenCISeq = ort->znCompLoads[izone - 1].day[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLS - 1].feneCondInstantSeq; ort->znCompLoads[izone - 1].day[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLS - 1].feneCondInstantSeq += tubularGain; } + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + for (int ispace = 1; ispace <= state.dataGlobal->NumOfZones; ++ispace) { + Real64 tubularGain = 0.0; + int zone = state.dataHeatBal->space(ispace).zoneNum; + tubularGain = InternalHeatGains::SumInternalConvectionGainsByTypes(state, zone, OutputReportTabular::IntGainTypesTubularGCLS, ispace); + Real64 fenCISeq = ort->znCompLoads[ispace - 1].day[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLS - 1].feneCondInstantSeq; + ort->znCompLoads[ispace - 1].day[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLS - 1].feneCondInstantSeq += tubularGain; + } + } } } @@ -15608,14 +15631,6 @@ void GetDelaySequences(EnergyPlusData &state, // static bool initAdjFenDone(false); moved to anonymous namespace for unit testing auto &ort = state.dataOutRptTab; - if (!ort->initAdjFenDone) { - state.dataOutRptTab->adjFenDone.allocate(state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, - state.dataGlobal->NumOfTimeStepInHour * 24, - state.dataGlobal->NumOfZones); - state.dataOutRptTab->adjFenDone = false; - ort->initAdjFenDone = true; - } - if (desDaySelected != 0) { Array2D decayCurve; @@ -15696,9 +15711,11 @@ void GetDelaySequences(EnergyPlusData &state, lightDelaySeq(kTimeStep) = lightLWConvIntoZone + lightSWConvIntoZone; feneSolarDelaySeq(kTimeStep) = feneSolarConvIntoZone; // also remove the net radiant component on the instanteous conduction for fenestration - if (!state.dataOutRptTab->adjFenDone(desDaySelected, kTimeStep, zoneIndex)) { - szCompLoadLoc.day[desDaySelected - 1].ts[kTimeStep - 1].feneCondInstantSeq -= adjFeneSurfNetRadSeq; - state.dataOutRptTab->adjFenDone(desDaySelected, kTimeStep, zoneIndex) = true; + auto &szCompLoadDayTS = szCompLoadLoc.day[desDaySelected - 1].ts[kTimeStep - 1]; + if (!szCompLoadDayTS.adjFenDone) { + Real64 fenCISeq = szCompLoadDayTS.feneCondInstantSeq; + szCompLoadDayTS.feneCondInstantSeq -= adjFeneSurfNetRadSeq; + szCompLoadDayTS.adjFenDone = true; } } // for kTimeStep diff --git a/src/EnergyPlus/OutputReportTabular.hh b/src/EnergyPlus/OutputReportTabular.hh index 78e50860040..10717cc2cd4 100644 --- a/src/EnergyPlus/OutputReportTabular.hh +++ b/src/EnergyPlus/OutputReportTabular.hh @@ -527,6 +527,7 @@ namespace OutputReportTabular { Real64 interZoneMixLatentSeq = 0.0; Real64 feneCondInstantSeq = 0.0; + bool adjFenDone = false; }; struct compLoadsDay { @@ -1348,7 +1349,6 @@ struct OutputReportTabularData : BaseGlobalStruct int TimeOfPulseCLCDC = 0; int CoolDesSelectedCLCDC = 0; // design day selected for cooling int HeatDesSelectedCLCDC = 0; // design day selected for heating - Array3D_bool adjFenDone; Real64 BigNumRMG = 0.0; int foundGsui = 0; int iUnitGsui = 0; @@ -1623,7 +1623,6 @@ struct OutputReportTabularData : BaseGlobalStruct this->TimeOfPulseCLCDC = 0; this->CoolDesSelectedCLCDC = 0; // design day selected for cooling this->HeatDesSelectedCLCDC = 0; // design day selected for heating - this->adjFenDone.clear(); this->BigNumRMG = 0.0; this->foundGsui = 0; this->iUnitGsui = 0; From 77e436d39a69b45a100f74fde1304c401e0ed3bc Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Mon, 23 Sep 2024 17:10:15 -0500 Subject: [PATCH 13/25] Clear debug code --- src/EnergyPlus/OutputReportTabular.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index c6a2363c4ed..ce1076db649 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -14741,7 +14741,6 @@ void GatherComponentLoadsSurface(EnergyPlusData &state) for (int izone = 1; izone <= state.dataGlobal->NumOfZones; ++izone) { Real64 tubularGain = 0.0; tubularGain = InternalHeatGains::SumInternalConvectionGainsByTypes(state, izone, OutputReportTabular::IntGainTypesTubularGCLS); - Real64 fenCISeq = ort->znCompLoads[izone - 1].day[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLS - 1].feneCondInstantSeq; ort->znCompLoads[izone - 1].day[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLS - 1].feneCondInstantSeq += tubularGain; } if (state.dataHeatBal->doSpaceHeatBalanceSizing) { @@ -14749,7 +14748,6 @@ void GatherComponentLoadsSurface(EnergyPlusData &state) Real64 tubularGain = 0.0; int zone = state.dataHeatBal->space(ispace).zoneNum; tubularGain = InternalHeatGains::SumInternalConvectionGainsByTypes(state, zone, OutputReportTabular::IntGainTypesTubularGCLS, ispace); - Real64 fenCISeq = ort->znCompLoads[ispace - 1].day[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLS - 1].feneCondInstantSeq; ort->znCompLoads[ispace - 1].day[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLS - 1].feneCondInstantSeq += tubularGain; } } @@ -15713,7 +15711,6 @@ void GetDelaySequences(EnergyPlusData &state, // also remove the net radiant component on the instanteous conduction for fenestration auto &szCompLoadDayTS = szCompLoadLoc.day[desDaySelected - 1].ts[kTimeStep - 1]; if (!szCompLoadDayTS.adjFenDone) { - Real64 fenCISeq = szCompLoadDayTS.feneCondInstantSeq; szCompLoadDayTS.feneCondInstantSeq -= adjFeneSurfNetRadSeq; szCompLoadDayTS.adjFenDone = true; } From 075de46ac80b634da56384a00e827e53298071ea Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Tue, 24 Sep 2024 13:50:06 -0500 Subject: [PATCH 14/25] Space IV.6 - component loads gather HVAC --- src/EnergyPlus/OutputReportTabular.cc | 89 ++++++++++++++------------- src/EnergyPlus/OutputReportTabular.hh | 4 ++ 2 files changed, 49 insertions(+), 44 deletions(-) diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index ce1076db649..c79ff347a35 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -14769,58 +14769,59 @@ void GatherComponentLoadsHVAC(EnergyPlusData &state) if (!(state.dataGlobal->CompLoadReportIsReq && !state.dataGlobal->isPulseZoneSizing)) { return; } - auto &ort = state.dataOutRptTab; - Real64 const TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; int timeStepInDayGCLH = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; for (int iZoneGCLH = 1; iZoneGCLH <= state.dataGlobal->NumOfZones; ++iZoneGCLH) { - auto &compLoadDayTS = ort->znCompLoads[iZoneGCLH - 1].day[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLH - 1]; - compLoadDayTS.infilInstantSeq = - ((state.dataHeatBal->ZnAirRpt(iZoneGCLH).InfilHeatGain - state.dataHeatBal->ZnAirRpt(iZoneGCLH).InfilHeatLoss) / - TimeStepSysSec); // zone infiltration - if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { - compLoadDayTS.infilInstantSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiSenGainW - - state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiSenLossW); // air flow network - } - compLoadDayTS.infilLatentSeq = - ((state.dataHeatBal->ZnAirRpt(iZoneGCLH).InfilLatentGain - state.dataHeatBal->ZnAirRpt(iZoneGCLH).InfilLatentLoss) / - TimeStepSysSec); // zone infiltration - if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { - compLoadDayTS.infilLatentSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiLatGainW - - state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiLatLossW); // air flow network - } - - compLoadDayTS.zoneVentInstantSeq = - ((state.dataHeatBal->ZnAirRpt(iZoneGCLH).VentilHeatGain - state.dataHeatBal->ZnAirRpt(iZoneGCLH).VentilHeatLoss) / - TimeStepSysSec); // zone ventilation - if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { - compLoadDayTS.zoneVentInstantSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentSenGainW - - state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentSenLossW); // air flow network - } - compLoadDayTS.zoneVentLatentSeq = - ((state.dataHeatBal->ZnAirRpt(iZoneGCLH).VentilLatentGain - state.dataHeatBal->ZnAirRpt(iZoneGCLH).VentilLatentLoss) / - TimeStepSysSec); // zone ventilation - if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { - compLoadDayTS.zoneVentInstantSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentLatGainW - - state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentLatLossW); // air flow network - } - - compLoadDayTS.interZoneMixInstantSeq = - ((state.dataHeatBal->ZnAirRpt(iZoneGCLH).MixHeatGain - state.dataHeatBal->ZnAirRpt(iZoneGCLH).MixHeatLoss) / - TimeStepSysSec); // zone mixing + auto &zoneCompLoadDayTS = state.dataOutRptTab->znCompLoads[iZoneGCLH - 1].day[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLH - 1]; + auto &zoneAirRpt = state.dataHeatBal->ZnAirRpt(iZoneGCLH); + gatherSpaceZoneCompLoadsHVAC(zoneCompLoadDayTS, zoneAirRpt, state.dataHVACGlobal->TimeStepSysSec); if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { - compLoadDayTS.interZoneMixInstantSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixSenGainW - - state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixSenLossW); // air flow network + zoneCompLoadDayTS.infilInstantSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiSenGainW - + state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiSenLossW); // air flow network + zoneCompLoadDayTS.infilLatentSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiLatGainW - + state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiLatLossW); // air flow network + zoneCompLoadDayTS.zoneVentInstantSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentSenGainW - + state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentSenLossW); // air flow network + zoneCompLoadDayTS.zoneVentInstantSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentLatGainW - + state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentLatLossW); // air flow network + zoneCompLoadDayTS.interZoneMixInstantSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixSenGainW - + state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixSenLossW); // air flow network + zoneCompLoadDayTS.interZoneMixLatentSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixLatGainW - + state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixLatLossW); // air flow network } - compLoadDayTS.interZoneMixLatentSeq = - ((state.dataHeatBal->ZnAirRpt(iZoneGCLH).MixLatentGain - state.dataHeatBal->ZnAirRpt(iZoneGCLH).MixLatentLoss) / - TimeStepSysSec); // zone mixing - if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { - compLoadDayTS.interZoneMixLatentSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixLatGainW - - state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixLatLossW); // air flow network + } + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + for (int iSpace = 1; iSpace <= state.dataGlobal->numSpaces; ++iSpace) { + auto &spaceCompLoadDayTS = + state.dataOutRptTab->spCompLoads[iSpace - 1].day[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLH - 1]; + auto &spaceAirRpt = state.dataHeatBal->spaceAirRpt(iSpace); + gatherSpaceZoneCompLoadsHVAC(spaceCompLoadDayTS, spaceAirRpt, state.dataHVACGlobal->TimeStepSysSec); + if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { + auto &space = state.dataHeatBal->space(iSpace); + auto const &zoneCompLoadDayTS = + state.dataOutRptTab->znCompLoads[space.zoneNum - 1].day[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLH - 1]; + spaceCompLoadDayTS.infilInstantSeq = space.fracZoneVolume * zoneCompLoadDayTS.infilInstantSeq; + spaceCompLoadDayTS.infilLatentSeq = space.fracZoneVolume * zoneCompLoadDayTS.infilLatentSeq; + spaceCompLoadDayTS.zoneVentInstantSeq = space.fracZoneVolume * zoneCompLoadDayTS.zoneVentInstantSeq; + spaceCompLoadDayTS.zoneVentInstantSeq = space.fracZoneVolume * zoneCompLoadDayTS.zoneVentInstantSeq; + spaceCompLoadDayTS.interZoneMixInstantSeq = space.fracZoneVolume * zoneCompLoadDayTS.interZoneMixInstantSeq; + spaceCompLoadDayTS.interZoneMixLatentSeq = space.fracZoneVolume * zoneCompLoadDayTS.interZoneMixLatentSeq; + } } } } +void gatherSpaceZoneCompLoadsHVAC(OutputReportTabular::compLoadsTimeStep &compLoadDayTS, + DataHeatBalance::AirReportVars const &szAirRpt, + Real64 const timeStepSysSec) +{ + compLoadDayTS.infilInstantSeq = ((szAirRpt.InfilHeatGain - szAirRpt.InfilHeatLoss) / timeStepSysSec); // zone infiltration + compLoadDayTS.infilLatentSeq = ((szAirRpt.InfilLatentGain - szAirRpt.InfilLatentLoss) / timeStepSysSec); // zone infiltration + compLoadDayTS.zoneVentInstantSeq = ((szAirRpt.VentilHeatGain - szAirRpt.VentilHeatLoss) / timeStepSysSec); // zone ventilation + compLoadDayTS.zoneVentLatentSeq = ((szAirRpt.VentilLatentGain - szAirRpt.VentilLatentLoss) / timeStepSysSec); // zone ventilation + compLoadDayTS.interZoneMixInstantSeq = ((szAirRpt.MixHeatGain - szAirRpt.MixHeatLoss) / timeStepSysSec); // zone mixing + compLoadDayTS.interZoneMixLatentSeq = ((szAirRpt.MixLatentGain - szAirRpt.MixLatentLoss) / timeStepSysSec); // zone mixing +} + void WriteLoadComponentSummaryTables(EnergyPlusData &state) { // SUBROUTINE INFORMATION: diff --git a/src/EnergyPlus/OutputReportTabular.hh b/src/EnergyPlus/OutputReportTabular.hh index 10717cc2cd4..8ee723d1124 100644 --- a/src/EnergyPlus/OutputReportTabular.hh +++ b/src/EnergyPlus/OutputReportTabular.hh @@ -825,6 +825,10 @@ namespace OutputReportTabular { void GatherComponentLoadsHVAC(EnergyPlusData &state); + void gatherSpaceZoneCompLoadsHVAC(OutputReportTabular::compLoadsTimeStep &compLoadDayTS, + DataHeatBalance::AirReportVars const &szAirRpt, + Real64 const timeStepSysSec); + void WriteLoadComponentSummaryTables(EnergyPlusData &state); void computeSpaceZoneCompLoads(EnergyPlusData &state, From 70e9cc4ef2bb22260875cca99c88d62594470159 Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Tue, 24 Sep 2024 13:58:08 -0500 Subject: [PATCH 15/25] Delete stray Array3D includes --- src/EnergyPlus/CurveManager.cc | 1 - src/EnergyPlus/DataDaylighting.hh | 1 - src/EnergyPlus/DataHeatBalSurface.hh | 1 - src/EnergyPlus/DaylightingManager.hh | 1 - src/EnergyPlus/OutputReportData.cc | 1 - src/EnergyPlus/OutputReportData.hh | 1 - src/EnergyPlus/OutputReportTabularAnnual.cc | 1 - src/EnergyPlus/OutputReportTabularAnnual.hh | 1 - src/EnergyPlus/WeatherManager.hh | 1 - src/EnergyPlus/WindowManager.hh | 1 - 10 files changed, 10 deletions(-) diff --git a/src/EnergyPlus/CurveManager.cc b/src/EnergyPlus/CurveManager.cc index 77a0e811884..e9eed686aaf 100644 --- a/src/EnergyPlus/CurveManager.cc +++ b/src/EnergyPlus/CurveManager.cc @@ -53,7 +53,6 @@ // ObjexxFCL Headers #include -#include #include // Third-party Headers diff --git a/src/EnergyPlus/DataDaylighting.hh b/src/EnergyPlus/DataDaylighting.hh index 36b8c0a78c4..2c1e250ead0 100644 --- a/src/EnergyPlus/DataDaylighting.hh +++ b/src/EnergyPlus/DataDaylighting.hh @@ -51,7 +51,6 @@ // ObjexxFCL Headers #include #include -#include // EnergyPlus Headers #include diff --git a/src/EnergyPlus/DataHeatBalSurface.hh b/src/EnergyPlus/DataHeatBalSurface.hh index 0a70f0a729f..ad2ca8326eb 100644 --- a/src/EnergyPlus/DataHeatBalSurface.hh +++ b/src/EnergyPlus/DataHeatBalSurface.hh @@ -51,7 +51,6 @@ // ObjexxFCL Headers #include #include -#include // EnergyPlus Headers #include diff --git a/src/EnergyPlus/DaylightingManager.hh b/src/EnergyPlus/DaylightingManager.hh index cc7e70c55cf..bd9b35da184 100644 --- a/src/EnergyPlus/DaylightingManager.hh +++ b/src/EnergyPlus/DaylightingManager.hh @@ -52,7 +52,6 @@ #include #include #include -#include #include // EnergyPlus Headers diff --git a/src/EnergyPlus/OutputReportData.cc b/src/EnergyPlus/OutputReportData.cc index 1393cbfb5b6..d29b41d703d 100644 --- a/src/EnergyPlus/OutputReportData.cc +++ b/src/EnergyPlus/OutputReportData.cc @@ -53,7 +53,6 @@ #include #include #include -#include // EnergyPlus Headers #include diff --git a/src/EnergyPlus/OutputReportData.hh b/src/EnergyPlus/OutputReportData.hh index 620895c9461..d41dff3246e 100644 --- a/src/EnergyPlus/OutputReportData.hh +++ b/src/EnergyPlus/OutputReportData.hh @@ -56,7 +56,6 @@ #include #include #include -#include // EnergyPlus Headers #include diff --git a/src/EnergyPlus/OutputReportTabularAnnual.cc b/src/EnergyPlus/OutputReportTabularAnnual.cc index fe42ff37954..5bf54d7624e 100644 --- a/src/EnergyPlus/OutputReportTabularAnnual.cc +++ b/src/EnergyPlus/OutputReportTabularAnnual.cc @@ -56,7 +56,6 @@ #include #include #include -#include // EnergyPlus Headers #include diff --git a/src/EnergyPlus/OutputReportTabularAnnual.hh b/src/EnergyPlus/OutputReportTabularAnnual.hh index 3a991ddb4ba..047e69e1ae3 100644 --- a/src/EnergyPlus/OutputReportTabularAnnual.hh +++ b/src/EnergyPlus/OutputReportTabularAnnual.hh @@ -57,7 +57,6 @@ #include #include #include -#include // EnergyPlus Headers #include diff --git a/src/EnergyPlus/WeatherManager.hh b/src/EnergyPlus/WeatherManager.hh index 78dc5e60ae8..ca35be0cdab 100644 --- a/src/EnergyPlus/WeatherManager.hh +++ b/src/EnergyPlus/WeatherManager.hh @@ -53,7 +53,6 @@ // ObjexxFCL Headers #include -#include #include // EnergyPlus Headers diff --git a/src/EnergyPlus/WindowManager.hh b/src/EnergyPlus/WindowManager.hh index e1560589a29..3e3ae6a4c19 100644 --- a/src/EnergyPlus/WindowManager.hh +++ b/src/EnergyPlus/WindowManager.hh @@ -52,7 +52,6 @@ #include #include #include -#include // EnergyPlus Headers #include From 69432ed5e02d960f2d7d5b5dd4ab5c8efd0efeaf Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Tue, 24 Sep 2024 16:30:55 -0500 Subject: [PATCH 16/25] Space IV.6 - unwind 3D comp loads arrays for surfaces --- src/EnergyPlus/HeatBalanceSurfaceManager.cc | 24 +++--- src/EnergyPlus/OutputReportTabular.cc | 73 +++++++------------ src/EnergyPlus/OutputReportTabular.hh | 40 ++++++---- .../unit/OutputReportTabular.unit.cc | 34 +++------ 4 files changed, 73 insertions(+), 98 deletions(-) diff --git a/src/EnergyPlus/HeatBalanceSurfaceManager.cc b/src/EnergyPlus/HeatBalanceSurfaceManager.cc index 22116cbe051..dd7bccf19b2 100644 --- a/src/EnergyPlus/HeatBalanceSurfaceManager.cc +++ b/src/EnergyPlus/HeatBalanceSurfaceManager.cc @@ -6571,16 +6571,15 @@ void ReportSurfaceHeatBalance(EnergyPlusData &state) if (state.dataGlobal->ZoneSizingCalc && state.dataGlobal->CompLoadReportIsReq) { // This is by surface, so it works for both space and zone component loads int TimeStepInDay = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; + auto &surfCLDayTS = state.dataOutRptTab->surfCompLoadsDays[state.dataSize->CurOverallSimDay - 1].ts[TimeStepInDay - 1]; for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) { for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { auto const &thisSpace = state.dataHeatBal->space(spaceNum); int firstSurf = thisSpace.OpaqOrIntMassSurfaceFirst; int lastSurf = thisSpace.OpaqOrIntMassSurfaceLast; for (int surfNum = firstSurf; surfNum <= lastSurf; ++surfNum) { - state.dataOutRptTab->lightSWRadSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, surfNum) = - state.dataHeatBalSurf->SurfQdotRadLightsInRep(surfNum); - state.dataOutRptTab->feneSolarRadSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, surfNum) = - state.dataHeatBalSurf->SurfQdotRadSolarInRep(surfNum); + surfCLDayTS.surf[surfNum - 1].lightSWRadSeq = state.dataHeatBalSurf->SurfQdotRadLightsInRep(surfNum); + surfCLDayTS.surf[surfNum - 1].feneSolarRadSeq = state.dataHeatBalSurf->SurfQdotRadSolarInRep(surfNum); } firstSurf = thisSpace.OpaqOrWinSurfaceFirst; lastSurf = thisSpace.OpaqOrWinSurfaceLast; @@ -6588,13 +6587,10 @@ void ReportSurfaceHeatBalance(EnergyPlusData &state) auto const &surface = state.dataSurface->Surface(surfNum); if (!state.dataGlobal->WarmupFlag) { if (state.dataGlobal->isPulseZoneSizing) { - state.dataOutRptTab->loadConvectedWithPulse(state.dataSize->CurOverallSimDay, TimeStepInDay, surfNum) = - state.dataHeatBalSurf->SurfQdotConvInRep(surfNum); + surfCLDayTS.surf[surfNum - 1].loadConvectedWithPulse = state.dataHeatBalSurf->SurfQdotConvInRep(surfNum); } else { - state.dataOutRptTab->loadConvectedNormal(state.dataSize->CurOverallSimDay, TimeStepInDay, surfNum) = - state.dataHeatBalSurf->SurfQdotConvInRep(surfNum); - state.dataOutRptTab->netSurfRadSeq(state.dataSize->CurOverallSimDay, TimeStepInDay, surfNum) = - state.dataHeatBalSurf->SurfQdotRadNetLWInPerArea(surfNum) * surface.Area; + surfCLDayTS.surf[surfNum - 1].loadConvectedNormal = state.dataHeatBalSurf->SurfQdotConvInRep(surfNum); + surfCLDayTS.surf[surfNum - 1].netSurfRadSeq = state.dataHeatBalSurf->SurfQdotRadNetLWInPerArea(surfNum) * surface.Area; } } } @@ -9533,15 +9529,13 @@ void GatherComponentLoadsSurfAbsFact(EnergyPlusData &state) // This is by surface, so it works for both space and zone component loads if (state.dataGlobal->CompLoadReportIsReq && !state.dataGlobal->isPulseZoneSizing) { int TimeStepInDay = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; - for (int enclosureNum = 1; enclosureNum <= state.dataViewFactor->NumOfRadiantEnclosures; ++enclosureNum) { - state.dataOutRptTab->TMULTseq(state.dataSize->CurOverallSimDay, TimeStepInDay, enclosureNum) = - state.dataViewFactor->EnclRadInfo(enclosureNum).radThermAbsMult; - } + auto &surfCLDayTS = state.dataOutRptTab->surfCompLoadsDays[state.dataSize->CurOverallSimDay - 1].ts[TimeStepInDay - 1]; for (int jSurf = 1; jSurf <= state.dataSurface->TotSurfaces; ++jSurf) { auto const &surface = state.dataSurface->Surface(jSurf); if (!surface.HeatTransSurf || surface.Zone == 0) continue; // Skip non-heat transfer surfaces if (surface.Class == DataSurfaces::SurfaceClass::TDD_Dome) continue; // Skip tubular daylighting device domes - state.dataOutRptTab->ITABSFseq(state.dataSize->CurOverallSimDay, TimeStepInDay, jSurf) = state.dataHeatBalSurf->SurfAbsThermalInt(jSurf); + surfCLDayTS.surf[jSurf - 1].ITABSFseq = state.dataHeatBalSurf->SurfAbsThermalInt(jSurf); + surfCLDayTS.surf[jSurf - 1].TMULTseq = state.dataViewFactor->EnclRadInfo(surface.RadEnclIndex).radThermAbsMult; } } } diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index c79ff347a35..965529a3e60 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -14473,13 +14473,10 @@ void AllocateLoadComponentArrays(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR Jason Glazer // DATE WRITTEN April 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Allocate the arrays related to the load component report - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: auto const &ort = state.dataOutRptTab; if (!ort->AllocateLoadComponentArraysDoAllocate) { @@ -14490,29 +14487,20 @@ void AllocateLoadComponentArrays(EnergyPlusData &state) ort->radiantPulseTimestep = 0; ort->radiantPulseReceived.allocate({0, state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays}, state.dataSurface->TotSurfaces); ort->radiantPulseReceived = 0.0; - ort->loadConvectedNormal.allocate(state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, - {0, state.dataGlobal->NumOfTimeStepInHour * 24}, - state.dataSurface->TotSurfaces); - ort->loadConvectedNormal = 0.0; - ort->loadConvectedWithPulse.allocate(state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, - {0, state.dataGlobal->NumOfTimeStepInHour * 24}, - state.dataSurface->TotSurfaces); - ort->loadConvectedWithPulse = 0.0; - ort->netSurfRadSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); - ort->netSurfRadSeq = 0.0; ort->decayCurveCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); ort->decayCurveCool = 0.0; ort->decayCurveHeat.allocate(state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); ort->decayCurveHeat = 0.0; - ort->ITABSFseq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); - ort->ITABSFseq = 0.0; - ort->TMULTseq.allocate(state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, - state.dataGlobal->NumOfTimeStepInHour * 24, - state.dataViewFactor->NumOfRadiantEnclosures); - ort->TMULTseq = 0.0; - Real64 numTSinDay = state.dataGlobal->NumOfTimeStepInHour * 24; + + Real64 const numTSinDay = state.dataGlobal->NumOfTimeStepInHour * 24; + + ort->surfCompLoadsDays.resize(state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays); + for (auto &day : ort->surfCompLoadsDays) { + day.ts.resize(numTSinDay); + for (auto &ts : day.ts) { + ts.surf.resize(state.dataSurface->TotSurfaces); + } + } ort->znCompLoads.resize(state.dataGlobal->NumOfZones); for (auto &zone : ort->znCompLoads) { @@ -14530,12 +14518,7 @@ void AllocateLoadComponentArrays(EnergyPlusData &state) } } } - ort->lightSWRadSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); - ort->lightSWRadSeq = 0.0; - ort->feneSolarRadSeq.allocate( - state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); - ort->feneSolarRadSeq = 0.0; + ort->AllocateLoadComponentArraysDoAllocate = false; } @@ -14555,7 +14538,6 @@ void DeallocateLoadComponentArrays(EnergyPlusData &state) auto const &ort = state.dataOutRptTab; ort->radiantPulseTimestep.deallocate(); ort->radiantPulseReceived.deallocate(); - ort->loadConvectedWithPulse.deallocate(); } void ComputeLoadComponentDecayCurve(EnergyPlusData &state) @@ -14564,8 +14546,6 @@ void ComputeLoadComponentDecayCurve(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR Jason Glazer // DATE WRITTEN August 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Determines the load component decay curve based on normal and pulse results from zone sizing. @@ -14574,7 +14554,6 @@ void ComputeLoadComponentDecayCurve(EnergyPlusData &state) // Decay curve is the fraction of the heat convected from a surface over the initial radiant heat // absorbed by the surface. - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 diff; auto const &ort = state.dataOutRptTab; @@ -14586,6 +14565,7 @@ void ComputeLoadComponentDecayCurve(EnergyPlusData &state) state.dataOutRptTab->CoolDesSelectedCLCDC = state.dataSize->CalcFinalZoneSizing(state.dataOutRptTab->ZoneNumCLCDC).CoolDDNum; // loop over timesteps after pulse occurred if (state.dataOutRptTab->CoolDesSelectedCLCDC != 0) { + auto &surfCLClDay = ort->surfCompLoadsDays[state.dataOutRptTab->CoolDesSelectedCLCDC - 1]; state.dataOutRptTab->TimeOfPulseCLCDC = ort->radiantPulseTimestep(state.dataOutRptTab->CoolDesSelectedCLCDC, state.dataOutRptTab->ZoneNumCLCDC); // if the CoolDesSelected time is on a different day than @@ -14602,10 +14582,8 @@ void ComputeLoadComponentDecayCurve(EnergyPlusData &state) state.dataOutRptTab->TimeStepCLCDC <= state.dataGlobal->NumOfTimeStepInHour * 24; ++state.dataOutRptTab->TimeStepCLCDC) { if (ort->radiantPulseReceived(state.dataOutRptTab->CoolDesSelectedCLCDC, state.dataOutRptTab->SurfNumCLCDC) != 0.0) { - diff = ort->loadConvectedWithPulse( - state.dataOutRptTab->CoolDesSelectedCLCDC, state.dataOutRptTab->TimeStepCLCDC, state.dataOutRptTab->SurfNumCLCDC) - - ort->loadConvectedNormal( - state.dataOutRptTab->CoolDesSelectedCLCDC, state.dataOutRptTab->TimeStepCLCDC, state.dataOutRptTab->SurfNumCLCDC); + auto &surfClDayTS = surfCLClDay.ts[state.dataOutRptTab->TimeStepCLCDC - 1].surf[state.dataOutRptTab->SurfNumCLCDC - 1]; + diff = surfClDayTS.loadConvectedWithPulse - surfClDayTS.loadConvectedNormal; ort->decayCurveCool(state.dataOutRptTab->TimeStepCLCDC - state.dataOutRptTab->TimeOfPulseCLCDC + 1, state.dataOutRptTab->SurfNumCLCDC) = -diff / ort->radiantPulseReceived(state.dataOutRptTab->CoolDesSelectedCLCDC, state.dataOutRptTab->SurfNumCLCDC); @@ -14617,6 +14595,7 @@ void ComputeLoadComponentDecayCurve(EnergyPlusData &state) } state.dataOutRptTab->HeatDesSelectedCLCDC = state.dataSize->CalcFinalZoneSizing(state.dataOutRptTab->ZoneNumCLCDC).HeatDDNum; if (state.dataOutRptTab->HeatDesSelectedCLCDC != 0) { + auto &surfCLHtDay = ort->surfCompLoadsDays[state.dataOutRptTab->HeatDesSelectedCLCDC - 1]; state.dataOutRptTab->TimeOfPulseCLCDC = ort->radiantPulseTimestep(state.dataOutRptTab->HeatDesSelectedCLCDC, state.dataOutRptTab->ZoneNumCLCDC); // scan back to the day that the heating pulse occurs, if necessary @@ -14631,10 +14610,8 @@ void ComputeLoadComponentDecayCurve(EnergyPlusData &state) state.dataOutRptTab->TimeStepCLCDC <= state.dataGlobal->NumOfTimeStepInHour * 24; ++state.dataOutRptTab->TimeStepCLCDC) { if (ort->radiantPulseReceived(state.dataOutRptTab->HeatDesSelectedCLCDC, state.dataOutRptTab->SurfNumCLCDC) != 0.0) { - diff = ort->loadConvectedWithPulse( - state.dataOutRptTab->HeatDesSelectedCLCDC, state.dataOutRptTab->TimeStepCLCDC, state.dataOutRptTab->SurfNumCLCDC) - - ort->loadConvectedNormal( - state.dataOutRptTab->HeatDesSelectedCLCDC, state.dataOutRptTab->TimeStepCLCDC, state.dataOutRptTab->SurfNumCLCDC); + auto &surfHtDayTS = surfCLHtDay.ts[state.dataOutRptTab->TimeStepCLCDC - 1].surf[state.dataOutRptTab->SurfNumCLCDC - 1]; + diff = surfHtDayTS.loadConvectedWithPulse - surfHtDayTS.loadConvectedNormal; ort->decayCurveHeat(state.dataOutRptTab->TimeStepCLCDC - state.dataOutRptTab->TimeOfPulseCLCDC + 1, state.dataOutRptTab->SurfNumCLCDC) = -diff / ort->radiantPulseReceived(state.dataOutRptTab->HeatDesSelectedCLCDC, state.dataOutRptTab->SurfNumCLCDC); @@ -15631,6 +15608,7 @@ void GetDelaySequences(EnergyPlusData &state, auto &ort = state.dataOutRptTab; if (desDaySelected != 0) { + auto &surfCLDay = ort->surfCompLoadsDays[desDaySelected - 1]; Array2D decayCurve; if (isCooling) { @@ -15667,17 +15645,17 @@ void GetDelaySequences(EnergyPlusData &state, for (int mStepBack = 1; mStepBack <= kTimeStep; ++mStepBack) { int sourceStep = kTimeStep - mStepBack + 1; auto &compLoadTS = szCompLoadLoc.day[desDaySelected - 1].ts[sourceStep - 1]; - Real64 thisQRadThermInAbsMult = ort->TMULTseq(desDaySelected, sourceStep, radEnclosureNum) * - ort->ITABSFseq(desDaySelected, sourceStep, jSurf) * state.dataSurface->Surface(jSurf).Area * - decayCurve(mStepBack, jSurf); + auto &surfCLDayTS = surfCLDay.ts[sourceStep - 1].surf[jSurf - 1]; + Real64 thisQRadThermInAbsMult = + surfCLDayTS.TMULTseq * surfCLDayTS.ITABSFseq * state.dataSurface->Surface(jSurf).Area * decayCurve(mStepBack, jSurf); peopleConvFromSurf += compLoadTS.peopleRadSeq * thisQRadThermInAbsMult; equipConvFromSurf += compLoadTS.equipRadSeq * thisQRadThermInAbsMult; hvacLossConvFromSurf += compLoadTS.hvacLossRadSeq * thisQRadThermInAbsMult; powerGenConvFromSurf += compLoadTS.powerGenRadSeq * thisQRadThermInAbsMult; lightLWConvFromSurf += compLoadTS.lightLWRadSeq * thisQRadThermInAbsMult; // short wave is already accumulated by surface - lightSWConvFromSurf += ort->lightSWRadSeq(desDaySelected, sourceStep, jSurf) * decayCurve(mStepBack, jSurf); - feneSolarConvFromSurf += ort->feneSolarRadSeq(desDaySelected, sourceStep, jSurf) * decayCurve(mStepBack, jSurf); + lightSWConvFromSurf += surfCLDayTS.lightSWRadSeq * decayCurve(mStepBack, jSurf); + feneSolarConvFromSurf += surfCLDayTS.feneSolarRadSeq * decayCurve(mStepBack, jSurf); } // for mStepBack peopleConvIntoZone += peopleConvFromSurf; @@ -15691,14 +15669,15 @@ void GetDelaySequences(EnergyPlusData &state, // determine the remaining convective heat from the surfaces that are not based // on any of these other loads // negative because heat from surface should be positive + auto &surfCLDaykTS = surfCLDay.ts[kTimeStep - 1].surf[jSurf - 1]; surfDelaySeq(kTimeStep, jSurf) = - -ort->loadConvectedNormal(desDaySelected, kTimeStep, jSurf) - ort->netSurfRadSeq(desDaySelected, kTimeStep, jSurf) - + -surfCLDaykTS.loadConvectedNormal - surfCLDaykTS.netSurfRadSeq - (peopleConvFromSurf + equipConvFromSurf + hvacLossConvFromSurf + powerGenConvFromSurf + lightLWConvFromSurf + lightSWConvFromSurf + feneSolarConvFromSurf); // remove net radiant for the surface // also remove the net radiant component on the instanteous conduction for fenestration if (state.dataSurface->Surface(jSurf).Class == DataSurfaces::SurfaceClass::Window) { - adjFeneSurfNetRadSeq += ort->netSurfRadSeq(desDaySelected, kTimeStep, jSurf); + adjFeneSurfNetRadSeq += surfCLDaykTS.netSurfRadSeq; } } // for jSurf } diff --git a/src/EnergyPlus/OutputReportTabular.hh b/src/EnergyPlus/OutputReportTabular.hh index 8ee723d1124..157585aff49 100644 --- a/src/EnergyPlus/OutputReportTabular.hh +++ b/src/EnergyPlus/OutputReportTabular.hh @@ -491,6 +491,27 @@ namespace OutputReportTabular { } }; + struct compLoadsSurface + { + Real64 loadConvectedNormal = 0.0; + Real64 loadConvectedWithPulse = 0.0; + Real64 netSurfRadSeq = 0.0; + Real64 ITABSFseq = 0.0; // used for determining the radiant fraction on each surface + Real64 TMULTseq = 0.0; // used for determining the radiant fraction on each surface + Real64 lightSWRadSeq = 0.0; // short wave visible radiation + Real64 feneSolarRadSeq = 0.0; + }; + + struct compLoadsTimeStepSurfaces + { + std::vector surf; + }; + + struct componentLoadsDaySurfaces + { + std::vector ts; + }; + struct compLoadsTimeStep { Real64 peopleInstantSeq = 0.0; @@ -1227,17 +1248,10 @@ struct OutputReportTabularData : BaseGlobalStruct // arrays related to pulse and load component reporting Array2D_int radiantPulseTimestep; Array2D radiantPulseReceived; - Array3D loadConvectedNormal; - Array3D loadConvectedWithPulse; - Array3D netSurfRadSeq; Array2D decayCurveCool; Array2D decayCurveHeat; - Array3D ITABSFseq; // used for determining the radiant fraction on each surface - Array3D TMULTseq; // used for determining the radiant fraction on each surface - - Array3D lightSWRadSeq; // short wave visible radiation - Array3D feneSolarRadSeq; + std::vector surfCompLoadsDays; std::vector znCompLoads; // Zone component loads std::vector spCompLoads; // Space component loads @@ -1510,14 +1524,12 @@ struct OutputReportTabularData : BaseGlobalStruct this->DesignDayCount = 0; this->radiantPulseTimestep.deallocate(); this->radiantPulseReceived.deallocate(); - this->loadConvectedNormal.deallocate(); - this->loadConvectedWithPulse.deallocate(); - this->netSurfRadSeq.deallocate(); this->decayCurveCool.deallocate(); this->decayCurveHeat.deallocate(); - this->ITABSFseq.deallocate(); - this->TMULTseq.deallocate(); - this->feneSolarRadSeq.deallocate(); + this->surfCompLoadsDays.clear(); + this->znCompLoads.clear(); + this->spCompLoads.clear(); + this->maxUniqueKeyCount = 0; this->activeSubTableName.clear(); this->activeReportNameNoSpace.clear(); diff --git a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc index aa9b4598671..fe897338902 100644 --- a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc +++ b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc @@ -518,35 +518,23 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_AllocateLoadComponentArraysTes // radiantPulseReceived.allocate( { 0, TotDesDays + TotRunDesPersDays }, TotSurfaces ); EXPECT_EQ(state->dataOutRptTab->radiantPulseReceived.size(), 42u); - // loadConvectedNormal.allocate( TotDesDays + TotRunDesPersDays, { 0, NumOfTimeStepInHour * 24 }, TotSurfaces ); - EXPECT_EQ(state->dataOutRptTab->loadConvectedNormal.size(), 3395u); - - // loadConvectedWithPulse.allocate( TotDesDays + TotRunDesPersDays, { 0, NumOfTimeStepInHour * 24 }, TotSurfaces ); - EXPECT_EQ(state->dataOutRptTab->loadConvectedWithPulse.size(), 3395u); - - // netSurfRadSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, TotSurfaces ); - EXPECT_EQ(state->dataOutRptTab->netSurfRadSeq.size(), 3360u); - // decayCurveCool.allocate( NumOfTimeStepInHour * 24, TotSurfaces ); EXPECT_EQ(state->dataOutRptTab->decayCurveCool.size(), 672u); // decayCurveHeat.allocate( NumOfTimeStepInHour * 24, TotSurfaces ); EXPECT_EQ(state->dataOutRptTab->decayCurveHeat.size(), 672u); - // ITABSFseq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, TotSurfaces ); - EXPECT_EQ(state->dataOutRptTab->ITABSFseq.size(), 3360u); - - // TMULTseq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, NumOfZones ); - EXPECT_EQ(state->dataOutRptTab->TMULTseq.size(), 1920u); + EXPECT_EQ(state->dataOutRptTab->surfCompLoadsDays.size(), 5u); + EXPECT_EQ(state->dataOutRptTab->surfCompLoadsDays[0].ts.size(), 96u); + EXPECT_EQ(state->dataOutRptTab->surfCompLoadsDays[0].ts[0].surf.size(), 7u); + EXPECT_EQ(state->dataOutRptTab->surfCompLoadsDays[4].ts.size(), 96u); + EXPECT_EQ(state->dataOutRptTab->surfCompLoadsDays[4].ts[0].surf.size(), 7u); EXPECT_EQ(state->dataOutRptTab->znCompLoads.size(), 4u); EXPECT_EQ(state->dataOutRptTab->znCompLoads[0].day.size(), 5u); EXPECT_EQ(state->dataOutRptTab->znCompLoads[0].day[0].ts.size(), 96u); EXPECT_EQ(state->dataOutRptTab->znCompLoads[3].day.size(), 5u); EXPECT_EQ(state->dataOutRptTab->znCompLoads[3].day[4].ts.size(), 96u); - - // lightSWRadSeq.allocate( TotDesDays + TotRunDesPersDays, NumOfTimeStepInHour * 24, TotSurfaces ); - EXPECT_EQ(state->dataOutRptTab->lightSWRadSeq.size(), 3360u); } TEST_F(EnergyPlusFixture, OutputReportTabularTest_ConfirmConvertToEscaped) @@ -6946,7 +6934,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesTwice_test) auto &znCL = state->dataOutRptTab->znCompLoads[iZone - 1]; znCL.day[coolDesSelected - 1].ts[0].feneCondInstantSeq = 0.88; - state->dataOutRptTab->netSurfRadSeq(coolDesSelected, 1, 1) = 0.05; + state->dataOutRptTab->surfCompLoadsDays[coolDesSelected - 1].ts[0].surf[0].netSurfRadSeq = 0.05; GetDelaySequences(*state, coolDesSelected, @@ -8337,8 +8325,9 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesSurfaceOrder_ for (int jSurf = 1; jSurf <= 4; ++jSurf) { for (int step = 1; step <= 10; ++step) { auto &znCLDayTS = znCL.day[coolDesSelected - 1].ts[step - 1]; - state->dataOutRptTab->TMULTseq(coolDesSelected, step, radEnclosureNum) = 0.1 * step; - state->dataOutRptTab->ITABSFseq(coolDesSelected, step, jSurf) = 0.2 * step * surfBaseValue[jSurf - 1]; + auto &surfCLDayTS = state->dataOutRptTab->surfCompLoadsDays[coolDesSelected - 1].ts[step - 1].surf[jSurf - 1]; + surfCLDayTS.TMULTseq = 0.1 * step; + surfCLDayTS.ITABSFseq = 0.2 * step * surfBaseValue[jSurf - 1]; state->dataOutRptTab->decayCurveCool(step, jSurf) = 0.3 * step * surfBaseValue[jSurf - 1]; znCLDayTS.peopleRadSeq = 0.4 * step; znCLDayTS.equipRadSeq = 0.5 * step; @@ -8391,8 +8380,9 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesSurfaceOrder_ for (int jSurf = 1; jSurf <= 4; ++jSurf) { for (int step = 1; step <= 10; ++step) { auto &znCLDayTS = znCL.day[coolDesSelected - 1].ts[step - 1]; - state->dataOutRptTab->TMULTseq(coolDesSelected, step, radEnclosureNum) = 0.1 * step; - state->dataOutRptTab->ITABSFseq(coolDesSelected, step, jSurf) = 0.2 * step * surfBaseValue[jSurf - 1]; + auto &surfCLDayTS = state->dataOutRptTab->surfCompLoadsDays[coolDesSelected - 1].ts[step - 1].surf[jSurf - 1]; + surfCLDayTS.TMULTseq = 0.1 * step; + surfCLDayTS.ITABSFseq = 0.2 * step * surfBaseValue[jSurf - 1]; state->dataOutRptTab->decayCurveCool(step, jSurf) = 0.3 * step * surfBaseValue[jSurf - 1]; znCLDayTS.peopleRadSeq = 0.4 * step; znCLDayTS.equipRadSeq = 0.5 * step; From cf45780fb597a5c401da7866b25eeb87f2696ed8 Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Tue, 24 Sep 2024 16:34:46 -0500 Subject: [PATCH 17/25] Revert errant VS reformat --- tst/EnergyPlus/unit/OutputReportTabular.unit.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc index fe897338902..d2a36a315e6 100644 --- a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc +++ b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc @@ -7124,7 +7124,10 @@ TEST_F(SQLiteFixture, OutputReportTabular_WriteLoadComponentSummaryTables_AirLoo state->dataSize->SysSizInput.allocate(state->dataSize->NumSysSizInput); state->dataSize->SysSizInput(1).AirLoopNum = 1; state->dataSize->SysSizInput(1).SizingOption = DataSizing::SizingConcurrence::NonCoincident; - auto degC_to_F = [](Real64 celsius) constexpr { return celsius * (9.0 / 5.0) + 32.0; }; + auto degC_to_F = [](Real64 celsius) constexpr + { + return celsius * (9.0 / 5.0) + 32.0; + }; constexpr Real64 coolMixTempSys = 26.2; constexpr Real64 coolMixTempSysIP = degC_to_F(coolMixTempSys); constexpr Real64 heatMixTempSys = -1.7; From 227c141b360f6983d1781009711571701b635f16 Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Wed, 25 Sep 2024 10:06:22 -0500 Subject: [PATCH 18/25] Space IV.6 - component loads rename reorder --- src/EnergyPlus/HeatBalanceSurfaceManager.cc | 4 +- src/EnergyPlus/InternalHeatGains.cc | 8 +- src/EnergyPlus/InternalHeatGains.hh | 6 +- src/EnergyPlus/OutputReportTabular.cc | 211 +++++++++--------- src/EnergyPlus/OutputReportTabular.hh | 35 +-- tst/EnergyPlus/unit/InternalHeatGains.unit.cc | 2 +- .../unit/OutputReportTabular.unit.cc | 49 ++-- 7 files changed, 166 insertions(+), 149 deletions(-) diff --git a/src/EnergyPlus/HeatBalanceSurfaceManager.cc b/src/EnergyPlus/HeatBalanceSurfaceManager.cc index dd7bccf19b2..88a00d7edc6 100644 --- a/src/EnergyPlus/HeatBalanceSurfaceManager.cc +++ b/src/EnergyPlus/HeatBalanceSurfaceManager.cc @@ -6571,7 +6571,7 @@ void ReportSurfaceHeatBalance(EnergyPlusData &state) if (state.dataGlobal->ZoneSizingCalc && state.dataGlobal->CompLoadReportIsReq) { // This is by surface, so it works for both space and zone component loads int TimeStepInDay = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; - auto &surfCLDayTS = state.dataOutRptTab->surfCompLoadsDays[state.dataSize->CurOverallSimDay - 1].ts[TimeStepInDay - 1]; + auto &surfCLDayTS = state.dataOutRptTab->surfCompLoads[state.dataSize->CurOverallSimDay - 1].ts[TimeStepInDay - 1]; for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) { for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) { auto const &thisSpace = state.dataHeatBal->space(spaceNum); @@ -9529,7 +9529,7 @@ void GatherComponentLoadsSurfAbsFact(EnergyPlusData &state) // This is by surface, so it works for both space and zone component loads if (state.dataGlobal->CompLoadReportIsReq && !state.dataGlobal->isPulseZoneSizing) { int TimeStepInDay = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; - auto &surfCLDayTS = state.dataOutRptTab->surfCompLoadsDays[state.dataSize->CurOverallSimDay - 1].ts[TimeStepInDay - 1]; + auto &surfCLDayTS = state.dataOutRptTab->surfCompLoads[state.dataSize->CurOverallSimDay - 1].ts[TimeStepInDay - 1]; for (int jSurf = 1; jSurf <= state.dataSurface->TotSurfaces; ++jSurf) { auto const &surface = state.dataSurface->Surface(jSurf); if (!surface.HeatTransSurf || surface.Zone == 0) continue; // Skip non-heat transfer surfaces diff --git a/src/EnergyPlus/InternalHeatGains.cc b/src/EnergyPlus/InternalHeatGains.cc index 08f2ff161b5..fcbe1e121a0 100644 --- a/src/EnergyPlus/InternalHeatGains.cc +++ b/src/EnergyPlus/InternalHeatGains.cc @@ -9509,19 +9509,21 @@ namespace InternalHeatGains { if (state.dataGlobal->CompLoadReportIsReq && !state.dataGlobal->isPulseZoneSizing) { int TimeStepInDay = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { - auto &znCLDayTS = state.dataOutRptTab->znCompLoads[iZone - 1].day[state.dataSize->CurOverallSimDay - 1].ts[TimeStepInDay - 1]; + auto &znCLDayTS = state.dataOutRptTab->znCompLoads[state.dataSize->CurOverallSimDay - 1].ts[TimeStepInDay - 1].spacezone[iZone - 1]; gatherCompLoadIntGain2(state, znCLDayTS, iZone); } if (state.dataHeatBal->doSpaceHeatBalanceSizing) { for (int iSpace = 1; iSpace <= state.dataGlobal->NumOfZones; ++iSpace) { - auto &spCLDayTS = state.dataOutRptTab->spCompLoads[iSpace - 1].day[state.dataSize->CurOverallSimDay - 1].ts[TimeStepInDay - 1]; + auto &spCLDayTS = + state.dataOutRptTab->spCompLoads[state.dataSize->CurOverallSimDay - 1].ts[TimeStepInDay - 1].spacezone[iSpace - 1]; gatherCompLoadIntGain2(state, spCLDayTS, state.dataHeatBal->space(iSpace).zoneNum, iSpace); } } } } - void gatherCompLoadIntGain2(EnergyPlusData &state, OutputReportTabular::compLoadsTimeStep &szCompLoadDayTS, int const zoneNum, int const spaceNum) + void + gatherCompLoadIntGain2(EnergyPlusData &state, OutputReportTabular::compLoadsSpaceZone &szCompLoadDayTS, int const zoneNum, int const spaceNum) { static constexpr std::array IntGainTypesPeople = {DataHeatBalance::IntGainType::People}; static constexpr std::array IntGainTypesLight = {DataHeatBalance::IntGainType::Lights}; diff --git a/src/EnergyPlus/InternalHeatGains.hh b/src/EnergyPlus/InternalHeatGains.hh index 7cadac01e38..3e4943058a2 100644 --- a/src/EnergyPlus/InternalHeatGains.hh +++ b/src/EnergyPlus/InternalHeatGains.hh @@ -222,8 +222,10 @@ namespace InternalHeatGains { void GatherComponentLoadsIntGain(EnergyPlusData &state); - void - gatherCompLoadIntGain2(EnergyPlusData &state, OutputReportTabular::compLoadsTimeStep &szCompLoadDayTS, int const zoneNum, int const spaceNum = 0); + void gatherCompLoadIntGain2(EnergyPlusData &state, + OutputReportTabular::compLoadsSpaceZone &szCompLoadDayTS, + int const zoneNum, + int const spaceNum = 0); } // namespace InternalHeatGains diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index 965529a3e60..339f7587619 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -14494,27 +14494,27 @@ void AllocateLoadComponentArrays(EnergyPlusData &state) Real64 const numTSinDay = state.dataGlobal->NumOfTimeStepInHour * 24; - ort->surfCompLoadsDays.resize(state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays); - for (auto &day : ort->surfCompLoadsDays) { + ort->surfCompLoads.resize(state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays); + for (auto &day : ort->surfCompLoads) { day.ts.resize(numTSinDay); for (auto &ts : day.ts) { ts.surf.resize(state.dataSurface->TotSurfaces); } } - ort->znCompLoads.resize(state.dataGlobal->NumOfZones); - for (auto &zone : ort->znCompLoads) { - zone.day.resize(state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays); - for (auto &day : zone.day) { - day.ts.resize(numTSinDay); + ort->znCompLoads.resize(state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays); + for (auto &day : ort->znCompLoads) { + day.ts.resize(numTSinDay); + for (auto &ts : day.ts) { + ts.spacezone.resize(state.dataGlobal->NumOfZones); } } if (state.dataHeatBal->doSpaceHeatBalanceSizing) { - ort->spCompLoads.resize(state.dataGlobal->numSpaces); - for (auto &space : ort->spCompLoads) { - space.day.resize(state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays); - for (auto &day : space.day) { - day.ts.resize(numTSinDay); + ort->spCompLoads.resize(state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays); + for (auto &day : ort->spCompLoads) { + day.ts.resize(numTSinDay); + for (auto &ts : day.ts) { + ts.spacezone.resize(state.dataGlobal->numSpaces); } } } @@ -14565,7 +14565,7 @@ void ComputeLoadComponentDecayCurve(EnergyPlusData &state) state.dataOutRptTab->CoolDesSelectedCLCDC = state.dataSize->CalcFinalZoneSizing(state.dataOutRptTab->ZoneNumCLCDC).CoolDDNum; // loop over timesteps after pulse occurred if (state.dataOutRptTab->CoolDesSelectedCLCDC != 0) { - auto &surfCLClDay = ort->surfCompLoadsDays[state.dataOutRptTab->CoolDesSelectedCLCDC - 1]; + auto &surfCLClDay = ort->surfCompLoads[state.dataOutRptTab->CoolDesSelectedCLCDC - 1]; state.dataOutRptTab->TimeOfPulseCLCDC = ort->radiantPulseTimestep(state.dataOutRptTab->CoolDesSelectedCLCDC, state.dataOutRptTab->ZoneNumCLCDC); // if the CoolDesSelected time is on a different day than @@ -14595,7 +14595,7 @@ void ComputeLoadComponentDecayCurve(EnergyPlusData &state) } state.dataOutRptTab->HeatDesSelectedCLCDC = state.dataSize->CalcFinalZoneSizing(state.dataOutRptTab->ZoneNumCLCDC).HeatDDNum; if (state.dataOutRptTab->HeatDesSelectedCLCDC != 0) { - auto &surfCLHtDay = ort->surfCompLoadsDays[state.dataOutRptTab->HeatDesSelectedCLCDC - 1]; + auto &surfCLHtDay = ort->surfCompLoads[state.dataOutRptTab->HeatDesSelectedCLCDC - 1]; state.dataOutRptTab->TimeOfPulseCLCDC = ort->radiantPulseTimestep(state.dataOutRptTab->HeatDesSelectedCLCDC, state.dataOutRptTab->ZoneNumCLCDC); // scan back to the day that the heating pulse occurs, if necessary @@ -14670,8 +14670,6 @@ void GatherComponentLoadsSurface(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR Jason Glazer // DATE WRITTEN September 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Gather values during sizing used for loads component report. @@ -14684,14 +14682,14 @@ void GatherComponentLoadsSurface(EnergyPlusData &state) if (state.dataGlobal->CompLoadReportIsReq && !state.dataGlobal->isPulseZoneSizing) { int timeStepInDayGCLS = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; - for (auto &zoneCL : ort->znCompLoads) { - auto &day = zoneCL.day[state.dataSize->CurOverallSimDay - 1]; - day.ts[timeStepInDayGCLS - 1].feneCondInstantSeq = 0.0; + auto &znCLDayTS = ort->znCompLoads[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLS - 1]; + for (auto &zone : znCLDayTS.spacezone) { + zone.feneCondInstantSeq = 0.0; } if (state.dataHeatBal->doSpaceHeatBalanceSizing) { - for (auto &spaceCL : ort->spCompLoads) { - auto &day = spaceCL.day[state.dataSize->CurOverallSimDay - 1]; - day.ts[timeStepInDayGCLS - 1].feneCondInstantSeq = 0.0; + auto &spCLDayTS = ort->spCompLoads[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLS - 1]; + for (auto &space : spCLDayTS.spacezone) { + space.feneCondInstantSeq = 0.0; } } for (int iSurfGCLS = 1; iSurfGCLS <= state.dataSurface->TotSurfaces; ++iSurfGCLS) { @@ -14702,11 +14700,12 @@ void GatherComponentLoadsSurface(EnergyPlusData &state) Real64 surfCond = state.dataSurface->SurfWinGainConvGlazToZoneRep(iSurfGCLS) + state.dataSurface->SurfWinConvHeatFlowNatural(iSurfGCLS) + state.dataSurface->SurfWinGainConvShadeToZoneRep(iSurfGCLS) + state.dataSurface->SurfWinGainFrameDividerToZoneRep(iSurfGCLS); - ort->znCompLoads[zoneNumGCLS - 1].day[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLS - 1].feneCondInstantSeq += surfCond; + znCLDayTS.spacezone[zoneNumGCLS - 1].feneCondInstantSeq += surfCond; if (state.dataHeatBal->doSpaceHeatBalanceSizing) { int spaceNum = state.dataSurface->Surface(iSurfGCLS).spaceNum; - ort->spCompLoads[spaceNum - 1].day[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLS - 1].feneCondInstantSeq += surfCond; + ort->spCompLoads[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLS - 1].spacezone[spaceNum - 1].feneCondInstantSeq += + surfCond; } // for now assume zero instant solar - may change related @@ -14718,14 +14717,15 @@ void GatherComponentLoadsSurface(EnergyPlusData &state) for (int izone = 1; izone <= state.dataGlobal->NumOfZones; ++izone) { Real64 tubularGain = 0.0; tubularGain = InternalHeatGains::SumInternalConvectionGainsByTypes(state, izone, OutputReportTabular::IntGainTypesTubularGCLS); - ort->znCompLoads[izone - 1].day[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLS - 1].feneCondInstantSeq += tubularGain; + znCLDayTS.spacezone[izone - 1].feneCondInstantSeq += tubularGain; } if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + auto &spCLDayTS = ort->spCompLoads[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLS - 1]; for (int ispace = 1; ispace <= state.dataGlobal->NumOfZones; ++ispace) { Real64 tubularGain = 0.0; int zone = state.dataHeatBal->space(ispace).zoneNum; tubularGain = InternalHeatGains::SumInternalConvectionGainsByTypes(state, zone, OutputReportTabular::IntGainTypesTubularGCLS, ispace); - ort->znCompLoads[ispace - 1].day[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLS - 1].feneCondInstantSeq += tubularGain; + spCLDayTS.spacezone[ispace - 1].feneCondInstantSeq += tubularGain; } } } @@ -14747,56 +14747,56 @@ void GatherComponentLoadsHVAC(EnergyPlusData &state) return; } int timeStepInDayGCLH = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; + auto &znCompLoadDayTS = state.dataOutRptTab->znCompLoads[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLH - 1]; for (int iZoneGCLH = 1; iZoneGCLH <= state.dataGlobal->NumOfZones; ++iZoneGCLH) { - auto &zoneCompLoadDayTS = state.dataOutRptTab->znCompLoads[iZoneGCLH - 1].day[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLH - 1]; + auto &znCompLoadDayTSZone = znCompLoadDayTS.spacezone[iZoneGCLH - 1]; auto &zoneAirRpt = state.dataHeatBal->ZnAirRpt(iZoneGCLH); - gatherSpaceZoneCompLoadsHVAC(zoneCompLoadDayTS, zoneAirRpt, state.dataHVACGlobal->TimeStepSysSec); + gatherSpaceZoneCompLoadsHVAC(znCompLoadDayTSZone, zoneAirRpt, state.dataHVACGlobal->TimeStepSysSec); if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { - zoneCompLoadDayTS.infilInstantSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiSenGainW - - state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiSenLossW); // air flow network - zoneCompLoadDayTS.infilLatentSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiLatGainW - - state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiLatLossW); // air flow network - zoneCompLoadDayTS.zoneVentInstantSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentSenGainW - - state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentSenLossW); // air flow network - zoneCompLoadDayTS.zoneVentInstantSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentLatGainW - - state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentLatLossW); // air flow network - zoneCompLoadDayTS.interZoneMixInstantSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixSenGainW - - state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixSenLossW); // air flow network - zoneCompLoadDayTS.interZoneMixLatentSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixLatGainW - - state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixLatLossW); // air flow network + znCompLoadDayTSZone.infilInstantSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiSenGainW - + state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiSenLossW); // air flow network + znCompLoadDayTSZone.infilLatentSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiLatGainW - + state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneInfiLatLossW); // air flow network + znCompLoadDayTSZone.zoneVentInstantSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentSenGainW - + state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentSenLossW); // air flow network + znCompLoadDayTSZone.zoneVentInstantSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentLatGainW - + state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneVentLatLossW); // air flow network + znCompLoadDayTSZone.interZoneMixInstantSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixSenGainW - + state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixSenLossW); // air flow network + znCompLoadDayTSZone.interZoneMixLatentSeq += (state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixLatGainW - + state.afn->AirflowNetworkReportData(iZoneGCLH).MultiZoneMixLatLossW); // air flow network } } if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + auto &spCompLoadDayTS = state.dataOutRptTab->spCompLoads[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLH - 1]; for (int iSpace = 1; iSpace <= state.dataGlobal->numSpaces; ++iSpace) { - auto &spaceCompLoadDayTS = - state.dataOutRptTab->spCompLoads[iSpace - 1].day[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLH - 1]; + auto &spCompLoadDayTSSpace = spCompLoadDayTS.spacezone[iSpace - 1]; auto &spaceAirRpt = state.dataHeatBal->spaceAirRpt(iSpace); - gatherSpaceZoneCompLoadsHVAC(spaceCompLoadDayTS, spaceAirRpt, state.dataHVACGlobal->TimeStepSysSec); + gatherSpaceZoneCompLoadsHVAC(spCompLoadDayTSSpace, spaceAirRpt, state.dataHVACGlobal->TimeStepSysSec); if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { auto &space = state.dataHeatBal->space(iSpace); - auto const &zoneCompLoadDayTS = - state.dataOutRptTab->znCompLoads[space.zoneNum - 1].day[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLH - 1]; - spaceCompLoadDayTS.infilInstantSeq = space.fracZoneVolume * zoneCompLoadDayTS.infilInstantSeq; - spaceCompLoadDayTS.infilLatentSeq = space.fracZoneVolume * zoneCompLoadDayTS.infilLatentSeq; - spaceCompLoadDayTS.zoneVentInstantSeq = space.fracZoneVolume * zoneCompLoadDayTS.zoneVentInstantSeq; - spaceCompLoadDayTS.zoneVentInstantSeq = space.fracZoneVolume * zoneCompLoadDayTS.zoneVentInstantSeq; - spaceCompLoadDayTS.interZoneMixInstantSeq = space.fracZoneVolume * zoneCompLoadDayTS.interZoneMixInstantSeq; - spaceCompLoadDayTS.interZoneMixLatentSeq = space.fracZoneVolume * zoneCompLoadDayTS.interZoneMixLatentSeq; + auto const &znCompLoadDayTSZone = znCompLoadDayTS.spacezone[space.zoneNum - 1]; + spCompLoadDayTSSpace.infilInstantSeq = space.fracZoneVolume * znCompLoadDayTSZone.infilInstantSeq; + spCompLoadDayTSSpace.infilLatentSeq = space.fracZoneVolume * znCompLoadDayTSZone.infilLatentSeq; + spCompLoadDayTSSpace.zoneVentInstantSeq = space.fracZoneVolume * znCompLoadDayTSZone.zoneVentInstantSeq; + spCompLoadDayTSSpace.zoneVentInstantSeq = space.fracZoneVolume * znCompLoadDayTSZone.zoneVentInstantSeq; + spCompLoadDayTSSpace.interZoneMixInstantSeq = space.fracZoneVolume * znCompLoadDayTSZone.interZoneMixInstantSeq; + spCompLoadDayTSSpace.interZoneMixLatentSeq = space.fracZoneVolume * znCompLoadDayTSZone.interZoneMixLatentSeq; } } } } -void gatherSpaceZoneCompLoadsHVAC(OutputReportTabular::compLoadsTimeStep &compLoadDayTS, +void gatherSpaceZoneCompLoadsHVAC(OutputReportTabular::compLoadsSpaceZone &szCompLoadDayTS, DataHeatBalance::AirReportVars const &szAirRpt, Real64 const timeStepSysSec) { - compLoadDayTS.infilInstantSeq = ((szAirRpt.InfilHeatGain - szAirRpt.InfilHeatLoss) / timeStepSysSec); // zone infiltration - compLoadDayTS.infilLatentSeq = ((szAirRpt.InfilLatentGain - szAirRpt.InfilLatentLoss) / timeStepSysSec); // zone infiltration - compLoadDayTS.zoneVentInstantSeq = ((szAirRpt.VentilHeatGain - szAirRpt.VentilHeatLoss) / timeStepSysSec); // zone ventilation - compLoadDayTS.zoneVentLatentSeq = ((szAirRpt.VentilLatentGain - szAirRpt.VentilLatentLoss) / timeStepSysSec); // zone ventilation - compLoadDayTS.interZoneMixInstantSeq = ((szAirRpt.MixHeatGain - szAirRpt.MixHeatLoss) / timeStepSysSec); // zone mixing - compLoadDayTS.interZoneMixLatentSeq = ((szAirRpt.MixLatentGain - szAirRpt.MixLatentLoss) / timeStepSysSec); // zone mixing + szCompLoadDayTS.infilInstantSeq = ((szAirRpt.InfilHeatGain - szAirRpt.InfilHeatLoss) / timeStepSysSec); // zone infiltration + szCompLoadDayTS.infilLatentSeq = ((szAirRpt.InfilLatentGain - szAirRpt.InfilLatentLoss) / timeStepSysSec); // zone infiltration + szCompLoadDayTS.zoneVentInstantSeq = ((szAirRpt.VentilHeatGain - szAirRpt.VentilHeatLoss) / timeStepSysSec); // zone ventilation + szCompLoadDayTS.zoneVentLatentSeq = ((szAirRpt.VentilLatentGain - szAirRpt.VentilLatentLoss) / timeStepSysSec); // zone ventilation + szCompLoadDayTS.interZoneMixInstantSeq = ((szAirRpt.MixHeatGain - szAirRpt.MixHeatLoss) / timeStepSysSec); // zone mixing + szCompLoadDayTS.interZoneMixLatentSeq = ((szAirRpt.MixLatentGain - szAirRpt.MixLatentLoss) / timeStepSysSec); // zone mixing } void WriteLoadComponentSummaryTables(EnergyPlusData &state) @@ -15042,7 +15042,7 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) powerGenDelaySeq, lightDelaySeq, feneSolarDelaySeq, - ort->spCompLoads[iSpace - 1], + ort->spCompLoads, surfDelaySeq, spaceComponentAreas(iSpace), zoneNum, @@ -15063,7 +15063,7 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) powerGenDelaySeq, lightDelaySeq, feneSolarDelaySeq, - ort->znCompLoads[iZone - 1], + ort->znCompLoads, surfDelaySeq, ZoneComponentAreas(iZone), iZone); @@ -15163,7 +15163,7 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) powerGenDelaySeq, lightDelaySeq, feneSolarDelaySeq, - ort->znCompLoads[iZone - 1], + ort->znCompLoads, surfDelaySeq); ComputeTableBodyUsingMovingAvg(state, airLoopZonesCoolCompLoadTables.cells, @@ -15177,7 +15177,7 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) powerGenDelaySeq, lightDelaySeq, feneSolarDelaySeq, - ort->znCompLoads[iZone - 1], + ort->znCompLoads, surfDelaySeq); CollectPeakZoneConditions(state, airLoopZonesCoolCompLoadTables, coolDesSelected, timeCoolMax, iZone, true); AddAreaColumnForZone(ZoneComponentAreas(iZone), airLoopZonesCoolCompLoadTables); @@ -15200,7 +15200,7 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) powerGenDelaySeq, lightDelaySeq, feneSolarDelaySeq, - ort->znCompLoads[iZone - 1], + ort->znCompLoads, surfDelaySeq); ComputeTableBodyUsingMovingAvg(state, airLoopZonesHeatCompLoadTables.cells, @@ -15214,7 +15214,7 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) powerGenDelaySeq, lightDelaySeq, feneSolarDelaySeq, - ort->znCompLoads[iZone - 1], + ort->znCompLoads, surfDelaySeq); CollectPeakZoneConditions(state, airLoopZonesHeatCompLoadTables, heatDesSelected, timeHeatMax, iZone, false); AddAreaColumnForZone(ZoneComponentAreas(iZone), airLoopZonesHeatCompLoadTables); @@ -15318,7 +15318,7 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) powerGenDelaySeq, lightDelaySeq, feneSolarDelaySeq, - ort->znCompLoads[iZone - 1], + ort->znCompLoads, surfDelaySeq); ComputeTableBodyUsingMovingAvg(state, facilityZonesCoolCompLoadTables.cells, @@ -15332,7 +15332,7 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) powerGenDelaySeq, lightDelaySeq, feneSolarDelaySeq, - ort->znCompLoads[iZone - 1], + ort->znCompLoads, surfDelaySeq); CollectPeakZoneConditions(state, facilityZonesCoolCompLoadTables, coolDesSelected, timeCoolMax, iZone, true); AddAreaColumnForZone(ZoneComponentAreas(iZone), facilityZonesCoolCompLoadTables); @@ -15355,7 +15355,7 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) powerGenDelaySeq, lightDelaySeq, feneSolarDelaySeq, - ort->znCompLoads[iZone - 1], + ort->znCompLoads, surfDelaySeq); ComputeTableBodyUsingMovingAvg(state, facilityZonesHeatCompLoadTables.cells, @@ -15369,7 +15369,7 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) powerGenDelaySeq, lightDelaySeq, feneSolarDelaySeq, - ort->znCompLoads[iZone - 1], + ort->znCompLoads, surfDelaySeq); CollectPeakZoneConditions(state, facilityZonesHeatCompLoadTables, heatDesSelected, timeHeatMax, iZone, false); AddAreaColumnForZone(ZoneComponentAreas(iZone), facilityZonesHeatCompLoadTables); @@ -15501,7 +15501,7 @@ void computeSpaceZoneCompLoads(EnergyPlusData &state, Array1D &powerGenDelaySeq, Array1D &lightDelaySeq, Array1D &feneSolarDelaySeq, - OutputReportTabular::componentLoads &szCompLoadLoc, + std::vector &szCompLoadLoc, Array2D &surfDelaySeq, ZompComponentAreasType &componentAreas, int const iZone, @@ -15523,7 +15523,8 @@ void computeSpaceZoneCompLoads(EnergyPlusData &state, lightDelaySeq, feneSolarDelaySeq, szCompLoadLoc, - surfDelaySeq); + surfDelaySeq, + iSpace); ComputeTableBodyUsingMovingAvg(state, coolCompLoadTables.cells, coolCompLoadTables.cellUsed, @@ -15537,7 +15538,8 @@ void computeSpaceZoneCompLoads(EnergyPlusData &state, lightDelaySeq, feneSolarDelaySeq, szCompLoadLoc, - surfDelaySeq); + surfDelaySeq, + iSpace); CollectPeakZoneConditions(state, coolCompLoadTables, coolDesSelected, timeCoolMax, iZone, true, iSpace); // send latent load info to coil summary report state.dataRptCoilSelection->coilSelectionReportObj->setZoneLatentLoadCoolingIdealPeak( @@ -15559,7 +15561,8 @@ void computeSpaceZoneCompLoads(EnergyPlusData &state, lightDelaySeq, feneSolarDelaySeq, szCompLoadLoc, - surfDelaySeq); + surfDelaySeq, + iSpace); ComputeTableBodyUsingMovingAvg(state, heatCompLoadTables.cells, heatCompLoadTables.cellUsed, @@ -15573,7 +15576,8 @@ void computeSpaceZoneCompLoads(EnergyPlusData &state, lightDelaySeq, feneSolarDelaySeq, szCompLoadLoc, - surfDelaySeq); + surfDelaySeq, + iSpace); CollectPeakZoneConditions(state, heatCompLoadTables, heatDesSelected, timeHeatMax, iZone, false, iSpace); // send latent load info to coil summary report @@ -15600,15 +15604,18 @@ void GetDelaySequences(EnergyPlusData &state, Array1D &powerGenDelaySeq, Array1D &lightDelaySeq, Array1D &feneSolarDelaySeq, - OutputReportTabular::componentLoads &szCompLoadLoc, - Array2D &surfDelaySeq) + std::vector &szCompLoadLoc, + Array2D &surfDelaySeq, + int const iSpace) { // static bool initAdjFenDone(false); moved to anonymous namespace for unit testing auto &ort = state.dataOutRptTab; + int const szNumMinus1 = (iSpace == 0) ? zoneIndex - 1 : iSpace - 1; // space or zone num minus 1 for vector if (desDaySelected != 0) { - auto &surfCLDay = ort->surfCompLoadsDays[desDaySelected - 1]; + auto &surfCLDay = ort->surfCompLoads[desDaySelected - 1]; + auto &szCLDay = szCompLoadLoc[desDaySelected - 1]; Array2D decayCurve; if (isCooling) { @@ -15644,7 +15651,7 @@ void GetDelaySequences(EnergyPlusData &state, for (int mStepBack = 1; mStepBack <= kTimeStep; ++mStepBack) { int sourceStep = kTimeStep - mStepBack + 1; - auto &compLoadTS = szCompLoadLoc.day[desDaySelected - 1].ts[sourceStep - 1]; + auto &compLoadTS = szCLDay.ts[sourceStep - 1].spacezone[szNumMinus1]; auto &surfCLDayTS = surfCLDay.ts[sourceStep - 1].surf[jSurf - 1]; Real64 thisQRadThermInAbsMult = surfCLDayTS.TMULTseq * surfCLDayTS.ITABSFseq * state.dataSurface->Surface(jSurf).Area * decayCurve(mStepBack, jSurf); @@ -15689,7 +15696,7 @@ void GetDelaySequences(EnergyPlusData &state, lightDelaySeq(kTimeStep) = lightLWConvIntoZone + lightSWConvIntoZone; feneSolarDelaySeq(kTimeStep) = feneSolarConvIntoZone; // also remove the net radiant component on the instanteous conduction for fenestration - auto &szCompLoadDayTS = szCompLoadLoc.day[desDaySelected - 1].ts[kTimeStep - 1]; + auto &szCompLoadDayTS = szCLDay.ts[kTimeStep - 1].spacezone[szNumMinus1]; if (!szCompLoadDayTS.adjFenDone) { szCompLoadDayTS.feneCondInstantSeq -= adjFeneSurfNetRadSeq; szCompLoadDayTS.adjFenDone = true; @@ -15714,8 +15721,9 @@ void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, Array1D const &powerGenDelaySeq, Array1D const &lightDelaySeq, Array1D const &feneSolarDelaySeq, - OutputReportTabular::componentLoads &szCompLoadLoc, - Array2D const &surfDelaySeq) + std::vector &szCompLoadLoc, + Array2D const &surfDelaySeq, + int const iSpace) { Array1D AvgData; // sequence data to be averaging Array1D delayOpaque; // hold values for report for delayed opaque @@ -15725,19 +15733,20 @@ void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, delayOpaque.allocate(LoadCompRow::GrdTot); Real64 numTSinDay = state.dataGlobal->NumOfTimeStepInHour * 24; AvgData.allocate(numTSinDay); + int const szNumMinus1 = (iSpace == 0) ? zoneIndex - 1 : iSpace - 1; // space or zone num minus 1 for vector if (desDaySelected != 0 && timeOfMax != 0) { // Don't update/average original array data // PEOPLE - auto &compLoadDay = szCompLoadLoc.day[desDaySelected - 1]; + auto &compLoadDay = szCompLoadLoc[desDaySelected - 1]; for (int iTS = 1; iTS <= numTSinDay; ++iTS) { - AvgData(iTS) = compLoadDay.ts[iTS - 1].peopleInstantSeq; + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].peopleInstantSeq; } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::People) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::People) = true; for (int iTS = 1; iTS <= numTSinDay; ++iTS) { - AvgData(iTS) = compLoadDay.ts[iTS - 1].peopleLatentSeq; + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].peopleLatentSeq; } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::Latent, LoadCompRow::People) = AvgData(timeOfMax); @@ -15749,13 +15758,13 @@ void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, // LIGHTS for (int iTS = 1; iTS <= numTSinDay; ++iTS) { - AvgData(iTS) = compLoadDay.ts[iTS - 1].lightInstantSeq; + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].lightInstantSeq; } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::Lights) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::Lights) = true; for (int iTS = 1; iTS <= numTSinDay; ++iTS) { - AvgData(iTS) = compLoadDay.ts[iTS - 1].lightRetAirSeq; + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].lightRetAirSeq; } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensRA, LoadCompRow::Lights) = AvgData(timeOfMax); @@ -15767,13 +15776,13 @@ void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, // EQUIPMENT for (int iTS = 1; iTS <= numTSinDay; ++iTS) { - AvgData(iTS) = compLoadDay.ts[iTS - 1].equipInstantSeq; + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].equipInstantSeq; } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::Equip) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::Equip) = true; for (int iTS = 1; iTS <= numTSinDay; ++iTS) { - AvgData(iTS) = compLoadDay.ts[iTS - 1].equipLatentSeq; + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].equipLatentSeq; } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::Latent, LoadCompRow::Equip) = AvgData(timeOfMax); @@ -15785,19 +15794,19 @@ void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, // REFRIGERATION EQUIPMENT for (int iTS = 1; iTS <= numTSinDay; ++iTS) { - AvgData(iTS) = compLoadDay.ts[iTS - 1].refrigInstantSeq; + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].refrigInstantSeq; } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::Refrig) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::Refrig) = true; for (int iTS = 1; iTS <= numTSinDay; ++iTS) { - AvgData(iTS) = compLoadDay.ts[iTS - 1].refrigRetAirSeq; + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].refrigRetAirSeq; } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensRA, LoadCompRow::Refrig) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensRA, LoadCompRow::Refrig) = true; for (int iTS = 1; iTS <= numTSinDay; ++iTS) { - AvgData(iTS) = compLoadDay.ts[iTS - 1].refrigLatentSeq; + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].refrigLatentSeq; } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::Latent, LoadCompRow::Refrig) = AvgData(timeOfMax); @@ -15805,13 +15814,13 @@ void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, // WATER USE EQUIPMENT for (int iTS = 1; iTS <= numTSinDay; ++iTS) { - AvgData(iTS) = compLoadDay.ts[iTS - 1].waterUseInstantSeq; + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].waterUseInstantSeq; } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::WaterUse) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::WaterUse) = true; for (int iTS = 1; iTS <= numTSinDay; ++iTS) { - AvgData(iTS) = compLoadDay.ts[iTS - 1].waterUseLatentSeq; + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].waterUseLatentSeq; } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::Latent, LoadCompRow::WaterUse) = AvgData(timeOfMax); @@ -15819,7 +15828,7 @@ void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, // HVAC EQUIPMENT LOSSES for (int iTS = 1; iTS <= numTSinDay; ++iTS) { - AvgData(iTS) = compLoadDay.ts[iTS - 1].hvacLossInstantSeq; + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].hvacLossInstantSeq; } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::HvacLoss) = AvgData(timeOfMax); @@ -15831,7 +15840,7 @@ void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, // POWER GENERATION EQUIPMENT for (int iTS = 1; iTS <= numTSinDay; ++iTS) { - AvgData(iTS) = compLoadDay.ts[iTS - 1].powerGenInstantSeq; + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].powerGenInstantSeq; } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::PowerGen) = AvgData(timeOfMax); @@ -15852,13 +15861,13 @@ void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, // INFILTRATION for (int iTS = 1; iTS <= numTSinDay; ++iTS) { - AvgData(iTS) = compLoadDay.ts[iTS - 1].infilInstantSeq; + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].infilInstantSeq; } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::Infil) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::Infil) = true; for (int iTS = 1; iTS <= numTSinDay; ++iTS) { - AvgData(iTS) = compLoadDay.ts[iTS - 1].infilLatentSeq; + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].infilLatentSeq; } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::Latent, LoadCompRow::Infil) = AvgData(timeOfMax); @@ -15866,13 +15875,13 @@ void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, // ZONE VENTILATION for (int iTS = 1; iTS <= numTSinDay; ++iTS) { - AvgData(iTS) = compLoadDay.ts[iTS - 1].zoneVentInstantSeq; + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].zoneVentInstantSeq; } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::ZoneVent) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::ZoneVent) = true; for (int iTS = 1; iTS <= numTSinDay; ++iTS) { - AvgData(iTS) = compLoadDay.ts[iTS - 1].zoneVentLatentSeq; + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].zoneVentLatentSeq; } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::Latent, LoadCompRow::ZoneVent) = AvgData(timeOfMax); @@ -15880,13 +15889,13 @@ void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, // INTERZONE MIXING for (int iTS = 1; iTS <= numTSinDay; ++iTS) { - AvgData(iTS) = compLoadDay.ts[iTS - 1].interZoneMixInstantSeq; + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].interZoneMixInstantSeq; } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::IntZonMix) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::IntZonMix) = true; for (int iTS = 1; iTS <= numTSinDay; ++iTS) { - AvgData(iTS) = compLoadDay.ts[iTS - 1].interZoneMixLatentSeq; + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].interZoneMixLatentSeq; } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::Latent, LoadCompRow::IntZonMix) = AvgData(timeOfMax); @@ -15894,7 +15903,7 @@ void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, // FENESTRATION CONDUCTION for (int iTS = 1; iTS <= numTSinDay; ++iTS) { - AvgData(iTS) = compLoadDay.ts[iTS - 1].feneCondInstantSeq; + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].feneCondInstantSeq; } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::FeneCond) = AvgData(timeOfMax); diff --git a/src/EnergyPlus/OutputReportTabular.hh b/src/EnergyPlus/OutputReportTabular.hh index 157585aff49..d9364d7fdc1 100644 --- a/src/EnergyPlus/OutputReportTabular.hh +++ b/src/EnergyPlus/OutputReportTabular.hh @@ -507,12 +507,12 @@ namespace OutputReportTabular { std::vector surf; }; - struct componentLoadsDaySurfaces + struct componentLoadsSurf { std::vector ts; }; - struct compLoadsTimeStep + struct compLoadsSpaceZone { Real64 peopleInstantSeq = 0.0; Real64 peopleLatentSeq = 0.0; @@ -550,14 +550,13 @@ namespace OutputReportTabular { Real64 feneCondInstantSeq = 0.0; bool adjFenDone = false; }; - struct compLoadsDay + struct compLoadsTimeStepSpZn { - - std::vector ts; + std::vector spacezone; }; - struct componentLoads + struct componentLoadsSpZn { - std::vector day; + std::vector ts; }; // Functions @@ -846,7 +845,7 @@ namespace OutputReportTabular { void GatherComponentLoadsHVAC(EnergyPlusData &state); - void gatherSpaceZoneCompLoadsHVAC(OutputReportTabular::compLoadsTimeStep &compLoadDayTS, + void gatherSpaceZoneCompLoadsHVAC(OutputReportTabular::compLoadsSpaceZone &compLoadDayTS, DataHeatBalance::AirReportVars const &szAirRpt, Real64 const timeStepSysSec); @@ -862,7 +861,7 @@ namespace OutputReportTabular { Array1D &powerGenDelaySeq, Array1D &lightDelaySeq, Array1D &feneSolarDelaySeq, - OutputReportTabular::componentLoads &zsCompLoadLoc, + std::vector &szCompLoadLoc, Array2D &surfDelaySeq, ZompComponentAreasType &componentAreas, int const iZone, @@ -878,8 +877,9 @@ namespace OutputReportTabular { Array1D &powerGenDelaySeq, Array1D &lightDelaySeq, Array1D &feneSolarDelaySeq, - OutputReportTabular::componentLoads &zsCompLoadLoc, - Array2D &surfDelaySeq); + std::vector &szCompLoadLoc, + Array2D &surfDelaySeq, + int const iSpace = 0); void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, Array2D &resultCells, @@ -893,8 +893,9 @@ namespace OutputReportTabular { Array1D const &powerGenDelaySeq, Array1D const &lightDelaySeq, Array1D const &feneSolarDelaySeq, - OutputReportTabular::componentLoads &zsCompLoadLoc, - Array2D const &surfDelaySeq); + std::vector &szCompLoadLoc, + Array2D const &surfDelaySeq, + int const iSpace = 0); void CollectPeakZoneConditions( EnergyPlusData &state, CompLoadTablesType &compLoad, int desDaySelected, int timeOfMax, int zoneIndex, bool isCooling, int spaceIndex = 0); @@ -1251,9 +1252,9 @@ struct OutputReportTabularData : BaseGlobalStruct Array2D decayCurveCool; Array2D decayCurveHeat; - std::vector surfCompLoadsDays; - std::vector znCompLoads; // Zone component loads - std::vector spCompLoads; // Space component loads + std::vector surfCompLoads; // Surface component loads by day, timestep, then surface + std::vector znCompLoads; // Zone component loads by day, timestep, then zone + std::vector spCompLoads; // Space component loads by day, timestep, then space int maxUniqueKeyCount = 0; @@ -1526,7 +1527,7 @@ struct OutputReportTabularData : BaseGlobalStruct this->radiantPulseReceived.deallocate(); this->decayCurveCool.deallocate(); this->decayCurveHeat.deallocate(); - this->surfCompLoadsDays.clear(); + this->surfCompLoads.clear(); this->znCompLoads.clear(); this->spCompLoads.clear(); diff --git a/tst/EnergyPlus/unit/InternalHeatGains.unit.cc b/tst/EnergyPlus/unit/InternalHeatGains.unit.cc index 8c378658dc0..193bc0887f0 100644 --- a/tst/EnergyPlus/unit/InternalHeatGains.unit.cc +++ b/tst/EnergyPlus/unit/InternalHeatGains.unit.cc @@ -695,7 +695,7 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_CheckZoneComponentLoadSubtotals) state->dataGlobal->CompLoadReportIsReq = true; state->dataGlobal->isPulseZoneSizing = false; InternalHeatGains::GatherComponentLoadsIntGain(*state); - auto &znCompLoadDayTS = state->dataOutRptTab->znCompLoads[zoneNum - 1].day[state->dataSize->CurOverallSimDay - 1].ts[timeStepInDay - 1]; + auto &znCompLoadDayTS = state->dataOutRptTab->znCompLoads[state->dataSize->CurOverallSimDay - 1].ts[timeStepInDay - 1].spacezone[zoneNum - 1]; totConvGains = znCompLoadDayTS.peopleInstantSeq + znCompLoadDayTS.lightInstantSeq + znCompLoadDayTS.equipInstantSeq + znCompLoadDayTS.refrigInstantSeq + znCompLoadDayTS.waterUseInstantSeq + znCompLoadDayTS.hvacLossInstantSeq + znCompLoadDayTS.powerGenInstantSeq; diff --git a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc index d2a36a315e6..c6b6e4d3309 100644 --- a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc +++ b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc @@ -524,17 +524,17 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_AllocateLoadComponentArraysTes // decayCurveHeat.allocate( NumOfTimeStepInHour * 24, TotSurfaces ); EXPECT_EQ(state->dataOutRptTab->decayCurveHeat.size(), 672u); - EXPECT_EQ(state->dataOutRptTab->surfCompLoadsDays.size(), 5u); - EXPECT_EQ(state->dataOutRptTab->surfCompLoadsDays[0].ts.size(), 96u); - EXPECT_EQ(state->dataOutRptTab->surfCompLoadsDays[0].ts[0].surf.size(), 7u); - EXPECT_EQ(state->dataOutRptTab->surfCompLoadsDays[4].ts.size(), 96u); - EXPECT_EQ(state->dataOutRptTab->surfCompLoadsDays[4].ts[0].surf.size(), 7u); - - EXPECT_EQ(state->dataOutRptTab->znCompLoads.size(), 4u); - EXPECT_EQ(state->dataOutRptTab->znCompLoads[0].day.size(), 5u); - EXPECT_EQ(state->dataOutRptTab->znCompLoads[0].day[0].ts.size(), 96u); - EXPECT_EQ(state->dataOutRptTab->znCompLoads[3].day.size(), 5u); - EXPECT_EQ(state->dataOutRptTab->znCompLoads[3].day[4].ts.size(), 96u); + EXPECT_EQ(state->dataOutRptTab->surfCompLoads.size(), 5u); + EXPECT_EQ(state->dataOutRptTab->surfCompLoads[0].ts.size(), 96u); + EXPECT_EQ(state->dataOutRptTab->surfCompLoads[0].ts[0].surf.size(), 7u); + EXPECT_EQ(state->dataOutRptTab->surfCompLoads[4].ts.size(), 96u); + EXPECT_EQ(state->dataOutRptTab->surfCompLoads[4].ts[95].surf.size(), 7u); + + EXPECT_EQ(state->dataOutRptTab->znCompLoads.size(), 5u); + EXPECT_EQ(state->dataOutRptTab->znCompLoads[0].ts.size(), 96u); + EXPECT_EQ(state->dataOutRptTab->znCompLoads[0].ts[0].spacezone.size(), 4u); + EXPECT_EQ(state->dataOutRptTab->znCompLoads[4].ts.size(), 96u); + EXPECT_EQ(state->dataOutRptTab->znCompLoads[4].ts[95].spacezone.size(), 4u); } TEST_F(EnergyPlusFixture, OutputReportTabularTest_ConfirmConvertToEscaped) @@ -6931,10 +6931,10 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesTwice_test) AllocateLoadComponentArrays(*state); - auto &znCL = state->dataOutRptTab->znCompLoads[iZone - 1]; - znCL.day[coolDesSelected - 1].ts[0].feneCondInstantSeq = 0.88; + auto &znCL = state->dataOutRptTab->znCompLoads; + znCL[coolDesSelected - 1].ts[0].spacezone[iZone - 1].feneCondInstantSeq = 0.88; - state->dataOutRptTab->surfCompLoadsDays[coolDesSelected - 1].ts[0].surf[0].netSurfRadSeq = 0.05; + state->dataOutRptTab->surfCompLoads[coolDesSelected - 1].ts[0].surf[0].netSurfRadSeq = 0.05; GetDelaySequences(*state, coolDesSelected, @@ -6949,8 +6949,9 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesTwice_test) znCL, surfDelaySeqCool); - EXPECT_EQ(0.83, - znCL.day[coolDesSelected - 1].ts[0].feneCondInstantSeq); // the first time the subtraction operation should have occurred + EXPECT_EQ( + 0.83, + znCL[coolDesSelected - 1].ts[0].spacezone[iZone - 1].feneCondInstantSeq); // the first time the subtraction operation should have occurred GetDelaySequences(*state, coolDesSelected, @@ -6966,8 +6967,9 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesTwice_test) surfDelaySeqCool); EXPECT_EQ(0.83, - znCL.day[coolDesSelected - 1].ts[0].feneCondInstantSeq); // the second time the subtraction should not have happened since it is - // only adjusted once so the value should be the same. + znCL[coolDesSelected - 1].ts[0].spacezone[iZone - 1].feneCondInstantSeq); // the second time the subtraction should not have happened + // since it is + // only adjusted once so the value should be the same. } TEST_F(SQLiteFixture, OutputReportTabular_WriteLoadComponentSummaryTables_AirLoop_ZeroDesignDay) @@ -8324,11 +8326,12 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesSurfaceOrder_ state->dataSurface->Surface(3).RadEnclIndex = 1; state->dataSurface->Surface(4).RadEnclIndex = 1; - auto &znCL = state->dataOutRptTab->znCompLoads[iZone - 1]; + auto &znCL = state->dataOutRptTab->znCompLoads; + auto &znCLDay = znCL[coolDesSelected - 1]; for (int jSurf = 1; jSurf <= 4; ++jSurf) { for (int step = 1; step <= 10; ++step) { - auto &znCLDayTS = znCL.day[coolDesSelected - 1].ts[step - 1]; - auto &surfCLDayTS = state->dataOutRptTab->surfCompLoadsDays[coolDesSelected - 1].ts[step - 1].surf[jSurf - 1]; + auto &znCLDayTS = znCLDay.ts[step - 1].spacezone[iZone - 1]; + auto &surfCLDayTS = state->dataOutRptTab->surfCompLoads[coolDesSelected - 1].ts[step - 1].surf[jSurf - 1]; surfCLDayTS.TMULTseq = 0.1 * step; surfCLDayTS.ITABSFseq = 0.2 * step * surfBaseValue[jSurf - 1]; state->dataOutRptTab->decayCurveCool(step, jSurf) = 0.3 * step * surfBaseValue[jSurf - 1]; @@ -8382,8 +8385,8 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesSurfaceOrder_ for (int jSurf = 1; jSurf <= 4; ++jSurf) { for (int step = 1; step <= 10; ++step) { - auto &znCLDayTS = znCL.day[coolDesSelected - 1].ts[step - 1]; - auto &surfCLDayTS = state->dataOutRptTab->surfCompLoadsDays[coolDesSelected - 1].ts[step - 1].surf[jSurf - 1]; + auto &znCLDayTS = znCLDay.ts[step - 1].spacezone[iZone - 1]; + auto &surfCLDayTS = state->dataOutRptTab->surfCompLoads[coolDesSelected - 1].ts[step - 1].surf[jSurf - 1]; surfCLDayTS.TMULTseq = 0.1 * step; surfCLDayTS.ITABSFseq = 0.2 * step * surfBaseValue[jSurf - 1]; state->dataOutRptTab->decayCurveCool(step, jSurf) = 0.3 * step * surfBaseValue[jSurf - 1]; From 22c969c9b068fea9d776b88e22e3712f3967cb2f Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Mon, 30 Sep 2024 15:46:42 -0500 Subject: [PATCH 19/25] Space IV.6 - fix delayed int gains for space and zone --- src/EnergyPlus/InternalHeatGains.cc | 162 +++++++++++------- src/EnergyPlus/InternalHeatGains.hh | 5 + src/EnergyPlus/OutputReportTabular.cc | 28 ++- src/EnergyPlus/OutputReportTabular.hh | 22 ++- .../unit/OutputReportTabular.unit.cc | 36 ++-- 5 files changed, 160 insertions(+), 93 deletions(-) diff --git a/src/EnergyPlus/InternalHeatGains.cc b/src/EnergyPlus/InternalHeatGains.cc index fcbe1e121a0..44d0a92ea89 100644 --- a/src/EnergyPlus/InternalHeatGains.cc +++ b/src/EnergyPlus/InternalHeatGains.cc @@ -127,6 +127,67 @@ namespace InternalHeatGains { using namespace DataHeatBalance; using namespace DataSurfaces; + static constexpr std::array IntGainTypesPeople = {DataHeatBalance::IntGainType::People}; + static constexpr std::array IntGainTypesLight = {DataHeatBalance::IntGainType::Lights}; + static constexpr std::array IntGainTypesEquip = {DataHeatBalance::IntGainType::ElectricEquipment, + DataHeatBalance::IntGainType::ElectricEquipmentITEAirCooled, + DataHeatBalance::IntGainType::GasEquipment, + DataHeatBalance::IntGainType::HotWaterEquipment, + DataHeatBalance::IntGainType::SteamEquipment, + DataHeatBalance::IntGainType::OtherEquipment, + DataHeatBalance::IntGainType::IndoorGreen}; + static constexpr std::array IntGainTypesRefrig = { + DataHeatBalance::IntGainType::RefrigerationCase, + DataHeatBalance::IntGainType::RefrigerationCompressorRack, + DataHeatBalance::IntGainType::RefrigerationSystemAirCooledCondenser, + DataHeatBalance::IntGainType::RefrigerationSystemSuctionPipe, + DataHeatBalance::IntGainType::RefrigerationSecondaryReceiver, + DataHeatBalance::IntGainType::RefrigerationSecondaryPipe, + DataHeatBalance::IntGainType::RefrigerationWalkIn, + DataHeatBalance::IntGainType::RefrigerationTransSysAirCooledGasCooler, + DataHeatBalance::IntGainType::RefrigerationTransSysSuctionPipeMT, + DataHeatBalance::IntGainType::RefrigerationTransSysSuctionPipeLT}; + static constexpr std::array IntGainTypesWaterUse = {DataHeatBalance::IntGainType::WaterUseEquipment, + DataHeatBalance::IntGainType::WaterHeaterMixed, + DataHeatBalance::IntGainType::WaterHeaterStratified}; + static constexpr std::array IntGainTypesHvacLoss = { + DataHeatBalance::IntGainType::ZoneBaseboardOutdoorTemperatureControlled, + DataHeatBalance::IntGainType::ThermalStorageChilledWaterMixed, + DataHeatBalance::IntGainType::ThermalStorageChilledWaterStratified, + DataHeatBalance::IntGainType::PipeIndoor, + DataHeatBalance::IntGainType::Pump_VarSpeed, + DataHeatBalance::IntGainType::Pump_ConSpeed, + DataHeatBalance::IntGainType::Pump_Cond, + DataHeatBalance::IntGainType::PumpBank_VarSpeed, + DataHeatBalance::IntGainType::PumpBank_ConSpeed, + DataHeatBalance::IntGainType::PlantComponentUserDefined, + DataHeatBalance::IntGainType::CoilUserDefined, + DataHeatBalance::IntGainType::ZoneHVACForcedAirUserDefined, + DataHeatBalance::IntGainType::AirTerminalUserDefined, + DataHeatBalance::IntGainType::PackagedTESCoilTank, + DataHeatBalance::IntGainType::FanSystemModel, + DataHeatBalance::IntGainType::SecCoolingDXCoilSingleSpeed, + DataHeatBalance::IntGainType::SecHeatingDXCoilSingleSpeed, + DataHeatBalance::IntGainType::SecCoolingDXCoilTwoSpeed, + DataHeatBalance::IntGainType::SecCoolingDXCoilMultiSpeed, + DataHeatBalance::IntGainType::SecHeatingDXCoilMultiSpeed}; + static constexpr std::array IntGainTypesPowerGen = { + DataHeatBalance::IntGainType::GeneratorFuelCell, + DataHeatBalance::IntGainType::GeneratorMicroCHP, + DataHeatBalance::IntGainType::ElectricLoadCenterTransformer, + DataHeatBalance::IntGainType::ElectricLoadCenterInverterSimple, + DataHeatBalance::IntGainType::ElectricLoadCenterInverterFunctionOfPower, + DataHeatBalance::IntGainType::ElectricLoadCenterInverterLookUpTable, + DataHeatBalance::IntGainType::ElectricLoadCenterStorageLiIonNmcBattery, + DataHeatBalance::IntGainType::ElectricLoadCenterStorageBattery, + DataHeatBalance::IntGainType::ElectricLoadCenterStorageSimple, + DataHeatBalance::IntGainType::ElectricLoadCenterConverter}; + // Explicitly list internal gains not gathered here + static constexpr std::array ExcludedIntGainTypes = { + DataHeatBalance::IntGainType::ZoneContaminantSourceAndSinkCarbonDioxide, + DataHeatBalance::IntGainType::DaylightingDeviceTubular, + DataHeatBalance::IntGainType::ZoneContaminantSourceAndSinkGenericContam}; + void ManageInternalHeatGains(EnergyPlusData &state, ObjexxFCL::Optional_bool_const InitOnly) // when true, just calls the get input, if appropriate and returns. { @@ -9241,6 +9302,32 @@ namespace InternalHeatGains { return SumRadiationGainRate; } + Real64 SumEnclosureInternalRadiationGainsByTypes( + EnergyPlusData &state, + int const enclosureNum, // enclosure to sum gains for + gsl::span GainTypeARR) // variable length 1-d array of enum valued gain types + { + // Return value + Real64 SumRadiationGainRate(0.0); + + int NumberOfTypes = GainTypeARR.size(); + + for (int spaceNum : state.dataViewFactor->EnclRadInfo(enclosureNum).spaceNums) { + if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) { + continue; + } + for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) { + for (int TypeNum = 0; TypeNum < NumberOfTypes; ++TypeNum) { + if (state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CompType == GainTypeARR[TypeNum]) { + SumRadiationGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).RadiantGainRate; + } + } + } + } + + return SumRadiationGainRate; + } + void SumAllInternalLatentGains(EnergyPlusData &state, int const ZoneNum // zone index pointer for which zone to sum gains for ) @@ -9512,6 +9599,14 @@ namespace InternalHeatGains { auto &znCLDayTS = state.dataOutRptTab->znCompLoads[state.dataSize->CurOverallSimDay - 1].ts[TimeStepInDay - 1].spacezone[iZone - 1]; gatherCompLoadIntGain2(state, znCLDayTS, iZone); } + for (int iEncl = 1; iEncl <= state.dataViewFactor->NumOfRadiantEnclosures; ++iEncl) { + auto &enclCLDayTS = state.dataOutRptTab->enclCompLoads[state.dataSize->CurOverallSimDay - 1].ts[TimeStepInDay - 1].encl[iEncl - 1]; + enclCLDayTS.peopleRadSeq = SumEnclosureInternalRadiationGainsByTypes(state, iEncl, IntGainTypesPeople); + enclCLDayTS.lightLWRadSeq = SumEnclosureInternalRadiationGainsByTypes(state, iEncl, IntGainTypesLight); + enclCLDayTS.equipRadSeq = SumEnclosureInternalRadiationGainsByTypes(state, iEncl, IntGainTypesEquip); + enclCLDayTS.hvacLossRadSeq = SumEnclosureInternalRadiationGainsByTypes(state, iEncl, IntGainTypesHvacLoss); + enclCLDayTS.powerGenRadSeq = SumEnclosureInternalRadiationGainsByTypes(state, iEncl, IntGainTypesPowerGen); + } if (state.dataHeatBal->doSpaceHeatBalanceSizing) { for (int iSpace = 1; iSpace <= state.dataGlobal->NumOfZones; ++iSpace) { auto &spCLDayTS = @@ -9525,82 +9620,19 @@ namespace InternalHeatGains { void gatherCompLoadIntGain2(EnergyPlusData &state, OutputReportTabular::compLoadsSpaceZone &szCompLoadDayTS, int const zoneNum, int const spaceNum) { - static constexpr std::array IntGainTypesPeople = {DataHeatBalance::IntGainType::People}; - static constexpr std::array IntGainTypesLight = {DataHeatBalance::IntGainType::Lights}; - static constexpr std::array IntGainTypesEquip = {DataHeatBalance::IntGainType::ElectricEquipment, - DataHeatBalance::IntGainType::ElectricEquipmentITEAirCooled, - DataHeatBalance::IntGainType::GasEquipment, - DataHeatBalance::IntGainType::HotWaterEquipment, - DataHeatBalance::IntGainType::SteamEquipment, - DataHeatBalance::IntGainType::OtherEquipment, - DataHeatBalance::IntGainType::IndoorGreen}; - static constexpr std::array IntGainTypesRefrig = { - DataHeatBalance::IntGainType::RefrigerationCase, - DataHeatBalance::IntGainType::RefrigerationCompressorRack, - DataHeatBalance::IntGainType::RefrigerationSystemAirCooledCondenser, - DataHeatBalance::IntGainType::RefrigerationSystemSuctionPipe, - DataHeatBalance::IntGainType::RefrigerationSecondaryReceiver, - DataHeatBalance::IntGainType::RefrigerationSecondaryPipe, - DataHeatBalance::IntGainType::RefrigerationWalkIn, - DataHeatBalance::IntGainType::RefrigerationTransSysAirCooledGasCooler, - DataHeatBalance::IntGainType::RefrigerationTransSysSuctionPipeMT, - DataHeatBalance::IntGainType::RefrigerationTransSysSuctionPipeLT}; - static constexpr std::array IntGainTypesWaterUse = {DataHeatBalance::IntGainType::WaterUseEquipment, - DataHeatBalance::IntGainType::WaterHeaterMixed, - DataHeatBalance::IntGainType::WaterHeaterStratified}; - static constexpr std::array IntGainTypesHvacLoss = { - DataHeatBalance::IntGainType::ZoneBaseboardOutdoorTemperatureControlled, - DataHeatBalance::IntGainType::ThermalStorageChilledWaterMixed, - DataHeatBalance::IntGainType::ThermalStorageChilledWaterStratified, - DataHeatBalance::IntGainType::PipeIndoor, - DataHeatBalance::IntGainType::Pump_VarSpeed, - DataHeatBalance::IntGainType::Pump_ConSpeed, - DataHeatBalance::IntGainType::Pump_Cond, - DataHeatBalance::IntGainType::PumpBank_VarSpeed, - DataHeatBalance::IntGainType::PumpBank_ConSpeed, - DataHeatBalance::IntGainType::PlantComponentUserDefined, - DataHeatBalance::IntGainType::CoilUserDefined, - DataHeatBalance::IntGainType::ZoneHVACForcedAirUserDefined, - DataHeatBalance::IntGainType::AirTerminalUserDefined, - DataHeatBalance::IntGainType::PackagedTESCoilTank, - DataHeatBalance::IntGainType::FanSystemModel, - DataHeatBalance::IntGainType::SecCoolingDXCoilSingleSpeed, - DataHeatBalance::IntGainType::SecHeatingDXCoilSingleSpeed, - DataHeatBalance::IntGainType::SecCoolingDXCoilTwoSpeed, - DataHeatBalance::IntGainType::SecCoolingDXCoilMultiSpeed, - DataHeatBalance::IntGainType::SecHeatingDXCoilMultiSpeed}; - static constexpr std::array IntGainTypesPowerGen = { - DataHeatBalance::IntGainType::GeneratorFuelCell, - DataHeatBalance::IntGainType::GeneratorMicroCHP, - DataHeatBalance::IntGainType::ElectricLoadCenterTransformer, - DataHeatBalance::IntGainType::ElectricLoadCenterInverterSimple, - DataHeatBalance::IntGainType::ElectricLoadCenterInverterFunctionOfPower, - DataHeatBalance::IntGainType::ElectricLoadCenterInverterLookUpTable, - DataHeatBalance::IntGainType::ElectricLoadCenterStorageLiIonNmcBattery, - DataHeatBalance::IntGainType::ElectricLoadCenterStorageBattery, - DataHeatBalance::IntGainType::ElectricLoadCenterStorageSimple, - DataHeatBalance::IntGainType::ElectricLoadCenterConverter}; - // Explicitly list internal gains not gathered here - static constexpr std::array ExcludedIntGainTypes = { - DataHeatBalance::IntGainType::ZoneContaminantSourceAndSinkCarbonDioxide, - DataHeatBalance::IntGainType::DaylightingDeviceTubular, - DataHeatBalance::IntGainType::ZoneContaminantSourceAndSinkGenericContam}; - // Make sure all types of internal gains have been gathered assert((int)(size(IntGainTypesPeople) + size(IntGainTypesLight) + size(IntGainTypesEquip) + size(IntGainTypesRefrig) + size(IntGainTypesWaterUse) + size(IntGainTypesHvacLoss) + size(IntGainTypesPowerGen) + size(ExcludedIntGainTypes)) == (int)DataHeatBalance::IntGainType::Num); + szCompLoadDayTS.peopleInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesPeople, spaceNum); szCompLoadDayTS.peopleLatentSeq = SumInternalLatentGainsByTypes(state, zoneNum, IntGainTypesPeople, spaceNum); - szCompLoadDayTS.peopleRadSeq = SumInternalRadiationGainsByTypes(state, zoneNum, IntGainTypesPeople, spaceNum); szCompLoadDayTS.lightInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesLight, spaceNum); szCompLoadDayTS.lightRetAirSeq = SumReturnAirConvectionGainsByTypes(state, zoneNum, IntGainTypesLight, spaceNum); - szCompLoadDayTS.lightLWRadSeq = SumInternalRadiationGainsByTypes(state, zoneNum, IntGainTypesLight, spaceNum); szCompLoadDayTS.equipInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesEquip, spaceNum); szCompLoadDayTS.equipLatentSeq = SumInternalLatentGainsByTypes(state, zoneNum, IntGainTypesEquip, spaceNum); - szCompLoadDayTS.equipRadSeq = SumInternalRadiationGainsByTypes(state, zoneNum, IntGainTypesEquip, spaceNum); szCompLoadDayTS.refrigInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesRefrig, spaceNum); szCompLoadDayTS.refrigRetAirSeq = SumReturnAirConvectionGainsByTypes(state, zoneNum, IntGainTypesRefrig, spaceNum); @@ -9610,10 +9642,8 @@ namespace InternalHeatGains { szCompLoadDayTS.waterUseLatentSeq = SumInternalLatentGainsByTypes(state, zoneNum, IntGainTypesWaterUse, spaceNum); szCompLoadDayTS.hvacLossInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesHvacLoss, spaceNum); - szCompLoadDayTS.hvacLossRadSeq = SumInternalRadiationGainsByTypes(state, zoneNum, IntGainTypesHvacLoss, spaceNum); szCompLoadDayTS.powerGenInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesPowerGen, spaceNum); - szCompLoadDayTS.powerGenRadSeq = SumInternalRadiationGainsByTypes(state, zoneNum, IntGainTypesPowerGen, spaceNum); } int GetInternalGainDeviceIndex(EnergyPlusData &state, diff --git a/src/EnergyPlus/InternalHeatGains.hh b/src/EnergyPlus/InternalHeatGains.hh index 3e4943058a2..600f12ebd86 100644 --- a/src/EnergyPlus/InternalHeatGains.hh +++ b/src/EnergyPlus/InternalHeatGains.hh @@ -181,6 +181,11 @@ namespace InternalHeatGains { gsl::span GainTypeARR, // variable length 1-d array of enum valued gain types int const spaceIndex = 0); // space index pointer, sum gains only for this space + Real64 SumEnclosureInternalRadiationGainsByTypes( + EnergyPlusData &state, + int const enclosureNum, // enclosure to sum gains for + gsl::span GainTypeARR); // variable length 1-d array of enum valued gain types + void SumAllInternalLatentGains(EnergyPlusData &state, int const ZoneNum // zone index pointer for which zone to sum gains for ); diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index 339f7587619..2b95ab502ab 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -14502,6 +14502,14 @@ void AllocateLoadComponentArrays(EnergyPlusData &state) } } + ort->enclCompLoads.resize(state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays); + for (auto &day : ort->enclCompLoads) { + day.ts.resize(numTSinDay); + for (auto &ts : day.ts) { + ts.encl.resize(state.dataViewFactor->NumOfRadiantEnclosures); + } + } + ort->znCompLoads.resize(state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays); for (auto &day : ort->znCompLoads) { day.ts.resize(numTSinDay); @@ -15614,7 +15622,8 @@ void GetDelaySequences(EnergyPlusData &state, int const szNumMinus1 = (iSpace == 0) ? zoneIndex - 1 : iSpace - 1; // space or zone num minus 1 for vector if (desDaySelected != 0) { - auto &surfCLDay = ort->surfCompLoads[desDaySelected - 1]; + auto const &surfCLDay = ort->surfCompLoads[desDaySelected - 1]; + auto const &enclCLDay = ort->enclCompLoads[desDaySelected - 1]; auto &szCLDay = szCompLoadLoc[desDaySelected - 1]; Array2D decayCurve; @@ -15636,10 +15645,10 @@ void GetDelaySequences(EnergyPlusData &state, // code from ComputeDelayedComponents starts for (int spaceNum : state.dataHeatBal->Zone(zoneIndex).spaceIndexes) { + if ((iSpace > 0) && (spaceNum != iSpace)) continue; auto const &thisSpace = state.dataHeatBal->space(spaceNum); for (int jSurf = thisSpace.HTSurfaceFirst; jSurf <= thisSpace.HTSurfaceLast; ++jSurf) { - int radEnclosureNum = state.dataSurface->Surface(jSurf).RadEnclIndex; - + int const radEnclosureNum = state.dataSurface->Surface(jSurf).RadEnclIndex; // for each time step, step back through time and apply decay curve to radiant heat for each end use absorbed in each surface Real64 peopleConvFromSurf = 0.0; Real64 equipConvFromSurf = 0.0; @@ -15652,14 +15661,15 @@ void GetDelaySequences(EnergyPlusData &state, for (int mStepBack = 1; mStepBack <= kTimeStep; ++mStepBack) { int sourceStep = kTimeStep - mStepBack + 1; auto &compLoadTS = szCLDay.ts[sourceStep - 1].spacezone[szNumMinus1]; - auto &surfCLDayTS = surfCLDay.ts[sourceStep - 1].surf[jSurf - 1]; + auto const &surfCLDayTS = surfCLDay.ts[sourceStep - 1].surf[jSurf - 1]; + auto const &enclCLDayTS = enclCLDay.ts[sourceStep - 1].encl[radEnclosureNum - 1]; Real64 thisQRadThermInAbsMult = surfCLDayTS.TMULTseq * surfCLDayTS.ITABSFseq * state.dataSurface->Surface(jSurf).Area * decayCurve(mStepBack, jSurf); - peopleConvFromSurf += compLoadTS.peopleRadSeq * thisQRadThermInAbsMult; - equipConvFromSurf += compLoadTS.equipRadSeq * thisQRadThermInAbsMult; - hvacLossConvFromSurf += compLoadTS.hvacLossRadSeq * thisQRadThermInAbsMult; - powerGenConvFromSurf += compLoadTS.powerGenRadSeq * thisQRadThermInAbsMult; - lightLWConvFromSurf += compLoadTS.lightLWRadSeq * thisQRadThermInAbsMult; + peopleConvFromSurf += enclCLDayTS.peopleRadSeq * thisQRadThermInAbsMult; + equipConvFromSurf += enclCLDayTS.equipRadSeq * thisQRadThermInAbsMult; + hvacLossConvFromSurf += enclCLDayTS.hvacLossRadSeq * thisQRadThermInAbsMult; + powerGenConvFromSurf += enclCLDayTS.powerGenRadSeq * thisQRadThermInAbsMult; + lightLWConvFromSurf += enclCLDayTS.lightLWRadSeq * thisQRadThermInAbsMult; // short wave is already accumulated by surface lightSWConvFromSurf += surfCLDayTS.lightSWRadSeq * decayCurve(mStepBack, jSurf); feneSolarConvFromSurf += surfCLDayTS.feneSolarRadSeq * decayCurve(mStepBack, jSurf); diff --git a/src/EnergyPlus/OutputReportTabular.hh b/src/EnergyPlus/OutputReportTabular.hh index d9364d7fdc1..2e8078722f4 100644 --- a/src/EnergyPlus/OutputReportTabular.hh +++ b/src/EnergyPlus/OutputReportTabular.hh @@ -516,15 +516,12 @@ namespace OutputReportTabular { { Real64 peopleInstantSeq = 0.0; Real64 peopleLatentSeq = 0.0; - Real64 peopleRadSeq = 0.0; Real64 lightInstantSeq = 0.0; Real64 lightRetAirSeq = 0.0; - Real64 lightLWRadSeq = 0.0; // long wave thermal radiation Real64 equipInstantSeq = 0.0; Real64 equipLatentSeq = 0.0; - Real64 equipRadSeq = 0.0; Real64 refrigInstantSeq = 0.0; Real64 refrigRetAirSeq = 0.0; @@ -534,7 +531,6 @@ namespace OutputReportTabular { Real64 waterUseLatentSeq = 0.0; Real64 hvacLossInstantSeq = 0.0; - Real64 hvacLossRadSeq = 0.0; Real64 powerGenInstantSeq = 0.0; Real64 powerGenRadSeq = 0.0; @@ -559,6 +555,22 @@ namespace OutputReportTabular { std::vector ts; }; + struct compLoadsEnclosure + { + Real64 peopleRadSeq = 0.0; + Real64 lightLWRadSeq = 0.0; // long wave thermal radiation + Real64 equipRadSeq = 0.0; + Real64 hvacLossRadSeq = 0.0; + Real64 powerGenRadSeq = 0.0; + }; + struct compLoadsTimeStepEncl + { + std::vector encl; + }; + struct componentLoadsEncl + { + std::vector ts; + }; // Functions std::ofstream &open_tbl_stream(EnergyPlusData &state, int const iStyle, fs::path const &filePath, bool output_to_file = true); @@ -1255,6 +1267,7 @@ struct OutputReportTabularData : BaseGlobalStruct std::vector surfCompLoads; // Surface component loads by day, timestep, then surface std::vector znCompLoads; // Zone component loads by day, timestep, then zone std::vector spCompLoads; // Space component loads by day, timestep, then space + std::vector enclCompLoads; // Enclosure component loads by day, timestep, then enclsoure int maxUniqueKeyCount = 0; @@ -1530,6 +1543,7 @@ struct OutputReportTabularData : BaseGlobalStruct this->surfCompLoads.clear(); this->znCompLoads.clear(); this->spCompLoads.clear(); + this->enclCompLoads.clear(); this->maxUniqueKeyCount = 0; this->activeSubTableName.clear(); diff --git a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc index c6b6e4d3309..e91ad0128b7 100644 --- a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc +++ b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc @@ -8321,10 +8321,10 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesSurfaceOrder_ state->dataSurface->Surface(2).Class = SurfaceClass::Wall; state->dataSurface->Surface(3).Class = SurfaceClass::Floor; state->dataSurface->Surface(4).Class = SurfaceClass::Shading; - state->dataSurface->Surface(1).RadEnclIndex = 1; - state->dataSurface->Surface(2).RadEnclIndex = 1; - state->dataSurface->Surface(3).RadEnclIndex = 1; - state->dataSurface->Surface(4).RadEnclIndex = 1; + state->dataSurface->Surface(1).RadEnclIndex = radEnclosureNum; + state->dataSurface->Surface(2).RadEnclIndex = radEnclosureNum; + state->dataSurface->Surface(3).RadEnclIndex = radEnclosureNum; + state->dataSurface->Surface(4).RadEnclIndex = radEnclosureNum; auto &znCL = state->dataOutRptTab->znCompLoads; auto &znCLDay = znCL[coolDesSelected - 1]; @@ -8335,14 +8335,18 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesSurfaceOrder_ surfCLDayTS.TMULTseq = 0.1 * step; surfCLDayTS.ITABSFseq = 0.2 * step * surfBaseValue[jSurf - 1]; state->dataOutRptTab->decayCurveCool(step, jSurf) = 0.3 * step * surfBaseValue[jSurf - 1]; - znCLDayTS.peopleRadSeq = 0.4 * step; - znCLDayTS.equipRadSeq = 0.5 * step; - znCLDayTS.hvacLossRadSeq = 0.6 * step; - znCLDayTS.powerGenRadSeq = 0.7 * step; - znCLDayTS.lightLWRadSeq = 0.8 * step; } } + for (int step = 1; step <= 10; ++step) { + auto &enclCLDayTS = state->dataOutRptTab->enclCompLoads[coolDesSelected - 1].ts[step - 1].encl[radEnclosureNum - 1]; + enclCLDayTS.peopleRadSeq = 0.4 * step; + enclCLDayTS.equipRadSeq = 0.5 * step; + enclCLDayTS.hvacLossRadSeq = 0.6 * step; + enclCLDayTS.powerGenRadSeq = 0.7 * step; + enclCLDayTS.lightLWRadSeq = 0.8 * step; + } + GetDelaySequences(*state, coolDesSelected, true, @@ -8390,14 +8394,18 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesSurfaceOrder_ surfCLDayTS.TMULTseq = 0.1 * step; surfCLDayTS.ITABSFseq = 0.2 * step * surfBaseValue[jSurf - 1]; state->dataOutRptTab->decayCurveCool(step, jSurf) = 0.3 * step * surfBaseValue[jSurf - 1]; - znCLDayTS.peopleRadSeq = 0.4 * step; - znCLDayTS.equipRadSeq = 0.5 * step; - znCLDayTS.hvacLossRadSeq = 0.6 * step; - znCLDayTS.powerGenRadSeq = 0.7 * step; - znCLDayTS.lightLWRadSeq = 0.8 * step; } } + for (int step = 1; step <= 10; ++step) { + auto &enclCLDayTS = state->dataOutRptTab->enclCompLoads[coolDesSelected - 1].ts[step - 1].encl[radEnclosureNum - 1]; + enclCLDayTS.peopleRadSeq = 0.4 * step; + enclCLDayTS.equipRadSeq = 0.5 * step; + enclCLDayTS.hvacLossRadSeq = 0.6 * step; + enclCLDayTS.powerGenRadSeq = 0.7 * step; + enclCLDayTS.lightLWRadSeq = 0.8 * step; + } + GetDelaySequences(*state, coolDesSelected, true, From 2af52b9ce02d58207be425340e39f48844ceac27 Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Thu, 3 Oct 2024 16:11:53 -0500 Subject: [PATCH 20/25] Space IV.6 - improve delayed surf gains for space --- src/EnergyPlus/OutputReportTabular.cc | 151 +++++++++--------- src/EnergyPlus/OutputReportTabular.hh | 26 ++- src/EnergyPlus/SizingManager.cc | 6 +- .../unit/OutputReportTabular.unit.cc | 8 +- 4 files changed, 94 insertions(+), 97 deletions(-) diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index 2b95ab502ab..4a957330b88 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -14487,10 +14487,16 @@ void AllocateLoadComponentArrays(EnergyPlusData &state) ort->radiantPulseTimestep = 0; ort->radiantPulseReceived.allocate({0, state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays}, state.dataSurface->TotSurfaces); ort->radiantPulseReceived = 0.0; - ort->decayCurveCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); - ort->decayCurveCool = 0.0; - ort->decayCurveHeat.allocate(state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); - ort->decayCurveHeat = 0.0; + ort->znDecayCurveCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); + ort->znDecayCurveCool = 0.0; + ort->znDecayCurveHeat.allocate(state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); + ort->znDecayCurveHeat = 0.0; + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + ort->spDecayCurveCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); + ort->spDecayCurveCool = 0.0; + ort->spDecayCurveHeat.allocate(state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); + ort->spDecayCurveHeat = 0.0; + } Real64 const numTSinDay = state.dataGlobal->NumOfTimeStepInHour * 24; @@ -14535,20 +14541,17 @@ void DeallocateLoadComponentArrays(EnergyPlusData &state) // SUBROUTINE INFORMATION: // AUTHOR Jason Glazer // DATE WRITTEN August 2012 - // MODIFIED na - // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: // Deallocate the arrays related to the load component report that will not // be needed in the reporting. - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: auto const &ort = state.dataOutRptTab; ort->radiantPulseTimestep.deallocate(); ort->radiantPulseReceived.deallocate(); } -void ComputeLoadComponentDecayCurve(EnergyPlusData &state) +void ComputeLoadComponentDecayCurve(EnergyPlusData &state, Array2D &szCoolCurve, Array2D &szHeatCurve, bool forSpace) { // SUBROUTINE INFORMATION: @@ -14565,67 +14568,57 @@ void ComputeLoadComponentDecayCurve(EnergyPlusData &state) Real64 diff; auto const &ort = state.dataOutRptTab; - for (state.dataOutRptTab->SurfNumCLCDC = 1; state.dataOutRptTab->SurfNumCLCDC <= state.dataSurface->TotSurfaces; - ++state.dataOutRptTab->SurfNumCLCDC) { - state.dataOutRptTab->ZoneNumCLCDC = state.dataSurface->Surface(state.dataOutRptTab->SurfNumCLCDC).Zone; - if (state.dataOutRptTab->ZoneNumCLCDC == 0) continue; - if (!state.dataZoneEquip->ZoneEquipConfig(state.dataOutRptTab->ZoneNumCLCDC).IsControlled) continue; - state.dataOutRptTab->CoolDesSelectedCLCDC = state.dataSize->CalcFinalZoneSizing(state.dataOutRptTab->ZoneNumCLCDC).CoolDDNum; + for (int surfNum = 1; surfNum <= state.dataSurface->TotSurfaces; ++surfNum) { + int const zoneNum = state.dataSurface->Surface(surfNum).Zone; + if (zoneNum == 0) continue; + if (!state.dataZoneEquip->ZoneEquipConfig(zoneNum).IsControlled) continue; + int const spaceNum = state.dataSurface->Surface(surfNum).spaceNum; + int coolDesSelected = + (forSpace) ? state.dataSize->CalcFinalSpaceSizing(spaceNum).CoolDDNum : state.dataSize->CalcFinalZoneSizing(zoneNum).CoolDDNum; // loop over timesteps after pulse occurred - if (state.dataOutRptTab->CoolDesSelectedCLCDC != 0) { - auto &surfCLClDay = ort->surfCompLoads[state.dataOutRptTab->CoolDesSelectedCLCDC - 1]; - state.dataOutRptTab->TimeOfPulseCLCDC = - ort->radiantPulseTimestep(state.dataOutRptTab->CoolDesSelectedCLCDC, state.dataOutRptTab->ZoneNumCLCDC); + if (coolDesSelected != 0) { + auto &surfCLClDay = ort->surfCompLoads[coolDesSelected - 1]; + int timeOfPulse = ort->radiantPulseTimestep(coolDesSelected, zoneNum); // if the CoolDesSelected time is on a different day than // when the pulse occurred, need to scan back and find when // the pulse occurred. - if (state.dataOutRptTab->TimeOfPulseCLCDC == 0) { - for (int i = state.dataOutRptTab->CoolDesSelectedCLCDC; i >= 1; --i) { - state.dataOutRptTab->TimeOfPulseCLCDC = ort->radiantPulseTimestep(i, state.dataOutRptTab->ZoneNumCLCDC); - if (state.dataOutRptTab->TimeOfPulseCLCDC != 0) break; + if (timeOfPulse == 0) { + for (int i = coolDesSelected; i >= 1; --i) { + timeOfPulse = ort->radiantPulseTimestep(i, zoneNum); + if (timeOfPulse != 0) break; } } - if (state.dataOutRptTab->TimeOfPulseCLCDC == 0) state.dataOutRptTab->TimeOfPulseCLCDC = 1; - for (state.dataOutRptTab->TimeStepCLCDC = state.dataOutRptTab->TimeOfPulseCLCDC; - state.dataOutRptTab->TimeStepCLCDC <= state.dataGlobal->NumOfTimeStepInHour * 24; - ++state.dataOutRptTab->TimeStepCLCDC) { - if (ort->radiantPulseReceived(state.dataOutRptTab->CoolDesSelectedCLCDC, state.dataOutRptTab->SurfNumCLCDC) != 0.0) { - auto &surfClDayTS = surfCLClDay.ts[state.dataOutRptTab->TimeStepCLCDC - 1].surf[state.dataOutRptTab->SurfNumCLCDC - 1]; + if (timeOfPulse == 0) timeOfPulse = 1; + for (int timeStep = timeOfPulse; timeStep <= state.dataGlobal->NumOfTimeStepInHour * 24; ++timeStep) { + if (ort->radiantPulseReceived(coolDesSelected, surfNum) != 0.0) { + auto &surfClDayTS = surfCLClDay.ts[timeStep - 1].surf[surfNum - 1]; diff = surfClDayTS.loadConvectedWithPulse - surfClDayTS.loadConvectedNormal; - ort->decayCurveCool(state.dataOutRptTab->TimeStepCLCDC - state.dataOutRptTab->TimeOfPulseCLCDC + 1, - state.dataOutRptTab->SurfNumCLCDC) = - -diff / ort->radiantPulseReceived(state.dataOutRptTab->CoolDesSelectedCLCDC, state.dataOutRptTab->SurfNumCLCDC); + szCoolCurve(timeStep - timeOfPulse + 1, surfNum) = -diff / ort->radiantPulseReceived(coolDesSelected, surfNum); } else { - ort->decayCurveCool(state.dataOutRptTab->TimeStepCLCDC - state.dataOutRptTab->TimeOfPulseCLCDC + 1, - state.dataOutRptTab->SurfNumCLCDC) = 0.0; + szCoolCurve(timeStep - timeOfPulse + 1, surfNum) = 0.0; } } } - state.dataOutRptTab->HeatDesSelectedCLCDC = state.dataSize->CalcFinalZoneSizing(state.dataOutRptTab->ZoneNumCLCDC).HeatDDNum; - if (state.dataOutRptTab->HeatDesSelectedCLCDC != 0) { - auto &surfCLHtDay = ort->surfCompLoads[state.dataOutRptTab->HeatDesSelectedCLCDC - 1]; - state.dataOutRptTab->TimeOfPulseCLCDC = - ort->radiantPulseTimestep(state.dataOutRptTab->HeatDesSelectedCLCDC, state.dataOutRptTab->ZoneNumCLCDC); + int const heatDesSelected = + (forSpace) ? state.dataSize->CalcFinalSpaceSizing(spaceNum).HeatDDNum : state.dataSize->CalcFinalZoneSizing(zoneNum).HeatDDNum; + if (heatDesSelected != 0) { + auto &surfCLHtDay = ort->surfCompLoads[heatDesSelected - 1]; + int timeOfPulse = ort->radiantPulseTimestep(heatDesSelected, zoneNum); // scan back to the day that the heating pulse occurs, if necessary - if (state.dataOutRptTab->TimeOfPulseCLCDC == 0) { - for (int i = state.dataOutRptTab->HeatDesSelectedCLCDC; i >= 1; --i) { - state.dataOutRptTab->TimeOfPulseCLCDC = ort->radiantPulseTimestep(i, state.dataOutRptTab->ZoneNumCLCDC); - if (state.dataOutRptTab->TimeOfPulseCLCDC != 0) break; + if (timeOfPulse == 0) { + for (int i = heatDesSelected; i >= 1; --i) { + timeOfPulse = ort->radiantPulseTimestep(i, zoneNum); + if (timeOfPulse != 0) break; } } - if (state.dataOutRptTab->TimeOfPulseCLCDC == 0) state.dataOutRptTab->TimeOfPulseCLCDC = 1; - for (state.dataOutRptTab->TimeStepCLCDC = state.dataOutRptTab->TimeOfPulseCLCDC; - state.dataOutRptTab->TimeStepCLCDC <= state.dataGlobal->NumOfTimeStepInHour * 24; - ++state.dataOutRptTab->TimeStepCLCDC) { - if (ort->radiantPulseReceived(state.dataOutRptTab->HeatDesSelectedCLCDC, state.dataOutRptTab->SurfNumCLCDC) != 0.0) { - auto &surfHtDayTS = surfCLHtDay.ts[state.dataOutRptTab->TimeStepCLCDC - 1].surf[state.dataOutRptTab->SurfNumCLCDC - 1]; + if (timeOfPulse == 0) timeOfPulse = 1; + for (int timeStep = timeOfPulse; timeStep <= state.dataGlobal->NumOfTimeStepInHour * 24; ++timeStep) { + if (ort->radiantPulseReceived(heatDesSelected, surfNum) != 0.0) { + auto &surfHtDayTS = surfCLHtDay.ts[timeStep - 1].surf[surfNum - 1]; diff = surfHtDayTS.loadConvectedWithPulse - surfHtDayTS.loadConvectedNormal; - ort->decayCurveHeat(state.dataOutRptTab->TimeStepCLCDC - state.dataOutRptTab->TimeOfPulseCLCDC + 1, - state.dataOutRptTab->SurfNumCLCDC) = - -diff / ort->radiantPulseReceived(state.dataOutRptTab->HeatDesSelectedCLCDC, state.dataOutRptTab->SurfNumCLCDC); + szHeatCurve(timeStep - timeOfPulse + 1, surfNum) = -diff / ort->radiantPulseReceived(heatDesSelected, surfNum); } else { - ort->decayCurveHeat(state.dataOutRptTab->TimeStepCLCDC - state.dataOutRptTab->TimeOfPulseCLCDC + 1, - state.dataOutRptTab->SurfNumCLCDC) = 0.0; + szHeatCurve(timeStep - timeOfPulse + 1, surfNum) = 0.0; } } } @@ -14633,38 +14626,38 @@ void ComputeLoadComponentDecayCurve(EnergyPlusData &state) if (state.dataGlobal->ShowDecayCurvesInEIO) { // show the line definition for the decay curves + std::string_view const spaceZone = (forSpace) ? "Space" : "Zone"; print(state.files.eio, - "! ,Zone Name, Surface Name, Time " - "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36\n"); + format("! ,{} Name, Surface Name, Time " + "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36\n", + spaceZone)); print(state.files.eio, - "! ,Zone Name, Surface Name, Time " - "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36\n"); + format("! ,{} Name, Surface Name, Time " + "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36\n", + spaceZone)); // Put the decay curve into the EIO file - for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { - auto &thisZone = state.dataHeatBal->Zone(iZone); + int numSpZn = (forSpace) ? state.dataGlobal->numSpaces : state.dataGlobal->NumOfZones; + for (int iSpZn = 1; iSpZn <= numSpZn; ++iSpZn) { + std::string_view const spZnName = (forSpace) ? state.dataHeatBal->space(iSpZn).Name : state.dataHeatBal->Zone(iSpZn).Name; for (int kSurf : state.dataSurface->AllSurfaceListReportOrder) { - if (state.dataSurface->Surface(kSurf).Zone != iZone) continue; - print(state.files.eio, - "{},{},{}", - "Radiant to Convective Decay Curves for Cooling", - thisZone.Name, - state.dataSurface->Surface(kSurf).Name); + int const surfSpZnNum = (forSpace) ? state.dataSurface->Surface(kSurf).spaceNum : state.dataSurface->Surface(kSurf).Zone; + if (surfSpZnNum != iSpZn) continue; + print( + state.files.eio, "{},{},{}", "Radiant to Convective Decay Curves for Cooling", spZnName, state.dataSurface->Surface(kSurf).Name); for (int jTime = 1; jTime <= min(state.dataGlobal->NumOfTimeStepInHour * 24, 36); ++jTime) { - print(state.files.eio, ",{:6.3F}", ort->decayCurveCool(jTime, kSurf)); + print(state.files.eio, ",{:6.3F}", szCoolCurve(jTime, kSurf)); } // put a line feed at the end of the line print(state.files.eio, "\n"); } for (int kSurf : state.dataSurface->AllSurfaceListReportOrder) { - if (state.dataSurface->Surface(kSurf).Zone != iZone) continue; - print(state.files.eio, - "{},{},{}", - "Radiant to Convective Decay Curves for Heating", - thisZone.Name, - state.dataSurface->Surface(kSurf).Name); + int const surfSpZnNum = (forSpace) ? state.dataSurface->Surface(kSurf).spaceNum : state.dataSurface->Surface(kSurf).Zone; + if (surfSpZnNum != iSpZn) continue; + print( + state.files.eio, "{},{},{}", "Radiant to Convective Decay Curves for Heating", spZnName, state.dataSurface->Surface(kSurf).Name); for (int jTime = 1; jTime <= min(state.dataGlobal->NumOfTimeStepInHour * 24, 36); ++jTime) { - print(state.files.eio, ",{:6.3F}", ort->decayCurveHeat(jTime, kSurf)); + print(state.files.eio, ",{:6.3F}", szHeatCurve(jTime, kSurf)); } // put a line feed at the end of the line print(state.files.eio, "\n"); @@ -15628,9 +15621,17 @@ void GetDelaySequences(EnergyPlusData &state, Array2D decayCurve; if (isCooling) { - decayCurve = ort->decayCurveCool; + if (iSpace == 0) { + decayCurve = ort->znDecayCurveCool; + } else { + decayCurve = ort->spDecayCurveCool; + } } else { - decayCurve = ort->decayCurveHeat; + if (iSpace == 0) { + decayCurve = ort->znDecayCurveHeat; + } else { + decayCurve = ort->spDecayCurveHeat; + } } for (int kTimeStep = 1; kTimeStep <= state.dataGlobal->NumOfTimeStepInHour * 24; ++kTimeStep) { diff --git a/src/EnergyPlus/OutputReportTabular.hh b/src/EnergyPlus/OutputReportTabular.hh index 2e8078722f4..c55a1dad3fb 100644 --- a/src/EnergyPlus/OutputReportTabular.hh +++ b/src/EnergyPlus/OutputReportTabular.hh @@ -851,7 +851,7 @@ namespace OutputReportTabular { void DeallocateLoadComponentArrays(EnergyPlusData &state); - void ComputeLoadComponentDecayCurve(EnergyPlusData &state); + void ComputeLoadComponentDecayCurve(EnergyPlusData &state, Array2D &szCoolCurve, Array2D &szHeatCurve, bool forSpace = false); void GatherComponentLoadsSurface(EnergyPlusData &state); @@ -1261,8 +1261,10 @@ struct OutputReportTabularData : BaseGlobalStruct // arrays related to pulse and load component reporting Array2D_int radiantPulseTimestep; Array2D radiantPulseReceived; - Array2D decayCurveCool; - Array2D decayCurveHeat; + Array2D znDecayCurveCool; // Decay curve relative to zone sensible cooling peak + Array2D znDecayCurveHeat; // Decay curve relative to zone sensible heating peak + Array2D spDecayCurveCool; // Decay curve relative to space sensible cooling peak + Array2D spDecayCurveHeat; // Decay curve relative to space sensible heating peak std::vector surfCompLoads; // Surface component loads by day, timestep, then surface std::vector znCompLoads; // Zone component loads by day, timestep, then zone @@ -1375,12 +1377,6 @@ struct OutputReportTabularData : BaseGlobalStruct int indexUnitConvWCS = 0; Real64 curValueSIWCS = 0.0; Real64 curValueWCS = 0.0; - int ZoneNumCLCDC = 0; - int SurfNumCLCDC = 0; - int TimeStepCLCDC = 0; - int TimeOfPulseCLCDC = 0; - int CoolDesSelectedCLCDC = 0; // design day selected for cooling - int HeatDesSelectedCLCDC = 0; // design day selected for heating Real64 BigNumRMG = 0.0; int foundGsui = 0; int iUnitGsui = 0; @@ -1538,8 +1534,10 @@ struct OutputReportTabularData : BaseGlobalStruct this->DesignDayCount = 0; this->radiantPulseTimestep.deallocate(); this->radiantPulseReceived.deallocate(); - this->decayCurveCool.deallocate(); - this->decayCurveHeat.deallocate(); + this->znDecayCurveCool.deallocate(); + this->znDecayCurveHeat.deallocate(); + this->spDecayCurveCool.deallocate(); + this->spDecayCurveHeat.deallocate(); this->surfCompLoads.clear(); this->znCompLoads.clear(); this->spCompLoads.clear(); @@ -1648,12 +1646,6 @@ struct OutputReportTabularData : BaseGlobalStruct this->indexUnitConvWCS = 0; this->curValueSIWCS = 0.0; this->curValueWCS = 0.0; - this->ZoneNumCLCDC = 0; - this->SurfNumCLCDC = 0; - this->TimeStepCLCDC = 0; - this->TimeOfPulseCLCDC = 0; - this->CoolDesSelectedCLCDC = 0; // design day selected for cooling - this->HeatDesSelectedCLCDC = 0; // design day selected for heating this->BigNumRMG = 0.0; this->foundGsui = 0; this->iUnitGsui = 0; diff --git a/src/EnergyPlus/SizingManager.cc b/src/EnergyPlus/SizingManager.cc index 0b76cbd122e..d221022af79 100644 --- a/src/EnergyPlus/SizingManager.cc +++ b/src/EnergyPlus/SizingManager.cc @@ -431,8 +431,12 @@ void ManageSizing(EnergyPlusData &state) // both the pulse and normal zone sizing is complete so now post processing of the results is performed if (state.dataGlobal->CompLoadReportIsReq) { // call the routine that computes the decay curve - ComputeLoadComponentDecayCurve(state); + ComputeLoadComponentDecayCurve(state, state.dataOutRptTab->znDecayCurveCool, state.dataOutRptTab->znDecayCurveHeat); // remove some of the arrays used to derive the decay curves + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + bool forSpace = true; + ComputeLoadComponentDecayCurve(state, state.dataOutRptTab->spDecayCurveCool, state.dataOutRptTab->spDecayCurveHeat, forSpace); + } DeallocateLoadComponentArrays(state); } } diff --git a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc index e91ad0128b7..a1717423f18 100644 --- a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc +++ b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc @@ -519,10 +519,10 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_AllocateLoadComponentArraysTes EXPECT_EQ(state->dataOutRptTab->radiantPulseReceived.size(), 42u); // decayCurveCool.allocate( NumOfTimeStepInHour * 24, TotSurfaces ); - EXPECT_EQ(state->dataOutRptTab->decayCurveCool.size(), 672u); + EXPECT_EQ(state->dataOutRptTab->znDecayCurveCool.size(), 672u); // decayCurveHeat.allocate( NumOfTimeStepInHour * 24, TotSurfaces ); - EXPECT_EQ(state->dataOutRptTab->decayCurveHeat.size(), 672u); + EXPECT_EQ(state->dataOutRptTab->znDecayCurveHeat.size(), 672u); EXPECT_EQ(state->dataOutRptTab->surfCompLoads.size(), 5u); EXPECT_EQ(state->dataOutRptTab->surfCompLoads[0].ts.size(), 96u); @@ -8334,7 +8334,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesSurfaceOrder_ auto &surfCLDayTS = state->dataOutRptTab->surfCompLoads[coolDesSelected - 1].ts[step - 1].surf[jSurf - 1]; surfCLDayTS.TMULTseq = 0.1 * step; surfCLDayTS.ITABSFseq = 0.2 * step * surfBaseValue[jSurf - 1]; - state->dataOutRptTab->decayCurveCool(step, jSurf) = 0.3 * step * surfBaseValue[jSurf - 1]; + state->dataOutRptTab->znDecayCurveCool(step, jSurf) = 0.3 * step * surfBaseValue[jSurf - 1]; } } @@ -8393,7 +8393,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesSurfaceOrder_ auto &surfCLDayTS = state->dataOutRptTab->surfCompLoads[coolDesSelected - 1].ts[step - 1].surf[jSurf - 1]; surfCLDayTS.TMULTseq = 0.1 * step; surfCLDayTS.ITABSFseq = 0.2 * step * surfBaseValue[jSurf - 1]; - state->dataOutRptTab->decayCurveCool(step, jSurf) = 0.3 * step * surfBaseValue[jSurf - 1]; + state->dataOutRptTab->znDecayCurveCool(step, jSurf) = 0.3 * step * surfBaseValue[jSurf - 1]; } } From 5c82432ac6df64e1744bbe8439bd685a3240d91c Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Fri, 4 Oct 2024 11:01:53 -0500 Subject: [PATCH 21/25] Move a few InternalHeatGains variables out of state --- src/EnergyPlus/InternalHeatGains.cc | 47 +++++++++++++++-------------- src/EnergyPlus/InternalHeatGains.hh | 13 -------- 2 files changed, 24 insertions(+), 36 deletions(-) diff --git a/src/EnergyPlus/InternalHeatGains.cc b/src/EnergyPlus/InternalHeatGains.cc index 44d0a92ea89..2239eab5997 100644 --- a/src/EnergyPlus/InternalHeatGains.cc +++ b/src/EnergyPlus/InternalHeatGains.cc @@ -695,7 +695,7 @@ namespace InternalHeatGains { if (IHGNumAlphas > 6) { // Optional parameters present--thermal comfort data follows... int lastOption = 0; - state.dataInternalHeatGains->UsingThermalComfort = false; + bool usingThermalComfort = false; if (IHGNumAlphas > 20) { lastOption = 20; } else { @@ -735,37 +735,37 @@ namespace InternalHeatGains { if (thermalComfortType == "FANGER") { thisPeople.Fanger = true; - state.dataInternalHeatGains->UsingThermalComfort = true; + usingThermalComfort = true; } else if (thermalComfortType == "PIERCE") { thisPeople.Pierce = true; state.dataHeatBal->AnyThermalComfortPierceModel = true; - state.dataInternalHeatGains->UsingThermalComfort = true; + usingThermalComfort = true; } else if (thermalComfortType == "KSU") { thisPeople.KSU = true; state.dataHeatBal->AnyThermalComfortKSUModel = true; - state.dataInternalHeatGains->UsingThermalComfort = true; + usingThermalComfort = true; } else if (thermalComfortType == "ADAPTIVEASH55") { thisPeople.AdaptiveASH55 = true; state.dataHeatBal->AdaptiveComfortRequested_ASH55 = true; - state.dataInternalHeatGains->UsingThermalComfort = true; + usingThermalComfort = true; } else if (thermalComfortType == "ADAPTIVECEN15251") { thisPeople.AdaptiveCEN15251 = true; state.dataHeatBal->AdaptiveComfortRequested_CEN15251 = true; - state.dataInternalHeatGains->UsingThermalComfort = true; + usingThermalComfort = true; } else if (thermalComfortType == "COOLINGEFFECTASH55") { thisPeople.CoolingEffectASH55 = true; state.dataHeatBal->AnyThermalComfortCoolingEffectModel = true; - state.dataInternalHeatGains->UsingThermalComfort = true; + usingThermalComfort = true; } else if (thermalComfortType == "ANKLEDRAFTASH55") { thisPeople.AnkleDraftASH55 = true; state.dataHeatBal->AnyThermalComfortAnkleDraftModel = true; - state.dataInternalHeatGains->UsingThermalComfort = true; + usingThermalComfort = true; } else if (thermalComfortType == "") { // Blank input field--just ignore this @@ -786,7 +786,7 @@ namespace InternalHeatGains { } } - if (state.dataInternalHeatGains->UsingThermalComfort) { + if (usingThermalComfort) { // Set the default value of MRTCalcType as 'EnclosureAveraged' thisPeople.MRTCalcType = DataHeatBalance::CalcMRT::EnclosureAveraged; @@ -1250,6 +1250,8 @@ namespace InternalHeatGains { // Lights // Declared in state because the lights inputs are needed for demand manager int numLightsStatements = 0; + Real64 sumArea = 0.0; // sum of floor area for all lights objects + Real64 sumPower = 0.0; // sum of power for all lights objects setupIHGZonesAndSpaces( state, lightsModuleObject, state.dataInternalHeatGains->lightsObjects, numLightsStatements, state.dataHeatBal->TotLights, ErrorsFound); @@ -1629,8 +1631,8 @@ namespace InternalHeatGains { std::string liteName = state.dataHeatBal->Lights(lightsNum2).Name; Real64 mult = state.dataHeatBal->Zone(zoneNum).Multiplier * state.dataHeatBal->Zone(zoneNum).ListMultiplier; Real64 spaceArea = state.dataHeatBal->space(spaceNum).FloorArea; - state.dataInternalHeatGains->sumArea += spaceArea * mult; - state.dataInternalHeatGains->sumPower += state.dataHeatBal->Lights(lightsNum2).DesignLevel * mult; + sumArea += spaceArea * mult; + sumPower += state.dataHeatBal->Lights(lightsNum2).DesignLevel * mult; PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtZone, liteName, state.dataHeatBal->Zone(zoneNum).Name); PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtSpace, liteName, state.dataHeatBal->space(spaceNum).Name); PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtSpaceType, liteName, state.dataHeatBal->space(spaceNum).spaceType); @@ -1685,17 +1687,14 @@ namespace InternalHeatGains { } } // TotLights > 0 check // add total line to lighting summary table - if (state.dataInternalHeatGains->sumArea > 0.0) { - PreDefTableEntry(state, - state.dataOutRptPredefined->pdchInLtDens, - "Interior Lighting Total", - state.dataInternalHeatGains->sumPower / state.dataInternalHeatGains->sumArea, + if (sumArea > 0.0) { + PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtDens, "Interior Lighting Total", sumPower / sumArea, 4); // line 792 } else { PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtDens, "Interior Lighting Total", DataPrecisionGlobals::constant_zero, 4); } - PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtArea, "Interior Lighting Total", state.dataInternalHeatGains->sumArea); - PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtPower, "Interior Lighting Total", state.dataInternalHeatGains->sumPower); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtArea, "Interior Lighting Total", sumArea); + PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtPower, "Interior Lighting Total", sumPower); // ElectricEquipment // Declared in state because the lights inputs are needed for demand manager @@ -7914,21 +7913,23 @@ namespace InternalHeatGains { state.dataHeatBal->SurfQdotRadIntGainsInPerArea(SurfNum) = thisEnclosure.radQThermalRad * thisEnclosure.radThermAbsMult * state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum); } else { - state.dataInternalHeatGains->curQL = thisEnclosure.radQThermalRad; + // radiant value prior to adjustment for pulse for load component report + Real64 curQL = thisEnclosure.radQThermalRad; // for the loads component report during the special sizing run increase the radiant portion // a small amount to create a "pulse" of heat that is used for the delayed loads - state.dataInternalHeatGains->adjQL = state.dataInternalHeatGains->curQL + thisEnclosure.FloorArea * pulseMultipler; + // radiant value including adjustment for pulse for load component report + Real64 adjQL = curQL + thisEnclosure.FloorArea * pulseMultipler; // ITABSF is the Inside Thermal Absorptance // EnclRadThermAbsMult is a multiplier for each zone // SurfQdotRadIntGainsInPerArea is the thermal radiation absorbed on inside surfaces state.dataHeatBal->SurfQdotRadIntGainsInPerArea(SurfNum) = - state.dataInternalHeatGains->adjQL * thisEnclosure.radThermAbsMult * state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum); + adjQL * thisEnclosure.radThermAbsMult * state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum); // store the magnitude and time of the pulse state.dataOutRptTab->radiantPulseTimestep(state.dataSize->CurOverallSimDay, zoneNum) = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; state.dataOutRptTab->radiantPulseReceived(state.dataSize->CurOverallSimDay, SurfNum) = - (state.dataInternalHeatGains->adjQL - state.dataInternalHeatGains->curQL) * thisEnclosure.radThermAbsMult * - state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum) * state.dataSurface->Surface(SurfNum).Area; + (adjQL - curQL) * thisEnclosure.radThermAbsMult * state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum) * + state.dataSurface->Surface(SurfNum).Area; } } } diff --git a/src/EnergyPlus/InternalHeatGains.hh b/src/EnergyPlus/InternalHeatGains.hh index 600f12ebd86..7c6f06d4da0 100644 --- a/src/EnergyPlus/InternalHeatGains.hh +++ b/src/EnergyPlus/InternalHeatGains.hh @@ -240,13 +240,6 @@ struct InternalHeatGainsData : BaseGlobalStruct bool GetInternalHeatGainsInputFlag = true; // Controls the GET routine calling (limited to first time) bool ErrorsFound = false; // if errors were found in the input - // static variables extracted from functions - bool UsingThermalComfort = false; - Real64 sumArea = 0.0; - Real64 sumPower = 0.0; - Real64 curQL = 0.0; // radiant value prior to adjustment for pulse for load component report - Real64 adjQL = 0.0; // radiant value including adjustment for pulse for load component report - // Declared here because they are needed later for the demand manager, other types of internal gain inputs are local EPVector lightsObjects; EPVector zoneElectricObjects; @@ -257,14 +250,8 @@ struct InternalHeatGainsData : BaseGlobalStruct void clear_state() override { - this->GetInternalHeatGainsInputFlag = true; this->ErrorsFound = false; - this->UsingThermalComfort = false; - this->sumArea = 0.0; - this->sumPower = 0.0; - this->curQL = 0.0; - this->adjQL = 0.0; } }; From c6f4c5b06259fd8b982acce1abee0f24d241b703 Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Fri, 4 Oct 2024 14:42:38 -0500 Subject: [PATCH 22/25] Move a few HeatBalanceSurfaceManager variables out of state --- src/EnergyPlus/HeatBalanceSurfaceManager.cc | 18 ++++++++++-------- src/EnergyPlus/HeatBalanceSurfaceManager.hh | 5 ----- src/EnergyPlus/InternalHeatGains.cc | 4 ++-- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/EnergyPlus/HeatBalanceSurfaceManager.cc b/src/EnergyPlus/HeatBalanceSurfaceManager.cc index 88a00d7edc6..9df1348f0ae 100644 --- a/src/EnergyPlus/HeatBalanceSurfaceManager.cc +++ b/src/EnergyPlus/HeatBalanceSurfaceManager.cc @@ -3819,16 +3819,17 @@ void InitIntSolarDistribution(EnergyPlusData &state) state.dataViewFactor->EnclRadInfo(radEnclosureNum).radQThermalRad * state.dataViewFactor->EnclRadInfo(radEnclosureNum).radThermAbsMult * state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum); } else { - state.dataHeatBalSurfMgr->curQL = state.dataViewFactor->EnclRadInfo(radEnclosureNum).radQThermalRad; + // radiant value prior to adjustment for pulse for load component report + Real64 const curQL = state.dataViewFactor->EnclRadInfo(radEnclosureNum).radQThermalRad; // for the loads component report during the special sizing run increase the radiant portion // a small amount to create a "pulse" of heat that is used for the - state.dataHeatBalSurfMgr->adjQL = - state.dataHeatBalSurfMgr->curQL + state.dataViewFactor->EnclRadInfo(radEnclosureNum).FloorArea * pulseMultipler; + // radiant value including adjustment for pulse for load component report + Real64 const adjQL = curQL + state.dataViewFactor->EnclRadInfo(radEnclosureNum).FloorArea * pulseMultipler; // ITABSF is the Inside Thermal Absorptance // EnclRadThermAbsMult is a multiplier for each zone/enclosure // SurfQdotRadIntGainsInPerArea is the thermal radiation absorbed on inside surfaces state.dataHeatBal->SurfQdotRadIntGainsInPerArea(SurfNum) = - state.dataHeatBalSurfMgr->adjQL * state.dataViewFactor->EnclRadInfo(radEnclosureNum).radThermAbsMult * + adjQL * state.dataViewFactor->EnclRadInfo(radEnclosureNum).radThermAbsMult * state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum); } @@ -3956,16 +3957,17 @@ void InitIntSolarDistribution(EnergyPlusData &state) state.dataViewFactor->EnclRadInfo(radEnclosureNum).radQThermalRad * state.dataViewFactor->EnclRadInfo(radEnclosureNum).radThermAbsMult * state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum); } else { - state.dataHeatBalSurfMgr->curQL = state.dataViewFactor->EnclRadInfo(radEnclosureNum).radQThermalRad; + // radiant value prior to adjustment for pulse for load component report + Real64 const curQL = state.dataViewFactor->EnclRadInfo(radEnclosureNum).radQThermalRad; // for the loads component report during the special sizing run increase the radiant portion // a small amount to create a "pulse" of heat that is used for the - state.dataHeatBalSurfMgr->adjQL = - state.dataHeatBalSurfMgr->curQL + state.dataViewFactor->EnclRadInfo(radEnclosureNum).FloorArea * pulseMultipler; + // radiant value including adjustment for pulse for load component report + Real64 const adjQL = curQL + state.dataViewFactor->EnclRadInfo(radEnclosureNum).FloorArea * pulseMultipler; // ITABSF is the Inside Thermal Absorptance // EnclRadThermAbsMult is a multiplier for each zone/radiant enclosure // SurfQdotRadIntGainsInPerArea is the thermal radiation absorbed on inside surfaces state.dataHeatBal->SurfQdotRadIntGainsInPerArea(SurfNum) = - state.dataHeatBalSurfMgr->adjQL * state.dataViewFactor->EnclRadInfo(radEnclosureNum).radThermAbsMult * + adjQL * state.dataViewFactor->EnclRadInfo(radEnclosureNum).radThermAbsMult * state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum); } // Radiations absorbed by the window layers coming from zone side diff --git a/src/EnergyPlus/HeatBalanceSurfaceManager.hh b/src/EnergyPlus/HeatBalanceSurfaceManager.hh index caaef860db2..4c9f131f394 100644 --- a/src/EnergyPlus/HeatBalanceSurfaceManager.hh +++ b/src/EnergyPlus/HeatBalanceSurfaceManager.hh @@ -236,9 +236,6 @@ struct HeatBalSurfMgr : BaseGlobalStruct Array2D DiffuseArray; - Real64 curQL = 0.0; // radiant value prior to adjustment for pulse for load component report - Real64 adjQL = 0.0; // radiant value including adjustment for pulse for load component report - bool ManageSurfaceHeatBalancefirstTime = true; bool InitSurfaceHeatBalancefirstTime = true; bool UpdateThermalHistoriesFirstTimeFlag = true; @@ -286,8 +283,6 @@ struct HeatBalSurfMgr : BaseGlobalStruct ZoneAESum.clear(); DiffuseArray.clear(); - curQL = 0.0; - adjQL = 0.0; ManageSurfaceHeatBalancefirstTime = true; InitSurfaceHeatBalancefirstTime = true; diff --git a/src/EnergyPlus/InternalHeatGains.cc b/src/EnergyPlus/InternalHeatGains.cc index 2239eab5997..6bd101a4316 100644 --- a/src/EnergyPlus/InternalHeatGains.cc +++ b/src/EnergyPlus/InternalHeatGains.cc @@ -7914,11 +7914,11 @@ namespace InternalHeatGains { thisEnclosure.radQThermalRad * thisEnclosure.radThermAbsMult * state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum); } else { // radiant value prior to adjustment for pulse for load component report - Real64 curQL = thisEnclosure.radQThermalRad; + Real64 const curQL = thisEnclosure.radQThermalRad; // for the loads component report during the special sizing run increase the radiant portion // a small amount to create a "pulse" of heat that is used for the delayed loads // radiant value including adjustment for pulse for load component report - Real64 adjQL = curQL + thisEnclosure.FloorArea * pulseMultipler; + Real64 const adjQL = curQL + thisEnclosure.FloorArea * pulseMultipler; // ITABSF is the Inside Thermal Absorptance // EnclRadThermAbsMult is a multiplier for each zone // SurfQdotRadIntGainsInPerArea is the thermal radiation absorbed on inside surfaces From 6f091eb63665e9f54a58458e73b678a2560b25e1 Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Fri, 4 Oct 2024 15:18:15 -0500 Subject: [PATCH 23/25] Space IV.6 - revert separate space and zone decay curves --- src/EnergyPlus/OutputReportTabular.cc | 82 ++++++++----------- src/EnergyPlus/OutputReportTabular.hh | 14 ++-- src/EnergyPlus/SizingManager.cc | 6 +- .../unit/OutputReportTabular.unit.cc | 8 +- 4 files changed, 43 insertions(+), 67 deletions(-) diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index 4a957330b88..1e3f0af4a43 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -14487,16 +14487,10 @@ void AllocateLoadComponentArrays(EnergyPlusData &state) ort->radiantPulseTimestep = 0; ort->radiantPulseReceived.allocate({0, state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays}, state.dataSurface->TotSurfaces); ort->radiantPulseReceived = 0.0; - ort->znDecayCurveCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); - ort->znDecayCurveCool = 0.0; - ort->znDecayCurveHeat.allocate(state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); - ort->znDecayCurveHeat = 0.0; - if (state.dataHeatBal->doSpaceHeatBalanceSizing) { - ort->spDecayCurveCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); - ort->spDecayCurveCool = 0.0; - ort->spDecayCurveHeat.allocate(state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); - ort->spDecayCurveHeat = 0.0; - } + ort->decayCurveCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); + ort->decayCurveCool = 0.0; + ort->decayCurveHeat.allocate(state.dataGlobal->NumOfTimeStepInHour * 24, state.dataSurface->TotSurfaces); + ort->decayCurveHeat = 0.0; Real64 const numTSinDay = state.dataGlobal->NumOfTimeStepInHour * 24; @@ -14551,7 +14545,7 @@ void DeallocateLoadComponentArrays(EnergyPlusData &state) ort->radiantPulseReceived.deallocate(); } -void ComputeLoadComponentDecayCurve(EnergyPlusData &state, Array2D &szCoolCurve, Array2D &szHeatCurve, bool forSpace) +void ComputeLoadComponentDecayCurve(EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -14573,8 +14567,7 @@ void ComputeLoadComponentDecayCurve(EnergyPlusData &state, Array2D &szCo if (zoneNum == 0) continue; if (!state.dataZoneEquip->ZoneEquipConfig(zoneNum).IsControlled) continue; int const spaceNum = state.dataSurface->Surface(surfNum).spaceNum; - int coolDesSelected = - (forSpace) ? state.dataSize->CalcFinalSpaceSizing(spaceNum).CoolDDNum : state.dataSize->CalcFinalZoneSizing(zoneNum).CoolDDNum; + int coolDesSelected = state.dataSize->CalcFinalZoneSizing(zoneNum).CoolDDNum; // loop over timesteps after pulse occurred if (coolDesSelected != 0) { auto &surfCLClDay = ort->surfCompLoads[coolDesSelected - 1]; @@ -14593,14 +14586,13 @@ void ComputeLoadComponentDecayCurve(EnergyPlusData &state, Array2D &szCo if (ort->radiantPulseReceived(coolDesSelected, surfNum) != 0.0) { auto &surfClDayTS = surfCLClDay.ts[timeStep - 1].surf[surfNum - 1]; diff = surfClDayTS.loadConvectedWithPulse - surfClDayTS.loadConvectedNormal; - szCoolCurve(timeStep - timeOfPulse + 1, surfNum) = -diff / ort->radiantPulseReceived(coolDesSelected, surfNum); + ort->decayCurveCool(timeStep - timeOfPulse + 1, surfNum) = -diff / ort->radiantPulseReceived(coolDesSelected, surfNum); } else { - szCoolCurve(timeStep - timeOfPulse + 1, surfNum) = 0.0; + ort->decayCurveCool(timeStep - timeOfPulse + 1, surfNum) = 0.0; } } } - int const heatDesSelected = - (forSpace) ? state.dataSize->CalcFinalSpaceSizing(spaceNum).HeatDDNum : state.dataSize->CalcFinalZoneSizing(zoneNum).HeatDDNum; + int const heatDesSelected = state.dataSize->CalcFinalZoneSizing(zoneNum).HeatDDNum; if (heatDesSelected != 0) { auto &surfCLHtDay = ort->surfCompLoads[heatDesSelected - 1]; int timeOfPulse = ort->radiantPulseTimestep(heatDesSelected, zoneNum); @@ -14616,9 +14608,9 @@ void ComputeLoadComponentDecayCurve(EnergyPlusData &state, Array2D &szCo if (ort->radiantPulseReceived(heatDesSelected, surfNum) != 0.0) { auto &surfHtDayTS = surfCLHtDay.ts[timeStep - 1].surf[surfNum - 1]; diff = surfHtDayTS.loadConvectedWithPulse - surfHtDayTS.loadConvectedNormal; - szHeatCurve(timeStep - timeOfPulse + 1, surfNum) = -diff / ort->radiantPulseReceived(heatDesSelected, surfNum); + ort->decayCurveHeat(timeStep - timeOfPulse + 1, surfNum) = -diff / ort->radiantPulseReceived(heatDesSelected, surfNum); } else { - szHeatCurve(timeStep - timeOfPulse + 1, surfNum) = 0.0; + ort->decayCurveHeat(timeStep - timeOfPulse + 1, surfNum) = 0.0; } } } @@ -14626,38 +14618,38 @@ void ComputeLoadComponentDecayCurve(EnergyPlusData &state, Array2D &szCo if (state.dataGlobal->ShowDecayCurvesInEIO) { // show the line definition for the decay curves - std::string_view const spaceZone = (forSpace) ? "Space" : "Zone"; print(state.files.eio, - format("! ,{} Name, Surface Name, Time " - "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36\n", - spaceZone)); + "! ,Zone Name, Surface Name, Time " + "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36\n"); print(state.files.eio, - format("! ,{} Name, Surface Name, Time " - "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36\n", - spaceZone)); + "! ,Zone Name, Surface Name, Time " + "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36\n"); // Put the decay curve into the EIO file - int numSpZn = (forSpace) ? state.dataGlobal->numSpaces : state.dataGlobal->NumOfZones; - for (int iSpZn = 1; iSpZn <= numSpZn; ++iSpZn) { - std::string_view const spZnName = (forSpace) ? state.dataHeatBal->space(iSpZn).Name : state.dataHeatBal->Zone(iSpZn).Name; + for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) { + auto &thisZone = state.dataHeatBal->Zone(iZone); for (int kSurf : state.dataSurface->AllSurfaceListReportOrder) { - int const surfSpZnNum = (forSpace) ? state.dataSurface->Surface(kSurf).spaceNum : state.dataSurface->Surface(kSurf).Zone; - if (surfSpZnNum != iSpZn) continue; - print( - state.files.eio, "{},{},{}", "Radiant to Convective Decay Curves for Cooling", spZnName, state.dataSurface->Surface(kSurf).Name); + if (state.dataSurface->Surface(kSurf).Zone != iZone) continue; + print(state.files.eio, + "{},{},{}", + "Radiant to Convective Decay Curves for Cooling", + thisZone.Name, + state.dataSurface->Surface(kSurf).Name); for (int jTime = 1; jTime <= min(state.dataGlobal->NumOfTimeStepInHour * 24, 36); ++jTime) { - print(state.files.eio, ",{:6.3F}", szCoolCurve(jTime, kSurf)); + print(state.files.eio, ",{:6.3F}", ort->decayCurveCool(jTime, kSurf)); } // put a line feed at the end of the line print(state.files.eio, "\n"); } for (int kSurf : state.dataSurface->AllSurfaceListReportOrder) { - int const surfSpZnNum = (forSpace) ? state.dataSurface->Surface(kSurf).spaceNum : state.dataSurface->Surface(kSurf).Zone; - if (surfSpZnNum != iSpZn) continue; - print( - state.files.eio, "{},{},{}", "Radiant to Convective Decay Curves for Heating", spZnName, state.dataSurface->Surface(kSurf).Name); + if (state.dataSurface->Surface(kSurf).Zone != iZone) continue; + print(state.files.eio, + "{},{},{}", + "Radiant to Convective Decay Curves for Heating", + thisZone.Name, + state.dataSurface->Surface(kSurf).Name); for (int jTime = 1; jTime <= min(state.dataGlobal->NumOfTimeStepInHour * 24, 36); ++jTime) { - print(state.files.eio, ",{:6.3F}", szHeatCurve(jTime, kSurf)); + print(state.files.eio, ",{:6.3F}", ort->decayCurveHeat(jTime, kSurf)); } // put a line feed at the end of the line print(state.files.eio, "\n"); @@ -15621,17 +15613,9 @@ void GetDelaySequences(EnergyPlusData &state, Array2D decayCurve; if (isCooling) { - if (iSpace == 0) { - decayCurve = ort->znDecayCurveCool; - } else { - decayCurve = ort->spDecayCurveCool; - } + decayCurve = ort->decayCurveCool; } else { - if (iSpace == 0) { - decayCurve = ort->znDecayCurveHeat; - } else { - decayCurve = ort->spDecayCurveHeat; - } + decayCurve = ort->decayCurveHeat; } for (int kTimeStep = 1; kTimeStep <= state.dataGlobal->NumOfTimeStepInHour * 24; ++kTimeStep) { diff --git a/src/EnergyPlus/OutputReportTabular.hh b/src/EnergyPlus/OutputReportTabular.hh index c55a1dad3fb..1f9e008ad84 100644 --- a/src/EnergyPlus/OutputReportTabular.hh +++ b/src/EnergyPlus/OutputReportTabular.hh @@ -851,7 +851,7 @@ namespace OutputReportTabular { void DeallocateLoadComponentArrays(EnergyPlusData &state); - void ComputeLoadComponentDecayCurve(EnergyPlusData &state, Array2D &szCoolCurve, Array2D &szHeatCurve, bool forSpace = false); + void ComputeLoadComponentDecayCurve(EnergyPlusData &state); void GatherComponentLoadsSurface(EnergyPlusData &state); @@ -1261,10 +1261,8 @@ struct OutputReportTabularData : BaseGlobalStruct // arrays related to pulse and load component reporting Array2D_int radiantPulseTimestep; Array2D radiantPulseReceived; - Array2D znDecayCurveCool; // Decay curve relative to zone sensible cooling peak - Array2D znDecayCurveHeat; // Decay curve relative to zone sensible heating peak - Array2D spDecayCurveCool; // Decay curve relative to space sensible cooling peak - Array2D spDecayCurveHeat; // Decay curve relative to space sensible heating peak + Array2D decayCurveCool; + Array2D decayCurveHeat; std::vector surfCompLoads; // Surface component loads by day, timestep, then surface std::vector znCompLoads; // Zone component loads by day, timestep, then zone @@ -1534,10 +1532,8 @@ struct OutputReportTabularData : BaseGlobalStruct this->DesignDayCount = 0; this->radiantPulseTimestep.deallocate(); this->radiantPulseReceived.deallocate(); - this->znDecayCurveCool.deallocate(); - this->znDecayCurveHeat.deallocate(); - this->spDecayCurveCool.deallocate(); - this->spDecayCurveHeat.deallocate(); + this->decayCurveCool.deallocate(); + this->decayCurveHeat.deallocate(); this->surfCompLoads.clear(); this->znCompLoads.clear(); this->spCompLoads.clear(); diff --git a/src/EnergyPlus/SizingManager.cc b/src/EnergyPlus/SizingManager.cc index d221022af79..0b76cbd122e 100644 --- a/src/EnergyPlus/SizingManager.cc +++ b/src/EnergyPlus/SizingManager.cc @@ -431,12 +431,8 @@ void ManageSizing(EnergyPlusData &state) // both the pulse and normal zone sizing is complete so now post processing of the results is performed if (state.dataGlobal->CompLoadReportIsReq) { // call the routine that computes the decay curve - ComputeLoadComponentDecayCurve(state, state.dataOutRptTab->znDecayCurveCool, state.dataOutRptTab->znDecayCurveHeat); + ComputeLoadComponentDecayCurve(state); // remove some of the arrays used to derive the decay curves - if (state.dataHeatBal->doSpaceHeatBalanceSizing) { - bool forSpace = true; - ComputeLoadComponentDecayCurve(state, state.dataOutRptTab->spDecayCurveCool, state.dataOutRptTab->spDecayCurveHeat, forSpace); - } DeallocateLoadComponentArrays(state); } } diff --git a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc index a1717423f18..e91ad0128b7 100644 --- a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc +++ b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc @@ -519,10 +519,10 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_AllocateLoadComponentArraysTes EXPECT_EQ(state->dataOutRptTab->radiantPulseReceived.size(), 42u); // decayCurveCool.allocate( NumOfTimeStepInHour * 24, TotSurfaces ); - EXPECT_EQ(state->dataOutRptTab->znDecayCurveCool.size(), 672u); + EXPECT_EQ(state->dataOutRptTab->decayCurveCool.size(), 672u); // decayCurveHeat.allocate( NumOfTimeStepInHour * 24, TotSurfaces ); - EXPECT_EQ(state->dataOutRptTab->znDecayCurveHeat.size(), 672u); + EXPECT_EQ(state->dataOutRptTab->decayCurveHeat.size(), 672u); EXPECT_EQ(state->dataOutRptTab->surfCompLoads.size(), 5u); EXPECT_EQ(state->dataOutRptTab->surfCompLoads[0].ts.size(), 96u); @@ -8334,7 +8334,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesSurfaceOrder_ auto &surfCLDayTS = state->dataOutRptTab->surfCompLoads[coolDesSelected - 1].ts[step - 1].surf[jSurf - 1]; surfCLDayTS.TMULTseq = 0.1 * step; surfCLDayTS.ITABSFseq = 0.2 * step * surfBaseValue[jSurf - 1]; - state->dataOutRptTab->znDecayCurveCool(step, jSurf) = 0.3 * step * surfBaseValue[jSurf - 1]; + state->dataOutRptTab->decayCurveCool(step, jSurf) = 0.3 * step * surfBaseValue[jSurf - 1]; } } @@ -8393,7 +8393,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesSurfaceOrder_ auto &surfCLDayTS = state->dataOutRptTab->surfCompLoads[coolDesSelected - 1].ts[step - 1].surf[jSurf - 1]; surfCLDayTS.TMULTseq = 0.1 * step; surfCLDayTS.ITABSFseq = 0.2 * step * surfBaseValue[jSurf - 1]; - state->dataOutRptTab->znDecayCurveCool(step, jSurf) = 0.3 * step * surfBaseValue[jSurf - 1]; + state->dataOutRptTab->decayCurveCool(step, jSurf) = 0.3 * step * surfBaseValue[jSurf - 1]; } } From 023142d1e8aa071092d9e7fa8e05991975b8b8b0 Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Fri, 11 Oct 2024 10:21:27 -0500 Subject: [PATCH 24/25] Space IV.6 - fix delayed surf gains for space --- src/EnergyPlus/OutputReportTabular.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index 1e3f0af4a43..86bef054922 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -15605,6 +15605,8 @@ void GetDelaySequences(EnergyPlusData &state, // static bool initAdjFenDone(false); moved to anonymous namespace for unit testing auto &ort = state.dataOutRptTab; int const szNumMinus1 = (iSpace == 0) ? zoneIndex - 1 : iSpace - 1; // space or zone num minus 1 for vector + // reset to zero + surfDelaySeq = 0.0; if (desDaySelected != 0) { auto const &surfCLDay = ort->surfCompLoads[desDaySelected - 1]; From 21c20f5e8fd76308143a4ad1f0dfac2e03ac7278 Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Fri, 11 Oct 2024 13:40:28 -0500 Subject: [PATCH 25/25] Space IV.6 - fix test for spaceAirRpt.allocate --- src/EnergyPlus/HeatBalanceAirManager.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EnergyPlus/HeatBalanceAirManager.cc b/src/EnergyPlus/HeatBalanceAirManager.cc index 67b5b948175..8decd5882a7 100644 --- a/src/EnergyPlus/HeatBalanceAirManager.cc +++ b/src/EnergyPlus/HeatBalanceAirManager.cc @@ -286,7 +286,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err // Following used for reporting state.dataHeatBal->ZnAirRpt.allocate(state.dataGlobal->NumOfZones); - if (state.dataHeatBal->doSpaceHeatBalance) { + if (state.dataHeatBal->doSpaceHeatBalanceSizing || state.dataHeatBal->doSpaceHeatBalanceSimulation) { state.dataHeatBal->spaceAirRpt.allocate(state.dataGlobal->numSpaces); }