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/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/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/HVACManager.cc b/src/EnergyPlus/HVACManager.cc index 8bc8708c0ed..a33bc0d7109 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; @@ -2261,58 +2266,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 +2296,484 @@ 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 > 0) && (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 (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) + ? 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 (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; + 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 (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; + 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 > 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 + if (refDoorMixing.VolRefDoorFlowRate(j) > 0.0) { + // int ZoneB = refDoorMixing.MateZonePtr(j); + // auto const &zoneBHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneB); + 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.MateZonePtr(j)).airHumRat + : state.dataZoneTempPredictorCorrector->spaceHeatBalance(refDoorMixing.fromSpaceIndex).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); + // 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 (((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 + szAMAT) / 2.0, + (szHeatBal.airHumRat + szAHumRat) / 2.0, + std::string()); + 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; + 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 - szAMAT); + szAirRpt.MixLatLoad += + refDoorMixingA.VolRefDoorFlowRate(j) * AirDensity * (szHeatBal.airHumRat - szAHumRat) * 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/HeatBalanceAirManager.cc b/src/EnergyPlus/HeatBalanceAirManager.cc index 6daa9ff9e43..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->doSpaceHeatBalanceSimulation) { + if (state.dataHeatBal->doSpaceHeatBalanceSizing || state.dataHeatBal->doSpaceHeatBalanceSimulation) { state.dataHeatBal->spaceAirRpt.allocate(state.dataGlobal->numSpaces); } diff --git a/src/EnergyPlus/HeatBalanceSurfaceManager.cc b/src/EnergyPlus/HeatBalanceSurfaceManager.cc index d121537afdd..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 @@ -6569,17 +6571,17 @@ 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->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); 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; @@ -6587,13 +6589,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; } } } @@ -9529,17 +9528,16 @@ 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) { - state.dataOutRptTab->TMULTseq(state.dataSize->CurOverallSimDay, TimeStepInDay, enclosureNum) = - state.dataViewFactor->EnclRadInfo(enclosureNum).radThermAbsMult; - } + 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 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/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 d6d7315043e..6bd101a4316 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. { @@ -634,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 { @@ -674,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 @@ -725,7 +786,7 @@ namespace InternalHeatGains { } } - if (state.dataInternalHeatGains->UsingThermalComfort) { + if (usingThermalComfort) { // Set the default value of MRTCalcType as 'EnclosureAveraged' thisPeople.MRTCalcType = DataHeatBalance::CalcMRT::EnclosureAveraged; @@ -1189,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); @@ -1568,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); @@ -1624,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 @@ -7853,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 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 - state.dataInternalHeatGains->adjQL = state.dataInternalHeatGains->curQL + thisEnclosure.FloorArea * pulseMultipler; + // radiant value including adjustment for pulse for load component report + 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 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; } } } @@ -9121,8 +9183,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 +9201,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; + } } } } @@ -9229,6 +9303,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 ) @@ -9494,120 +9594,57 @@ namespace InternalHeatGains { // Using/Aliasing using namespace DataHeatBalance; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - 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}; + 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[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 = + 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::compLoadsSpaceZone &szCompLoadDayTS, int const zoneNum, int const spaceNum) + { // 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); - 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.peopleInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesPeople, spaceNum); + szCompLoadDayTS.peopleLatentSeq = SumInternalLatentGainsByTypes(state, zoneNum, IntGainTypesPeople, spaceNum); + + szCompLoadDayTS.lightInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesLight, spaceNum); + szCompLoadDayTS.lightRetAirSeq = SumReturnAirConvectionGainsByTypes(state, zoneNum, IntGainTypesLight, spaceNum); + + szCompLoadDayTS.equipInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesEquip, spaceNum); + szCompLoadDayTS.equipLatentSeq = SumInternalLatentGainsByTypes(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.powerGenInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesPowerGen, spaceNum); } int GetInternalGainDeviceIndex(EnergyPlusData &state, diff --git a/src/EnergyPlus/InternalHeatGains.hh b/src/EnergyPlus/InternalHeatGains.hh index a44469c5e89..7c6f06d4da0 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 @@ -180,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 ); @@ -221,6 +227,11 @@ namespace InternalHeatGains { void GatherComponentLoadsIntGain(EnergyPlusData &state); + void gatherCompLoadIntGain2(EnergyPlusData &state, + OutputReportTabular::compLoadsSpaceZone &szCompLoadDayTS, + int const zoneNum, + int const spaceNum = 0); + } // namespace InternalHeatGains struct InternalHeatGainsData : BaseGlobalStruct @@ -229,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; @@ -246,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; } }; 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/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index bbf5530f5bc..86bef054922 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); @@ -14467,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) { @@ -14484,109 +14487,46 @@ 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; - 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; - 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; + + Real64 const numTSinDay = state.dataGlobal->NumOfTimeStepInHour * 24; + + 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->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); + for (auto &ts : day.ts) { + ts.spacezone.resize(state.dataGlobal->NumOfZones); + } + } + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + 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); + } + } + } + ort->AllocateLoadComponentArraysDoAllocate = false; } @@ -14595,18 +14535,14 @@ 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(); - ort->loadConvectedWithPulse.deallocate(); } void ComputeLoadComponentDecayCurve(EnergyPlusData &state) @@ -14615,8 +14551,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. @@ -14625,73 +14559,58 @@ 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; - 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 = state.dataSize->CalcFinalZoneSizing(zoneNum).CoolDDNum; // loop over timesteps after pulse occurred - if (state.dataOutRptTab->CoolDesSelectedCLCDC != 0) { - 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) { - diff = ort->loadConvectedWithPulse( - state.dataOutRptTab->CoolDesSelectedCLCDC, state.dataOutRptTab->TimeStepCLCDC, state.dataOutRptTab->SurfNumCLCDC) - - ort->loadConvectedNormal( - state.dataOutRptTab->CoolDesSelectedCLCDC, state.dataOutRptTab->TimeStepCLCDC, state.dataOutRptTab->SurfNumCLCDC); - ort->decayCurveCool(state.dataOutRptTab->TimeStepCLCDC - state.dataOutRptTab->TimeOfPulseCLCDC + 1, - state.dataOutRptTab->SurfNumCLCDC) = - -diff / ort->radiantPulseReceived(state.dataOutRptTab->CoolDesSelectedCLCDC, state.dataOutRptTab->SurfNumCLCDC); + 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(timeStep - timeOfPulse + 1, surfNum) = -diff / ort->radiantPulseReceived(coolDesSelected, surfNum); } else { - ort->decayCurveCool(state.dataOutRptTab->TimeStepCLCDC - state.dataOutRptTab->TimeOfPulseCLCDC + 1, - state.dataOutRptTab->SurfNumCLCDC) = 0.0; + ort->decayCurveCool(timeStep - timeOfPulse + 1, surfNum) = 0.0; } } } - state.dataOutRptTab->HeatDesSelectedCLCDC = state.dataSize->CalcFinalZoneSizing(state.dataOutRptTab->ZoneNumCLCDC).HeatDDNum; - if (state.dataOutRptTab->HeatDesSelectedCLCDC != 0) { - state.dataOutRptTab->TimeOfPulseCLCDC = - ort->radiantPulseTimestep(state.dataOutRptTab->HeatDesSelectedCLCDC, state.dataOutRptTab->ZoneNumCLCDC); + int const heatDesSelected = 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) { - diff = ort->loadConvectedWithPulse( - state.dataOutRptTab->HeatDesSelectedCLCDC, state.dataOutRptTab->TimeStepCLCDC, state.dataOutRptTab->SurfNumCLCDC) - - ort->loadConvectedNormal( - state.dataOutRptTab->HeatDesSelectedCLCDC, state.dataOutRptTab->TimeStepCLCDC, state.dataOutRptTab->SurfNumCLCDC); - ort->decayCurveHeat(state.dataOutRptTab->TimeStepCLCDC - state.dataOutRptTab->TimeOfPulseCLCDC + 1, - state.dataOutRptTab->SurfNumCLCDC) = - -diff / ort->radiantPulseReceived(state.dataOutRptTab->HeatDesSelectedCLCDC, state.dataOutRptTab->SurfNumCLCDC); + 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(timeStep - timeOfPulse + 1, surfNum) = -diff / ort->radiantPulseReceived(heatDesSelected, surfNum); } else { - ort->decayCurveHeat(state.dataOutRptTab->TimeStepCLCDC - state.dataOutRptTab->TimeOfPulseCLCDC + 1, - state.dataOutRptTab->SurfNumCLCDC) = 0.0; + ort->decayCurveHeat(timeStep - timeOfPulse + 1, surfNum) = 0.0; } } } @@ -14744,8 +14663,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. @@ -14757,28 +14674,52 @@ 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; + auto &znCLDayTS = ort->znCompLoads[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLS - 1]; + for (auto &zone : znCLDayTS.spacezone) { + zone.feneCondInstantSeq = 0.0; + } + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + 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) { + 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); + Real64 surfCond = state.dataSurface->SurfWinGainConvGlazToZoneRep(iSurfGCLS) + state.dataSurface->SurfWinConvHeatFlowNatural(iSurfGCLS) + + state.dataSurface->SurfWinGainConvShadeToZoneRep(iSurfGCLS) + + state.dataSurface->SurfWinGainFrameDividerToZoneRep(iSurfGCLS); + znCLDayTS.spacezone[zoneNumGCLS - 1].feneCondInstantSeq += surfCond; + + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + int spaceNum = state.dataSurface->Surface(iSurfGCLS).spaceNum; + ort->spCompLoads[state.dataSize->CurOverallSimDay - 1].ts[timeStepInDayGCLS - 1].spacezone[spaceNum - 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. // 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, state.dataOutRptTab->TimeStepInDayGCLS, izone) += 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); + spCLDayTS.spacezone[ispace - 1].feneCondInstantSeq += tubularGain; + } } } } @@ -14788,8 +14729,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. @@ -14797,76 +14736,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) / - 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->infilLatentSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLH, state.dataOutRptTab->iZoneGCLH) = - ((state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->iZoneGCLH).InfilLatentGain - - state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->iZoneGCLH).InfilLatentLoss) / - TimeStepSysSec); // zone infiltration + 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 &znCompLoadDayTSZone = znCompLoadDayTS.spacezone[iZoneGCLH - 1]; + auto &zoneAirRpt = state.dataHeatBal->ZnAirRpt(iZoneGCLH); + gatherSpaceZoneCompLoadsHVAC(znCompLoadDayTSZone, zoneAirRpt, state.dataHVACGlobal->TimeStepSysSec); 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->zoneVentInstantSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLH, state.dataOutRptTab->iZoneGCLH) = - ((state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->iZoneGCLH).VentilHeatGain - - state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->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->zoneVentLatentSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLH, state.dataOutRptTab->iZoneGCLH) = - ((state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->iZoneGCLH).VentilLatentGain - - state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->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->interZoneMixInstantSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLH, state.dataOutRptTab->iZoneGCLH) = - ((state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->iZoneGCLH).MixHeatGain - - state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->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->interZoneMixLatentSeq(state.dataSize->CurOverallSimDay, state.dataOutRptTab->TimeStepInDayGCLH, state.dataOutRptTab->iZoneGCLH) = - ((state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->iZoneGCLH).MixLatentGain - - state.dataHeatBal->ZnAirRpt(state.dataOutRptTab->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 + 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 &spCompLoadDayTSSpace = spCompLoadDayTS.spacezone[iSpace - 1]; + auto &spaceAirRpt = state.dataHeatBal->spaceAirRpt(iSpace); + gatherSpaceZoneCompLoadsHVAC(spCompLoadDayTSSpace, spaceAirRpt, state.dataHVACGlobal->TimeStepSysSec); + if (state.afn->simulation_control.type != AirflowNetwork::ControlType::NoMultizoneOrDistribution) { + auto &space = state.dataHeatBal->space(iSpace); + 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::compLoadsSpaceZone &szCompLoadDayTS, + DataHeatBalance::AirReportVars const &szAirRpt, + Real64 const timeStepSysSec) +{ + 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) { // SUBROUTINE INFORMATION: @@ -14940,20 +14865,16 @@ 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; Array1D ZoneHeatCompLoadTables; // for zone level component load summary output tables Array1D ZoneCoolCompLoadTables; @@ -14978,37 +14899,39 @@ 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) { + 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; + } + } ZoneHeatCompLoadTables.allocate(state.dataGlobal->NumOfZones); for (auto &e : ZoneHeatCompLoadTables) { e.cells.allocate(LoadCompCol::PerArea, LoadCompRow::GrdTot); @@ -15086,103 +15009,63 @@ 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) { + if (state.dataHeatBal->doSpaceHeatBalanceSizing) { + for (int iSpace = 1; iSpace <= state.dataGlobal->numSpaces; ++iSpace) { + // Yes, check if the zone is controlled, not the space for this + 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), + SpaceCoolCompLoadTables(iSpace), + SpaceHeatCompLoadTables(iSpace), + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, + ort->spCompLoads, + surfDelaySeq, + spaceComponentAreas(iSpace), + zoneNum, + iSpace); + } + } + } 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)); - - // 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 + computeSpaceZoneCompLoads(state, + state.dataSize->CalcFinalZoneSizing(iZone), + ZoneCoolCompLoadTables(iZone), + ZoneHeatCompLoadTables(iZone), + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, + ort->znCompLoads, + surfDelaySeq, + 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 @@ -15267,30 +15150,30 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) coolDesSelected, true, iZone, - peopleDelaySeqCool, - equipDelaySeqCool, - hvacLossDelaySeqCool, - powerGenDelaySeqCool, - lightDelaySeqCool, - feneSolarDelaySeqCool, - ort->feneCondInstantSeq, - surfDelaySeqCool); + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, + ort->znCompLoads, + surfDelaySeq); ComputeTableBodyUsingMovingAvg(state, airLoopZonesCoolCompLoadTables.cells, airLoopZonesCoolCompLoadTables.cellUsed, coolDesSelected, timeCoolMax, iZone, - peopleDelaySeqCool, - equipDelaySeqCool, - hvacLossDelaySeqCool, - powerGenDelaySeqCool, - lightDelaySeqCool, - feneSolarDelaySeqCool, - ort->feneCondInstantSeq, - surfDelaySeqCool); + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, + ort->znCompLoads, + surfDelaySeq); CollectPeakZoneConditions(state, airLoopZonesCoolCompLoadTables, coolDesSelected, timeCoolMax, iZone, true); - AddAreaColumnForZone(iZone, ZoneComponentAreas, airLoopZonesCoolCompLoadTables); + AddAreaColumnForZone(ZoneComponentAreas(iZone), airLoopZonesCoolCompLoadTables); } if (ort->displayZoneComponentLoadSummary && (airLoopZonesHeatCompLoadTables.desDayNum == ZoneHeatCompLoadTables(iZone).desDayNum) && @@ -15304,30 +15187,30 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) heatDesSelected, false, iZone, - peopleDelaySeqHeat, - equipDelaySeqHeat, - hvacLossDelaySeqHeat, - powerGenDelaySeqHeat, - lightDelaySeqHeat, - feneSolarDelaySeqHeat, - ort->feneCondInstantSeq, - surfDelaySeqHeat); + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, + ort->znCompLoads, + surfDelaySeq); ComputeTableBodyUsingMovingAvg(state, airLoopZonesHeatCompLoadTables.cells, airLoopZonesHeatCompLoadTables.cellUsed, heatDesSelected, timeHeatMax, iZone, - peopleDelaySeqHeat, - equipDelaySeqHeat, - hvacLossDelaySeqHeat, - powerGenDelaySeqHeat, - lightDelaySeqHeat, - feneSolarDelaySeqHeat, - ort->feneCondInstantSeq, - surfDelaySeqHeat); + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, + ort->znCompLoads, + surfDelaySeq); CollectPeakZoneConditions(state, airLoopZonesHeatCompLoadTables, heatDesSelected, timeHeatMax, iZone, false); - AddAreaColumnForZone(iZone, ZoneComponentAreas, airLoopZonesHeatCompLoadTables); + AddAreaColumnForZone(ZoneComponentAreas(iZone), airLoopZonesHeatCompLoadTables); } } // combine the zones for each air loop @@ -15422,30 +15305,30 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) coolDesSelected, true, iZone, - peopleDelaySeqCool, - equipDelaySeqCool, - hvacLossDelaySeqCool, - powerGenDelaySeqCool, - lightDelaySeqCool, - feneSolarDelaySeqCool, - ort->feneCondInstantSeq, - surfDelaySeqCool); + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, + ort->znCompLoads, + surfDelaySeq); ComputeTableBodyUsingMovingAvg(state, facilityZonesCoolCompLoadTables.cells, facilityZonesCoolCompLoadTables.cellUsed, coolDesSelected, timeCoolMax, iZone, - peopleDelaySeqCool, - equipDelaySeqCool, - hvacLossDelaySeqCool, - powerGenDelaySeqCool, - lightDelaySeqCool, - feneSolarDelaySeqCool, - ort->feneCondInstantSeq, - surfDelaySeqCool); + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, + ort->znCompLoads, + surfDelaySeq); CollectPeakZoneConditions(state, facilityZonesCoolCompLoadTables, coolDesSelected, timeCoolMax, iZone, true); - AddAreaColumnForZone(iZone, ZoneComponentAreas, facilityZonesCoolCompLoadTables); + AddAreaColumnForZone(ZoneComponentAreas(iZone), facilityZonesCoolCompLoadTables); } facilityZonesCoolCompLoadTables.timeStepMax = timeCoolMax; facilityZonesCoolCompLoadTables.desDayNum = coolDesSelected; @@ -15459,30 +15342,30 @@ void WriteLoadComponentSummaryTables(EnergyPlusData &state) heatDesSelected, false, iZone, - peopleDelaySeqHeat, - equipDelaySeqHeat, - hvacLossDelaySeqHeat, - powerGenDelaySeqHeat, - lightDelaySeqHeat, - feneSolarDelaySeqHeat, - ort->feneCondInstantSeq, - surfDelaySeqHeat); + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, + ort->znCompLoads, + surfDelaySeq); ComputeTableBodyUsingMovingAvg(state, facilityZonesHeatCompLoadTables.cells, facilityZonesHeatCompLoadTables.cellUsed, heatDesSelected, timeHeatMax, iZone, - peopleDelaySeqHeat, - equipDelaySeqHeat, - hvacLossDelaySeqHeat, - powerGenDelaySeqHeat, - lightDelaySeqHeat, - feneSolarDelaySeqHeat, - ort->feneCondInstantSeq, - surfDelaySeqHeat); + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, + ort->znCompLoads, + surfDelaySeq); CollectPeakZoneConditions(state, facilityZonesHeatCompLoadTables, heatDesSelected, timeHeatMax, iZone, false); - AddAreaColumnForZone(iZone, ZoneComponentAreas, facilityZonesHeatCompLoadTables); + AddAreaColumnForZone(ZoneComponentAreas(iZone), facilityZonesHeatCompLoadTables); } facilityZonesHeatCompLoadTables.timeStepMax = timeHeatMax; facilityZonesHeatCompLoadTables.desDayNum = heatDesSelected; @@ -15531,6 +15414,31 @@ 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->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); + 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) { @@ -15566,23 +15474,118 @@ 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(); } } +void computeSpaceZoneCompLoads(EnergyPlusData &state, + DataSizing::ZoneSizingData const &calcFinalSizing, + CompLoadTablesType &coolCompLoadTables, + CompLoadTablesType &heatCompLoadTables, + Array1D &peopleDelaySeq, + Array1D &equipDelaySeq, + Array1D &hvacLossDelaySeq, + Array1D &powerGenDelaySeq, + Array1D &lightDelaySeq, + Array1D &feneSolarDelaySeq, + std::vector &szCompLoadLoc, + Array2D &surfDelaySeq, + ZompComponentAreasType &componentAreas, + int const iZone, + int const iSpace) +{ + 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, + szCompLoadLoc, + surfDelaySeq, + iSpace); + ComputeTableBodyUsingMovingAvg(state, + coolCompLoadTables.cells, + coolCompLoadTables.cellUsed, + coolDesSelected, + timeCoolMax, + iZone, + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, + szCompLoadLoc, + surfDelaySeq, + iSpace); + 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)); + + 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, + szCompLoadLoc, + surfDelaySeq, + iSpace); + ComputeTableBodyUsingMovingAvg(state, + heatCompLoadTables.cells, + heatCompLoadTables.cellUsed, + heatDesSelected, + timeHeatMax, + iZone, + peopleDelaySeq, + equipDelaySeq, + hvacLossDelaySeq, + powerGenDelaySeq, + lightDelaySeq, + feneSolarDelaySeq, + szCompLoadLoc, + surfDelaySeq, + iSpace); + CollectPeakZoneConditions(state, heatCompLoadTables, heatDesSelected, timeHeatMax, iZone, false, iSpace); + + // 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, @@ -15594,22 +15597,21 @@ void GetDelaySequences(EnergyPlusData &state, Array1D &powerGenDelaySeq, Array1D &lightDelaySeq, Array1D &feneSolarDelaySeq, - Array3D &feneCondInstantSeq, - 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; - - 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; - } + 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]; + auto const &enclCLDay = ort->enclCompLoads[desDaySelected - 1]; + auto &szCLDay = szCompLoadLoc[desDaySelected - 1]; Array2D decayCurve; if (isCooling) { @@ -15630,10 +15632,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; @@ -15645,17 +15647,19 @@ void GetDelaySequences(EnergyPlusData &state, for (int mStepBack = 1; mStepBack <= kTimeStep; ++mStepBack) { int sourceStep = kTimeStep - mStepBack + 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; + auto &compLoadTS = szCLDay.ts[sourceStep - 1].spacezone[szNumMinus1]; + 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 += 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 += 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; @@ -15669,14 +15673,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 } @@ -15688,9 +15693,10 @@ 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)) { - feneCondInstantSeq(desDaySelected, kTimeStep, zoneIndex) -= adjFeneSurfNetRadSeq; - state.dataOutRptTab->adjFenDone(desDaySelected, kTimeStep, zoneIndex) = true; + auto &szCompLoadDayTS = szCLDay.ts[kTimeStep - 1].spacezone[szNumMinus1]; + if (!szCompLoadDayTS.adjFenDone) { + szCompLoadDayTS.feneCondInstantSeq -= adjFeneSurfNetRadSeq; + szCompLoadDayTS.adjFenDone = true; } } // for kTimeStep @@ -15712,8 +15718,9 @@ void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, Array1D const &powerGenDelaySeq, Array1D const &lightDelaySeq, Array1D const &feneSolarDelaySeq, - Array3D const &feneCondInstantSeq, - 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 @@ -15721,16 +15728,23 @@ 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); + 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 - AvgData = state.dataOutRptTab->peopleInstantSeq(desDaySelected, _, zoneIndex); + auto &compLoadDay = szCompLoadLoc[desDaySelected - 1]; + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + 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; - AvgData = state.dataOutRptTab->peopleLatentSeq(desDaySelected, _, zoneIndex); + for (int iTS = 1; iTS <= numTSinDay; ++iTS) { + AvgData(iTS) = compLoadDay.ts[iTS - 1].spacezone[szNumMinus1].peopleLatentSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::Latent, LoadCompRow::People) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::Latent, LoadCompRow::People) = true; @@ -15740,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].spacezone[szNumMinus1].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].spacezone[szNumMinus1].lightRetAirSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensRA, LoadCompRow::Lights) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensRA, LoadCompRow::Lights) = true; @@ -15754,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].spacezone[szNumMinus1].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].spacezone[szNumMinus1].equipLatentSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::Latent, LoadCompRow::Equip) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::Latent, LoadCompRow::Equip) = true; @@ -15768,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].spacezone[szNumMinus1].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].spacezone[szNumMinus1].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].spacezone[szNumMinus1].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].spacezone[szNumMinus1].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].spacezone[szNumMinus1].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].spacezone[szNumMinus1].hvacLossInstantSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::HvacLoss) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::HvacLoss) = true; @@ -15802,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].spacezone[szNumMinus1].powerGenInstantSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::PowerGen) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::PowerGen) = true; @@ -15821,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].spacezone[szNumMinus1].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].spacezone[szNumMinus1].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].spacezone[szNumMinus1].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].spacezone[szNumMinus1].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].spacezone[szNumMinus1].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].spacezone[szNumMinus1].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].spacezone[szNumMinus1].feneCondInstantSeq; + } General::MovingAvg(AvgData, state.dataSize->NumTimeStepsInAvg); resultCells(LoadCompCol::SensInst, LoadCompRow::FeneCond) = AvgData(timeOfMax); resCellsUsd(LoadCompCol::SensInst, LoadCompRow::FeneCond) = true; @@ -15956,16 +16006,23 @@ 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); - 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); + if (mult == 0.0) mult = 1.0; if (isCooling) { @@ -15976,53 +16033,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 @@ -16032,57 +16085,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.) { @@ -16107,12 +16156,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 totNumPeople = 0; + if (spaceIndex == 0) { + 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 { + 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; } } @@ -16141,114 +16200,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 +16574,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..1f9e008ad84 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, @@ -489,6 +491,86 @@ 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 componentLoadsSurf + { + std::vector ts; + }; + + struct compLoadsSpaceZone + { + Real64 peopleInstantSeq = 0.0; + Real64 peopleLatentSeq = 0.0; + + Real64 lightInstantSeq = 0.0; + Real64 lightRetAirSeq = 0.0; + + Real64 equipInstantSeq = 0.0; + Real64 equipLatentSeq = 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 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; + bool adjFenDone = false; + }; + struct compLoadsTimeStepSpZn + { + std::vector spacezone; + }; + struct componentLoadsSpZn + { + 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); @@ -775,8 +857,28 @@ namespace OutputReportTabular { void GatherComponentLoadsHVAC(EnergyPlusData &state); + void gatherSpaceZoneCompLoadsHVAC(OutputReportTabular::compLoadsSpaceZone &compLoadDayTS, + DataHeatBalance::AirReportVars const &szAirRpt, + Real64 const timeStepSysSec); + void WriteLoadComponentSummaryTables(EnergyPlusData &state); + void computeSpaceZoneCompLoads(EnergyPlusData &state, + DataSizing::ZoneSizingData const &calcFinalSizing, + CompLoadTablesType &coolCompLoadTables, + CompLoadTablesType &heatCompLoadTables, + Array1D &peopleDelaySeq, + Array1D &equipDelaySeq, + Array1D &hvacLossDelaySeq, + Array1D &powerGenDelaySeq, + Array1D &lightDelaySeq, + Array1D &feneSolarDelaySeq, + std::vector &szCompLoadLoc, + Array2D &surfDelaySeq, + ZompComponentAreasType &componentAreas, + int const iZone, + int const iSpace = 0); + void GetDelaySequences(EnergyPlusData &state, int desDaySelected, bool isCooling, @@ -787,8 +889,9 @@ namespace OutputReportTabular { Array1D &powerGenDelaySeq, Array1D &lightDelaySeq, Array1D &feneSolarDelaySeq, - Array3D &feneCondInstantSeq, - Array2D &surfDelaySeq); + std::vector &szCompLoadLoc, + Array2D &surfDelaySeq, + int const iSpace = 0); void ComputeTableBodyUsingMovingAvg(EnergyPlusData &state, Array2D &resultCells, @@ -802,17 +905,20 @@ namespace OutputReportTabular { Array1D const &powerGenDelaySeq, Array1D const &lightDelaySeq, Array1D const &feneSolarDelaySeq, - Array3D const &feneCondInstantSeqLoc, - 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); + void CollectPeakZoneConditions( + EnergyPlusData &state, CompLoadTablesType &compLoad, int desDaySelected, int timeOfMax, int zoneIndex, bool isCooling, int spaceIndex = 0); void ComputeEngineeringChecks(CompLoadTablesType &compLoad); - void GetZoneComponentAreas(EnergyPlusData &state, Array1D &areas); + void GetZoneComponentAreas(EnergyPlusData &state, Array1D &znAreas, Array1D &spAreas); - void AddAreaColumnForZone(int zoneNum, Array1D const &compAreas, CompLoadTablesType &compLoadTotal); + void addSurfaceArea(DataSurfaces::SurfaceData const &curSurface, Array1D &areas, bool isZone); + + void AddAreaColumnForZone(ZompComponentAreasType const &compAreas, CompLoadTablesType &compLoadTotal); void CombineLoadCompResults(CompLoadTablesType &compLoadTotal, CompLoadTablesType const &compLoadPartial, Real64 multiplier); @@ -1155,50 +1261,13 @@ 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 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 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; @@ -1306,18 +1375,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 - 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; int iUnitGsui = 0; @@ -1475,40 +1532,13 @@ 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->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->surfCompLoads.clear(); + this->znCompLoads.clear(); + this->spCompLoads.clear(); + this->enclCompLoads.clear(); + this->maxUniqueKeyCount = 0; this->activeSubTableName.clear(); this->activeReportNameNoSpace.clear(); @@ -1612,18 +1642,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->iSurfGCLS = 0; - this->ZoneNumGCLS = 0; - this->TimeStepInDayGCLS = 0; - this->iZoneGCLH = 0; - this->TimeStepInDayGCLH = 0; - this->adjFenDone.clear(); this->BigNumRMG = 0.0; this->foundGsui = 0; this->iUnitGsui = 0; 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 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); diff --git a/tst/EnergyPlus/unit/InternalHeatGains.unit.cc b/tst/EnergyPlus/unit/InternalHeatGains.unit.cc index d44e21eaff8..193bc0887f0 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[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; // 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 68afb1ad5ec..e91ad0128b7 100644 --- a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc +++ b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc @@ -518,128 +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); - - // 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); - - // 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 ); + 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) @@ -6716,6 +6611,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 +6698,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); @@ -7029,21 +6925,16 @@ 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; AllocateLoadComponentArrays(*state); - feneCondInstantSeq(coolDesSelected, 1, 1) = 0.88; + auto &znCL = state->dataOutRptTab->znCompLoads; + znCL[coolDesSelected - 1].ts[0].spacezone[iZone - 1].feneCondInstantSeq = 0.88; - state->dataOutRptTab->netSurfRadSeq(coolDesSelected, 1, 1) = 0.05; + state->dataOutRptTab->surfCompLoads[coolDesSelected - 1].ts[0].surf[0].netSurfRadSeq = 0.05; GetDelaySequences(*state, coolDesSelected, @@ -7055,10 +6946,12 @@ 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[coolDesSelected - 1].ts[0].spacezone[iZone - 1].feneCondInstantSeq); // the first time the subtraction operation should have occurred GetDelaySequences(*state, coolDesSelected, @@ -7070,14 +6963,13 @@ 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[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) @@ -8409,12 +8301,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; @@ -8435,24 +8321,32 @@ 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]; for (int jSurf = 1; jSurf <= 4; ++jSurf) { for (int step = 1; step <= 10; ++step) { - state->dataOutRptTab->TMULTseq(coolDesSelected, step, radEnclosureNum) = 0.1 * step; - state->dataOutRptTab->ITABSFseq(coolDesSelected, step, jSurf) = 0.2 * step * surfBaseValue[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]; - 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; } } + 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, @@ -8463,7 +8357,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesSurfaceOrder_ powerGenDelaySeqCool, lightDelaySeqCool, feneSolarDelaySeqCool, - feneCondInstantSeq, + znCL, surfDelaySeqCool); // Save some results from first pass @@ -8495,17 +8389,23 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesSurfaceOrder_ for (int jSurf = 1; jSurf <= 4; ++jSurf) { for (int step = 1; step <= 10; ++step) { - state->dataOutRptTab->TMULTseq(coolDesSelected, step, radEnclosureNum) = 0.1 * step; - state->dataOutRptTab->ITABSFseq(coolDesSelected, step, jSurf) = 0.2 * step * surfBaseValue[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]; - 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; } } + 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, @@ -8516,7 +8416,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesSurfaceOrder_ powerGenDelaySeqCool, lightDelaySeqCool, feneSolarDelaySeqCool, - feneCondInstantSeq, + znCL, surfDelaySeqCool); // Save some results from second pass