From 1d999a7b2815bd136c42d1eaaf4877d4387406eb Mon Sep 17 00:00:00 2001 From: jcyuan Date: Wed, 12 Apr 2023 11:54:56 -0500 Subject: [PATCH 01/80] Fix the default parameter type for the exhaust control function. --- src/EnergyPlus/ExhaustAirSystemManager.cc | 6 +++--- src/EnergyPlus/ExhaustAirSystemManager.hh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/EnergyPlus/ExhaustAirSystemManager.cc b/src/EnergyPlus/ExhaustAirSystemManager.cc index aac6c90fca0..4c1ab7cfa1f 100644 --- a/src/EnergyPlus/ExhaustAirSystemManager.cc +++ b/src/EnergyPlus/ExhaustAirSystemManager.cc @@ -675,13 +675,13 @@ namespace ExhaustAirSystemManager { } for (int ExhaustControlNum = 1; ExhaustControlNum <= state.dataZoneEquip->NumZoneExhaustControls; ++ExhaustControlNum) { - CalcZoneHVACExhaustControl(state, ExhaustControlNum, _); + CalcZoneHVACExhaustControl(state, ExhaustControlNum); } // report results if needed } - void CalcZoneHVACExhaustControl(EnergyPlusData &state, int const ZoneHVACExhaustControlNum, ObjexxFCL::Optional FlowRatio) + void CalcZoneHVACExhaustControl(EnergyPlusData &state, int const ZoneHVACExhaustControlNum, Real64 const FlowRatio) { // Calculate a zonehvac exhaust control system @@ -695,7 +695,7 @@ namespace ExhaustAirSystemManager { Real64 Tin = state.dataZoneTempPredictorCorrector->zoneHeatBalance(thisExhCtrl.ZoneNum).ZT; Real64 thisExhCtrlAvailScheVal = ScheduleManager::GetCurrentScheduleValue(state, thisExhCtrl.AvailScheduleNum); - if (present(FlowRatio)) { + if (FlowRatio != 0.0) { thisExhCtrl.BalancedFlow *= FlowRatio; thisExhCtrl.UnbalancedFlow *= FlowRatio; diff --git a/src/EnergyPlus/ExhaustAirSystemManager.hh b/src/EnergyPlus/ExhaustAirSystemManager.hh index 40020d7d243..2117972ac6c 100644 --- a/src/EnergyPlus/ExhaustAirSystemManager.hh +++ b/src/EnergyPlus/ExhaustAirSystemManager.hh @@ -133,7 +133,7 @@ namespace ExhaustAirSystemManager { void SimZoneHVACExhaustControls(EnergyPlusData &state); - void CalcZoneHVACExhaustControl(EnergyPlusData &state, int const ZoneHVACExhaustControlNum, ObjexxFCL::Optional FlowRatio); + void CalcZoneHVACExhaustControl(EnergyPlusData &state, int const ZoneHVACExhaustControlNum, Real64 const FlowRatio = 0.0); void SizeExhaustSystem(EnergyPlusData &state, int const exhSysNum); From 3adb67b8e4611413667c04b15095629845f75a30 Mon Sep 17 00:00:00 2001 From: jcyuan Date: Fri, 12 May 2023 14:21:04 -0500 Subject: [PATCH 02/80] A couple of additional places of azimuth angles comparisions where rotational angle differences should be used. --- src/EnergyPlus/SurfaceGeometry.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EnergyPlus/SurfaceGeometry.cc b/src/EnergyPlus/SurfaceGeometry.cc index 622a94b16d1..273afbc97dc 100644 --- a/src/EnergyPlus/SurfaceGeometry.cc +++ b/src/EnergyPlus/SurfaceGeometry.cc @@ -7897,7 +7897,7 @@ namespace SurfaceGeometry { surfaceArea; // Autodesk:F2C++ Functions handle array subscript usage for (ThisSurf = 1; ThisSurf <= state.dataHeatBal->ExtVentedCavity(Item).NumSurfs; ++ThisSurf) { SurfID = state.dataHeatBal->ExtVentedCavity(Item).SurfPtrs(ThisSurf); - if (std::abs(state.dataSurface->Surface(SurfID).Azimuth - AvgAzimuth) > 15.0) { + if (rotAzmDiffDeg(state.dataSurface->Surface(SurfID).Azimuth, AvgAzimuth) > 15.0) { ShowWarningError(state, format("{}=\"{}, Surface {} has Azimuth different from others in the associated group.", cCurrentModuleObject, @@ -13053,7 +13053,7 @@ namespace SurfaceGeometry { for (int iFace = 1; iFace <= zonePoly.NumSurfaceFaces; ++iFace) { int curSurfNum = zonePoly.SurfaceFace(iFace).SurfNum; - if (std::abs(state.dataSurface->Surface(curSurfNum).Azimuth - azimuth) < 1.) { + if (rotAzmDiffDeg(state.dataSurface->Surface(curSurfNum).Azimuth, azimuth) < 1.) { facingAzimuth.emplace_back(iFace); } } From ce1a5b545858795bd33c8a917a43d1c3659549b0 Mon Sep 17 00:00:00 2001 From: jcyuan Date: Fri, 12 May 2023 15:11:24 -0500 Subject: [PATCH 03/80] Refactoring for include in other files, and one additional occurance in the transpired collector module. --- src/EnergyPlus/General.cc | 14 ++++++++++++++ src/EnergyPlus/General.hh | 3 ++- src/EnergyPlus/SurfaceGeometry.cc | 22 ++++------------------ src/EnergyPlus/TranspiredCollector.cc | 2 +- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/EnergyPlus/General.cc b/src/EnergyPlus/General.cc index 170cf152994..0c1cb3f3b9a 100644 --- a/src/EnergyPlus/General.cc +++ b/src/EnergyPlus/General.cc @@ -1409,4 +1409,18 @@ void findReportPeriodIdx(EnergyPlusData &state, } } +Real64 rotAzmDiffDeg(Real64 const &AzmA, Real64 const &AzmB) +{ + // This function takes two (azimuth) angles in Degree(s), + // and returns the rotational angle difference in Degree(s). + + Real64 diff = AzmB - AzmA; + if (diff > 180.0) { + diff = 360.0 - diff; + } else if (diff < -180.0) { + diff = 360.0 + diff; + } + return std::abs(diff); +} + } // namespace EnergyPlus::General diff --git a/src/EnergyPlus/General.hh b/src/EnergyPlus/General.hh index f3904d710d8..c3301642115 100644 --- a/src/EnergyPlus/General.hh +++ b/src/EnergyPlus/General.hh @@ -248,6 +248,8 @@ namespace General { int nReportPeriods, Array1D_bool &inReportPeriodFlags); + Real64 rotAzmDiffDeg(Real64 const &AzmA, Real64 const &AzmB); + inline Real64 epexp(const Real64 numerator, const Real64 denominator) { if (denominator == 0.0) { @@ -256,7 +258,6 @@ namespace General { return std::exp(numerator / denominator); } } - } // namespace General struct GeneralData : BaseGlobalStruct diff --git a/src/EnergyPlus/SurfaceGeometry.cc b/src/EnergyPlus/SurfaceGeometry.cc index 273afbc97dc..420c4477dcb 100644 --- a/src/EnergyPlus/SurfaceGeometry.cc +++ b/src/EnergyPlus/SurfaceGeometry.cc @@ -3017,20 +3017,6 @@ namespace SurfaceGeometry { } } - Real64 rotAzmDiffDeg(Real64 const &AzmA, Real64 const &AzmB) - { - // This function takes two (azimuth) angles in Degree(s), - // and returns the rotational angle difference in Degree(s). - - Real64 diff = AzmB - AzmA; - if (diff > 180.0) { - diff = 360.0 - diff; - } else if (diff < -180.0) { - diff = 360.0 + diff; - } - return std::abs(diff); - } - void checkSubSurfAzTiltNorm(EnergyPlusData &state, SurfaceData &baseSurface, // Base surface data (in) SurfaceData &subSurface, // Subsurface data (in) @@ -3066,7 +3052,7 @@ namespace SurfaceGeometry { // Is base surface horizontal? If so, ignore azimuth differences if (std::abs(baseSurface.Tilt) <= 1.0e-5 || std::abs(baseSurface.Tilt - 180.0) <= 1.0e-5) baseSurfHoriz = true; - if (((rotAzmDiffDeg(baseSurface.Azimuth, subSurface.Azimuth) > errorTolerance) && !baseSurfHoriz) || + if (((General::rotAzmDiffDeg(baseSurface.Azimuth, subSurface.Azimuth) > errorTolerance) && !baseSurfHoriz) || (std::abs(baseSurface.Tilt - subSurface.Tilt) > errorTolerance)) { surfaceError = true; ShowSevereError( @@ -3077,7 +3063,7 @@ namespace SurfaceGeometry { format("Subsurface=\"{}\" Tilt = {:.1R} Azimuth = {:.1R}", subSurface.Name, subSurface.Tilt, subSurface.Azimuth)); ShowContinueError( state, format("Base surface=\"{}\" Tilt = {:.1R} Azimuth = {:.1R}", baseSurface.Name, baseSurface.Tilt, baseSurface.Azimuth)); - } else if (((rotAzmDiffDeg(baseSurface.Azimuth, subSurface.Azimuth) > warningTolerance) && !baseSurfHoriz) || + } else if (((General::rotAzmDiffDeg(baseSurface.Azimuth, subSurface.Azimuth) > warningTolerance) && !baseSurfHoriz) || (std::abs(baseSurface.Tilt - subSurface.Tilt) > warningTolerance)) { ++state.dataSurfaceGeometry->checkSubSurfAzTiltNormErrCount; if (state.dataSurfaceGeometry->checkSubSurfAzTiltNormErrCount == 1 && !state.dataGlobal->DisplayExtraWarnings) { @@ -7897,7 +7883,7 @@ namespace SurfaceGeometry { surfaceArea; // Autodesk:F2C++ Functions handle array subscript usage for (ThisSurf = 1; ThisSurf <= state.dataHeatBal->ExtVentedCavity(Item).NumSurfs; ++ThisSurf) { SurfID = state.dataHeatBal->ExtVentedCavity(Item).SurfPtrs(ThisSurf); - if (rotAzmDiffDeg(state.dataSurface->Surface(SurfID).Azimuth, AvgAzimuth) > 15.0) { + if (General::rotAzmDiffDeg(state.dataSurface->Surface(SurfID).Azimuth, AvgAzimuth) > 15.0) { ShowWarningError(state, format("{}=\"{}, Surface {} has Azimuth different from others in the associated group.", cCurrentModuleObject, @@ -13053,7 +13039,7 @@ namespace SurfaceGeometry { for (int iFace = 1; iFace <= zonePoly.NumSurfaceFaces; ++iFace) { int curSurfNum = zonePoly.SurfaceFace(iFace).SurfNum; - if (rotAzmDiffDeg(state.dataSurface->Surface(curSurfNum).Azimuth, azimuth) < 1.) { + if (General::rotAzmDiffDeg(state.dataSurface->Surface(curSurfNum).Azimuth, azimuth) < 1.) { facingAzimuth.emplace_back(iFace); } } diff --git a/src/EnergyPlus/TranspiredCollector.cc b/src/EnergyPlus/TranspiredCollector.cc index d42925bbe52..684fc939360 100644 --- a/src/EnergyPlus/TranspiredCollector.cc +++ b/src/EnergyPlus/TranspiredCollector.cc @@ -654,7 +654,7 @@ namespace TranspiredCollector { surfaceArea; // Autodesk:F2C++ Functions handle array subscript usage for (ThisSurf = 1; ThisSurf <= state.dataTranspiredCollector->UTSC(Item).NumSurfs; ++ThisSurf) { SurfID = state.dataTranspiredCollector->UTSC(Item).SurfPtrs(ThisSurf); - if (std::abs(state.dataSurface->Surface(SurfID).Azimuth - AvgAzimuth) > 15.0) { + if (General::rotAzmDiffDeg(state.dataSurface->Surface(SurfID).Azimuth, AvgAzimuth) > 15.0) { ShowWarningError(state, format("Surface {} has Azimuth different from others in the group associated with {} ={}", state.dataSurface->Surface(SurfID).Name, From 81060ecaca8499be3a482409241a5202d8e3c8d4 Mon Sep 17 00:00:00 2001 From: Rick Strand Date: Tue, 6 Jun 2023 11:34:03 -0500 Subject: [PATCH 04/80] Correction of Issues with ZeroSource variables Changes made to ZeroSource variables in various models that act like radiant systems. ZeroSource (and other variables) converted from arrays over zones or surfaces to being attached to local objects. --- src/EnergyPlus/ChilledCeilingPanelSimple.cc | 8 +- src/EnergyPlus/ChilledCeilingPanelSimple.hh | 2 +- src/EnergyPlus/DataHeatBalance.hh | 5 +- src/EnergyPlus/ElectricBaseboardRadiator.cc | 2 +- src/EnergyPlus/HWBaseboardRadiator.cc | 148 +++++++------------- src/EnergyPlus/HWBaseboardRadiator.hh | 29 ++-- src/EnergyPlus/HighTempRadiantSystem.cc | 103 +++++++------- src/EnergyPlus/HighTempRadiantSystem.hh | 25 ++-- src/EnergyPlus/LowTempRadiantSystem.cc | 26 ++-- src/EnergyPlus/LowTempRadiantSystem.hh | 27 ++-- src/EnergyPlus/SteamBaseboardRadiator.cc | 70 +++++---- src/EnergyPlus/SteamBaseboardRadiator.hh | 28 ++-- src/EnergyPlus/SwimmingPool.cc | 60 +++----- src/EnergyPlus/SwimmingPool.hh | 17 +-- src/EnergyPlus/VentilatedSlab.cc | 7 +- src/EnergyPlus/VentilatedSlab.hh | 22 +-- 16 files changed, 253 insertions(+), 326 deletions(-) diff --git a/src/EnergyPlus/ChilledCeilingPanelSimple.cc b/src/EnergyPlus/ChilledCeilingPanelSimple.cc index bda31786665..c71de090e31 100644 --- a/src/EnergyPlus/ChilledCeilingPanelSimple.cc +++ b/src/EnergyPlus/ChilledCeilingPanelSimple.cc @@ -873,7 +873,7 @@ void InitCoolingPanel(EnergyPlusData &state, int const CoolingPanelNum, int cons ThisInNode.Press = 0.0; ThisInNode.HumRat = 0.0; - ThisCP.ZeroSourceSumHATsurf = 0.0; + ThisCP.ZeroCPSourceSumHATsurf = 0.0; ThisCP.CoolingPanelSource = 0.0; ThisCP.CoolingPanelSrcAvg = 0.0; ThisCP.LastCoolingPanelSrc = 0.0; @@ -889,7 +889,7 @@ void InitCoolingPanel(EnergyPlusData &state, int const CoolingPanelNum, int cons if (state.dataGlobal->BeginTimeStepFlag && FirstHVACIteration) { int ZoneNum = ThisCP.ZonePtr; - state.dataHeatBal->Zone(ZoneNum).ZeroSourceSumHATsurf = state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state); + ThisCP.ZeroCPSourceSumHATsurf = state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state); ThisCP.CoolingPanelSrcAvg = 0.0; ThisCP.LastCoolingPanelSrc = 0.0; ThisCP.LastSysTimeElapsed = 0.0; @@ -1416,8 +1416,8 @@ void CoolingPanelParams::CalcCoolingPanel(EnergyPlusData &state, int const Cooli // that all energy radiated to people is converted to convective energy is // not very precise, but at least it conserves energy. The system impact to heat balance // should include this. - LoadMet = (state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state) - state.dataHeatBal->Zone(ZoneNum).ZeroSourceSumHATsurf) + - (CoolingPanelCool * this->FracConvect) + (RadHeat * this->FracDistribPerson); + LoadMet = (state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state) - this->ZeroCPSourceSumHATsurf) + (CoolingPanelCool * this->FracConvect) + + (RadHeat * this->FracDistribPerson); } this->WaterOutletEnthalpy = this->WaterInletEnthalpy - CoolingPanelCool / waterMassFlowRate; diff --git a/src/EnergyPlus/ChilledCeilingPanelSimple.hh b/src/EnergyPlus/ChilledCeilingPanelSimple.hh index 14a9ca198a3..64e406f7458 100644 --- a/src/EnergyPlus/ChilledCeilingPanelSimple.hh +++ b/src/EnergyPlus/ChilledCeilingPanelSimple.hh @@ -144,7 +144,7 @@ namespace CoolingPanelSimple { int CoolingPanelMassFlowReSimIndex = 0; int CoolingPanelInletTempFlowReSimIndex = 0; bool MyEnvrnFlag = true; - Real64 ZeroSourceSumHATsurf = 0.0; + Real64 ZeroCPSourceSumHATsurf = 0.0; Real64 CoolingPanelSource = 0.0; Real64 CoolingPanelSrcAvg = 0.0; Real64 LastCoolingPanelSrc = 0.0; diff --git a/src/EnergyPlus/DataHeatBalance.hh b/src/EnergyPlus/DataHeatBalance.hh index d8fbfeb9063..627532583a8 100644 --- a/src/EnergyPlus/DataHeatBalance.hh +++ b/src/EnergyPlus/DataHeatBalance.hh @@ -692,9 +692,8 @@ namespace DataHeatBalance { Real64 delta_T = 0.0; // Indoor and outdoor temperature Real64 delta_HumRat = 0.0; // Indoor and outdoor humidity ratio delta - Real64 ZeroSourceSumHATsurf = 0.0; // From Chilled Ceiling Panel, equal to the SumHATsurf for all the walls in a zone with no source - bool zoneOAQuadratureSum = false; // True when zone OA balance method is Quadrature - int zoneOABalanceIndex = 0; // Index to ZoneAirBalance for this zone, if any + bool zoneOAQuadratureSum = false; // True when zone OA balance method is Quadrature + int zoneOABalanceIndex = 0; // Index to ZoneAirBalance for this zone, if any // Spaces bool anySurfacesWithoutSpace = false; // True if any surfaces in a zone do not have a space assigned in input diff --git a/src/EnergyPlus/ElectricBaseboardRadiator.cc b/src/EnergyPlus/ElectricBaseboardRadiator.cc index 57140cedc55..83369f7d5be 100644 --- a/src/EnergyPlus/ElectricBaseboardRadiator.cc +++ b/src/EnergyPlus/ElectricBaseboardRadiator.cc @@ -741,7 +741,7 @@ namespace ElectricBaseboardRadiator { DistributeBBElecRadGains(state); HeatBalanceSurfaceManager::CalcHeatBalanceOutsideSurf(state, ZoneNum); HeatBalanceSurfaceManager::CalcHeatBalanceInsideSurf(state, ZoneNum); - // Recalculate LoadMet with new ZeroSource... term and see if it is positive now. If not, shut it down. + // Recalculate LoadMet with new ZeroBBSource... term and see if it is positive now. If not, shut it down. LoadMet = (state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state) - TempZeroBBSourceSumHATsurf) + (QBBCap * elecBaseboard.FracConvect) + (RadHeat * elecBaseboard.FracDistribPerson); if (LoadMet < 0.0) { diff --git a/src/EnergyPlus/HWBaseboardRadiator.cc b/src/EnergyPlus/HWBaseboardRadiator.cc index 76e45188879..f7653bcd6fc 100644 --- a/src/EnergyPlus/HWBaseboardRadiator.cc +++ b/src/EnergyPlus/HWBaseboardRadiator.cc @@ -908,12 +908,6 @@ namespace HWBaseboardRadiator { Real64 Cp; // local fluid specific heat bool errFlag; - auto &ZeroSourceSumHATsurf = state.dataHWBaseboardRad->ZeroSourceSumHATsurf; - auto &QBBRadSource = state.dataHWBaseboardRad->QBBRadSource; - auto &QBBRadSrcAvg = state.dataHWBaseboardRad->QBBRadSrcAvg; - auto &LastQBBRadSrc = state.dataHWBaseboardRad->LastQBBRadSrc; - auto &LastSysTimeElapsed = state.dataHWBaseboardRad->LastSysTimeElapsed; - auto &LastTimeStepSys = state.dataHWBaseboardRad->LastTimeStepSys; int NumHWBaseboards = state.dataHWBaseboardRad->NumHWBaseboards; auto &HWBaseboard = state.dataHWBaseboardRad->HWBaseboard; @@ -923,12 +917,6 @@ namespace HWBaseboardRadiator { // Initialize the environment and sizing flags state.dataHWBaseboardRad->MyEnvrnFlag.dimension(NumHWBaseboards, true); state.dataHWBaseboardRad->MySizeFlag.dimension(NumHWBaseboards, true); - ZeroSourceSumHATsurf.dimension(state.dataGlobal->NumOfZones, 0.0); - QBBRadSource.dimension(NumHWBaseboards, 0.0); - QBBRadSrcAvg.dimension(NumHWBaseboards, 0.0); - LastQBBRadSrc.dimension(NumHWBaseboards, 0.0); - LastSysTimeElapsed.dimension(NumHWBaseboards, 0.0); - LastTimeStepSys.dimension(NumHWBaseboards, 0.0); state.dataHWBaseboardRad->SetLoopIndexFlag.dimension(NumHWBaseboards, true); state.dataHWBaseboardRad->MyOneTimeFlag = false; @@ -936,6 +924,12 @@ namespace HWBaseboardRadiator { // Air mass flow rate is obtained from the following linear equation (reset if autosize is used) // m_dot = 0.0062 + 2.75e-05*q HWBaseboard(Loop).AirMassFlowRateStd = Constant + Coeff * HWBaseboard(Loop).RatedCapacity; + HWBaseboard(Loop).ZeroBBSourceSumHATsurf = 0.0; + HWBaseboard(Loop).QBBRadSource = 0.0; + HWBaseboard(Loop).QBBRadSrcAvg = 0.0; + HWBaseboard(Loop).LastQBBRadSrc = 0.0; + HWBaseboard(Loop).LastSysTimeElapsed = 0.0; + HWBaseboard(Loop).LastTimeStepSys = 0.0; } } @@ -999,12 +993,12 @@ namespace HWBaseboardRadiator { state.dataLoopNodes->Node(WaterInletNode).Press = 0.0; state.dataLoopNodes->Node(WaterInletNode).HumRat = 0.0; - ZeroSourceSumHATsurf = 0.0; - QBBRadSource = 0.0; - QBBRadSrcAvg = 0.0; - LastQBBRadSrc = 0.0; - LastSysTimeElapsed = 0.0; - LastTimeStepSys = 0.0; + HWBaseboard(BaseboardNum).ZeroBBSourceSumHATsurf = 0.0; + HWBaseboard(BaseboardNum).QBBRadSource = 0.0; + HWBaseboard(BaseboardNum).QBBRadSrcAvg = 0.0; + HWBaseboard(BaseboardNum).LastQBBRadSrc = 0.0; + HWBaseboard(BaseboardNum).LastSysTimeElapsed = 0.0; + HWBaseboard(BaseboardNum).LastTimeStepSys = 0.0; state.dataHWBaseboardRad->MyEnvrnFlag(BaseboardNum) = false; } @@ -1015,11 +1009,11 @@ namespace HWBaseboardRadiator { if (state.dataGlobal->BeginTimeStepFlag && FirstHVACIteration) { int ZoneNum = HWBaseboard(BaseboardNum).ZonePtr; - ZeroSourceSumHATsurf(ZoneNum) = state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state); - QBBRadSrcAvg(BaseboardNum) = 0.0; - LastQBBRadSrc(BaseboardNum) = 0.0; - LastSysTimeElapsed(BaseboardNum) = 0.0; - LastTimeStepSys(BaseboardNum) = 0.0; + HWBaseboard(BaseboardNum).ZeroBBSourceSumHATsurf = state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state); + HWBaseboard(BaseboardNum).QBBRadSrcAvg = 0.0; + HWBaseboard(BaseboardNum).LastQBBRadSrc = 0.0; + HWBaseboard(BaseboardNum).LastSysTimeElapsed = 0.0; + HWBaseboard(BaseboardNum).LastTimeStepSys = 0.0; } // Do the every time step initializations @@ -1444,8 +1438,6 @@ namespace HWBaseboardRadiator { Real64 Cp; auto &HWBaseboard = state.dataHWBaseboardRad->HWBaseboard; auto &HWBaseboardDesignObject = state.dataHWBaseboardRad->HWBaseboardDesignObject; - auto &QBBRadSource = state.dataHWBaseboardRad->QBBRadSource; - auto &ZeroSourceSumHATsurf = state.dataHWBaseboardRad->ZeroSourceSumHATsurf; ZoneNum = HWBaseboard(BaseboardNum).ZonePtr; QZnReq = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).RemainingOutputReqToHeatSP; @@ -1495,7 +1487,7 @@ namespace HWBaseboardRadiator { WaterOutletTemp = WaterInletTemp - CapacitanceAir * (AirOutletTemp - AirInletTemp) / CapacitanceWater; BBHeat = CapacitanceWater * (WaterInletTemp - WaterOutletTemp); RadHeat = BBHeat * HWBaseboardDesignDataObject.FracRadiant; - QBBRadSource(BaseboardNum) = RadHeat; + HWBaseboard(BaseboardNum).QBBRadSource = RadHeat; if (HWBaseboardDesignDataObject.FracRadiant <= MinFrac) { LoadMet = BBHeat; @@ -1516,7 +1508,7 @@ namespace HWBaseboardRadiator { // that all energy radiated to people is converted to convective energy is // not very precise, but at least it conserves energy. The system impact to heat balance // should include this. - LoadMet = (state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state) - ZeroSourceSumHATsurf(ZoneNum)) + + LoadMet = (state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state) - HWBaseboard(BaseboardNum).ZeroBBSourceSumHATsurf) + (BBHeat * HWBaseboard(BaseboardNum).FracConvect) + (RadHeat * HWBaseboardDesignDataObject.FracDistribPerson); } HWBaseboard(BaseboardNum).WaterOutletEnthalpy = HWBaseboard(BaseboardNum).WaterInletEnthalpy - BBHeat / WaterMassFlowRate; @@ -1533,7 +1525,7 @@ namespace HWBaseboardRadiator { RadHeat = 0.0; WaterMassFlowRate = 0.0; AirMassFlowRate = 0.0; - QBBRadSource(BaseboardNum) = 0.0; + HWBaseboard(BaseboardNum).QBBRadSource = 0.0; HWBaseboard(BaseboardNum).WaterOutletEnthalpy = HWBaseboard(BaseboardNum).WaterInletEnthalpy; SetActuatedBranchFlowRate(state, WaterMassFlowRate, HWBaseboard(BaseboardNum).WaterInletNode, HWBaseboard(BaseboardNum).plantLoc, false); } @@ -1586,12 +1578,7 @@ namespace HWBaseboardRadiator { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int WaterInletNode; int WaterOutletNode; - auto &HWBaseboard = state.dataHWBaseboardRad->HWBaseboard; - auto &LastSysTimeElapsed = state.dataHWBaseboardRad->LastSysTimeElapsed; - auto &QBBRadSrcAvg = state.dataHWBaseboardRad->QBBRadSrcAvg; - auto &LastQBBRadSrc = state.dataHWBaseboardRad->LastQBBRadSrc; - auto &QBBRadSource = state.dataHWBaseboardRad->QBBRadSource; - auto &LastTimeStepSys = state.dataHWBaseboardRad->LastTimeStepSys; + auto &thisHWBB = state.dataHWBaseboardRad->HWBaseboard(BaseboardNum); if (state.dataGlobal->BeginEnvrnFlag && state.dataHWBaseboardRad->MyEnvrnFlag2) { state.dataHWBaseboardRad->Iter = 0; @@ -1602,24 +1589,24 @@ namespace HWBaseboardRadiator { } // First, update the running average if necessary... - if (LastSysTimeElapsed(BaseboardNum) == state.dataHVACGlobal->SysTimeElapsed) { - QBBRadSrcAvg(BaseboardNum) -= LastQBBRadSrc(BaseboardNum) * LastTimeStepSys(BaseboardNum) / state.dataGlobal->TimeStepZone; + if (thisHWBB.LastSysTimeElapsed == state.dataHVACGlobal->SysTimeElapsed) { + thisHWBB.QBBRadSrcAvg -= thisHWBB.LastQBBRadSrc * thisHWBB.LastTimeStepSys / state.dataGlobal->TimeStepZone; } // Update the running average and the "last" values with the current values of the appropriate variables - QBBRadSrcAvg(BaseboardNum) += QBBRadSource(BaseboardNum) * state.dataHVACGlobal->TimeStepSys / state.dataGlobal->TimeStepZone; + thisHWBB.QBBRadSrcAvg += thisHWBB.QBBRadSource * state.dataHVACGlobal->TimeStepSys / state.dataGlobal->TimeStepZone; - LastQBBRadSrc(BaseboardNum) = QBBRadSource(BaseboardNum); - LastSysTimeElapsed(BaseboardNum) = state.dataHVACGlobal->SysTimeElapsed; - LastTimeStepSys(BaseboardNum) = state.dataHVACGlobal->TimeStepSys; + thisHWBB.LastQBBRadSrc = thisHWBB.QBBRadSource; + thisHWBB.LastSysTimeElapsed = state.dataHVACGlobal->SysTimeElapsed; + thisHWBB.LastTimeStepSys = state.dataHVACGlobal->TimeStepSys; - WaterInletNode = HWBaseboard(BaseboardNum).WaterInletNode; - WaterOutletNode = HWBaseboard(BaseboardNum).WaterOutletNode; + WaterInletNode = thisHWBB.WaterInletNode; + WaterOutletNode = thisHWBB.WaterOutletNode; // Set the outlet air nodes of the Baseboard // Set the outlet water nodes for the Coil SafeCopyPlantNode(state, WaterInletNode, WaterOutletNode); - state.dataLoopNodes->Node(WaterOutletNode).Temp = HWBaseboard(BaseboardNum).WaterOutletTemp; - state.dataLoopNodes->Node(WaterOutletNode).Enthalpy = HWBaseboard(BaseboardNum).WaterOutletEnthalpy; + state.dataLoopNodes->Node(WaterOutletNode).Temp = thisHWBB.WaterOutletTemp; + state.dataLoopNodes->Node(WaterOutletNode).Enthalpy = thisHWBB.WaterOutletEnthalpy; } void UpdateBBRadSourceValAvg(EnergyPlusData &state, bool &HWBaseboardSysOn) // .TRUE. if the radiant system has run this zone time step @@ -1644,42 +1631,18 @@ namespace HWBaseboardRadiator { // see if the system was even on. If any average term is non-zero, then // one or more of the radiant systems was running. - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int BaseboardNum; // DO loop counter for surface index - HWBaseboardSysOn = false; + auto &HWBaseboard = state.dataHWBaseboardRad->HWBaseboard; - // If this was never allocated, then there are no radiant systems in this input file (just RETURN) - if (!allocated(state.dataHWBaseboardRad->QBBRadSrcAvg)) return; + // If there are no baseboards in this input file, just RETURN + if (state.dataHWBaseboardRad->NumHWBaseboards == 0) return; - // If it was allocated, then we have to check to see if this was running at all... - for (BaseboardNum = 1; BaseboardNum <= state.dataHWBaseboardRad->NumHWBaseboards; ++BaseboardNum) { - if (state.dataHWBaseboardRad->QBBRadSrcAvg(BaseboardNum) != 0.0) { - HWBaseboardSysOn = true; - break; // DO loop - } + // If there are baseboards, then we have to check to see if this was running at all... + for (int BaseboardNum = 1; BaseboardNum <= state.dataHWBaseboardRad->NumHWBaseboards; ++BaseboardNum) { + HWBaseboard(BaseboardNum).QBBRadSource = HWBaseboard(BaseboardNum).QBBRadSrcAvg; + if (HWBaseboard(BaseboardNum).QBBRadSrcAvg != 0.0) HWBaseboardSysOn = true; } - state.dataHWBaseboardRad->QBBRadSource = state.dataHWBaseboardRad->QBBRadSrcAvg; - DistributeBBRadGains(state); // QBBRadSource has been modified so we need to redistribute gains } @@ -1717,28 +1680,23 @@ namespace HWBaseboardRadiator { int ZoneNum; // Pointer to the Zone derived type Real64 ThisSurfIntensity; // temporary for W/m2 term for rad on a surface - int NumHWBaseboards = state.dataHWBaseboardRad->NumHWBaseboards; - auto &HWBaseboard = state.dataHWBaseboardRad->HWBaseboard; - auto &HWBaseboardDesignObject = state.dataHWBaseboardRad->HWBaseboardDesignObject; - auto &QBBRadSource = state.dataHWBaseboardRad->QBBRadSource; - // Initialize arrays state.dataHeatBalFanSys->SurfQHWBaseboard = 0.0; state.dataHeatBalFanSys->ZoneQHWBaseboardToPerson = 0.0; - for (BaseboardNum = 1; BaseboardNum <= NumHWBaseboards; ++BaseboardNum) { + for (BaseboardNum = 1; BaseboardNum <= state.dataHWBaseboardRad->NumHWBaseboards; ++BaseboardNum) { + auto &thisHWBB = state.dataHWBaseboardRad->HWBaseboard(BaseboardNum); HWBaseboardDesignData HWBaseboardDesignDataObject{ - HWBaseboardDesignObject(HWBaseboard(BaseboardNum).DesignObjectPtr)}; // Contains the data for the design object - ZoneNum = HWBaseboard(BaseboardNum).ZonePtr; + state.dataHWBaseboardRad->HWBaseboardDesignObject(thisHWBB.DesignObjectPtr)}; // Contains the data for the design object + ZoneNum = thisHWBB.ZonePtr; if (ZoneNum <= 0) continue; - state.dataHeatBalFanSys->ZoneQHWBaseboardToPerson(ZoneNum) += QBBRadSource(BaseboardNum) * HWBaseboardDesignDataObject.FracDistribPerson; + state.dataHeatBalFanSys->ZoneQHWBaseboardToPerson(ZoneNum) += thisHWBB.QBBRadSource * HWBaseboardDesignDataObject.FracDistribPerson; - for (RadSurfNum = 1; RadSurfNum <= HWBaseboard(BaseboardNum).TotSurfToDistrib; ++RadSurfNum) { - SurfNum = HWBaseboard(BaseboardNum).SurfacePtr(RadSurfNum); + for (RadSurfNum = 1; RadSurfNum <= thisHWBB.TotSurfToDistrib; ++RadSurfNum) { + SurfNum = thisHWBB.SurfacePtr(RadSurfNum); if (state.dataSurface->Surface(SurfNum).Area > SmallestArea) { - ThisSurfIntensity = (QBBRadSource(BaseboardNum) * HWBaseboard(BaseboardNum).FracDistribToSurf(RadSurfNum) / - state.dataSurface->Surface(SurfNum).Area); + ThisSurfIntensity = (thisHWBB.QBBRadSource * thisHWBB.FracDistribToSurf(RadSurfNum) / state.dataSurface->Surface(SurfNum).Area); state.dataHeatBalFanSys->SurfQHWBaseboard(SurfNum) += ThisSurfIntensity; state.dataHeatBalSurf->AnyRadiantSystems = true; // CR 8074, trap for excessive intensity (throws off surface balance ) @@ -1746,7 +1704,7 @@ namespace HWBaseboardRadiator { ShowSevereError(state, "DistributeBBRadGains: excessive thermal radiation heat flux intensity detected"); ShowContinueError(state, format("Surface = {}", state.dataSurface->Surface(SurfNum).Name)); ShowContinueError(state, format("Surface area = {:.3R} [m2]", state.dataSurface->Surface(SurfNum).Area)); - ShowContinueError(state, format("Occurs in {} = {}", cCMO_BBRadiator_Water, HWBaseboard(BaseboardNum).EquipID)); + ShowContinueError(state, format("Occurs in {} = {}", cCMO_BBRadiator_Water, thisHWBB.EquipID)); ShowContinueError(state, format("Radiation intensity = {:.2R} [W/m2]", ThisSurfIntensity)); ShowContinueError(state, format("Assign a larger surface area or more surfaces in {}", cCMO_BBRadiator_Water)); ShowFatalError(state, "DistributeBBRadGains: excessive thermal radiation heat flux intensity detected"); @@ -1755,7 +1713,7 @@ namespace HWBaseboardRadiator { ShowSevereError(state, "DistributeBBRadGains: surface not large enough to receive thermal radiation heat flux"); ShowContinueError(state, format("Surface = {}", state.dataSurface->Surface(SurfNum).Name)); ShowContinueError(state, format("Surface area = {:.3R} [m2]", state.dataSurface->Surface(SurfNum).Area)); - ShowContinueError(state, format("Occurs in {} = {}", cCMO_BBRadiator_Water, HWBaseboard(BaseboardNum).EquipID)); + ShowContinueError(state, format("Occurs in {} = {}", cCMO_BBRadiator_Water, thisHWBB.EquipID)); ShowContinueError(state, format("Assign a larger surface area or more surfaces in {}", cCMO_BBRadiator_Water)); ShowFatalError(state, "DistributeBBRadGains: surface not large enough to receive thermal radiation heat flux"); } @@ -1771,12 +1729,12 @@ namespace HWBaseboardRadiator { // DATE WRITTEN Aug 2007 // MODIFIED na // RE-ENGINEERED na - auto &HWBaseboard = state.dataHWBaseboardRad->HWBaseboard; + auto &thisHWBB = state.dataHWBaseboardRad->HWBaseboard(BaseboardNum); - HWBaseboard(BaseboardNum).TotEnergy = HWBaseboard(BaseboardNum).TotPower * state.dataHVACGlobal->TimeStepSysSec; - HWBaseboard(BaseboardNum).Energy = HWBaseboard(BaseboardNum).Power * state.dataHVACGlobal->TimeStepSysSec; - HWBaseboard(BaseboardNum).ConvEnergy = HWBaseboard(BaseboardNum).ConvPower * state.dataHVACGlobal->TimeStepSysSec; - HWBaseboard(BaseboardNum).RadEnergy = HWBaseboard(BaseboardNum).RadPower * state.dataHVACGlobal->TimeStepSysSec; + thisHWBB.TotEnergy = thisHWBB.TotPower * state.dataHVACGlobal->TimeStepSysSec; + thisHWBB.Energy = thisHWBB.Power * state.dataHVACGlobal->TimeStepSysSec; + thisHWBB.ConvEnergy = thisHWBB.ConvPower * state.dataHVACGlobal->TimeStepSysSec; + thisHWBB.RadEnergy = thisHWBB.RadPower * state.dataHVACGlobal->TimeStepSysSec; } void UpdateHWBaseboardPlantConnection(EnergyPlusData &state, diff --git a/src/EnergyPlus/HWBaseboardRadiator.hh b/src/EnergyPlus/HWBaseboardRadiator.hh index fe9cb9a05a5..a50fb56859b 100644 --- a/src/EnergyPlus/HWBaseboardRadiator.hh +++ b/src/EnergyPlus/HWBaseboardRadiator.hh @@ -118,9 +118,16 @@ namespace HWBaseboardRadiator { int BBLoadReSimIndex; int BBMassFlowReSimIndex; int BBInletTempFlowReSimIndex; - int HeatingCapMethod; // - Method for heating capacity scaled sizing calculation (HeatingDesignCapacity, CapacityPerFloorArea, - // FracOfAutosizedHeatingCapacity) - Real64 ScaledHeatingCapacity; // - scaled maximum heating capacity {W} or scalable variable of zone HVAC equipment, {-}, or {W/m2} + int HeatingCapMethod; // - Method for heating capacity scaled sizing calculation (HeatingDesignCapacity, CapacityPerFloorArea, + // FracOfAutosizedHeatingCapacity) + Real64 ScaledHeatingCapacity; // - scaled maximum heating capacity {W} or scalable variable of zone HVAC equipment, {-}, or {W/m2} + Real64 ZeroBBSourceSumHATsurf; // used in baseboard energy balance + // Record keeping variables used to calculate QBBRadSrcAvg locally + Real64 QBBRadSource; // Need to keep the last value in case we are still iterating + Real64 QBBRadSrcAvg; // Need to keep the last value in case we are still iterating + Real64 LastSysTimeElapsed; // Need to keep the last value in case we are still iterating + Real64 LastTimeStepSys; // Need to keep the last value in case we are still iterating + Real64 LastQBBRadSrc; // Need to keep the last value in case we are still iterating // Default Constructor HWBaseboardParams() @@ -131,7 +138,8 @@ namespace HWBaseboardRadiator { WaterOutletEnthalpy(0.0), AirInletTempStd(0.0), AirInletTemp(0.0), AirOutletTemp(0.0), AirInletHumRat(0.0), AirOutletTempStd(0.0), FracConvect(0.0), TotPower(0.0), Power(0.0), ConvPower(0.0), RadPower(0.0), TotEnergy(0.0), Energy(0.0), ConvEnergy(0.0), RadEnergy(0.0), plantLoc{}, BBLoadReSimIndex(0), BBMassFlowReSimIndex(0), BBInletTempFlowReSimIndex(0), HeatingCapMethod(0), - ScaledHeatingCapacity(0.0) + ScaledHeatingCapacity(0.0), ZeroBBSourceSumHATsurf(0.0), QBBRadSource(0.0), QBBRadSrcAvg(0.0), LastSysTimeElapsed(0.0), + LastTimeStepSys(0.0), LastQBBRadSrc(0.0) { } }; @@ -216,13 +224,6 @@ namespace HWBaseboardRadiator { struct HWBaseboardRadiatorData : BaseGlobalStruct { - Array1D QBBRadSource; // Need to keep the last value in case we are still iterating - Array1D QBBRadSrcAvg; // Need to keep the last value in case we are still iterating - Array1D ZeroSourceSumHATsurf; // Equal to the SumHATsurf for all the walls in a zone with no source - // Record keeping variables used to calculate QBBRadSrcAvg locally - Array1D LastQBBRadSrc; // Need to keep the last value in case we are still iterating - Array1D LastSysTimeElapsed; // Need to keep the last value in case we are still iterating - Array1D LastTimeStepSys; // Need to keep the last value in case we are still iterating Array1D_bool MySizeFlag; Array1D_bool CheckEquipName; Array1D_bool SetLoopIndexFlag; // get loop number flag @@ -242,12 +243,6 @@ struct HWBaseboardRadiatorData : BaseGlobalStruct void clear_state() override { - this->QBBRadSource.clear(); - this->QBBRadSrcAvg.clear(); - this->ZeroSourceSumHATsurf.clear(); - this->LastQBBRadSrc.clear(); - this->LastSysTimeElapsed.clear(); - this->LastTimeStepSys.clear(); this->MySizeFlag.clear(); this->CheckEquipName.clear(); this->SetLoopIndexFlag.clear(); diff --git a/src/EnergyPlus/HighTempRadiantSystem.cc b/src/EnergyPlus/HighTempRadiantSystem.cc index be979f354c9..1a0ae2d47ea 100644 --- a/src/EnergyPlus/HighTempRadiantSystem.cc +++ b/src/EnergyPlus/HighTempRadiantSystem.cc @@ -735,12 +735,6 @@ namespace HighTempRadiantSystem { int Loop; if (state.dataHighTempRadSys->firstTime) { - state.dataHighTempRadSys->ZeroSourceSumHATsurf.dimension(state.dataGlobal->NumOfZones, 0.0); - state.dataHighTempRadSys->QHTRadSource.dimension(state.dataHighTempRadSys->NumOfHighTempRadSys, 0.0); - state.dataHighTempRadSys->QHTRadSrcAvg.dimension(state.dataHighTempRadSys->NumOfHighTempRadSys, 0.0); - state.dataHighTempRadSys->LastQHTRadSrc.dimension(state.dataHighTempRadSys->NumOfHighTempRadSys, 0.0); - state.dataHighTempRadSys->LastSysTimeElapsed.dimension(state.dataHighTempRadSys->NumOfHighTempRadSys, 0.0); - state.dataHighTempRadSys->LastTimeStepSys.dimension(state.dataHighTempRadSys->NumOfHighTempRadSys, 0.0); state.dataHighTempRadSys->MySizeFlag.dimension(state.dataHighTempRadSys->NumOfHighTempRadSys, true); state.dataHighTempRadSys->firstTime = false; } @@ -764,29 +758,27 @@ namespace HighTempRadiantSystem { } if (state.dataGlobal->BeginEnvrnFlag && state.dataHighTempRadSys->MyEnvrnFlag) { - state.dataHighTempRadSys->ZeroSourceSumHATsurf = 0.0; - state.dataHighTempRadSys->QHTRadSource = 0.0; - state.dataHighTempRadSys->QHTRadSrcAvg = 0.0; - state.dataHighTempRadSys->LastQHTRadSrc = 0.0; - state.dataHighTempRadSys->LastSysTimeElapsed = 0.0; - state.dataHighTempRadSys->LastTimeStepSys = 0.0; state.dataHighTempRadSys->MyEnvrnFlag = false; } if (!state.dataGlobal->BeginEnvrnFlag) { + for (int HTRnum = 1; state.dataHighTempRadSys->NumOfHighTempRadSys; ++HTRnum) { + state.dataHighTempRadSys->HighTempRadSys(HTRnum).LastQHTRRadSrc = 0.0; + } state.dataHighTempRadSys->MyEnvrnFlag = true; } if (state.dataGlobal->BeginTimeStepFlag && FirstHVACIteration) { // This is the first pass through in a particular time step - ZoneNum = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ZonePtr; - state.dataHighTempRadSys->ZeroSourceSumHATsurf(ZoneNum) = - state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state); // Set this to figure out what part of the load the radiant system meets - state.dataHighTempRadSys->QHTRadSrcAvg(RadSysNum) = 0.0; // Initialize this variable to zero (radiant system defaults to off) - state.dataHighTempRadSys->LastQHTRadSrc(RadSysNum) = - 0.0; // At the beginning of a time step, reset to zero so average calculation can start again - state.dataHighTempRadSys->LastSysTimeElapsed(RadSysNum) = - 0.0; // At the beginning of a time step, reset to zero so average calculation can start again - state.dataHighTempRadSys->LastTimeStepSys(RadSysNum) = - 0.0; // At the beginning of a time step, reset to zero so average calculation can start again + for (int HTRnum = 1; state.dataHighTempRadSys->NumOfHighTempRadSys; ++HTRnum) { + auto &thisHTR = state.dataHighTempRadSys->HighTempRadSys(HTRnum); + ZoneNum = thisHTR.ZonePtr; + thisHTR.ZeroHTRSourceSumHATsurf = + state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state); // Set this to figure out what part of the load the radiant system meets + thisHTR.QHTRRadSource = 0.0; // Initialize this variable to zero (radiant system defaults to off) + thisHTR.QHTRRadSrcAvg = 0.0; // Initialize this variable to zero (radiant system defaults to off) + thisHTR.LastQHTRRadSrc = 0.0; // At the beginning of a time step, reset to zero so average calculation can start again + thisHTR.LastSysTimeElapsed = 0.0; // At the beginning of a time step, reset to zero so average calculation can start again + thisHTR.LastTimeStepSys = 0.0; // At the beginning of a time step, reset to zero so average calculation can start again + } } } @@ -958,7 +950,7 @@ namespace HighTempRadiantSystem { // Unit is off or has no load upon it; set the flow rates to zero and then // simulate the components with the no flow conditions - state.dataHighTempRadSys->QHTRadSource(RadSysNum) = 0.0; + state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSource = 0.0; } else { // Unit might be on-->this section is intended to control the output of the // high temperature radiant heater (temperature controlled) @@ -989,7 +981,8 @@ namespace HighTempRadiantSystem { if (HeatFrac > 1.0) HeatFrac = 1.0; // Set the heat source for the high temperature electric radiant system - state.dataHighTempRadSys->QHTRadSource(RadSysNum) = HeatFrac * state.dataHighTempRadSys->HighTempRadSys(RadSysNum).MaxPowerCapac; + state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSource = + HeatFrac * state.dataHighTempRadSys->HighTempRadSys(RadSysNum).MaxPowerCapac; } } @@ -1058,7 +1051,7 @@ namespace HighTempRadiantSystem { // initialize local variables ZoneNum = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ZonePtr; - state.dataHighTempRadSys->QHTRadSource(RadSysNum) = 0.0; + state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSource = 0.0; if (GetCurrentScheduleValue(state, state.dataHighTempRadSys->HighTempRadSys(RadSysNum).SchedPtr) > 0) { @@ -1111,7 +1104,8 @@ namespace HighTempRadiantSystem { } // Set the heat source for the high temperature radiant system - state.dataHighTempRadSys->QHTRadSource(RadSysNum) = HeatFrac * state.dataHighTempRadSys->HighTempRadSys(RadSysNum).MaxPowerCapac; + state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSource = + HeatFrac * state.dataHighTempRadSys->HighTempRadSys(RadSysNum).MaxPowerCapac; // Now, distribute the radiant energy of all systems to the appropriate // surfaces, to people, and the air; determine the latent portion @@ -1199,25 +1193,23 @@ namespace HighTempRadiantSystem { int ZoneNum; // Zone index number for the current radiant system Real64 SysTimeElapsed = state.dataHVACGlobal->SysTimeElapsed; Real64 TimeStepSys = state.dataHVACGlobal->TimeStepSys; + auto &thisHTR = state.dataHighTempRadSys->HighTempRadSys(RadSysNum); // First, update the running average if necessary... - if (state.dataHighTempRadSys->LastSysTimeElapsed(RadSysNum) == SysTimeElapsed) { + if (thisHTR.LastSysTimeElapsed == SysTimeElapsed) { // Still iterating or reducing system time step, so subtract old values which were // not valid - state.dataHighTempRadSys->QHTRadSrcAvg(RadSysNum) -= state.dataHighTempRadSys->LastQHTRadSrc(RadSysNum) * - state.dataHighTempRadSys->LastTimeStepSys(RadSysNum) / - state.dataGlobal->TimeStepZone; + thisHTR.QHTRRadSrcAvg -= thisHTR.LastQHTRRadSrc * thisHTR.LastTimeStepSys / state.dataGlobal->TimeStepZone; } // Update the running average and the "last" values with the current values of the appropriate variables - state.dataHighTempRadSys->QHTRadSrcAvg(RadSysNum) += - state.dataHighTempRadSys->QHTRadSource(RadSysNum) * TimeStepSys / state.dataGlobal->TimeStepZone; + thisHTR.QHTRRadSrcAvg += thisHTR.QHTRRadSource * TimeStepSys / state.dataGlobal->TimeStepZone; - state.dataHighTempRadSys->LastQHTRadSrc(RadSysNum) = state.dataHighTempRadSys->QHTRadSource(RadSysNum); - state.dataHighTempRadSys->LastSysTimeElapsed(RadSysNum) = SysTimeElapsed; - state.dataHighTempRadSys->LastTimeStepSys(RadSysNum) = TimeStepSys; + thisHTR.LastQHTRRadSrc = thisHTR.QHTRRadSource; + thisHTR.LastSysTimeElapsed = SysTimeElapsed; + thisHTR.LastTimeStepSys = TimeStepSys; - switch (state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ControlType) { + switch (thisHTR.ControlType) { case RadControlType::MATControl: case RadControlType::MRTControl: case RadControlType::OperativeControl: { @@ -1227,7 +1219,7 @@ namespace HighTempRadiantSystem { DistributeHTRadGains(state); // Now "simulate" the system by recalculating the heat balances - ZoneNum = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ZonePtr; + ZoneNum = thisHTR.ZonePtr; HeatBalanceSurfaceManager::CalcHeatBalanceOutsideSurf(state, ZoneNum); HeatBalanceSurfaceManager::CalcHeatBalanceInsideSurf(state, ZoneNum); } break; @@ -1235,11 +1227,11 @@ namespace HighTempRadiantSystem { break; } - if (state.dataHighTempRadSys->QHTRadSource(RadSysNum) <= 0.0) { + if (thisHTR.QHTRRadSource <= 0.0) { LoadMet = 0.0; // System wasn't running so it can't meet a load } else { - ZoneNum = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ZonePtr; - LoadMet = (state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state) - state.dataHighTempRadSys->ZeroSourceSumHATsurf(ZoneNum)) + + ZoneNum = thisHTR.ZonePtr; + LoadMet = (state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state) - thisHTR.ZeroHTRSourceSumHATsurf) + state.dataHeatBalFanSys->SumConvHTRadSys(ZoneNum); } } @@ -1290,19 +1282,20 @@ namespace HighTempRadiantSystem { HighTempRadSysOn = false; // If this was never allocated, then there are no radiant systems in this input file (just RETURN) - if (!allocated(state.dataHighTempRadSys->QHTRadSrcAvg)) return; + if (state.dataHighTempRadSys->NumOfHighTempRadSys == 0) return; // If it was allocated, then we have to check to see if this was running at all... for (RadSysNum = 1; RadSysNum <= state.dataHighTempRadSys->NumOfHighTempRadSys; ++RadSysNum) { - if (state.dataHighTempRadSys->QHTRadSrcAvg(RadSysNum) != 0.0) { + if (state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSrcAvg != 0.0) { HighTempRadSysOn = true; break; // DO loop } } - state.dataHighTempRadSys->QHTRadSource = state.dataHighTempRadSys->QHTRadSrcAvg; + state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSource = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSrcAvg; - DistributeHTRadGains(state); // state.dataHighTempRadSys->QHTRadSource has been modified so we need to redistribute gains + DistributeHTRadGains( + state); // state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSource has been modified so we need to redistribute gains } void DistributeHTRadGains(EnergyPlusData &state) @@ -1350,23 +1343,23 @@ namespace HighTempRadiantSystem { ZoneNum = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ZonePtr; - state.dataHeatBalFanSys->ZoneQHTRadSysToPerson(ZoneNum) = state.dataHighTempRadSys->QHTRadSource(RadSysNum) * + state.dataHeatBalFanSys->ZoneQHTRadSysToPerson(ZoneNum) = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSource * state.dataHighTempRadSys->HighTempRadSys(RadSysNum).FracRadiant * state.dataHighTempRadSys->HighTempRadSys(RadSysNum).FracDistribPerson; state.dataHeatBalFanSys->SumConvHTRadSys(ZoneNum) += - state.dataHighTempRadSys->QHTRadSource(RadSysNum) * state.dataHighTempRadSys->HighTempRadSys(RadSysNum).FracConvect; + state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSource * state.dataHighTempRadSys->HighTempRadSys(RadSysNum).FracConvect; state.dataHeatBalFanSys->SumLatentHTRadSys(ZoneNum) += - state.dataHighTempRadSys->QHTRadSource(RadSysNum) * state.dataHighTempRadSys->HighTempRadSys(RadSysNum).FracLatent; + state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSource * state.dataHighTempRadSys->HighTempRadSys(RadSysNum).FracLatent; for (RadSurfNum = 1; RadSurfNum <= state.dataHighTempRadSys->HighTempRadSys(RadSysNum).TotSurfToDistrib; ++RadSurfNum) { SurfNum = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).SurfacePtr(RadSurfNum); if (state.dataSurface->Surface(SurfNum).Area > SmallestArea) { - ThisSurfIntensity = - (state.dataHighTempRadSys->QHTRadSource(RadSysNum) * state.dataHighTempRadSys->HighTempRadSys(RadSysNum).FracRadiant * - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).FracDistribToSurf(RadSurfNum) / - state.dataSurface->Surface(SurfNum).Area); + ThisSurfIntensity = (state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSource * + state.dataHighTempRadSys->HighTempRadSys(RadSysNum).FracRadiant * + state.dataHighTempRadSys->HighTempRadSys(RadSysNum).FracDistribToSurf(RadSurfNum) / + state.dataSurface->Surface(SurfNum).Area); state.dataHeatBalFanSys->SurfQHTRadSys(SurfNum) += ThisSurfIntensity; state.dataHeatBalSurf->AnyRadiantSystems = true; @@ -1422,8 +1415,8 @@ namespace HighTempRadiantSystem { Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; if (state.dataHighTempRadSys->HighTempRadSys(RadSysNum).HeaterType == RadHeaterType::Gas) { - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).GasPower = - state.dataHighTempRadSys->QHTRadSource(RadSysNum) / state.dataHighTempRadSys->HighTempRadSys(RadSysNum).CombustionEffic; + state.dataHighTempRadSys->HighTempRadSys(RadSysNum).GasPower = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSource / + state.dataHighTempRadSys->HighTempRadSys(RadSysNum).CombustionEffic; state.dataHighTempRadSys->HighTempRadSys(RadSysNum).GasEnergy = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).GasPower * TimeStepSysSec; state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ElecPower = 0.0; @@ -1431,13 +1424,13 @@ namespace HighTempRadiantSystem { } else if (state.dataHighTempRadSys->HighTempRadSys(RadSysNum).HeaterType == RadHeaterType::Electric) { state.dataHighTempRadSys->HighTempRadSys(RadSysNum).GasPower = 0.0; state.dataHighTempRadSys->HighTempRadSys(RadSysNum).GasEnergy = 0.0; - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ElecPower = state.dataHighTempRadSys->QHTRadSource(RadSysNum); + state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ElecPower = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSource; state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ElecEnergy = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ElecPower * TimeStepSysSec; } else { ShowWarningError(state, "Someone forgot to add a high temperature radiant heater type to the reporting subroutine"); } - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).HeatPower = state.dataHighTempRadSys->QHTRadSource(RadSysNum); + state.dataHighTempRadSys->HighTempRadSys(RadSysNum).HeatPower = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSource; state.dataHighTempRadSys->HighTempRadSys(RadSysNum).HeatEnergy = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).HeatPower * TimeStepSysSec; } diff --git a/src/EnergyPlus/HighTempRadiantSystem.hh b/src/EnergyPlus/HighTempRadiantSystem.hh index 3523ff6600a..302056d482e 100644 --- a/src/EnergyPlus/HighTempRadiantSystem.hh +++ b/src/EnergyPlus/HighTempRadiantSystem.hh @@ -123,6 +123,13 @@ namespace HighTempRadiantSystem { Array1D_int SurfacePtr; // Surface number in the list of surfaces heater sends radiation to Array1D FracDistribToSurf; // Fraction of fraction radiant incident on the surface // Other parameters + Real64 ZeroHTRSourceSumHATsurf; // used in baseboard energy balance + Real64 QHTRRadSource; // Need to keep the last value in case we are still iterating + Real64 QHTRRadSrcAvg; // Need to keep the last value in case we are still iterating + Real64 LastSysTimeElapsed; // Need to keep the last value in case we are still iterating + Real64 LastTimeStepSys; // Need to keep the last value in case we are still iterating + Real64 LastQHTRRadSrc; // Need to keep the last value in case we are still iterating + // Report data Real64 ElecPower; // system electric consumption in Watts Real64 ElecEnergy; // system electric consumption in Joules @@ -140,7 +147,8 @@ namespace HighTempRadiantSystem { : SchedPtr(0), ZonePtr(0), HeaterType(RadHeaterType::Invalid), MaxPowerCapac(0.0), CombustionEffic(0.0), FracRadiant(0.0), FracLatent(0.0), FracLost(0.0), FracConvect(0.0), ControlType(RadControlType::Invalid), ThrottlRange(0.0), SetptSchedPtr(0), FracDistribPerson(0.0), TotSurfToDistrib(0), ElecPower(0.0), ElecEnergy(0.0), GasPower(0.0), GasEnergy(0.0), HeatPower(0.0), - HeatEnergy(0.0), HeatingCapMethod(0), ScaledHeatingCapacity(0.0) + HeatEnergy(0.0), HeatingCapMethod(0), ZeroHTRSourceSumHATsurf(0.0), QHTRRadSource(0.0), QHTRRadSrcAvg(0.0), LastSysTimeElapsed(0.0), + LastTimeStepSys(0.0), LastQHTRRadSrc(0.0), ScaledHeatingCapacity(0.0) { } }; @@ -198,14 +206,7 @@ struct HighTempRadiantSystemData : BaseGlobalStruct { // Standard, run-of-the-mill variables... - int NumOfHighTempRadSys = 0; // Number of hydronic low tempererature radiant systems - Array1D QHTRadSource; // Need to keep the last value in case we are still iterating - Array1D QHTRadSrcAvg; // Need to keep the last value in case we are still iterating - Array1D ZeroSourceSumHATsurf; // Equal to the SumHATsurf for all the walls in a zone with no source - // Record keeping variables used to calculate QHTRadSrcAvg locally - Array1D LastQHTRadSrc; // Need to keep the last value in case we are still iterating - Array1D LastSysTimeElapsed; // Need to keep the last value in case we are still iterating - Array1D LastTimeStepSys; // Need to keep the last value in case we are still iterating + int NumOfHighTempRadSys = 0; // Number of hydronic low tempererature radiant systems Array1D_bool MySizeFlag; Array1D_bool CheckEquipName; @@ -221,12 +222,6 @@ struct HighTempRadiantSystemData : BaseGlobalStruct void clear_state() override { NumOfHighTempRadSys = 0; - QHTRadSource.clear(); - QHTRadSrcAvg.clear(); - ZeroSourceSumHATsurf.clear(); - LastQHTRadSrc.clear(); - LastSysTimeElapsed.clear(); - LastTimeStepSys.clear(); MySizeFlag.clear(); CheckEquipName.clear(); diff --git a/src/EnergyPlus/LowTempRadiantSystem.cc b/src/EnergyPlus/LowTempRadiantSystem.cc index f138ed7c0ae..49123698a17 100644 --- a/src/EnergyPlus/LowTempRadiantSystem.cc +++ b/src/EnergyPlus/LowTempRadiantSystem.cc @@ -1972,7 +1972,6 @@ namespace LowTempRadiantSystem { if (state.dataLowTempRadSys->FirstTimeInit) { - state.dataLowTempRadSys->ZeroSourceSumHATsurf.dimension(state.dataGlobal->NumOfZones, 0.0); state.dataLowTempRadSys->QRadSysSrcAvg.dimension(state.dataSurface->TotSurfaces, 0.0); state.dataLowTempRadSys->LastQRadSysSrc.dimension(state.dataSurface->TotSurfaces, 0.0); state.dataLowTempRadSys->LastSysTimeElapsed.dimension(state.dataSurface->TotSurfaces, 0.0); @@ -1984,8 +1983,9 @@ namespace LowTempRadiantSystem { state.dataLowTempRadSys->MySizeFlagCFlo = true; state.dataLowTempRadSys->MySizeFlagElec = true; - // Initialize total areas for all radiant systems + // Initialize total areas and ZeroLTRSource for all radiant systems for (RadNum = 1; RadNum <= state.dataLowTempRadSys->NumOfHydrLowTempRadSys; ++RadNum) { + state.dataLowTempRadSys->HydrRadSys(RadNum).ZeroLTRSourceSumHATsurf = 0.0; state.dataLowTempRadSys->HydrRadSys(RadNum).TotalSurfaceArea = 0.0; for (SurfNum = 1; SurfNum <= state.dataLowTempRadSys->HydrRadSys(RadNum).NumOfSurfaces; ++SurfNum) { state.dataLowTempRadSys->HydrRadSys(RadNum).TotalSurfaceArea += @@ -1993,6 +1993,7 @@ namespace LowTempRadiantSystem { } } for (RadNum = 1; RadNum <= state.dataLowTempRadSys->NumOfCFloLowTempRadSys; ++RadNum) { + state.dataLowTempRadSys->CFloRadSys(RadNum).ZeroLTRSourceSumHATsurf = 0.0; state.dataLowTempRadSys->CFloRadSys(RadNum).TotalSurfaceArea = 0.0; for (SurfNum = 1; SurfNum <= state.dataLowTempRadSys->CFloRadSys(RadNum).NumOfSurfaces; ++SurfNum) { state.dataLowTempRadSys->CFloRadSys(RadNum).TotalSurfaceArea += @@ -2000,6 +2001,7 @@ namespace LowTempRadiantSystem { } } for (RadNum = 1; RadNum <= state.dataLowTempRadSys->NumOfElecLowTempRadSys; ++RadNum) { + state.dataLowTempRadSys->ElecRadSys(RadNum).ZeroLTRSourceSumHATsurf = 0.0; state.dataLowTempRadSys->ElecRadSys(RadNum).TotalSurfaceArea = 0.0; for (SurfNum = 1; SurfNum <= state.dataLowTempRadSys->ElecRadSys(RadNum).NumOfSurfaces; ++SurfNum) { state.dataLowTempRadSys->ElecRadSys(RadNum).TotalSurfaceArea += @@ -2273,7 +2275,13 @@ namespace LowTempRadiantSystem { } if (state.dataGlobal->BeginEnvrnFlag && state.dataLowTempRadSys->MyEnvrnFlagGeneral) { - state.dataLowTempRadSys->ZeroSourceSumHATsurf = 0.0; + if (SystemType == LowTempRadiantSystem::SystemType::HydronicSystem) { + state.dataLowTempRadSys->HydrRadSys(RadSysNum).ZeroLTRSourceSumHATsurf = 0.0; + } else if (SystemType == LowTempRadiantSystem::SystemType::ConstantFlowSystem) { + state.dataLowTempRadSys->CFloRadSys(RadSysNum).ZeroLTRSourceSumHATsurf = 0.0; + } else if (SystemType == LowTempRadiantSystem::SystemType::ElectricSystem) { + state.dataLowTempRadSys->ElecRadSys(RadSysNum).ZeroLTRSourceSumHATsurf = 0.0; + } state.dataLowTempRadSys->QRadSysSrcAvg = 0.0; state.dataLowTempRadSys->LastQRadSysSrc = 0.0; state.dataLowTempRadSys->LastSysTimeElapsed = 0.0; @@ -2424,7 +2432,7 @@ namespace LowTempRadiantSystem { switch (SystemType) { case LowTempRadiantSystem::SystemType::HydronicSystem: { ZoneNum = state.dataLowTempRadSys->HydrRadSys(RadSysNum).ZonePtr; - state.dataLowTempRadSys->ZeroSourceSumHATsurf(ZoneNum) = + state.dataLowTempRadSys->HydrRadSys(RadSysNum).ZeroLTRSourceSumHATsurf = state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state); // Set this to figure what part of the load the radiant system meets for (RadSurfNum = 1; RadSurfNum <= state.dataLowTempRadSys->HydrRadSys(RadSysNum).NumOfSurfaces; ++RadSurfNum) { SurfNum = state.dataLowTempRadSys->HydrRadSys(RadSysNum).SurfacePtr(RadSurfNum); @@ -2439,7 +2447,7 @@ namespace LowTempRadiantSystem { } break; case LowTempRadiantSystem::SystemType::ConstantFlowSystem: { ZoneNum = state.dataLowTempRadSys->CFloRadSys(RadSysNum).ZonePtr; - state.dataLowTempRadSys->ZeroSourceSumHATsurf(ZoneNum) = + state.dataLowTempRadSys->CFloRadSys(RadSysNum).ZeroLTRSourceSumHATsurf = state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state); // Set this to figure what part of the load the radiant system meets for (RadSurfNum = 1; RadSurfNum <= state.dataLowTempRadSys->CFloRadSys(RadSysNum).NumOfSurfaces; ++RadSurfNum) { SurfNum = state.dataLowTempRadSys->CFloRadSys(RadSysNum).SurfacePtr(RadSurfNum); @@ -2454,7 +2462,7 @@ namespace LowTempRadiantSystem { } break; case LowTempRadiantSystem::SystemType::ElectricSystem: { ZoneNum = state.dataLowTempRadSys->ElecRadSys(RadSysNum).ZonePtr; - state.dataLowTempRadSys->ZeroSourceSumHATsurf(ZoneNum) = + state.dataLowTempRadSys->ElecRadSys(RadSysNum).ZeroLTRSourceSumHATsurf = state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state); // Set this to figure what part of the load the radiant system meets for (RadSurfNum = 1; RadSurfNum <= state.dataLowTempRadSys->ElecRadSys(RadSysNum).NumOfSurfaces; ++RadSurfNum) { SurfNum = state.dataLowTempRadSys->ElecRadSys(RadSysNum).SurfacePtr(RadSurfNum); @@ -4171,7 +4179,7 @@ namespace LowTempRadiantSystem { HeatBalanceSurfaceManager::CalcHeatBalanceOutsideSurf(state, ZoneNum); HeatBalanceSurfaceManager::CalcHeatBalanceInsideSurf(state, ZoneNum); - LoadMet = state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state) - state.dataLowTempRadSys->ZeroSourceSumHATsurf(ZoneNum); + LoadMet = state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state) - this->ZeroLTRSourceSumHATsurf; } void ConstantFlowRadiantSystemData::calculateLowTemperatureRadiantSystem(EnergyPlusData &state, @@ -5190,7 +5198,7 @@ namespace LowTempRadiantSystem { HeatBalanceSurfaceManager::CalcHeatBalanceOutsideSurf(state, ZoneNum); HeatBalanceSurfaceManager::CalcHeatBalanceInsideSurf(state, ZoneNum); - LoadMet = state.dataHeatBal->Zone(this->ZonePtr).sumHATsurf(state) - state.dataLowTempRadSys->ZeroSourceSumHATsurf(this->ZonePtr); + LoadMet = state.dataHeatBal->Zone(this->ZonePtr).sumHATsurf(state) - this->ZeroLTRSourceSumHATsurf; } // TODO Write unit tests for baseboard void ConstantFlowRadiantSystemData::calculateRunningMeanAverageTemperature(EnergyPlusData &state, int RadSysNum) @@ -5322,7 +5330,7 @@ namespace LowTempRadiantSystem { HeatBalanceSurfaceManager::CalcHeatBalanceOutsideSurf(state, ZoneNum); HeatBalanceSurfaceManager::CalcHeatBalanceInsideSurf(state, ZoneNum); - LoadMet = state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state) - state.dataLowTempRadSys->ZeroSourceSumHATsurf(ZoneNum); + LoadMet = state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state) - this->ZeroLTRSourceSumHATsurf; } else { // OFF or COOLING MODE (not allowed for an electric low temperature radiant system), turn it off diff --git a/src/EnergyPlus/LowTempRadiantSystem.hh b/src/EnergyPlus/LowTempRadiantSystem.hh index 398ef3992f2..cbadab4f327 100644 --- a/src/EnergyPlus/LowTempRadiantSystem.hh +++ b/src/EnergyPlus/LowTempRadiantSystem.hh @@ -139,17 +139,18 @@ namespace LowTempRadiantSystem { struct RadiantSystemBaseData { // Members - std::string Name; // name of hydronic radiant system - std::string SchedName; // availability schedule - int SchedPtr = 0; // index to schedule - std::string ZoneName; // Name of zone the system is serving - int ZonePtr = 0; // Point to this zone in the Zone derived type - std::string SurfListName; // Name of surface/surface list that is the radiant system - int NumOfSurfaces = 0; // Number of surfaces included in this radiant system (coordinated control) - Array1D_int SurfacePtr; // Pointer to the surface(s) in the Surface derived type - Array1D_string SurfaceName; // Name of surfaces that are the radiant system (can be one or more) - Array1D SurfaceFrac; // Fraction of flow/pipe length or electric power for a particular surface - Real64 TotalSurfaceArea = 0.0; // Total surface area for all surfaces that are part of this radiant system + std::string Name; // name of hydronic radiant system + std::string SchedName; // availability schedule + int SchedPtr = 0; // index to schedule + std::string ZoneName; // Name of zone the system is serving + int ZonePtr = 0; // Point to this zone in the Zone derived type + std::string SurfListName; // Name of surface/surface list that is the radiant system + int NumOfSurfaces = 0; // Number of surfaces included in this radiant system (coordinated control) + Array1D_int SurfacePtr; // Pointer to the surface(s) in the Surface derived type + Array1D_string SurfaceName; // Name of surfaces that are the radiant system (can be one or more) + Array1D SurfaceFrac; // Fraction of flow/pipe length or electric power for a particular surface + Real64 TotalSurfaceArea = 0.0; // Total surface area for all surfaces that are part of this radiant system + Real64 ZeroLTRSourceSumHATsurf = 0.0; // Equal to SumHATsurf for all the walls in a zone with no source LowTempRadiantControlTypes controlType = LowTempRadiantControlTypes::MATControl; // Control type for the system (MAT, MRT, Op temp, ODB, OWB, // Surface Face Temp, Surface Interior Temp, Running Mean // Temp for Constant Flow systems only) @@ -567,8 +568,7 @@ struct LowTempRadiantSystemData : BaseGlobalStruct Real64 LowTempHeating = -200.0; // Used to indicate that a user does not have a heating control temperature Real64 HighTempCooling = 200.0; // Used to indicate that a user does not have a cooling control temperature - Array1D QRadSysSrcAvg; // Average source over the time step for a particular radiant surface - Array1D ZeroSourceSumHATsurf; // Equal to SumHATsurf for all the walls in a zone with no source + Array1D QRadSysSrcAvg; // Average source over the time step for a particular radiant surface // Record keeping variables used to calculate QRadSysSrcAvg locally Array1D LastQRadSysSrc; // Need to keep the last value in case we are still iterating Array1D LastSysTimeElapsed; // Need to keep the last value in case we are still iterating @@ -630,7 +630,6 @@ struct LowTempRadiantSystemData : BaseGlobalStruct // QRadSysSrcAvg.clear(); - ZeroSourceSumHATsurf.clear(); LastQRadSysSrc.clear(); LastSysTimeElapsed.clear(); LastTimeStepSys.clear(); diff --git a/src/EnergyPlus/SteamBaseboardRadiator.cc b/src/EnergyPlus/SteamBaseboardRadiator.cc index 7f27498cab0..c8cc0cc2851 100644 --- a/src/EnergyPlus/SteamBaseboardRadiator.cc +++ b/src/EnergyPlus/SteamBaseboardRadiator.cc @@ -933,12 +933,6 @@ namespace SteamBaseboardRadiator { // initialize the environment and sizing flags state.dataSteamBaseboardRadiator->MyEnvrnFlag.dimension(state.dataSteamBaseboardRadiator->NumSteamBaseboards, true); state.dataSteamBaseboardRadiator->MySizeFlag.dimension(state.dataSteamBaseboardRadiator->NumSteamBaseboards, true); - state.dataSteamBaseboardRadiator->ZeroSourceSumHATsurf.dimension(state.dataGlobal->NumOfZones, 0.0); - state.dataSteamBaseboardRadiator->QBBSteamRadSource.dimension(state.dataSteamBaseboardRadiator->NumSteamBaseboards, 0.0); - state.dataSteamBaseboardRadiator->QBBSteamRadSrcAvg.dimension(state.dataSteamBaseboardRadiator->NumSteamBaseboards, 0.0); - state.dataSteamBaseboardRadiator->LastQBBSteamRadSrc.dimension(state.dataSteamBaseboardRadiator->NumSteamBaseboards, 0.0); - state.dataSteamBaseboardRadiator->LastSysTimeElapsed.dimension(state.dataSteamBaseboardRadiator->NumSteamBaseboards, 0.0); - state.dataSteamBaseboardRadiator->LastTimeStepSys.dimension(state.dataSteamBaseboardRadiator->NumSteamBaseboards, 0.0); state.dataSteamBaseboardRadiator->SetLoopIndexFlag.dimension(state.dataSteamBaseboardRadiator->NumSteamBaseboards, true); state.dataSteamBaseboardRadiator->MyOneTimeFlag = false; } @@ -1016,28 +1010,28 @@ namespace SteamBaseboardRadiator { state.dataLoopNodes->Node(SteamInletNode).Quality = 1.0; state.dataLoopNodes->Node(SteamInletNode).HumRat = 0.0; - // Initializes radiant sources - state.dataSteamBaseboardRadiator->ZeroSourceSumHATsurf = 0.0; - state.dataSteamBaseboardRadiator->QBBSteamRadSource = 0.0; - state.dataSteamBaseboardRadiator->QBBSteamRadSrcAvg = 0.0; - state.dataSteamBaseboardRadiator->LastQBBSteamRadSrc = 0.0; - state.dataSteamBaseboardRadiator->LastSysTimeElapsed = 0.0; - state.dataSteamBaseboardRadiator->LastTimeStepSys = 0.0; - state.dataSteamBaseboardRadiator->MyEnvrnFlag(BaseboardNum) = false; } if (!state.dataGlobal->BeginEnvrnFlag) { state.dataSteamBaseboardRadiator->MyEnvrnFlag(BaseboardNum) = true; + // Initializes radiant sources + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).ZeroBBSteamSourceSumHATsurf = 0.0; + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).QBBSteamRadSource = 0.0; + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).QBBSteamRadSrcAvg = 0.0; + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).LastQBBSteamRadSrc = 0.0; + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).LastSysTimeElapsed = 0.0; + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).LastTimeStepSys = 0.0; } if (state.dataGlobal->BeginTimeStepFlag && FirstHVACIteration) { int ZoneNum = state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).ZonePtr; - state.dataSteamBaseboardRadiator->ZeroSourceSumHATsurf(ZoneNum) = state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state); - state.dataSteamBaseboardRadiator->QBBSteamRadSrcAvg(BaseboardNum) = 0.0; - state.dataSteamBaseboardRadiator->LastQBBSteamRadSrc(BaseboardNum) = 0.0; - state.dataSteamBaseboardRadiator->LastSysTimeElapsed(BaseboardNum) = 0.0; - state.dataSteamBaseboardRadiator->LastTimeStepSys(BaseboardNum) = 0.0; + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).ZeroBBSteamSourceSumHATsurf = + state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state); + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).QBBSteamRadSrcAvg = 0.0; + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).LastQBBSteamRadSrc = 0.0; + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).LastSysTimeElapsed = 0.0; + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).LastTimeStepSys = 0.0; } // Do the every time step initializations @@ -1361,7 +1355,7 @@ namespace SteamBaseboardRadiator { SteamOutletTemp = SteamInletTemp - SubcoolDeltaT; // Outlet temperature of steam // Estimate radiant heat addition RadHeat = SteamBBHeat * SteamBaseboardDesignDataObject.FracRadiant; // Radiant heating rate - state.dataSteamBaseboardRadiator->QBBSteamRadSource(BaseboardNum) = + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).QBBSteamRadSource = RadHeat; // Radiant heat source which will be distributed to surfaces and people // Now, distribute the radiant energy of all systems to the appropriate surfaces, to people, and the air @@ -1380,7 +1374,8 @@ namespace SteamBaseboardRadiator { // should include this. // Actual system load that the unit should meet - LoadMet = (state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state) - state.dataSteamBaseboardRadiator->ZeroSourceSumHATsurf(ZoneNum)) + + LoadMet = (state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state) - + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).ZeroBBSteamSourceSumHATsurf) + (SteamBBHeat * state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).FracConvect) + (RadHeat * SteamBaseboardDesignDataObject.FracDistribPerson); state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).SteamOutletEnthalpy = @@ -1392,7 +1387,7 @@ namespace SteamBaseboardRadiator { LoadMet = 0.0; RadHeat = 0.0; SteamMassFlowRate = 0.0; - state.dataSteamBaseboardRadiator->QBBSteamRadSource(BaseboardNum) = 0.0; + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).QBBSteamRadSource = 0.0; state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).SteamOutletQuality = 0.0; state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).SteamOutletEnthalpy = state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).SteamInletEnthalpy; @@ -1432,18 +1427,20 @@ namespace SteamBaseboardRadiator { int SteamOutletNode; // First, update the running average if necessary... - if (state.dataSteamBaseboardRadiator->LastSysTimeElapsed(BaseboardNum) == state.dataHVACGlobal->SysTimeElapsed) { - state.dataSteamBaseboardRadiator->QBBSteamRadSrcAvg(BaseboardNum) -= state.dataSteamBaseboardRadiator->LastQBBSteamRadSrc(BaseboardNum) * - state.dataSteamBaseboardRadiator->LastTimeStepSys(BaseboardNum) / - state.dataGlobal->TimeStepZone; + if (state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).LastSysTimeElapsed == state.dataHVACGlobal->SysTimeElapsed) { + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).QBBSteamRadSrcAvg -= + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).LastQBBSteamRadSrc * + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).LastTimeStepSys / state.dataGlobal->TimeStepZone; } // Update the running average and the "last" values with the current values of the appropriate variables - state.dataSteamBaseboardRadiator->QBBSteamRadSrcAvg(BaseboardNum) += - state.dataSteamBaseboardRadiator->QBBSteamRadSource(BaseboardNum) * state.dataHVACGlobal->TimeStepSys / state.dataGlobal->TimeStepZone; + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).QBBSteamRadSrcAvg += + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).QBBSteamRadSource * state.dataHVACGlobal->TimeStepSys / + state.dataGlobal->TimeStepZone; - state.dataSteamBaseboardRadiator->LastQBBSteamRadSrc(BaseboardNum) = state.dataSteamBaseboardRadiator->QBBSteamRadSource(BaseboardNum); - state.dataSteamBaseboardRadiator->LastSysTimeElapsed(BaseboardNum) = state.dataHVACGlobal->SysTimeElapsed; - state.dataSteamBaseboardRadiator->LastTimeStepSys(BaseboardNum) = state.dataHVACGlobal->TimeStepSys; + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).LastQBBSteamRadSrc = + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).QBBSteamRadSource; + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).LastSysTimeElapsed = state.dataHVACGlobal->SysTimeElapsed; + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).LastTimeStepSys = state.dataHVACGlobal->TimeStepSys; SteamInletNode = state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).SteamInletNode; SteamOutletNode = state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).SteamOutletNode; @@ -1482,17 +1479,18 @@ namespace SteamBaseboardRadiator { SteamBaseboardSysOn = false; // If this was never allocated, then there are no radiant systems in this input file (just RETURN) - if (!allocated(state.dataSteamBaseboardRadiator->QBBSteamRadSrcAvg)) return; + if (state.dataSteamBaseboardRadiator->NumSteamBaseboards == 0) return; // If it was allocated, then we have to check to see if this was running at all... for (BaseboardNum = 1; BaseboardNum <= state.dataSteamBaseboardRadiator->NumSteamBaseboards; ++BaseboardNum) { - if (state.dataSteamBaseboardRadiator->QBBSteamRadSrcAvg(BaseboardNum) != 0.0) { + if (state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).QBBSteamRadSrcAvg != 0.0) { SteamBaseboardSysOn = true; break; // DO loop } } - state.dataSteamBaseboardRadiator->QBBSteamRadSource = state.dataSteamBaseboardRadiator->QBBSteamRadSrcAvg; + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).QBBSteamRadSource = + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).QBBSteamRadSrcAvg; DistributeBBSteamRadGains(state); // QBBRadSource has been modified so we need to redistribute gains } @@ -1538,12 +1536,12 @@ namespace SteamBaseboardRadiator { state.dataSteamBaseboardRadiator->SteamBaseboardDesign(state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum) .DesignObjectPtr)}; // Contains the data for variable flow hydronic systems state.dataHeatBalFanSys->ZoneQSteamBaseboardToPerson(ZoneNum) += - state.dataSteamBaseboardRadiator->QBBSteamRadSource(BaseboardNum) * SteamBaseboardDesignDataObject.FracDistribPerson; + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).QBBSteamRadSource * SteamBaseboardDesignDataObject.FracDistribPerson; for (RadSurfNum = 1; RadSurfNum <= state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).TotSurfToDistrib; ++RadSurfNum) { SurfNum = state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).SurfacePtr(RadSurfNum); if (state.dataSurface->Surface(SurfNum).Area > SmallestArea) { - ThisSurfIntensity = (state.dataSteamBaseboardRadiator->QBBSteamRadSource(BaseboardNum) * + ThisSurfIntensity = (state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).QBBSteamRadSource * state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).FracDistribToSurf(RadSurfNum) / state.dataSurface->Surface(SurfNum).Area); state.dataHeatBalFanSys->SurfQSteamBaseboard(SurfNum) += ThisSurfIntensity; diff --git a/src/EnergyPlus/SteamBaseboardRadiator.hh b/src/EnergyPlus/SteamBaseboardRadiator.hh index 9dd66e99e97..38efaa9603d 100644 --- a/src/EnergyPlus/SteamBaseboardRadiator.hh +++ b/src/EnergyPlus/SteamBaseboardRadiator.hh @@ -109,6 +109,16 @@ namespace SteamBaseboardRadiator { int BBLoadReSimIndex; int BBMassFlowReSimIndex; int BBInletTempFlowReSimIndex; + Real64 QBBSteamRadSource; // Need to keep the last value in case we are still iterating + Real64 QBBSteamRadSrcAvg; // Need to keep the last value in case we are still iterating + Real64 ZeroBBSteamSourceSumHATsurf; // Equal to the SumHATsurf for all the walls in a zone + // with no source + + // Record keeping variables used to calculate QBBRadSrcAvg locally + Real64 LastQBBSteamRadSrc; // Need to keep the last value in case we are still iterating + Real64 LastSysTimeElapsed; // Need to keep the last value in case we are still iterating + Real64 LastTimeStepSys; // Need to keep the last value in case we are still iterating + Real64 ScaledHeatingCapacity; // - steam baseboard Radiator system scaled maximum heating capacity {W} or scalable variable of zone HVAC // equipment, {-}, or {W/m2} @@ -120,7 +130,8 @@ namespace SteamBaseboardRadiator { SteamOutletEnthalpy(0.0), SteamInletPress(0.0), SteamOutletPress(0.0), SteamInletQuality(0.0), SteamOutletQuality(0.0), FracRadiant(0.0), FracConvect(0.0), FracDistribPerson(0.0), TotPower(0.0), Power(0.0), ConvPower(0.0), RadPower(0.0), TotEnergy(0.0), Energy(0.0), ConvEnergy(0.0), RadEnergy(0.0), plantLoc{}, BBLoadReSimIndex(0), BBMassFlowReSimIndex(0), BBInletTempFlowReSimIndex(0), - ScaledHeatingCapacity(0.0) + QBBSteamRadSource(0.0), QBBSteamRadSrcAvg(0.0), ZeroBBSteamSourceSumHATsurf(0.0), LastQBBSteamRadSrc(0.0), LastSysTimeElapsed(0.0), + LastTimeStepSys(0.0), ScaledHeatingCapacity(0.0) { } }; @@ -209,15 +220,6 @@ struct SteamBaseboardRadiatorData : BaseGlobalStruct int NumSteamBaseboardsDesign = 0; int SteamIndex = 0; - Array1D QBBSteamRadSource; // Need to keep the last value in case we are still iterating - Array1D QBBSteamRadSrcAvg; // Need to keep the last value in case we are still iterating - Array1D ZeroSourceSumHATsurf; // Equal to the SumHATsurf for all the walls in a zone - // with no source - - // Record keeping variables used to calculate QBBRadSrcAvg locally - Array1D LastQBBSteamRadSrc; // Need to keep the last value in case we are still iterating - Array1D LastSysTimeElapsed; // Need to keep the last value in case we are still iterating - Array1D LastTimeStepSys; // Need to keep the last value in case we are still iterating Array1D_bool MySizeFlag; Array1D_bool CheckEquipName; Array1D_bool CheckDesignObjectName; @@ -238,12 +240,6 @@ struct SteamBaseboardRadiatorData : BaseGlobalStruct { NumSteamBaseboards = 0; SteamIndex = 0; - QBBSteamRadSource.clear(); - QBBSteamRadSrcAvg.clear(); - ZeroSourceSumHATsurf.clear(); - LastQBBSteamRadSrc.clear(); - LastSysTimeElapsed.clear(); - LastTimeStepSys.clear(); MySizeFlag.clear(); MyEnvrnFlag.clear(); CheckEquipName.clear(); diff --git a/src/EnergyPlus/SwimmingPool.cc b/src/EnergyPlus/SwimmingPool.cc index 8f70389c30c..7bf1af0aeb0 100644 --- a/src/EnergyPlus/SwimmingPool.cc +++ b/src/EnergyPlus/SwimmingPool.cc @@ -478,27 +478,13 @@ void SwimmingPoolData::initialize(EnergyPlusData &state, bool const FirstHVACIte if (this->MyOneTimeFlag) { this->setupOutputVars(state); // Set up the output variables once here - this->ZeroSourceSumHATsurf.allocate(state.dataGlobal->NumOfZones); - this->ZeroSourceSumHATsurf = 0.0; - this->QPoolSrcAvg.allocate(state.dataSurface->TotSurfaces); - this->QPoolSrcAvg = 0.0; - this->HeatTransCoefsAvg.allocate(state.dataSurface->TotSurfaces); - this->HeatTransCoefsAvg = 0.0; - this->LastQPoolSrc.allocate(state.dataSurface->TotSurfaces); - this->LastQPoolSrc = 0.0; - this->LastHeatTransCoefs.allocate(state.dataSurface->TotSurfaces); - this->LastHeatTransCoefs = 0.0; - this->LastSysTimeElapsed.allocate(state.dataSurface->TotSurfaces); - this->LastSysTimeElapsed = 0.0; - this->LastTimeStepSys.allocate(state.dataSurface->TotSurfaces); - this->LastTimeStepSys = 0.0; this->MyOneTimeFlag = false; } SwimmingPoolData::initSwimmingPoolPlantLoopIndex(state); if (state.dataGlobal->BeginEnvrnFlag && this->MyEnvrnFlagGeneral) { - this->ZeroSourceSumHATsurf = 0.0; + this->ZeroPoolSourceSumHATsurf = 0.0; this->QPoolSrcAvg = 0.0; this->HeatTransCoefsAvg = 0.0; this->LastQPoolSrc = 0.0; @@ -529,14 +515,14 @@ void SwimmingPoolData::initialize(EnergyPlusData &state, bool const FirstHVACIte if (state.dataGlobal->BeginTimeStepFlag && FirstHVACIteration) { // This is the first pass through in a particular time step int ZoneNum = this->ZonePtr; - this->ZeroSourceSumHATsurf(ZoneNum) = - state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state); // Set this to figure what part of the load the radiant system meets + this->ZeroPoolSourceSumHATsurf = + state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state); // Set this to figure what the impact of the swimming pool on all zone surfaces int SurfNum = this->SurfacePtr; - this->QPoolSrcAvg(SurfNum) = 0.0; // Initialize this variable to zero (pool parameters "off") - this->HeatTransCoefsAvg(SurfNum) = 0.0; // Initialize this variable to zero (pool parameters "off") - this->LastQPoolSrc(SurfNum) = 0.0; // At the start of a time step, reset to zero so average calculation can begin again - this->LastSysTimeElapsed(SurfNum) = 0.0; // At the start of a time step, reset to zero so average calculation can begin again - this->LastTimeStepSys(SurfNum) = 0.0; // At the start of a time step, reset to zero so average calculation can begin again + this->QPoolSrcAvg = 0.0; // Initialize this variable to zero (pool parameters "off") + this->HeatTransCoefsAvg = 0.0; // Initialize this variable to zero (pool parameters "off") + this->LastQPoolSrc = 0.0; // At the start of a time step, reset to zero so average calculation can begin again + this->LastSysTimeElapsed = 0.0; // At the start of a time step, reset to zero so average calculation can begin again + this->LastTimeStepSys = 0.0; // At the start of a time step, reset to zero so average calculation can begin again } // initialize the flow rate for the component on the plant side (this follows standard procedure for other components like low temperature @@ -1004,23 +990,22 @@ void SwimmingPoolData::update(EnergyPlusData &state) int SurfNum = this->SurfacePtr; // surface number/pointer - if (this->LastSysTimeElapsed(SurfNum) == state.dataHVACGlobal->SysTimeElapsed) { + if (this->LastSysTimeElapsed == state.dataHVACGlobal->SysTimeElapsed) { // Still iterating or reducing system time step, so subtract old values which were // not valid - this->QPoolSrcAvg(SurfNum) -= this->LastQPoolSrc(SurfNum) * this->LastTimeStepSys(SurfNum) / state.dataGlobal->TimeStepZone; - this->HeatTransCoefsAvg(SurfNum) -= this->LastHeatTransCoefs(SurfNum) * this->LastTimeStepSys(SurfNum) / state.dataGlobal->TimeStepZone; + this->QPoolSrcAvg -= this->LastQPoolSrc * this->LastTimeStepSys / state.dataGlobal->TimeStepZone; + this->HeatTransCoefsAvg -= this->LastHeatTransCoefs * this->LastTimeStepSys / state.dataGlobal->TimeStepZone; } // Update the running average and the "last" values with the current values of the appropriate variables - this->QPoolSrcAvg(SurfNum) += - state.dataHeatBalFanSys->QPoolSurfNumerator(SurfNum) * state.dataHVACGlobal->TimeStepSys / state.dataGlobal->TimeStepZone; - this->HeatTransCoefsAvg(SurfNum) += + this->QPoolSrcAvg += state.dataHeatBalFanSys->QPoolSurfNumerator(SurfNum) * state.dataHVACGlobal->TimeStepSys / state.dataGlobal->TimeStepZone; + this->HeatTransCoefsAvg += state.dataHeatBalFanSys->PoolHeatTransCoefs(SurfNum) * state.dataHVACGlobal->TimeStepSys / state.dataGlobal->TimeStepZone; - this->LastQPoolSrc(SurfNum) = state.dataHeatBalFanSys->QPoolSurfNumerator(SurfNum); - this->LastHeatTransCoefs(SurfNum) = state.dataHeatBalFanSys->PoolHeatTransCoefs(SurfNum); - this->LastSysTimeElapsed(SurfNum) = state.dataHVACGlobal->SysTimeElapsed; - this->LastTimeStepSys(SurfNum) = state.dataHVACGlobal->TimeStepSys; + this->LastQPoolSrc = state.dataHeatBalFanSys->QPoolSurfNumerator(SurfNum); + this->LastHeatTransCoefs = state.dataHeatBalFanSys->PoolHeatTransCoefs(SurfNum); + this->LastSysTimeElapsed = state.dataHVACGlobal->SysTimeElapsed; + this->LastTimeStepSys = state.dataHVACGlobal->TimeStepSys; PlantUtilities::SafeCopyPlantNode(state, this->WaterInletNode, this->WaterOutletNode); @@ -1056,13 +1041,14 @@ void UpdatePoolSourceValAvg(EnergyPlusData &state, bool &SwimmingPoolOn) // .TRU // SUBROUTINE LOCAL VARIABLE DECLARATIONS: SwimmingPoolOn = false; - // If this was never allocated, then there are no radiant systems in this input file (just RETURN) - for (int PoolNum = 1; PoolNum <= state.dataSwimmingPools->NumSwimmingPools; ++PoolNum) { - if (!allocated(state.dataSwimmingPools->Pool(PoolNum).QPoolSrcAvg)) return; + // If there are no pools, then just RETURN - // If it was allocated, then we have to check to see if this was running at all + if (state.dataSwimmingPools->NumSwimmingPools == 0) return; + + for (int PoolNum = 1; PoolNum <= state.dataSwimmingPools->NumSwimmingPools; ++PoolNum) { + // Check to see if any of the pools were running at all for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { - if (state.dataSwimmingPools->Pool(PoolNum).QPoolSrcAvg(SurfNum) != 0.0) { + if (state.dataSwimmingPools->Pool(PoolNum).QPoolSrcAvg != 0.0) { SwimmingPoolOn = true; break; // DO loop } diff --git a/src/EnergyPlus/SwimmingPool.hh b/src/EnergyPlus/SwimmingPool.hh index 8f22500e7fa..41b8bb2cc5c 100644 --- a/src/EnergyPlus/SwimmingPool.hh +++ b/src/EnergyPlus/SwimmingPool.hh @@ -130,14 +130,14 @@ namespace SwimmingPool { bool MyOneTimeFlag; bool MyEnvrnFlagGeneral; bool MyPlantScanFlagPool; - Array1D QPoolSrcAvg; // Average source over the time step for a particular radiant surface - Array1D HeatTransCoefsAvg; // Average denominator term over the time step for a particular pool - Array1D ZeroSourceSumHATsurf; // Equal to SumHATsurf for all the walls in a zone with no source + Real64 QPoolSrcAvg; // Average source over the time step for a particular radiant surface + Real64 HeatTransCoefsAvg; // Average denominator term over the time step for a particular pool + Real64 ZeroPoolSourceSumHATsurf; // Equal to SumHATsurf for all the walls in a zone with no source // Record keeping variables used to calculate QRadSysSrcAvg locally - Array1D LastQPoolSrc; // Need to keep the last value in case we are still iterating - Array1D LastHeatTransCoefs; // Need to keep the last value in case we are still iterating - Array1D LastSysTimeElapsed; // Need to keep the last value in case we are still iterating - Array1D LastTimeStepSys; // Need to keep the last value in case we are still iterating + Real64 LastQPoolSrc; // Need to keep the last value in case we are still iterating + Real64 LastHeatTransCoefs; // Need to keep the last value in case we are still iterating + Real64 LastSysTimeElapsed; // Need to keep the last value in case we are still iterating + Real64 LastTimeStepSys; // Need to keep the last value in case we are still iterating // Default Constructor SwimmingPoolData() @@ -150,7 +150,8 @@ namespace SwimmingPool { PoolWaterTemp(23.0), WaterInletTemp(0.0), WaterOutletTemp(0.0), WaterMassFlowRate(0.0), MakeUpWaterMassFlowRate(0.0), MakeUpWaterMass(0.0), MakeUpWaterVolFlowRate(0.0), MakeUpWaterVol(0.0), HeatPower(0.0), HeatEnergy(0.0), MiscEquipPower(0.0), MiscEquipEnergy(0.0), RadConvertToConvectRep(0.0), EvapHeatLossRate(0.0), EvapEnergyLoss(0.0), MyOneTimeFlag(true), - MyEnvrnFlagGeneral(true), MyPlantScanFlagPool(true) + MyEnvrnFlagGeneral(true), MyPlantScanFlagPool(true), QPoolSrcAvg(0.0), HeatTransCoefsAvg(0.0), ZeroPoolSourceSumHATsurf(0.0), + LastQPoolSrc(0.0), LastHeatTransCoefs(0.0), LastSysTimeElapsed(0.0), LastTimeStepSys(0.0) { } diff --git a/src/EnergyPlus/VentilatedSlab.cc b/src/EnergyPlus/VentilatedSlab.cc index 353e6f2a1d3..70f550e3b7f 100644 --- a/src/EnergyPlus/VentilatedSlab.cc +++ b/src/EnergyPlus/VentilatedSlab.cc @@ -1539,7 +1539,6 @@ namespace VentilatedSlab { state.dataVentilatedSlab->MySizeFlag.allocate(state.dataVentilatedSlab->NumOfVentSlabs); state.dataVentilatedSlab->MyPlantScanFlag.allocate(state.dataVentilatedSlab->NumOfVentSlabs); state.dataVentilatedSlab->MyZoneEqFlag.allocate(state.dataVentilatedSlab->NumOfVentSlabs); - state.dataVentilatedSlab->ZeroSourceSumHATsurf.dimension(state.dataGlobal->NumOfZones, 0.0); state.dataVentilatedSlab->QRadSysSrcAvg.dimension(state.dataSurface->TotSurfaces, 0.0); state.dataVentilatedSlab->LastQRadSysSrc.dimension(state.dataSurface->TotSurfaces, 0.0); state.dataVentilatedSlab->LastSysTimeElapsed.dimension(state.dataSurface->TotSurfaces, 0.0); @@ -1630,14 +1629,14 @@ namespace VentilatedSlab { OutsideAirNode = ventSlab.OutsideAirNode; RhoAir = state.dataEnvrn->StdRhoAir; - // Radiation Panel Part - state.dataVentilatedSlab->ZeroSourceSumHATsurf = 0.0; + // "Radiant" Source Part state.dataVentilatedSlab->QRadSysSrcAvg = 0.0; state.dataVentilatedSlab->LastQRadSysSrc = 0.0; state.dataVentilatedSlab->LastSysTimeElapsed = 0.0; state.dataVentilatedSlab->LastTimeStepSys = 0.0; if (state.dataVentilatedSlab->NumOfVentSlabs > 0) { for (auto &e : state.dataVentilatedSlab->VentSlab) { + e.ZeroVentSlabSourceSumHATsurf = 0.0; e.RadHeatingPower = 0.0; e.RadHeatingEnergy = 0.0; e.RadCoolingPower = 0.0; @@ -1767,7 +1766,7 @@ namespace VentilatedSlab { // The first pass through in a particular time step ZoneNum = ventSlab.ZonePtr; - state.dataVentilatedSlab->ZeroSourceSumHATsurf(ZoneNum) = + ventSlab.ZeroVentSlabSourceSumHATsurf = state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state); // Set this to figure what part of the load the radiant system meets for (RadSurfNum = 1; RadSurfNum <= ventSlab.NumOfSurfaces; ++RadSurfNum) { SurfNum = ventSlab.SurfacePtr(RadSurfNum); diff --git a/src/EnergyPlus/VentilatedSlab.hh b/src/EnergyPlus/VentilatedSlab.hh index f84bbccc03e..c33c9a02759 100644 --- a/src/EnergyPlus/VentilatedSlab.hh +++ b/src/EnergyPlus/VentilatedSlab.hh @@ -273,8 +273,10 @@ namespace VentilatedSlab { Real64 ZoneInletTemp; // supply air temp std::string AvailManagerListName; // Name of an availability manager list object int AvailStatus; - int HVACSizingIndex; // index of a HVACSizing object for a ventilator slab - bool FirstPass; // detects first time through for resetting sizing data + int HVACSizingIndex; // index of a HVACSizing object for a ventilator slab + bool FirstPass; // detects first time through for resetting sizing data + Real64 ZeroVentSlabSourceSumHATsurf; // Equal to SumHATsurf for all the walls in a zone with no source + // Default Constructor VentilatedSlabData() : SchedPtr(0), ZonePtr(0), NumOfSurfaces(0), TotalSurfaceArea(0.0), CoreDiameter(0.0), CoreLength(0.0), CoreNumbers(0.0), @@ -296,7 +298,7 @@ namespace VentilatedSlab { RadHeatingEnergy(0.0), RadCoolingPower(0.0), RadCoolingEnergy(0.0), HeatCoilPower(0.0), HeatCoilEnergy(0.0), TotCoolCoilPower(0.0), TotCoolCoilEnergy(0.0), SensCoolCoilPower(0.0), SensCoolCoilEnergy(0.0), LateCoolCoilPower(0.0), LateCoolCoilEnergy(0.0), ElecFanPower(0.0), ElecFanEnergy(0.0), AirMassFlowRate(0.0), AirVolFlow(0.0), SlabInTemp(0.0), SlabOutTemp(0.0), ReturnAirTemp(0.0), - FanOutletTemp(0.0), ZoneInletTemp(0.0), AvailStatus(0), HVACSizingIndex(0), FirstPass(true) + FanOutletTemp(0.0), ZoneInletTemp(0.0), AvailStatus(0), HVACSizingIndex(0), FirstPass(true), ZeroVentSlabSourceSumHATsurf(0.0) { } }; @@ -385,13 +387,12 @@ struct VentilatedSlabData : BaseGlobalStruct int OperatingMode = 0; // Used to keep track of whether system is in heating or cooling mode // MODULE VARIABLE DECLARATIONS: - bool HCoilOn = false; // TRUE if the heating coil (gas or electric especially) should be running - int NumOfVentSlabs = 0; // Number of ventilated slab in the input file - Real64 OAMassFlowRate = 0.0; // Outside air mass flow rate for the ventilated slab - Array1D_double QRadSysSrcAvg; // Average source over the time step for a particular radiant surfaceD - Array1D ZeroSourceSumHATsurf; // Equal to SumHATsurf for all the walls in a zone with no source - int MaxCloNumOfSurfaces = 0; // Used to set allocate size in CalcClo routine - Real64 QZnReq = 0.0; // heating or cooling needed by system [watts] + bool HCoilOn = false; // TRUE if the heating coil (gas or electric especially) should be running + int NumOfVentSlabs = 0; // Number of ventilated slab in the input file + Real64 OAMassFlowRate = 0.0; // Outside air mass flow rate for the ventilated slab + Array1D_double QRadSysSrcAvg; // Average source over the time step for a particular radiant surfaceD + int MaxCloNumOfSurfaces = 0; // Used to set allocate size in CalcClo routine + Real64 QZnReq = 0.0; // heating or cooling needed by system [watts] // Record keeping variables used to calculate QRadSysSrcAvg locally @@ -430,7 +431,6 @@ struct VentilatedSlabData : BaseGlobalStruct this->MaxCloNumOfSurfaces = 0; this->QZnReq = 0.0; this->QRadSysSrcAvg.deallocate(); - this->ZeroSourceSumHATsurf.deallocate(); this->LastQRadSysSrc.deallocate(); this->LastSysTimeElapsed.deallocate(); this->LastTimeStepSys.deallocate(); From b4cc760556645c2e5117f51199e18b67b78bfa68 Mon Sep 17 00:00:00 2001 From: Rick Strand Date: Tue, 6 Jun 2023 14:46:33 -0500 Subject: [PATCH 05/80] Corrections to Unit Tests Corrections made to HW Baseboard Radiator unit tests which used one of the variables that was moved to become a local variable. --- src/EnergyPlus/SteamBaseboardRadiator.cc | 2 +- tst/EnergyPlus/unit/HWBaseboardRadiator.unit.cc | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/EnergyPlus/SteamBaseboardRadiator.cc b/src/EnergyPlus/SteamBaseboardRadiator.cc index c8cc0cc2851..2ec839b5478 100644 --- a/src/EnergyPlus/SteamBaseboardRadiator.cc +++ b/src/EnergyPlus/SteamBaseboardRadiator.cc @@ -1492,7 +1492,7 @@ namespace SteamBaseboardRadiator { state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).QBBSteamRadSource = state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).QBBSteamRadSrcAvg; - DistributeBBSteamRadGains(state); // QBBRadSource has been modified so we need to redistribute gains + DistributeBBSteamRadGains(state); // QBBSteamRadSource has been modified so we need to redistribute gains } void DistributeBBSteamRadGains(EnergyPlusData &state) diff --git a/tst/EnergyPlus/unit/HWBaseboardRadiator.unit.cc b/tst/EnergyPlus/unit/HWBaseboardRadiator.unit.cc index 7e3693bde1b..b04eb6f8e6a 100644 --- a/tst/EnergyPlus/unit/HWBaseboardRadiator.unit.cc +++ b/tst/EnergyPlus/unit/HWBaseboardRadiator.unit.cc @@ -77,7 +77,6 @@ TEST_F(EnergyPlusFixture, HWBaseboardRadiator_CalcHWBaseboard) int BBNum; auto &HWBaseboard = state->dataHWBaseboardRad->HWBaseboard; - auto &QBBRadSource = state->dataHWBaseboardRad->QBBRadSource; auto &HWBaseboardDesignObject = state->dataHWBaseboardRad->HWBaseboardDesignObject; state->dataLoopNodes->Node.allocate(1); @@ -85,7 +84,6 @@ TEST_F(EnergyPlusFixture, HWBaseboardRadiator_CalcHWBaseboard) state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); state->dataZoneEnergyDemand->CurDeadBandOrSetback.allocate(1); state->dataPlnt->PlantLoop.allocate(1); - QBBRadSource.allocate(1); HWBaseboardDesignObject.allocate(1); state->dataLoopNodes->Node(1).MassFlowRate = 0.40; @@ -103,10 +101,10 @@ TEST_F(EnergyPlusFixture, HWBaseboardRadiator_CalcHWBaseboard) HWBaseboard(1).SchedPtr = -1; HWBaseboard(1).plantLoc.loopNum = 1; HWBaseboard(1).UA = 370; + HWBaseboard(1).QBBRadSource = 0.0; state->dataPlnt->PlantLoop(1).FluidName = "Water"; state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidType = DataLoopNode::NodeFluidType::Water; - QBBRadSource(1) = 0.0; CalcHWBaseboard(*state, BBNum, LoadMet); @@ -120,7 +118,6 @@ TEST_F(EnergyPlusFixture, HWBaseboardRadiator_CalcHWBaseboard) state->dataZoneEnergyDemand->ZoneSysEnergyDemand.deallocate(); state->dataZoneEnergyDemand->CurDeadBandOrSetback.deallocate(); state->dataPlnt->PlantLoop.deallocate(); - QBBRadSource.deallocate(); } TEST_F(EnergyPlusFixture, HWBaseboardRadiator_HWBaseboardWaterFlowResetTest) @@ -131,7 +128,6 @@ TEST_F(EnergyPlusFixture, HWBaseboardRadiator_HWBaseboardWaterFlowResetTest) BBNum = 1; LoadMet = 0.0; auto &HWBaseboard = state->dataHWBaseboardRad->HWBaseboard; - auto &QBBRadSource = state->dataHWBaseboardRad->QBBRadSource; auto &HWBaseboardDesignObject = state->dataHWBaseboardRad->HWBaseboardDesignObject; state->dataLoopNodes->Node.allocate(2); @@ -139,7 +135,6 @@ TEST_F(EnergyPlusFixture, HWBaseboardRadiator_HWBaseboardWaterFlowResetTest) state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); state->dataZoneEnergyDemand->CurDeadBandOrSetback.allocate(1); state->dataPlnt->PlantLoop.allocate(1); - QBBRadSource.allocate(1); HWBaseboardDesignObject.allocate(1); state->dataZoneEnergyDemand->CurDeadBandOrSetback(1) = false; @@ -160,10 +155,10 @@ TEST_F(EnergyPlusFixture, HWBaseboardRadiator_HWBaseboardWaterFlowResetTest) HWBaseboard(1).plantLoc.loopSideNum = DataPlant::LoopSideLocation::Demand; HWBaseboard(1).plantLoc.branchNum = 1; HWBaseboard(1).UA = 400.0; + HWBaseboard(1).QBBRadSource = 0.0; state->dataPlnt->PlantLoop(1).FluidName = "Water"; state->dataPlnt->PlantLoop(1).FluidIndex = 1; state->dataPlnt->PlantLoop(1).FluidType = DataLoopNode::NodeFluidType::Water; - QBBRadSource(1) = 0.0; state->dataLoopNodes->Node(HWBaseboard(1).WaterInletNode).MassFlowRate = 0.2; state->dataLoopNodes->Node(HWBaseboard(1).WaterInletNode).MassFlowRateMax = 0.4; @@ -205,5 +200,4 @@ TEST_F(EnergyPlusFixture, HWBaseboardRadiator_HWBaseboardWaterFlowResetTest) state->dataZoneEnergyDemand->ZoneSysEnergyDemand.deallocate(); state->dataZoneEnergyDemand->CurDeadBandOrSetback.deallocate(); state->dataPlnt->PlantLoop.deallocate(); - QBBRadSource.deallocate(); } From d8c4e12d83114e9b059d91f012ce25c9d5722968 Mon Sep 17 00:00:00 2001 From: Rick Strand Date: Tue, 6 Jun 2023 16:16:39 -0500 Subject: [PATCH 06/80] More corrections Additional changes needed after attempting to merge in some diffs with develop. --- src/EnergyPlus/HWBaseboardRadiator.cc | 60 +++++++++++++-------------- 1 file changed, 28 insertions(+), 32 deletions(-) diff --git a/src/EnergyPlus/HWBaseboardRadiator.cc b/src/EnergyPlus/HWBaseboardRadiator.cc index ce682ad39ec..4fa5e6f016f 100644 --- a/src/EnergyPlus/HWBaseboardRadiator.cc +++ b/src/EnergyPlus/HWBaseboardRadiator.cc @@ -835,10 +835,8 @@ namespace HWBaseboardRadiator { static constexpr std::string_view RoutineName("BaseboardRadiatorWater:InitHWBaseboard"); int WaterInletNode; - Real64 RhoAirStdInit; Real64 rho; // local fluid density Real64 Cp; // local fluid specific heat - bool errFlag; int NumHWBaseboards = state.dataHWBaseboardRad->NumHWBaseboards; auto &HWBaseboard = state.dataHWBaseboardRad->HWBaseboard(BaseboardNum); @@ -853,17 +851,17 @@ namespace HWBaseboardRadiator { state.dataHWBaseboardRad->MyOneTimeFlag = false; for (int Loop = 1; Loop <= NumHWBaseboards; ++Loop) { + auto &hWBB = state.dataHWBaseboardRad->HWBaseboard; // Air mass flow rate is obtained from the following linear equation (reset if autosize is used) // m_dot = 0.0062 + 2.75e-05*q - HWBaseboard(Loop).AirMassFlowRateStd = Constant + Coeff * HWBaseboard(Loop).RatedCapacity; - HWBaseboard(Loop).ZeroBBSourceSumHATsurf = 0.0; - HWBaseboard(Loop).QBBRadSource = 0.0; - HWBaseboard(Loop).QBBRadSrcAvg = 0.0; - HWBaseboard(Loop).LastQBBRadSrc = 0.0; - HWBaseboard(Loop).LastSysTimeElapsed = 0.0; - HWBaseboard(Loop).LastTimeStepSys = 0.0; - state.dataHWBaseboardRad->HWBaseboard(Loop).AirMassFlowRateStd = - Constant + Coeff * state.dataHWBaseboardRad->HWBaseboard(Loop).RatedCapacity; + hWBB(Loop).AirMassFlowRateStd = Constant + Coeff * hWBB(Loop).RatedCapacity; + hWBB(Loop).ZeroBBSourceSumHATsurf = 0.0; + hWBB(Loop).QBBRadSource = 0.0; + hWBB(Loop).QBBRadSrcAvg = 0.0; + hWBB(Loop).LastQBBRadSrc = 0.0; + hWBB(Loop).LastSysTimeElapsed = 0.0; + hWBB(Loop).LastTimeStepSys = 0.0; + hWBB(Loop).AirMassFlowRateStd = Constant + Coeff * hWBB(Loop).RatedCapacity; } } @@ -888,7 +886,6 @@ namespace HWBaseboardRadiator { // Do the Begin Environment initializations if (state.dataGlobal->BeginEnvrnFlag && state.dataHWBaseboardRad->MyEnvrnFlag(BaseboardNum)) { // Initialize - RhoAirStdInit = state.dataEnvrn->StdRhoAir; WaterInletNode = HWBaseboard.WaterInletNode; rho = FluidProperties::GetDensityGlycol(state, @@ -914,12 +911,12 @@ namespace HWBaseboardRadiator { state.dataLoopNodes->Node(WaterInletNode).Press = 0.0; state.dataLoopNodes->Node(WaterInletNode).HumRat = 0.0; - HWBaseboard(BaseboardNum).ZeroBBSourceSumHATsurf = 0.0; - HWBaseboard(BaseboardNum).QBBRadSource = 0.0; - HWBaseboard(BaseboardNum).QBBRadSrcAvg = 0.0; - HWBaseboard(BaseboardNum).LastQBBRadSrc = 0.0; - HWBaseboard(BaseboardNum).LastSysTimeElapsed = 0.0; - HWBaseboard(BaseboardNum).LastTimeStepSys = 0.0; + HWBaseboard.ZeroBBSourceSumHATsurf = 0.0; + HWBaseboard.QBBRadSource = 0.0; + HWBaseboard.QBBRadSrcAvg = 0.0; + HWBaseboard.LastQBBRadSrc = 0.0; + HWBaseboard.LastSysTimeElapsed = 0.0; + HWBaseboard.LastTimeStepSys = 0.0; state.dataHWBaseboardRad->MyEnvrnFlag(BaseboardNum) = false; } @@ -929,12 +926,12 @@ namespace HWBaseboardRadiator { } if (state.dataGlobal->BeginTimeStepFlag && FirstHVACIteration) { - int ZoneNum = HWBaseboard(BaseboardNum).ZonePtr; - HWBaseboard(BaseboardNum).ZeroBBSourceSumHATsurf = state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state); - HWBaseboard(BaseboardNum).QBBRadSrcAvg = 0.0; - HWBaseboard(BaseboardNum).LastQBBRadSrc = 0.0; - HWBaseboard(BaseboardNum).LastSysTimeElapsed = 0.0; - HWBaseboard(BaseboardNum).LastTimeStepSys = 0.0; + int ZoneNum = HWBaseboard.ZonePtr; + HWBaseboard.ZeroBBSourceSumHATsurf = state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state); + HWBaseboard.QBBRadSrcAvg = 0.0; + HWBaseboard.LastQBBRadSrc = 0.0; + HWBaseboard.LastSysTimeElapsed = 0.0; + HWBaseboard.LastTimeStepSys = 0.0; } // Do the every time step initializations @@ -1337,7 +1334,7 @@ namespace HWBaseboardRadiator { WaterOutletTemp = WaterInletTemp - CapacitanceAir * (AirOutletTemp - AirInletTemp) / CapacitanceWater; BBHeat = CapacitanceWater * (WaterInletTemp - WaterOutletTemp); RadHeat = BBHeat * HWBaseboardDesignDataObject.FracRadiant; - HWBaseboard(BaseboardNum).QBBRadSource = RadHeat; + hWBaseboard.QBBRadSource = RadHeat; if (HWBaseboardDesignDataObject.FracRadiant <= MinFrac) { LoadMet = BBHeat; @@ -1359,8 +1356,8 @@ namespace HWBaseboardRadiator { // not very precise, but at least it conserves energy. The system impact to heat balance // should include this. - LoadMet = (state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state) - HWBaseboard(BaseboardNum).ZeroBBSourceSumHATsurf) + - (BBHeat * HWBaseboard(BaseboardNum).FracConvect) + (RadHeat * HWBaseboardDesignDataObject.FracDistribPerson); + LoadMet = (state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state) - hWBaseboard.ZeroBBSourceSumHATsurf) + + (BBHeat * hWBaseboard.FracConvect) + (RadHeat * HWBaseboardDesignDataObject.FracDistribPerson); } hWBaseboard.WaterOutletEnthalpy = hWBaseboard.WaterInletEnthalpy - BBHeat / WaterMassFlowRate; } else { @@ -1376,7 +1373,7 @@ namespace HWBaseboardRadiator { RadHeat = 0.0; WaterMassFlowRate = 0.0; AirMassFlowRate = 0.0; - HWBaseboard(BaseboardNum).QBBRadSource = 0.0; + hWBaseboard.QBBRadSource = 0.0; hWBaseboard.WaterOutletEnthalpy = hWBaseboard.WaterInletEnthalpy; PlantUtilities::SetActuatedBranchFlowRate(state, WaterMassFlowRate, hWBaseboard.WaterInletNode, hWBaseboard.plantLoc, false); } @@ -1409,7 +1406,6 @@ namespace HWBaseboardRadiator { int WaterInletNode; int WaterOutletNode; auto &thisHWBB = state.dataHWBaseboardRad->HWBaseboard(BaseboardNum); - Real64 const qBBRadSource = thisHWBB.QBBRadSource; if (state.dataGlobal->BeginEnvrnFlag && state.dataHWBaseboardRad->MyEnvrnFlag2) { state.dataHWBaseboardRad->Iter = 0; @@ -1513,7 +1509,7 @@ namespace HWBaseboardRadiator { auto &thisHWBB = state.dataHWBaseboardRad->HWBaseboard(BaseboardNum); HWBaseboardDesignData const &HWBaseboardDesignDataObject = - state.dataHWBaseboardRad->HWBaseboardDesignObject(HWBaseboard.DesignObjectPtr); // Contains the data for the design object + state.dataHWBaseboardRad->HWBaseboardDesignObject(thisHWBB.DesignObjectPtr); // Contains the data for the design object int ZoneNum = thisHWBB.ZonePtr; if (ZoneNum <= 0) continue; state.dataHeatBalFanSys->ZoneQHWBaseboardToPerson(ZoneNum) += thisHWBB.QBBRadSource * HWBaseboardDesignDataObject.FracDistribPerson; @@ -1529,7 +1525,7 @@ namespace HWBaseboardRadiator { ShowSevereError(state, "DistributeBBRadGains: excessive thermal radiation heat flux intensity detected"); ShowContinueError(state, format("Surface = {}", state.dataSurface->Surface(SurfNum).Name)); ShowContinueError(state, format("Surface area = {:.3R} [m2]", state.dataSurface->Surface(SurfNum).Area)); - ShowContinueError(state, format("Occurs in {} = {}", cCMO_BBRadiator_Water, thisHWBB.EquipID)); + ShowContinueError(state, format("Occurs in {} = {}", cCMO_BBRadiator_Water, thisHWBB.Name)); ShowContinueError(state, format("Radiation intensity = {:.2R} [W/m2]", ThisSurfIntensity)); ShowContinueError(state, format("Assign a larger surface area or more surfaces in {}", cCMO_BBRadiator_Water)); ShowFatalError(state, "DistributeBBRadGains: excessive thermal radiation heat flux intensity detected"); @@ -1538,7 +1534,7 @@ namespace HWBaseboardRadiator { ShowSevereError(state, "DistributeBBRadGains: surface not large enough to receive thermal radiation heat flux"); ShowContinueError(state, format("Surface = {}", state.dataSurface->Surface(SurfNum).Name)); ShowContinueError(state, format("Surface area = {:.3R} [m2]", state.dataSurface->Surface(SurfNum).Area)); - ShowContinueError(state, format("Occurs in {} = {}", cCMO_BBRadiator_Water, thisHWBB.EquipID)); + ShowContinueError(state, format("Occurs in {} = {}", cCMO_BBRadiator_Water, thisHWBB.Name)); ShowContinueError(state, format("Assign a larger surface area or more surfaces in {}", cCMO_BBRadiator_Water)); ShowFatalError(state, "DistributeBBRadGains: surface not large enough to receive thermal radiation heat flux"); } From 0658c6255b7b54a80ac40869230a5ad585d52ff9 Mon Sep 17 00:00:00 2001 From: Rick Strand Date: Wed, 7 Jun 2023 07:15:56 -0500 Subject: [PATCH 07/80] Changes to Address Diffs and Fails Fixes a bug introduced in some of the changes that were made and tries to address one of the models that had significant differences in the output. --- src/EnergyPlus/HighTempRadiantSystem.cc | 15 +++++++-------- src/EnergyPlus/SteamBaseboardRadiator.cc | 11 ++++++----- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/EnergyPlus/HighTempRadiantSystem.cc b/src/EnergyPlus/HighTempRadiantSystem.cc index 1a0ae2d47ea..2e5010ad0f1 100644 --- a/src/EnergyPlus/HighTempRadiantSystem.cc +++ b/src/EnergyPlus/HighTempRadiantSystem.cc @@ -732,7 +732,7 @@ namespace HighTempRadiantSystem { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int ZoneNum; // Intermediate variable for keeping track of the zone number - int Loop; + int HTRnum; if (state.dataHighTempRadSys->firstTime) { state.dataHighTempRadSys->MySizeFlag.dimension(state.dataHighTempRadSys->NumOfHighTempRadSys, true); @@ -742,12 +742,12 @@ namespace HighTempRadiantSystem { // need to check all units to see if they are on Zone Equipment List or issue warning if (!state.dataHighTempRadSys->ZoneEquipmentListChecked && state.dataZoneEquip->ZoneEquipInputsFilled) { state.dataHighTempRadSys->ZoneEquipmentListChecked = true; - for (Loop = 1; Loop <= state.dataHighTempRadSys->NumOfHighTempRadSys; ++Loop) { - if (CheckZoneEquipmentList(state, "ZoneHVAC:HighTemperatureRadiant", state.dataHighTempRadSys->HighTempRadSys(Loop).Name)) continue; + for (HTRnum = 1; HTRnum <= state.dataHighTempRadSys->NumOfHighTempRadSys; ++HTRnum) { + if (CheckZoneEquipmentList(state, "ZoneHVAC:HighTemperatureRadiant", state.dataHighTempRadSys->HighTempRadSys(HTRnum).Name)) continue; ShowSevereError(state, format("InitHighTempRadiantSystem: Unit=[ZoneHVAC:HighTemperatureRadiant,{}] is not on any ZoneHVAC:EquipmentList. " "It will not be simulated.", - state.dataHighTempRadSys->HighTempRadSys(Loop).Name)); + state.dataHighTempRadSys->HighTempRadSys(HTRnum).Name)); } } @@ -761,14 +761,14 @@ namespace HighTempRadiantSystem { state.dataHighTempRadSys->MyEnvrnFlag = false; } if (!state.dataGlobal->BeginEnvrnFlag) { - for (int HTRnum = 1; state.dataHighTempRadSys->NumOfHighTempRadSys; ++HTRnum) { + for (HTRnum = 1; HTRnum <= state.dataHighTempRadSys->NumOfHighTempRadSys; ++HTRnum) { state.dataHighTempRadSys->HighTempRadSys(HTRnum).LastQHTRRadSrc = 0.0; } state.dataHighTempRadSys->MyEnvrnFlag = true; } if (state.dataGlobal->BeginTimeStepFlag && FirstHVACIteration) { // This is the first pass through in a particular time step - for (int HTRnum = 1; state.dataHighTempRadSys->NumOfHighTempRadSys; ++HTRnum) { + for (HTRnum = 1; HTRnum <= state.dataHighTempRadSys->NumOfHighTempRadSys; ++HTRnum) { auto &thisHTR = state.dataHighTempRadSys->HighTempRadSys(HTRnum); ZoneNum = thisHTR.ZonePtr; thisHTR.ZeroHTRSourceSumHATsurf = @@ -1286,14 +1286,13 @@ namespace HighTempRadiantSystem { // If it was allocated, then we have to check to see if this was running at all... for (RadSysNum = 1; RadSysNum <= state.dataHighTempRadSys->NumOfHighTempRadSys; ++RadSysNum) { + state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSource = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSrcAvg; if (state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSrcAvg != 0.0) { HighTempRadSysOn = true; break; // DO loop } } - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSource = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSrcAvg; - DistributeHTRadGains( state); // state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSource has been modified so we need to redistribute gains } diff --git a/src/EnergyPlus/SteamBaseboardRadiator.cc b/src/EnergyPlus/SteamBaseboardRadiator.cc index 2ec839b5478..93f29422333 100644 --- a/src/EnergyPlus/SteamBaseboardRadiator.cc +++ b/src/EnergyPlus/SteamBaseboardRadiator.cc @@ -1010,11 +1010,6 @@ namespace SteamBaseboardRadiator { state.dataLoopNodes->Node(SteamInletNode).Quality = 1.0; state.dataLoopNodes->Node(SteamInletNode).HumRat = 0.0; - state.dataSteamBaseboardRadiator->MyEnvrnFlag(BaseboardNum) = false; - } - - if (!state.dataGlobal->BeginEnvrnFlag) { - state.dataSteamBaseboardRadiator->MyEnvrnFlag(BaseboardNum) = true; // Initializes radiant sources state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).ZeroBBSteamSourceSumHATsurf = 0.0; state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).QBBSteamRadSource = 0.0; @@ -1022,6 +1017,12 @@ namespace SteamBaseboardRadiator { state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).LastQBBSteamRadSrc = 0.0; state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).LastSysTimeElapsed = 0.0; state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).LastTimeStepSys = 0.0; + + state.dataSteamBaseboardRadiator->MyEnvrnFlag(BaseboardNum) = false; + } + + if (!state.dataGlobal->BeginEnvrnFlag) { + state.dataSteamBaseboardRadiator->MyEnvrnFlag(BaseboardNum) = true; } if (state.dataGlobal->BeginTimeStepFlag && FirstHVACIteration) { From 54bcdcd18879bb308fd1ccca7451a3ed17394738 Mon Sep 17 00:00:00 2001 From: Rick Strand Date: Wed, 7 Jun 2023 08:57:50 -0500 Subject: [PATCH 08/80] Another Round of Corrections Corrections made to address large differences in the results for several idfs and also to take care of some warning messages from the compiler. --- src/EnergyPlus/HighTempRadiantSystem.cc | 12 +++++++++--- src/EnergyPlus/HighTempRadiantSystem.hh | 6 +++--- src/EnergyPlus/SwimmingPool.cc | 11 +++++------ 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/EnergyPlus/HighTempRadiantSystem.cc b/src/EnergyPlus/HighTempRadiantSystem.cc index 2e5010ad0f1..a816cc12ee0 100644 --- a/src/EnergyPlus/HighTempRadiantSystem.cc +++ b/src/EnergyPlus/HighTempRadiantSystem.cc @@ -758,12 +758,18 @@ namespace HighTempRadiantSystem { } if (state.dataGlobal->BeginEnvrnFlag && state.dataHighTempRadSys->MyEnvrnFlag) { + for (HTRnum = 1; HTRnum <= state.dataHighTempRadSys->NumOfHighTempRadSys; ++HTRnum) { + auto &thisHTR = state.dataHighTempRadSys->HighTempRadSys(HTRnum); + thisHTR.ZeroHTRSourceSumHATsurf = 0.0; + thisHTR.QHTRRadSource = 0.0; + thisHTR.QHTRRadSrcAvg = 0.0; + thisHTR.LastQHTRRadSrc = 0.0; + thisHTR.LastSysTimeElapsed = 0.0; + thisHTR.LastTimeStepSys = 0.0; + } state.dataHighTempRadSys->MyEnvrnFlag = false; } if (!state.dataGlobal->BeginEnvrnFlag) { - for (HTRnum = 1; HTRnum <= state.dataHighTempRadSys->NumOfHighTempRadSys; ++HTRnum) { - state.dataHighTempRadSys->HighTempRadSys(HTRnum).LastQHTRRadSrc = 0.0; - } state.dataHighTempRadSys->MyEnvrnFlag = true; } diff --git a/src/EnergyPlus/HighTempRadiantSystem.hh b/src/EnergyPlus/HighTempRadiantSystem.hh index 302056d482e..6f7d836b1ba 100644 --- a/src/EnergyPlus/HighTempRadiantSystem.hh +++ b/src/EnergyPlus/HighTempRadiantSystem.hh @@ -146,9 +146,9 @@ namespace HighTempRadiantSystem { HighTempRadiantSystemData() : SchedPtr(0), ZonePtr(0), HeaterType(RadHeaterType::Invalid), MaxPowerCapac(0.0), CombustionEffic(0.0), FracRadiant(0.0), FracLatent(0.0), FracLost(0.0), FracConvect(0.0), ControlType(RadControlType::Invalid), ThrottlRange(0.0), SetptSchedPtr(0), - FracDistribPerson(0.0), TotSurfToDistrib(0), ElecPower(0.0), ElecEnergy(0.0), GasPower(0.0), GasEnergy(0.0), HeatPower(0.0), - HeatEnergy(0.0), HeatingCapMethod(0), ZeroHTRSourceSumHATsurf(0.0), QHTRRadSource(0.0), QHTRRadSrcAvg(0.0), LastSysTimeElapsed(0.0), - LastTimeStepSys(0.0), LastQHTRRadSrc(0.0), ScaledHeatingCapacity(0.0) + FracDistribPerson(0.0), TotSurfToDistrib(0), ZeroHTRSourceSumHATsurf(0.0), QHTRRadSource(0.0), QHTRRadSrcAvg(0.0), + LastSysTimeElapsed(0.0), LastTimeStepSys(0.0), LastQHTRRadSrc(0.0), ElecPower(0.0), ElecEnergy(0.0), GasPower(0.0), GasEnergy(0.0), + HeatPower(0.0), HeatEnergy(0.0), HeatingCapMethod(0), ScaledHeatingCapacity(0.0) { } }; diff --git a/src/EnergyPlus/SwimmingPool.cc b/src/EnergyPlus/SwimmingPool.cc index 7bf1af0aeb0..2f0c4a613c4 100644 --- a/src/EnergyPlus/SwimmingPool.cc +++ b/src/EnergyPlus/SwimmingPool.cc @@ -517,12 +517,11 @@ void SwimmingPoolData::initialize(EnergyPlusData &state, bool const FirstHVACIte int ZoneNum = this->ZonePtr; this->ZeroPoolSourceSumHATsurf = state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state); // Set this to figure what the impact of the swimming pool on all zone surfaces - int SurfNum = this->SurfacePtr; - this->QPoolSrcAvg = 0.0; // Initialize this variable to zero (pool parameters "off") - this->HeatTransCoefsAvg = 0.0; // Initialize this variable to zero (pool parameters "off") - this->LastQPoolSrc = 0.0; // At the start of a time step, reset to zero so average calculation can begin again - this->LastSysTimeElapsed = 0.0; // At the start of a time step, reset to zero so average calculation can begin again - this->LastTimeStepSys = 0.0; // At the start of a time step, reset to zero so average calculation can begin again + this->QPoolSrcAvg = 0.0; // Initialize this variable to zero (pool parameters "off") + this->HeatTransCoefsAvg = 0.0; // Initialize this variable to zero (pool parameters "off") + this->LastQPoolSrc = 0.0; // At the start of a time step, reset to zero so average calculation can begin again + this->LastSysTimeElapsed = 0.0; // At the start of a time step, reset to zero so average calculation can begin again + this->LastTimeStepSys = 0.0; // At the start of a time step, reset to zero so average calculation can begin again } // initialize the flow rate for the component on the plant side (this follows standard procedure for other components like low temperature From 2b2d4380057ba014b607eb7ef3482362bf076830 Mon Sep 17 00:00:00 2001 From: Rick Strand Date: Wed, 7 Jun 2023 10:38:55 -0500 Subject: [PATCH 09/80] Correction of Source to Avg Assignment Rewrite potentially lost some data transfer when one high temperature radiant heater was on--it broke out of the for loop and missed the remaining assignments. This is corrected here. --- src/EnergyPlus/HighTempRadiantSystem.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/EnergyPlus/HighTempRadiantSystem.cc b/src/EnergyPlus/HighTempRadiantSystem.cc index a816cc12ee0..ee039843701 100644 --- a/src/EnergyPlus/HighTempRadiantSystem.cc +++ b/src/EnergyPlus/HighTempRadiantSystem.cc @@ -1292,11 +1292,9 @@ namespace HighTempRadiantSystem { // If it was allocated, then we have to check to see if this was running at all... for (RadSysNum = 1; RadSysNum <= state.dataHighTempRadSys->NumOfHighTempRadSys; ++RadSysNum) { - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSource = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSrcAvg; - if (state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSrcAvg != 0.0) { - HighTempRadSysOn = true; - break; // DO loop - } + auto &thisHTR = state.dataHighTempRadSys->HighTempRadSys(RadSysNum); + thisHTR.QHTRRadSource = thisHTR.QHTRRadSrcAvg; + if (thisHTR.QHTRRadSrcAvg != 0.0) HighTempRadSysOn = true; } DistributeHTRadGains( From 9635292980f96603698371f2b30d57f6ba698bad Mon Sep 17 00:00:00 2001 From: Rick Strand Date: Thu, 8 Jun 2023 06:06:32 -0500 Subject: [PATCH 10/80] Clean up swimming pool Cudos to @rraustad for catching this before it became a new bug. --- src/EnergyPlus/SwimmingPool.cc | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/EnergyPlus/SwimmingPool.cc b/src/EnergyPlus/SwimmingPool.cc index 2f0c4a613c4..b1d7ef308a5 100644 --- a/src/EnergyPlus/SwimmingPool.cc +++ b/src/EnergyPlus/SwimmingPool.cc @@ -1045,16 +1045,11 @@ void UpdatePoolSourceValAvg(EnergyPlusData &state, bool &SwimmingPoolOn) // .TRU if (state.dataSwimmingPools->NumSwimmingPools == 0) return; for (int PoolNum = 1; PoolNum <= state.dataSwimmingPools->NumSwimmingPools; ++PoolNum) { - // Check to see if any of the pools were running at all - for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { - if (state.dataSwimmingPools->Pool(PoolNum).QPoolSrcAvg != 0.0) { - SwimmingPoolOn = true; - break; // DO loop - } - } - - state.dataHeatBalFanSys->QPoolSurfNumerator = state.dataSwimmingPools->Pool(PoolNum).QPoolSrcAvg; - state.dataHeatBalFanSys->PoolHeatTransCoefs = state.dataSwimmingPools->Pool(PoolNum).HeatTransCoefsAvg; + auto &thisPool = state.dataSwimmingPools->Pool(PoolNum); + if (thisPool.QPoolSrcAvg != 0.0) SwimmingPoolOn = true; + int SurfNum = thisPool.SurfacePtr; // surface number index + state.dataHeatBalFanSys->QPoolSurfNumerator(SurfNum) = thisPool.QPoolSrcAvg; + state.dataHeatBalFanSys->PoolHeatTransCoefs(SurfNum) = thisPool.HeatTransCoefsAvg; } // For interzone surfaces, modQPoolSrcAvg was only updated for the "active" side. The active side From d85c707ed6e5af6f61906ed1ff4980f68e12402a Mon Sep 17 00:00:00 2001 From: Rick Strand Date: Thu, 8 Jun 2023 11:00:23 -0500 Subject: [PATCH 11/80] Correction to HTR Got overly aggressive with a change, this impacted some initializations in the high temperature radiant heater (HTR). --- src/EnergyPlus/HighTempRadiantSystem.cc | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/EnergyPlus/HighTempRadiantSystem.cc b/src/EnergyPlus/HighTempRadiantSystem.cc index ee039843701..5566925f861 100644 --- a/src/EnergyPlus/HighTempRadiantSystem.cc +++ b/src/EnergyPlus/HighTempRadiantSystem.cc @@ -774,17 +774,15 @@ namespace HighTempRadiantSystem { } if (state.dataGlobal->BeginTimeStepFlag && FirstHVACIteration) { // This is the first pass through in a particular time step - for (HTRnum = 1; HTRnum <= state.dataHighTempRadSys->NumOfHighTempRadSys; ++HTRnum) { - auto &thisHTR = state.dataHighTempRadSys->HighTempRadSys(HTRnum); - ZoneNum = thisHTR.ZonePtr; - thisHTR.ZeroHTRSourceSumHATsurf = - state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state); // Set this to figure out what part of the load the radiant system meets - thisHTR.QHTRRadSource = 0.0; // Initialize this variable to zero (radiant system defaults to off) - thisHTR.QHTRRadSrcAvg = 0.0; // Initialize this variable to zero (radiant system defaults to off) - thisHTR.LastQHTRRadSrc = 0.0; // At the beginning of a time step, reset to zero so average calculation can start again - thisHTR.LastSysTimeElapsed = 0.0; // At the beginning of a time step, reset to zero so average calculation can start again - thisHTR.LastTimeStepSys = 0.0; // At the beginning of a time step, reset to zero so average calculation can start again - } + auto &thisHTR = state.dataHighTempRadSys->HighTempRadSys(RadSysNum); + ZoneNum = thisHTR.ZonePtr; + thisHTR.ZeroHTRSourceSumHATsurf = + state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state); // Set this to figure out what part of the load the radiant system meets + thisHTR.QHTRRadSource = 0.0; // Initialize this variable to zero (radiant system defaults to off) + thisHTR.QHTRRadSrcAvg = 0.0; // Initialize this variable to zero (radiant system defaults to off) + thisHTR.LastQHTRRadSrc = 0.0; // At the beginning of a time step, reset to zero so average calculation can start again + thisHTR.LastSysTimeElapsed = 0.0; // At the beginning of a time step, reset to zero so average calculation can start again + thisHTR.LastTimeStepSys = 0.0; // At the beginning of a time step, reset to zero so average calculation can start again } } From f41547b625b603c46e7ae0b1fbe54ec42ff3deb7 Mon Sep 17 00:00:00 2001 From: Rick Strand Date: Fri, 9 Jun 2023 08:58:26 -0500 Subject: [PATCH 12/80] Swimming Pool Unit Test and Steam Baseboard Fix Fixed some issues with the swimming pool and the steam baseboard that caused problems in the runs. --- src/EnergyPlus/SteamBaseboardRadiator.cc | 10 ++-- tst/EnergyPlus/unit/SwimmingPool.unit.cc | 67 +++++++++++------------- 2 files changed, 35 insertions(+), 42 deletions(-) diff --git a/src/EnergyPlus/SteamBaseboardRadiator.cc b/src/EnergyPlus/SteamBaseboardRadiator.cc index 93f29422333..6a3275352d1 100644 --- a/src/EnergyPlus/SteamBaseboardRadiator.cc +++ b/src/EnergyPlus/SteamBaseboardRadiator.cc @@ -1484,15 +1484,11 @@ namespace SteamBaseboardRadiator { // If it was allocated, then we have to check to see if this was running at all... for (BaseboardNum = 1; BaseboardNum <= state.dataSteamBaseboardRadiator->NumSteamBaseboards; ++BaseboardNum) { - if (state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).QBBSteamRadSrcAvg != 0.0) { - SteamBaseboardSysOn = true; - break; // DO loop - } + if (state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).QBBSteamRadSrcAvg != 0.0) SteamBaseboardSysOn = true; + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).QBBSteamRadSource = + state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).QBBSteamRadSrcAvg; } - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).QBBSteamRadSource = - state.dataSteamBaseboardRadiator->SteamBaseboard(BaseboardNum).QBBSteamRadSrcAvg; - DistributeBBSteamRadGains(state); // QBBSteamRadSource has been modified so we need to redistribute gains } diff --git a/tst/EnergyPlus/unit/SwimmingPool.unit.cc b/tst/EnergyPlus/unit/SwimmingPool.unit.cc index 8346745f0cf..bcdd188bd9c 100644 --- a/tst/EnergyPlus/unit/SwimmingPool.unit.cc +++ b/tst/EnergyPlus/unit/SwimmingPool.unit.cc @@ -374,10 +374,6 @@ TEST_F(EnergyPlusFixture, SwimmingPool_MultiplePoolUpdatePoolSourceValAvgTest) SurfData->TotSurfaces = 2; SurfData->Surface.allocate(SurfData->TotSurfaces); - for (int poolNum = 1; poolNum <= PoolData->NumSwimmingPools; ++poolNum) { - PoolData->Pool(poolNum).QPoolSrcAvg.allocate(SurfData->TotSurfaces); - PoolData->Pool(poolNum).HeatTransCoefsAvg.allocate(SurfData->TotSurfaces); - } Real64 noResult = -9999.0; HBFanData->QPoolSurfNumerator.allocate(SurfData->TotSurfaces); @@ -385,9 +381,10 @@ TEST_F(EnergyPlusFixture, SwimmingPool_MultiplePoolUpdatePoolSourceValAvgTest) HBFanData->PoolHeatTransCoefs.allocate(SurfData->TotSurfaces); HBFanData->PoolHeatTransCoefs = noResult; - for (int surfNum = 1; surfNum <= SurfData->TotSurfaces; ++surfNum) { - SurfData->Surface(surfNum).ExtBoundCond = 0; // All connected to exterior - } + SurfData->Surface(1).ExtBoundCond = 0; // All connected to exterior + SurfData->Surface(2).ExtBoundCond = 0; // All connected to exterior + Pool1Data.SurfacePtr = 1; + Pool2Data.SurfacePtr = 2; // Test 1: both pools off Pool1Data.QPoolSrcAvg = 0.0; @@ -401,16 +398,16 @@ TEST_F(EnergyPlusFixture, SwimmingPool_MultiplePoolUpdatePoolSourceValAvgTest) // Test data transfer EXPECT_FALSE(poolOnFlag); - EXPECT_NEAR(HBFanData->QPoolSurfNumerator(1), noResult, closeEnough); - EXPECT_NEAR(HBFanData->QPoolSurfNumerator(2), noResult, closeEnough); - EXPECT_NEAR(HBFanData->PoolHeatTransCoefs(1), noResult, closeEnough); - EXPECT_NEAR(HBFanData->PoolHeatTransCoefs(2), noResult, closeEnough); + EXPECT_NEAR(HBFanData->QPoolSurfNumerator(1), 0.0, closeEnough); + EXPECT_NEAR(HBFanData->QPoolSurfNumerator(2), 0.0, closeEnough); + EXPECT_NEAR(HBFanData->PoolHeatTransCoefs(1), 0.0, closeEnough); + EXPECT_NEAR(HBFanData->PoolHeatTransCoefs(2), 0.0, closeEnough); // Test 2a: pool 1 on, pool 2 off - Pool1Data.QPoolSrcAvg(1) = 100.0; - Pool1Data.HeatTransCoefsAvg(1) = 10.0; - Pool2Data.QPoolSrcAvg(2) = 0.0; - Pool2Data.HeatTransCoefsAvg(2) = 0.0; + Pool1Data.QPoolSrcAvg = 100.0; + Pool1Data.HeatTransCoefsAvg = 10.0; + Pool2Data.QPoolSrcAvg = 0.0; + Pool2Data.HeatTransCoefsAvg = 0.0; HBFanData->QPoolSurfNumerator = noResult; HBFanData->PoolHeatTransCoefs = noResult; @@ -420,16 +417,16 @@ TEST_F(EnergyPlusFixture, SwimmingPool_MultiplePoolUpdatePoolSourceValAvgTest) // Test data transfer EXPECT_TRUE(poolOnFlag); - EXPECT_NEAR(HBFanData->QPoolSurfNumerator(1), Pool1Data.QPoolSrcAvg(1), closeEnough); - EXPECT_NEAR(HBFanData->QPoolSurfNumerator(2), noResult, closeEnough); - EXPECT_NEAR(HBFanData->PoolHeatTransCoefs(1), Pool1Data.HeatTransCoefsAvg(1), closeEnough); - EXPECT_NEAR(HBFanData->PoolHeatTransCoefs(2), noResult, closeEnough); + EXPECT_NEAR(HBFanData->QPoolSurfNumerator(1), Pool1Data.QPoolSrcAvg, closeEnough); + EXPECT_NEAR(HBFanData->QPoolSurfNumerator(2), 0.0, closeEnough); + EXPECT_NEAR(HBFanData->PoolHeatTransCoefs(1), Pool1Data.HeatTransCoefsAvg, closeEnough); + EXPECT_NEAR(HBFanData->PoolHeatTransCoefs(2), 0.0, closeEnough); // Test 2b: pool 1 off, pool 2 on - Pool1Data.QPoolSrcAvg(1) = 0.0; - Pool1Data.HeatTransCoefsAvg(1) = 0.0; - Pool2Data.QPoolSrcAvg(2) = 200.0; - Pool2Data.HeatTransCoefsAvg(2) = 20.0; + Pool1Data.QPoolSrcAvg = 0.0; + Pool1Data.HeatTransCoefsAvg = 0.0; + Pool2Data.QPoolSrcAvg = 200.0; + Pool2Data.HeatTransCoefsAvg = 20.0; HBFanData->QPoolSurfNumerator = noResult; HBFanData->PoolHeatTransCoefs = noResult; @@ -439,16 +436,16 @@ TEST_F(EnergyPlusFixture, SwimmingPool_MultiplePoolUpdatePoolSourceValAvgTest) // Test data transfer EXPECT_TRUE(poolOnFlag); - EXPECT_NEAR(HBFanData->QPoolSurfNumerator(1), noResult, closeEnough); - EXPECT_NEAR(HBFanData->QPoolSurfNumerator(2), Pool2Data.QPoolSrcAvg(2), closeEnough); - EXPECT_NEAR(HBFanData->PoolHeatTransCoefs(1), noResult, closeEnough); - EXPECT_NEAR(HBFanData->PoolHeatTransCoefs(2), Pool2Data.HeatTransCoefsAvg(2), closeEnough); + EXPECT_NEAR(HBFanData->QPoolSurfNumerator(1), 0.0, closeEnough); + EXPECT_NEAR(HBFanData->QPoolSurfNumerator(2), Pool2Data.QPoolSrcAvg, closeEnough); + EXPECT_NEAR(HBFanData->PoolHeatTransCoefs(1), 0.0, closeEnough); + EXPECT_NEAR(HBFanData->PoolHeatTransCoefs(2), Pool2Data.HeatTransCoefsAvg, closeEnough); // Test 3: both pools on - Pool1Data.QPoolSrcAvg(1) = 100.0; - Pool1Data.HeatTransCoefsAvg(1) = 10.0; - Pool2Data.QPoolSrcAvg(2) = 200.0; - Pool2Data.HeatTransCoefsAvg(2) = 20.0; + Pool1Data.QPoolSrcAvg = 100.0; + Pool1Data.HeatTransCoefsAvg = 10.0; + Pool2Data.QPoolSrcAvg = 200.0; + Pool2Data.HeatTransCoefsAvg = 20.0; HBFanData->QPoolSurfNumerator = noResult; HBFanData->PoolHeatTransCoefs = noResult; @@ -458,8 +455,8 @@ TEST_F(EnergyPlusFixture, SwimmingPool_MultiplePoolUpdatePoolSourceValAvgTest) // Test data transfer EXPECT_TRUE(poolOnFlag); - EXPECT_NEAR(HBFanData->QPoolSurfNumerator(1), Pool1Data.QPoolSrcAvg(1), closeEnough); - EXPECT_NEAR(HBFanData->QPoolSurfNumerator(2), Pool2Data.QPoolSrcAvg(2), closeEnough); - EXPECT_NEAR(HBFanData->PoolHeatTransCoefs(1), Pool1Data.HeatTransCoefsAvg(1), closeEnough); - EXPECT_NEAR(HBFanData->PoolHeatTransCoefs(2), Pool2Data.HeatTransCoefsAvg(2), closeEnough); + EXPECT_NEAR(HBFanData->QPoolSurfNumerator(1), Pool1Data.QPoolSrcAvg, closeEnough); + EXPECT_NEAR(HBFanData->QPoolSurfNumerator(2), Pool2Data.QPoolSrcAvg, closeEnough); + EXPECT_NEAR(HBFanData->PoolHeatTransCoefs(1), Pool1Data.HeatTransCoefsAvg, closeEnough); + EXPECT_NEAR(HBFanData->PoolHeatTransCoefs(2), Pool2Data.HeatTransCoefsAvg, closeEnough); } From 66094ffd55ecbaebfa9674141cc36acbf91aff7c Mon Sep 17 00:00:00 2001 From: Rick Strand Date: Wed, 14 Jun 2023 15:31:03 -0500 Subject: [PATCH 13/80] Additional changes to certain models Additional changes specific to models that impact the surface heat balances, requiring a slightly different approach. --- src/EnergyPlus/LowTempRadiantSystem.cc | 151 +++++++++++++++---------- src/EnergyPlus/LowTempRadiantSystem.hh | 15 +-- src/EnergyPlus/VentilatedSlab.cc | 56 ++++----- src/EnergyPlus/VentilatedSlab.hh | 30 +++-- 4 files changed, 132 insertions(+), 120 deletions(-) diff --git a/src/EnergyPlus/LowTempRadiantSystem.cc b/src/EnergyPlus/LowTempRadiantSystem.cc index 49123698a17..5cc0838af56 100644 --- a/src/EnergyPlus/LowTempRadiantSystem.cc +++ b/src/EnergyPlus/LowTempRadiantSystem.cc @@ -1972,10 +1972,27 @@ namespace LowTempRadiantSystem { if (state.dataLowTempRadSys->FirstTimeInit) { - state.dataLowTempRadSys->QRadSysSrcAvg.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataLowTempRadSys->LastQRadSysSrc.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataLowTempRadSys->LastSysTimeElapsed.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataLowTempRadSys->LastTimeStepSys.dimension(state.dataSurface->TotSurfaces, 0.0); + for (RadNum = 1; RadNum <= state.dataLowTempRadSys->NumOfHydrLowTempRadSys; ++RadNum) { + auto &thisLTR = state.dataLowTempRadSys->HydrRadSys(RadNum); + thisLTR.QRadSysSrcAvg.dimension(thisLTR.NumOfSurfaces, 0.0); + thisLTR.LastQRadSysSrc.dimension(thisLTR.NumOfSurfaces, 0.0); + thisLTR.LastSysTimeElapsed.dimension(thisLTR.NumOfSurfaces, 0.0); + thisLTR.LastTimeStepSys.dimension(thisLTR.NumOfSurfaces, 0.0); + } + for (RadNum = 1; RadNum <= state.dataLowTempRadSys->NumOfCFloLowTempRadSys; ++RadNum) { + auto &thisLTR = state.dataLowTempRadSys->CFloRadSys(RadNum); + thisLTR.QRadSysSrcAvg.dimension(thisLTR.NumOfSurfaces, 0.0); + thisLTR.LastQRadSysSrc.dimension(thisLTR.NumOfSurfaces, 0.0); + thisLTR.LastSysTimeElapsed.dimension(thisLTR.NumOfSurfaces, 0.0); + thisLTR.LastTimeStepSys.dimension(thisLTR.NumOfSurfaces, 0.0); + } + for (RadNum = 1; RadNum <= state.dataLowTempRadSys->NumOfElecLowTempRadSys; ++RadNum) { + auto &thisLTR = state.dataLowTempRadSys->ElecRadSys(RadNum); + thisLTR.QRadSysSrcAvg.dimension(thisLTR.NumOfSurfaces, 0.0); + thisLTR.LastQRadSysSrc.dimension(thisLTR.NumOfSurfaces, 0.0); + thisLTR.LastSysTimeElapsed.dimension(thisLTR.NumOfSurfaces, 0.0); + thisLTR.LastTimeStepSys.dimension(thisLTR.NumOfSurfaces, 0.0); + } state.dataLowTempRadSys->MySizeFlagHydr.allocate(state.dataLowTempRadSys->NumOfHydrLowTempRadSys); state.dataLowTempRadSys->MySizeFlagCFlo.allocate(state.dataLowTempRadSys->NumOfCFloLowTempRadSys); state.dataLowTempRadSys->MySizeFlagElec.allocate(state.dataLowTempRadSys->NumOfElecLowTempRadSys); @@ -2276,16 +2293,27 @@ namespace LowTempRadiantSystem { if (state.dataGlobal->BeginEnvrnFlag && state.dataLowTempRadSys->MyEnvrnFlagGeneral) { if (SystemType == LowTempRadiantSystem::SystemType::HydronicSystem) { - state.dataLowTempRadSys->HydrRadSys(RadSysNum).ZeroLTRSourceSumHATsurf = 0.0; + auto &thisLTR = state.dataLowTempRadSys->HydrRadSys(RadSysNum); + thisLTR.ZeroLTRSourceSumHATsurf = 0.0; + thisLTR.QRadSysSrcAvg = 0.0; + thisLTR.LastQRadSysSrc = 0.0; + thisLTR.LastSysTimeElapsed = 0.0; + thisLTR.LastTimeStepSys = 0.0; } else if (SystemType == LowTempRadiantSystem::SystemType::ConstantFlowSystem) { - state.dataLowTempRadSys->CFloRadSys(RadSysNum).ZeroLTRSourceSumHATsurf = 0.0; + auto &thisLTR = state.dataLowTempRadSys->CFloRadSys(RadSysNum); + thisLTR.ZeroLTRSourceSumHATsurf = 0.0; + thisLTR.QRadSysSrcAvg = 0.0; + thisLTR.LastQRadSysSrc = 0.0; + thisLTR.LastSysTimeElapsed = 0.0; + thisLTR.LastTimeStepSys = 0.0; } else if (SystemType == LowTempRadiantSystem::SystemType::ElectricSystem) { - state.dataLowTempRadSys->ElecRadSys(RadSysNum).ZeroLTRSourceSumHATsurf = 0.0; + auto &thisLTR = state.dataLowTempRadSys->ElecRadSys(RadSysNum); + thisLTR.ZeroLTRSourceSumHATsurf = 0.0; + thisLTR.QRadSysSrcAvg = 0.0; + thisLTR.LastQRadSysSrc = 0.0; + thisLTR.LastSysTimeElapsed = 0.0; + thisLTR.LastTimeStepSys = 0.0; } - state.dataLowTempRadSys->QRadSysSrcAvg = 0.0; - state.dataLowTempRadSys->LastQRadSysSrc = 0.0; - state.dataLowTempRadSys->LastSysTimeElapsed = 0.0; - state.dataLowTempRadSys->LastTimeStepSys = 0.0; state.dataLowTempRadSys->MyEnvrnFlagGeneral = false; } if (!state.dataGlobal->BeginEnvrnFlag) state.dataLowTempRadSys->MyEnvrnFlagGeneral = true; @@ -2432,48 +2460,33 @@ namespace LowTempRadiantSystem { switch (SystemType) { case LowTempRadiantSystem::SystemType::HydronicSystem: { ZoneNum = state.dataLowTempRadSys->HydrRadSys(RadSysNum).ZonePtr; - state.dataLowTempRadSys->HydrRadSys(RadSysNum).ZeroLTRSourceSumHATsurf = + auto &thisLTR = state.dataLowTempRadSys->HydrRadSys(RadSysNum); + thisLTR.ZeroLTRSourceSumHATsurf = state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state); // Set this to figure what part of the load the radiant system meets - for (RadSurfNum = 1; RadSurfNum <= state.dataLowTempRadSys->HydrRadSys(RadSysNum).NumOfSurfaces; ++RadSurfNum) { - SurfNum = state.dataLowTempRadSys->HydrRadSys(RadSysNum).SurfacePtr(RadSurfNum); - state.dataLowTempRadSys->QRadSysSrcAvg(SurfNum) = 0.0; // Initialize this variable to zero (radiant system defaults to off) - state.dataLowTempRadSys->LastQRadSysSrc(SurfNum) = - 0.0; // At the start of a time step, reset to zero so average calculation can begin again - state.dataLowTempRadSys->LastSysTimeElapsed(SurfNum) = - 0.0; // At the start of a time step, reset to zero so average calculation can begin again - state.dataLowTempRadSys->LastTimeStepSys(SurfNum) = - 0.0; // At the start of a time step, reset to zero so average calculation can begin again - } + thisLTR.QRadSysSrcAvg = 0.0; // Initialize this variable to zero (radiant system defaults to off) + thisLTR.LastQRadSysSrc = 0.0; // At the start of a time step, reset to zero so average calculation can begin again + thisLTR.LastSysTimeElapsed = 0.0; // At the start of a time step, reset to zero so average calculation can begin again + thisLTR.LastTimeStepSys = 0.0; // At the start of a time step, reset to zero so average calculation can begin again } } break; case LowTempRadiantSystem::SystemType::ConstantFlowSystem: { ZoneNum = state.dataLowTempRadSys->CFloRadSys(RadSysNum).ZonePtr; - state.dataLowTempRadSys->CFloRadSys(RadSysNum).ZeroLTRSourceSumHATsurf = + auto &thisLTR = state.dataLowTempRadSys->CFloRadSys(RadSysNum); + thisLTR.ZeroLTRSourceSumHATsurf = state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state); // Set this to figure what part of the load the radiant system meets - for (RadSurfNum = 1; RadSurfNum <= state.dataLowTempRadSys->CFloRadSys(RadSysNum).NumOfSurfaces; ++RadSurfNum) { - SurfNum = state.dataLowTempRadSys->CFloRadSys(RadSysNum).SurfacePtr(RadSurfNum); - state.dataLowTempRadSys->QRadSysSrcAvg(SurfNum) = 0.0; // Initialize this variable to zero (radiant system defaults to off) - state.dataLowTempRadSys->LastQRadSysSrc(SurfNum) = - 0.0; // At the start of a time step, reset to zero so average calculation can begin again - state.dataLowTempRadSys->LastSysTimeElapsed(SurfNum) = - 0.0; // At the start of a time step, reset to zero so average calculation can begin again - state.dataLowTempRadSys->LastTimeStepSys(SurfNum) = - 0.0; // At the start of a time step, reset to zero so average calculation can begin again - } + thisLTR.QRadSysSrcAvg = 0.0; // Initialize this variable to zero (radiant system defaults to off) + thisLTR.LastQRadSysSrc = 0.0; // At the start of a time step, reset to zero so average calculation can begin again + thisLTR.LastSysTimeElapsed = 0.0; // At the start of a time step, reset to zero so average calculation can begin again + thisLTR.LastTimeStepSys = 0.0; // At the start of a time step, reset to zero so average calculation can begin again } } break; case LowTempRadiantSystem::SystemType::ElectricSystem: { ZoneNum = state.dataLowTempRadSys->ElecRadSys(RadSysNum).ZonePtr; - state.dataLowTempRadSys->ElecRadSys(RadSysNum).ZeroLTRSourceSumHATsurf = + auto &thisLTR = state.dataLowTempRadSys->ElecRadSys(RadSysNum); + thisLTR.ZeroLTRSourceSumHATsurf = state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state); // Set this to figure what part of the load the radiant system meets - for (RadSurfNum = 1; RadSurfNum <= state.dataLowTempRadSys->ElecRadSys(RadSysNum).NumOfSurfaces; ++RadSurfNum) { - SurfNum = state.dataLowTempRadSys->ElecRadSys(RadSysNum).SurfacePtr(RadSurfNum); - state.dataLowTempRadSys->QRadSysSrcAvg(SurfNum) = 0.0; // Initialize this variable to zero (radiant system defaults to off) - state.dataLowTempRadSys->LastQRadSysSrc(SurfNum) = - 0.0; // At the start of a time step, reset to zero so average calculation can begin again - state.dataLowTempRadSys->LastSysTimeElapsed(SurfNum) = - 0.0; // At the start of a time step, reset to zero so average calculation can begin again - state.dataLowTempRadSys->LastTimeStepSys(SurfNum) = - 0.0; // At the start of a time step, reset to zero so average calculation can begin again - } + thisLTR.QRadSysSrcAvg = 0.0; // Initialize this variable to zero (radiant system defaults to off) + thisLTR.LastQRadSysSrc = 0.0; // At the start of a time step, reset to zero so average calculation can begin again + thisLTR.LastSysTimeElapsed = 0.0; // At the start of a time step, reset to zero so average calculation can begin again + thisLTR.LastTimeStepSys = 0.0; // At the start of a time step, reset to zero so average calculation can begin again } } break; default: { ShowSevereError(state, "Radiant system entered without specification of type: electric, constant flow, or hydronic?"); @@ -5355,25 +5368,24 @@ namespace LowTempRadiantSystem { Real64 TimeStepSys = state.dataHVACGlobal->TimeStepSys; Real64 SysTimeElapsed = state.dataHVACGlobal->SysTimeElapsed; + Real64 TimeStepZone = state.dataGlobal->TimeStepZone; for (int radSurfNum = 1; radSurfNum <= this->NumOfSurfaces; ++radSurfNum) { int surfNum = this->SurfacePtr(radSurfNum); - if (state.dataLowTempRadSys->LastSysTimeElapsed(surfNum) == SysTimeElapsed) { + if (this->LastSysTimeElapsed(radSurfNum) == SysTimeElapsed) { // Still iterating or reducing system time step, so subtract old values which were // not valid - state.dataLowTempRadSys->QRadSysSrcAvg(surfNum) -= state.dataLowTempRadSys->LastQRadSysSrc(surfNum) * - state.dataLowTempRadSys->LastTimeStepSys(surfNum) / state.dataGlobal->TimeStepZone; + this->QRadSysSrcAvg(radSurfNum) -= this->LastQRadSysSrc(radSurfNum) * this->LastTimeStepSys(radSurfNum) / TimeStepZone; } // Update the running average and the "last" values with the current values of the appropriate variables - state.dataLowTempRadSys->QRadSysSrcAvg(surfNum) += - state.dataHeatBalFanSys->QRadSysSource(surfNum) * TimeStepSys / state.dataGlobal->TimeStepZone; + this->QRadSysSrcAvg(radSurfNum) += state.dataHeatBalFanSys->QRadSysSource(surfNum) * TimeStepSys / TimeStepZone; - state.dataLowTempRadSys->LastQRadSysSrc(surfNum) = state.dataHeatBalFanSys->QRadSysSource(surfNum); - state.dataLowTempRadSys->LastSysTimeElapsed(surfNum) = SysTimeElapsed; - state.dataLowTempRadSys->LastTimeStepSys(surfNum) = TimeStepSys; + this->LastQRadSysSrc(radSurfNum) = state.dataHeatBalFanSys->QRadSysSource(surfNum); + this->LastSysTimeElapsed(radSurfNum) = SysTimeElapsed; + this->LastTimeStepSys(radSurfNum) = TimeStepSys; } } @@ -5930,22 +5942,39 @@ namespace LowTempRadiantSystem { LowTempRadSysOn = false; - // If this was never allocated, then there are no radiant systems in this input file (just RETURN) - if (!allocated(state.dataLowTempRadSys->QRadSysSrcAvg)) return; + // If there are no radiant systems in this input file, just RETURN + if (state.dataLowTempRadSys->TotalNumOfRadSystems == 0) return; // If it was allocated, then we have to check to see if this was running at all... - for (SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { - if (state.dataLowTempRadSys->QRadSysSrcAvg(SurfNum) != 0.0) { - LowTempRadSysOn = true; - break; // DO loop + for (int numRadSys = 1; numRadSys <= state.dataLowTempRadSys->NumOfHydrLowTempRadSys; ++numRadSys) { + auto &thisLTR = state.dataLowTempRadSys->HydrRadSys(numRadSys); + for (int numRadSurf = 1; numRadSurf <= thisLTR.NumOfSurfaces; ++numRadSurf) { + if (thisLTR.QRadSysSrcAvg(numRadSurf) != 0.0) LowTempRadSysOn = true; + SurfNum = thisLTR.SurfacePtr(numRadSurf); + state.dataHeatBalFanSys->QRadSysSource(SurfNum) = thisLTR.QRadSysSrcAvg(numRadSurf); + } + } + for (int numRadSys = 1; numRadSys <= state.dataLowTempRadSys->NumOfCFloLowTempRadSys; ++numRadSys) { + auto &thisLTR = state.dataLowTempRadSys->CFloRadSys(numRadSys); + for (int numRadSurf = 1; numRadSurf <= thisLTR.NumOfSurfaces; ++numRadSurf) { + if (thisLTR.QRadSysSrcAvg(numRadSurf) != 0.0) LowTempRadSysOn = true; + SurfNum = thisLTR.SurfacePtr(numRadSurf); + state.dataHeatBalFanSys->QRadSysSource(SurfNum) = thisLTR.QRadSysSrcAvg(numRadSurf); + } + } + for (int numRadSys = 1; numRadSys <= state.dataLowTempRadSys->NumOfElecLowTempRadSys; ++numRadSys) { + auto &thisLTR = state.dataLowTempRadSys->ElecRadSys(numRadSys); + for (int numRadSurf = 1; numRadSurf <= thisLTR.NumOfSurfaces; ++numRadSurf) { + if (thisLTR.QRadSysSrcAvg(numRadSurf) != 0.0) LowTempRadSysOn = true; + SurfNum = thisLTR.SurfacePtr(numRadSurf); + state.dataHeatBalFanSys->QRadSysSource(SurfNum) = thisLTR.QRadSysSrcAvg(numRadSurf); } } - state.dataHeatBalFanSys->QRadSysSource = state.dataLowTempRadSys->QRadSysSrcAvg; auto &Surface = state.dataSurface->Surface; - // For interzone surfaces, QRadSysSrcAvg was only updated for the "active" side. The active side - // would have a non-zero value at this point. If the numbers differ, then we have to manually update. + // For interzone surfaces, QRadSysSource was only updated for the "active" side. The + // active side would have a non-zero value at this point. If the numbers differ, then we have to manually update. for (SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) { if (Surface(SurfNum).ExtBoundCond > 0 && Surface(SurfNum).ExtBoundCond != SurfNum) { if (std::abs(state.dataHeatBalFanSys->QRadSysSource(SurfNum) - diff --git a/src/EnergyPlus/LowTempRadiantSystem.hh b/src/EnergyPlus/LowTempRadiantSystem.hh index cbadab4f327..f3679c86d8a 100644 --- a/src/EnergyPlus/LowTempRadiantSystem.hh +++ b/src/EnergyPlus/LowTempRadiantSystem.hh @@ -151,6 +151,11 @@ namespace LowTempRadiantSystem { Array1D SurfaceFrac; // Fraction of flow/pipe length or electric power for a particular surface Real64 TotalSurfaceArea = 0.0; // Total surface area for all surfaces that are part of this radiant system Real64 ZeroLTRSourceSumHATsurf = 0.0; // Equal to SumHATsurf for all the walls in a zone with no source + Array1D QRadSysSrcAvg; // Average source over the time step for a particular radiant surface + // Record keeping variables used to calculate QRadSysSrcAvg locally + Array1D LastQRadSysSrc; // Need to keep the last value in case we are still iterating + Array1D LastSysTimeElapsed; // Need to keep the last value in case we are still iterating + Array1D LastTimeStepSys; // Need to keep the last value in case we are still iterating LowTempRadiantControlTypes controlType = LowTempRadiantControlTypes::MATControl; // Control type for the system (MAT, MRT, Op temp, ODB, OWB, // Surface Face Temp, Surface Interior Temp, Running Mean // Temp for Constant Flow systems only) @@ -568,12 +573,6 @@ struct LowTempRadiantSystemData : BaseGlobalStruct Real64 LowTempHeating = -200.0; // Used to indicate that a user does not have a heating control temperature Real64 HighTempCooling = 200.0; // Used to indicate that a user does not have a cooling control temperature - Array1D QRadSysSrcAvg; // Average source over the time step for a particular radiant surface - // Record keeping variables used to calculate QRadSysSrcAvg locally - Array1D LastQRadSysSrc; // Need to keep the last value in case we are still iterating - Array1D LastSysTimeElapsed; // Need to keep the last value in case we are still iterating - Array1D LastTimeStepSys; // Need to keep the last value in case we are still iterating - Array1D Ckj; // Coefficients for individual surfaces within a radiant system Array1D Cmj; Array1D WaterTempOut; // Array of outlet water temperatures for @@ -629,10 +628,6 @@ struct LowTempRadiantSystemData : BaseGlobalStruct warnTooHigh = false; // - QRadSysSrcAvg.clear(); - LastQRadSysSrc.clear(); - LastSysTimeElapsed.clear(); - LastTimeStepSys.clear(); Ckj.clear(); Cmj.clear(); WaterTempOut.clear(); diff --git a/src/EnergyPlus/VentilatedSlab.cc b/src/EnergyPlus/VentilatedSlab.cc index 70f550e3b7f..b191dda3d77 100644 --- a/src/EnergyPlus/VentilatedSlab.cc +++ b/src/EnergyPlus/VentilatedSlab.cc @@ -1539,18 +1539,19 @@ namespace VentilatedSlab { state.dataVentilatedSlab->MySizeFlag.allocate(state.dataVentilatedSlab->NumOfVentSlabs); state.dataVentilatedSlab->MyPlantScanFlag.allocate(state.dataVentilatedSlab->NumOfVentSlabs); state.dataVentilatedSlab->MyZoneEqFlag.allocate(state.dataVentilatedSlab->NumOfVentSlabs); - state.dataVentilatedSlab->QRadSysSrcAvg.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataVentilatedSlab->LastQRadSysSrc.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataVentilatedSlab->LastSysTimeElapsed.dimension(state.dataSurface->TotSurfaces, 0.0); - state.dataVentilatedSlab->LastTimeStepSys.dimension(state.dataSurface->TotSurfaces, 0.0); - // Initialize total areas for all radiant systems + // Initialize total areas for all radiant systems and dimension record keeping arrays for (RadNum = 1; RadNum <= state.dataVentilatedSlab->NumOfVentSlabs; ++RadNum) { state.dataVentilatedSlab->VentSlab(RadNum).TotalSurfaceArea = 0.0; - for (SurfNum = 1; SurfNum <= state.dataVentilatedSlab->VentSlab(RadNum).NumOfSurfaces; ++SurfNum) { - state.dataVentilatedSlab->VentSlab(RadNum).TotalSurfaceArea += - state.dataSurface->Surface(state.dataVentilatedSlab->VentSlab(RadNum).SurfacePtr(SurfNum)).Area; + auto &numRadSurfs = state.dataVentilatedSlab->VentSlab(RadNum).NumOfSurfaces; + auto &thisVentSlab = state.dataVentilatedSlab->VentSlab(RadNum); + for (SurfNum = 1; SurfNum <= numRadSurfs; ++SurfNum) { + thisVentSlab.TotalSurfaceArea += state.dataSurface->Surface(thisVentSlab.SurfacePtr(SurfNum)).Area; } + thisVentSlab.QRadSysSrcAvg.dimension(numRadSurfs, 0.0); + thisVentSlab.LastQRadSysSrc.dimension(numRadSurfs, 0.0); + thisVentSlab.LastSysTimeElapsed.dimension(numRadSurfs, 0.0); + thisVentSlab.LastTimeStepSys.dimension(numRadSurfs, 0.0); } state.dataVentilatedSlab->MyEnvrnFlag = true; state.dataVentilatedSlab->MySizeFlag = true; @@ -1629,11 +1630,6 @@ namespace VentilatedSlab { OutsideAirNode = ventSlab.OutsideAirNode; RhoAir = state.dataEnvrn->StdRhoAir; - // "Radiant" Source Part - state.dataVentilatedSlab->QRadSysSrcAvg = 0.0; - state.dataVentilatedSlab->LastQRadSysSrc = 0.0; - state.dataVentilatedSlab->LastSysTimeElapsed = 0.0; - state.dataVentilatedSlab->LastTimeStepSys = 0.0; if (state.dataVentilatedSlab->NumOfVentSlabs > 0) { for (auto &e : state.dataVentilatedSlab->VentSlab) { e.ZeroVentSlabSourceSumHATsurf = 0.0; @@ -1641,6 +1637,10 @@ namespace VentilatedSlab { e.RadHeatingEnergy = 0.0; e.RadCoolingPower = 0.0; e.RadCoolingEnergy = 0.0; + e.QRadSysSrcAvg = 0.0; + e.LastQRadSysSrc = 0.0; + e.LastSysTimeElapsed = 0.0; + e.LastTimeStepSys = 0.0; } } @@ -1768,16 +1768,10 @@ namespace VentilatedSlab { ZoneNum = ventSlab.ZonePtr; ventSlab.ZeroVentSlabSourceSumHATsurf = state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state); // Set this to figure what part of the load the radiant system meets - for (RadSurfNum = 1; RadSurfNum <= ventSlab.NumOfSurfaces; ++RadSurfNum) { - SurfNum = ventSlab.SurfacePtr(RadSurfNum); - state.dataVentilatedSlab->QRadSysSrcAvg(SurfNum) = 0.0; // Initialize this variable to zero (radiant system defaults to off) - state.dataVentilatedSlab->LastQRadSysSrc(SurfNum) = - 0.0; // At the start of a time step, reset to zero so average calculation can begin again - state.dataVentilatedSlab->LastSysTimeElapsed(SurfNum) = - 0.0; // At the start of a time step, reset to zero so average calculation can begin again - state.dataVentilatedSlab->LastTimeStepSys(SurfNum) = - 0.0; // At the start of a time step, reset to zero so average calculation can begin again - } + ventSlab.QRadSysSrcAvg = 0.0; // Initialize this variable to zero (radiant system defaults to off) + ventSlab.LastQRadSysSrc = 0.0; // At the start of a time step, reset to zero so average calculation can begin again + ventSlab.LastSysTimeElapsed = 0.0; // At the start of a time step, reset to zero so average calculation can begin again + ventSlab.LastTimeStepSys = 0.0; // At the start of a time step, reset to zero so average calculation can begin again } } @@ -4480,21 +4474,19 @@ namespace VentilatedSlab { SurfNum = ventSlab.SurfacePtr(RadSurfNum); - if (state.dataVentilatedSlab->LastSysTimeElapsed(SurfNum) == SysTimeElapsed) { + if (ventSlab.LastSysTimeElapsed(RadSurfNum) == SysTimeElapsed) { // Still iterating or reducing system time step, so subtract old values which were // not valid - state.dataVentilatedSlab->QRadSysSrcAvg(SurfNum) -= state.dataVentilatedSlab->LastQRadSysSrc(SurfNum) * - state.dataVentilatedSlab->LastTimeStepSys(SurfNum) / - state.dataGlobal->TimeStepZone; + ventSlab.QRadSysSrcAvg(RadSurfNum) -= + ventSlab.LastQRadSysSrc(RadSurfNum) * ventSlab.LastTimeStepSys(RadSurfNum) / state.dataGlobal->TimeStepZone; } // Update the running average and the "last" values with the current values of the appropriate variables - state.dataVentilatedSlab->QRadSysSrcAvg(SurfNum) += - state.dataHeatBalFanSys->QRadSysSource(SurfNum) * TimeStepSys / state.dataGlobal->TimeStepZone; + ventSlab.QRadSysSrcAvg(RadSurfNum) += state.dataHeatBalFanSys->QRadSysSource(SurfNum) * TimeStepSys / state.dataGlobal->TimeStepZone; - state.dataVentilatedSlab->LastQRadSysSrc(SurfNum) = state.dataHeatBalFanSys->QRadSysSource(SurfNum); - state.dataVentilatedSlab->LastSysTimeElapsed(SurfNum) = SysTimeElapsed; - state.dataVentilatedSlab->LastTimeStepSys(SurfNum) = TimeStepSys; + ventSlab.LastQRadSysSrc(RadSurfNum) = state.dataHeatBalFanSys->QRadSysSource(SurfNum); + ventSlab.LastSysTimeElapsed(RadSurfNum) = SysTimeElapsed; + ventSlab.LastTimeStepSys(RadSurfNum) = TimeStepSys; } // First sum up all of the heat sources/sinks associated with this system diff --git a/src/EnergyPlus/VentilatedSlab.hh b/src/EnergyPlus/VentilatedSlab.hh index c33c9a02759..bd329a21817 100644 --- a/src/EnergyPlus/VentilatedSlab.hh +++ b/src/EnergyPlus/VentilatedSlab.hh @@ -276,6 +276,11 @@ namespace VentilatedSlab { int HVACSizingIndex; // index of a HVACSizing object for a ventilator slab bool FirstPass; // detects first time through for resetting sizing data Real64 ZeroVentSlabSourceSumHATsurf; // Equal to SumHATsurf for all the walls in a zone with no source + Array1D QRadSysSrcAvg; // Average source over the time step for a particular radiant surfaceD + // Record keeping variables used to calculate QRadSysSrcAvg locally + Array1D LastQRadSysSrc; // Need to keep the last value in case we are still iterating + Array1D LastSysTimeElapsed; // Need to keep the last value in case we are still iterating + Array1D LastTimeStepSys; // Need to keep the last value in case we are still iterating // Default Constructor VentilatedSlabData() @@ -298,7 +303,8 @@ namespace VentilatedSlab { RadHeatingEnergy(0.0), RadCoolingPower(0.0), RadCoolingEnergy(0.0), HeatCoilPower(0.0), HeatCoilEnergy(0.0), TotCoolCoilPower(0.0), TotCoolCoilEnergy(0.0), SensCoolCoilPower(0.0), SensCoolCoilEnergy(0.0), LateCoolCoilPower(0.0), LateCoolCoilEnergy(0.0), ElecFanPower(0.0), ElecFanEnergy(0.0), AirMassFlowRate(0.0), AirVolFlow(0.0), SlabInTemp(0.0), SlabOutTemp(0.0), ReturnAirTemp(0.0), - FanOutletTemp(0.0), ZoneInletTemp(0.0), AvailStatus(0), HVACSizingIndex(0), FirstPass(true), ZeroVentSlabSourceSumHATsurf(0.0) + FanOutletTemp(0.0), ZoneInletTemp(0.0), AvailStatus(0), HVACSizingIndex(0), FirstPass(true), ZeroVentSlabSourceSumHATsurf(0.0), + QRadSysSrcAvg(0.0), LastQRadSysSrc(0.0), LastSysTimeElapsed(0.0), LastTimeStepSys(0.0) { } }; @@ -387,18 +393,12 @@ struct VentilatedSlabData : BaseGlobalStruct int OperatingMode = 0; // Used to keep track of whether system is in heating or cooling mode // MODULE VARIABLE DECLARATIONS: - bool HCoilOn = false; // TRUE if the heating coil (gas or electric especially) should be running - int NumOfVentSlabs = 0; // Number of ventilated slab in the input file - Real64 OAMassFlowRate = 0.0; // Outside air mass flow rate for the ventilated slab - Array1D_double QRadSysSrcAvg; // Average source over the time step for a particular radiant surfaceD - int MaxCloNumOfSurfaces = 0; // Used to set allocate size in CalcClo routine - Real64 QZnReq = 0.0; // heating or cooling needed by system [watts] - - // Record keeping variables used to calculate QRadSysSrcAvg locally - - Array1D_double LastQRadSysSrc; // Need to keep the last value in case we are still iterating - Array1D LastSysTimeElapsed; // Need to keep the last value in case we are still iterating - Array1D LastTimeStepSys; // Need to keep the last value in case we are still iterating + bool HCoilOn = false; // TRUE if the heating coil (gas or electric especially) should be running + int NumOfVentSlabs = 0; // Number of ventilated slab in the input file + Real64 OAMassFlowRate = 0.0; // Outside air mass flow rate for the ventilated slab + int MaxCloNumOfSurfaces = 0; // Used to set allocate size in CalcClo routine + Real64 QZnReq = 0.0; // heating or cooling needed by system [watts] + Array1D_bool CheckEquipName; // Autosizing variables @@ -430,10 +430,6 @@ struct VentilatedSlabData : BaseGlobalStruct this->OAMassFlowRate = 0.0; this->MaxCloNumOfSurfaces = 0; this->QZnReq = 0.0; - this->QRadSysSrcAvg.deallocate(); - this->LastQRadSysSrc.deallocate(); - this->LastSysTimeElapsed.deallocate(); - this->LastTimeStepSys.deallocate(); this->CheckEquipName.deallocate(); this->MySizeFlag.deallocate(); this->VentSlab.deallocate(); From 52f992d4bc2a8e7ea0f2c27706011f2a5f33e94b Mon Sep 17 00:00:00 2001 From: Rick Strand Date: Thu, 15 Jun 2023 07:23:39 -0500 Subject: [PATCH 14/80] Minor updates Got rid of unused variables causing warnings and made another initialization to make sure just is not being left around in an array. --- src/EnergyPlus/LowTempRadiantSystem.cc | 8 +++++--- src/EnergyPlus/VentilatedSlab.cc | 1 - 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/EnergyPlus/LowTempRadiantSystem.cc b/src/EnergyPlus/LowTempRadiantSystem.cc index 5cc0838af56..e080aa206dd 100644 --- a/src/EnergyPlus/LowTempRadiantSystem.cc +++ b/src/EnergyPlus/LowTempRadiantSystem.cc @@ -1943,7 +1943,6 @@ namespace LowTempRadiantSystem { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 CurrentFlowSchedule; // Schedule value for flow fraction in a constant flow radiant system int RadNum; // Number of the radiant system (DO loop counter) - int RadSurfNum; // Number of the radiant system surface (DO loop counter) int SurfNum; // Intermediate variable for keeping track of the surface number Real64 TotalEffic; // Intermediate calculation variable for total pump efficiency int ZoneNum; // Intermediate variable for keeping track of the zone number @@ -5945,8 +5944,11 @@ namespace LowTempRadiantSystem { // If there are no radiant systems in this input file, just RETURN if (state.dataLowTempRadSys->TotalNumOfRadSystems == 0) return; - // If it was allocated, then we have to check to see if this was running at all... - for (int numRadSys = 1; numRadSys <= state.dataLowTempRadSys->NumOfHydrLowTempRadSys; ++numRadSys) { + // Now check to see if anything is running and transfer information from the "average" variables to + // the array that will be used within the heat balance. + state.dataHeatBalFanSys->QRadSysSource = 0.0 // Zero this out first + for (int numRadSys = 1; numRadSys <= state.dataLowTempRadSys->NumOfHydrLowTempRadSys; ++numRadSys) + { auto &thisLTR = state.dataLowTempRadSys->HydrRadSys(numRadSys); for (int numRadSurf = 1; numRadSurf <= thisLTR.NumOfSurfaces; ++numRadSurf) { if (thisLTR.QRadSysSrcAvg(numRadSurf) != 0.0) LowTempRadSysOn = true; diff --git a/src/EnergyPlus/VentilatedSlab.cc b/src/EnergyPlus/VentilatedSlab.cc index b191dda3d77..00d7ce4d95a 100644 --- a/src/EnergyPlus/VentilatedSlab.cc +++ b/src/EnergyPlus/VentilatedSlab.cc @@ -1515,7 +1515,6 @@ namespace VentilatedSlab { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int RadNum; // Number of the radiant system (DO loop counter) - int RadSurfNum; // Number of the radiant system surface (DO loop counter) int SurfNum; // Intermediate variable for keeping track of the surface number int ZoneNum; // Intermediate variable for keeping track of the zone number int AirRelNode; // relief air node number in Ventilated Slab loop From 865da70db606bcfbb5c88bd60ac36e9c32c7c6c2 Mon Sep 17 00:00:00 2001 From: Rick Strand Date: Thu, 15 Jun 2023 07:28:54 -0500 Subject: [PATCH 15/80] Minor typo fix No comment. --- src/EnergyPlus/LowTempRadiantSystem.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EnergyPlus/LowTempRadiantSystem.cc b/src/EnergyPlus/LowTempRadiantSystem.cc index e080aa206dd..a090ed654a6 100644 --- a/src/EnergyPlus/LowTempRadiantSystem.cc +++ b/src/EnergyPlus/LowTempRadiantSystem.cc @@ -5946,7 +5946,7 @@ namespace LowTempRadiantSystem { // Now check to see if anything is running and transfer information from the "average" variables to // the array that will be used within the heat balance. - state.dataHeatBalFanSys->QRadSysSource = 0.0 // Zero this out first + state.dataHeatBalFanSys->QRadSysSource = 0.0; // Zero this out first for (int numRadSys = 1; numRadSys <= state.dataLowTempRadSys->NumOfHydrLowTempRadSys; ++numRadSys) { auto &thisLTR = state.dataLowTempRadSys->HydrRadSys(numRadSys); From 46196e4a10e0b0375f0a06d3d6d3928d0accfdcd Mon Sep 17 00:00:00 2001 From: Rick Strand Date: Fri, 16 Jun 2023 09:35:59 -0500 Subject: [PATCH 16/80] Unit Test for ZeroSource Fix Addition of a unit test for the fixes for various ZeroSource variables throughout the code. --- .../unit/LowTempRadiantSystem.unit.cc | 132 ++++++++++++++++++ 1 file changed, 132 insertions(+) diff --git a/tst/EnergyPlus/unit/LowTempRadiantSystem.unit.cc b/tst/EnergyPlus/unit/LowTempRadiantSystem.unit.cc index 72bb1448100..c71b5bb3f23 100644 --- a/tst/EnergyPlus/unit/LowTempRadiantSystem.unit.cc +++ b/tst/EnergyPlus/unit/LowTempRadiantSystem.unit.cc @@ -4665,3 +4665,135 @@ TEST_F(LowTempRadiantSystemTest, VariableFlowCoolingOnlyInputTest) EXPECT_NO_THROW(GetLowTempRadiantSystem(*state)); compare_err_stream(""); } + +TEST_F(LowTempRadiantSystemTest, UpdateRadSysSourceValAvgTest) +{ + bool isItOn; + Real64 errTol = 0.0001; + + auto &hRS = state->dataLowTempRadSys->HydrRadSys; + auto &cRS = state->dataLowTempRadSys->CFloRadSys; + auto &eRS = state->dataLowTempRadSys->ElecRadSys; + auto &surf = state->dataSurface->Surface; + auto &dataLTRS = state->dataLowTempRadSys; + auto &totSurfaces = state->dataSurface->TotSurfaces; + auto &qRadSysSource = state->dataHeatBalFanSys->QRadSysSource; + + dataLTRS->NumOfHydrLowTempRadSys = 2; + dataLTRS->NumOfCFloLowTempRadSys = 1; + dataLTRS->NumOfElecLowTempRadSys = 1; + hRS.allocate(dataLTRS->NumOfHydrLowTempRadSys); + cRS.allocate(dataLTRS->NumOfCFloLowTempRadSys); + eRS.allocate(dataLTRS->NumOfElecLowTempRadSys); + + hRS(1).NumOfSurfaces = 1; + hRS(1).SurfacePtr.allocate(hRS(1).NumOfSurfaces); + hRS(1).QRadSysSrcAvg.allocate(hRS(1).NumOfSurfaces); + hRS(2).NumOfSurfaces = 2; + hRS(2).SurfacePtr.allocate(hRS(2).NumOfSurfaces); + hRS(2).QRadSysSrcAvg.allocate(hRS(2).NumOfSurfaces); + cRS(1).NumOfSurfaces = 1; + cRS(1).SurfacePtr.allocate(cRS(1).NumOfSurfaces); + cRS(1).QRadSysSrcAvg.allocate(cRS(1).NumOfSurfaces); + eRS(1).NumOfSurfaces = 1; + eRS(1).SurfacePtr.allocate(eRS(1).NumOfSurfaces); + eRS(1).QRadSysSrcAvg.allocate(eRS(1).NumOfSurfaces); + + hRS(1).SurfacePtr(1) = 1; + hRS(2).SurfacePtr(1) = 2; + hRS(2).SurfacePtr(2) = 3; + cRS(1).SurfacePtr(1) = 5; + eRS(1).SurfacePtr(1) = 6; + hRS(1).QRadSysSrcAvg(1) = 100.0; + hRS(2).QRadSysSrcAvg(1) = 200.0; + hRS(2).QRadSysSrcAvg(2) = 300.0; + cRS(1).QRadSysSrcAvg(1) = 400.0; + eRS(1).QRadSysSrcAvg(1) = 500.0; + + totSurfaces = 6; + surf.allocate(totSurfaces); + surf(1).ExtBoundCond = 0; + surf(2).ExtBoundCond = 0; + surf(3).ExtBoundCond = 4; // interzone surface test + surf(4).ExtBoundCond = 3; // interzone surface test + surf(5).ExtBoundCond = 0; + surf(6).ExtBoundCond = 0; + qRadSysSource.allocate(totSurfaces); + + // Test 1: No radiant systems--should come back with flag false and nothing set in QRadSysSource + isItOn = false; + dataLTRS->NumOfHydrLowTempRadSys = 0; + dataLTRS->NumOfCFloLowTempRadSys = 0; + dataLTRS->NumOfElecLowTempRadSys = 0; + dataLTRS->TotalNumOfRadSystems = dataLTRS->NumOfHydrLowTempRadSys + dataLTRS->NumOfCFloLowTempRadSys + dataLTRS->NumOfElecLowTempRadSys; + qRadSysSource = 0.0; + UpdateRadSysSourceValAvg(*state, isItOn); + EXPECT_FALSE(isItOn); + for (int surfNum = 1; surfNum <= totSurfaces; ++surfNum) { + EXPECT_NEAR(qRadSysSource(surfNum), 0.0, errTol); + } + + // Test 2: Only Hydronic Radiant System--should come back with flag true and only hydronic variables set in QRadSysSource + isItOn = false; + dataLTRS->NumOfHydrLowTempRadSys = 2; + dataLTRS->NumOfCFloLowTempRadSys = 0; + dataLTRS->NumOfElecLowTempRadSys = 0; + dataLTRS->TotalNumOfRadSystems = dataLTRS->NumOfHydrLowTempRadSys + dataLTRS->NumOfCFloLowTempRadSys + dataLTRS->NumOfElecLowTempRadSys; + qRadSysSource = 0.0; + UpdateRadSysSourceValAvg(*state, isItOn); + EXPECT_TRUE(isItOn); + EXPECT_NEAR(qRadSysSource(1), 100.0, errTol); + EXPECT_NEAR(qRadSysSource(2), 200.0, errTol); + EXPECT_NEAR(qRadSysSource(3), 300.0, errTol); + EXPECT_NEAR(qRadSysSource(4), 300.0, errTol); + EXPECT_NEAR(qRadSysSource(5), 0.0, errTol); + EXPECT_NEAR(qRadSysSource(6), 0.0, errTol); + + // Test 3: Only Constant Flow Radiant System--should come back with flag true and only constant flow variables set in QRadSysSource + isItOn = false; + dataLTRS->NumOfHydrLowTempRadSys = 0; + dataLTRS->NumOfCFloLowTempRadSys = 1; + dataLTRS->NumOfElecLowTempRadSys = 0; + dataLTRS->TotalNumOfRadSystems = dataLTRS->NumOfHydrLowTempRadSys + dataLTRS->NumOfCFloLowTempRadSys + dataLTRS->NumOfElecLowTempRadSys; + qRadSysSource = 0.0; + UpdateRadSysSourceValAvg(*state, isItOn); + EXPECT_TRUE(isItOn); + EXPECT_NEAR(qRadSysSource(1), 0.0, errTol); + EXPECT_NEAR(qRadSysSource(2), 0.0, errTol); + EXPECT_NEAR(qRadSysSource(3), 0.0, errTol); + EXPECT_NEAR(qRadSysSource(4), 0.0, errTol); + EXPECT_NEAR(qRadSysSource(5), 400.0, errTol); + EXPECT_NEAR(qRadSysSource(6), 0.0, errTol); + + // Test 4: Only Electric Radiant System--should come back with flag true and only electric variables set in qRadSysSrc (QRadSysSource) + isItOn = false; + dataLTRS->NumOfHydrLowTempRadSys = 0; + dataLTRS->NumOfCFloLowTempRadSys = 0; + dataLTRS->NumOfElecLowTempRadSys = 1; + dataLTRS->TotalNumOfRadSystems = dataLTRS->NumOfHydrLowTempRadSys + dataLTRS->NumOfCFloLowTempRadSys + dataLTRS->NumOfElecLowTempRadSys; + qRadSysSource = 0.0; + UpdateRadSysSourceValAvg(*state, isItOn); + EXPECT_TRUE(isItOn); + EXPECT_NEAR(qRadSysSource(1), 0.0, errTol); + EXPECT_NEAR(qRadSysSource(2), 0.0, errTol); + EXPECT_NEAR(qRadSysSource(3), 0.0, errTol); + EXPECT_NEAR(qRadSysSource(4), 0.0, errTol); + EXPECT_NEAR(qRadSysSource(5), 0.0, errTol); + EXPECT_NEAR(qRadSysSource(6), 500.0, errTol); + + // Test 5: All Radiant System--should come back with flag true and all variables set in qRadSysSrc (QRadSysSource) + isItOn = false; + dataLTRS->NumOfHydrLowTempRadSys = 2; + dataLTRS->NumOfCFloLowTempRadSys = 1; + dataLTRS->NumOfElecLowTempRadSys = 1; + dataLTRS->TotalNumOfRadSystems = dataLTRS->NumOfHydrLowTempRadSys + dataLTRS->NumOfCFloLowTempRadSys + dataLTRS->NumOfElecLowTempRadSys; + qRadSysSource = 0.0; + UpdateRadSysSourceValAvg(*state, isItOn); + EXPECT_TRUE(isItOn); + EXPECT_NEAR(qRadSysSource(1), 100.0, errTol); + EXPECT_NEAR(qRadSysSource(2), 200.0, errTol); + EXPECT_NEAR(qRadSysSource(3), 300.0, errTol); + EXPECT_NEAR(qRadSysSource(4), 300.0, errTol); + EXPECT_NEAR(qRadSysSource(5), 400.0, errTol); + EXPECT_NEAR(qRadSysSource(6), 500.0, errTol); +} From 87220a9050d7b11f15f38eb099a733fa2f40ca95 Mon Sep 17 00:00:00 2001 From: Rick Strand Date: Fri, 16 Jun 2023 12:47:44 -0500 Subject: [PATCH 17/80] Clang formating issue Fixed something that clang didn't like. --- src/EnergyPlus/LowTempRadiantSystem.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/EnergyPlus/LowTempRadiantSystem.cc b/src/EnergyPlus/LowTempRadiantSystem.cc index a090ed654a6..50a2057d87f 100644 --- a/src/EnergyPlus/LowTempRadiantSystem.cc +++ b/src/EnergyPlus/LowTempRadiantSystem.cc @@ -5947,8 +5947,7 @@ namespace LowTempRadiantSystem { // Now check to see if anything is running and transfer information from the "average" variables to // the array that will be used within the heat balance. state.dataHeatBalFanSys->QRadSysSource = 0.0; // Zero this out first - for (int numRadSys = 1; numRadSys <= state.dataLowTempRadSys->NumOfHydrLowTempRadSys; ++numRadSys) - { + for (int numRadSys = 1; numRadSys <= state.dataLowTempRadSys->NumOfHydrLowTempRadSys; ++numRadSys) { auto &thisLTR = state.dataLowTempRadSys->HydrRadSys(numRadSys); for (int numRadSurf = 1; numRadSurf <= thisLTR.NumOfSurfaces; ++numRadSurf) { if (thisLTR.QRadSysSrcAvg(numRadSurf) != 0.0) LowTempRadSysOn = true; From 136f3b450d4e1b646ffa6e5c282c77706d3469a2 Mon Sep 17 00:00:00 2001 From: Rick Strand Date: Tue, 20 Jun 2023 09:25:49 -0500 Subject: [PATCH 18/80] Merge with Corrections Merged in latest develop and cleaned up some other stuff that somehow made it through previously (???). --- src/EnergyPlus/ChilledCeilingPanelSimple.cc | 2 +- src/EnergyPlus/HighTempRadiantSystem.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EnergyPlus/ChilledCeilingPanelSimple.cc b/src/EnergyPlus/ChilledCeilingPanelSimple.cc index 8889d75b916..ed6459e0e51 100644 --- a/src/EnergyPlus/ChilledCeilingPanelSimple.cc +++ b/src/EnergyPlus/ChilledCeilingPanelSimple.cc @@ -889,7 +889,7 @@ void InitCoolingPanel(EnergyPlusData &state, int const CoolingPanelNum, int cons } if (state.dataGlobal->BeginTimeStepFlag && FirstHVACIteration) { - int ZoneNum = ThisCP.ZonePtr; + int ZoneNum = thisCP.ZonePtr; thisCP.ZeroCPSourceSumHATsurf = state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state); thisCP.CoolingPanelSrcAvg = 0.0; thisCP.LastCoolingPanelSrc = 0.0; diff --git a/src/EnergyPlus/HighTempRadiantSystem.cc b/src/EnergyPlus/HighTempRadiantSystem.cc index ab3684f0341..61902cd055c 100644 --- a/src/EnergyPlus/HighTempRadiantSystem.cc +++ b/src/EnergyPlus/HighTempRadiantSystem.cc @@ -1098,7 +1098,7 @@ namespace HighTempRadiantSystem { if (state.dataHighTempRadSys->NumOfHighTempRadSys == 0) return; // If it was allocated, then we have to check to see if this was running at all... - for (RadSysNum = 1; RadSysNum <= state.dataHighTempRadSys->NumOfHighTempRadSys; ++RadSysNum) { + for (int RadSysNum = 1; RadSysNum <= state.dataHighTempRadSys->NumOfHighTempRadSys; ++RadSysNum) { auto &thisHTR = state.dataHighTempRadSys->HighTempRadSys(RadSysNum); thisHTR.QHTRRadSource = thisHTR.QHTRRadSrcAvg; if (thisHTR.QHTRRadSrcAvg != 0.0) HighTempRadSysOn = true; From 61f4709f84082d1b1540b30a18a7af38570d1a6a Mon Sep 17 00:00:00 2001 From: Rick Strand Date: Tue, 20 Jun 2023 09:41:08 -0500 Subject: [PATCH 19/80] clang format didn't like it clang format detected a double blank line and said nope. Fixed here. --- src/EnergyPlus/ChilledCeilingPanelSimple.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/EnergyPlus/ChilledCeilingPanelSimple.cc b/src/EnergyPlus/ChilledCeilingPanelSimple.cc index ed6459e0e51..e4073f9887b 100644 --- a/src/EnergyPlus/ChilledCeilingPanelSimple.cc +++ b/src/EnergyPlus/ChilledCeilingPanelSimple.cc @@ -873,7 +873,6 @@ void InitCoolingPanel(EnergyPlusData &state, int const CoolingPanelNum, int cons ThisInNode.Press = 0.0; ThisInNode.HumRat = 0.0; - thisCP.ZeroCPSourceSumHATsurf = 0.0; thisCP.CoolingPanelSource = 0.0; thisCP.CoolingPanelSrcAvg = 0.0; From 41728fdc4ff217dde3b5e04ab54c0d55d99992c8 Mon Sep 17 00:00:00 2001 From: Rick Strand Date: Tue, 20 Jun 2023 11:10:04 -0500 Subject: [PATCH 20/80] LTR and VentSlab time variables During review, it was noted that the time variables for the LTR and VentSlab systems did not need to be arrays but rather a scalar for a specific system. This commit fixes that issue. --- src/EnergyPlus/LowTempRadiantSystem.cc | 21 ++++++++++----------- src/EnergyPlus/LowTempRadiantSystem.hh | 4 ++-- src/EnergyPlus/VentilatedSlab.cc | 17 +++++++---------- src/EnergyPlus/VentilatedSlab.hh | 6 +++--- 4 files changed, 22 insertions(+), 26 deletions(-) diff --git a/src/EnergyPlus/LowTempRadiantSystem.cc b/src/EnergyPlus/LowTempRadiantSystem.cc index 9207d02e5ff..976edf2c550 100644 --- a/src/EnergyPlus/LowTempRadiantSystem.cc +++ b/src/EnergyPlus/LowTempRadiantSystem.cc @@ -1975,22 +1975,22 @@ namespace LowTempRadiantSystem { auto &thisLTR = state.dataLowTempRadSys->HydrRadSys(RadNum); thisLTR.QRadSysSrcAvg.dimension(thisLTR.NumOfSurfaces, 0.0); thisLTR.LastQRadSysSrc.dimension(thisLTR.NumOfSurfaces, 0.0); - thisLTR.LastSysTimeElapsed.dimension(thisLTR.NumOfSurfaces, 0.0); - thisLTR.LastTimeStepSys.dimension(thisLTR.NumOfSurfaces, 0.0); + thisLTR.LastSysTimeElapsed = 0.0; + thisLTR.LastTimeStepSys = 0.0; } for (RadNum = 1; RadNum <= state.dataLowTempRadSys->NumOfCFloLowTempRadSys; ++RadNum) { auto &thisLTR = state.dataLowTempRadSys->CFloRadSys(RadNum); thisLTR.QRadSysSrcAvg.dimension(thisLTR.NumOfSurfaces, 0.0); thisLTR.LastQRadSysSrc.dimension(thisLTR.NumOfSurfaces, 0.0); - thisLTR.LastSysTimeElapsed.dimension(thisLTR.NumOfSurfaces, 0.0); - thisLTR.LastTimeStepSys.dimension(thisLTR.NumOfSurfaces, 0.0); + thisLTR.LastSysTimeElapsed = 0.0; + thisLTR.LastTimeStepSys = 0.0; } for (RadNum = 1; RadNum <= state.dataLowTempRadSys->NumOfElecLowTempRadSys; ++RadNum) { auto &thisLTR = state.dataLowTempRadSys->ElecRadSys(RadNum); thisLTR.QRadSysSrcAvg.dimension(thisLTR.NumOfSurfaces, 0.0); thisLTR.LastQRadSysSrc.dimension(thisLTR.NumOfSurfaces, 0.0); - thisLTR.LastSysTimeElapsed.dimension(thisLTR.NumOfSurfaces, 0.0); - thisLTR.LastTimeStepSys.dimension(thisLTR.NumOfSurfaces, 0.0); + thisLTR.LastSysTimeElapsed = 0.0; + thisLTR.LastTimeStepSys = 0.0; } state.dataLowTempRadSys->MySizeFlagHydr.allocate(state.dataLowTempRadSys->NumOfHydrLowTempRadSys); state.dataLowTempRadSys->MySizeFlagCFlo.allocate(state.dataLowTempRadSys->NumOfCFloLowTempRadSys); @@ -5373,19 +5373,18 @@ namespace LowTempRadiantSystem { int surfNum = this->SurfacePtr(radSurfNum); - if (this->LastSysTimeElapsed(radSurfNum) == SysTimeElapsed) { + if (this->LastSysTimeElapsed == SysTimeElapsed) { // Still iterating or reducing system time step, so subtract old values which were // not valid - this->QRadSysSrcAvg(radSurfNum) -= this->LastQRadSysSrc(radSurfNum) * this->LastTimeStepSys(radSurfNum) / TimeStepZone; + this->QRadSysSrcAvg(radSurfNum) -= this->LastQRadSysSrc(radSurfNum) * this->LastTimeStepSys / TimeStepZone; } // Update the running average and the "last" values with the current values of the appropriate variables this->QRadSysSrcAvg(radSurfNum) += state.dataHeatBalFanSys->QRadSysSource(surfNum) * TimeStepSys / TimeStepZone; - this->LastQRadSysSrc(radSurfNum) = state.dataHeatBalFanSys->QRadSysSource(surfNum); - this->LastSysTimeElapsed(radSurfNum) = SysTimeElapsed; - this->LastTimeStepSys(radSurfNum) = TimeStepSys; } + this->LastSysTimeElapsed = SysTimeElapsed; + this->LastTimeStepSys = TimeStepSys; } void VariableFlowRadiantSystemData::updateLowTemperatureRadiantSystem(EnergyPlusData &state) diff --git a/src/EnergyPlus/LowTempRadiantSystem.hh b/src/EnergyPlus/LowTempRadiantSystem.hh index f3679c86d8a..461649e8d27 100644 --- a/src/EnergyPlus/LowTempRadiantSystem.hh +++ b/src/EnergyPlus/LowTempRadiantSystem.hh @@ -154,8 +154,8 @@ namespace LowTempRadiantSystem { Array1D QRadSysSrcAvg; // Average source over the time step for a particular radiant surface // Record keeping variables used to calculate QRadSysSrcAvg locally Array1D LastQRadSysSrc; // Need to keep the last value in case we are still iterating - Array1D LastSysTimeElapsed; // Need to keep the last value in case we are still iterating - Array1D LastTimeStepSys; // Need to keep the last value in case we are still iterating + Real64 LastSysTimeElapsed; // Need to keep the last value in case we are still iterating + Real64 LastTimeStepSys; // Need to keep the last value in case we are still iterating LowTempRadiantControlTypes controlType = LowTempRadiantControlTypes::MATControl; // Control type for the system (MAT, MRT, Op temp, ODB, OWB, // Surface Face Temp, Surface Interior Temp, Running Mean // Temp for Constant Flow systems only) diff --git a/src/EnergyPlus/VentilatedSlab.cc b/src/EnergyPlus/VentilatedSlab.cc index 4448d09648d..414e43c689a 100644 --- a/src/EnergyPlus/VentilatedSlab.cc +++ b/src/EnergyPlus/VentilatedSlab.cc @@ -1549,8 +1549,8 @@ namespace VentilatedSlab { } thisVentSlab.QRadSysSrcAvg.dimension(numRadSurfs, 0.0); thisVentSlab.LastQRadSysSrc.dimension(numRadSurfs, 0.0); - thisVentSlab.LastSysTimeElapsed.dimension(numRadSurfs, 0.0); - thisVentSlab.LastTimeStepSys.dimension(numRadSurfs, 0.0); + thisVentSlab.LastSysTimeElapsed = 0.0; + thisVentSlab.LastTimeStepSys = 0.0; } state.dataVentilatedSlab->MyEnvrnFlag = true; state.dataVentilatedSlab->MySizeFlag = true; @@ -4473,20 +4473,17 @@ namespace VentilatedSlab { SurfNum = ventSlab.SurfacePtr(RadSurfNum); - if (ventSlab.LastSysTimeElapsed(RadSurfNum) == SysTimeElapsed) { - // Still iterating or reducing system time step, so subtract old values which were - // not valid - ventSlab.QRadSysSrcAvg(RadSurfNum) -= - ventSlab.LastQRadSysSrc(RadSurfNum) * ventSlab.LastTimeStepSys(RadSurfNum) / state.dataGlobal->TimeStepZone; + if (ventSlab.LastSysTimeElapsed == SysTimeElapsed) { + // Still iterating or reducing system time step, so subtract old values which were not valid + ventSlab.QRadSysSrcAvg(RadSurfNum) -= ventSlab.LastQRadSysSrc(RadSurfNum) * ventSlab.LastTimeStepSys / state.dataGlobal->TimeStepZone; } // Update the running average and the "last" values with the current values of the appropriate variables ventSlab.QRadSysSrcAvg(RadSurfNum) += state.dataHeatBalFanSys->QRadSysSource(SurfNum) * TimeStepSys / state.dataGlobal->TimeStepZone; - ventSlab.LastQRadSysSrc(RadSurfNum) = state.dataHeatBalFanSys->QRadSysSource(SurfNum); - ventSlab.LastSysTimeElapsed(RadSurfNum) = SysTimeElapsed; - ventSlab.LastTimeStepSys(RadSurfNum) = TimeStepSys; } + ventSlab.LastSysTimeElapsed = SysTimeElapsed; + ventSlab.LastTimeStepSys = TimeStepSys; // First sum up all of the heat sources/sinks associated with this system TotalHeatSource = 0.0; diff --git a/src/EnergyPlus/VentilatedSlab.hh b/src/EnergyPlus/VentilatedSlab.hh index bd329a21817..394adc7dac8 100644 --- a/src/EnergyPlus/VentilatedSlab.hh +++ b/src/EnergyPlus/VentilatedSlab.hh @@ -278,9 +278,9 @@ namespace VentilatedSlab { Real64 ZeroVentSlabSourceSumHATsurf; // Equal to SumHATsurf for all the walls in a zone with no source Array1D QRadSysSrcAvg; // Average source over the time step for a particular radiant surfaceD // Record keeping variables used to calculate QRadSysSrcAvg locally - Array1D LastQRadSysSrc; // Need to keep the last value in case we are still iterating - Array1D LastSysTimeElapsed; // Need to keep the last value in case we are still iterating - Array1D LastTimeStepSys; // Need to keep the last value in case we are still iterating + Array1D LastQRadSysSrc; // Need to keep the last value in case we are still iterating + Real64 LastSysTimeElapsed; // Need to keep the last value in case we are still iterating + Real64 LastTimeStepSys; // Need to keep the last value in case we are still iterating // Default Constructor VentilatedSlabData() From df4344eb865a50c57059e718b84aac328eca9c0c Mon Sep 17 00:00:00 2001 From: Rick Strand Date: Tue, 20 Jun 2023 11:57:46 -0500 Subject: [PATCH 21/80] More intros of auto statements Implementation of more "thisHTR" auto definitions to clean up the code in various subroutines throughout this module. --- src/EnergyPlus/HighTempRadiantSystem.cc | 149 +++++++++++------------- 1 file changed, 71 insertions(+), 78 deletions(-) diff --git a/src/EnergyPlus/HighTempRadiantSystem.cc b/src/EnergyPlus/HighTempRadiantSystem.cc index 61902cd055c..e118b42716c 100644 --- a/src/EnergyPlus/HighTempRadiantSystem.cc +++ b/src/EnergyPlus/HighTempRadiantSystem.cc @@ -709,6 +709,9 @@ namespace HighTempRadiantSystem { // METHODOLOGY EMPLOYED: // Obtains design heating load from the zone sizing arrays + // Using/Aliasing + auto &thisHTR = state.dataHighTempRadSys->HighTempRadSys(RadSysNum); + // SUBROUTINE LOCAL VARIABLE DECLARATIONS Real64 TempSize; // autosized value of coil input field state.dataSize->DataScalableCapSizingON = false; @@ -719,48 +722,45 @@ namespace HighTempRadiantSystem { auto &zoneEqSizing = state.dataSize->ZoneEqSizing(curZoneEqNum); state.dataSize->DataFracOfAutosizedHeatingCapacity = 1.0; - state.dataSize->DataZoneNumber = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ZonePtr; + state.dataSize->DataZoneNumber = thisHTR.ZonePtr; // Integer representation of sizing method name (e.g., CoolingAirflowSizing, HeatingCapacitySizing, etc.) int SizingMethod = DataHVACGlobals::HeatingCapacitySizing; int FieldNum = 1; std::string const SizingString = format("{} [W]", state.dataHighTempRadSys->HighTempRadSysNumericFields(RadSysNum).FieldNames(FieldNum)); // capacity sizing methods (HeatingDesignCapacity, CapacityPerFloorArea, FractionOfAutosizedCoolingCapacity, and // FractionOfAutosizedHeatingCapacity ) - int CapSizingMethod = static_cast(state.dataHighTempRadSys->HighTempRadSys(RadSysNum).HeatingCapMethod); + int CapSizingMethod = static_cast(thisHTR.HeatingCapMethod); zoneEqSizing.SizingMethod(SizingMethod) = CapSizingMethod; if (CapSizingMethod == DataSizing::HeatingDesignCapacity || CapSizingMethod == DataSizing::CapacityPerFloorArea || CapSizingMethod == DataSizing::FractionOfAutosizedHeatingCapacity) { std::string_view const CompType = "ZoneHVAC:HighTemperatureRadiant"; - std::string_view const CompName = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).Name; + std::string_view const CompName = thisHTR.Name; if (CapSizingMethod == DataSizing::HeatingDesignCapacity) { - if (state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ScaledHeatingCapacity == DataSizing::AutoSize) { + if (thisHTR.ScaledHeatingCapacity == DataSizing::AutoSize) { CheckZoneSizing(state, CompType, CompName); - zoneEqSizing.DesHeatingLoad = state.dataSize->FinalZoneSizing(curZoneEqNum).NonAirSysDesHeatLoad / - (state.dataHighTempRadSys->HighTempRadSys(RadSysNum).FracRadiant + - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).FracConvect); + zoneEqSizing.DesHeatingLoad = + state.dataSize->FinalZoneSizing(curZoneEqNum).NonAirSysDesHeatLoad / (thisHTR.FracRadiant + thisHTR.FracConvect); } else { - zoneEqSizing.DesHeatingLoad = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ScaledHeatingCapacity; + zoneEqSizing.DesHeatingLoad = thisHTR.ScaledHeatingCapacity; } zoneEqSizing.HeatingCapacity = true; TempSize = zoneEqSizing.DesHeatingLoad; } else if (CapSizingMethod == DataSizing::CapacityPerFloorArea) { zoneEqSizing.HeatingCapacity = true; - zoneEqSizing.DesHeatingLoad = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ScaledHeatingCapacity * - state.dataHeatBal->Zone(state.dataSize->DataZoneNumber).FloorArea; + zoneEqSizing.DesHeatingLoad = thisHTR.ScaledHeatingCapacity * state.dataHeatBal->Zone(state.dataSize->DataZoneNumber).FloorArea; TempSize = zoneEqSizing.DesHeatingLoad; state.dataSize->DataScalableCapSizingON = true; } else if (CapSizingMethod == DataSizing::FractionOfAutosizedHeatingCapacity) { CheckZoneSizing(state, CompType, CompName); zoneEqSizing.HeatingCapacity = true; - state.dataSize->DataFracOfAutosizedHeatingCapacity = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ScaledHeatingCapacity; - zoneEqSizing.DesHeatingLoad = state.dataSize->FinalZoneSizing(curZoneEqNum).NonAirSysDesHeatLoad / - (state.dataHighTempRadSys->HighTempRadSys(RadSysNum).FracRadiant + - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).FracConvect); + state.dataSize->DataFracOfAutosizedHeatingCapacity = thisHTR.ScaledHeatingCapacity; + zoneEqSizing.DesHeatingLoad = + state.dataSize->FinalZoneSizing(curZoneEqNum).NonAirSysDesHeatLoad / (thisHTR.FracRadiant + thisHTR.FracConvect); TempSize = DataSizing::AutoSize; state.dataSize->DataScalableCapSizingON = true; } else { - TempSize = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ScaledHeatingCapacity; + TempSize = thisHTR.ScaledHeatingCapacity; } bool PrintFlag = true; bool errorsFound = false; @@ -768,7 +768,7 @@ namespace HighTempRadiantSystem { HeatingCapacitySizer sizerHeatingCapacity; sizerHeatingCapacity.overrideSizingString(SizingString); sizerHeatingCapacity.initializeWithinEP(state, CompType, CompName, PrintFlag, RoutineName); - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).MaxPowerCapac = sizerHeatingCapacity.size(state, TempSize, errorsFound); + thisHTR.MaxPowerCapac = sizerHeatingCapacity.size(state, TempSize, errorsFound); state.dataSize->DataScalableCapSizingON = false; } } @@ -803,37 +803,39 @@ namespace HighTempRadiantSystem { // energy analysis program", M.S. thesis, University of Illinois at // Urbana-Champaign (Dept. of Mechanical and Industrial Engineering). + // Using/Aliasing + auto &thisHTR = state.dataHighTempRadSys->HighTempRadSys(RadSysNum); + // initialize local variables - int ZoneNum = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ZonePtr; + int ZoneNum = thisHTR.ZonePtr; Real64 HeatFrac = 0.0; // fraction of maximum energy input to radiant system [dimensionless] - if (ScheduleManager::GetCurrentScheduleValue(state, state.dataHighTempRadSys->HighTempRadSys(RadSysNum).SchedPtr) <= 0) { + if (ScheduleManager::GetCurrentScheduleValue(state, thisHTR.SchedPtr) <= 0) { // Unit is off or has no load upon it; set the flow rates to zero and then // simulate the components with the no flow conditions - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSource = 0.0; + thisHTR.QHTRRadSource = 0.0; } else { // Unit might be on-->this section is intended to control the output of the // high temperature radiant heater (temperature controlled) // Determine the current setpoint temperature and the temperature at which the unit should be completely off - Real64 SetPtTemp = ScheduleManager::GetCurrentScheduleValue(state, state.dataHighTempRadSys->HighTempRadSys(RadSysNum).SetptSchedPtr); - Real64 OffTemp = SetPtTemp + 0.5 * state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ThrottlRange; + Real64 SetPtTemp = ScheduleManager::GetCurrentScheduleValue(state, thisHTR.SetptSchedPtr); + Real64 OffTemp = SetPtTemp + 0.5 * thisHTR.ThrottlRange; Real64 OpTemp = (state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT + state.dataHeatBal->ZoneMRT(ZoneNum)) / 2.0; // Approximate the "operative" temperature // Determine the fraction of maximum power to the unit (limiting the fraction range from zero to unity) - switch (state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ControlType) { + switch (thisHTR.ControlType) { case RadControlType::MATControl: { - HeatFrac = (OffTemp - state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT) / - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ThrottlRange; + HeatFrac = (OffTemp - state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT) / thisHTR.ThrottlRange; } break; case RadControlType::MRTControl: { - HeatFrac = (OffTemp - state.dataHeatBal->ZoneMRT(ZoneNum)) / state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ThrottlRange; + HeatFrac = (OffTemp - state.dataHeatBal->ZoneMRT(ZoneNum)) / thisHTR.ThrottlRange; } break; case RadControlType::OperativeControl: { OpTemp = 0.5 * (state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT + state.dataHeatBal->ZoneMRT(ZoneNum)); - HeatFrac = (OffTemp - OpTemp) / state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ThrottlRange; + HeatFrac = (OffTemp - OpTemp) / thisHTR.ThrottlRange; } break; default: break; @@ -842,8 +844,7 @@ namespace HighTempRadiantSystem { if (HeatFrac > 1.0) HeatFrac = 1.0; // Set the heat source for the high temperature electric radiant system - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSource = - HeatFrac * state.dataHighTempRadSys->HighTempRadSys(RadSysNum).MaxPowerCapac; + thisHTR.QHTRRadSource = HeatFrac * thisHTR.MaxPowerCapac; } } @@ -879,6 +880,9 @@ namespace HighTempRadiantSystem { // energy analysis program", M.S. thesis, University of Illinois at // Urbana-Champaign (Dept. of Mechanical and Industrial Engineering). + // Using/Aliasing + auto &thisHTR = state.dataHighTempRadSys->HighTempRadSys(RadSysNum); + // SUBROUTINE PARAMETER DEFINITIONS: float const TempConvToler(0.1f); // Temperature controller tries to converge to within 0.1C int constexpr MaxIterations(10); // Maximum number of iterations to achieve temperature control @@ -890,16 +894,16 @@ namespace HighTempRadiantSystem { Real64 ZoneTemp(0.0); // zone temperature (MAT, MRT, or Operative Temperature, depending on control type) [C] // initialize local variables - int ZoneNum = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ZonePtr; - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSource = 0.0; + int ZoneNum = thisHTR.ZonePtr; + thisHTR.QHTRRadSource = 0.0; - if (ScheduleManager::GetCurrentScheduleValue(state, state.dataHighTempRadSys->HighTempRadSys(RadSysNum).SchedPtr) > 0) { + if (ScheduleManager::GetCurrentScheduleValue(state, thisHTR.SchedPtr) > 0) { // Unit is scheduled on-->this section is intended to control the output of the // high temperature radiant heater (temperature controlled) // Determine the current setpoint temperature and the temperature at which the unit should be completely off - Real64 SetPtTemp = ScheduleManager::GetCurrentScheduleValue(state, state.dataHighTempRadSys->HighTempRadSys(RadSysNum).SetptSchedPtr); + Real64 SetPtTemp = ScheduleManager::GetCurrentScheduleValue(state, thisHTR.SetptSchedPtr); // Now, distribute the radiant energy of all systems to the appropriate // surfaces, to people, and the air; determine the latent portion @@ -911,7 +915,7 @@ namespace HighTempRadiantSystem { // First determine whether or not the unit should be on // Determine the proper temperature on which to control - switch (state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ControlType) { + switch (thisHTR.ControlType) { case RadControlType::MATSPControl: { ZoneTemp = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT; } break; @@ -945,8 +949,7 @@ namespace HighTempRadiantSystem { } // Set the heat source for the high temperature radiant system - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSource = - HeatFrac * state.dataHighTempRadSys->HighTempRadSys(RadSysNum).MaxPowerCapac; + thisHTR.QHTRRadSource = HeatFrac * thisHTR.MaxPowerCapac; // Now, distribute the radiant energy of all systems to the appropriate // surfaces, to people, and the air; determine the latent portion @@ -957,7 +960,7 @@ namespace HighTempRadiantSystem { HeatBalanceSurfaceManager::CalcHeatBalanceInsideSurf(state, ZoneNum); // Redetermine the current value of the controlling temperature - switch (state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ControlType) { + switch (thisHTR.ControlType) { case RadControlType::MATControl: { ZoneTemp = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT; } break; @@ -1135,43 +1138,37 @@ namespace HighTempRadiantSystem { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 ThisSurfIntensity; // temporary for W/m2 term for rad on a surface + // Using/Aliasing + auto &thisHTR = state.dataHighTempRadSys->HighTempRadSys(RadSysNum); + auto &dataHBFS = state.dataHeatBalFanSys; + // Initialize arrays - state.dataHeatBalFanSys->SumConvHTRadSys = 0.0; - state.dataHeatBalFanSys->SumLatentHTRadSys = 0.0; - state.dataHeatBalFanSys->SurfQHTRadSys = 0.0; - state.dataHeatBalFanSys->ZoneQHTRadSysToPerson = 0.0; + dataHBFS->SumConvHTRadSys = 0.0; + dataHBFS->SumLatentHTRadSys = 0.0; + dataHBFS->SurfQHTRadSys = 0.0; + dataHBFS->ZoneQHTRadSysToPerson = 0.0; for (int RadSysNum = 1; RadSysNum <= state.dataHighTempRadSys->NumOfHighTempRadSys; ++RadSysNum) { - int ZoneNum = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ZonePtr; - - state.dataHeatBalFanSys->ZoneQHTRadSysToPerson(ZoneNum) = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSource * - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).FracRadiant * - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).FracDistribPerson; + int ZoneNum = thisHTR.ZonePtr; - state.dataHeatBalFanSys->SumConvHTRadSys(ZoneNum) += - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSource * state.dataHighTempRadSys->HighTempRadSys(RadSysNum).FracConvect; + dataHBFS->ZoneQHTRadSysToPerson(ZoneNum) = thisHTR.QHTRRadSource * thisHTR.FracRadiant * thisHTR.FracDistribPerson; + dataHBFS->SumConvHTRadSys(ZoneNum) += thisHTR.QHTRRadSource * thisHTR.FracConvect; + dataHBFS->SumLatentHTRadSys(ZoneNum) += thisHTR.QHTRRadSource * thisHTR.FracLatent; - state.dataHeatBalFanSys->SumLatentHTRadSys(ZoneNum) += - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSource * state.dataHighTempRadSys->HighTempRadSys(RadSysNum).FracLatent; - - for (int RadSurfNum = 1; RadSurfNum <= state.dataHighTempRadSys->HighTempRadSys(RadSysNum).TotSurfToDistrib; ++RadSurfNum) { - int SurfNum = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).SurfacePtr(RadSurfNum); + for (int RadSurfNum = 1; RadSurfNum <= thisHTR.TotSurfToDistrib; ++RadSurfNum) { + int SurfNum = thisHTR.SurfacePtr(RadSurfNum); if (state.dataSurface->Surface(SurfNum).Area > SmallestArea) { - ThisSurfIntensity = (state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSource * - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).FracRadiant * - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).FracDistribToSurf(RadSurfNum) / + ThisSurfIntensity = (thisHTR.QHTRRadSource * thisHTR.FracRadiant * thisHTR.FracDistribToSurf(RadSurfNum) / state.dataSurface->Surface(SurfNum).Area); - state.dataHeatBalFanSys->SurfQHTRadSys(SurfNum) += ThisSurfIntensity; + dataHBFS->SurfQHTRadSys(SurfNum) += ThisSurfIntensity; state.dataHeatBalSurf->AnyRadiantSystems = true; if (ThisSurfIntensity > DataHeatBalFanSys::MaxRadHeatFlux) { // CR 8074, trap excessive intensity (throws off surface balance ) ShowSevereError(state, "DistributeHTRadGains: excessive thermal radiation heat flux intensity detected"); ShowContinueError(state, format("Surface = {}", state.dataSurface->Surface(SurfNum).Name)); ShowContinueError(state, format("Surface area = {:.3R} [m2]", state.dataSurface->Surface(SurfNum).Area)); - ShowContinueError( - state, - format("Occurs in ZoneHVAC:HighTemperatureRadiant = {}", state.dataHighTempRadSys->HighTempRadSys(RadSysNum).Name)); + ShowContinueError(state, format("Occurs in ZoneHVAC:HighTemperatureRadiant = {}", thisHTR.Name)); ShowContinueError(state, format("Radiation intensity = {:.2R} [W/m2]", ThisSurfIntensity)); ShowContinueError(state, "Assign a larger surface area or more surfaces in ZoneHVAC:HighTemperatureRadiant"); ShowFatalError(state, "DistributeHTRadGains: excessive thermal radiation heat flux intensity detected"); @@ -1180,8 +1177,7 @@ namespace HighTempRadiantSystem { ShowSevereError(state, "DistributeHTRadGains: surface not large enough to receive thermal radiation heat flux"); ShowContinueError(state, format("Surface = {}", state.dataSurface->Surface(SurfNum).Name)); ShowContinueError(state, format("Surface area = {:.3R} [m2]", state.dataSurface->Surface(SurfNum).Area)); - ShowContinueError( - state, format("Occurs in ZoneHVAC:HighTemperatureRadiant = {}", state.dataHighTempRadSys->HighTempRadSys(RadSysNum).Name)); + ShowContinueError(state, format("Occurs in ZoneHVAC:HighTemperatureRadiant = {}", thisHTR.Name)); ShowContinueError(state, "Assign a larger surface area or more surfaces in ZoneHVAC:HighTemperatureRadiant"); ShowFatalError(state, "DistributeHTRadGains: surface not large enough to receive thermal radiation heat flux"); } @@ -1196,7 +1192,7 @@ namespace HighTempRadiantSystem { // that all energy radiated to people is converted to convective energy is // not very precise, but at least it conserves energy. for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { - state.dataHeatBalFanSys->SumConvHTRadSys(ZoneNum) += state.dataHeatBalFanSys->ZoneQHTRadSysToPerson(ZoneNum); + dataHBFS->SumConvHTRadSys(ZoneNum) += dataHBFS->ZoneQHTRadSysToPerson(ZoneNum); } } @@ -1213,26 +1209,23 @@ namespace HighTempRadiantSystem { // Using/Aliasing Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; + auto &thisHTR = state.dataHighTempRadSys->HighTempRadSys(RadSysNum); - if (state.dataHighTempRadSys->HighTempRadSys(RadSysNum).HeaterType == Constant::eResource::NaturalGas) { - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).GasPower = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSource / - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).CombustionEffic; - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).GasEnergy = - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).GasPower * TimeStepSysSec; - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ElecPower = 0.0; - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ElecEnergy = 0.0; - } else if (state.dataHighTempRadSys->HighTempRadSys(RadSysNum).HeaterType == Constant::eResource::Electricity) { - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).GasPower = 0.0; - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).GasEnergy = 0.0; - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ElecPower = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSource; - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ElecEnergy = - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).ElecPower * TimeStepSysSec; + if (thisHTR.HeaterType == Constant::eResource::NaturalGas) { + thisHTR.GasPower = thisHTR.QHTRRadSource / thisHTR.CombustionEffic; + thisHTR.GasEnergy = thisHTR.GasPower * TimeStepSysSec; + thisHTR.ElecPower = 0.0; + thisHTR.ElecEnergy = 0.0; + } else if (thisHTR.HeaterType == Constant::eResource::Electricity) { + thisHTR.GasPower = 0.0; + thisHTR.GasEnergy = 0.0; + thisHTR.ElecPower = thisHTR.QHTRRadSource; + thisHTR.ElecEnergy = thisHTR.ElecPower * TimeStepSysSec; } else { ShowWarningError(state, "Someone forgot to add a high temperature radiant heater type to the reporting subroutine"); } - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).HeatPower = state.dataHighTempRadSys->HighTempRadSys(RadSysNum).QHTRRadSource; - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).HeatEnergy = - state.dataHighTempRadSys->HighTempRadSys(RadSysNum).HeatPower * TimeStepSysSec; + thisHTR.HeatPower = thisHTR.QHTRRadSource; + thisHTR.HeatEnergy = thisHTR.HeatPower * TimeStepSysSec; } } // namespace HighTempRadiantSystem From 2cb240a748e8afbbc0c23e247144d2a4c9a06ffc Mon Sep 17 00:00:00 2001 From: Rick Strand Date: Tue, 20 Jun 2023 12:13:39 -0500 Subject: [PATCH 22/80] AccountingData fix and random HTR fix Corrected the data structure for the HWBB based on review comments. Also uncovered a problem in HTR that somehow slipped by the compiler on a previous build (?). --- src/EnergyPlus/HWBaseboardRadiator.hh | 64 ++++++++----------------- src/EnergyPlus/HighTempRadiantSystem.cc | 2 +- 2 files changed, 22 insertions(+), 44 deletions(-) diff --git a/src/EnergyPlus/HWBaseboardRadiator.hh b/src/EnergyPlus/HWBaseboardRadiator.hh index c45fa8e4ecb..476ca540f89 100644 --- a/src/EnergyPlus/HWBaseboardRadiator.hh +++ b/src/EnergyPlus/HWBaseboardRadiator.hh @@ -68,14 +68,6 @@ namespace HWBaseboardRadiator { extern std::string const cCMO_BBRadiator_Water; - struct AccountingData - { - // Record keeping variables used to calculate QBBRadSrcAvg locally - Real64 LastQBBRadSrc = 0.0; // Need to keep the last value in case we are still iterating - Real64 LastSysTimeElapsed = 0.0; // Need to keep the last value in case we are still iterating - Real64 LastTimeStepSys = 0.0; // Need to keep the last value in case we are still iterating - }; - struct HWBaseboardParams { // Members @@ -113,42 +105,28 @@ namespace HWBaseboardRadiator { Real64 AirOutletTempStd = 0.0; Real64 FracConvect = 0.0; Array1D FracDistribToSurf; - Real64 TotPower; - Real64 Power; - Real64 ConvPower; - Real64 RadPower; - Real64 TotEnergy; - Real64 Energy; - Real64 ConvEnergy; - Real64 RadEnergy; - PlantLocation plantLoc; - int BBLoadReSimIndex; - int BBMassFlowReSimIndex; - int BBInletTempFlowReSimIndex; - int HeatingCapMethod; // - Method for heating capacity scaled sizing calculation (HeatingDesignCapacity, CapacityPerFloorArea, - // FracOfAutosizedHeatingCapacity) - Real64 ScaledHeatingCapacity; // - scaled maximum heating capacity {W} or scalable variable of zone HVAC equipment, {-}, or {W/m2} - Real64 ZeroBBSourceSumHATsurf; // used in baseboard energy balance + Real64 TotPower = 0.0; + Real64 Power = 0.0; + Real64 ConvPower = 0.0; + Real64 RadPower = 0.0; + Real64 TotEnergy = 0.0; + Real64 Energy = 0.0; + Real64 ConvEnergy = 0.0; + Real64 RadEnergy = 0.0; + PlantLocation plantLoc = {}; + int BBLoadReSimIndex = 0; + int BBMassFlowReSimIndex = 0; + int BBInletTempFlowReSimIndex = 0; + int HeatingCapMethod = 0; // - Method for heating capacity scaled sizing calculation (HeatingDesignCapacity, CapacityPerFloorArea, + // FracOfAutosizedHeatingCapacity) + Real64 ScaledHeatingCapacity = 0.0; // - scaled maximum heating capacity {W} or scalable variable of zone HVAC equipment, {-}, or {W/m2} + Real64 ZeroBBSourceSumHATsurf = 0.0; // used in baseboard energy balance // Record keeping variables used to calculate QBBRadSrcAvg locally - Real64 QBBRadSource; // Need to keep the last value in case we are still iterating - Real64 QBBRadSrcAvg; // Need to keep the last value in case we are still iterating - Real64 LastSysTimeElapsed; // Need to keep the last value in case we are still iterating - Real64 LastTimeStepSys; // Need to keep the last value in case we are still iterating - Real64 LastQBBRadSrc; // Need to keep the last value in case we are still iterating - - // Default Constructor - HWBaseboardParams() - : EquipType(DataPlant::PlantEquipmentType::Invalid), DesignObjectPtr(0), ZonePtr(0), SchedPtr(0), WaterInletNode(0), WaterOutletNode(0), - TotSurfToDistrib(0), ControlCompTypeNum(0), CompErrIndex(0), AirMassFlowRate(0.0), AirMassFlowRateStd(0.0), WaterTempAvg(0.0), - RatedCapacity(0.0), UA(0.0), WaterMassFlowRate(0.0), WaterMassFlowRateMax(0.0), WaterMassFlowRateStd(0.0), WaterVolFlowRateMax(0.0), - WaterInletTempStd(0.0), WaterInletTemp(0.0), WaterInletEnthalpy(0.0), WaterOutletTempStd(0.0), WaterOutletTemp(0.0), - WaterOutletEnthalpy(0.0), AirInletTempStd(0.0), AirInletTemp(0.0), AirOutletTemp(0.0), AirInletHumRat(0.0), AirOutletTempStd(0.0), - FracConvect(0.0), TotPower(0.0), Power(0.0), ConvPower(0.0), RadPower(0.0), TotEnergy(0.0), Energy(0.0), ConvEnergy(0.0), - RadEnergy(0.0), plantLoc{}, BBLoadReSimIndex(0), BBMassFlowReSimIndex(0), BBInletTempFlowReSimIndex(0), HeatingCapMethod(0), - ScaledHeatingCapacity(0.0), ZeroBBSourceSumHATsurf(0.0), QBBRadSource(0.0), QBBRadSrcAvg(0.0), LastSysTimeElapsed(0.0), - LastTimeStepSys(0.0), LastQBBRadSrc(0.0) - { - } + Real64 QBBRadSource = 0.0; // Need to keep the last value in case we are still iterating + Real64 QBBRadSrcAvg = 0.0; // Need to keep the last value in case we are still iterating + Real64 LastSysTimeElapsed = 0.0; // Need to keep the last value in case we are still iterating + Real64 LastTimeStepSys = 0.0; // Need to keep the last value in case we are still iterating + Real64 LastQBBRadSrc = 0.0; // Need to keep the last value in case we are still iterating }; struct HWBaseboardDesignData : HWBaseboardParams diff --git a/src/EnergyPlus/HighTempRadiantSystem.cc b/src/EnergyPlus/HighTempRadiantSystem.cc index e118b42716c..b463957a5c9 100644 --- a/src/EnergyPlus/HighTempRadiantSystem.cc +++ b/src/EnergyPlus/HighTempRadiantSystem.cc @@ -1139,7 +1139,6 @@ namespace HighTempRadiantSystem { Real64 ThisSurfIntensity; // temporary for W/m2 term for rad on a surface // Using/Aliasing - auto &thisHTR = state.dataHighTempRadSys->HighTempRadSys(RadSysNum); auto &dataHBFS = state.dataHeatBalFanSys; // Initialize arrays @@ -1150,6 +1149,7 @@ namespace HighTempRadiantSystem { for (int RadSysNum = 1; RadSysNum <= state.dataHighTempRadSys->NumOfHighTempRadSys; ++RadSysNum) { + auto &thisHTR = state.dataHighTempRadSys->HighTempRadSys(RadSysNum); int ZoneNum = thisHTR.ZonePtr; dataHBFS->ZoneQHTRadSysToPerson(ZoneNum) = thisHTR.QHTRRadSource * thisHTR.FracRadiant * thisHTR.FracDistribPerson; From bfd6ce7402c7add8cb0ab56fa4d2a95d8d7fd401 Mon Sep 17 00:00:00 2001 From: rraustad Date: Tue, 25 Jul 2023 16:22:00 -0400 Subject: [PATCH 23/80] Protect no heating coil case and update unit test --- src/EnergyPlus/UnitarySystem.cc | 47 +++++++------- tst/EnergyPlus/unit/UnitarySystem.unit.cc | 78 +++++++++++++++++++++-- 2 files changed, 99 insertions(+), 26 deletions(-) diff --git a/src/EnergyPlus/UnitarySystem.cc b/src/EnergyPlus/UnitarySystem.cc index 904a3eea405..fff6d05ffd1 100644 --- a/src/EnergyPlus/UnitarySystem.cc +++ b/src/EnergyPlus/UnitarySystem.cc @@ -8330,14 +8330,14 @@ namespace UnitarySystems { SupHeaterLoad, CompressorONFlag); Real64 CpAir = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(this->CoolCoilInletNodeNum).HumRat); + Real64 heatCoildT = + (this->m_HeatCoilExists) + ? (state.dataLoopNodes->Node(this->HeatCoilOutletNodeNum).Temp - state.dataLoopNodes->Node(this->HeatCoilInletNodeNum).Temp) + : 0.0; Real64 CoolingOnlySensibleOutput = state.dataLoopNodes->Node(this->CoolCoilInletNodeNum).MassFlowRate * CpAir * - (state.dataLoopNodes->Node(this->NodeNumOfControlledZone).Temp - state.dataLoopNodes->Node(this->CoolCoilOutletNodeNum).Temp); - if (this->m_HeatCoilExists) { - CoolingOnlySensibleOutput -= - state.dataLoopNodes->Node(this->CoolCoilInletNodeNum).MassFlowRate * CpAir * - (state.dataLoopNodes->Node(this->HeatCoilOutletNodeNum).Temp - state.dataLoopNodes->Node(this->HeatCoilInletNodeNum).Temp); - } + ((state.dataLoopNodes->Node(this->NodeNumOfControlledZone).Temp - state.dataLoopNodes->Node(this->CoolCoilOutletNodeNum).Temp) - + heatCoildT); if (state.dataUnitarySystems->QToHeatSetPt < 0.0) { // Calculate the reheat coil load wrt the heating setpoint temperature. Reheat coil picks up // the entire excess sensible cooling (DX cooling coil and impact of outdoor air). @@ -8371,20 +8371,19 @@ namespace UnitarySystems { int constexpr MaxIter(100); // maximum number of iterations // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int SpeedNum; // multi-speed coil speed number - Real64 SensOutputOn; // sensible output at PLR = 1 [W] - Real64 LatOutputOn; // latent output at PLR = 1 [W] - Real64 TempLoad; // represents either a sensible or latent load [W] - Real64 TempSysOutput; // represents either a sensible or latent capacity [W] - Real64 TempSensOutput; // iterative sensible capacity [W] - Real64 TempLatOutput; // iterative latent capacity [W] - Real64 TempMinPLR; // iterative minimum PLR - Real64 TempMaxPLR; // iterative maximum PLR - Real64 CoolingOnlySensibleOutput; // use to calculate dehumidification induced heating [W] - Real64 CpAir; // specific heat of air [J/kg_C] - Real64 FullLoadAirOutletTemp; // saved full load outlet air temperature [C] - Real64 FullLoadAirOutletHumRat; // saved full load outlet air humidity ratio [kg/kg] - Real64 NoLoadOutletTemp; // outlet temp of system with coils off [C] + int SpeedNum; // multi-speed coil speed number + Real64 SensOutputOn; // sensible output at PLR = 1 [W] + Real64 LatOutputOn; // latent output at PLR = 1 [W] + Real64 TempLoad; // represents either a sensible or latent load [W] + Real64 TempSysOutput; // represents either a sensible or latent capacity [W] + Real64 TempSensOutput; // iterative sensible capacity [W] + Real64 TempLatOutput; // iterative latent capacity [W] + Real64 TempMinPLR; // iterative minimum PLR + Real64 TempMaxPLR; // iterative maximum PLR + Real64 CpAir; // specific heat of air [J/kg_C] + Real64 FullLoadAirOutletTemp; // saved full load outlet air temperature [C] + Real64 FullLoadAirOutletHumRat; // saved full load outlet air humidity ratio [kg/kg] + Real64 NoLoadOutletTemp; // outlet temp of system with coils off [C] std::string CompName = this->Name; int OutletNode = this->AirOutNode; @@ -9933,10 +9932,14 @@ namespace UnitarySystems { FullSensibleOutput = TempSensOutput; CpAir = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(this->CoolCoilInletNodeNum).HumRat); - CoolingOnlySensibleOutput = + Real64 heatCoildT = + (this->m_HeatCoilExists) + ? (state.dataLoopNodes->Node(this->HeatCoilOutletNodeNum).Temp - state.dataLoopNodes->Node(this->HeatCoilInletNodeNum).Temp) + : 0.0; + Real64 CoolingOnlySensibleOutput = state.dataLoopNodes->Node(this->CoolCoilInletNodeNum).MassFlowRate * CpAir * ((state.dataLoopNodes->Node(this->NodeNumOfControlledZone).Temp - state.dataLoopNodes->Node(this->CoolCoilOutletNodeNum).Temp) - - (state.dataLoopNodes->Node(this->HeatCoilOutletNodeNum).Temp - state.dataLoopNodes->Node(this->HeatCoilInletNodeNum).Temp)); + heatCoildT); if (state.dataUnitarySystems->QToHeatSetPt < 0.0) { // Calculate the reheat coil load wrt the heating setpoint temperature. Reheat coil picks up // the entire excess sensible cooling (DX cooling coil and impact of outdoor air). diff --git a/tst/EnergyPlus/unit/UnitarySystem.unit.cc b/tst/EnergyPlus/unit/UnitarySystem.unit.cc index 71a713b1e63..81b800793f2 100644 --- a/tst/EnergyPlus/unit/UnitarySystem.unit.cc +++ b/tst/EnergyPlus/unit/UnitarySystem.unit.cc @@ -6047,7 +6047,7 @@ Curve:Biquadratic, state->dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputRequired = 1000.0; // heating load state->dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputReqToCoolSP = 2000.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputReqToHeatSP = 1000.0; - state->dataZoneEnergyDemand->ZoneSysMoistureDemand(ControlZoneNum).RemainingOutputReqToDehumidSP = -0.00001; + state->dataZoneEnergyDemand->ZoneSysMoistureDemand(ControlZoneNum).RemainingOutputReqToDehumidSP = -0.0006; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlZoneNum).SequencedOutputRequired.allocate(1); state->dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlZoneNum).SequencedOutputRequiredToCoolingSP.allocate(1); @@ -6108,7 +6108,7 @@ Curve:Biquadratic, EXPECT_NEAR(state->dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputRequired, thisSys->m_SensibleLoadMet, 0.01); // Watts EXPECT_DOUBLE_EQ(state->dataLoopNodes->Node(InletNode).MassFlowRate, thisSys->MaxHeatAirMassFlow * thisSys->m_PartLoadFrac); // cycling fan EXPECT_DOUBLE_EQ(state->dataLoopNodes->Node(InletNode).MassFlowRate, state->dataLoopNodes->Node(OutletNode).MassFlowRate); - EXPECT_DOUBLE_EQ(thisSys->m_MoistureLoadPredicted, 0.0); // dehumidification control type = none so MoistureLoad reset o 0 + EXPECT_DOUBLE_EQ(thisSys->m_MoistureLoadPredicted, 0.0); // dehumidification control type = none so MoistureLoad reset to 0 state->dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputRequired = -1000.0; // cooling load state->dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlZoneNum).OutputRequiredToCoolingSP = -1000.0; @@ -6124,7 +6124,8 @@ Curve:Biquadratic, // set zone temperature state->dataLoopNodes->Node(ControlZoneNum).Temp = 24.0; // set zone temperature during cooling season used to determine system delivered capacity - state->dataEnvrn->OutDryBulbTemp = 35.0; // initialize weather + state->dataLoopNodes->Node(ControlZoneNum).HumRat = 0.01; // set zone humrat during cooling season used to determine system delivered capacity + state->dataEnvrn->OutDryBulbTemp = 35.0; // initialize weather state->dataEnvrn->OutHumRat = 0.1; state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->OutWetBulbTemp = 30.0; @@ -6187,8 +6188,13 @@ Curve:Biquadratic, EXPECT_DOUBLE_EQ(state->dataLoopNodes->Node(InletNode).MassFlowRate, thisSys->MaxCoolAirMassFlow * thisSys->m_PartLoadFrac); // cycling fan EXPECT_DOUBLE_EQ(state->dataLoopNodes->Node(InletNode).MassFlowRate, state->dataLoopNodes->Node(OutletNode).MassFlowRate); + state->dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputRequired = 1000.0; // heating load + state->dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlZoneNum).OutputRequiredToCoolingSP = 2000.0; + state->dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlZoneNum).OutputRequiredToHeatingSP = 1000.0; // turn on dehumidification control and check that moisture load is < 0 + FirstHVACIteration = false; // heating coil calculations only happen when FirstHVACIteration = false thisSys->m_DehumidControlType_Num = UnitarySys::DehumCtrlType::CoolReheat; + thisSys->m_Humidistat = true; thisSys->m_RunOnLatentLoad = true; thisSys->simulate(*state, thisSys->Name, @@ -6202,7 +6208,71 @@ Curve:Biquadratic, ZoneEquipment, sensOut, latOut); - EXPECT_LT(thisSys->m_MoistureLoadPredicted, 0.0); // dehumidification control type = CoolReheat so MoistureLoad < 0 + // test model performance + EXPECT_NEAR(state->dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputRequired, 1000.0, 0.0001); // Watts + EXPECT_NEAR(state->dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputRequired, thisSys->m_SensibleLoadMet, 11.0); // Watts + // test simulate function return value for sysOutputRequired + EXPECT_NEAR(state->dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputRequired, sensOut, 11.0); // Watts + Real64 HgAir = Psychrometrics::PsyHgAirFnWTdb(state->dataLoopNodes->Node(ControlZoneNum).HumRat, state->dataLoopNodes->Node(ControlZoneNum).Temp); + EXPECT_NEAR( + state->dataZoneEnergyDemand->ZoneSysMoistureDemand(ControlZoneNum).RemainingOutputReqToDehumidSP, -0.0006, 0.00001); // kg moisture per sec + EXPECT_NEAR(state->dataZoneEnergyDemand->ZoneSysMoistureDemand(ControlZoneNum).RemainingOutputReqToDehumidSP * HgAir, latOut, 55.0); // Watts + + // not sure why the above control is loose, i.e., 11 W on sensible and 55 W on latent. + EXPECT_NEAR(sensOut, 1010.6, 0.1); // Watts + EXPECT_NEAR(latOut, -1477.7, 0.1); // Watts + EXPECT_NEAR(state->dataUnitarySystems->QToHeatSetPt, 1000.0, 0.1); // heating load + EXPECT_NEAR(thisSys->m_MoistureLoadPredicted, -1467.1, 0.1); // dehumidification control type = CoolReheat so MoistureLoad < 0 + + // results using hand calcs + Real64 CpAir = Psychrometrics::PsyCpAirFnW(state->dataLoopNodes->Node(ControlZoneNum).HumRat); + Real64 DeliveredSensibleCapacity = state->dataLoopNodes->Node(thisSys->AirOutNode).MassFlowRate * CpAir * + (state->dataLoopNodes->Node(thisSys->AirOutNode).Temp - state->dataLoopNodes->Node(ControlZoneNum).Temp); + EXPECT_NEAR(DeliveredSensibleCapacity, 1010.6, 0.001); // actual delivered capacity + EXPECT_NEAR(DeliveredSensibleCapacity, thisSys->m_SensibleLoadMet, 0.001); // Watts - heating + + Real64 RoomDeltaW = state->dataLoopNodes->Node(thisSys->AirOutNode).HumRat - state->dataLoopNodes->Node(ControlZoneNum).HumRat; + Real64 OutDeltaW = state->dataLoopNodes->Node(thisSys->CoolCoilOutletNodeNum).HumRat - state->dataLoopNodes->Node(ControlZoneNum).HumRat; + Real64 OutMassFlow = state->dataLoopNodes->Node(thisSys->AirOutNode).MassFlowRate; + Real64 LatentOutput = OutDeltaW * OutMassFlow * HgAir; + EXPECT_NEAR(OutDeltaW, -0.0003193, 0.0000001); + EXPECT_NEAR(OutDeltaW, RoomDeltaW, 0.0000001); + EXPECT_NEAR(LatentOutput, -1477.1, 0.1); + + Real64 ExcessSensibleCapacity = + state->dataLoopNodes->Node(thisSys->AirOutNode).MassFlowRate * CpAir * + (state->dataLoopNodes->Node(thisSys->CoolCoilOutletNodeNum).Temp - state->dataLoopNodes->Node(ControlZoneNum).Temp); + EXPECT_NEAR(ExcessSensibleCapacity, -17268.1, 0.1); + EXPECT_NEAR(state->dataHeatingCoils->HeatingCoil(thisSys->m_HeatingCoilIndex).HeatingCoilRate, 0.0, 0.1); + EXPECT_NEAR(state->dataHeatingCoils->HeatingCoil(thisSys->m_SuppHeatCoilIndex).HeatingCoilRate, 18268.1, 0.1); + Real64 ReheatNeded = sensOut - ExcessSensibleCapacity; + EXPECT_NEAR(ReheatNeded, 18268.1, 11.0); // same 11 watt difference as above, is this error due to tolerance? + + // remove heating coil to test cooling only application + thisSys->m_HeatCoilExists = false; + thisSys->m_HeatingCoilIndex = 0; + thisSys->HeatCoilInletNodeNum = 0; + thisSys->HeatCoilOutletNodeNum = 0; + thisSys->simulate(*state, + thisSys->Name, + FirstHVACIteration, + AirLoopNum, + CompIndex, + HeatActive, + CoolActive, + ZoneOAUnitNum, + OAUCoilOutTemp, + ZoneEquipment, + sensOut, + latOut); + Real64 SaveDeliveredSensibleCapacity = DeliveredSensibleCapacity; + DeliveredSensibleCapacity = state->dataLoopNodes->Node(thisSys->AirOutNode).MassFlowRate * CpAir * + (state->dataLoopNodes->Node(thisSys->AirOutNode).Temp - state->dataLoopNodes->Node(ControlZoneNum).Temp); + // same answers as above, wihtout heating coil present, and no crash + EXPECT_NEAR(DeliveredSensibleCapacity, SaveDeliveredSensibleCapacity, 0.0001); // actual delivered capacity + EXPECT_NEAR(DeliveredSensibleCapacity, 1010.6, 0.001); // actual delivered capacity + EXPECT_NEAR(state->dataHeatingCoils->HeatingCoil(thisSys->m_SuppHeatCoilIndex).HeatingCoilRate, 18268.1, 0.1); // actual reheat load to meet SP + EXPECT_NEAR(state->dataHeatingCoils->HeatingCoil(thisSys->m_SuppHeatCoilIndex).HeatingCoilRate, 18268.1, 0.1); } TEST_F(EnergyPlusFixture, UnitarySystemModel_VSDXCoilSizing) From 9676b2b444c398b3b5ed700e2c24e068f002d8aa Mon Sep 17 00:00:00 2001 From: rraustad Date: Tue, 25 Jul 2023 16:24:50 -0400 Subject: [PATCH 24/80] small correction to unit test --- tst/EnergyPlus/unit/UnitarySystem.unit.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tst/EnergyPlus/unit/UnitarySystem.unit.cc b/tst/EnergyPlus/unit/UnitarySystem.unit.cc index 81b800793f2..318a42032e2 100644 --- a/tst/EnergyPlus/unit/UnitarySystem.unit.cc +++ b/tst/EnergyPlus/unit/UnitarySystem.unit.cc @@ -6272,7 +6272,7 @@ Curve:Biquadratic, EXPECT_NEAR(DeliveredSensibleCapacity, SaveDeliveredSensibleCapacity, 0.0001); // actual delivered capacity EXPECT_NEAR(DeliveredSensibleCapacity, 1010.6, 0.001); // actual delivered capacity EXPECT_NEAR(state->dataHeatingCoils->HeatingCoil(thisSys->m_SuppHeatCoilIndex).HeatingCoilRate, 18268.1, 0.1); // actual reheat load to meet SP - EXPECT_NEAR(state->dataHeatingCoils->HeatingCoil(thisSys->m_SuppHeatCoilIndex).HeatingCoilRate, 18268.1, 0.1); + EXPECT_NEAR(thisSys->m_MoistureLoadPredicted, -1467.1, 0.1); // dehumidification control type = CoolReheat so MoistureLoad < 0 } TEST_F(EnergyPlusFixture, UnitarySystemModel_VSDXCoilSizing) From 3172adc1931c2c74cf90c9296aa48c702f07bb09 Mon Sep 17 00:00:00 2001 From: rraustad Date: Wed, 9 Aug 2023 19:44:12 -0400 Subject: [PATCH 25/80] Original code changes --- src/EnergyPlus/HVACHXAssistedCoolingCoil.cc | 6 ++++-- src/EnergyPlus/HeatRecovery.cc | 2 +- src/EnergyPlus/MixedAir.cc | 15 +++++++++++++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc b/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc index 8215ff6bd50..1fe40d32bf1 100644 --- a/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc +++ b/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc @@ -611,12 +611,14 @@ namespace HVACHXAssistedCoolingCoil { // Get the data for the Coil:Water:CoolingHeatExchangerAssisted objects CurrentModuleObject = "CoilSystem:Cooling:Water:HeatExchangerAssisted"; - for (HXAssistedCoilNum = NumHXAssistedDXCoils + 1; HXAssistedCoilNum <= NumHXAssistedWaterCoils; ++HXAssistedCoilNum) { + for (HXAssistedCoilNum = NumHXAssistedDXCoils + 1; HXAssistedCoilNum <= state.dataHVACAssistedCC->TotalNumHXAssistedCoils; + ++HXAssistedCoilNum) { + int thisWaterHXNum = HXAssistedCoilNum - NumHXAssistedDXCoils; auto &thisHXCoil = state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum); state.dataInputProcessing->inputProcessor->getObjectItem(state, CurrentModuleObject, - HXAssistedCoilNum, + thisWaterHXNum, AlphArray, NumAlphas, NumArray, diff --git a/src/EnergyPlus/HeatRecovery.cc b/src/EnergyPlus/HeatRecovery.cc index 325b0777f10..5583f98f6e6 100644 --- a/src/EnergyPlus/HeatRecovery.cc +++ b/src/EnergyPlus/HeatRecovery.cc @@ -2612,7 +2612,7 @@ namespace HeatRecovery { HXPartLoadRatio = max(0.0, HXPartLoadRatio); HXPartLoadRatio = min(1.0, HXPartLoadRatio); - } else if (CompanionCoilIndex > 0) { + } else if (CompanionCoilIndex > 0 && !state.dataDXCoils->DXCoilPartLoadRatio.empty()) { // VS coil issue here? HXPartLoadRatio = state.dataDXCoils->DXCoilPartLoadRatio(CompanionCoilIndex); } diff --git a/src/EnergyPlus/MixedAir.cc b/src/EnergyPlus/MixedAir.cc index 18e8d96b765..00de037e27d 100644 --- a/src/EnergyPlus/MixedAir.cc +++ b/src/EnergyPlus/MixedAir.cc @@ -1050,8 +1050,6 @@ void GetOutsideAirSysInputs(EnergyPlusData &state) OASys.ComponentTypeEnum(CompNum) == SimAirServingZones::CompType::UnitarySystemModel || OASys.ComponentTypeEnum(CompNum) == SimAirServingZones::CompType::DXSystem) { OASys.ComponentIndex(CompNum) = CompNum; - OASys.compPointer[CompNum] = - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, OASys.ComponentName(CompNum), false, 0); } else if (OASys.ComponentTypeEnum(CompNum) == SimAirServingZones::CompType::Invalid) { std::string const thisComp = OASys.ComponentType(CompNum); if (thisComp == "HEATEXCHANGER:AIRTOAIR:SENSIBLEANDLATENT" || thisComp == "HEATEXCHANGER:DESICCANT:BALANCEDFLOW") { @@ -1094,6 +1092,19 @@ void GetOutsideAirSysInputs(EnergyPlusData &state) lNumericBlanks.deallocate(); state.dataMixedAir->GetOASysInputFlag = false; + + // once GetOASysInputFlag is set to false other calls to objects can occur without worry that GetOutsideAirSysInputs will be called again + // now get the pointer for UnitarySystem - doing this earlier can cause recursion which trips IntraObjUniquenessCheck warnings + for (int OASysNum = 1; OASysNum <= state.dataAirLoop->NumOASystems; ++OASysNum) { + for (int CompNum = 1; CompNum <= state.dataAirLoop->OutsideAirSys(OASysNum).NumComponents; ++CompNum) { + if (state.dataAirLoop->OutsideAirSys(OASysNum).ComponentTypeEnum(CompNum) == SimAirServingZones::CompType::CoilSystemWater || + state.dataAirLoop->OutsideAirSys(OASysNum).ComponentTypeEnum(CompNum) == SimAirServingZones::CompType::UnitarySystemModel || + state.dataAirLoop->OutsideAirSys(OASysNum).ComponentTypeEnum(CompNum) == SimAirServingZones::CompType::DXSystem) { + state.dataAirLoop->OutsideAirSys(OASysNum).compPointer[CompNum] = UnitarySystems::UnitarySys::factory( + state, DataHVACGlobals::UnitarySys_AnyCoilType, state.dataAirLoop->OutsideAirSys(OASysNum).ComponentName(CompNum), false, 0); + } + } + } } void GetOAControllerInputs(EnergyPlusData &state) From 33e0f1506e34c4b646998bfb7c3c104a7e33ba46 Mon Sep 17 00:00:00 2001 From: rraustad Date: Fri, 11 Aug 2023 11:49:17 -0400 Subject: [PATCH 26/80] Call correct coil model to avoid inaccurate data or crash --- src/EnergyPlus/HeatRecovery.cc | 37 +++++++++++++++++++++++----------- src/EnergyPlus/HeatRecovery.hh | 13 ++++++------ 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/src/EnergyPlus/HeatRecovery.cc b/src/EnergyPlus/HeatRecovery.cc index 5583f98f6e6..8aa9a200ba8 100644 --- a/src/EnergyPlus/HeatRecovery.cc +++ b/src/EnergyPlus/HeatRecovery.cc @@ -165,8 +165,8 @@ namespace HeatRecovery { } } - int CompanionCoilNum = present(CompanionCoilIndex) ? int(CompanionCoilIndex) : 0; // Index to companion cooling coil - int companionCoilType = present(CompanionCoilType_Num) ? int(CompanionCoilType_Num) : 0; + int CompanionCoilNum = present(CompanionCoilIndex) ? int(CompanionCoilIndex) : -1; // Index to companion cooling coil + int companionCoilType = present(CompanionCoilType_Num) ? int(CompanionCoilType_Num) : -1; bool HXUnitOn; // flag to enable heat exchanger if (present(HXUnitEnable)) { @@ -178,7 +178,7 @@ namespace HeatRecovery { } else { // HX is placed on a BRANCH, optional arguments are not passed in from SimAirServingZones. // HX will calculate its own part-load ratio if optional HXUnitEnable flag is not present - HXUnitOn = true; + HXUnitOn = (HXPartLoadRatio > 0.0); state.dataHeatRecovery->CalledFromParentObject = false; } @@ -199,8 +199,16 @@ namespace HeatRecovery { case DataHVACGlobals::HX_DESICCANT_BALANCED: Real64 PartLoadRatio = present(HXPartLoadRatio) ? Real64(HXPartLoadRatio) : 1.0; // Part load ratio requested of DX compressor bool RegInIsOANode = present(RegenInletIsOANode) && bool(RegenInletIsOANode); - thisExch.CalcDesiccantBalancedHeatExch( - state, HXUnitOn, FirstHVACIteration, FanOpMode, PartLoadRatio, CompanionCoilNum, RegInIsOANode, EconomizerFlag, HighHumCtrlFlag); + thisExch.CalcDesiccantBalancedHeatExch(state, + HXUnitOn, + FirstHVACIteration, + FanOpMode, + PartLoadRatio, + CompanionCoilNum, + companionCoilType, + RegInIsOANode, + EconomizerFlag, + HighHumCtrlFlag); break; } @@ -1494,10 +1502,9 @@ namespace HeatRecovery { } } - if ((((CompanionCoilType_Num == DataHVACGlobals::CoilDX_CoolingSingleSpeed) || - (CompanionCoilType_Num == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed)) && - (CompanionCoilIndex > 0)) || - ((CompanionCoilType_Num == DataHVACGlobals::CoilDX_Cooling) && (CompanionCoilIndex > -1))) { + if ((CompanionCoilIndex > -1) && ((CompanionCoilType_Num == DataHVACGlobals::CoilDX_CoolingSingleSpeed) || + (CompanionCoilType_Num == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) || + (CompanionCoilType_Num == DataHVACGlobals::CoilDX_Cooling))) { if (CompanionCoilType_Num == DataHVACGlobals::CoilDX_CoolingSingleSpeed || CompanionCoilType_Num == DataHVACGlobals::CoilDX_CoolingTwoStageWHumControl) { @@ -2386,6 +2393,7 @@ namespace HeatRecovery { int const FanOpMode, // Supply air fan operating mode (1=cycling, 2=constant) Real64 const PartLoadRatio, // Part load ratio requested of DX compressor int const CompanionCoilIndex, // index of companion cooling coil + int const CompanionCoilType, // type of cooling coil bool const RegenInletIsOANode, // Flag to determine if regen side inlet is OANode, if so this air stream cycles ObjexxFCL::Optional_bool_const EconomizerFlag, // economizer flag pass by air loop or OA sys ObjexxFCL::Optional_bool_const HighHumCtrlFlag // high humidity control flag passed by airloop or OA sys @@ -2612,9 +2620,14 @@ namespace HeatRecovery { HXPartLoadRatio = max(0.0, HXPartLoadRatio); HXPartLoadRatio = min(1.0, HXPartLoadRatio); - } else if (CompanionCoilIndex > 0 && !state.dataDXCoils->DXCoilPartLoadRatio.empty()) { - // VS coil issue here? - HXPartLoadRatio = state.dataDXCoils->DXCoilPartLoadRatio(CompanionCoilIndex); + } else if (CompanionCoilType > 0 && CompanionCoilIndex > -1) { + if (CompanionCoilType == DataHVACGlobals::CoilDX_Cooling) { + HXPartLoadRatio = state.dataCoilCooingDX->coilCoolingDXs[CompanionCoilIndex].partLoadRatioReport; + } else if (CompanionCoilType == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) { + HXPartLoadRatio = state.dataVariableSpeedCoils->VarSpeedCoil(CompanionCoilIndex).PartLoadRatio; + } else { + HXPartLoadRatio = state.dataDXCoils->DXCoilPartLoadRatio(CompanionCoilIndex); + } } Real64 constexpr lowerLimit = 1.e-5; diff --git a/src/EnergyPlus/HeatRecovery.hh b/src/EnergyPlus/HeatRecovery.hh index 0a21ebe7b04..285fa5161f2 100644 --- a/src/EnergyPlus/HeatRecovery.hh +++ b/src/EnergyPlus/HeatRecovery.hh @@ -222,12 +222,13 @@ namespace HeatRecovery { void CalcDesiccantBalancedHeatExch(EnergyPlusData &state, - bool HXUnitOn, // flag to simulate heat exchager heat recovery - bool FirstHVACIteration, // First HVAC iteration flag - int FanOpMode, // Supply air fan operating mode (1=cycling, 2=constant) - Real64 PartLoadRatio, // Part load ratio requested of DX compressor - int CompanionCoilIndex, // index of companion cooling coil - bool RegenInletIsOANode, // Flag to determine if regen side inlet is OANode, if so this air stream cycles + bool HXUnitOn, // flag to simulate heat exchager heat recovery + bool FirstHVACIteration, // First HVAC iteration flag + int FanOpMode, // Supply air fan operating mode (1=cycling, 2=constant) + Real64 PartLoadRatio, // Part load ratio requested of DX compressor + int CompanionCoilIndex, // index of companion cooling coil + int CompanionCoilType, // type of cooling coil + bool RegenInletIsOANode, // Flag to determine if regen side inlet is OANode, if so this air stream cycles ObjexxFCL::Optional_bool_const EconomizerFlag = _, // economizer flag pass by air loop or OA sys ObjexxFCL::Optional_bool_const HighHumCtrlFlag = _ // high humidity control flag passed by airloop or OA sys ); From fa1607effb2cd68f5467bc44168e1f198c7f2cf0 Mon Sep 17 00:00:00 2001 From: rraustad Date: Fri, 11 Aug 2023 13:14:19 -0400 Subject: [PATCH 27/80] Correct CI failure by protecting optional argument --- src/EnergyPlus/HeatRecovery.cc | 6 +++++- src/EnergyPlus/HeatRecovery.hh | 14 +++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/EnergyPlus/HeatRecovery.cc b/src/EnergyPlus/HeatRecovery.cc index 8aa9a200ba8..932a77b036f 100644 --- a/src/EnergyPlus/HeatRecovery.cc +++ b/src/EnergyPlus/HeatRecovery.cc @@ -178,7 +178,11 @@ namespace HeatRecovery { } else { // HX is placed on a BRANCH, optional arguments are not passed in from SimAirServingZones. // HX will calculate its own part-load ratio if optional HXUnitEnable flag is not present - HXUnitOn = (HXPartLoadRatio > 0.0); + if (present(HXPartLoadRatio)) { + HXUnitOn = (HXPartLoadRatio > 0.0); + } else { + HXUnitOn = true; + } state.dataHeatRecovery->CalledFromParentObject = false; } diff --git a/src/EnergyPlus/HeatRecovery.hh b/src/EnergyPlus/HeatRecovery.hh index 285fa5161f2..267b5a88d3a 100644 --- a/src/EnergyPlus/HeatRecovery.hh +++ b/src/EnergyPlus/HeatRecovery.hh @@ -222,13 +222,13 @@ namespace HeatRecovery { void CalcDesiccantBalancedHeatExch(EnergyPlusData &state, - bool HXUnitOn, // flag to simulate heat exchager heat recovery - bool FirstHVACIteration, // First HVAC iteration flag - int FanOpMode, // Supply air fan operating mode (1=cycling, 2=constant) - Real64 PartLoadRatio, // Part load ratio requested of DX compressor - int CompanionCoilIndex, // index of companion cooling coil - int CompanionCoilType, // type of cooling coil - bool RegenInletIsOANode, // Flag to determine if regen side inlet is OANode, if so this air stream cycles + bool HXUnitOn, // flag to simulate heat exchager heat recovery + bool FirstHVACIteration, // First HVAC iteration flag + int FanOpMode, // Supply air fan operating mode (1=cycling, 2=constant) + Real64 PartLoadRatio, // Part load ratio requested of DX compressor + int CompanionCoilIndex, // index of companion cooling coil + int CompanionCoilType, // type of cooling coil + bool RegenInletIsOANode, // Flag to determine if regen side inlet is OANode, if so this air stream cycles ObjexxFCL::Optional_bool_const EconomizerFlag = _, // economizer flag pass by air loop or OA sys ObjexxFCL::Optional_bool_const HighHumCtrlFlag = _ // high humidity control flag passed by airloop or OA sys ); From 26bd493388d489c7f4b4389f3ebec4c10337ae92 Mon Sep 17 00:00:00 2001 From: Rick Strand Date: Thu, 17 Aug 2023 09:14:04 -0500 Subject: [PATCH 28/80] UFAD code clarification Made the code consistent with the documentation which corrected an oversight in the way that convective energy was summed for a particular UFAD sizing. Also corrected a bug in an initialization. This should resolve the issue. --- src/EnergyPlus/UFADManager.cc | 87 +++++++++++++++++------------------ src/EnergyPlus/UFADManager.hh | 2 + 2 files changed, 45 insertions(+), 44 deletions(-) diff --git a/src/EnergyPlus/UFADManager.cc b/src/EnergyPlus/UFADManager.cc index c8159bb98b8..f62d4679182 100644 --- a/src/EnergyPlus/UFADManager.cc +++ b/src/EnergyPlus/UFADManager.cc @@ -226,12 +226,6 @@ namespace RoomAir { using DataSizing::AutoSize; - Real64 ZoneElecConv(0.0); // zone elec equip design convective gain [W] - Real64 ZoneGasConv(0.0); // zone gas equip design convective gain [W] - Real64 ZoneOthEqConv(0.0); // zone other equip design convective gain [W] - Real64 ZoneHWEqConv(0.0); // zone hot water equip design convective gain [W] - Real64 ZoneSteamEqConv(0.0); // zone steam equip design convective gain [W] - // This is for both UFADInt and UFADExt auto &zoneU = state.dataRoomAir->ZoneUFAD(state.dataRoomAir->ZoneUFADPtr(ZoneNum)); @@ -329,45 +323,8 @@ namespace RoomAir { } if (zoneU.PowerPerPlume == Constant::AutoCalculate) { - Real64 NumberOfPlumes = (NumberOfOccupants > 0.0) ? NumberOfOccupants : 1.0; - - ZoneElecConv = 0.0; - for (auto const &zoneElectric : state.dataHeatBal->ZoneElectric) { - if (zoneElectric.ZonePtr == ZoneNum) { - // Is the behavior for Exterior UFAD supposed to be different than for Interior UFAD? - ZoneElecConv += - (model == RoomAirModel::UFADExt) ? zoneElectric.DesignLevel : (zoneElectric.DesignLevel * zoneElectric.FractionConvected); - } - } - ZoneGasConv = 0.0; - for (auto const &zoneGas : state.dataHeatBal->ZoneGas) { - if (zoneGas.ZonePtr == ZoneNum) { - ZoneGasConv += (model == RoomAirModel::UFADExt) ? zoneGas.DesignLevel : (zoneGas.DesignLevel * zoneGas.FractionConvected); - } - } - ZoneOthEqConv = 0.0; - for (auto const &zoneOtherEq : state.dataHeatBal->ZoneOtherEq) { - if (zoneOtherEq.ZonePtr == ZoneNum) { - ZoneOthEqConv += - (model == RoomAirModel::UFADExt) ? zoneOtherEq.DesignLevel : (zoneOtherEq.DesignLevel * zoneOtherEq.FractionConvected); - } - } - ZoneHWEqConv = 0.0; - for (auto const &zoneHWEq : state.dataHeatBal->ZoneHWEq) { - if (zoneHWEq.ZonePtr == ZoneNum) { - ZoneHWEqConv += (model == RoomAirModel::UFADExt) ? zoneHWEq.DesignLevel : (zoneHWEq.DesignLevel * zoneHWEq.FractionConvected); - } - } - for (auto const &zoneSteamEq : state.dataHeatBal->ZoneSteamEq) { - ZoneSteamEqConv = 0.0; // I'm 99.72% sure this is a bug. - if (zoneSteamEq.ZonePtr == ZoneNum) { - ZoneSteamEqConv += - (model == RoomAirModel::UFADExt) ? zoneSteamEq.DesignLevel : (zoneSteamEq.DesignLevel * zoneSteamEq.FractionConvected); - } - } - zoneU.PowerPerPlume = - (NumberOfOccupants * 73.0 + ZoneElecConv + ZoneGasConv + ZoneOthEqConv + ZoneHWEqConv + ZoneSteamEqConv) / NumberOfPlumes; + zoneU.PowerPerPlume = sumUFADConvGainPerPlume(state, ZoneNum, NumberOfOccupants); BaseSizer::reportSizerOutput(state, cCMO, zoneU.ZoneName, "Power per plume [W]", zoneU.PowerPerPlume); @@ -384,6 +341,48 @@ namespace RoomAir { } } + Real64 sumUFADConvGainPerPlume(EnergyPlusData &state, int const zoneNum, Real64 const numOccupants) + { + Real64 zoneElecConv(0.0); // zone elec equip design convective gain [W] + for (auto const &zoneElectric : state.dataHeatBal->ZoneElectric) { + if (zoneElectric.ZonePtr == zoneNum) { + zoneElecConv += zoneElectric.DesignLevel * zoneElectric.FractionConvected; + } + } + + Real64 zoneGasConv(0.0); // zone gas equip design convective gain [W] + for (auto const &zoneGas : state.dataHeatBal->ZoneGas) { + if (zoneGas.ZonePtr == zoneNum) { + zoneGasConv += zoneGas.DesignLevel * zoneGas.FractionConvected; + } + } + + Real64 zoneOthEqConv(0.0); // zone other equip design convective gain [W] + for (auto const &zoneOtherEq : state.dataHeatBal->ZoneOtherEq) { + if (zoneOtherEq.ZonePtr == zoneNum) { + zoneOthEqConv += zoneOtherEq.DesignLevel * zoneOtherEq.FractionConvected; + } + } + + Real64 zoneHWEqConv(0.0); // zone hot water equip design convective gain [W] + for (auto const &zoneHWEq : state.dataHeatBal->ZoneHWEq) { + if (zoneHWEq.ZonePtr == zoneNum) { + zoneHWEqConv += zoneHWEq.DesignLevel * zoneHWEq.FractionConvected; + } + } + + Real64 zoneSteamEqConv(0.0); // zone steam equip design convective gain [W] + for (auto const &zoneSteamEq : state.dataHeatBal->ZoneSteamEq) { + if (zoneSteamEq.ZonePtr == zoneNum) { + zoneSteamEqConv += zoneSteamEq.DesignLevel * zoneSteamEq.FractionConvected; + } + } + + Real64 numPlumes = (numOccupants > 0.0) ? numOccupants : 1.0; + + return (numOccupants * 73.0 + zoneElecConv + zoneGasConv + zoneOthEqConv + zoneHWEqConv + zoneSteamEqConv) / numPlumes; + } + void HcUFAD(EnergyPlusData &state, int const ZoneNum, Real64 const FractionHeight, UFADConvCoef &ufadCC) { diff --git a/src/EnergyPlus/UFADManager.hh b/src/EnergyPlus/UFADManager.hh index 634f0620b14..a0ed2d8455c 100644 --- a/src/EnergyPlus/UFADManager.hh +++ b/src/EnergyPlus/UFADManager.hh @@ -88,6 +88,8 @@ namespace RoomAir { RoomAir::RoomAirModel const ZoneModelType // type of zone model; UCSDUFI = 6 ); + Real64 sumUFADConvGainPerPlume(EnergyPlusData &state, int const zoneNum, Real64 const numOccupants); + void HcUFAD(EnergyPlusData &state, int const ZoneNum, Real64 const FractionHeight, UFADConvCoef &ufadCC); void CalcUFADInt(EnergyPlusData &state, int const ZoneNum); // index number for the specified zone From 43612eb0698c9d72eb66bd5f9922d888692fae52 Mon Sep 17 00:00:00 2001 From: Rick Strand Date: Fri, 18 Aug 2023 13:34:16 -0500 Subject: [PATCH 29/80] UFAD Fix Unit Test Unit test of the new subroutine that calculates convective gain per plume. This was a new file so this impacted CMakeList.txt as well. --- tst/EnergyPlus/unit/CMakeLists.txt | 1 + tst/EnergyPlus/unit/UFADManager.unit.cc | 157 ++++++++++++++++++++++++ 2 files changed, 158 insertions(+) create mode 100644 tst/EnergyPlus/unit/UFADManager.unit.cc diff --git a/tst/EnergyPlus/unit/CMakeLists.txt b/tst/EnergyPlus/unit/CMakeLists.txt index f291923a758..fc089dca9a0 100644 --- a/tst/EnergyPlus/unit/CMakeLists.txt +++ b/tst/EnergyPlus/unit/CMakeLists.txt @@ -232,6 +232,7 @@ set(test_src TranspiredCollector.unit.cc UnitHeater.unit.cc UnitVentilator.unit.cc + UFADManager.unit.cc UnitaryHybridAirConditioner.unit.cc UnitarySystem.unit.cc UtilityRoutines.unit.cc diff --git a/tst/EnergyPlus/unit/UFADManager.unit.cc b/tst/EnergyPlus/unit/UFADManager.unit.cc new file mode 100644 index 00000000000..9bbc8dab276 --- /dev/null +++ b/tst/EnergyPlus/unit/UFADManager.unit.cc @@ -0,0 +1,157 @@ +// EnergyPlus, Copyright (c) 1996-2023, The Board of Trustees of the University of Illinois, +// The Regents of the University of California, through Lawrence Berkeley National Laboratory +// (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge +// National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other +// contributors. All rights reserved. +// +// NOTICE: This Software was developed under funding from the U.S. Department of Energy and the +// U.S. Government consequently retains certain rights. As such, the U.S. Government has been +// granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, +// worldwide license in the Software to reproduce, distribute copies to the public, prepare +// derivative works, and perform publicly and display publicly, and to permit others to do so. +// +// Redistribution and use in source and binary forms, with or without modification, are permitted +// provided that the following conditions are met: +// +// (1) Redistributions of source code must retain the above copyright notice, this list of +// conditions and the following disclaimer. +// +// (2) Redistributions in binary form must reproduce the above copyright notice, this list of +// conditions and the following disclaimer in the documentation and/or other materials +// provided with the distribution. +// +// (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory, +// the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be +// used to endorse or promote products derived from this software without specific prior +// +// (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form +// without changes from the version obtained under this License, or (ii) Licensee makes a +// reference solely to the software portion of its product, Licensee must refer to the +// software as "EnergyPlus version X" software, where "X" is the version number Licensee +// obtained under this License and may not use a different name for the software. Except as +// specifically required in this Section (4), Licensee shall not use in a company name, a +// product name, in advertising, publicity, or other promotional activities any name, trade +// name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly +// similar designation, without the U.S. Department of Energy's prior written consent. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// EnergyPlus::Pumps Unit Tests + +// Google Test Headers +#include + +// EnergyPlus Headers +#include +#include +#include + +#include "Fixtures/EnergyPlusFixture.hh" + +namespace EnergyPlus { + +TEST_F(EnergyPlusFixture, UFADManagerTest_sumUFADConvGainPerPlume) +{ + auto &dataHB = state->dataHeatBal; + dataHB->ZoneElectric.allocate(5); + dataHB->ZoneGas.allocate(5); + dataHB->ZoneOtherEq.allocate(5); + dataHB->ZoneHWEq.allocate(5); + dataHB->ZoneSteamEq.allocate(5); + + // Set-up data for various tests + dataHB->ZoneElectric(1).DesignLevel = 11.0; + dataHB->ZoneElectric(2).DesignLevel = 12.0; + dataHB->ZoneElectric(3).DesignLevel = 13.0; + dataHB->ZoneElectric(4).DesignLevel = 14.0; + dataHB->ZoneElectric(5).DesignLevel = 15.0; + dataHB->ZoneElectric(1).FractionConvected = 0.11; + dataHB->ZoneElectric(2).FractionConvected = 0.21; + dataHB->ZoneElectric(3).FractionConvected = 0.31; + dataHB->ZoneElectric(4).FractionConvected = 0.41; + dataHB->ZoneElectric(5).FractionConvected = 0.51; + dataHB->ZoneElectric(1).ZonePtr = 1; + dataHB->ZoneElectric(2).ZonePtr = 1; + dataHB->ZoneElectric(3).ZonePtr = 2; + dataHB->ZoneElectric(4).ZonePtr = 2; + dataHB->ZoneElectric(5).ZonePtr = 3; + dataHB->ZoneGas(1).DesignLevel = 21.0; + dataHB->ZoneGas(2).DesignLevel = 22.0; + dataHB->ZoneGas(3).DesignLevel = 23.0; + dataHB->ZoneGas(4).DesignLevel = 24.0; + dataHB->ZoneGas(5).DesignLevel = 25.0; + dataHB->ZoneGas(1).FractionConvected = 0.12; + dataHB->ZoneGas(2).FractionConvected = 0.22; + dataHB->ZoneGas(3).FractionConvected = 0.32; + dataHB->ZoneGas(4).FractionConvected = 0.42; + dataHB->ZoneGas(5).FractionConvected = 0.52; + dataHB->ZoneGas(1).ZonePtr = 1; + dataHB->ZoneGas(2).ZonePtr = 2; + dataHB->ZoneGas(3).ZonePtr = 3; + dataHB->ZoneGas(4).ZonePtr = 1; + dataHB->ZoneGas(5).ZonePtr = 2; + dataHB->ZoneOtherEq(1).DesignLevel = 31.0; + dataHB->ZoneOtherEq(2).DesignLevel = 32.0; + dataHB->ZoneOtherEq(3).DesignLevel = 33.0; + dataHB->ZoneOtherEq(4).DesignLevel = 34.0; + dataHB->ZoneOtherEq(5).DesignLevel = 35.0; + dataHB->ZoneOtherEq(1).FractionConvected = 0.13; + dataHB->ZoneOtherEq(2).FractionConvected = 0.23; + dataHB->ZoneOtherEq(3).FractionConvected = 0.33; + dataHB->ZoneOtherEq(4).FractionConvected = 0.43; + dataHB->ZoneOtherEq(5).FractionConvected = 0.53; + dataHB->ZoneOtherEq(1).ZonePtr = 3; + dataHB->ZoneOtherEq(2).ZonePtr = 3; + dataHB->ZoneOtherEq(3).ZonePtr = 4; + dataHB->ZoneOtherEq(4).ZonePtr = 4; + dataHB->ZoneOtherEq(5).ZonePtr = 5; + dataHB->ZoneHWEq(1).DesignLevel = 41.0; + dataHB->ZoneHWEq(2).DesignLevel = 42.0; + dataHB->ZoneHWEq(3).DesignLevel = 43.0; + dataHB->ZoneHWEq(4).DesignLevel = 44.0; + dataHB->ZoneHWEq(5).DesignLevel = 45.0; + dataHB->ZoneHWEq(1).FractionConvected = 0.14; + dataHB->ZoneHWEq(2).FractionConvected = 0.24; + dataHB->ZoneHWEq(3).FractionConvected = 0.34; + dataHB->ZoneHWEq(4).FractionConvected = 0.44; + dataHB->ZoneHWEq(5).FractionConvected = 0.54; + dataHB->ZoneHWEq(1).ZonePtr = 5; + dataHB->ZoneHWEq(2).ZonePtr = 5; + dataHB->ZoneHWEq(3).ZonePtr = 6; + dataHB->ZoneHWEq(4).ZonePtr = 6; + dataHB->ZoneHWEq(5).ZonePtr = 7; + dataHB->ZoneSteamEq(1).DesignLevel = 51.0; + dataHB->ZoneSteamEq(2).DesignLevel = 52.0; + dataHB->ZoneSteamEq(3).DesignLevel = 53.0; + dataHB->ZoneSteamEq(4).DesignLevel = 54.0; + dataHB->ZoneSteamEq(5).DesignLevel = 55.0; + dataHB->ZoneSteamEq(1).FractionConvected = 0.15; + dataHB->ZoneSteamEq(2).FractionConvected = 0.25; + dataHB->ZoneSteamEq(3).FractionConvected = 0.35; + dataHB->ZoneSteamEq(4).FractionConvected = 0.45; + dataHB->ZoneSteamEq(5).FractionConvected = 0.55; + dataHB->ZoneSteamEq(1).ZonePtr = 7; + dataHB->ZoneSteamEq(2).ZonePtr = 7; + dataHB->ZoneSteamEq(3).ZonePtr = 8; + dataHB->ZoneSteamEq(4).ZonePtr = 8; + dataHB->ZoneSteamEq(5).ZonePtr = 8; + Real64 constexpr numOccupants = 10.0; + std::vector expectedAnswer = {74.633, 75.761, 75.64, 75.551, 76.437, 76.398, 77.495, 80.31}; + Real64 constexpr allowedTolerance = 0.00001; + + // Tests 1 - 8: testNum is used for the zone number which grabs different data and each has a different answer + for (int testNum = 1; testNum <= 8; ++testNum) { + Real64 actualAnswer = RoomAir::sumUFADConvGainPerPlume(*state, testNum, numOccupants); + EXPECT_NEAR(actualAnswer, expectedAnswer[testNum - 1], allowedTolerance); + } +} + +} // namespace EnergyPlus From b0e33542a84c0b8226540d737fdb0d1c22f737a3 Mon Sep 17 00:00:00 2001 From: Rick Strand Date: Fri, 18 Aug 2023 13:34:41 -0500 Subject: [PATCH 30/80] Update UFADManager.unit.cc --- tst/EnergyPlus/unit/UFADManager.unit.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/tst/EnergyPlus/unit/UFADManager.unit.cc b/tst/EnergyPlus/unit/UFADManager.unit.cc index 9bbc8dab276..b54c496106e 100644 --- a/tst/EnergyPlus/unit/UFADManager.unit.cc +++ b/tst/EnergyPlus/unit/UFADManager.unit.cc @@ -23,6 +23,7 @@ // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory, // the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be // used to endorse or promote products derived from this software without specific prior +// written permission. // // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form // without changes from the version obtained under this License, or (ii) Licensee makes a From cebd1ba4bac611efdff9ef2b0d5e5e19abd9076a Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Thu, 24 Aug 2023 12:54:53 -0500 Subject: [PATCH 31/80] Consolidate ZoneSizingData --- src/EnergyPlus/DataSizing.hh | 360 ++++++++++--------------- src/EnergyPlus/General.cc | 20 ++ src/EnergyPlus/General.hh | 3 + src/EnergyPlus/ZoneEquipmentManager.cc | 24 +- 4 files changed, 181 insertions(+), 226 deletions(-) diff --git a/src/EnergyPlus/DataSizing.hh b/src/EnergyPlus/DataSizing.hh index d84fef2dbf6..d66b6f73a75 100644 --- a/src/EnergyPlus/DataSizing.hh +++ b/src/EnergyPlus/DataSizing.hh @@ -339,146 +339,66 @@ namespace DataSizing { ZoneSizing zoneSizingMethod = ZoneSizing::Invalid; // load to sizing on: sensible, latent, sensibleandlatent, sensibleonlynolatent }; - struct ZoneSizingData + // based on ZoneSizingData but only member variables that are actually used by terminal unit sizing + struct TermUnitZoneSizingCommonData { - // Members - std::string ZoneName; // name of a zone - std::string ADUName; // Terminal Unit Name (air distribution unit or direct air unit) - only assigned for TermUnitFinalZoneSizing - std::string CoolDesDay; // name of a cooling design day - std::string HeatDesDay; // name of a heating design day - int ZnCoolDgnSAMethod = 0; // choice of how to get zone cooling design air temperature; - // 1 = specify supply air temperature, 2 = calculate from the temperature difference - int ZnHeatDgnSAMethod = 0; // choice of how to get zone heating design air temperature; - // 1 = specify supply air temperature, 2 = calculate from the temperature difference - Real64 CoolDesTemp = 0.0; // zone design cooling supply air temperature [C] - Real64 HeatDesTemp = 0.0; // zone design heating supply air temperature [C] - Real64 CoolDesTempDiff = 0.0; // zone design cooling supply air temperature difference [deltaC] - Real64 HeatDesTempDiff = 0.0; // zone design heating supply air temperature difference [deltaC] - Real64 CoolDesHumRat = 0.0; // zone design cooling supply air humidity ratio [kgWater/kgDryAir] - Real64 HeatDesHumRat = 0.0; // zone design heating supply air humidity ratio [kgWater/kgDryAir] - int ZoneAirDistributionIndex = 0; // index to DesignSpecification:ZoneAirDistribution object - int ZoneDesignSpecOAIndex = 0; // index to DesignSpecification:OutdoorAir object - Real64 DesOAFlowPPer = 0.0; // design outside air flow per person in zone [m3/s] (average for zone across spaces) - Real64 DesOAFlowPerArea = 0.0; // design outside air flow per zone area [m3/s / m2] (average for zone across spaces) - AirflowSizingMethod CoolAirDesMethod = AirflowSizingMethod::Invalid; // choice of how to get zone cooling design air flow rates; - // 0 = calc from des day simulation; 1 = m3/s per zone, user input; 2 = apply limits to air flow rate from DD calc - Real64 InpDesCoolAirFlow = 0.0; // design zone supply air flow rate [m3/s] - Real64 DesCoolMinAirFlowPerArea = 0.0; // design cooling minimum air flow rate per zone area [m3/s / m2] - Real64 DesCoolMinAirFlow = 0.0; // design cooling minimum air flow rate [m3/s] - Real64 DesCoolMinAirFlowFrac = 0.0; // design cooling minimum air flow rate fraction - // (of the cooling design air flow rate) - AirflowSizingMethod HeatAirDesMethod = AirflowSizingMethod::Invalid; // choice of how to get zone heating design air flow rates; - // 1 = calc from des day simulation; 2 = m3/s per zone, user input - // 3 = apply limits to air flow rate from DD calc - Real64 InpDesHeatAirFlow = 0.0; // design zone heating supply air flow rate [m3/s] - Real64 DesHeatMaxAirFlowPerArea = 0.0; // design heating maximum air flow rate per zone area [m3/s / m2] - Real64 DesHeatMaxAirFlow = 0.0; // design heating maximum air flow rate [m3/s] - Real64 DesHeatMaxAirFlowFrac = 0.0; // design heating maximum air flow rate fraction - // (of the cooling design air flow rate) - Real64 HeatSizingFactor = 0.0; // the zone heating sizing ratio - Real64 CoolSizingFactor = 0.0; // the zone cooling sizing ratio - bool AccountForDOAS = false; // False: do nothing; True: calculate the effect of a DOA system on the zone sizing arrays - DOASControl DOASControlStrategy = DOASControl::Invalid; // 0=neutral ventilation air; 1=neutral dehumidified ventilation air, 2 = cooled air; - // 3=supply cold ventilation air - Real64 DOASLowSetpoint = 0.0; // Dedicated Outside Air Low Setpoint for Design [C] - Real64 DOASHighSetpoint = 0.0; // Dedicated Outside Air High Setpoint for Design [C] - int ZoneNum = 0; // index into the Zone data array (in DataHeatBalance) - Real64 DesHeatMassFlow = 0.0; // zone design heating air mass flow rate [kg/s] - Real64 DesHeatMassFlowNoOA = 0.0; // zone design heating air mass flow rate without applying MinOA as a limit [kg/s] - Real64 DesHeatOAFlowFrac = 0.0; // zone design heating OA air volume fraction [-] - bool EMSOverrideDesHeatMassOn = false; // true if EMS is acting on this structure - Real64 EMSValueDesHeatMassFlow = 0.0; // Value EMS directing to use for Design Heating air mass flow [kg/s] - Real64 DesCoolMassFlow = 0.0; // zone design cooling air mass flow rate [kg/s] - Real64 DesCoolMassFlowNoOA = 0.0; // zone design cooling air mass flow rate without applying MinOA as a limit [kg/s] - Real64 DesCoolOAFlowFrac = 0.0; // zone design cooling OA air volume fraction [-] - bool EMSOverrideDesCoolMassOn = false; // true if EMS is acting on this structure - Real64 EMSValueDesCoolMassFlow = 0.0; // Value EMS directing to use for Design Cooling air mass flow [kg/s] - Real64 DesHeatLoad = 0.0; // zone design heating load including sizing factor and scaled to match airflow sizing [W] - Real64 NonAirSysDesHeatLoad = 0.0; // base zone design heating load including sizing factor [W] - bool EMSOverrideDesHeatLoadOn = false; // true if EMS is acting on this structure - Real64 EMSValueDesHeatLoad = 0.0; // Value EMS directing to use for zone design heating load [W] - Real64 DesCoolLoad = 0.0; // zone design cooling load including sizing factor and scaled to match airflow sizing [W] - Real64 NonAirSysDesCoolLoad = 0.0; // base zone design cooling load including sizing factor [W] - bool EMSOverrideDesCoolLoadOn = false; // true if EMS is acting on this structure - Real64 EMSValueDesCoolLoad = 0.0; // Value EMS directing to use for zone design cooling load [W] - Real64 DesHeatDens = 0.0; // zone design heating air density [kg/m3] - Real64 DesCoolDens = 0.0; // zone design cooling air density [kg/m3] + std::string ZoneName; // name of a zone + std::string ADUName; // Terminal Unit Name (air distribution unit or direct air unit) - only assigned for TermUnitFinalZoneSizing + Real64 CoolDesTemp = 0.0; // zone design cooling supply air temperature [C] + Real64 HeatDesTemp = 0.0; // zone design heating supply air temperature [C] + Real64 CoolDesHumRat = 0.0; // zone design cooling supply air humidity ratio [kgWater/kgDryAir] + Real64 HeatDesHumRat = 0.0; // zone design heating supply air humidity ratio [kgWater/kgDryAir] + Real64 DesOAFlowPPer = 0.0; // design outside air flow per person in zone [m3/s] (average for zone across spaces) + Real64 DesOAFlowPerArea = 0.0; // design outside air flow per zone area [m3/s / m2] (average for zone across spaces) + Real64 DesCoolMinAirFlow = 0.0; // design cooling minimum air flow rate [m3/s] + Real64 DesCoolMinAirFlowFrac = 0.0; // design cooling minimum air flow rate fraction (of the cooling design air flow rate) + Real64 DesHeatMaxAirFlow = 0.0; // design heating maximum air flow rate [m3/s] + Real64 DesHeatMaxAirFlowFrac = 0.0; // design heating maximum air flow rate fraction (of the cooling design air flow rate) + int ZoneNum = 0; // index into the Zone data array (in DataHeatBalance) + Real64 DesHeatMassFlow = 0.0; // zone design heating air mass flow rate [kg/s] + Real64 DesHeatMassFlowNoOA = 0.0; // zone design heating air mass flow rate without applying MinOA as a limit [kg/s] + Real64 DesHeatOAFlowFrac = 0.0; // zone design heating OA air volume fraction [-] + Real64 DesCoolMassFlow = 0.0; // zone design cooling air mass flow rate [kg/s] + Real64 DesCoolMassFlowNoOA = 0.0; // zone design cooling air mass flow rate without applying MinOA as a limit [kg/s] + Real64 DesCoolOAFlowFrac = 0.0; // zone design cooling OA air volume fraction [-] + Real64 DesHeatLoad = 0.0; // zone design heating load including sizing factor and scaled to match airflow sizing [W] + Real64 NonAirSysDesHeatLoad = 0.0; // base zone design heating load including sizing factor [W] + Real64 DesCoolLoad = 0.0; // zone design cooling load including sizing factor and scaled to match airflow sizing [W] + Real64 NonAirSysDesCoolLoad = 0.0; // base zone design cooling load including sizing factor [W] Real64 DesHeatVolFlow = 0.0; // zone design heating air volume flow rate including sizing factor and scaled to match airflow sizing [m3/s] Real64 DesHeatVolFlowNoOA = 0.0; // zone design heating air volume flow rate including sizing factor and scaled to match airflow sizing // without MinOA limit [m3/s] Real64 NonAirSysDesHeatVolFlow = 0.0; // base zone design heating air volume flow rate including sizing factor [m3/s] - bool EMSOverrideDesHeatVolOn = false; // true if EMS is acting on this structure - Real64 EMSValueDesHeatVolFlow = 0.0; // Value EMS directing to use for Design Heating air volume flow [m3/s] Real64 DesCoolVolFlow = 0.0; // zone design cooling air volume flow rate [m3/s] Real64 DesCoolVolFlowNoOA = 0.0; // zone design cooling air volume flow rate without applying MinOA as a limit [m3/s] Real64 NonAirSysDesCoolVolFlow = 0.0; // base zone design cooling air volume flow rate including sizing factor [m3/s] - bool EMSOverrideDesCoolVolOn = false; // true if EMS is acting on this structure - Real64 EMSValueDesCoolVolFlow = 0.0; // Value EMS directing to use for Design cooling air volume flow [m3/s] Real64 DesHeatVolFlowMax = 0.0; // zone design heating maximum air volume flow rate [m3/s] Real64 DesCoolVolFlowMin = 0.0; // zone design cooling minimum air volume flow rate [m3/s] - Real64 DesHeatCoilInTemp = 0.0; // zone heating coil design air inlet temperature [C] - Real64 DesCoolCoilInTemp = 0.0; // zone cooling coil design air inlet temperature [C] - Real64 DesHeatCoilInHumRat = 0.0; // zone heating coil design air inlet humidity ratio [kg/kg] - Real64 DesCoolCoilInHumRat = 0.0; // zone cooling coil design air inlet humidity ratio [kg/kg] Real64 DesHeatCoilInTempTU = 0.0; // zone heating coil design air inlet temperature (supply air)([C] Real64 DesCoolCoilInTempTU = 0.0; // zone cooling coil design air inlet temperature (supply air)[C] Real64 DesHeatCoilInHumRatTU = 0.0; // zone heating coil design air inlet humidity ratio [kg/kg] Real64 DesCoolCoilInHumRatTU = 0.0; // zone cooling coil design air inlet humidity ratio [kg/kg] - Real64 HeatMassFlow = 0.0; // current zone heating air mass flow rate (HVAC time step) - Real64 CoolMassFlow = 0.0; // current zone cooling air mass flow rate (HVAC time step) - Real64 HeatLoad = 0.0; // current zone heating load (HVAC time step) - Real64 CoolLoad = 0.0; // current zone heating load (HVAC time step) - Real64 HeatZoneTemp = 0.0; // current zone temperature (heating, time step) - Real64 HeatOutTemp = 0.0; // current outdoor temperature (heating, time step) - Real64 HeatZoneRetTemp = 0.0; // current zone return temperature (heating, time step) - Real64 HeatTstatTemp = 0.0; // current zone thermostat temperature (heating, time step) - Real64 CoolZoneTemp = 0.0; // current zone temperature (cooling, time step) - Real64 CoolOutTemp = 0.0; // current Outdoor temperature (cooling, time step) - Real64 CoolZoneRetTemp = 0.0; // current zone return temperature (cooling, time step) - Real64 CoolTstatTemp = 0.0; // current zone thermostat temperature (cooling, time step) - Real64 HeatZoneHumRat = 0.0; // current zone humidity ratio (heating, time step) - Real64 CoolZoneHumRat = 0.0; // current zone humidity ratio (cooling, time step) - Real64 HeatOutHumRat = 0.0; // current outdoor humidity ratio (heating, time step) - Real64 CoolOutHumRat = 0.0; // current outdoor humidity ratio (cooling, time step) Real64 ZoneTempAtHeatPeak = 0.0; // zone temp at max heating [C] Real64 ZoneRetTempAtHeatPeak = 0.0; // zone return temp at max heating [C] - Real64 OutTempAtHeatPeak = 0.0; // outdoor temperature at max heating [C] Real64 ZoneTempAtCoolPeak = 0.0; // zone temp at max cooling [C] Real64 ZoneRetTempAtCoolPeak = 0.0; // zone return temp at max cooling [C] - Real64 OutTempAtCoolPeak = 0.0; // outdoor temperature at max cooling [C] Real64 ZoneHumRatAtHeatPeak = 0.0; // zone humidity ratio at max heating [kg/kg] Real64 ZoneHumRatAtCoolPeak = 0.0; // zone humidity ratio at max cooling [kg/kg] - Real64 OutHumRatAtHeatPeak = 0.0; // outdoor humidity at max heating [kg/kg] - Real64 OutHumRatAtCoolPeak = 0.0; // outdoor humidity at max cooling [kg/kg] int TimeStepNumAtHeatMax = 0; // time step number (in day) at Heating peak int TimeStepNumAtCoolMax = 0; // time step number (in day) at cooling peak int HeatDDNum = 0; // design day index of design day causing heating peak int CoolDDNum = 0; // design day index of design day causing cooling peak - std::string cHeatDDDate; // date of design day causing heating peak - std::string cCoolDDDate; // date of design day causing cooling peak Real64 MinOA = 0.0; // design minimum outside air in m3/s Real64 DesCoolMinAirFlow2 = 0.0; // design cooling minimum air flow rate [m3/s] derived from DesCoolMinAirFlowPerArea Real64 DesHeatMaxAirFlow2 = 0.0; // design heating maximum air flow rate [m3/s] derived from DesHeatMaxAirFlowPerArea - Array1D HeatFlowSeq; // daily sequence of zone heating air mass flow rate (zone time step) [kg/s] - Array1D HeatFlowSeqNoOA; // daily sequence of zone heating air mass flow rate (zone time step) without MinOA limit [kg/s] - Array1D CoolFlowSeq; // daily sequence of zone cooling air mass flow rate (zone time step) [kg/s] - Array1D CoolFlowSeqNoOA; // daily sequence of zone cooling air mass flow rate (zone time step) without MinOA limit [kg/s] - Array1D HeatLoadSeq; // daily sequence of zone heating load (zone time step) - Array1D CoolLoadSeq; // daily sequence of zone cooling load (zone time step) - Array1D HeatZoneTempSeq; // daily sequence of zone temperatures (heating, zone time step) - Array1D HeatOutTempSeq; // daily sequence of outdoor temperatures (heating, zone time step) - Array1D HeatZoneRetTempSeq; // daily sequence of zone return temperatures (heating, zone time step) - Array1D HeatTstatTempSeq; // daily sequence of zone thermostat temperatures (heating, zone time step) - Array1D DesHeatSetPtSeq; // daily sequence of indoor set point temperatures (zone time step) - Array1D CoolZoneTempSeq; // daily sequence of zone temperatures (cooling, zone time step) - Array1D CoolOutTempSeq; // daily sequence of outdoor temperatures (cooling, zone time step) - Array1D CoolZoneRetTempSeq; // daily sequence of zone return temperatures (cooling, zone time step) - Array1D CoolTstatTempSeq; // daily sequence of zone thermostat temperatures (cooling, zone time step) - Array1D DesCoolSetPtSeq; // daily sequence of indoor set point temperatures (zone time step) - Array1D HeatZoneHumRatSeq; // daily sequence of zone humidity ratios (heating, zone time step) - Array1D CoolZoneHumRatSeq; // daily sequence of zone humidity ratios (cooling, zone time step) - Array1D HeatOutHumRatSeq; // daily sequence of outdoor humidity ratios (heating, zone time step) - Array1D CoolOutHumRatSeq; // daily sequence of outdoor humidity ratios (cooling, zone time step) + EPVector HeatFlowSeq; // daily sequence of zone heating air mass flow rate (zone time step) [kg/s] + EPVector HeatFlowSeqNoOA; // daily sequence of zone heating air mass flow rate (zone time step) without MinOA limit [kg/s] + EPVector CoolFlowSeq; // daily sequence of zone cooling air mass flow rate (zone time step) [kg/s] + EPVector CoolFlowSeqNoOA; // daily sequence of zone cooling air mass flow rate (zone time step) without MinOA limit [kg/s] + EPVector HeatZoneTempSeq; // daily sequence of zone temperatures (heating, zone time step) + EPVector HeatZoneRetTempSeq; // daily sequence of zone return temperatures (heating, zone time step) + EPVector CoolZoneTempSeq; // daily sequence of zone temperatures (cooling, zone time step) + EPVector CoolZoneRetTempSeq; // daily sequence of zone return temperatures (cooling, zone time step) Real64 ZoneADEffCooling = 1.0; // the zone air distribution effectiveness in cooling mode Real64 ZoneADEffHeating = 1.0; // the zone air distribution effectiveness in heating mode Real64 ZoneSecondaryRecirculation = 0.0; // the zone secondary air recirculation fraction @@ -491,29 +411,114 @@ namespace DataSizing { Real64 TotalOAFromArea = 0.0; // Zone OA required based on floor area Real64 TotPeopleInZone = 0.0; // total number of people in the zone Real64 TotalZoneFloorArea = 0.0; // total zone floor area - Real64 ZonePeakOccupancy = 0.0; // zone peak occupancy based on max schedule value Real64 SupplyAirAdjustFactor = 1.0; // supply air adjustment factor for next time step if OA is capped Real64 ZpzClgByZone = 0.0; // OA Std 62.1 required fraction in cooling mode ? should this be ZdzClgByZone Real64 ZpzHtgByZone = 0.0; // OA Std 62.1 required fraction in heating mode ? should this be ZdzHtgByZone - Real64 VozClgByZone = 0.0; // value of required cooling vent to zone, used in 62.1 tabular report, already includes people diversity term - Real64 VozHtgByZone = 0.0; // value of required heating vent to zone, used in 62.1 tabular report, already includes people diversity term - Real64 DOASHeatLoad = 0.0; // current heating load from DOAS supply air [W] - Real64 DOASCoolLoad = 0.0; // current cooling load from DOAS supply air [W] - Real64 DOASHeatAdd = 0.0; // current heat addition rate from DOAS supply air [W] - Real64 DOASLatAdd = 0.0; // current latent heat addition rate from DOAS supply air [W] - Real64 DOASSupMassFlow = 0.0; // current mass flow rate of DOAS supply air [kg/s] - Real64 DOASSupTemp = 0.0; // current DOAS supply air temperature [C] - Real64 DOASSupHumRat = 0.0; // current DOAS supply air humidity ratio [kgWater/kgDryAir] - Real64 DOASTotCoolLoad = 0.0; // current total cooling load imposed by DOAS supply air [W] - bool VpzMinByZoneSPSized = false; // is Vpz_min sized using the 62.1 Standard Simplified Procedure - Array1D DOASHeatLoadSeq; // daily sequence of zone DOAS heating load (zone time step) [W] - Array1D DOASCoolLoadSeq; // daily sequence of zone DOAS cooling load (zone time step) [W] - Array1D DOASHeatAddSeq; // daily sequence of zone DOAS heat addition rate (zone time step) [W] - Array1D DOASLatAddSeq; // daily sequence of zone DOAS latent heat addition rate (zone time step) [W] - Array1D DOASSupMassFlowSeq; // daily sequence of zone DOAS supply mass flow rate (zone time step) [Kg/s] - Array1D DOASSupTempSeq; // daily sequence of zone DOAS supply temperature (zone time step) [C] - Array1D DOASSupHumRatSeq; // daily sequence of zone DOAS supply humidity ratio (zone time step) [kgWater/kgDryAir] - Array1D DOASTotCoolLoadSeq; // daily sequence of zone DOAS total cooling load (zone time step) [W] + Real64 VozClgByZone = 0.0; // value of required cooling vent to zone, used in 62.1 tabular report, already includes people diversity term + Real64 VozHtgByZone = 0.0; // value of required heating vent to zone, used in 62.1 tabular report, already includes people diversity term + bool VpzMinByZoneSPSized = false; // is Vpz_min sized using the 62.1 Standard Simplified Procedure + Real64 ZoneSizThermSetPtHi = 0.0; // highest zone thermostat setpoint during zone sizing calcs + Real64 ZoneSizThermSetPtLo = 1000.0; // lowest zone thermostat setpoint during zone sizing calcs + }; + + struct ZoneSizingData : TermUnitZoneSizingCommonData + { + // Members + std::string CoolDesDay; // name of a cooling design day + std::string HeatDesDay; // name of a heating design day + int ZnCoolDgnSAMethod = 0; // choice of how to get zone cooling design air temperature; + // 1 = specify supply air temperature, 2 = calculate from the temperature difference + int ZnHeatDgnSAMethod = 0; // choice of how to get zone heating design air temperature; + // 1 = specify supply air temperature, 2 = calculate from the temperature difference + Real64 CoolDesTempDiff = 0.0; // zone design cooling supply air temperature difference [deltaC] + Real64 HeatDesTempDiff = 0.0; // zone design heating supply air temperature difference [deltaC] + int ZoneAirDistributionIndex = 0; // index to DesignSpecification:ZoneAirDistribution object + int ZoneDesignSpecOAIndex = 0; // index to DesignSpecification:OutdoorAir object + AirflowSizingMethod CoolAirDesMethod = AirflowSizingMethod::Invalid; // choice of how to get zone cooling design air flow rates; + // 0 = calc from des day simulation; 1 = m3/s per zone, user input; 2 = apply limits to air flow rate from DD calc + Real64 InpDesCoolAirFlow = 0.0; // design zone supply air flow rate [m3/s] + Real64 DesCoolMinAirFlowPerArea = 0.0; // design cooling minimum air flow rate per zone area [m3/s / m2] + AirflowSizingMethod HeatAirDesMethod = AirflowSizingMethod::Invalid; // choice of how to get zone heating design air flow rates; + // 1 = calc from des day simulation; 2 = m3/s per zone, user input + // 3 = apply limits to air flow rate from DD calc + Real64 InpDesHeatAirFlow = 0.0; // design zone heating supply air flow rate [m3/s] + Real64 DesHeatMaxAirFlowPerArea = 0.0; // design heating maximum air flow rate per zone area [m3/s / m2] + Real64 HeatSizingFactor = 0.0; // the zone heating sizing ratio + Real64 CoolSizingFactor = 0.0; // the zone cooling sizing ratio + bool AccountForDOAS = false; // False: do nothing; True: calculate the effect of a DOA system on the zone sizing arrays + DOASControl DOASControlStrategy = DOASControl::Invalid; // 0=neutral ventilation air; 1=neutral dehumidified ventilation air, 2 = cooled air; + // 3=supply cold ventilation air + Real64 DOASLowSetpoint = 0.0; // Dedicated Outside Air Low Setpoint for Design [C] + Real64 DOASHighSetpoint = 0.0; // Dedicated Outside Air High Setpoint for Design [C] + bool EMSOverrideDesHeatMassOn = false; // true if EMS is acting on this structure + Real64 EMSValueDesHeatMassFlow = 0.0; // Value EMS directing to use for Design Heating air mass flow [kg/s] + bool EMSOverrideDesCoolMassOn = false; // true if EMS is acting on this structure + Real64 EMSValueDesCoolMassFlow = 0.0; // Value EMS directing to use for Design Cooling air mass flow [kg/s] + bool EMSOverrideDesHeatLoadOn = false; // true if EMS is acting on this structure + Real64 EMSValueDesHeatLoad = 0.0; // Value EMS directing to use for zone design heating load [W] + bool EMSOverrideDesCoolLoadOn = false; // true if EMS is acting on this structure + Real64 EMSValueDesCoolLoad = 0.0; // Value EMS directing to use for zone design cooling load [W] + Real64 DesHeatDens = 0.0; // zone design heating air density [kg/m3] + Real64 DesCoolDens = 0.0; // zone design cooling air density [kg/m3] + bool EMSOverrideDesHeatVolOn = false; // true if EMS is acting on this structure + Real64 EMSValueDesHeatVolFlow = 0.0; // Value EMS directing to use for Design Heating air volume flow [m3/s] + bool EMSOverrideDesCoolVolOn = false; // true if EMS is acting on this structure + Real64 EMSValueDesCoolVolFlow = 0.0; // Value EMS directing to use for Design cooling air volume flow [m3/s] + Real64 DesHeatCoilInTemp = 0.0; // zone heating coil design air inlet temperature [C] + Real64 DesCoolCoilInTemp = 0.0; // zone cooling coil design air inlet temperature [C] + Real64 DesHeatCoilInHumRat = 0.0; // zone heating coil design air inlet humidity ratio [kg/kg] + Real64 DesCoolCoilInHumRat = 0.0; // zone cooling coil design air inlet humidity ratio [kg/kg] + Real64 HeatMassFlow = 0.0; // current zone heating air mass flow rate (HVAC time step) + Real64 CoolMassFlow = 0.0; // current zone cooling air mass flow rate (HVAC time step) + Real64 HeatLoad = 0.0; // current zone heating load (HVAC time step) + Real64 CoolLoad = 0.0; // current zone heating load (HVAC time step) + Real64 HeatZoneTemp = 0.0; // current zone temperature (heating, time step) + Real64 HeatOutTemp = 0.0; // current outdoor temperature (heating, time step) + Real64 HeatZoneRetTemp = 0.0; // current zone return temperature (heating, time step) + Real64 HeatTstatTemp = 0.0; // current zone thermostat temperature (heating, time step) + Real64 CoolZoneTemp = 0.0; // current zone temperature (cooling, time step) + Real64 CoolOutTemp = 0.0; // current Outdoor temperature (cooling, time step) + Real64 CoolZoneRetTemp = 0.0; // current zone return temperature (cooling, time step) + Real64 CoolTstatTemp = 0.0; // current zone thermostat temperature (cooling, time step) + Real64 HeatZoneHumRat = 0.0; // current zone humidity ratio (heating, time step) + Real64 CoolZoneHumRat = 0.0; // current zone humidity ratio (cooling, time step) + Real64 HeatOutHumRat = 0.0; // current outdoor humidity ratio (heating, time step) + Real64 CoolOutHumRat = 0.0; // current outdoor humidity ratio (cooling, time step) + Real64 OutTempAtHeatPeak = 0.0; // outdoor temperature at max heating [C] + Real64 OutTempAtCoolPeak = 0.0; // outdoor temperature at max cooling [C] + Real64 OutHumRatAtHeatPeak = 0.0; // outdoor humidity at max heating [kg/kg] + Real64 OutHumRatAtCoolPeak = 0.0; // outdoor humidity at max cooling [kg/kg] + std::string cHeatDDDate; // date of design day causing heating peak + std::string cCoolDDDate; // date of design day causing cooling peak + Array1D HeatLoadSeq; // daily sequence of zone heating load (zone time step) + Array1D CoolLoadSeq; // daily sequence of zone cooling load (zone time step) + Array1D HeatOutTempSeq; // daily sequence of outdoor temperatures (heating, zone time step) + Array1D HeatTstatTempSeq; // daily sequence of zone thermostat temperatures (heating, zone time step) + Array1D DesHeatSetPtSeq; // daily sequence of indoor set point temperatures (zone time step) + Array1D CoolOutTempSeq; // daily sequence of outdoor temperatures (cooling, zone time step) + Array1D CoolTstatTempSeq; // daily sequence of zone thermostat temperatures (cooling, zone time step) + Array1D DesCoolSetPtSeq; // daily sequence of indoor set point temperatures (zone time step) + Array1D HeatZoneHumRatSeq; // daily sequence of zone humidity ratios (heating, zone time step) + Array1D CoolZoneHumRatSeq; // daily sequence of zone humidity ratios (cooling, zone time step) + Array1D HeatOutHumRatSeq; // daily sequence of outdoor humidity ratios (heating, zone time step) + Array1D CoolOutHumRatSeq; // daily sequence of outdoor humidity ratios (cooling, zone time step) + Real64 ZonePeakOccupancy = 0.0; // zone peak occupancy based on max schedule value + Real64 DOASHeatLoad = 0.0; // current heating load from DOAS supply air [W] + Real64 DOASCoolLoad = 0.0; // current cooling load from DOAS supply air [W] + Real64 DOASHeatAdd = 0.0; // current heat addition rate from DOAS supply air [W] + Real64 DOASLatAdd = 0.0; // current latent heat addition rate from DOAS supply air [W] + Real64 DOASSupMassFlow = 0.0; // current mass flow rate of DOAS supply air [kg/s] + Real64 DOASSupTemp = 0.0; // current DOAS supply air temperature [C] + Real64 DOASSupHumRat = 0.0; // current DOAS supply air humidity ratio [kgWater/kgDryAir] + Real64 DOASTotCoolLoad = 0.0; // current total cooling load imposed by DOAS supply air [W] + Array1D DOASHeatLoadSeq; // daily sequence of zone DOAS heating load (zone time step) [W] + Array1D DOASCoolLoadSeq; // daily sequence of zone DOAS cooling load (zone time step) [W] + Array1D DOASHeatAddSeq; // daily sequence of zone DOAS heat addition rate (zone time step) [W] + Array1D DOASLatAddSeq; // daily sequence of zone DOAS latent heat addition rate (zone time step) [W] + Array1D DOASSupMassFlowSeq; // daily sequence of zone DOAS supply mass flow rate (zone time step) [Kg/s] + Array1D DOASSupTempSeq; // daily sequence of zone DOAS supply temperature (zone time step) [C] + Array1D DOASSupHumRatSeq; // daily sequence of zone DOAS supply humidity ratio (zone time step) [kgWater/kgDryAir] + Array1D DOASTotCoolLoadSeq; // daily sequence of zone DOAS total cooling load (zone time step) [W] // Latent heat variables Real64 HeatLoadNoDOAS = 0.0; // current zone heating load no DOAS (HVAC time step) @@ -570,8 +575,8 @@ namespace DataSizing { Array1D LatentCoolLoadSeq; // daily sequence of zone latent cooling load (zone time step) [W] Array1D HeatLatentLoadNoDOASSeq; // daily sequence of zone latent heating load No DOAS (zone time step) [W] Array1D CoolLatentLoadNoDOASSeq; // daily sequence of zone latent cooling load No DOAS (zone time step) [W] - Array1D LatentCoolFlowSeq; // daily sequence of zone latent cooling supply mass flow rate (zone time step) [Kg/s] - Array1D LatentHeatFlowSeq; // daily sequence of zone latent heating supply mass flow rate (zone time step) [Kg/s] + EPVector LatentCoolFlowSeq; // daily sequence of zone latent cooling supply mass flow rate (zone time step) [Kg/s] + EPVector LatentHeatFlowSeq; // daily sequence of zone latent heating supply mass flow rate (zone time step) [Kg/s] bool zoneLatentSizing = false; // trigger to do RH control during zone sizing Real64 zoneRHDehumidifySetPoint = 50.0; // RH dehumidifying set point used during sizing, default to 50% int zoneRHDehumidifySchIndex = 0; // index to zone RH dehumidifying schedule used for zone sizing @@ -598,97 +603,16 @@ namespace DataSizing { std::string HeatPeakDateHrMin; // date:hr:min of heating peak std::string LatCoolPeakDateHrMin; // date:hr:min of latent cooling peak std::string LatHeatPeakDateHrMin; // date:hr:min of latent heating peak - Real64 ZoneSizThermSetPtHi = 0.0; // highest zone thermostat setpoint during zone sizing calcs - Real64 ZoneSizThermSetPtLo = 1000.0; // lowest zone thermostat setpoint during zone sizing calcs void zeroMemberData(); void allocateMemberArrays(int numOfTimeStepInDay); }; - // based on ZoneSizingData but only member variables that are actually used by terminal unit sizing - struct TermUnitZoneSizingData + struct TermUnitZoneSizingData : TermUnitZoneSizingCommonData { - std::string ZoneName; // name of a zone - std::string ADUName; // Terminal Unit Name (air distribution unit or direct air unit) - only assigned for TermUnitFinalZoneSizing - Real64 CoolDesTemp = 0.0; // zone design cooling supply air temperature [C] - Real64 HeatDesTemp = 0.0; // zone design heating supply air temperature [C] - Real64 CoolDesHumRat = 0.0; // zone design cooling supply air humidity ratio [kgWater/kgDryAir] - Real64 HeatDesHumRat = 0.0; // zone design heating supply air humidity ratio [kgWater/kgDryAir] - Real64 DesOAFlowPPer = 0.0; // design outside air flow per person in zone [m3/s] (average for zone across spaces) - Real64 DesOAFlowPerArea = 0.0; // design outside air flow per zone area [m3/s / m2] (average for zone across spaces) - Real64 DesCoolMinAirFlow = 0.0; // design cooling minimum air flow rate [m3/s] - Real64 DesCoolMinAirFlowFrac = 0.0; // design cooling minimum air flow rate fraction (of the cooling design air flow rate) - Real64 DesHeatMaxAirFlow = 0.0; // design heating maximum air flow rate [m3/s] - Real64 DesHeatMaxAirFlowFrac = 0.0; // design heating maximum air flow rate fraction (of the cooling design air flow rate) - int ZoneNum = 0; // index into the Zone data array (in DataHeatBalance) - Real64 DesHeatMassFlow = 0.0; // zone design heating air mass flow rate [kg/s] - Real64 DesHeatMassFlowNoOA = 0.0; // zone design heating air mass flow rate without applying MinOA as a limit [kg/s] - Real64 DesHeatOAFlowFrac = 0.0; // zone design heating OA air volume fraction [-] - Real64 DesCoolMassFlow = 0.0; // zone design cooling air mass flow rate [kg/s] - Real64 DesCoolMassFlowNoOA = 0.0; // zone design cooling air mass flow rate without applying MinOA as a limit [kg/s] - Real64 DesCoolOAFlowFrac = 0.0; // zone design cooling OA air volume fraction [-] - Real64 DesHeatLoad = 0.0; // zone design heating load including sizing factor and scaled to match airflow sizing [W] - Real64 NonAirSysDesHeatLoad = 0.0; // base zone design heating load including sizing factor [W] - Real64 DesCoolLoad = 0.0; // zone design cooling load including sizing factor and scaled to match airflow sizing [W] - Real64 NonAirSysDesCoolLoad = 0.0; // base zone design cooling load including sizing factor [W] - Real64 DesHeatVolFlow = 0.0; // zone design heating air volume flow rate including sizing factor and scaled to match airflow sizing [m3/s] - Real64 DesHeatVolFlowNoOA = 0.0; // zone design heating air volume flow rate including sizing factor and scaled to match airflow sizing - // without MinOA limit [m3/s] - Real64 NonAirSysDesHeatVolFlow = 0.0; // base zone design heating air volume flow rate including sizing factor [m3/s] - Real64 DesCoolVolFlow = 0.0; // zone design cooling air volume flow rate [m3/s] - Real64 DesCoolVolFlowNoOA = 0.0; // zone design cooling air volume flow rate without applying MinOA as a limit [m3/s] - Real64 NonAirSysDesCoolVolFlow = 0.0; // base zone design cooling air volume flow rate including sizing factor [m3/s] - Real64 DesHeatVolFlowMax = 0.0; // zone design heating maximum air volume flow rate [m3/s] - Real64 DesCoolVolFlowMin = 0.0; // zone design cooling minimum air volume flow rate [m3/s] - Real64 DesHeatCoilInTempTU = 0.0; // zone heating coil design air inlet temperature (supply air)([C] - Real64 DesCoolCoilInTempTU = 0.0; // zone cooling coil design air inlet temperature (supply air)[C] - Real64 DesHeatCoilInHumRatTU = 0.0; // zone heating coil design air inlet humidity ratio [kg/kg] - Real64 DesCoolCoilInHumRatTU = 0.0; // zone cooling coil design air inlet humidity ratio [kg/kg] - Real64 ZoneTempAtHeatPeak = 0.0; // zone temp at max heating [C] - Real64 ZoneRetTempAtHeatPeak = 0.0; // zone return temp at max heating [C] - Real64 ZoneTempAtCoolPeak = 0.0; // zone temp at max cooling [C] - Real64 ZoneRetTempAtCoolPeak = 0.0; // zone return temp at max cooling [C] - Real64 ZoneHumRatAtHeatPeak = 0.0; // zone humidity ratio at max heating [kg/kg] - Real64 ZoneHumRatAtCoolPeak = 0.0; // zone humidity ratio at max cooling [kg/kg] - int TimeStepNumAtHeatMax = 0; // time step number (in day) at Heating peak - int TimeStepNumAtCoolMax = 0; // time step number (in day) at cooling peak - int HeatDDNum = 0; // design day index of design day causing heating peak - int CoolDDNum = 0; // design day index of design day causing cooling peak - Real64 MinOA = 0.0; // design minimum outside air in m3/s - Real64 DesCoolMinAirFlow2 = 0.0; // design cooling minimum air flow rate [m3/s] derived from DesCoolMinAirFlowPerArea - Real64 DesHeatMaxAirFlow2 = 0.0; // design heating maximum air flow rate [m3/s] derived from DesHeatMaxAirFlowPerArea - EPVector HeatFlowSeq; // daily sequence of zone heating air mass flow rate (zone time step) [kg/s] - EPVector HeatFlowSeqNoOA; // daily sequence of zone heating air mass flow rate (zone time step) without MinOA limit [kg/s] - EPVector CoolFlowSeq; // daily sequence of zone cooling air mass flow rate (zone time step) [kg/s] - EPVector CoolFlowSeqNoOA; // daily sequence of zone cooling air mass flow rate (zone time step) without MinOA limit [kg/s] - EPVector HeatZoneTempSeq; // daily sequence of zone temperatures (heating, zone time step) - EPVector HeatZoneRetTempSeq; // daily sequence of zone return temperatures (heating, zone time step) - EPVector CoolZoneTempSeq; // daily sequence of zone temperatures (cooling, zone time step) - EPVector CoolZoneRetTempSeq; // daily sequence of zone return temperatures (cooling, zone time step) - Real64 ZoneADEffCooling = 1.0; // the zone air distribution effectiveness in cooling mode - Real64 ZoneADEffHeating = 1.0; // the zone air distribution effectiveness in heating mode - Real64 ZoneSecondaryRecirculation = 0.0; // the zone secondary air recirculation fraction - Real64 ZoneVentilationEff = 0.0; // zone ventilation efficiency - Real64 ZonePrimaryAirFraction = 0.0; // the zone primary air fraction for cooling based calculations - Real64 ZonePrimaryAirFractionHtg = 0.0; // the zone primary air fraction for heating based calculations - Real64 ZoneOAFracCooling = 0.0; // OA fraction in cooling mode - Real64 ZoneOAFracHeating = 0.0; // OA fraction in heating mode - Real64 TotalOAFromPeople = 0.0; // Zone OA required due to people - Real64 TotalOAFromArea = 0.0; // Zone OA required based on floor area - Real64 TotPeopleInZone = 0.0; // total number of people in the zone - Real64 TotalZoneFloorArea = 0.0; // total zone floor area - Real64 SupplyAirAdjustFactor = 1.0; // supply air adjustment factor for next time step if OA is capped - Real64 ZpzClgByZone = 0.0; // OA Std 62.1 required fraction in cooling mode ? should this be ZdzClgByZone - Real64 ZpzHtgByZone = 0.0; // OA Std 62.1 required fraction in heating mode ? should this be ZdzHtgByZone - Real64 VozClgByZone = 0.0; // value of required cooling vent to zone, used in 62.1 tabular report, already includes people diversity term - Real64 VozHtgByZone = 0.0; // value of required heating vent to zone, used in 62.1 tabular report, already includes people diversity term - bool VpzMinByZoneSPSized = false; // is Vpz_min sized using the 62.1 Standard Simplified Procedure - Real64 ZoneSizThermSetPtHi = 0.0; // highest zone thermostat setpoint during zone sizing calcs - Real64 ZoneSizThermSetPtLo = 1000.0; // lowest zone thermostat setpoint during zone sizing calcs - void scaleZoneCooling(Real64 ratio); void scaleZoneHeating(Real64 ratio); - void copyFromZoneSizing(ZoneSizingData const &sourceData); + void copyFromZoneSizing(DataSizing::ZoneSizingData const &sourceData); void allocateMemberArrays(int numOfTimeStepInDay); }; diff --git a/src/EnergyPlus/General.cc b/src/EnergyPlus/General.cc index aada86ee9af..b99a128019e 100644 --- a/src/EnergyPlus/General.cc +++ b/src/EnergyPlus/General.cc @@ -288,6 +288,26 @@ void SolveRoot(const EnergyPlusData &state, XRes = XTemp; } +void MovingAvg(EPVector &DataIn, int const NumItemsInAvg) +{ + if (NumItemsInAvg <= 1) return; // no need to average/smooth + + EPVector TempData; + TempData.allocate(2 * DataIn.size()); // a scratch array twice the size, bottom end duplicate of top end + + for (std::size_t i = 1; i <= DataIn.size(); ++i) { + TempData(i) = TempData(DataIn.size() + i) = DataIn(i); // initialize both bottom and top end + DataIn(i) = 0.0; + } + + for (std::size_t i = 1; i <= DataIn.size(); ++i) { + for (int j = 1; j <= NumItemsInAvg; ++j) { + DataIn(i) += TempData(DataIn.size() - NumItemsInAvg + i + j); // sum top end including NumItemsInAvg history terms + } + DataIn(i) /= NumItemsInAvg; // average to smooth over NumItemsInAvg window + } +} + void MovingAvg(Array1D &DataIn, int const NumItemsInAvg) { if (NumItemsInAvg <= 1) return; // no need to average/smooth diff --git a/src/EnergyPlus/General.hh b/src/EnergyPlus/General.hh index 7fb73cdbfc2..9f154a4a4ee 100644 --- a/src/EnergyPlus/General.hh +++ b/src/EnergyPlus/General.hh @@ -57,6 +57,7 @@ // EnergyPlus Headers #include +#include #include namespace EnergyPlus { @@ -97,6 +98,8 @@ namespace General { } } + void MovingAvg(EPVector &DataIn, int NumItemsInAvg); + void MovingAvg(Array1D &DataIn, int NumItemsInAvg); void ProcessDateString(EnergyPlusData &state, diff --git a/src/EnergyPlus/ZoneEquipmentManager.cc b/src/EnergyPlus/ZoneEquipmentManager.cc index 9926bd155a1..b2bb32613df 100644 --- a/src/EnergyPlus/ZoneEquipmentManager.cc +++ b/src/EnergyPlus/ZoneEquipmentManager.cc @@ -2301,8 +2301,10 @@ void updateZoneSizingEndZoneSizingCalc7(EnergyPlusData &state, zsFinalSizing.DesCoolVolFlow = zsCalcFinalSizing.DesCoolVolFlow * TotCoolSizMult; zsFinalSizing.DesCoolMassFlow = zsCalcFinalSizing.DesCoolMassFlow * TotCoolSizMult; zsFinalSizing.DesCoolLoad = zsCalcFinalSizing.DesCoolLoad * TotCoolSizMult; - zsFinalSizing.CoolFlowSeq = zsCalcFinalSizing.CoolFlowSeq * TotCoolSizMult; - zsFinalSizing.CoolLoadSeq = zsCalcFinalSizing.CoolLoadSeq * TotCoolSizMult; + for (int i = 0; i < (int)zsFinalSizing.CoolFlowSeq.size(); ++i) { + zsFinalSizing.CoolFlowSeq[i] = zsCalcFinalSizing.CoolFlowSeq[i] * TotCoolSizMult; + zsFinalSizing.CoolLoadSeq[i] = zsCalcFinalSizing.CoolLoadSeq[i] * TotCoolSizMult; + } Real64 OAFrac = zsFinalSizing.MinOA / zsFinalSizing.DesCoolVolFlow; OAFrac = min(1.0, max(0.0, OAFrac)); zsFinalSizing.DesCoolCoilInTemp = @@ -2322,8 +2324,10 @@ void updateZoneSizingEndZoneSizingCalc7(EnergyPlusData &state, zoneSizing.DesCoolVolFlow = calcZoneSizing.DesCoolVolFlow * TotCoolSizMult; zoneSizing.DesCoolMassFlow = calcZoneSizing.DesCoolMassFlow * TotCoolSizMult; zoneSizing.DesCoolLoad = calcZoneSizing.DesCoolLoad * TotCoolSizMult; - zoneSizing.CoolFlowSeq = calcZoneSizing.CoolFlowSeq * TotCoolSizMult; - zoneSizing.CoolLoadSeq = calcZoneSizing.CoolLoadSeq * TotCoolSizMult; + for (int i = 0; i < (int)zoneSizing.CoolFlowSeq.size(); ++i) { + zoneSizing.CoolFlowSeq[i] = calcZoneSizing.CoolFlowSeq[i] * TotCoolSizMult; + zoneSizing.CoolLoadSeq[i] = calcZoneSizing.CoolLoadSeq[i] * TotCoolSizMult; + } Real64 OAFrac = zoneSizing.MinOA / zoneSizing.DesCoolVolFlow; OAFrac = min(1.0, max(0.0, OAFrac)); zoneSizing.DesCoolCoilInTemp = OAFrac * desDayWeath.Temp(TimeStepAtPeak) + (1.0 - OAFrac) * zoneSizing.ZoneTempAtCoolPeak; @@ -2477,8 +2481,10 @@ void updateZoneSizingEndZoneSizingCalc7(EnergyPlusData &state, zsFinalSizing.DesHeatVolFlow = zsCalcFinalSizing.DesHeatVolFlow * TotHeatSizMult; zsFinalSizing.DesHeatMassFlow = zsCalcFinalSizing.DesHeatMassFlow * TotHeatSizMult; zsFinalSizing.DesHeatLoad = zsCalcFinalSizing.DesHeatLoad * TotHeatSizMult; - zsFinalSizing.HeatFlowSeq = zsCalcFinalSizing.HeatFlowSeq * TotHeatSizMult; - zsFinalSizing.HeatLoadSeq = zsCalcFinalSizing.HeatLoadSeq * TotHeatSizMult; + for (int i = 0; i < (int)zsFinalSizing.HeatFlowSeq.size(); ++i) { + zsFinalSizing.HeatFlowSeq[i] = zsCalcFinalSizing.HeatFlowSeq[i] * TotHeatSizMult; + zsFinalSizing.HeatLoadSeq[i] = zsCalcFinalSizing.HeatLoadSeq[i] * TotHeatSizMult; + } Real64 OAFrac = zsFinalSizing.MinOA / zsFinalSizing.DesHeatVolFlow; OAFrac = min(1.0, max(0.0, OAFrac)); zsFinalSizing.DesHeatCoilInTemp = @@ -2497,8 +2503,10 @@ void updateZoneSizingEndZoneSizingCalc7(EnergyPlusData &state, zoneSizingDD.DesHeatVolFlow = calcZoneSizing.DesHeatVolFlow * TotHeatSizMult; zoneSizingDD.DesHeatMassFlow = calcZoneSizing.DesHeatMassFlow * TotHeatSizMult; zoneSizingDD.DesHeatLoad = calcZoneSizing.DesHeatLoad * TotHeatSizMult; - zoneSizingDD.HeatFlowSeq = calcZoneSizing.HeatFlowSeq * TotHeatSizMult; - zoneSizingDD.HeatLoadSeq = calcZoneSizing.HeatLoadSeq * TotHeatSizMult; + for (int i = 0; i < (int)zoneSizingDD.HeatFlowSeq.size(); ++i) { + zoneSizingDD.HeatFlowSeq[i] = calcZoneSizing.HeatFlowSeq[i] * TotHeatSizMult; + zoneSizingDD.HeatLoadSeq[i] = calcZoneSizing.HeatLoadSeq[i] * TotHeatSizMult; + } Real64 OAFrac = zoneSizingDD.MinOA / zoneSizingDD.DesHeatVolFlow; OAFrac = min(1.0, max(0.0, OAFrac)); zoneSizingDD.DesHeatCoilInTemp = From a6b2784f4429f7d7f69fec699dab87da6fd34bc1 Mon Sep 17 00:00:00 2001 From: jcyuan Date: Mon, 21 Aug 2023 00:43:43 -0500 Subject: [PATCH 32/80] Fix default design condenser inlet and design evaporator outlet temperatures for Chiller ConstantCOP. --- src/EnergyPlus/PlantChillers.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/EnergyPlus/PlantChillers.cc b/src/EnergyPlus/PlantChillers.cc index e3e272bd6f8..95d71ad8d2e 100644 --- a/src/EnergyPlus/PlantChillers.cc +++ b/src/EnergyPlus/PlantChillers.cc @@ -6539,6 +6539,10 @@ namespace PlantChillers { state.dataIPShortCut->cAlphaArgs(8))); } } + + // set default design condenser in and evaporator out temperatures + thisChiller.TempDesCondIn = 29.44; // Degree Celsius, or 85 Degree Fahrenheit + thisChiller.TempDesEvapOut = 6.67; // Degree Celsius, or 44 Degree Fahrenheit } if (ErrorsFound) { From d07c2482f2329121827869a75a916d02b50808cf Mon Sep 17 00:00:00 2001 From: jcyuan Date: Thu, 24 Aug 2023 12:22:40 -0500 Subject: [PATCH 33/80] Unit test. --- .../unit/ChillerConstantCOP.unit.cc | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/tst/EnergyPlus/unit/ChillerConstantCOP.unit.cc b/tst/EnergyPlus/unit/ChillerConstantCOP.unit.cc index 641f2ef12ce..d25a5b2ebf6 100644 --- a/tst/EnergyPlus/unit/ChillerConstantCOP.unit.cc +++ b/tst/EnergyPlus/unit/ChillerConstantCOP.unit.cc @@ -163,3 +163,52 @@ TEST_F(EnergyPlusFixture, ChillerConstantCOP_WaterCooled_Autosize) EXPECT_NEAR(thisChiller.CondVolFlowRate, 0.0012606164769923673, 0.0000001); EXPECT_NEAR(thisChiller.CondMassFlowRateMax, 1.2604878941117141, 0.0000001); } + +TEST_F(EnergyPlusFixture, ChillerConstantCOP_Default_Des_Cond_Evap_Temps) +{ + // Unit test for PR 10158 that fixes Issue 10157) + state->dataPlnt->TotNumLoops = 4; + state->dataEnvrn->OutBaroPress = 101325.0; + state->dataEnvrn->StdRhoAir = 1.20; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + + std::string const idf_objects = delimited_string({ + " Chiller:ConstantCOP,", + " Chiller, !- Name", + " autosize, !- Nominal Capacity {W}", + " 4.0, !- Nominal COP {W/W}", + " autosize, !- Design Chilled Water Flow Rate {m3/s}", + " autosize, !- Design Condenser Water Flow Rate {m3/s}", + " Chiller ChW Inlet, !- Chilled Water Inlet Node Name", + " Chiller ChW Outlet, !- Chilled Water Outlet Node Name", + " Chiller Cnd Inlet, !- Condenser Inlet Node Name", + " Chiller Cnd Outlet, !- Condenser Outlet Node Name", + " WaterCooled, !- Condenser Type", + " ConstantFlow, !- Chiller Flow Mode", + " 1, !- Sizing Factor", + " , !- Basin Heater Capacity {W/K}", + " 2; !- Basin Heater Setpoint Temperature {C}", + }); + + EXPECT_TRUE(process_idf(idf_objects, false)); + + state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); + state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); + for (int l = 1; l <= state->dataPlnt->TotNumLoops; ++l) { + auto &loopside(state->dataPlnt->PlantLoop(l).LoopSide(DataPlant::LoopSideLocation::Demand)); + loopside.TotalBranches = 1; + loopside.Branch.allocate(1); + auto &loopsidebranch(state->dataPlnt->PlantLoop(l).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1)); + loopsidebranch.TotalComponents = 1; + loopsidebranch.Comp.allocate(1); + } + + ConstCOPChillerSpecs::getInput(*state); + + auto &thisChiller = state->dataPlantChillers->ConstCOPChiller(1); + + EXPECT_NEAR(thisChiller.TempDesCondIn, 29.44, 1e-3); + EXPECT_NEAR(thisChiller.TempDesEvapOut, 6.67, 1e-3); +} From 4b19e02699de03539da82606de95a2e6ee9f54c0 Mon Sep 17 00:00:00 2001 From: jcyuan Date: Thu, 24 Aug 2023 16:08:46 -0500 Subject: [PATCH 34/80] Treat default cond and evap temperatures based on chiller:ConstantCOP condenser types. --- src/EnergyPlus/PlantChillers.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/EnergyPlus/PlantChillers.cc b/src/EnergyPlus/PlantChillers.cc index 95d71ad8d2e..c2911270696 100644 --- a/src/EnergyPlus/PlantChillers.cc +++ b/src/EnergyPlus/PlantChillers.cc @@ -6541,8 +6541,17 @@ namespace PlantChillers { } // set default design condenser in and evaporator out temperatures - thisChiller.TempDesCondIn = 29.44; // Degree Celsius, or 85 Degree Fahrenheit + // Values from AHRI Standard 550/590 (2023, IP Version) thisChiller.TempDesEvapOut = 6.67; // Degree Celsius, or 44 Degree Fahrenheit + if (thisChiller.CondenserType == DataPlant::CondenserType::WaterCooled) { + thisChiller.TempDesCondIn = 29.44; // Degree Celsius, or 85 Degree Fahrenheit + } else if (thisChiller.CondenserType == DataPlant::CondenserType::AirCooled) { + thisChiller.TempDesCondIn = 35.0; // Degree Celsius, or 95 Degree Fahrenheit + } else if (thisChiller.CondenserType == DataPlant::CondenserType::EvapCooled) { + thisChiller.TempDesCondIn = 35.0; // Degree Celsius, or 95 Degree Fahrenheit + } else { + thisChiller.TempDesCondIn = 35.0; // Degree Celsius, or 95 Degree Fahrenheit + } } if (ErrorsFound) { From 1c3e69ca8b9b2cbd36f8c08c51c27edde23269b4 Mon Sep 17 00:00:00 2001 From: jcyuan Date: Thu, 24 Aug 2023 16:26:42 -0500 Subject: [PATCH 35/80] Unit test update--assigning different default cond and evap rating temperatures based on condenser types. --- .../unit/ChillerConstantCOP.unit.cc | 62 ++++++++++++++++--- 1 file changed, 52 insertions(+), 10 deletions(-) diff --git a/tst/EnergyPlus/unit/ChillerConstantCOP.unit.cc b/tst/EnergyPlus/unit/ChillerConstantCOP.unit.cc index d25a5b2ebf6..bb835f782c4 100644 --- a/tst/EnergyPlus/unit/ChillerConstantCOP.unit.cc +++ b/tst/EnergyPlus/unit/ChillerConstantCOP.unit.cc @@ -167,7 +167,7 @@ TEST_F(EnergyPlusFixture, ChillerConstantCOP_WaterCooled_Autosize) TEST_F(EnergyPlusFixture, ChillerConstantCOP_Default_Des_Cond_Evap_Temps) { // Unit test for PR 10158 that fixes Issue 10157) - state->dataPlnt->TotNumLoops = 4; + state->dataPlnt->TotNumLoops = 12; state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.20; state->dataGlobal->NumOfTimeStepInHour = 1; @@ -176,26 +176,58 @@ TEST_F(EnergyPlusFixture, ChillerConstantCOP_Default_Des_Cond_Evap_Temps) std::string const idf_objects = delimited_string({ " Chiller:ConstantCOP,", - " Chiller, !- Name", + " Chiller_1_WaterCooled, !- Name", " autosize, !- Nominal Capacity {W}", " 4.0, !- Nominal COP {W/W}", " autosize, !- Design Chilled Water Flow Rate {m3/s}", " autosize, !- Design Condenser Water Flow Rate {m3/s}", - " Chiller ChW Inlet, !- Chilled Water Inlet Node Name", - " Chiller ChW Outlet, !- Chilled Water Outlet Node Name", - " Chiller Cnd Inlet, !- Condenser Inlet Node Name", - " Chiller Cnd Outlet, !- Condenser Outlet Node Name", + " Chiller 1 ChW Inlet, !- Chilled Water Inlet Node Name", + " Chiller 1 ChW Outlet, !- Chilled Water Outlet Node Name", + " Chiller 1 Cnd Inlet, !- Condenser Inlet Node Name", + " Chiller 1 Cnd Outlet, !- Condenser Outlet Node Name", " WaterCooled, !- Condenser Type", " ConstantFlow, !- Chiller Flow Mode", " 1, !- Sizing Factor", " , !- Basin Heater Capacity {W/K}", " 2; !- Basin Heater Setpoint Temperature {C}", + + " Chiller:ConstantCOP,", + " Chiller_2_AirCooled, !- Name", + " autosize, !- Nominal Capacity {W}", + " 4.0, !- Nominal COP {W/W}", + " autosize, !- Design Chilled Water Flow Rate {m3/s}", + " autosize, !- Design Condenser Water Flow Rate {m3/s}", + " Chiller 2 ChW Inlet, !- Chilled Water Inlet Node Name", + " Chiller 2 ChW Outlet, !- Chilled Water Outlet Node Name", + " Chiller 2 Cnd Inlet, !- Condenser Inlet Node Name", + " Chiller 2 Cnd Outlet, !- Condenser Outlet Node Name", + " AirCooled, !- Condenser Type", + " ConstantFlow, !- Chiller Flow Mode", + " 1, !- Sizing Factor", + " , !- Basin Heater Capacity {W/K}", + " 2; !- Basin Heater Setpoint Temperature {C}", + + " Chiller:ConstantCOP,", + " Chiller_3_EvapCooled, !- Name", + " autosize, !- Nominal Capacity {W}", + " 4.0, !- Nominal COP {W/W}", + " autosize, !- Design Chilled Water Flow Rate {m3/s}", + " autosize, !- Design Condenser Water Flow Rate {m3/s}", + " Chiller 3 ChW Inlet, !- Chilled Water Inlet Node Name", + " Chiller 3 ChW Outlet, !- Chilled Water Outlet Node Name", + " Chiller 3 Cnd Inlet, !- Condenser Inlet Node Name", + " Chiller 3 Cnd Outlet, !- Condenser Outlet Node Name", + " EvaporativelyCooled, !- Condenser Type", + " ConstantFlow, !- Chiller Flow Mode", + " 1, !- Sizing Factor", + " , !- Basin Heater Capacity {W/K}", + " 2; !- Basin Heater Setpoint Temperature {C}", }); EXPECT_TRUE(process_idf(idf_objects, false)); state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); - state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); + for (int l = 1; l <= state->dataPlnt->TotNumLoops; ++l) { auto &loopside(state->dataPlnt->PlantLoop(l).LoopSide(DataPlant::LoopSideLocation::Demand)); loopside.TotalBranches = 1; @@ -207,8 +239,18 @@ TEST_F(EnergyPlusFixture, ChillerConstantCOP_Default_Des_Cond_Evap_Temps) ConstCOPChillerSpecs::getInput(*state); - auto &thisChiller = state->dataPlantChillers->ConstCOPChiller(1); + auto &thisChiller_1 = state->dataPlantChillers->ConstCOPChiller(1); + + EXPECT_NEAR(thisChiller_1.TempDesCondIn, 29.44, 1e-3); + EXPECT_NEAR(thisChiller_1.TempDesEvapOut, 6.67, 1e-3); + + auto &thisChiller_2 = state->dataPlantChillers->ConstCOPChiller(2); + + EXPECT_NEAR(thisChiller_2.TempDesCondIn, 35.0, 1e-3); + EXPECT_NEAR(thisChiller_2.TempDesEvapOut, 6.67, 1e-3); + + auto &thisChiller_3 = state->dataPlantChillers->ConstCOPChiller(3); - EXPECT_NEAR(thisChiller.TempDesCondIn, 29.44, 1e-3); - EXPECT_NEAR(thisChiller.TempDesEvapOut, 6.67, 1e-3); + EXPECT_NEAR(thisChiller_3.TempDesCondIn, 35.0, 1e-3); + EXPECT_NEAR(thisChiller_3.TempDesEvapOut, 6.67, 1e-3); } From e92e1be4b6e5630708b3e94636812c840a6f8aac Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Fri, 25 Aug 2023 10:36:52 -0500 Subject: [PATCH 36/80] Rename moisture vars with redundant Zone in name --- src/EnergyPlus/DataZoneEnergyDemands.cc | 58 ++++++++++++------------- src/EnergyPlus/DataZoneEnergyDemands.hh | 18 ++++---- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/EnergyPlus/DataZoneEnergyDemands.cc b/src/EnergyPlus/DataZoneEnergyDemands.cc index 35688934d9e..bda3e8b0de4 100644 --- a/src/EnergyPlus/DataZoneEnergyDemands.cc +++ b/src/EnergyPlus/DataZoneEnergyDemands.cc @@ -85,15 +85,15 @@ void ZoneSystemMoistureDemand::beginEnvironmentInit() this->SequencedOutputRequiredToDehumidSP(equipNum) = 0.0; } } - this->ZoneLTLoadHeatEnergy = 0.0; - this->ZoneLTLoadCoolEnergy = 0.0; - this->ZoneLTLoadHeatRate = 0.0; - this->ZoneLTLoadCoolRate = 0.0; - this->ZoneSensibleHeatRatio = 0.0; - this->ZoneVaporPressureDifference = 0.0; - this->ZoneMoisturePredictedRate = 0.0; - this->ZoneMoisturePredictedHumSPRate = 0.0; - this->ZoneMoisturePredictedDehumSPRate = 0.0; + this->loadHeatEnergy = 0.0; + this->loadCoolEnergy = 0.0; + this->loadHeatRate = 0.0; + this->loadCoolRate = 0.0; + this->sensibleHeatRatio = 0.0; + this->vaporPressureDifference = 0.0; + this->predictedRate = 0.0; + this->predictedHumSPRate = 0.0; + this->predictedDehumSPRate = 0.0; } void ZoneSystemSensibleDemand::setUpOutputVars(EnergyPlusData &state, std::string_view prefix, @@ -233,28 +233,28 @@ void ZoneSystemMoistureDemand::setUpOutputVars(EnergyPlusData &state, SetupOutputVariable(state, format("{} Air System Latent Heating Energy", prefix), OutputProcessor::Unit::J, - this->ZoneLTLoadHeatEnergy, + this->loadHeatEnergy, OutputProcessor::SOVTimeStepType::System, OutputProcessor::SOVStoreType::Summed, name); SetupOutputVariable(state, format("{} Air System Latent Cooling Energy", prefix), OutputProcessor::Unit::J, - this->ZoneLTLoadCoolEnergy, + this->loadCoolEnergy, OutputProcessor::SOVTimeStepType::System, OutputProcessor::SOVStoreType::Summed, name); SetupOutputVariable(state, format("{} Air System Latent Heating Rate", prefix), OutputProcessor::Unit::W, - this->ZoneLTLoadHeatRate, + this->loadHeatRate, OutputProcessor::SOVTimeStepType::System, OutputProcessor::SOVStoreType::Average, name); SetupOutputVariable(state, format("{} Air System Latent Cooling Rate", prefix), OutputProcessor::Unit::W, - this->ZoneLTLoadCoolRate, + this->loadCoolRate, OutputProcessor::SOVTimeStepType::System, OutputProcessor::SOVStoreType::Average, name); @@ -262,14 +262,14 @@ void ZoneSystemMoistureDemand::setUpOutputVars(EnergyPlusData &state, SetupOutputVariable(state, format("{} Air System Sensible Heat Ratio", prefix), OutputProcessor::Unit::None, - this->ZoneSensibleHeatRatio, + this->sensibleHeatRatio, OutputProcessor::SOVTimeStepType::System, OutputProcessor::SOVStoreType::Average, name); SetupOutputVariable(state, format("{} Air Vapor Pressure Difference", prefix), OutputProcessor::Unit::Pa, - this->ZoneVaporPressureDifference, + this->vaporPressureDifference, OutputProcessor::SOVTimeStepType::System, OutputProcessor::SOVStoreType::Average, name); @@ -280,21 +280,21 @@ void ZoneSystemMoistureDemand::setUpOutputVars(EnergyPlusData &state, SetupOutputVariable(state, format("{} Predicted Moisture Load Moisture Transfer Rate", prefix), OutputProcessor::Unit::kgWater_s, - this->ZoneMoisturePredictedRate, + this->predictedRate, OutputProcessor::SOVTimeStepType::System, OutputProcessor::SOVStoreType::Average, name); SetupOutputVariable(state, format("{} Predicted Moisture Load to Humidifying Setpoint Moisture Transfer Rate", prefix), OutputProcessor::Unit::kgWater_s, - this->ZoneMoisturePredictedHumSPRate, + this->predictedHumSPRate, OutputProcessor::SOVTimeStepType::System, OutputProcessor::SOVStoreType::Average, name); SetupOutputVariable(state, format("{} Predicted Moisture Load to Dehumidifying Setpoint Moisture Transfer Rate", prefix), OutputProcessor::Unit::kgWater_s, - this->ZoneMoisturePredictedDehumSPRate, + this->predictedDehumSPRate, OutputProcessor::SOVTimeStepType::System, OutputProcessor::SOVStoreType::Average, name); @@ -358,26 +358,26 @@ void ZoneSystemMoistureDemand::reportZoneAirSystemMoistureLoads(EnergyPlusData & Real64 const sensibleLoad, Real64 const vaporPressureDiff) { - this->ZoneLTLoadHeatRate = std::abs(min(latentGain, 0.0)); - this->ZoneLTLoadCoolRate = max(latentGain, 0.0); - this->ZoneLTLoadHeatEnergy = this->ZoneLTLoadHeatRate * state.dataHVACGlobal->TimeStepSysSec; - this->ZoneLTLoadCoolEnergy = this->ZoneLTLoadCoolRate * state.dataHVACGlobal->TimeStepSysSec; + this->loadHeatRate = std::abs(min(latentGain, 0.0)); + this->loadCoolRate = max(latentGain, 0.0); + this->loadHeatEnergy = this->loadHeatRate * state.dataHVACGlobal->TimeStepSysSec; + this->loadCoolEnergy = this->loadCoolRate * state.dataHVACGlobal->TimeStepSysSec; if ((sensibleLoad + latentGain) != 0.0) { - this->ZoneSensibleHeatRatio = sensibleLoad / (sensibleLoad + latentGain); + this->sensibleHeatRatio = sensibleLoad / (sensibleLoad + latentGain); } else if (sensibleLoad != 0.0) { - this->ZoneSensibleHeatRatio = 1.0; + this->sensibleHeatRatio = 1.0; } else { - this->ZoneSensibleHeatRatio = 0.0; + this->sensibleHeatRatio = 0.0; } - this->ZoneVaporPressureDifference = vaporPressureDiff; + this->vaporPressureDifference = vaporPressureDiff; } void ZoneSystemMoistureDemand::reportMoistLoadsZoneMultiplier( EnergyPlusData &state, int const zoneNum, Real64 const totalLoad, Real64 const loadToHumidifySetPoint, Real64 const loadToDehumidifySetPoint) { - this->ZoneMoisturePredictedRate = totalLoad; - this->ZoneMoisturePredictedHumSPRate = loadToHumidifySetPoint; - this->ZoneMoisturePredictedDehumSPRate = loadToDehumidifySetPoint; + this->predictedRate = totalLoad; + this->predictedHumSPRate = loadToHumidifySetPoint; + this->predictedDehumSPRate = loadToDehumidifySetPoint; Real64 zoneMultFac = state.dataHeatBal->Zone(zoneNum).Multiplier * state.dataHeatBal->Zone(zoneNum).ListMultiplier; diff --git a/src/EnergyPlus/DataZoneEnergyDemands.hh b/src/EnergyPlus/DataZoneEnergyDemands.hh index dc55ff02fea..d5dd468d4fc 100644 --- a/src/EnergyPlus/DataZoneEnergyDemands.hh +++ b/src/EnergyPlus/DataZoneEnergyDemands.hh @@ -132,15 +132,15 @@ namespace DataZoneEnergyDemands { EPVector SequencedOutputRequired; // load required to meet setpoint by sequence [kgWater/s] (multiplied) EPVector SequencedOutputRequiredToHumidSP; // load required to meet humidify setpoint by sequence [kgWater/s] (multiplied) EPVector SequencedOutputRequiredToDehumidSP; // load required to meet dehumidify setpoint by sequenc [kgWater/s] (multiplied) - Real64 ZoneMoisturePredictedRate = 0.0; // Predicted moisture load to setpoint [kgWater/s] (unmultiplied) - Real64 ZoneMoisturePredictedHumSPRate = 0.0; // Predicted latent load to humidification setpoint [kgWater/s] (unmultiplied) - Real64 ZoneMoisturePredictedDehumSPRate = 0.0; // Predicted latent load to dehumidification setpoint [kgWater/s] (unmultiplied) - Real64 ZoneLTLoadHeatRate = 0.0; // latent heating rate [W] (unmultiplied) - Real64 ZoneLTLoadCoolRate = 0.0; // latent cooling rate [W] (unmultiplied) - Real64 ZoneLTLoadHeatEnergy = 0.0; // latent heating energy [J] (unmultiplied) - Real64 ZoneLTLoadCoolEnergy = 0.0; // latent cooling energy [J] (unmultiplied) - Real64 ZoneSensibleHeatRatio = 0.0; // zone load SHR [] - Real64 ZoneVaporPressureDifference = 0.0; // vapor pressure depression [Pa] + Real64 predictedRate = 0.0; // Predicted moisture load to setpoint [kgWater/s] (unmultiplied) + Real64 predictedHumSPRate = 0.0; // Predicted latent load to humidification setpoint [kgWater/s] (unmultiplied) + Real64 predictedDehumSPRate = 0.0; // Predicted latent load to dehumidification setpoint [kgWater/s] (unmultiplied) + Real64 loadHeatRate = 0.0; // latent heating rate [W] (unmultiplied) + Real64 loadCoolRate = 0.0; // latent cooling rate [W] (unmultiplied) + Real64 loadHeatEnergy = 0.0; // latent heating energy [J] (unmultiplied) + Real64 loadCoolEnergy = 0.0; // latent cooling energy [J] (unmultiplied) + Real64 sensibleHeatRatio = 0.0; // zone load SHR [] + Real64 vaporPressureDifference = 0.0; // vapor pressure depression [Pa] void beginEnvironmentInit() override; From 28d5c4b34b8a7f9155aae73df56c55e8ae3b8938 Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Fri, 25 Aug 2023 10:47:50 -0500 Subject: [PATCH 37/80] Rename moisture vars with redundant Zone in name - plan B --- src/EnergyPlus/DataZoneEnergyDemands.cc | 34 ++++++++++++------------- src/EnergyPlus/DataZoneEnergyDemands.hh | 10 ++++---- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/EnergyPlus/DataZoneEnergyDemands.cc b/src/EnergyPlus/DataZoneEnergyDemands.cc index bda3e8b0de4..1bca808885d 100644 --- a/src/EnergyPlus/DataZoneEnergyDemands.cc +++ b/src/EnergyPlus/DataZoneEnergyDemands.cc @@ -85,11 +85,11 @@ void ZoneSystemMoistureDemand::beginEnvironmentInit() this->SequencedOutputRequiredToDehumidSP(equipNum) = 0.0; } } - this->loadHeatEnergy = 0.0; - this->loadCoolEnergy = 0.0; - this->loadHeatRate = 0.0; - this->loadCoolRate = 0.0; - this->sensibleHeatRatio = 0.0; + this->airSysHeatEnergy = 0.0; + this->airSysCoolEnergy = 0.0; + this->airSysHeatRate = 0.0; + this->airSysCoolRate = 0.0; + this->airSysSensibleHeatRatio = 0.0; this->vaporPressureDifference = 0.0; this->predictedRate = 0.0; this->predictedHumSPRate = 0.0; @@ -233,28 +233,28 @@ void ZoneSystemMoistureDemand::setUpOutputVars(EnergyPlusData &state, SetupOutputVariable(state, format("{} Air System Latent Heating Energy", prefix), OutputProcessor::Unit::J, - this->loadHeatEnergy, + this->airSysHeatEnergy, OutputProcessor::SOVTimeStepType::System, OutputProcessor::SOVStoreType::Summed, name); SetupOutputVariable(state, format("{} Air System Latent Cooling Energy", prefix), OutputProcessor::Unit::J, - this->loadCoolEnergy, + this->airSysCoolEnergy, OutputProcessor::SOVTimeStepType::System, OutputProcessor::SOVStoreType::Summed, name); SetupOutputVariable(state, format("{} Air System Latent Heating Rate", prefix), OutputProcessor::Unit::W, - this->loadHeatRate, + this->airSysHeatRate, OutputProcessor::SOVTimeStepType::System, OutputProcessor::SOVStoreType::Average, name); SetupOutputVariable(state, format("{} Air System Latent Cooling Rate", prefix), OutputProcessor::Unit::W, - this->loadCoolRate, + this->airSysCoolRate, OutputProcessor::SOVTimeStepType::System, OutputProcessor::SOVStoreType::Average, name); @@ -262,7 +262,7 @@ void ZoneSystemMoistureDemand::setUpOutputVars(EnergyPlusData &state, SetupOutputVariable(state, format("{} Air System Sensible Heat Ratio", prefix), OutputProcessor::Unit::None, - this->sensibleHeatRatio, + this->airSysSensibleHeatRatio, OutputProcessor::SOVTimeStepType::System, OutputProcessor::SOVStoreType::Average, name); @@ -358,16 +358,16 @@ void ZoneSystemMoistureDemand::reportZoneAirSystemMoistureLoads(EnergyPlusData & Real64 const sensibleLoad, Real64 const vaporPressureDiff) { - this->loadHeatRate = std::abs(min(latentGain, 0.0)); - this->loadCoolRate = max(latentGain, 0.0); - this->loadHeatEnergy = this->loadHeatRate * state.dataHVACGlobal->TimeStepSysSec; - this->loadCoolEnergy = this->loadCoolRate * state.dataHVACGlobal->TimeStepSysSec; + this->airSysHeatRate = std::abs(min(latentGain, 0.0)); + this->airSysCoolRate = max(latentGain, 0.0); + this->airSysHeatEnergy = this->airSysHeatRate * state.dataHVACGlobal->TimeStepSysSec; + this->airSysCoolEnergy = this->airSysCoolRate * state.dataHVACGlobal->TimeStepSysSec; if ((sensibleLoad + latentGain) != 0.0) { - this->sensibleHeatRatio = sensibleLoad / (sensibleLoad + latentGain); + this->airSysSensibleHeatRatio = sensibleLoad / (sensibleLoad + latentGain); } else if (sensibleLoad != 0.0) { - this->sensibleHeatRatio = 1.0; + this->airSysSensibleHeatRatio = 1.0; } else { - this->sensibleHeatRatio = 0.0; + this->airSysSensibleHeatRatio = 0.0; } this->vaporPressureDifference = vaporPressureDiff; } diff --git a/src/EnergyPlus/DataZoneEnergyDemands.hh b/src/EnergyPlus/DataZoneEnergyDemands.hh index d5dd468d4fc..d1d736142f0 100644 --- a/src/EnergyPlus/DataZoneEnergyDemands.hh +++ b/src/EnergyPlus/DataZoneEnergyDemands.hh @@ -135,11 +135,11 @@ namespace DataZoneEnergyDemands { Real64 predictedRate = 0.0; // Predicted moisture load to setpoint [kgWater/s] (unmultiplied) Real64 predictedHumSPRate = 0.0; // Predicted latent load to humidification setpoint [kgWater/s] (unmultiplied) Real64 predictedDehumSPRate = 0.0; // Predicted latent load to dehumidification setpoint [kgWater/s] (unmultiplied) - Real64 loadHeatRate = 0.0; // latent heating rate [W] (unmultiplied) - Real64 loadCoolRate = 0.0; // latent cooling rate [W] (unmultiplied) - Real64 loadHeatEnergy = 0.0; // latent heating energy [J] (unmultiplied) - Real64 loadCoolEnergy = 0.0; // latent cooling energy [J] (unmultiplied) - Real64 sensibleHeatRatio = 0.0; // zone load SHR [] + Real64 airSysHeatRate = 0.0; // air system latent heating rate [W] (unmultiplied) + Real64 airSysCoolRate = 0.0; // air system latent cooling rate [W] (unmultiplied) + Real64 airSysHeatEnergy = 0.0; // air system latent heating energy [J] (unmultiplied) + Real64 airSysCoolEnergy = 0.0; // latent cooling energy [J] (unmultiplied) + Real64 airSysSensibleHeatRatio = 0.0; // air system SHR [] Real64 vaporPressureDifference = 0.0; // vapor pressure depression [Pa] void beginEnvironmentInit() override; From b5a2d4f14b7dccab996cc4e7afee967962ee8a04 Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Fri, 25 Aug 2023 10:57:35 -0500 Subject: [PATCH 38/80] Rename sensible vars with redundant Zone in name --- src/EnergyPlus/ConvectionCoefficients.cc | 4 +- src/EnergyPlus/DataZoneEnergyDemands.cc | 52 +++++++++---------- src/EnergyPlus/DataZoneEnergyDemands.hh | 14 ++--- src/EnergyPlus/HVACManager.cc | 8 +-- src/EnergyPlus/HeatBalanceManager.cc | 11 ++-- src/EnergyPlus/RoomAirModelUserTempPattern.cc | 4 +- src/EnergyPlus/SolarShading.cc | 14 ++--- src/EnergyPlus/ZoneTempPredictorCorrector.cc | 8 +-- 8 files changed, 57 insertions(+), 58 deletions(-) diff --git a/src/EnergyPlus/ConvectionCoefficients.cc b/src/EnergyPlus/ConvectionCoefficients.cc index 17c79b01c3f..87565305024 100644 --- a/src/EnergyPlus/ConvectionCoefficients.cc +++ b/src/EnergyPlus/ConvectionCoefficients.cc @@ -4140,7 +4140,7 @@ void DynamicIntConvSurfaceClassification(EnergyPlusData &state, int const SurfNu // now select which equipment type is dominant compared to all those that are ON if (EquipOnCount > 0) { - if (state.dataZoneEnergyDemand->ZoneSysEnergyDemand(zoneNum).ZoneSNLoadPredictedRate >= 0.0) { // heating load + if (state.dataZoneEnergyDemand->ZoneSysEnergyDemand(zoneNum).predictedRate >= 0.0) { // heating load PriorityEquipOn = 1; for (int EquipOnLoop = 1; EquipOnLoop <= EquipOnCount; ++EquipOnLoop) { // assume highest priority/first sim order is dominant for flow regime @@ -4148,7 +4148,7 @@ void DynamicIntConvSurfaceClassification(EnergyPlusData &state, int const SurfNu PriorityEquipOn = EquipOnLoop; } } - } else if (state.dataZoneEnergyDemand->ZoneSysEnergyDemand(zoneNum).ZoneSNLoadPredictedRate < 0.0) { // cooling load + } else if (state.dataZoneEnergyDemand->ZoneSysEnergyDemand(zoneNum).predictedRate < 0.0) { // cooling load PriorityEquipOn = 1; for (int EquipOnLoop = 1; EquipOnLoop <= EquipOnCount; ++EquipOnLoop) { // assume highest priority/first sim order is dominant for flow regime diff --git a/src/EnergyPlus/DataZoneEnergyDemands.cc b/src/EnergyPlus/DataZoneEnergyDemands.cc index 1bca808885d..cecc780aff0 100644 --- a/src/EnergyPlus/DataZoneEnergyDemands.cc +++ b/src/EnergyPlus/DataZoneEnergyDemands.cc @@ -65,13 +65,13 @@ void ZoneSystemSensibleDemand::beginEnvironmentInit() this->SequencedOutputRequiredToCoolingSP(equipNum) = 0.0; } } - this->ZoneSNLoadHeatEnergy = 0.0; - this->ZoneSNLoadCoolEnergy = 0.0; - this->ZoneSNLoadHeatRate = 0.0; - this->ZoneSNLoadCoolRate = 0.0; - this->ZoneSNLoadPredictedRate = 0.0; - this->ZoneSNLoadPredictedHSPRate = 0.0; - this->ZoneSNLoadPredictedCSPRate = 0.0; + this->airSysHeatEnergy = 0.0; + this->airSysCoolEnergy = 0.0; + this->airSysHeatRate = 0.0; + this->airSysCoolRate = 0.0; + this->predictedRate = 0.0; + this->predictedHSPRate = 0.0; + this->predictedCSPRate = 0.0; } void ZoneSystemMoistureDemand::beginEnvironmentInit() @@ -107,7 +107,7 @@ void ZoneSystemSensibleDemand::setUpOutputVars(EnergyPlusData &state, SetupOutputVariable(state, format("{} Air System Sensible Heating Energy", prefix), OutputProcessor::Unit::J, - this->ZoneSNLoadHeatEnergy, + this->airSysHeatEnergy, OutputProcessor::SOVTimeStepType::System, OutputProcessor::SOVStoreType::Summed, name, @@ -122,7 +122,7 @@ void ZoneSystemSensibleDemand::setUpOutputVars(EnergyPlusData &state, SetupOutputVariable(state, format("{} Air System Sensible Cooling Energy", prefix), OutputProcessor::Unit::J, - this->ZoneSNLoadCoolEnergy, + this->airSysCoolEnergy, OutputProcessor::SOVTimeStepType::System, OutputProcessor::SOVStoreType::Summed, name, @@ -138,14 +138,14 @@ void ZoneSystemSensibleDemand::setUpOutputVars(EnergyPlusData &state, SetupOutputVariable(state, format("{} Air System Sensible Heating Energy", prefix), OutputProcessor::Unit::J, - this->ZoneSNLoadHeatEnergy, + this->airSysHeatEnergy, OutputProcessor::SOVTimeStepType::System, OutputProcessor::SOVStoreType::Summed, name); SetupOutputVariable(state, format("{} Air System Sensible Cooling Energy", prefix), OutputProcessor::Unit::J, - this->ZoneSNLoadCoolEnergy, + this->airSysCoolEnergy, OutputProcessor::SOVTimeStepType::System, OutputProcessor::SOVStoreType::Summed, name); @@ -153,14 +153,14 @@ void ZoneSystemSensibleDemand::setUpOutputVars(EnergyPlusData &state, SetupOutputVariable(state, format("{} Air System Sensible Heating Rate", prefix), OutputProcessor::Unit::W, - this->ZoneSNLoadHeatRate, + this->airSysHeatRate, OutputProcessor::SOVTimeStepType::System, OutputProcessor::SOVStoreType::Average, name); SetupOutputVariable(state, format("{} Air System Sensible Cooling Rate", prefix), OutputProcessor::Unit::W, - this->ZoneSNLoadCoolRate, + this->airSysCoolRate, OutputProcessor::SOVTimeStepType::System, OutputProcessor::SOVStoreType::Average, name); @@ -170,21 +170,21 @@ void ZoneSystemSensibleDemand::setUpOutputVars(EnergyPlusData &state, SetupOutputVariable(state, format("{} Predicted Sensible Load to Setpoint Heat Transfer Rate", prefix), OutputProcessor::Unit::W, - this->ZoneSNLoadPredictedRate, + this->predictedRate, OutputProcessor::SOVTimeStepType::System, OutputProcessor::SOVStoreType::Average, name); SetupOutputVariable(state, format("{} Predicted Sensible Load to Heating Setpoint Heat Transfer Rate", prefix), OutputProcessor::Unit::W, - this->ZoneSNLoadPredictedHSPRate, + this->predictedHSPRate, OutputProcessor::SOVTimeStepType::System, OutputProcessor::SOVStoreType::Average, name); SetupOutputVariable(state, format("{} Predicted Sensible Load to Cooling Setpoint Heat Transfer Rate", prefix), OutputProcessor::Unit::W, - this->ZoneSNLoadPredictedCSPRate, + this->predictedCSPRate, OutputProcessor::SOVTimeStepType::System, OutputProcessor::SOVStoreType::Average, name); @@ -324,24 +324,24 @@ void ZoneSystemMoistureDemand::setUpOutputVars(EnergyPlusData &state, void ZoneSystemSensibleDemand::reportZoneAirSystemSensibleLoads(EnergyPlusData &state, Real64 const SNLoad) { - this->ZoneSNLoadHeatRate = max(SNLoad, 0.0); - this->ZoneSNLoadCoolRate = std::abs(min(SNLoad, 0.0)); - this->ZoneSNLoadHeatEnergy = this->ZoneSNLoadHeatRate * state.dataHVACGlobal->TimeStepSysSec; - this->ZoneSNLoadCoolEnergy = this->ZoneSNLoadCoolRate * state.dataHVACGlobal->TimeStepSysSec; + this->airSysHeatRate = max(SNLoad, 0.0); + this->airSysCoolRate = std::abs(min(SNLoad, 0.0)); + this->airSysHeatEnergy = this->airSysHeatRate * state.dataHVACGlobal->TimeStepSysSec; + this->airSysCoolEnergy = this->airSysCoolRate * state.dataHVACGlobal->TimeStepSysSec; } void ZoneSystemSensibleDemand::reportSensibleLoadsZoneMultiplier( EnergyPlusData &state, int const zoneNum, Real64 const totalLoad, Real64 const loadToHeatingSetPoint, Real64 const loadToCoolingSetPoint) { Real64 loadCorrFactor = state.dataHeatBalFanSys->LoadCorrectionFactor(zoneNum); - this->ZoneSNLoadPredictedRate = totalLoad * loadCorrFactor; - this->ZoneSNLoadPredictedHSPRate = loadToHeatingSetPoint * loadCorrFactor; - this->ZoneSNLoadPredictedCSPRate = loadToCoolingSetPoint * loadCorrFactor; + this->predictedRate = totalLoad * loadCorrFactor; + this->predictedHSPRate = loadToHeatingSetPoint * loadCorrFactor; + this->predictedCSPRate = loadToCoolingSetPoint * loadCorrFactor; Real64 ZoneMultFac = state.dataHeatBal->Zone(zoneNum).Multiplier * state.dataHeatBal->Zone(zoneNum).ListMultiplier; - this->TotalOutputRequired = this->ZoneSNLoadPredictedRate * ZoneMultFac; - this->OutputRequiredToHeatingSP = this->ZoneSNLoadPredictedHSPRate * ZoneMultFac; - this->OutputRequiredToCoolingSP = this->ZoneSNLoadPredictedCSPRate * ZoneMultFac; + this->TotalOutputRequired = this->predictedRate * ZoneMultFac; + this->OutputRequiredToHeatingSP = this->predictedHSPRate * ZoneMultFac; + this->OutputRequiredToCoolingSP = this->predictedCSPRate * ZoneMultFac; // init each sequenced demand to the full output if (state.dataHeatBal->Zone(zoneNum).IsControlled && this->NumZoneEquipment > 0) { diff --git a/src/EnergyPlus/DataZoneEnergyDemands.hh b/src/EnergyPlus/DataZoneEnergyDemands.hh index d1d736142f0..7ab1935bb21 100644 --- a/src/EnergyPlus/DataZoneEnergyDemands.hh +++ b/src/EnergyPlus/DataZoneEnergyDemands.hh @@ -93,13 +93,13 @@ namespace DataZoneEnergyDemands { EPVector SequencedOutputRequired; // load required to meet setpoint by sequence [W] (multiplied) EPVector SequencedOutputRequiredToHeatingSP; // load required to meet heating setpoint by sequence [W] (multiplied) EPVector SequencedOutputRequiredToCoolingSP; // load required to meet cooling setpoint by sequence [W] (multiplied) - Real64 ZoneSNLoadPredictedRate = 0.0; // Predicted sensible load [W] (unmultiplied) - Real64 ZoneSNLoadPredictedHSPRate = 0.0; // Predicted sensible load to heating setpoint [W] (unmultiplied) - Real64 ZoneSNLoadPredictedCSPRate = 0.0; // Predicted sensible load to cooling setpoint [W] (unmultiplied) - Real64 ZoneSNLoadHeatRate = 0.0; // sensible heating rate [W] (unmultiplied) - Real64 ZoneSNLoadCoolRate = 0.0; // sensible cooling rate [W] (unmultiplied) - Real64 ZoneSNLoadHeatEnergy = 0.0; // sensible heating energy [J] (unmultiplied) - Real64 ZoneSNLoadCoolEnergy = 0.0; // sensible cooling energy [J] (unmultiplied) + Real64 predictedRate = 0.0; // Predicted sensible load [W] (unmultiplied) + Real64 predictedHSPRate = 0.0; // Predicted sensible load to heating setpoint [W] (unmultiplied) + Real64 predictedCSPRate = 0.0; // Predicted sensible load to cooling setpoint [W] (unmultiplied) + Real64 airSysHeatRate = 0.0; // sensible heating rate [W] (unmultiplied) + Real64 airSysCoolRate = 0.0; // sensible cooling rate [W] (unmultiplied) + Real64 airSysHeatEnergy = 0.0; // sensible heating energy [J] (unmultiplied) + Real64 airSysCoolEnergy = 0.0; // sensible cooling energy [J] (unmultiplied) void beginEnvironmentInit() override; diff --git a/src/EnergyPlus/HVACManager.cc b/src/EnergyPlus/HVACManager.cc index b6a6c6d75b5..d002a5a362e 100644 --- a/src/EnergyPlus/HVACManager.cc +++ b/src/EnergyPlus/HVACManager.cc @@ -2205,10 +2205,10 @@ void UpdateZoneListAndGroupLoads(EnergyPlusData &state) for (ZoneNum = 1; ZoneNum <= zoneList.NumOfZones; ++ZoneNum) { auto const &zoneSysEnergyDemand = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(zoneList.Zone(ZoneNum)); Mult = state.dataHeatBal->Zone(ZoneNum).Multiplier; - state.dataHeatBal->ZoneListSNLoadHeatEnergy(ListNum) += zoneSysEnergyDemand.ZoneSNLoadHeatEnergy * Mult; - state.dataHeatBal->ZoneListSNLoadCoolEnergy(ListNum) += zoneSysEnergyDemand.ZoneSNLoadCoolEnergy * Mult; - state.dataHeatBal->ZoneListSNLoadHeatRate(ListNum) += zoneSysEnergyDemand.ZoneSNLoadHeatRate * Mult; - state.dataHeatBal->ZoneListSNLoadCoolRate(ListNum) += zoneSysEnergyDemand.ZoneSNLoadCoolRate * Mult; + state.dataHeatBal->ZoneListSNLoadHeatEnergy(ListNum) += zoneSysEnergyDemand.airSysHeatEnergy * Mult; + state.dataHeatBal->ZoneListSNLoadCoolEnergy(ListNum) += zoneSysEnergyDemand.airSysCoolEnergy * Mult; + state.dataHeatBal->ZoneListSNLoadHeatRate(ListNum) += zoneSysEnergyDemand.airSysHeatRate * Mult; + state.dataHeatBal->ZoneListSNLoadCoolRate(ListNum) += zoneSysEnergyDemand.airSysCoolRate * Mult; } // ZoneNum } // ListNum diff --git a/src/EnergyPlus/HeatBalanceManager.cc b/src/EnergyPlus/HeatBalanceManager.cc index 6e7b0ef9619..fc97d67f5bf 100644 --- a/src/EnergyPlus/HeatBalanceManager.cc +++ b/src/EnergyPlus/HeatBalanceManager.cc @@ -3141,11 +3141,11 @@ namespace HeatBalanceManager { if (thisZoneHB.ZTAV < state.dataHeatBalMgr->MinTempZone(ZoneNum)) { state.dataHeatBalMgr->MinTempZone(ZoneNum) = thisZoneHB.ZTAV; } - if (thisZoneSysEnergyDemand.ZoneSNLoadHeatRate > state.dataHeatBalMgr->MaxHeatLoadZone(ZoneNum)) { - state.dataHeatBalMgr->MaxHeatLoadZone(ZoneNum) = thisZoneSysEnergyDemand.ZoneSNLoadHeatRate; + if (thisZoneSysEnergyDemand.airSysHeatRate > state.dataHeatBalMgr->MaxHeatLoadZone(ZoneNum)) { + state.dataHeatBalMgr->MaxHeatLoadZone(ZoneNum) = thisZoneSysEnergyDemand.airSysHeatRate; } - if (thisZoneSysEnergyDemand.ZoneSNLoadCoolRate > state.dataHeatBalMgr->MaxCoolLoadZone(ZoneNum)) { - state.dataHeatBalMgr->MaxCoolLoadZone(ZoneNum) = thisZoneSysEnergyDemand.ZoneSNLoadCoolRate; + if (thisZoneSysEnergyDemand.airSysCoolRate > state.dataHeatBalMgr->MaxCoolLoadZone(ZoneNum)) { + state.dataHeatBalMgr->MaxCoolLoadZone(ZoneNum) = thisZoneSysEnergyDemand.airSysCoolRate; } // Record temperature and load for individual zone @@ -3154,8 +3154,7 @@ namespace HeatBalanceManager { state.dataHeatBalMgr->TempZonePrevDay(ZoneNum) = state.dataHeatBalMgr->TempZone(ZoneNum); state.dataHeatBalMgr->LoadZonePrevDay(ZoneNum) = state.dataHeatBalMgr->LoadZone(ZoneNum); state.dataHeatBalMgr->TempZone(ZoneNum) = thisZoneHB.ZTAV; - state.dataHeatBalMgr->LoadZone(ZoneNum) = - max(thisZoneSysEnergyDemand.ZoneSNLoadHeatRate, std::abs(thisZoneSysEnergyDemand.ZoneSNLoadCoolRate)); + state.dataHeatBalMgr->LoadZone(ZoneNum) = max(thisZoneSysEnergyDemand.airSysHeatRate, std::abs(thisZoneSysEnergyDemand.airSysCoolRate)); // Calculate differences in temperature and load for the last two warmup days if (!state.dataGlobal->WarmupFlag && state.dataGlobal->DayOfSim == 1 && diff --git a/src/EnergyPlus/RoomAirModelUserTempPattern.cc b/src/EnergyPlus/RoomAirModelUserTempPattern.cc index fd8b5ec4c22..f8ae9171169 100644 --- a/src/EnergyPlus/RoomAirModelUserTempPattern.cc +++ b/src/EnergyPlus/RoomAirModelUserTempPattern.cc @@ -415,7 +415,7 @@ void FigureTwoGradInterpPattern(EnergyPlusData &state, int const PattrnID, int c } } break; case UserDefinedPatternMode::SensibleCooling: { - Real64 CoolLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).ZoneSNLoadCoolRate; + Real64 CoolLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).airSysCoolRate; if (CoolLoad >= twoGrad.UpperBoundHeatRateScale) { Grad = twoGrad.HiGradient; @@ -434,7 +434,7 @@ void FigureTwoGradInterpPattern(EnergyPlusData &state, int const PattrnID, int c } } break; case UserDefinedPatternMode::SensibleHeating: { - Real64 HeatLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).ZoneSNLoadHeatRate; + Real64 HeatLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).airSysHeatRate; if (HeatLoad >= twoGrad.UpperBoundHeatRateScale) { Grad = twoGrad.HiGradient; } else if (HeatLoad <= twoGrad.LowerBoundHeatRateScale) { diff --git a/src/EnergyPlus/SolarShading.cc b/src/EnergyPlus/SolarShading.cc index c9eb0f0376f..f307f30523a 100644 --- a/src/EnergyPlus/SolarShading.cc +++ b/src/EnergyPlus/SolarShading.cc @@ -9736,7 +9736,7 @@ void WindowShadingManager(EnergyPlusData &state) // In the following, the check on BeginSimFlag is needed since SNLoadCoolRate (and SNLoadHeatRate, // used in other CASEs) are not allocated at this point for the first time step of the simulation. if (!state.dataGlobal->BeginSimFlag) { - if (state.dataZoneEnergyDemand->ZoneSysEnergyDemand(IZone).ZoneSNLoadCoolRate > SetPoint && SchedAllowsControl) { + if (state.dataZoneEnergyDemand->ZoneSysEnergyDemand(IZone).airSysCoolRate > SetPoint && SchedAllowsControl) { shadingOn = true; } else if (GlareControlIsActive) { shadingOffButGlareControlOn = true; @@ -9842,7 +9842,7 @@ void WindowShadingManager(EnergyPlusData &state) case WindowShadingControlType::OnNightIfHeating_OffDay: // 'OnNightIfHeatingAndOffDay' if (!state.dataGlobal->BeginSimFlag) { - if (!state.dataEnvrn->SunIsUp && state.dataZoneEnergyDemand->ZoneSysEnergyDemand(IZone).ZoneSNLoadHeatRate > SetPoint && + if (!state.dataEnvrn->SunIsUp && state.dataZoneEnergyDemand->ZoneSysEnergyDemand(IZone).airSysHeatRate > SetPoint && SchedAllowsControl) { shadingOn = true; } else if (GlareControlIsActive) { @@ -9856,7 +9856,7 @@ void WindowShadingManager(EnergyPlusData &state) if (!state.dataEnvrn->SunIsUp) { // Night if (state.dataSurface->SurfOutDryBulbTemp(ISurf) < SetPoint && SchedAllowsControl) shadingOn = true; } else { // Day - if (state.dataZoneEnergyDemand->ZoneSysEnergyDemand(IZone).ZoneSNLoadCoolRate > 0.0 && SchedAllowsControl) { + if (state.dataZoneEnergyDemand->ZoneSysEnergyDemand(IZone).airSysCoolRate > 0.0 && SchedAllowsControl) { shadingOn = true; } else if (GlareControlIsActive) { shadingOffButGlareControlOn = true; @@ -9868,10 +9868,10 @@ void WindowShadingManager(EnergyPlusData &state) case WindowShadingControlType::OnNightIfHeating_OnDayCooling: // 'OnNightIfHeatingAndOnDayIfCooling' if (!state.dataGlobal->BeginSimFlag) { if (!state.dataEnvrn->SunIsUp) { // Night - if (state.dataZoneEnergyDemand->ZoneSysEnergyDemand(IZone).ZoneSNLoadHeatRate > SetPoint && SchedAllowsControl) + if (state.dataZoneEnergyDemand->ZoneSysEnergyDemand(IZone).airSysHeatRate > SetPoint && SchedAllowsControl) shadingOn = true; } else { // Day - if (state.dataZoneEnergyDemand->ZoneSysEnergyDemand(IZone).ZoneSNLoadCoolRate > 0.0 && SchedAllowsControl) { + if (state.dataZoneEnergyDemand->ZoneSysEnergyDemand(IZone).airSysCoolRate > 0.0 && SchedAllowsControl) { shadingOn = true; } else if (GlareControlIsActive) { shadingOffButGlareControlOn = true; @@ -9882,7 +9882,7 @@ void WindowShadingManager(EnergyPlusData &state) case WindowShadingControlType::OffNight_OnDay_HiSolarWindow: // 'OffNightAndOnDayIfCoolingAndHighSolarOnWindow' if (!state.dataGlobal->BeginSimFlag) { - if (state.dataEnvrn->SunIsUp && state.dataZoneEnergyDemand->ZoneSysEnergyDemand(IZone).ZoneSNLoadCoolRate > 0.0 && + if (state.dataEnvrn->SunIsUp && state.dataZoneEnergyDemand->ZoneSysEnergyDemand(IZone).airSysCoolRate > 0.0 && SchedAllowsControl) { if (SolarOnWindow > SetPoint) shadingOn = true; } else if (GlareControlIsActive) { @@ -9893,7 +9893,7 @@ void WindowShadingManager(EnergyPlusData &state) case WindowShadingControlType::OnNight_OnDay_HiSolarWindow: // 'OnNightAndOnDayIfCoolingAndHighSolarOnWindow' if (!state.dataGlobal->BeginSimFlag) { - if (state.dataEnvrn->SunIsUp && state.dataZoneEnergyDemand->ZoneSysEnergyDemand(IZone).ZoneSNLoadCoolRate > 0.0 && + if (state.dataEnvrn->SunIsUp && state.dataZoneEnergyDemand->ZoneSysEnergyDemand(IZone).airSysCoolRate > 0.0 && SchedAllowsControl) { if (SolarOnWindow > SetPoint) shadingOn = true; } else if (!state.dataEnvrn->SunIsUp && SchedAllowsControl) { diff --git a/src/EnergyPlus/ZoneTempPredictorCorrector.cc b/src/EnergyPlus/ZoneTempPredictorCorrector.cc index 97930626322..4760e730392 100644 --- a/src/EnergyPlus/ZoneTempPredictorCorrector.cc +++ b/src/EnergyPlus/ZoneTempPredictorCorrector.cc @@ -4975,13 +4975,13 @@ void ZoneSpaceHeatBalanceData::correctHumRat(EnergyPlusData &state, int const zo Real64 Tdp = Psychrometrics::PsyTdpFnWPb(state, this->ZoneAirHumRatTemp, state.dataEnvrn->StdBaroPress); Real64 vaporPressureDiff = pSat - Psychrometrics::PsyPsatFnTemp(state, Tdp, RoutineName); if (spaceNum > 0) { - sensibleLoad = state.dataZoneEnergyDemand->spaceSysEnergyDemand(spaceNum).ZoneSNLoadHeatRate + - state.dataZoneEnergyDemand->spaceSysEnergyDemand(spaceNum).ZoneSNLoadCoolRate; + sensibleLoad = state.dataZoneEnergyDemand->spaceSysEnergyDemand(spaceNum).airSysHeatRate + + state.dataZoneEnergyDemand->spaceSysEnergyDemand(spaceNum).airSysCoolRate; state.dataZoneEnergyDemand->spaceSysMoistureDemand(spaceNum).reportZoneAirSystemMoistureLoads( state, LatentGain, sensibleLoad, vaporPressureDiff); } else { - sensibleLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(zoneNum).ZoneSNLoadHeatRate + - state.dataZoneEnergyDemand->ZoneSysEnergyDemand(zoneNum).ZoneSNLoadCoolRate; + sensibleLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(zoneNum).airSysHeatRate + + state.dataZoneEnergyDemand->ZoneSysEnergyDemand(zoneNum).airSysCoolRate; state.dataZoneEnergyDemand->ZoneSysMoistureDemand(zoneNum).reportZoneAirSystemMoistureLoads( state, LatentGain, sensibleLoad, vaporPressureDiff); } From 6d094b04cd509a9fb30cc41b2ec6b53e66a42445 Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Fri, 25 Aug 2023 11:56:51 -0500 Subject: [PATCH 39/80] Rename vars in unit tests --- .../unit/ZoneTempPredictorCorrector.unit.cc | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/tst/EnergyPlus/unit/ZoneTempPredictorCorrector.unit.cc b/tst/EnergyPlus/unit/ZoneTempPredictorCorrector.unit.cc index 90abe9da4af..bc7b325bc81 100644 --- a/tst/EnergyPlus/unit/ZoneTempPredictorCorrector.unit.cc +++ b/tst/EnergyPlus/unit/ZoneTempPredictorCorrector.unit.cc @@ -1463,11 +1463,9 @@ TEST_F(EnergyPlusFixture, ReportMoistLoadsZoneMultiplier_Test) thisZone.ListMultiplier = 1.0; thisZoneSysMoistureDemand.reportMoistLoadsZoneMultiplier( *state, zoneNum, totalOutputRequired, outputRequiredToHumidifyingSP, outputRequiredToDehumidifyingSP); - EXPECT_NEAR(thisZoneSysMoistureDemand.TotalOutputRequired, thisZoneSysMoistureDemand.ZoneMoisturePredictedRate, AcceptableTolerance); - EXPECT_NEAR( - thisZoneSysMoistureDemand.OutputRequiredToHumidifyingSP, thisZoneSysMoistureDemand.ZoneMoisturePredictedHumSPRate, AcceptableTolerance); - EXPECT_NEAR( - thisZoneSysMoistureDemand.OutputRequiredToDehumidifyingSP, thisZoneSysMoistureDemand.ZoneMoisturePredictedDehumSPRate, AcceptableTolerance); + EXPECT_NEAR(thisZoneSysMoistureDemand.TotalOutputRequired, thisZoneSysMoistureDemand.predictedRate, AcceptableTolerance); + EXPECT_NEAR(thisZoneSysMoistureDemand.OutputRequiredToHumidifyingSP, thisZoneSysMoistureDemand.predictedHumSPRate, AcceptableTolerance); + EXPECT_NEAR(thisZoneSysMoistureDemand.OutputRequiredToDehumidifyingSP, thisZoneSysMoistureDemand.predictedDehumSPRate, AcceptableTolerance); // Test 2a: Zone Multiplier (non-list) is greater than 1, list Zone Multiplier is still one thisZone.Multiplier = 7.0; @@ -1475,11 +1473,11 @@ TEST_F(EnergyPlusFixture, ReportMoistLoadsZoneMultiplier_Test) thisZoneSysMoistureDemand.reportMoistLoadsZoneMultiplier( *state, zoneNum, totalOutputRequired, outputRequiredToHumidifyingSP, outputRequiredToDehumidifyingSP); ExpectedResult = 1000.0; - EXPECT_NEAR(ExpectedResult, thisZoneSysMoistureDemand.ZoneMoisturePredictedRate, AcceptableTolerance); + EXPECT_NEAR(ExpectedResult, thisZoneSysMoistureDemand.predictedRate, AcceptableTolerance); ExpectedResult = 2000.0; - EXPECT_NEAR(ExpectedResult, thisZoneSysMoistureDemand.ZoneMoisturePredictedHumSPRate, AcceptableTolerance); + EXPECT_NEAR(ExpectedResult, thisZoneSysMoistureDemand.predictedHumSPRate, AcceptableTolerance); ExpectedResult = 3000.0; - EXPECT_NEAR(ExpectedResult, thisZoneSysMoistureDemand.ZoneMoisturePredictedDehumSPRate, AcceptableTolerance); + EXPECT_NEAR(ExpectedResult, thisZoneSysMoistureDemand.predictedDehumSPRate, AcceptableTolerance); ExpectedResult = 7000.0; EXPECT_NEAR(thisZoneSysMoistureDemand.TotalOutputRequired, ExpectedResult, AcceptableTolerance); ExpectedResult = 14000.0; @@ -1493,11 +1491,11 @@ TEST_F(EnergyPlusFixture, ReportMoistLoadsZoneMultiplier_Test) thisZoneSysMoistureDemand.reportMoistLoadsZoneMultiplier( *state, zoneNum, totalOutputRequired, outputRequiredToHumidifyingSP, outputRequiredToDehumidifyingSP); ExpectedResult = 1000.0; - EXPECT_NEAR(ExpectedResult, thisZoneSysMoistureDemand.ZoneMoisturePredictedRate, AcceptableTolerance); + EXPECT_NEAR(ExpectedResult, thisZoneSysMoistureDemand.predictedRate, AcceptableTolerance); ExpectedResult = 2000.0; - EXPECT_NEAR(ExpectedResult, thisZoneSysMoistureDemand.ZoneMoisturePredictedHumSPRate, AcceptableTolerance); + EXPECT_NEAR(ExpectedResult, thisZoneSysMoistureDemand.predictedHumSPRate, AcceptableTolerance); ExpectedResult = 3000.0; - EXPECT_NEAR(ExpectedResult, thisZoneSysMoistureDemand.ZoneMoisturePredictedDehumSPRate, AcceptableTolerance); + EXPECT_NEAR(ExpectedResult, thisZoneSysMoistureDemand.predictedDehumSPRate, AcceptableTolerance); ExpectedResult = 7000.0; EXPECT_NEAR(thisZoneSysMoistureDemand.TotalOutputRequired, ExpectedResult, AcceptableTolerance); ExpectedResult = 14000.0; @@ -1514,11 +1512,11 @@ TEST_F(EnergyPlusFixture, ReportMoistLoadsZoneMultiplier_Test) thisZoneSysMoistureDemand.reportMoistLoadsZoneMultiplier( *state, zoneNum, totalOutputRequired, outputRequiredToHumidifyingSP, outputRequiredToDehumidifyingSP); ExpectedResult = 300.0; - EXPECT_NEAR(ExpectedResult, thisZoneSysMoistureDemand.ZoneMoisturePredictedRate, AcceptableTolerance); + EXPECT_NEAR(ExpectedResult, thisZoneSysMoistureDemand.predictedRate, AcceptableTolerance); ExpectedResult = 150.0; - EXPECT_NEAR(ExpectedResult, thisZoneSysMoistureDemand.ZoneMoisturePredictedHumSPRate, AcceptableTolerance); + EXPECT_NEAR(ExpectedResult, thisZoneSysMoistureDemand.predictedHumSPRate, AcceptableTolerance); ExpectedResult = 100.0; - EXPECT_NEAR(ExpectedResult, thisZoneSysMoistureDemand.ZoneMoisturePredictedDehumSPRate, AcceptableTolerance); + EXPECT_NEAR(ExpectedResult, thisZoneSysMoistureDemand.predictedDehumSPRate, AcceptableTolerance); ExpectedResult = 1800.0; EXPECT_NEAR(thisZoneSysMoistureDemand.TotalOutputRequired, ExpectedResult, AcceptableTolerance); ExpectedResult = 900.0; @@ -1532,9 +1530,9 @@ TEST_F(EnergyPlusFixture, ReportSensibleLoadsZoneMultiplier_Test) int zoneNum = 1; state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(zoneNum); auto &thisZoneSysEnergyDemand = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(zoneNum); - Real64 &SingleZoneTotRate = thisZoneSysEnergyDemand.ZoneSNLoadPredictedRate; - Real64 &SingleZoneHeatRate = thisZoneSysEnergyDemand.ZoneSNLoadPredictedHSPRate; - Real64 &SingleZoneCoolRate = thisZoneSysEnergyDemand.ZoneSNLoadPredictedCSPRate; + Real64 &SingleZoneTotRate = thisZoneSysEnergyDemand.predictedRate; + Real64 &SingleZoneHeatRate = thisZoneSysEnergyDemand.predictedHSPRate; + Real64 &SingleZoneCoolRate = thisZoneSysEnergyDemand.predictedCSPRate; state->dataHeatBalFanSys->LoadCorrectionFactor.allocate(zoneNum); Real64 &CorrectionFactor = state->dataHeatBalFanSys->LoadCorrectionFactor(zoneNum); state->dataHeatBal->Zone.allocate(zoneNum); From 4b5d085405374872cb9e98a4a7bdd7b458ed2eef Mon Sep 17 00:00:00 2001 From: Rick Strand Date: Fri, 25 Aug 2023 17:48:34 -0500 Subject: [PATCH 40/80] I object (loop)! A few more changes to address comments. --- src/EnergyPlus/HWBaseboardRadiator.cc | 4 +--- src/EnergyPlus/HighTempRadiantSystem.cc | 11 ++++------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/EnergyPlus/HWBaseboardRadiator.cc b/src/EnergyPlus/HWBaseboardRadiator.cc index 5d03e45565d..0523bb4ca9e 100644 --- a/src/EnergyPlus/HWBaseboardRadiator.cc +++ b/src/EnergyPlus/HWBaseboardRadiator.cc @@ -1503,9 +1503,7 @@ namespace HWBaseboardRadiator { state.dataHeatBalFanSys->SurfQHWBaseboard = 0.0; state.dataHeatBalFanSys->ZoneQHWBaseboardToPerson = 0.0; - for (BaseboardNum = 1; BaseboardNum <= state.dataHWBaseboardRad->NumHWBaseboards; ++BaseboardNum) { - - auto &thisHWBB = state.dataHWBaseboardRad->HWBaseboard(BaseboardNum); + for (auto &thisHWBB : state.dataHWBaseboardRad->HWBaseboard) { HWBaseboardDesignData const &HWBaseboardDesignDataObject = state.dataHWBaseboardRad->HWBaseboardDesignObject(thisHWBB.DesignObjectPtr); // Contains the data for the design object int ZoneNum = thisHWBB.ZonePtr; diff --git a/src/EnergyPlus/HighTempRadiantSystem.cc b/src/EnergyPlus/HighTempRadiantSystem.cc index 6575401545d..6fc49574a27 100644 --- a/src/EnergyPlus/HighTempRadiantSystem.cc +++ b/src/EnergyPlus/HighTempRadiantSystem.cc @@ -665,8 +665,7 @@ namespace HighTempRadiantSystem { } if (state.dataGlobal->BeginEnvrnFlag && state.dataHighTempRadSys->MyEnvrnFlag) { - for (HTRnum = 1; HTRnum <= state.dataHighTempRadSys->NumOfHighTempRadSys; ++HTRnum) { - auto &thisHTR = state.dataHighTempRadSys->HighTempRadSys(HTRnum); + for (auto &thisHTR : state.dataHighTempRadSys->HighTempRadSys) { thisHTR.ZeroHTRSourceSumHATsurf = 0.0; thisHTR.QHTRRadSource = 0.0; thisHTR.QHTRRadSrcAvg = 0.0; @@ -1101,8 +1100,7 @@ namespace HighTempRadiantSystem { if (state.dataHighTempRadSys->NumOfHighTempRadSys == 0) return; // If it was allocated, then we have to check to see if this was running at all... - for (int RadSysNum = 1; RadSysNum <= state.dataHighTempRadSys->NumOfHighTempRadSys; ++RadSysNum) { - auto &thisHTR = state.dataHighTempRadSys->HighTempRadSys(RadSysNum); + for (auto &thisHTR : state.dataHighTempRadSys->HighTempRadSys) { thisHTR.QHTRRadSource = thisHTR.QHTRRadSrcAvg; if (thisHTR.QHTRRadSrcAvg != 0.0) HighTempRadSysOn = true; } @@ -1147,9 +1145,8 @@ namespace HighTempRadiantSystem { dataHBFS->SurfQHTRadSys = 0.0; dataHBFS->ZoneQHTRadSysToPerson = 0.0; - for (int RadSysNum = 1; RadSysNum <= state.dataHighTempRadSys->NumOfHighTempRadSys; ++RadSysNum) { - - auto &thisHTR = state.dataHighTempRadSys->HighTempRadSys(RadSysNum); + + for (auto &thisHTR : state.dataHighTempRadSys->HighTempRadSys) { int ZoneNum = thisHTR.ZonePtr; dataHBFS->ZoneQHTRadSysToPerson(ZoneNum) = thisHTR.QHTRRadSource * thisHTR.FracRadiant * thisHTR.FracDistribPerson; From f39990ecad2b0fa95668e5580c6b948cf6de3400 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Sat, 26 Aug 2023 10:18:30 -0400 Subject: [PATCH 41/80] Object loop, unused vars, cleanup with CppCheck help --- src/EnergyPlus/HWBaseboardRadiator.cc | 27 ++--- src/EnergyPlus/HighTempRadiantSystem.cc | 18 +-- src/EnergyPlus/LowTempRadiantSystem.cc | 154 +++++++++--------------- src/EnergyPlus/VentilatedSlab.cc | 7 +- 4 files changed, 78 insertions(+), 128 deletions(-) diff --git a/src/EnergyPlus/HWBaseboardRadiator.cc b/src/EnergyPlus/HWBaseboardRadiator.cc index 0523bb4ca9e..d40296ffe72 100644 --- a/src/EnergyPlus/HWBaseboardRadiator.cc +++ b/src/EnergyPlus/HWBaseboardRadiator.cc @@ -440,7 +440,6 @@ namespace HWBaseboardRadiator { state.dataIPShortCut->cNumericFieldNames); HWBaseboardNumericFields.FieldNames.allocate(NumNumbers); - HWBaseboardNumericFields.FieldNames = ""; HWBaseboardNumericFields.FieldNames = state.dataIPShortCut->cNumericFieldNames; // ErrorsFound will be set to True if problem was found, left untouched otherwise @@ -848,18 +847,16 @@ namespace HWBaseboardRadiator { state.dataHWBaseboardRad->SetLoopIndexFlag.dimension(NumHWBaseboards, true); state.dataHWBaseboardRad->MyOneTimeFlag = false; - for (int Loop = 1; Loop <= NumHWBaseboards; ++Loop) { - auto &hWBB = state.dataHWBaseboardRad->HWBaseboard; + for (auto &hWBB : state.dataHWBaseboardRad->HWBaseboard) { // Air mass flow rate is obtained from the following linear equation (reset if autosize is used) // m_dot = 0.0062 + 2.75e-05*q - hWBB(Loop).AirMassFlowRateStd = Constant + Coeff * hWBB(Loop).RatedCapacity; - hWBB(Loop).ZeroBBSourceSumHATsurf = 0.0; - hWBB(Loop).QBBRadSource = 0.0; - hWBB(Loop).QBBRadSrcAvg = 0.0; - hWBB(Loop).LastQBBRadSrc = 0.0; - hWBB(Loop).LastSysTimeElapsed = 0.0; - hWBB(Loop).LastTimeStepSys = 0.0; - hWBB(Loop).AirMassFlowRateStd = Constant + Coeff * hWBB(Loop).RatedCapacity; + hWBB.ZeroBBSourceSumHATsurf = 0.0; + hWBB.QBBRadSource = 0.0; + hWBB.QBBRadSrcAvg = 0.0; + hWBB.LastQBBRadSrc = 0.0; + hWBB.LastSysTimeElapsed = 0.0; + hWBB.LastTimeStepSys = 0.0; + hWBB.AirMassFlowRateStd = Constant + Coeff * hWBB.RatedCapacity; } } @@ -1456,15 +1453,14 @@ namespace HWBaseboardRadiator { // one or more of the radiant systems was running. HWBaseboardSysOn = false; - auto &HWBaseboard = state.dataHWBaseboardRad->HWBaseboard; // If there are no baseboards in this input file, just RETURN if (state.dataHWBaseboardRad->NumHWBaseboards == 0) return; // If there are baseboards, then we have to check to see if this was running at all... - for (int BaseboardNum = 1; BaseboardNum <= state.dataHWBaseboardRad->NumHWBaseboards; ++BaseboardNum) { - HWBaseboard(BaseboardNum).QBBRadSource = HWBaseboard(BaseboardNum).QBBRadSrcAvg; - if (HWBaseboard(BaseboardNum).QBBRadSrcAvg != 0.0) HWBaseboardSysOn = true; + for (auto &thisHWBaseboard : state.dataHWBaseboardRad->HWBaseboard) { + thisHWBaseboard.QBBRadSource = thisHWBaseboard.QBBRadSrcAvg; + if (thisHWBaseboard.QBBRadSrcAvg != 0.0) HWBaseboardSysOn = true; } DistributeBBRadGains(state); // QBBRadSource has been modified so we need to redistribute gains @@ -1495,7 +1491,6 @@ namespace HWBaseboardRadiator { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int RadSurfNum; // Counter for surfaces receiving radiation from radiant heater - int BaseboardNum; // Counter for the baseboard int SurfNum; // Pointer to the Surface derived type Real64 ThisSurfIntensity; // temporary for W/m2 term for rad on a surface diff --git a/src/EnergyPlus/HighTempRadiantSystem.cc b/src/EnergyPlus/HighTempRadiantSystem.cc index 6fc49574a27..67791180327 100644 --- a/src/EnergyPlus/HighTempRadiantSystem.cc +++ b/src/EnergyPlus/HighTempRadiantSystem.cc @@ -637,10 +637,6 @@ namespace HighTempRadiantSystem { // Using/Aliasing using DataZoneEquipment::CheckZoneEquipmentList; - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int ZoneNum; // Intermediate variable for keeping track of the zone number - int HTRnum; - if (state.dataHighTempRadSys->firstTime) { state.dataHighTempRadSys->MySizeFlag.dimension(state.dataHighTempRadSys->NumOfHighTempRadSys, true); state.dataHighTempRadSys->firstTime = false; @@ -649,12 +645,12 @@ namespace HighTempRadiantSystem { // need to check all units to see if they are on Zone Equipment List or issue warning if (!state.dataHighTempRadSys->ZoneEquipmentListChecked && state.dataZoneEquip->ZoneEquipInputsFilled) { state.dataHighTempRadSys->ZoneEquipmentListChecked = true; - for (HTRnum = 1; HTRnum <= state.dataHighTempRadSys->NumOfHighTempRadSys; ++HTRnum) { - if (CheckZoneEquipmentList(state, "ZoneHVAC:HighTemperatureRadiant", state.dataHighTempRadSys->HighTempRadSys(HTRnum).Name)) continue; + for (auto &thisHTRSys : state.dataHighTempRadSys->HighTempRadSys) { + if (CheckZoneEquipmentList(state, "ZoneHVAC:HighTemperatureRadiant", thisHTRSys.Name)) continue; ShowSevereError(state, format("InitHighTempRadiantSystem: Unit=[ZoneHVAC:HighTemperatureRadiant,{}] is not on any ZoneHVAC:EquipmentList. " "It will not be simulated.", - state.dataHighTempRadSys->HighTempRadSys(HTRnum).Name)); + thisHTRSys.Name)); } } @@ -681,11 +677,10 @@ namespace HighTempRadiantSystem { if (state.dataGlobal->BeginTimeStepFlag && FirstHVACIteration) { // This is the first pass through in a particular time step auto &thisHTR = state.dataHighTempRadSys->HighTempRadSys(RadSysNum); - ZoneNum = thisHTR.ZonePtr; thisHTR.ZeroHTRSourceSumHATsurf = - state.dataHeatBal->Zone(ZoneNum).sumHATsurf(state); // Set this to figure out what part of the load the radiant system meets - thisHTR.QHTRRadSource = 0.0; // Initialize this variable to zero (radiant system defaults to off) - thisHTR.QHTRRadSrcAvg = 0.0; // Initialize this variable to zero (radiant system defaults to off) + state.dataHeatBal->Zone(thisHTR.ZonePtr).sumHATsurf(state); // Set this to figure out what part of the load the radiant system meets + thisHTR.QHTRRadSource = 0.0; // Initialize this variable to zero (radiant system defaults to off) + thisHTR.QHTRRadSrcAvg = 0.0; // Initialize this variable to zero (radiant system defaults to off) thisHTR.LastQHTRRadSrc = 0.0; // At the beginning of a time step, reset to zero so average calculation can start again thisHTR.LastSysTimeElapsed = 0.0; // At the beginning of a time step, reset to zero so average calculation can start again thisHTR.LastTimeStepSys = 0.0; // At the beginning of a time step, reset to zero so average calculation can start again @@ -1145,7 +1140,6 @@ namespace HighTempRadiantSystem { dataHBFS->SurfQHTRadSys = 0.0; dataHBFS->ZoneQHTRadSysToPerson = 0.0; - for (auto &thisHTR : state.dataHighTempRadSys->HighTempRadSys) { int ZoneNum = thisHTR.ZonePtr; diff --git a/src/EnergyPlus/LowTempRadiantSystem.cc b/src/EnergyPlus/LowTempRadiantSystem.cc index 976edf2c550..1a8463b91c7 100644 --- a/src/EnergyPlus/LowTempRadiantSystem.cc +++ b/src/EnergyPlus/LowTempRadiantSystem.cc @@ -1942,18 +1942,16 @@ namespace LowTempRadiantSystem { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 CurrentFlowSchedule; // Schedule value for flow fraction in a constant flow radiant system - int RadNum; // Number of the radiant system (DO loop counter) int SurfNum; // Intermediate variable for keeping track of the surface number Real64 TotalEffic; // Intermediate calculation variable for total pump efficiency int ZoneNum; // Intermediate variable for keeping track of the zone number - int Loop; - Real64 mdot; // local fluid mass flow rate - Real64 rho; // local fluid density + Real64 mdot; // local fluid mass flow rate + Real64 rho; // local fluid density bool errFlag; InitErrorsFound = false; - auto &Surface = state.dataSurface->Surface; + auto const &Surface = state.dataSurface->Surface; if (state.dataLowTempRadSys->MyOneTimeFlag) { state.dataLowTempRadSys->MyEnvrnFlagHydr.allocate(state.dataLowTempRadSys->NumOfHydrLowTempRadSys); @@ -1971,26 +1969,23 @@ namespace LowTempRadiantSystem { if (state.dataLowTempRadSys->FirstTimeInit) { - for (RadNum = 1; RadNum <= state.dataLowTempRadSys->NumOfHydrLowTempRadSys; ++RadNum) { - auto &thisLTR = state.dataLowTempRadSys->HydrRadSys(RadNum); - thisLTR.QRadSysSrcAvg.dimension(thisLTR.NumOfSurfaces, 0.0); - thisLTR.LastQRadSysSrc.dimension(thisLTR.NumOfSurfaces, 0.0); - thisLTR.LastSysTimeElapsed = 0.0; - thisLTR.LastTimeStepSys = 0.0; + for (auto &thisLTRSys : state.dataLowTempRadSys->HydrRadSys) { + thisLTRSys.QRadSysSrcAvg.dimension(thisLTRSys.NumOfSurfaces, 0.0); + thisLTRSys.LastQRadSysSrc.dimension(thisLTRSys.NumOfSurfaces, 0.0); + thisLTRSys.LastSysTimeElapsed = 0.0; + thisLTRSys.LastTimeStepSys = 0.0; } - for (RadNum = 1; RadNum <= state.dataLowTempRadSys->NumOfCFloLowTempRadSys; ++RadNum) { - auto &thisLTR = state.dataLowTempRadSys->CFloRadSys(RadNum); - thisLTR.QRadSysSrcAvg.dimension(thisLTR.NumOfSurfaces, 0.0); - thisLTR.LastQRadSysSrc.dimension(thisLTR.NumOfSurfaces, 0.0); - thisLTR.LastSysTimeElapsed = 0.0; - thisLTR.LastTimeStepSys = 0.0; + for (auto &thisCFLTRSys : state.dataLowTempRadSys->CFloRadSys) { + thisCFLTRSys.QRadSysSrcAvg.dimension(thisCFLTRSys.NumOfSurfaces, 0.0); + thisCFLTRSys.LastQRadSysSrc.dimension(thisCFLTRSys.NumOfSurfaces, 0.0); + thisCFLTRSys.LastSysTimeElapsed = 0.0; + thisCFLTRSys.LastTimeStepSys = 0.0; } - for (RadNum = 1; RadNum <= state.dataLowTempRadSys->NumOfElecLowTempRadSys; ++RadNum) { - auto &thisLTR = state.dataLowTempRadSys->ElecRadSys(RadNum); - thisLTR.QRadSysSrcAvg.dimension(thisLTR.NumOfSurfaces, 0.0); - thisLTR.LastQRadSysSrc.dimension(thisLTR.NumOfSurfaces, 0.0); - thisLTR.LastSysTimeElapsed = 0.0; - thisLTR.LastTimeStepSys = 0.0; + for (auto &thisELTRSys : state.dataLowTempRadSys->ElecRadSys) { + thisELTRSys.QRadSysSrcAvg.dimension(thisELTRSys.NumOfSurfaces, 0.0); + thisELTRSys.LastQRadSysSrc.dimension(thisELTRSys.NumOfSurfaces, 0.0); + thisELTRSys.LastSysTimeElapsed = 0.0; + thisELTRSys.LastTimeStepSys = 0.0; } state.dataLowTempRadSys->MySizeFlagHydr.allocate(state.dataLowTempRadSys->NumOfHydrLowTempRadSys); state.dataLowTempRadSys->MySizeFlagCFlo.allocate(state.dataLowTempRadSys->NumOfCFloLowTempRadSys); @@ -2000,28 +1995,25 @@ namespace LowTempRadiantSystem { state.dataLowTempRadSys->MySizeFlagElec = true; // Initialize total areas and ZeroLTRSource for all radiant systems - for (RadNum = 1; RadNum <= state.dataLowTempRadSys->NumOfHydrLowTempRadSys; ++RadNum) { - state.dataLowTempRadSys->HydrRadSys(RadNum).ZeroLTRSourceSumHATsurf = 0.0; - state.dataLowTempRadSys->HydrRadSys(RadNum).TotalSurfaceArea = 0.0; - for (SurfNum = 1; SurfNum <= state.dataLowTempRadSys->HydrRadSys(RadNum).NumOfSurfaces; ++SurfNum) { - state.dataLowTempRadSys->HydrRadSys(RadNum).TotalSurfaceArea += - Surface(state.dataLowTempRadSys->HydrRadSys(RadNum).SurfacePtr(SurfNum)).Area; + for (auto &thisHRadSys : state.dataLowTempRadSys->HydrRadSys) { + thisHRadSys.ZeroLTRSourceSumHATsurf = 0.0; + thisHRadSys.TotalSurfaceArea = 0.0; + for (SurfNum = 1; SurfNum <= thisHRadSys.NumOfSurfaces; ++SurfNum) { + thisHRadSys.TotalSurfaceArea += Surface(thisHRadSys.SurfacePtr(SurfNum)).Area; } } - for (RadNum = 1; RadNum <= state.dataLowTempRadSys->NumOfCFloLowTempRadSys; ++RadNum) { - state.dataLowTempRadSys->CFloRadSys(RadNum).ZeroLTRSourceSumHATsurf = 0.0; - state.dataLowTempRadSys->CFloRadSys(RadNum).TotalSurfaceArea = 0.0; - for (SurfNum = 1; SurfNum <= state.dataLowTempRadSys->CFloRadSys(RadNum).NumOfSurfaces; ++SurfNum) { - state.dataLowTempRadSys->CFloRadSys(RadNum).TotalSurfaceArea += - Surface(state.dataLowTempRadSys->CFloRadSys(RadNum).SurfacePtr(SurfNum)).Area; + for (auto &thisCFLRadSys : state.dataLowTempRadSys->CFloRadSys) { + thisCFLRadSys.ZeroLTRSourceSumHATsurf = 0.0; + thisCFLRadSys.TotalSurfaceArea = 0.0; + for (SurfNum = 1; SurfNum <= thisCFLRadSys.NumOfSurfaces; ++SurfNum) { + thisCFLRadSys.TotalSurfaceArea += Surface(thisCFLRadSys.SurfacePtr(SurfNum)).Area; } } - for (RadNum = 1; RadNum <= state.dataLowTempRadSys->NumOfElecLowTempRadSys; ++RadNum) { - state.dataLowTempRadSys->ElecRadSys(RadNum).ZeroLTRSourceSumHATsurf = 0.0; - state.dataLowTempRadSys->ElecRadSys(RadNum).TotalSurfaceArea = 0.0; - for (SurfNum = 1; SurfNum <= state.dataLowTempRadSys->ElecRadSys(RadNum).NumOfSurfaces; ++SurfNum) { - state.dataLowTempRadSys->ElecRadSys(RadNum).TotalSurfaceArea += - Surface(state.dataLowTempRadSys->ElecRadSys(RadNum).SurfacePtr(SurfNum)).Area; + for (auto &thisERadSys : state.dataLowTempRadSys->ElecRadSys) { + thisERadSys.ZeroLTRSourceSumHATsurf = 0.0; + thisERadSys.TotalSurfaceArea = 0.0; + for (SurfNum = 1; SurfNum <= thisERadSys.NumOfSurfaces; ++SurfNum) { + thisERadSys.TotalSurfaceArea += Surface(thisERadSys.SurfacePtr(SurfNum)).Area; } } @@ -2033,36 +2025,27 @@ namespace LowTempRadiantSystem { } // Check pump parameters for constant flow hydronic radiant systems - for (RadNum = 1; RadNum <= state.dataLowTempRadSys->NumOfCFloLowTempRadSys; ++RadNum) { + for (auto &thisCFLRadSys : state.dataLowTempRadSys->CFloRadSys) { // Calculate the efficiency for each pump: The calculation // is based on the PMPSIM code in the ASHRAE Secondary Toolkit - Real64 PEC = state.dataLowTempRadSys->CFloRadSys(RadNum).PumpEffic; - if ((state.dataLowTempRadSys->CFloRadSys(RadNum).NomPowerUse > ZeroTol) && (MotorEffic > ZeroTol) && - (state.dataLowTempRadSys->CFloRadSys(RadNum).WaterVolFlowMax != AutoSize)) { - TotalEffic = state.dataLowTempRadSys->CFloRadSys(RadNum).WaterVolFlowMax * - state.dataLowTempRadSys->CFloRadSys(RadNum).NomPumpHead / state.dataLowTempRadSys->CFloRadSys(RadNum).NomPowerUse; - state.dataLowTempRadSys->CFloRadSys(RadNum).PumpEffic = TotalEffic / MotorEffic; - PEC = state.dataLowTempRadSys->CFloRadSys(RadNum).PumpEffic; + if ((thisCFLRadSys.NomPowerUse > ZeroTol) && (MotorEffic > ZeroTol) && (thisCFLRadSys.WaterVolFlowMax != AutoSize)) { + TotalEffic = thisCFLRadSys.WaterVolFlowMax * thisCFLRadSys.NomPumpHead / thisCFLRadSys.NomPowerUse; + thisCFLRadSys.PumpEffic = TotalEffic / MotorEffic; constexpr std::string_view fmt = "Check input. Calc Pump Efficiency={:.5R}% {}, for pump in radiant system {}"; - Real64 pumpEfficiency = state.dataLowTempRadSys->CFloRadSys(RadNum).PumpEffic * 100.0; - PEC = state.dataLowTempRadSys->CFloRadSys(RadNum).PumpEffic; - if (state.dataLowTempRadSys->CFloRadSys(RadNum).PumpEffic < 0.50) { - ShowWarningError(state, - format(fmt, pumpEfficiency, "which is less than 50%", state.dataLowTempRadSys->CFloRadSys(RadNum).Name)); - } else if ((state.dataLowTempRadSys->CFloRadSys(RadNum).PumpEffic > 0.95) && - (state.dataLowTempRadSys->CFloRadSys(RadNum).PumpEffic <= 1.0)) { - ShowWarningError(state, format(fmt, pumpEfficiency, "is approaching 100%", state.dataLowTempRadSys->CFloRadSys(RadNum).Name)); - } else if (state.dataLowTempRadSys->CFloRadSys(RadNum).PumpEffic > 1.0) { - ShowSevereError(state, - format(fmt, pumpEfficiency, "which is bigger than 100%", state.dataLowTempRadSys->CFloRadSys(RadNum).Name)); + Real64 pumpEfficiency = thisCFLRadSys.PumpEffic * 100.0; + if (thisCFLRadSys.PumpEffic < 0.50) { + ShowWarningError(state, format(fmt, pumpEfficiency, "which is less than 50%", thisCFLRadSys.Name)); + } else if ((thisCFLRadSys.PumpEffic > 0.95) && (thisCFLRadSys.PumpEffic <= 1.0)) { + ShowWarningError(state, format(fmt, pumpEfficiency, "is approaching 100%", thisCFLRadSys.Name)); + } else if (thisCFLRadSys.PumpEffic > 1.0) { + ShowSevereError(state, format(fmt, pumpEfficiency, "which is bigger than 100%", thisCFLRadSys.Name)); InitErrorsFound = true; } } else { - if (state.dataLowTempRadSys->CFloRadSys(RadNum).WaterVolFlowMax != - AutoSize) { // Autosize is not an error but it does not need to check pump efficiency here + // Autosize is not an error but it does not need to check pump efficiency here + if (thisCFLRadSys.WaterVolFlowMax != AutoSize) { ShowSevereError(state, - format("Check input. Pump nominal power and motor efficiency cannot be 0, for pump={}", - state.dataLowTempRadSys->CFloRadSys(RadNum).Name)); + format("Check input. Pump nominal power and motor efficiency cannot be 0, for pump={}", thisCFLRadSys.Name)); InitErrorsFound = true; } } @@ -2152,31 +2135,28 @@ namespace LowTempRadiantSystem { // need to check all units to see if they are on Zone Equipment List or issue warning if (!state.dataLowTempRadSys->ZoneEquipmentListChecked && state.dataZoneEquip->ZoneEquipInputsFilled) { state.dataLowTempRadSys->ZoneEquipmentListChecked = true; - for (Loop = 1; Loop <= state.dataLowTempRadSys->TotalNumOfRadSystems; ++Loop) { - switch (state.dataLowTempRadSys->RadSysTypes(Loop).SystemType) { + for (auto &thisRadSys : state.dataLowTempRadSys->RadSysTypes) { + switch (thisRadSys.SystemType) { case LowTempRadiantSystem::SystemType::HydronicSystem: { - if (CheckZoneEquipmentList(state, "ZoneHVAC:LowTemperatureRadiant:VariableFlow", state.dataLowTempRadSys->RadSysTypes(Loop).Name)) - continue; + if (CheckZoneEquipmentList(state, "ZoneHVAC:LowTemperatureRadiant:VariableFlow", thisRadSys.Name)) continue; ShowSevereError(state, format("InitLowTempRadiantSystem: Unit=[ZoneHVAC:LowTemperatureRadiant:VariableFlow,{}] is not on any " "ZoneHVAC:EquipmentList. It will not be simulated.", - state.dataLowTempRadSys->RadSysTypes(Loop).Name)); + thisRadSys.Name)); } break; case LowTempRadiantSystem::SystemType::ConstantFlowSystem: { - if (CheckZoneEquipmentList(state, "ZoneHVAC:LowTemperatureRadiant:ConstantFlow", state.dataLowTempRadSys->RadSysTypes(Loop).Name)) - continue; + if (CheckZoneEquipmentList(state, "ZoneHVAC:LowTemperatureRadiant:ConstantFlow", thisRadSys.Name)) continue; ShowSevereError(state, format("InitLowTempRadiantSystem: Unit=[ZoneHVAC:LowTemperatureRadiant:ConstantFlow,{}] is not on any " "ZoneHVAC:EquipmentList. It will not be simulated.", - state.dataLowTempRadSys->RadSysTypes(Loop).Name)); + thisRadSys.Name)); } break; case LowTempRadiantSystem::SystemType::ElectricSystem: { - if (CheckZoneEquipmentList(state, "ZoneHVAC:LowTemperatureRadiant:Electric", state.dataLowTempRadSys->RadSysTypes(Loop).Name)) - continue; + if (CheckZoneEquipmentList(state, "ZoneHVAC:LowTemperatureRadiant:Electric", thisRadSys.Name)) continue; ShowSevereError(state, format("InitLowTempRadiantSystem: Unit=[ZoneHVAC:LowTemperatureRadiant:Electric,{}] is not on any " "ZoneHVAC:EquipmentList. It will not be simulated.", - state.dataLowTempRadSys->RadSysTypes(Loop).Name)); + thisRadSys.Name)); } break; default: { // Illegal system, but checked earlier } break; @@ -2736,7 +2716,7 @@ namespace LowTempRadiantSystem { state.dataSize->DataScalableCapSizingON = false; state.dataSize->DataFracOfAutosizedHeatingCapacity = 1.0; - auto &Zone = state.dataHeatBal->Zone; + auto const &Zone = state.dataHeatBal->Zone; if (SystemType == LowTempRadiantSystem::SystemType::ElectricSystem) { @@ -3533,7 +3513,7 @@ namespace LowTempRadiantSystem { for (int surfNum = 1; surfNum <= this->NumOfSurfaces; ++surfNum) { auto &thisHydrSysSurf = state.dataSurface->Surface(this->SurfacePtr(surfNum)); - auto &thisHydrSpacing = state.dataConstruction->Construct(thisHydrSysSurf.Construction).ThicknessPerpend; + auto const &thisHydrSpacing = state.dataConstruction->Construct(thisHydrSysSurf.Construction).ThicknessPerpend; if ((thisHydrSpacing > 0.005) && (thisHydrSpacing < 0.5)) { // limit allowable spacing to between 1cm and 1m tubeLength += thisHydrSysSurf.Area / (2.0 * thisHydrSpacing); } else { // if not in allowable limit, default back to 0.15m (15cm or 6 inches) @@ -4135,7 +4115,6 @@ namespace LowTempRadiantSystem { this->CondCausedShutDown = true; WaterMassFlow = 0.0; this->OperatingMode = NotOperating; - RadSurfNum = RadSurfNum2; SetComponentFlowRate(state, WaterMassFlow, this->ColdWaterInNode, this->ColdWaterOutNode, this->CWPlantLoc); this->WaterMassFlowRate = WaterMassFlow; for (RadSurfNum3 = 1; RadSurfNum3 <= this->NumOfSurfaces; ++RadSurfNum3) { @@ -4256,7 +4235,6 @@ namespace LowTempRadiantSystem { Real64 SysWaterInTemp; // Fluid temperature supplied from the loop Real64 WaterTempHi; // Current high point in water temperature range Real64 WaterTempLo; // Current low point in water temperature range - int ZoneNum; // number of zone being served Real64 mdot; // local temporary for water mass flow rate kg/s ConstantFlowRadDesignData ConstantFlowDesignDataObject = // Once again, is this supposed to be a deep copy? @@ -4265,7 +4243,6 @@ namespace LowTempRadiantSystem { auto &Node = state.dataLoopNodes->Node; // initialize local variables - ZoneNum = this->ZonePtr; SysRunning = true; // default to running and turn off only if not running state.dataLowTempRadSys->VarOffCond = false; @@ -4765,7 +4742,6 @@ namespace LowTempRadiantSystem { Real64 TotalRadSysPower; // Total heat source/sink to radiant system Real64 TwiCoeff; // Intermeidate calculation variable for determining the water inlet temperature Real64 WaterMassFlow; // Water mass flow rate in the radiant system, kg/s - int WaterNodeIn; // Node number of the water entering the radiant system Real64 WaterOutletTempCheck; // Radiant system water outlet temperature (calculated from mixing all outlet streams together) Real64 WaterTempIn; // Temperature of the water entering the radiant system, in C int ZoneNum; // number of zone being served @@ -4803,20 +4779,6 @@ namespace LowTempRadiantSystem { state.dataLowTempRadSys->Cmj = 0.0; state.dataLowTempRadSys->WaterTempOut = this->WaterInletTemp; - // Set the conditions on the water side inlet - switch (this->OperatingMode) { - case HeatingMode: { - WaterNodeIn = this->HotWaterInNode; - } break; - case CoolingMode: { - WaterNodeIn = this->ColdWaterInNode; - } break; - default: { - ShowSevereError(state, "Illegal low temperature radiant system operating mode"); - ShowContinueError(state, format("Occurs in Radiant System={}", this->Name)); - ShowFatalError(state, "Preceding condition causes termination."); - } break; - } ZoneNum = this->ZonePtr; ZoneMult = double(Zone(ZoneNum).Multiplier * Zone(ZoneNum).ListMultiplier); WaterMassFlow = this->WaterMassFlowRate / ZoneMult; @@ -5971,7 +5933,7 @@ namespace LowTempRadiantSystem { } } - auto &Surface = state.dataSurface->Surface; + auto const &Surface = state.dataSurface->Surface; // For interzone surfaces, QRadSysSource was only updated for the "active" side. The // active side would have a non-zero value at this point. If the numbers differ, then we have to manually update. diff --git a/src/EnergyPlus/VentilatedSlab.cc b/src/EnergyPlus/VentilatedSlab.cc index 99d492b7212..29b0888f0ed 100644 --- a/src/EnergyPlus/VentilatedSlab.cc +++ b/src/EnergyPlus/VentilatedSlab.cc @@ -1540,10 +1540,9 @@ namespace VentilatedSlab { state.dataVentilatedSlab->MyZoneEqFlag.allocate(state.dataVentilatedSlab->NumOfVentSlabs); // Initialize total areas for all radiant systems and dimension record keeping arrays - for (RadNum = 1; RadNum <= state.dataVentilatedSlab->NumOfVentSlabs; ++RadNum) { - state.dataVentilatedSlab->VentSlab(RadNum).TotalSurfaceArea = 0.0; - auto &numRadSurfs = state.dataVentilatedSlab->VentSlab(RadNum).NumOfSurfaces; - auto &thisVentSlab = state.dataVentilatedSlab->VentSlab(RadNum); + for (auto &thisVentSlab : state.dataVentilatedSlab->VentSlab) { + thisVentSlab.TotalSurfaceArea = 0.0; + int numRadSurfs = thisVentSlab.NumOfSurfaces; for (SurfNum = 1; SurfNum <= numRadSurfs; ++SurfNum) { thisVentSlab.TotalSurfaceArea += state.dataSurface->Surface(thisVentSlab.SurfacePtr(SurfNum)).Area; } From 70f3f00222ca30d021d2dc686bbd54d2cef0357c Mon Sep 17 00:00:00 2001 From: jcyuan Date: Mon, 28 Aug 2023 12:35:20 -0500 Subject: [PATCH 42/80] Change default FlowRatio values from zero to 1 for exhaust elements flow request. --- src/EnergyPlus/ExhaustAirSystemManager.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EnergyPlus/ExhaustAirSystemManager.hh b/src/EnergyPlus/ExhaustAirSystemManager.hh index 2117972ac6c..0d2ef96c4c0 100644 --- a/src/EnergyPlus/ExhaustAirSystemManager.hh +++ b/src/EnergyPlus/ExhaustAirSystemManager.hh @@ -133,7 +133,7 @@ namespace ExhaustAirSystemManager { void SimZoneHVACExhaustControls(EnergyPlusData &state); - void CalcZoneHVACExhaustControl(EnergyPlusData &state, int const ZoneHVACExhaustControlNum, Real64 const FlowRatio = 0.0); + void CalcZoneHVACExhaustControl(EnergyPlusData &state, int const ZoneHVACExhaustControlNum, Real64 const FlowRatio = 1.0); void SizeExhaustSystem(EnergyPlusData &state, int const exhSysNum); From 6037259fd5c49ee801f60d9502c953eacd34a13c Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Mon, 28 Aug 2023 15:07:50 -0500 Subject: [PATCH 43/80] Rename heat balance vars with redundant Zone in name --- src/EnergyPlus/AirflowNetwork/src/Solver.cpp | 146 ++++---- src/EnergyPlus/ChilledCeilingPanelSimple.cc | 4 +- src/EnergyPlus/ConvectionCoefficients.cc | 10 +- src/EnergyPlus/CoolTower.cc | 2 +- src/EnergyPlus/DXCoils.cc | 26 +- src/EnergyPlus/DataSurfaces.cc | 2 +- src/EnergyPlus/DisplacementVentMgr.cc | 16 +- src/EnergyPlus/HVACManager.cc | 107 +++--- src/EnergyPlus/HeatBalanceAirManager.cc | 2 +- src/EnergyPlus/HeatBalanceSurfaceManager.cc | 14 +- src/EnergyPlus/InternalHeatGains.cc | 18 +- src/EnergyPlus/LowTempRadiantSystem.cc | 4 +- src/EnergyPlus/MoistureBalanceEMPDManager.cc | 6 +- src/EnergyPlus/MundtSimMgr.cc | 4 +- src/EnergyPlus/PurchasedAirManager.cc | 14 +- src/EnergyPlus/RoomAirModelAirflowNetwork.cc | 10 +- src/EnergyPlus/RoomAirModelManager.cc | 8 +- src/EnergyPlus/RoomAirModelUserTempPattern.cc | 4 +- src/EnergyPlus/SwimmingPool.cc | 6 +- src/EnergyPlus/SystemAvailabilityManager.cc | 6 +- src/EnergyPlus/SystemReports.cc | 2 +- src/EnergyPlus/ThermalChimney.cc | 16 +- src/EnergyPlus/ThermalComfort.cc | 12 +- src/EnergyPlus/UFADManager.cc | 28 +- src/EnergyPlus/UnitarySystem.cc | 2 +- src/EnergyPlus/VentilatedSlab.cc | 8 +- src/EnergyPlus/WaterUse.cc | 2 +- src/EnergyPlus/WindowComplexManager.cc | 4 +- src/EnergyPlus/WindowManager.cc | 6 +- .../ZoneContaminantPredictorCorrector.cc | 6 +- src/EnergyPlus/ZoneEquipmentManager.cc | 16 +- src/EnergyPlus/ZoneTempPredictorCorrector.cc | 321 +++++++++--------- src/EnergyPlus/ZoneTempPredictorCorrector.hh | 83 +++-- .../unit/AirflowNetworkConditions.unit.cc | 2 +- .../unit/AirflowNetworkHVAC.unit.cc | 38 +-- .../unit/ConvectionCoefficients.unit.cc | 2 +- tst/EnergyPlus/unit/CoolTower.unit.cc | 2 +- tst/EnergyPlus/unit/HVACManager.unit.cc | 36 +- .../unit/HeatBalanceSurfaceManager.unit.cc | 38 +-- tst/EnergyPlus/unit/HybridModel.unit.cc | 30 +- tst/EnergyPlus/unit/InternalHeatGains.unit.cc | 24 +- .../unit/MoistureBalanceEMPD.unit.cc | 6 +- .../unit/PackagedTerminalHeatPump.unit.cc | 6 +- .../unit/PurchasedAirManager.unit.cc | 2 +- .../unit/RoomAirflowNetwork.unit.cc | 14 +- tst/EnergyPlus/unit/SecondaryDXCoils.unit.cc | 4 +- tst/EnergyPlus/unit/ThermalChimney.unit.cc | 2 +- tst/EnergyPlus/unit/ThermalComfort.unit.cc | 12 +- tst/EnergyPlus/unit/UnitarySystem.unit.cc | 6 +- tst/EnergyPlus/unit/WindowManager.unit.cc | 20 +- .../ZoneContaminantPredictorCorrector.unit.cc | 16 +- .../unit/ZoneEquipmentManager.unit.cc | 16 +- .../unit/ZoneTempPredictorCorrector.unit.cc | 70 ++-- 53 files changed, 625 insertions(+), 636 deletions(-) diff --git a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp index c383d81e934..c9a335885eb 100644 --- a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp +++ b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp @@ -5398,7 +5398,7 @@ namespace AirflowNetwork { for (i = 1; i <= m_state.dataGlobal->NumOfZones; ++i) { ANZT(i) = m_state.dataZoneTempPredictorCorrector->zoneHeatBalance(i).MAT; - ANZW(i) = m_state.dataZoneTempPredictorCorrector->zoneHeatBalance(i).ZoneAirHumRat; + ANZW(i) = m_state.dataZoneTempPredictorCorrector->zoneHeatBalance(i).airHumRat; if (m_state.dataContaminantBalance->Contaminant.CO2Simulation) { ANCO(i) = m_state.dataContaminantBalance->ZoneAirCO2(i); } @@ -5435,7 +5435,7 @@ namespace AirflowNetwork { } else { for (i = 1; i <= m_state.dataGlobal->NumOfZones; ++i) { ANZT(i) = m_state.dataZoneTempPredictorCorrector->zoneHeatBalance(i).MAT; - ANZW(i) = m_state.dataZoneTempPredictorCorrector->zoneHeatBalance(i).ZoneAirHumRat; + ANZW(i) = m_state.dataZoneTempPredictorCorrector->zoneHeatBalance(i).airHumRat; if (m_state.dataContaminantBalance->Contaminant.CO2Simulation) ANCO(i) = m_state.dataContaminantBalance->ZoneAirCO2(i); if (m_state.dataContaminantBalance->Contaminant.GenericContamSimulation) ANGC(i) = m_state.dataContaminantBalance->ZoneAirGC(i); @@ -8682,7 +8682,7 @@ namespace AirflowNetwork { Tamb = Zone(ZN1).OutDryBulbTemp; CpAir = PsyCpAirFnW(m_state.dataEnvrn->OutHumRat); } - hg = Psychrometrics::PsyHgAirFnWTdb(zn1HB.ZoneAirHumRat, zn1HB.MAT); + hg = Psychrometrics::PsyHgAirFnWTdb(zn1HB.airHumRat, zn1HB.MAT); if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::SCR || AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::SEL) { @@ -8695,16 +8695,16 @@ namespace AirflowNetwork { AirflowNetworkReportData(ZN1).MultiZoneInfiSenLossJ += (AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (zn1HB.MAT - Tamb)) * ReportingConstant; } - if (m_state.dataEnvrn->OutHumRat > zn1HB.ZoneAirHumRat) { + if (m_state.dataEnvrn->OutHumRat > zn1HB.airHumRat) { AirflowNetworkReportData(ZN1).MultiZoneInfiLatGainW += - (AirflowNetworkLinkSimu(i).FLOW2 * (m_state.dataEnvrn->OutHumRat - zn1HB.ZoneAirHumRat)) * hg; + (AirflowNetworkLinkSimu(i).FLOW2 * (m_state.dataEnvrn->OutHumRat - zn1HB.airHumRat)) * hg; AirflowNetworkReportData(ZN1).MultiZoneInfiLatGainJ += - (AirflowNetworkLinkSimu(i).FLOW2 * (m_state.dataEnvrn->OutHumRat - zn1HB.ZoneAirHumRat)) * hg * ReportingConstant; + (AirflowNetworkLinkSimu(i).FLOW2 * (m_state.dataEnvrn->OutHumRat - zn1HB.airHumRat)) * hg * ReportingConstant; } else { AirflowNetworkReportData(ZN1).MultiZoneInfiLatLossW += - (AirflowNetworkLinkSimu(i).FLOW2 * (zn1HB.ZoneAirHumRat - m_state.dataEnvrn->OutHumRat)) * hg; + (AirflowNetworkLinkSimu(i).FLOW2 * (zn1HB.airHumRat - m_state.dataEnvrn->OutHumRat)) * hg; AirflowNetworkReportData(ZN1).MultiZoneInfiLatLossJ += - (AirflowNetworkLinkSimu(i).FLOW2 * (zn1HB.ZoneAirHumRat - m_state.dataEnvrn->OutHumRat)) * hg * ReportingConstant; + (AirflowNetworkLinkSimu(i).FLOW2 * (zn1HB.airHumRat - m_state.dataEnvrn->OutHumRat)) * hg * ReportingConstant; } } else { if (Tamb > zn1HB.MAT) { @@ -8716,16 +8716,16 @@ namespace AirflowNetwork { AirflowNetworkReportData(ZN1).MultiZoneVentSenLossJ += (AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (zn1HB.MAT - Tamb)) * ReportingConstant; } - if (m_state.dataEnvrn->OutHumRat > zn1HB.ZoneAirHumRat) { + if (m_state.dataEnvrn->OutHumRat > zn1HB.airHumRat) { AirflowNetworkReportData(ZN1).MultiZoneVentLatGainW += - (AirflowNetworkLinkSimu(i).FLOW2 * (m_state.dataEnvrn->OutHumRat - zn1HB.ZoneAirHumRat)) * hg; + (AirflowNetworkLinkSimu(i).FLOW2 * (m_state.dataEnvrn->OutHumRat - zn1HB.airHumRat)) * hg; AirflowNetworkReportData(ZN1).MultiZoneVentLatGainJ += - (AirflowNetworkLinkSimu(i).FLOW2 * (m_state.dataEnvrn->OutHumRat - zn1HB.ZoneAirHumRat)) * hg * ReportingConstant; + (AirflowNetworkLinkSimu(i).FLOW2 * (m_state.dataEnvrn->OutHumRat - zn1HB.airHumRat)) * hg * ReportingConstant; } else { AirflowNetworkReportData(ZN1).MultiZoneVentLatLossW += - (AirflowNetworkLinkSimu(i).FLOW2 * (zn1HB.ZoneAirHumRat - m_state.dataEnvrn->OutHumRat)) * hg; + (AirflowNetworkLinkSimu(i).FLOW2 * (zn1HB.airHumRat - m_state.dataEnvrn->OutHumRat)) * hg; AirflowNetworkReportData(ZN1).MultiZoneVentLatLossJ += - (AirflowNetworkLinkSimu(i).FLOW2 * (zn1HB.ZoneAirHumRat - m_state.dataEnvrn->OutHumRat)) * hg * ReportingConstant; + (AirflowNetworkLinkSimu(i).FLOW2 * (zn1HB.airHumRat - m_state.dataEnvrn->OutHumRat)) * hg * ReportingConstant; } } } @@ -8741,7 +8741,7 @@ namespace AirflowNetwork { Tamb = Zone(ZN2).OutDryBulbTemp; CpAir = PsyCpAirFnW(m_state.dataEnvrn->OutHumRat); } - hg = Psychrometrics::PsyHgAirFnWTdb(zn2HB.ZoneAirHumRat, zn2HB.MAT); + hg = Psychrometrics::PsyHgAirFnWTdb(zn2HB.airHumRat, zn2HB.MAT); if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::SCR || AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::SEL) { @@ -8754,16 +8754,16 @@ namespace AirflowNetwork { AirflowNetworkReportData(ZN2).MultiZoneInfiSenLossJ += (AirflowNetworkLinkSimu(i).FLOW * CpAir * (zn2HB.MAT - Tamb)) * ReportingConstant; } - if (m_state.dataEnvrn->OutHumRat > zn2HB.ZoneAirHumRat) { + if (m_state.dataEnvrn->OutHumRat > zn2HB.airHumRat) { AirflowNetworkReportData(ZN2).MultiZoneInfiLatGainW += - (AirflowNetworkLinkSimu(i).FLOW * (m_state.dataEnvrn->OutHumRat - zn2HB.ZoneAirHumRat)) * hg; + (AirflowNetworkLinkSimu(i).FLOW * (m_state.dataEnvrn->OutHumRat - zn2HB.airHumRat)) * hg; AirflowNetworkReportData(ZN2).MultiZoneInfiLatGainJ += - (AirflowNetworkLinkSimu(i).FLOW * (m_state.dataEnvrn->OutHumRat - zn2HB.ZoneAirHumRat)) * hg * ReportingConstant; + (AirflowNetworkLinkSimu(i).FLOW * (m_state.dataEnvrn->OutHumRat - zn2HB.airHumRat)) * hg * ReportingConstant; } else { AirflowNetworkReportData(ZN2).MultiZoneInfiLatLossW += - (AirflowNetworkLinkSimu(i).FLOW * (zn2HB.ZoneAirHumRat - m_state.dataEnvrn->OutHumRat)) * hg; + (AirflowNetworkLinkSimu(i).FLOW * (zn2HB.airHumRat - m_state.dataEnvrn->OutHumRat)) * hg; AirflowNetworkReportData(ZN2).MultiZoneInfiLatLossJ += - (AirflowNetworkLinkSimu(i).FLOW * (zn2HB.ZoneAirHumRat - m_state.dataEnvrn->OutHumRat)) * hg * ReportingConstant; + (AirflowNetworkLinkSimu(i).FLOW * (zn2HB.airHumRat - m_state.dataEnvrn->OutHumRat)) * hg * ReportingConstant; } } else { if (Tamb > zn2HB.MAT) { @@ -8775,16 +8775,16 @@ namespace AirflowNetwork { AirflowNetworkReportData(ZN2).MultiZoneVentSenLossJ += (AirflowNetworkLinkSimu(i).FLOW * CpAir * (zn2HB.MAT - Tamb)) * ReportingConstant; } - if (m_state.dataEnvrn->OutHumRat > zn2HB.ZoneAirHumRat) { + if (m_state.dataEnvrn->OutHumRat > zn2HB.airHumRat) { AirflowNetworkReportData(ZN2).MultiZoneVentLatGainW += - (AirflowNetworkLinkSimu(i).FLOW * (m_state.dataEnvrn->OutHumRat - zn2HB.ZoneAirHumRat)) * hg; + (AirflowNetworkLinkSimu(i).FLOW * (m_state.dataEnvrn->OutHumRat - zn2HB.airHumRat)) * hg; AirflowNetworkReportData(ZN2).MultiZoneVentLatGainJ += - (AirflowNetworkLinkSimu(i).FLOW * (m_state.dataEnvrn->OutHumRat - zn2HB.ZoneAirHumRat)) * hg * ReportingConstant; + (AirflowNetworkLinkSimu(i).FLOW * (m_state.dataEnvrn->OutHumRat - zn2HB.airHumRat)) * hg * ReportingConstant; } else { AirflowNetworkReportData(ZN2).MultiZoneVentLatLossW += - (AirflowNetworkLinkSimu(i).FLOW * (zn2HB.ZoneAirHumRat - m_state.dataEnvrn->OutHumRat)) * hg; + (AirflowNetworkLinkSimu(i).FLOW * (zn2HB.airHumRat - m_state.dataEnvrn->OutHumRat)) * hg; AirflowNetworkReportData(ZN2).MultiZoneVentLatLossJ += - (AirflowNetworkLinkSimu(i).FLOW * (zn2HB.ZoneAirHumRat - m_state.dataEnvrn->OutHumRat)) * hg * ReportingConstant; + (AirflowNetworkLinkSimu(i).FLOW * (zn2HB.airHumRat - m_state.dataEnvrn->OutHumRat)) * hg * ReportingConstant; } } } @@ -8792,8 +8792,8 @@ namespace AirflowNetwork { if (ZN1 > 0 && ZN2 > 0) { auto const &zn1HB = m_state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZN1); auto const &zn2HB = m_state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZN2); - CpAir = PsyCpAirFnW((zn1HB.ZoneAirHumRat + zn2HB.ZoneAirHumRat) / 2.0); - hg = Psychrometrics::PsyHgAirFnWTdb((zn1HB.ZoneAirHumRat + zn2HB.ZoneAirHumRat) / 2.0, (zn1HB.MAT + zn2HB.MAT) / 2.0); + CpAir = PsyCpAirFnW((zn1HB.airHumRat + zn2HB.airHumRat) / 2.0); + hg = Psychrometrics::PsyHgAirFnWTdb((zn1HB.airHumRat + zn2HB.airHumRat) / 2.0, (zn1HB.MAT + zn2HB.MAT) / 2.0); if (zn1HB.MAT > zn2HB.MAT) { AirflowNetworkReportData(ZN2).MultiZoneMixSenGainW += (AirflowNetworkLinkSimu(i).FLOW * CpAir * (zn1HB.MAT - zn2HB.MAT)); AirflowNetworkReportData(ZN2).MultiZoneMixSenGainJ += @@ -8803,16 +8803,16 @@ namespace AirflowNetwork { AirflowNetworkReportData(ZN2).MultiZoneMixSenLossJ += (AirflowNetworkLinkSimu(i).FLOW * CpAir * (zn2HB.MAT - zn1HB.MAT)) * ReportingConstant; } - if (zn1HB.ZoneAirHumRat > zn2HB.ZoneAirHumRat) { + if (zn1HB.airHumRat > zn2HB.airHumRat) { AirflowNetworkReportData(ZN2).MultiZoneMixLatGainW += - (AirflowNetworkLinkSimu(i).FLOW * (zn1HB.ZoneAirHumRat - zn2HB.ZoneAirHumRat)) * hg; + (AirflowNetworkLinkSimu(i).FLOW * (zn1HB.airHumRat - zn2HB.airHumRat)) * hg; AirflowNetworkReportData(ZN2).MultiZoneMixLatGainJ += - (AirflowNetworkLinkSimu(i).FLOW * (zn1HB.ZoneAirHumRat - zn2HB.ZoneAirHumRat)) * hg * ReportingConstant; + (AirflowNetworkLinkSimu(i).FLOW * (zn1HB.airHumRat - zn2HB.airHumRat)) * hg * ReportingConstant; } else { AirflowNetworkReportData(ZN2).MultiZoneMixLatLossW += - (AirflowNetworkLinkSimu(i).FLOW * (zn2HB.ZoneAirHumRat - zn1HB.ZoneAirHumRat)) * hg; + (AirflowNetworkLinkSimu(i).FLOW * (zn2HB.airHumRat - zn1HB.airHumRat)) * hg; AirflowNetworkReportData(ZN2).MultiZoneMixLatLossJ += - (AirflowNetworkLinkSimu(i).FLOW * (zn2HB.ZoneAirHumRat - zn1HB.ZoneAirHumRat)) * hg * ReportingConstant; + (AirflowNetworkLinkSimu(i).FLOW * (zn2HB.airHumRat - zn1HB.airHumRat)) * hg * ReportingConstant; } if (zn2HB.MAT > zn1HB.MAT) { AirflowNetworkReportData(ZN1).MultiZoneMixSenGainW += (AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (zn2HB.MAT - zn1HB.MAT)); @@ -8823,16 +8823,16 @@ namespace AirflowNetwork { AirflowNetworkReportData(ZN1).MultiZoneMixSenLossJ += (AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (zn1HB.MAT - zn2HB.MAT)) * ReportingConstant; } - if (zn2HB.ZoneAirHumRat > zn1HB.ZoneAirHumRat) { + if (zn2HB.airHumRat > zn1HB.airHumRat) { AirflowNetworkReportData(ZN1).MultiZoneMixLatGainW += - (AirflowNetworkLinkSimu(i).FLOW2 * (zn2HB.ZoneAirHumRat - zn1HB.ZoneAirHumRat)) * hg; + (AirflowNetworkLinkSimu(i).FLOW2 * (zn2HB.airHumRat - zn1HB.airHumRat)) * hg; AirflowNetworkReportData(ZN1).MultiZoneMixLatGainJ += - (AirflowNetworkLinkSimu(i).FLOW2 * (zn2HB.ZoneAirHumRat - zn1HB.ZoneAirHumRat)) * hg * ReportingConstant; + (AirflowNetworkLinkSimu(i).FLOW2 * (zn2HB.airHumRat - zn1HB.airHumRat)) * hg * ReportingConstant; } else { AirflowNetworkReportData(ZN1).MultiZoneMixLatLossW += - std::abs(AirflowNetworkLinkSimu(i).FLOW2 * (zn1HB.ZoneAirHumRat - zn2HB.ZoneAirHumRat)) * hg; + std::abs(AirflowNetworkLinkSimu(i).FLOW2 * (zn1HB.airHumRat - zn2HB.airHumRat)) * hg; AirflowNetworkReportData(ZN1).MultiZoneMixLatLossJ += - (AirflowNetworkLinkSimu(i).FLOW2 * (zn1HB.ZoneAirHumRat - zn2HB.ZoneAirHumRat)) * hg * ReportingConstant; + (AirflowNetworkLinkSimu(i).FLOW2 * (zn1HB.airHumRat - zn2HB.airHumRat)) * hg * ReportingConstant; } } } @@ -8986,17 +8986,17 @@ namespace AirflowNetwork { AirflowNetworkReportData(ZN1).MultiZoneInfiSenLossJ += (linkReport1(i).FLOW2OFF * CpAir * (zn1HB.MAT - Tamb)) * ReportingConstant * ReportingFraction; } - if (m_state.dataEnvrn->OutHumRat > zn1HB.ZoneAirHumRat) { + if (m_state.dataEnvrn->OutHumRat > zn1HB.airHumRat) { AirflowNetworkReportData(ZN1).MultiZoneInfiLatGainW += - (linkReport1(i).FLOW2OFF * (m_state.dataEnvrn->OutHumRat - zn1HB.ZoneAirHumRat)) * ReportingFraction; + (linkReport1(i).FLOW2OFF * (m_state.dataEnvrn->OutHumRat - zn1HB.airHumRat)) * ReportingFraction; AirflowNetworkReportData(ZN1).MultiZoneInfiLatGainJ += - (linkReport1(i).FLOW2OFF * (m_state.dataEnvrn->OutHumRat - zn1HB.ZoneAirHumRat)) * ReportingConstant * + (linkReport1(i).FLOW2OFF * (m_state.dataEnvrn->OutHumRat - zn1HB.airHumRat)) * ReportingConstant * ReportingFraction; } else { AirflowNetworkReportData(ZN1).MultiZoneInfiLatLossW += - (linkReport1(i).FLOW2OFF * (zn1HB.ZoneAirHumRat - m_state.dataEnvrn->OutHumRat)) * ReportingFraction; + (linkReport1(i).FLOW2OFF * (zn1HB.airHumRat - m_state.dataEnvrn->OutHumRat)) * ReportingFraction; AirflowNetworkReportData(ZN1).MultiZoneInfiLatLossJ += - (linkReport1(i).FLOW2OFF * (zn1HB.ZoneAirHumRat - m_state.dataEnvrn->OutHumRat)) * ReportingConstant * + (linkReport1(i).FLOW2OFF * (zn1HB.airHumRat - m_state.dataEnvrn->OutHumRat)) * ReportingConstant * ReportingFraction; } } else { @@ -9011,17 +9011,17 @@ namespace AirflowNetwork { AirflowNetworkReportData(ZN1).MultiZoneVentSenLossJ += (linkReport1(i).FLOW2OFF * CpAir * (zn1HB.MAT - Tamb)) * ReportingConstant * ReportingFraction; } - if (m_state.dataEnvrn->OutHumRat > zn1HB.ZoneAirHumRat) { + if (m_state.dataEnvrn->OutHumRat > zn1HB.airHumRat) { AirflowNetworkReportData(ZN1).MultiZoneVentLatGainW += - (linkReport1(i).FLOW2OFF * (m_state.dataEnvrn->OutHumRat - zn1HB.ZoneAirHumRat)) * ReportingFraction; + (linkReport1(i).FLOW2OFF * (m_state.dataEnvrn->OutHumRat - zn1HB.airHumRat)) * ReportingFraction; AirflowNetworkReportData(ZN1).MultiZoneVentLatGainJ += - (linkReport1(i).FLOW2OFF * (m_state.dataEnvrn->OutHumRat - zn1HB.ZoneAirHumRat)) * ReportingConstant * + (linkReport1(i).FLOW2OFF * (m_state.dataEnvrn->OutHumRat - zn1HB.airHumRat)) * ReportingConstant * ReportingFraction; } else { AirflowNetworkReportData(ZN1).MultiZoneVentLatLossW += - (linkReport1(i).FLOW2OFF * (zn1HB.ZoneAirHumRat - m_state.dataEnvrn->OutHumRat)) * ReportingFraction; + (linkReport1(i).FLOW2OFF * (zn1HB.airHumRat - m_state.dataEnvrn->OutHumRat)) * ReportingFraction; AirflowNetworkReportData(ZN1).MultiZoneVentLatLossJ += - (linkReport1(i).FLOW2OFF * (zn1HB.ZoneAirHumRat - m_state.dataEnvrn->OutHumRat)) * ReportingConstant * + (linkReport1(i).FLOW2OFF * (zn1HB.airHumRat - m_state.dataEnvrn->OutHumRat)) * ReportingConstant * ReportingFraction; } } @@ -9055,17 +9055,17 @@ namespace AirflowNetwork { AirflowNetworkReportData(ZN2).MultiZoneInfiSenLossJ += (linkReport1(i).FLOWOFF * CpAir * (zn2HB.MAT - Tamb)) * ReportingConstant * ReportingFraction; } - if (m_state.dataEnvrn->OutHumRat > zn2HB.ZoneAirHumRat) { + if (m_state.dataEnvrn->OutHumRat > zn2HB.airHumRat) { AirflowNetworkReportData(ZN2).MultiZoneInfiLatGainW += - (linkReport1(i).FLOWOFF * (m_state.dataEnvrn->OutHumRat - zn2HB.ZoneAirHumRat)) * ReportingFraction; + (linkReport1(i).FLOWOFF * (m_state.dataEnvrn->OutHumRat - zn2HB.airHumRat)) * ReportingFraction; AirflowNetworkReportData(ZN2).MultiZoneInfiLatGainJ += - (linkReport1(i).FLOWOFF * (m_state.dataEnvrn->OutHumRat - zn2HB.ZoneAirHumRat)) * ReportingConstant * + (linkReport1(i).FLOWOFF * (m_state.dataEnvrn->OutHumRat - zn2HB.airHumRat)) * ReportingConstant * ReportingFraction; } else { AirflowNetworkReportData(ZN2).MultiZoneInfiLatLossW += - (linkReport1(i).FLOWOFF * (zn2HB.ZoneAirHumRat - m_state.dataEnvrn->OutHumRat)) * ReportingFraction; + (linkReport1(i).FLOWOFF * (zn2HB.airHumRat - m_state.dataEnvrn->OutHumRat)) * ReportingFraction; AirflowNetworkReportData(ZN2).MultiZoneInfiLatLossJ += - (linkReport1(i).FLOWOFF * (zn2HB.ZoneAirHumRat - m_state.dataEnvrn->OutHumRat)) * ReportingConstant * + (linkReport1(i).FLOWOFF * (zn2HB.airHumRat - m_state.dataEnvrn->OutHumRat)) * ReportingConstant * ReportingFraction; } } else { @@ -9080,17 +9080,17 @@ namespace AirflowNetwork { AirflowNetworkReportData(ZN2).MultiZoneVentSenLossJ += (linkReport1(i).FLOWOFF * CpAir * (zn2HB.MAT - Tamb)) * ReportingConstant * ReportingFraction; } - if (m_state.dataEnvrn->OutHumRat > zn2HB.ZoneAirHumRat) { + if (m_state.dataEnvrn->OutHumRat > zn2HB.airHumRat) { AirflowNetworkReportData(ZN2).MultiZoneVentLatGainW += - (linkReport1(i).FLOWOFF * (m_state.dataEnvrn->OutHumRat - zn2HB.ZoneAirHumRat)) * ReportingFraction; + (linkReport1(i).FLOWOFF * (m_state.dataEnvrn->OutHumRat - zn2HB.airHumRat)) * ReportingFraction; AirflowNetworkReportData(ZN2).MultiZoneVentLatGainJ += - (linkReport1(i).FLOWOFF * (m_state.dataEnvrn->OutHumRat - zn2HB.ZoneAirHumRat)) * ReportingConstant * + (linkReport1(i).FLOWOFF * (m_state.dataEnvrn->OutHumRat - zn2HB.airHumRat)) * ReportingConstant * ReportingFraction; } else { AirflowNetworkReportData(ZN2).MultiZoneVentLatLossW += - (linkReport1(i).FLOWOFF * (zn2HB.ZoneAirHumRat - m_state.dataEnvrn->OutHumRat)) * ReportingFraction; + (linkReport1(i).FLOWOFF * (zn2HB.airHumRat - m_state.dataEnvrn->OutHumRat)) * ReportingFraction; AirflowNetworkReportData(ZN2).MultiZoneVentLatLossJ += - (linkReport1(i).FLOWOFF * (zn2HB.ZoneAirHumRat - m_state.dataEnvrn->OutHumRat)) * ReportingConstant * + (linkReport1(i).FLOWOFF * (zn2HB.airHumRat - m_state.dataEnvrn->OutHumRat)) * ReportingConstant * ReportingFraction; } } @@ -9103,7 +9103,7 @@ namespace AirflowNetwork { auto &zn1HB = m_state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZN1); auto &zn2HB = m_state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZN2); ReportingFraction = (1.0 - MaxOnOffFanRunTimeFraction); - CpAir = PsyCpAirFnW(zn1HB.ZoneAirHumRat); + CpAir = PsyCpAirFnW(zn1HB.airHumRat); if (zn1HB.MAT > zn2HB.MAT) { AirflowNetworkReportData(ZN2).MultiZoneMixSenGainW += (linkReport1(i).FLOWOFF * CpAir * (zn1HB.MAT - zn2HB.MAT)) * ReportingFraction; @@ -9115,18 +9115,18 @@ namespace AirflowNetwork { AirflowNetworkReportData(ZN2).MultiZoneMixSenLossJ += (linkReport1(i).FLOWOFF * CpAir * (zn2HB.MAT - zn1HB.MAT)) * ReportingConstant * ReportingFraction; } - if (zn1HB.ZoneAirHumRat > zn2HB.ZoneAirHumRat) { + if (zn1HB.airHumRat > zn2HB.airHumRat) { AirflowNetworkReportData(ZN2).MultiZoneMixLatGainW += - (linkReport1(i).FLOWOFF * (zn1HB.ZoneAirHumRat - zn2HB.ZoneAirHumRat)) * ReportingFraction; + (linkReport1(i).FLOWOFF * (zn1HB.airHumRat - zn2HB.airHumRat)) * ReportingFraction; AirflowNetworkReportData(ZN2).MultiZoneMixLatGainJ += - (linkReport1(i).FLOWOFF * (zn1HB.ZoneAirHumRat - zn2HB.ZoneAirHumRat)) * ReportingConstant * ReportingFraction; + (linkReport1(i).FLOWOFF * (zn1HB.airHumRat - zn2HB.airHumRat)) * ReportingConstant * ReportingFraction; } else { AirflowNetworkReportData(ZN2).MultiZoneMixLatLossW += - (linkReport1(i).FLOWOFF * (zn2HB.ZoneAirHumRat - zn1HB.ZoneAirHumRat)) * ReportingFraction; + (linkReport1(i).FLOWOFF * (zn2HB.airHumRat - zn1HB.airHumRat)) * ReportingFraction; AirflowNetworkReportData(ZN2).MultiZoneMixLatLossJ += - (linkReport1(i).FLOWOFF * (zn2HB.ZoneAirHumRat - zn1HB.ZoneAirHumRat)) * ReportingConstant * ReportingFraction; + (linkReport1(i).FLOWOFF * (zn2HB.airHumRat - zn1HB.airHumRat)) * ReportingConstant * ReportingFraction; } - CpAir = PsyCpAirFnW(zn2HB.ZoneAirHumRat); + CpAir = PsyCpAirFnW(zn2HB.airHumRat); if (zn2HB.MAT > zn1HB.MAT) { AirflowNetworkReportData(ZN1).MultiZoneMixSenGainW += (linkReport1(i).FLOW2OFF * CpAir * (zn2HB.MAT - zn1HB.MAT)) * ReportingFraction; @@ -9139,16 +9139,16 @@ namespace AirflowNetwork { (linkReport1(i).FLOW2OFF * CpAir * (zn1HB.MAT - zn2HB.MAT)) * ReportingConstant * ReportingFraction; } - if (zn2HB.ZoneAirHumRat > zn1HB.ZoneAirHumRat) { + if (zn2HB.airHumRat > zn1HB.airHumRat) { AirflowNetworkReportData(ZN1).MultiZoneMixLatGainW += - (linkReport1(i).FLOW2OFF * (zn2HB.ZoneAirHumRat - zn1HB.ZoneAirHumRat)) * ReportingFraction; + (linkReport1(i).FLOW2OFF * (zn2HB.airHumRat - zn1HB.airHumRat)) * ReportingFraction; AirflowNetworkReportData(ZN1).MultiZoneMixLatGainJ += - (linkReport1(i).FLOW2OFF * (zn2HB.ZoneAirHumRat - zn1HB.ZoneAirHumRat)) * ReportingConstant * ReportingFraction; + (linkReport1(i).FLOW2OFF * (zn2HB.airHumRat - zn1HB.airHumRat)) * ReportingConstant * ReportingFraction; } else { AirflowNetworkReportData(ZN1).MultiZoneMixLatLossW += - std::abs(linkReport1(i).FLOW2OFF * (zn1HB.ZoneAirHumRat - zn2HB.ZoneAirHumRat)) * ReportingFraction; + std::abs(linkReport1(i).FLOW2OFF * (zn1HB.airHumRat - zn2HB.airHumRat)) * ReportingFraction; AirflowNetworkReportData(ZN1).MultiZoneMixLatLossJ += - (linkReport1(i).FLOW2OFF * (zn1HB.ZoneAirHumRat - zn2HB.ZoneAirHumRat)) * ReportingConstant * ReportingFraction; + (linkReport1(i).FLOW2OFF * (zn1HB.airHumRat - zn2HB.airHumRat)) * ReportingConstant * ReportingFraction; } } } @@ -9162,8 +9162,8 @@ namespace AirflowNetwork { for (i = 1; i <= m_state.dataGlobal->NumOfZones; ++i) { // Start of zone loads report variable update loop ... auto &thisZoneHB = m_state.dataZoneTempPredictorCorrector->zoneHeatBalance(i); Tamb = Zone(i).OutDryBulbTemp; - CpAir = PsyCpAirFnW(thisZoneHB.ZoneAirHumRatAvg); - AirDensity = PsyRhoAirFnPbTdbW(m_state, m_state.dataEnvrn->OutBaroPress, thisZoneHB.MAT, thisZoneHB.ZoneAirHumRatAvg); + CpAir = PsyCpAirFnW(thisZoneHB.airHumRatAvg); + AirDensity = PsyRhoAirFnPbTdbW(m_state, m_state.dataEnvrn->OutBaroPress, thisZoneHB.MAT, thisZoneHB.airHumRatAvg); AirflowNetworkZnRpt(i).InfilMass = (exchangeData(i).SumMCp / CpAir) * ReportingConstant; AirflowNetworkZnRpt(i).InfilVolume = AirflowNetworkZnRpt(i).InfilMass / AirDensity; @@ -9212,7 +9212,7 @@ namespace AirflowNetwork { AirflowNetworkZnRpt(i).InletMass - AirflowNetworkZnRpt(i).OutletMass; AirflowNetworkZnRpt(i).ExfilSensiLoss = AirflowNetworkZnRpt(i).ExfilMass / ReportingConstant * (thisZoneHB.MAT - Tamb) * CpAir; AirflowNetworkZnRpt(i).ExfilLatentLoss = - AirflowNetworkZnRpt(i).ExfilMass / ReportingConstant * (thisZoneHB.ZoneAirHumRat - m_state.dataEnvrn->OutHumRat) * H2OHtOfVap; + AirflowNetworkZnRpt(i).ExfilMass / ReportingConstant * (thisZoneHB.airHumRat - m_state.dataEnvrn->OutHumRat) * H2OHtOfVap; AirflowNetworkZnRpt(i).ExfilTotalLoss = AirflowNetworkZnRpt(i).ExfilSensiLoss + AirflowNetworkZnRpt(i).ExfilLatentLoss; m_state.dataHeatBal->ZoneTotalExfiltrationHeatLoss += AirflowNetworkZnRpt(i).ExfilTotalLoss * ReportingConstant; @@ -11717,8 +11717,8 @@ namespace AirflowNetwork { auto &TimeStepSys = m_state.dataHVACGlobal->TimeStepSys; auto &thisZoneHB = m_state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); - Real64 CpAir = PsyCpAirFnW(thisZoneHB.ZoneAirHumRat); - Real64 RhoAir = PsyRhoAirFnPbTdbW(m_state, m_state.dataEnvrn->OutBaroPress, thisZoneHB.MAT, thisZoneHB.ZoneAirHumRat); + Real64 CpAir = PsyCpAirFnW(thisZoneHB.airHumRat); + Real64 RhoAir = PsyRhoAirFnPbTdbW(m_state, m_state.dataEnvrn->OutBaroPress, thisZoneHB.MAT, thisZoneHB.airHumRat); Real64 InfilVolume = ((exchangeData(ZoneNum).SumMCp + exchangeData(ZoneNum).SumMVCp) / CpAir / RhoAir) * TimeStepSys * Constant::SecInHour; Real64 ACH = InfilVolume / (TimeStepSys * m_state.dataHeatBal->Zone(ZoneNum).Volume); diff --git a/src/EnergyPlus/ChilledCeilingPanelSimple.cc b/src/EnergyPlus/ChilledCeilingPanelSimple.cc index ef41a5cdc6b..833ad9b8398 100644 --- a/src/EnergyPlus/ChilledCeilingPanelSimple.cc +++ b/src/EnergyPlus/ChilledCeilingPanelSimple.cc @@ -1238,8 +1238,8 @@ void CoolingPanelParams::CalcCoolingPanel(EnergyPlusData &state, int const Cooli // iterate like in the low temperature radiant systems because the inlet water condition is known // not calculated. So, we can deal with this upfront rather than after calculation and then more // iteration. - Real64 DewPointTemp = Psychrometrics::PsyTdpFnWPb( - state, state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).ZoneAirHumRat, state.dataEnvrn->OutBaroPress); + Real64 DewPointTemp = + Psychrometrics::PsyTdpFnWPb(state, state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).airHumRat, state.dataEnvrn->OutBaroPress); if (waterInletTemp < (DewPointTemp + this->CondDewPtDeltaT) && (CoolingPanelOn)) { diff --git a/src/EnergyPlus/ConvectionCoefficients.cc b/src/EnergyPlus/ConvectionCoefficients.cc index 87565305024..0a0778a1ee0 100644 --- a/src/EnergyPlus/ConvectionCoefficients.cc +++ b/src/EnergyPlus/ConvectionCoefficients.cc @@ -2166,7 +2166,7 @@ void CalcCeilingDiffuserIntConvCoeff(EnergyPlusData &state, Real64 ACH = CalcCeilingDiffuserACH(state, ZoneNum); - Real64 AirHumRat = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).ZoneAirHumRatAvg; + Real64 AirHumRat = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).airHumRatAvg; for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { auto const &thisSpace = state.dataHeatBal->space(spaceNum); @@ -2726,7 +2726,7 @@ void CalcISO15099WindowIntConvCoeff(EnergyPlusData &state, // Get humidity ratio Real64 AirHumRat = - (surface.Zone > 0) ? state.dataZoneTempPredictorCorrector->zoneHeatBalance(surface.Zone).ZoneAirHumRatAvg : state.dataEnvrn->OutHumRat; + (surface.Zone > 0) ? state.dataZoneTempPredictorCorrector->zoneHeatBalance(surface.Zone).airHumRatAvg : state.dataEnvrn->OutHumRat; Real64 Height = surface.Height; Real64 TiltDeg = surface.Tilt; @@ -3197,7 +3197,7 @@ Real64 EvaluateIntHcModels(EnergyPlusData &state, int const SurfNum, HcInt const case HcInt::FisherPedersenCeilDiffuserFloor: { Real64 AirChangeRate = CalcCeilingDiffuserACH(state, ZoneNum); - Real64 AirHumRat = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).ZoneAirHumRatAvg; + Real64 AirHumRat = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).airHumRatAvg; if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) { HnFn = [=, &state](double Tsurf, double Tamb, double, double, double cosTilt) -> double { @@ -3218,7 +3218,7 @@ Real64 EvaluateIntHcModels(EnergyPlusData &state, int const SurfNum, HcInt const case HcInt::FisherPedersenCeilDiffuserCeiling: { Real64 AirChangeRate = CalcCeilingDiffuserACH(state, ZoneNum); - Real64 AirHumRat = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).ZoneAirHumRatAvg; + Real64 AirHumRat = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).airHumRatAvg; if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) { HnFn = [=, &state](double Tsurf, double Tamb, double, double, double cosTilt) -> double { @@ -3239,7 +3239,7 @@ Real64 EvaluateIntHcModels(EnergyPlusData &state, int const SurfNum, HcInt const case HcInt::FisherPedersenCeilDiffuserWalls: { Real64 AirChangeRate = CalcCeilingDiffuserACH(state, ZoneNum); - Real64 AirHumRat = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).ZoneAirHumRatAvg; + Real64 AirHumRat = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).airHumRatAvg; if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) { HnFn = [=, &state](double Tsurf, double Tamb, double, double, double cosTilt) -> double { diff --git a/src/EnergyPlus/CoolTower.cc b/src/EnergyPlus/CoolTower.cc index 3f80f4eb588..efe6a09bb9a 100644 --- a/src/EnergyPlus/CoolTower.cc +++ b/src/EnergyPlus/CoolTower.cc @@ -718,7 +718,7 @@ namespace CoolTower { thisZoneHB.CTMFL = thisZoneHB.MCPC / AirSpecHeat; state.dataCoolTower->CoolTowerSys(CoolTowerNum).SenHeatPower = thisZoneHB.MCPC * std::abs(thisZoneHB.ZT - OutletTemp); - state.dataCoolTower->CoolTowerSys(CoolTowerNum).LatHeatPower = CVF_ZoneNum * std::abs(thisZoneHB.ZoneAirHumRat - OutletHumRat); + state.dataCoolTower->CoolTowerSys(CoolTowerNum).LatHeatPower = CVF_ZoneNum * std::abs(thisZoneHB.airHumRat - OutletHumRat); state.dataCoolTower->CoolTowerSys(CoolTowerNum).OutletTemp = OutletTemp; state.dataCoolTower->CoolTowerSys(CoolTowerNum).OutletHumRat = OutletHumRat; state.dataCoolTower->CoolTowerSys(CoolTowerNum).AirVolFlowRate = CVF_ZoneNum; diff --git a/src/EnergyPlus/DXCoils.cc b/src/EnergyPlus/DXCoils.cc index 10b27efa831..84db7a0269f 100644 --- a/src/EnergyPlus/DXCoils.cc +++ b/src/EnergyPlus/DXCoils.cc @@ -7307,7 +7307,7 @@ void InitDXCoil(EnergyPlusData &state, int const DXCoilNum) // number of the cur if (thisDXCoil.IsSecondaryDXCoilInZone) { thisDXCoil.EvapInletWetBulb = PsyTwbFnTdbWPb(state, state.dataZoneTempPredictorCorrector->zoneHeatBalance(thisDXCoil.SecZonePtr).ZT, - state.dataZoneTempPredictorCorrector->zoneHeatBalance(thisDXCoil.SecZonePtr).ZoneAirHumRat, + state.dataZoneTempPredictorCorrector->zoneHeatBalance(thisDXCoil.SecZonePtr).airHumRat, state.dataEnvrn->OutBaroPress, RoutineName); } @@ -9367,7 +9367,7 @@ void CalcDoe2DXCoil(EnergyPlusData &state, if (thisDXCoil.IsSecondaryDXCoilInZone) { auto &secZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(thisDXCoil.SecZonePtr); OutdoorDryBulb = secZoneHB.ZT; - OutdoorHumRat = secZoneHB.ZoneAirHumRat; + OutdoorHumRat = secZoneHB.airHumRat; OutdoorWetBulb = thisDXCoil.EvapInletWetBulb; OutdoorPressure = state.dataEnvrn->OutBaroPress; } @@ -9390,7 +9390,7 @@ void CalcDoe2DXCoil(EnergyPlusData &state, CondInletTemp = secZoneHB.ZT; CompAmbTemp = CondInletTemp; // assumes compressor is in same location as secondary coil OutdoorDryBulb = CondInletTemp; - OutdoorHumRat = secZoneHB.ZoneAirHumRat; + OutdoorHumRat = secZoneHB.airHumRat; OutdoorWetBulb = thisDXCoil.EvapInletWetBulb; OutdoorPressure = state.dataEnvrn->OutBaroPress; } @@ -11015,7 +11015,7 @@ void CalcDXHeatingCoil(EnergyPlusData &state, if (thisDXCoil.IsSecondaryDXCoilInZone) { auto &secZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(thisDXCoil.SecZonePtr); OutdoorDryBulb = secZoneHB.ZT; - OutdoorHumRat = secZoneHB.ZoneAirHumRat; + OutdoorHumRat = secZoneHB.airHumRat; OutdoorWetBulb = thisDXCoil.EvapInletWetBulb; OutdoorPressure = state.dataEnvrn->OutBaroPress; CompAmbTemp = OutdoorDryBulb; @@ -11024,7 +11024,7 @@ void CalcDXHeatingCoil(EnergyPlusData &state, } else if (thisDXCoil.IsSecondaryDXCoilInZone) { auto &secZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(thisDXCoil.SecZonePtr); OutdoorDryBulb = secZoneHB.ZT; - OutdoorHumRat = secZoneHB.ZoneAirHumRat; + OutdoorHumRat = secZoneHB.airHumRat; OutdoorWetBulb = thisDXCoil.EvapInletWetBulb; OutdoorPressure = state.dataEnvrn->OutBaroPress; CompAmbTemp = OutdoorDryBulb; @@ -11497,7 +11497,7 @@ void CalcMultiSpeedDXCoil(EnergyPlusData &state, if (thisDXCoil.IsSecondaryDXCoilInZone) { auto &secZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(thisDXCoil.SecZonePtr); OutdoorDryBulb = secZoneHB.ZT; - OutdoorHumRat = secZoneHB.ZoneAirHumRat; + OutdoorHumRat = secZoneHB.airHumRat; OutdoorWetBulb = thisDXCoil.EvapInletWetBulb; OutdoorPressure = state.dataEnvrn->OutBaroPress; CompAmbTemp = OutdoorDryBulb; @@ -11505,7 +11505,7 @@ void CalcMultiSpeedDXCoil(EnergyPlusData &state, } else if (thisDXCoil.IsSecondaryDXCoilInZone) { auto &secZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(thisDXCoil.SecZonePtr); OutdoorDryBulb = secZoneHB.ZT; - OutdoorHumRat = secZoneHB.ZoneAirHumRat; + OutdoorHumRat = secZoneHB.airHumRat; OutdoorWetBulb = thisDXCoil.EvapInletWetBulb; OutdoorPressure = state.dataEnvrn->OutBaroPress; CompAmbTemp = OutdoorDryBulb; @@ -12729,14 +12729,14 @@ void CalcMultiSpeedDXCoilCooling(EnergyPlusData &state, if (thisDXCoil.IsSecondaryDXCoilInZone) { auto &secZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(thisDXCoil.SecZonePtr); OutdoorDryBulb = secZoneHB.ZT; - OutdoorHumRat = secZoneHB.ZoneAirHumRat; + OutdoorHumRat = secZoneHB.airHumRat; OutdoorWetBulb = thisDXCoil.EvapInletWetBulb; OutdoorPressure = state.dataEnvrn->OutBaroPress; } } else if (thisDXCoil.IsSecondaryDXCoilInZone) { auto &secZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(thisDXCoil.SecZonePtr); OutdoorDryBulb = secZoneHB.ZT; - OutdoorHumRat = secZoneHB.ZoneAirHumRat; + OutdoorHumRat = secZoneHB.airHumRat; OutdoorWetBulb = thisDXCoil.EvapInletWetBulb; OutdoorPressure = state.dataEnvrn->OutBaroPress; } else { @@ -13625,14 +13625,14 @@ void CalcMultiSpeedDXCoilHeating(EnergyPlusData &state, if (thisDXCoil.IsSecondaryDXCoilInZone) { auto &secZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(thisDXCoil.SecZonePtr); OutdoorDryBulb = secZoneHB.ZT; - OutdoorHumRat = secZoneHB.ZoneAirHumRat; + OutdoorHumRat = secZoneHB.airHumRat; // OutdoorWetBulb = DXCoil( DXCoilNum ).EvapInletWetBulb; OutdoorPressure = state.dataEnvrn->OutBaroPress; } } else if (thisDXCoil.IsSecondaryDXCoilInZone) { auto &secZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(thisDXCoil.SecZonePtr); OutdoorDryBulb = secZoneHB.ZT; - OutdoorHumRat = secZoneHB.ZoneAirHumRat; + OutdoorHumRat = secZoneHB.airHumRat; // OutdoorWetBulb = DXCoil( DXCoilNum ).EvapInletWetBulb; OutdoorPressure = state.dataEnvrn->OutBaroPress; } else { @@ -16314,7 +16314,7 @@ void CalcSecondaryDXCoils(EnergyPlusData &state, int const DXCoilNum) } thisDXCoil.SecCoilTotalHeatRemovalRate = -TotalHeatRemovalRate; // +DXCoil( DXCoilNum ).DefrostPower; EvapInletDryBulb = secZoneHB.ZT; - EvapInletHumRat = secZoneHB.ZoneAirHumRat; + EvapInletHumRat = secZoneHB.airHumRat; RhoAir = PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, EvapInletDryBulb, EvapInletHumRat); EvapAirMassFlow = RhoAir * thisDXCoil.SecCoilAirFlow; ; @@ -16370,7 +16370,7 @@ void CalcSecondaryDXCoils(EnergyPlusData &state, int const DXCoilNum) } break; case CoilDX_MultiSpeedHeating: { EvapInletDryBulb = secZoneHB.ZT; - EvapInletHumRat = secZoneHB.ZoneAirHumRat; + EvapInletHumRat = secZoneHB.airHumRat; RhoAir = PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, EvapInletDryBulb, EvapInletHumRat); MSSpeedRatio = thisDXCoil.MSSpeedRatio; MSCycRatio = thisDXCoil.MSCycRatio; diff --git a/src/EnergyPlus/DataSurfaces.cc b/src/EnergyPlus/DataSurfaces.cc index 784779d8b98..8ce00de23f6 100644 --- a/src/EnergyPlus/DataSurfaces.cc +++ b/src/EnergyPlus/DataSurfaces.cc @@ -251,7 +251,7 @@ Real64 SurfaceData::getInsideAirTemperature(EnergyPlusData &state, const int t_S for (int NodeNum = 1; NodeNum <= state.dataZoneEquip->ZoneEquipConfig(Zone).NumInletNodes; ++NodeNum) { Real64 NodeTemp = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(Zone).InletNode(NodeNum)).Temp; Real64 MassFlowRate = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(Zone).InletNode(NodeNum)).MassFlowRate; - Real64 CpAir = PsyCpAirFnW(thisZoneHB.ZoneAirHumRat); + Real64 CpAir = PsyCpAirFnW(thisZoneHB.airHumRat); SumSysMCp += MassFlowRate * CpAir; SumSysMCpT += MassFlowRate * CpAir * NodeTemp; } diff --git a/src/EnergyPlus/DisplacementVentMgr.cc b/src/EnergyPlus/DisplacementVentMgr.cc index f2309eadd55..228cde79ef6 100644 --- a/src/EnergyPlus/DisplacementVentMgr.cc +++ b/src/EnergyPlus/DisplacementVentMgr.cc @@ -633,7 +633,7 @@ namespace RoomAir { for (int NodeNum = 1; NodeNum <= state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).NumInletNodes; ++NodeNum) { NodeTemp = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).InletNode(NodeNum)).Temp; MassFlowRate = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).InletNode(NodeNum)).MassFlowRate; - CpAir = PsyCpAirFnW(thisZoneHB.ZoneAirHumRat); + CpAir = PsyCpAirFnW(thisZoneHB.airHumRat); SumSysMCp += MassFlowRate * CpAir; SumSysMCpT += MassFlowRate * CpAir * NodeTemp; } @@ -734,17 +734,17 @@ namespace RoomAir { state.dataRoomAir->AIRRATFloor(ZoneNum) = zone.Volume * min(state.dataRoomAir->HeightTransition(ZoneNum), state.dataDispVentMgr->HeightFloorSubzoneTop) / CeilingHeight * zone.ZoneVolCapMultpSens * - PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAir->MATFloor(ZoneNum), thisZoneHB.ZoneAirHumRat) * - PsyCpAirFnW(thisZoneHB.ZoneAirHumRat) / TimeStepSysSec; + PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAir->MATFloor(ZoneNum), thisZoneHB.airHumRat) * + PsyCpAirFnW(thisZoneHB.airHumRat) / TimeStepSysSec; state.dataRoomAir->AIRRATOC(ZoneNum) = zone.Volume * (state.dataRoomAir->HeightTransition(ZoneNum) - min(state.dataRoomAir->HeightTransition(ZoneNum), 0.2)) / CeilingHeight * zone.ZoneVolCapMultpSens * - PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAir->MATOC(ZoneNum), thisZoneHB.ZoneAirHumRat) * - PsyCpAirFnW(thisZoneHB.ZoneAirHumRat) / TimeStepSysSec; + PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAir->MATOC(ZoneNum), thisZoneHB.airHumRat) * + PsyCpAirFnW(thisZoneHB.airHumRat) / TimeStepSysSec; state.dataRoomAir->AIRRATMX(ZoneNum) = zone.Volume * (CeilingHeight - state.dataRoomAir->HeightTransition(ZoneNum)) / CeilingHeight * zone.ZoneVolCapMultpSens * - PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAir->MATMX(ZoneNum), thisZoneHB.ZoneAirHumRat) * - PsyCpAirFnW(thisZoneHB.ZoneAirHumRat) / TimeStepSysSec; + PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAir->MATMX(ZoneNum), thisZoneHB.airHumRat) * + PsyCpAirFnW(thisZoneHB.airHumRat) / TimeStepSysSec; if (state.dataHVACGlobal->UseZoneTimeStepHistory) { state.dataRoomAir->ZTMFloor(ZoneNum)[2] = state.dataRoomAir->XMATFloor(ZoneNum)[2]; @@ -887,7 +887,7 @@ namespace RoomAir { state.dataRoomAir->AvgTempGrad(ZoneNum) = 0.0; state.dataRoomAir->MaxTempGrad(ZoneNum) = 0.0; state.dataRoomAir->AirModel(ZoneNum).SimAirModel = false; - Real64 const thisZoneT1 = thisZoneHB.ZoneT1; + Real64 const thisZoneT1 = thisZoneHB.T1; Real64 AirCap = thisZoneHB.AirPowerCap; TempHistTerm = AirCap * (3.0 * thisZoneHB.ZTM[0] - (3.0 / 2.0) * thisZoneHB.ZTM[1] + OneThird * thisZoneHB.ZTM[2]); diff --git a/src/EnergyPlus/HVACManager.cc b/src/EnergyPlus/HVACManager.cc index d002a5a362e..c4d8b22732e 100644 --- a/src/EnergyPlus/HVACManager.cc +++ b/src/EnergyPlus/HVACManager.cc @@ -160,14 +160,14 @@ void ManageHVAC(EnergyPlusData &state) thisZoneHB.ZT = thisZoneHB.MAT; // save for use with thermal comfort control models (Fang, Pierce, and KSU) thisZoneHB.ZTAV = 0.0; - thisZoneHB.ZoneAirHumRatAvg = 0.0; + thisZoneHB.airHumRatAvg = 0.0; } if (state.dataHeatBal->doSpaceHeatBalance) { for (auto &thisSpaceHB : state.dataZoneTempPredictorCorrector->spaceHeatBalance) { thisSpaceHB.ZT = thisSpaceHB.MAT; // save for use with thermal comfort control models (Fang, Pierce, and KSU) thisSpaceHB.ZTAV = 0.0; - thisSpaceHB.ZoneAirHumRatAvg = 0.0; + thisSpaceHB.airHumRatAvg = 0.0; } } state.dataHeatBalFanSys->ZoneThermostatSetPointHiAver = 0.0; @@ -390,12 +390,12 @@ void ManageHVAC(EnergyPlusData &state) for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); thisZoneHB.ZTAV += thisZoneHB.ZT * state.dataHVACGlobal->FracTimeStepZone; - thisZoneHB.ZoneAirHumRatAvg += thisZoneHB.ZoneAirHumRat * state.dataHVACGlobal->FracTimeStepZone; + thisZoneHB.airHumRatAvg += thisZoneHB.airHumRat * state.dataHVACGlobal->FracTimeStepZone; if (state.dataHeatBal->doSpaceHeatBalance) { for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { auto &thisSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum); thisSpaceHB.ZTAV += thisSpaceHB.ZT * state.dataHVACGlobal->FracTimeStepZone; - thisSpaceHB.ZoneAirHumRatAvg += thisSpaceHB.ZoneAirHumRat * state.dataHVACGlobal->FracTimeStepZone; + thisSpaceHB.airHumRatAvg += thisSpaceHB.airHumRat * state.dataHVACGlobal->FracTimeStepZone; } } if (state.dataContaminantBalance->Contaminant.CO2Simulation) @@ -545,12 +545,12 @@ void ManageHVAC(EnergyPlusData &state) for (auto &thisZoneHB : state.dataZoneTempPredictorCorrector->zoneHeatBalance) { thisZoneHB.ZTAVComf = thisZoneHB.ZTAV; - thisZoneHB.ZoneAirHumRatAvgComf = thisZoneHB.ZoneAirHumRatAvg; + thisZoneHB.airHumRatAvgComf = thisZoneHB.airHumRatAvg; } if (state.dataHeatBal->doSpaceHeatBalance) { for (auto &thisSpaceHB : state.dataZoneTempPredictorCorrector->spaceHeatBalance) { thisSpaceHB.ZTAVComf = thisSpaceHB.ZTAV; - thisSpaceHB.ZoneAirHumRatAvgComf = thisSpaceHB.ZoneAirHumRatAvg; + thisSpaceHB.airHumRatAvgComf = thisSpaceHB.airHumRatAvg; } } @@ -2275,17 +2275,17 @@ void ReportInfiltrations(EnergyPlusData &state) } // Report infiltration latent gains and losses - H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(thisZoneHB.ZoneAirHumRat, thisZoneHB.MAT); - if (thisZoneHB.ZoneAirHumRat > state.dataEnvrn->OutHumRat) { + H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(thisZoneHB.airHumRat, thisZoneHB.MAT); + if (thisZoneHB.airHumRat > state.dataEnvrn->OutHumRat) { thisInfiltration.InfilLatentLoss = - thisInfiltration.InfilMdot * (thisZoneHB.ZoneAirHumRat - state.dataEnvrn->OutHumRat) * H2OHtOfVap * TimeStepSysSec; + thisInfiltration.InfilMdot * (thisZoneHB.airHumRat - state.dataEnvrn->OutHumRat) * H2OHtOfVap * TimeStepSysSec; thisInfiltration.InfilLatentGain = 0.0; } else { thisInfiltration.InfilLatentGain = - thisInfiltration.InfilMdot * (state.dataEnvrn->OutHumRat - thisZoneHB.ZoneAirHumRat) * H2OHtOfVap * TimeStepSysSec; + thisInfiltration.InfilMdot * (state.dataEnvrn->OutHumRat - thisZoneHB.airHumRat) * H2OHtOfVap * TimeStepSysSec; thisInfiltration.InfilLatentLoss = 0.0; } // Total infiltration losses and gains @@ -2299,8 +2299,7 @@ void ReportInfiltrations(EnergyPlusData &state) thisInfiltration.InfilTotalLoss = -TotalLoad; } // CR7751 second, calculate using indoor conditions for density property - AirDensity = - Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, thisZoneHB.MAT, thisZoneHB.ZoneAirHumRatAvg, RoutineName); + AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, thisZoneHB.MAT, thisZoneHB.airHumRatAvg, RoutineName); thisInfiltration.InfilVdotCurDensity = thisInfiltration.InfilMdot / AirDensity; thisInfiltration.InfilVolumeCurDensity = thisInfiltration.InfilVdotCurDensity * TimeStepSysSec; thisInfiltration.InfilAirChangeRate = thisInfiltration.InfilVolumeCurDensity / (TimeStepSys * thisZone.Volume); @@ -2425,17 +2424,17 @@ void ReportAirHeatBalance(EnergyPlusData &state) } // Report infiltration latent gains and losses CpAir = Psychrometrics::PsyCpAirFnW(state.dataEnvrn->OutHumRat); - H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(thisZoneHB.ZoneAirHumRat, thisZoneHB.MAT); - if (thisZoneHB.ZoneAirHumRat > state.dataEnvrn->OutHumRat) { + H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(thisZoneHB.airHumRat, thisZoneHB.MAT); + if (thisZoneHB.airHumRat > state.dataEnvrn->OutHumRat) { znAirRpt.InfilLatentLoss = - thisZoneHB.MCPI / CpAir * (thisZoneHB.ZoneAirHumRat - state.dataEnvrn->OutHumRat) * H2OHtOfVap * TimeStepSysSec * ADSCorrectionFactor; + thisZoneHB.MCPI / CpAir * (thisZoneHB.airHumRat - state.dataEnvrn->OutHumRat) * H2OHtOfVap * TimeStepSysSec * ADSCorrectionFactor; znAirRpt.InfilLatentGain = 0.0; } else { znAirRpt.InfilLatentGain = - thisZoneHB.MCPI / CpAir * (state.dataEnvrn->OutHumRat - thisZoneHB.ZoneAirHumRat) * H2OHtOfVap * TimeStepSysSec * ADSCorrectionFactor; + thisZoneHB.MCPI / CpAir * (state.dataEnvrn->OutHumRat - thisZoneHB.airHumRat) * H2OHtOfVap * TimeStepSysSec * ADSCorrectionFactor; znAirRpt.InfilLatentLoss = 0.0; } // Total infiltration losses and gains @@ -2455,8 +2454,7 @@ void ReportAirHeatBalance(EnergyPlusData &state) znAirRpt.VentilMass = znAirRpt.VentilMdot * TimeStepSysSec; // CR7751 second, calculate using indoor conditions for density property - AirDensity = - Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, thisZoneHB.MAT, thisZoneHB.ZoneAirHumRatAvg, RoutineName3); + 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); @@ -2500,14 +2498,14 @@ void ReportAirHeatBalance(EnergyPlusData &state) if (VentZoneNum > 1) continue; // Report ventilation latent gains and losses - H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(thisZoneHB.ZoneAirHumRat, thisZoneHB.MAT); - if (thisZoneHB.ZoneAirHumRat > state.dataEnvrn->OutHumRat) { + H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(thisZoneHB.airHumRat, thisZoneHB.MAT); + if (thisZoneHB.airHumRat > state.dataEnvrn->OutHumRat) { znAirRpt.VentilLatentLoss = - znAirRpt.VentilMdot * (thisZoneHB.ZoneAirHumRat - state.dataEnvrn->OutHumRat) * H2OHtOfVap * TimeStepSysSec; + znAirRpt.VentilMdot * (thisZoneHB.airHumRat - state.dataEnvrn->OutHumRat) * H2OHtOfVap * TimeStepSysSec; znAirRpt.VentilLatentGain = 0.0; } else { znAirRpt.VentilLatentGain = - znAirRpt.VentilMdot * (state.dataEnvrn->OutHumRat - thisZoneHB.ZoneAirHumRat) * H2OHtOfVap * TimeStepSysSec; + znAirRpt.VentilMdot * (state.dataEnvrn->OutHumRat - thisZoneHB.airHumRat) * H2OHtOfVap * TimeStepSysSec; znAirRpt.VentilLatentLoss = 0.0; } // Total ventilation losses and gains @@ -2551,20 +2549,20 @@ void ReportAirHeatBalance(EnergyPlusData &state) AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, (thisZoneHB.MAT + fromZoneHB.MAT) / 2.0, - (thisZoneHB.ZoneAirHumRat + fromZoneHB.ZoneAirHumRat) / 2.0, + (thisZoneHB.airHumRat + fromZoneHB.airHumRat) / 2.0, std::string()); - CpAir = Psychrometrics::PsyCpAirFnW((thisZoneHB.ZoneAirHumRat + fromZoneHB.ZoneAirHumRat) / 2.0); + 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.ZoneAirHumRat + fromZoneHB.ZoneAirHumRat) / 2.0, - (thisZoneHB.MAT + fromZoneHB.MAT) / 2.0); + 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.ZoneAirHumRat - fromZoneHB.ZoneAirHumRat) * H2OHtOfVap; + mixLatLoad += mixing.DesiredAirFlowRate * AirDensity * (thisZoneHB.airHumRat - fromZoneHB.airHumRat) * H2OHtOfVap; } } @@ -2578,38 +2576,38 @@ void ReportAirHeatBalance(EnergyPlusData &state) AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, (thisZoneHB.MAT + fromZoneHB.MAT) / 2.0, - (thisZoneHB.ZoneAirHumRat + fromZoneHB.ZoneAirHumRat) / 2.0, + (thisZoneHB.airHumRat + fromZoneHB.airHumRat) / 2.0, std::string()); - CpAir = Psychrometrics::PsyCpAirFnW((thisZoneHB.ZoneAirHumRat + fromZoneHB.ZoneAirHumRat) / 2.0); + 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.ZoneAirHumRat + fromZoneHB.ZoneAirHumRat) / 2.0, - (thisZoneHB.MAT + fromZoneHB.MAT) / 2.0); + 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.ZoneAirHumRat - fromZoneHB.ZoneAirHumRat) * H2OHtOfVap; + mixLatLoad += crossMixing.DesiredAirFlowRate * AirDensity * (thisZoneHB.airHumRat - fromZoneHB.airHumRat) * H2OHtOfVap; } 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.ZoneAirHumRat + mixingZoneHB.ZoneAirHumRat) / 2.0, + (thisZoneHB.airHumRat + mixingZoneHB.airHumRat) / 2.0, std::string()); - CpAir = Psychrometrics::PsyCpAirFnW((thisZoneHB.ZoneAirHumRat + mixingZoneHB.ZoneAirHumRat) / 2.0); + 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.ZoneAirHumRat + mixingZoneHB.ZoneAirHumRat) / 2.0, - (thisZoneHB.MAT + mixingZoneHB.MAT) / 2.0); - mixLatLoad += crossMixing.DesiredAirFlowRate * AirDensity * (thisZoneHB.ZoneAirHumRat - mixingZoneHB.ZoneAirHumRat) * H2OHtOfVap; + H2OHtOfVap = + Psychrometrics::PsyHgAirFnWTdb((thisZoneHB.airHumRat + mixingZoneHB.airHumRat) / 2.0, (thisZoneHB.MAT + mixingZoneHB.MAT) / 2.0); + mixLatLoad += crossMixing.DesiredAirFlowRate * AirDensity * (thisZoneHB.airHumRat - mixingZoneHB.airHumRat) * H2OHtOfVap; } } @@ -2630,10 +2628,10 @@ void ReportAirHeatBalance(EnergyPlusData &state) AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, (thisZoneHB.MAT + zoneBHB.MAT) / 2.0, - (thisZoneHB.ZoneAirHumRat + zoneBHB.ZoneAirHumRat) / 2.0, + (thisZoneHB.airHumRat + zoneBHB.airHumRat) / 2.0, std::string()); - CpAir = Psychrometrics::PsyCpAirFnW((thisZoneHB.ZoneAirHumRat + zoneBHB.ZoneAirHumRat) / 2.0); - H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb((thisZoneHB.ZoneAirHumRat + zoneBHB.ZoneAirHumRat) / 2.0, + 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; @@ -2642,8 +2640,7 @@ void ReportAirHeatBalance(EnergyPlusData &state) 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.ZoneAirHumRat - zoneBHB.ZoneAirHumRat) * H2OHtOfVap; + mixLatLoad += refDoorMixing.VolRefDoorFlowRate(j) * AirDensity * (thisZoneHB.airHumRat - zoneBHB.airHumRat) * H2OHtOfVap; } // flow > 0 } // J-1, numref connections } // zone A (zoneptr = zoneloop) @@ -2659,10 +2656,10 @@ void ReportAirHeatBalance(EnergyPlusData &state) AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, (thisZoneHB.MAT + zoneAHB.MAT) / 2.0, - (thisZoneHB.ZoneAirHumRat + zoneAHB.ZoneAirHumRat) / 2.0, + (thisZoneHB.airHumRat + zoneAHB.airHumRat) / 2.0, std::string()); - CpAir = Psychrometrics::PsyCpAirFnW((thisZoneHB.ZoneAirHumRat + zoneAHB.ZoneAirHumRat) / 2.0); - H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb((thisZoneHB.ZoneAirHumRat + zoneAHB.ZoneAirHumRat) / 2.0, + 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; @@ -2671,8 +2668,8 @@ void ReportAirHeatBalance(EnergyPlusData &state) 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.ZoneAirHumRat - zoneAHB.ZoneAirHumRat) * H2OHtOfVap; + mixLatLoad += + refDoorMixingA.VolRefDoorFlowRate(j) * AirDensity * (thisZoneHB.airHumRat - zoneAHB.airHumRat) * H2OHtOfVap; } // volflowrate > 0 } // matezoneptr (zoneB) = Zonelooop } // NumRefDoorConnections @@ -2721,13 +2718,13 @@ void ReportAirHeatBalance(EnergyPlusData &state) znAirRpt.OABalanceHeatGain = -thisZoneHB.MDotCPOA * (thisZoneHB.MAT - zone.OutDryBulbTemp) * TimeStepSysSec * ADSCorrectionFactor; } H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(state.dataEnvrn->OutHumRat, zone.OutDryBulbTemp); - if (thisZoneHB.ZoneAirHumRat > state.dataEnvrn->OutHumRat) { - znAirRpt.OABalanceLatentLoss = thisZoneHB.MDotOA * (thisZoneHB.ZoneAirHumRat - state.dataEnvrn->OutHumRat) * H2OHtOfVap * - TimeStepSysSec * ADSCorrectionFactor; + 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.ZoneAirHumRat) * H2OHtOfVap * - TimeStepSysSec * ADSCorrectionFactor; + znAirRpt.OABalanceLatentGain = + thisZoneHB.MDotOA * (state.dataEnvrn->OutHumRat - thisZoneHB.airHumRat) * H2OHtOfVap * TimeStepSysSec * ADSCorrectionFactor; znAirRpt.OABalanceLatentLoss = 0.0; } // Total ventilation losses and gains @@ -2741,8 +2738,8 @@ void ReportAirHeatBalance(EnergyPlusData &state) } znAirRpt.OABalanceMass = (thisZoneHB.MDotOA) * TimeStepSysSec * ADSCorrectionFactor; znAirRpt.OABalanceMdot = (thisZoneHB.MDotOA) * ADSCorrectionFactor; - AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW( - state, state.dataEnvrn->OutBaroPress, thisZoneHB.MAT, thisZoneHB.ZoneAirHumRatAvg, std::string()); + 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; @@ -2774,7 +2771,7 @@ void ReportAirHeatBalance(EnergyPlusData &state) 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.ZoneAirHumRat - state.dataEnvrn->OutHumRat) * H2OHtOfVap; + znAirRpt.ExfilLatentLoss = znAirRpt.ExfilMass / TimeStepSysSec * (thisZoneHB.airHumRat - state.dataEnvrn->OutHumRat) * H2OHtOfVap; znAirRpt.ExfilTotalLoss = znAirRpt.ExfilLatentLoss + znAirRpt.ExfilSensiLoss; state.dataHeatBal->ZoneTotalExfiltrationHeatLoss += znAirRpt.ExfilTotalLoss * TimeStepSysSec; diff --git a/src/EnergyPlus/HeatBalanceAirManager.cc b/src/EnergyPlus/HeatBalanceAirManager.cc index 932fb3aa9b2..f178b160c34 100644 --- a/src/EnergyPlus/HeatBalanceAirManager.cc +++ b/src/EnergyPlus/HeatBalanceAirManager.cc @@ -4920,7 +4920,7 @@ void ReportZoneMeanAirTemp(EnergyPlusData &state) // temperature of the air temperatures at the system time step for the // entire zone time step. znAirRpt.MeanAirTemp = thisZoneHB.ZTAV; - znAirRpt.MeanAirHumRat = thisZoneHB.ZoneAirHumRatAvg; + znAirRpt.MeanAirHumRat = thisZoneHB.airHumRatAvg; znAirRpt.OperativeTemp = 0.5 * (thisZoneHB.ZTAV + state.dataHeatBal->ZoneMRT(ZoneLoop)); znAirRpt.MeanAirDewPointTemp = Psychrometrics::PsyTdpFnWPb(state, znAirRpt.MeanAirHumRat, state.dataEnvrn->OutBaroPress); diff --git a/src/EnergyPlus/HeatBalanceSurfaceManager.cc b/src/EnergyPlus/HeatBalanceSurfaceManager.cc index 3ccdd5a1640..99cf6bd61eb 100644 --- a/src/EnergyPlus/HeatBalanceSurfaceManager.cc +++ b/src/EnergyPlus/HeatBalanceSurfaceManager.cc @@ -2121,16 +2121,16 @@ void InitThermalAndFluxHistories(EnergyPlusData &state) new (&state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum)) ZoneTempPredictorCorrector::ZoneHeatBalanceData(); // Initialize the Zone Humidity Ratio here so that it is available for EMPD implementations auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum); - thisZoneHB.ZoneAirHumRatAvg = state.dataEnvrn->OutHumRat; - thisZoneHB.ZoneAirHumRat = state.dataEnvrn->OutHumRat; + thisZoneHB.airHumRatAvg = state.dataEnvrn->OutHumRat; + thisZoneHB.airHumRat = state.dataEnvrn->OutHumRat; state.dataHeatBalFanSys->TempTstatAir(zoneNum) = DataHeatBalance::ZoneInitialTemp; } // Reset spaceHeatBalance even if doSpaceHeatBalance is false, beause spaceHB is used to gether zoneHB in some cases for (auto &thisSpaceHB : state.dataZoneTempPredictorCorrector->spaceHeatBalance) { new (&thisSpaceHB) ZoneTempPredictorCorrector::SpaceHeatBalanceData(); // Initialize the Zone Humidity Ratio here so that it is available for EMPD implementations - thisSpaceHB.ZoneAirHumRatAvg = state.dataEnvrn->OutHumRat; - thisSpaceHB.ZoneAirHumRat = state.dataEnvrn->OutHumRat; + thisSpaceHB.airHumRatAvg = state.dataEnvrn->OutHumRat; + thisSpaceHB.airHumRat = state.dataEnvrn->OutHumRat; } // "Bulk" initializations of arrays sized to TotSurfaces @@ -5556,7 +5556,7 @@ void CalcThermalResilience(EnergyPlusData &state) Real64 constexpr c9 = -.00000199; for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { Real64 const ZoneT = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).ZTAV; - Real64 const ZoneW = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).ZoneAirHumRatAvg; + Real64 const ZoneW = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).airHumRatAvg; Real64 const ZoneRH = Psychrometrics::PsyRhFnTdbWPb(state, ZoneT, ZoneW, state.dataEnvrn->OutBaroPress) * 100.0; Real64 const ZoneTF = ZoneT * (9.0 / 5.0) + 32.0; Real64 HI; @@ -5578,7 +5578,7 @@ void CalcThermalResilience(EnergyPlusData &state) } if (state.dataHeatBalSurfMgr->reportVarHumidex || state.dataOutRptTab->displayThermalResilienceSummary) { for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { - Real64 const ZoneW = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).ZoneAirHumRatAvg; + Real64 const ZoneW = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).airHumRatAvg; Real64 const ZoneT = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).ZTAV; Real64 const TDewPointK = Psychrometrics::PsyTdpFnWPb(state, ZoneW, state.dataEnvrn->OutBaroPress) + Constant::KelvinConv; Real64 const e = 6.11 * std::exp(5417.7530 * ((1 / 273.16) - (1 / TDewPointK))); @@ -7691,7 +7691,7 @@ void CalcHeatBalanceInsideSurf2(EnergyPlusData &state, (surface.HeatTransferAlgorithm == DataSurfaces::HeatTransferModel::HAMT)) { int ZoneNum = surface.Zone; Real64 const MAT_zone(state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT); - Real64 const ZoneAirHumRat_zone(max(state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).ZoneAirHumRat, 1.0e-5)); + Real64 const ZoneAirHumRat_zone(max(state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).airHumRat, 1.0e-5)); Real64 const HConvIn_surf(state.dataMstBal->HConvInFD(SurfNum) = state.dataHeatBalSurf->SurfHConvInt(SurfNum)); state.dataMstBal->RhoVaporAirIn(SurfNum) = diff --git a/src/EnergyPlus/InternalHeatGains.cc b/src/EnergyPlus/InternalHeatGains.cc index eb5c5898dfc..b70a081bd61 100644 --- a/src/EnergyPlus/InternalHeatGains.cc +++ b/src/EnergyPlus/InternalHeatGains.cc @@ -7670,10 +7670,10 @@ namespace InternalHeatGains { for (int NZ = 1; NZ <= state.dataGlobal->NumOfZones; ++NZ) { auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(NZ); - thisZoneHB.ZoneLatentGain = InternalHeatGains::SumAllInternalLatentGains(state, NZ); // Also sets space gains + thisZoneHB.latentGain = InternalHeatGains::SumAllInternalLatentGains(state, NZ); // Also sets space gains // Added for hybrid model if (state.dataHybridModel->FlagHybridModel_PC) { - thisZoneHB.ZoneLatentGainExceptPeople = InternalHeatGains::SumAllInternalLatentGainsExceptPeople(state, NZ); // Also sets space gains + thisZoneHB.latentGainExceptPeople = InternalHeatGains::SumAllInternalLatentGainsExceptPeople(state, NZ); // Also sets space gains } } @@ -7929,14 +7929,14 @@ namespace InternalHeatGains { RecircFrac = state.dataHeatBal->ZoneITEq(Loop).DesignRecircFrac; } TRecirc = thisZoneHB.MAT; - WRecirc = thisZoneHB.ZoneAirHumRat; + WRecirc = thisZoneHB.airHumRat; TAirIn = TRecirc * RecircFrac + TSupply * (1.0 - RecircFrac); WAirIn = WRecirc * RecircFrac + WSupply * (1.0 - RecircFrac); } else if (AirConnection == ITEInletConnection::RoomAirModel) { // Room air model option: TAirIn=TAirZone, according to EngineeringRef 17.1.4 TAirIn = thisZoneHB.MAT; TSupply = TAirIn; - WAirIn = thisZoneHB.ZoneAirHumRat; + WAirIn = thisZoneHB.airHumRat; } else { // TAirIn = TRoomAirNodeIn, according to EngineeringRef 17.1.4 if (state.dataHeatBal->ZoneITEq(Loop).inControlledZone) { @@ -7946,7 +7946,7 @@ namespace InternalHeatGains { TSupply = thisZoneHB.MAT; } TAirIn = thisZoneHB.MAT; - WAirIn = thisZoneHB.ZoneAirHumRat; + WAirIn = thisZoneHB.airHumRat; } } TDPAirIn = PsyTdpFnWPb(state, WAirIn, state.dataEnvrn->StdBaroPress, RoutineName); @@ -8791,10 +8791,10 @@ namespace InternalHeatGains { if (SumLatentGains) { for (int NZ = 1; NZ <= state.dataGlobal->NumOfZones; ++NZ) { auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(NZ); - thisZoneHB.ZoneLatentGain = InternalHeatGains::SumAllInternalLatentGains(state, NZ); + thisZoneHB.latentGain = InternalHeatGains::SumAllInternalLatentGains(state, NZ); // Added for the hybrid model if (state.dataHybridModel->FlagHybridModel_PC) { - thisZoneHB.ZoneLatentGainExceptPeople = InternalHeatGains::SumAllInternalLatentGainsExceptPeople(state, NZ); + thisZoneHB.latentGainExceptPeople = InternalHeatGains::SumAllInternalLatentGainsExceptPeople(state, NZ); } } } @@ -9082,7 +9082,7 @@ namespace InternalHeatGains { for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) { SumLatentGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).LatentGainRate; } - state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).ZoneLatentGain = SumLatentGainRate; + state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).latentGain = SumLatentGainRate; } return SumLatentGainRate; @@ -9106,7 +9106,7 @@ namespace InternalHeatGains { SumLatentGainRateExceptPeople += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).LatentGainRate; } } - state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).ZoneLatentGainExceptPeople = SumLatentGainRateExceptPeople; + state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).latentGainExceptPeople = SumLatentGainRateExceptPeople; } return SumLatentGainRateExceptPeople; diff --git a/src/EnergyPlus/LowTempRadiantSystem.cc b/src/EnergyPlus/LowTempRadiantSystem.cc index 236f8a5aab4..ea6adb43d1b 100644 --- a/src/EnergyPlus/LowTempRadiantSystem.cc +++ b/src/EnergyPlus/LowTempRadiantSystem.cc @@ -3943,7 +3943,7 @@ namespace LowTempRadiantSystem { // conditions. this->CondCausedShutDown = false; DewPointTemp = - PsyTdpFnWPb(state, state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).ZoneAirHumRat, state.dataEnvrn->OutBaroPress); + PsyTdpFnWPb(state, state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).airHumRat, state.dataEnvrn->OutBaroPress); if ((this->OperatingMode == CoolingMode) && (variableFlowDesignDataObject.CondCtrlType == CondContrlType::CondCtrlSimpleOff)) { @@ -5039,7 +5039,7 @@ namespace LowTempRadiantSystem { // conditions. this->CondCausedShutDown = false; DewPointTemp = - PsyTdpFnWPb(state, state.dataZoneTempPredictorCorrector->zoneHeatBalance(this->ZonePtr).ZoneAirHumRat, state.dataEnvrn->OutBaroPress); + PsyTdpFnWPb(state, state.dataZoneTempPredictorCorrector->zoneHeatBalance(this->ZonePtr).airHumRat, state.dataEnvrn->OutBaroPress); if ((this->OperatingMode == CoolingMode) && (ConstantFlowDesignDataObject.CondCtrlType == CondContrlType::CondCtrlSimpleOff)) { diff --git a/src/EnergyPlus/MoistureBalanceEMPDManager.cc b/src/EnergyPlus/MoistureBalanceEMPDManager.cc index 8e3afafc520..ef351a49b10 100644 --- a/src/EnergyPlus/MoistureBalanceEMPDManager.cc +++ b/src/EnergyPlus/MoistureBalanceEMPDManager.cc @@ -371,7 +371,7 @@ void InitMoistureBalanceEMPD(EnergyPlusData &state) if (!state.dataSurface->Surface(SurfNum).HeatTransSurf) continue; Real64 const rv_air_in_initval = min(PsyRhovFnTdbWPb_fast(state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT, - max(state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).ZoneAirHumRat, 1.0e-5), + max(state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).airHumRat, 1.0e-5), state.dataEnvrn->OutBaroPress), PsyRhovFnTdbRh(state, state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT, 1.0, "InitMoistureBalanceEMPD")); state.dataMstBalEMPD->RVSurfaceOld(SurfNum) = rv_air_in_initval; @@ -558,8 +558,8 @@ void CalcMoistureBalanceEMPD(EnergyPlusData &state, auto const *material(dynamic_cast(state.dataMaterial->Material(MatNum))); assert(material != nullptr); if (material->EMPDmu <= 0.0) { - rv_surface = PsyRhovFnTdbWPb( - TempZone, state.dataZoneTempPredictorCorrector->zoneHeatBalance(surface.Zone).ZoneAirHumRat, state.dataEnvrn->OutBaroPress); + rv_surface = + PsyRhovFnTdbWPb(TempZone, state.dataZoneTempPredictorCorrector->zoneHeatBalance(surface.Zone).airHumRat, state.dataEnvrn->OutBaroPress); return; } diff --git a/src/EnergyPlus/MundtSimMgr.cc b/src/EnergyPlus/MundtSimMgr.cc index 901859e3561..8643d45ff55 100644 --- a/src/EnergyPlus/MundtSimMgr.cc +++ b/src/EnergyPlus/MundtSimMgr.cc @@ -381,7 +381,7 @@ namespace RoomAir { for (NodeNum = 1; NodeNum <= state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).NumInletNodes; ++NodeNum) { NodeTemp = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).InletNode(NodeNum)).Temp; MassFlowRate = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).InletNode(NodeNum)).MassFlowRate; - CpAir = PsyCpAirFnW(thisZoneHB.ZoneAirHumRat); + CpAir = PsyCpAirFnW(thisZoneHB.airHumRat); SumSysMCp += MassFlowRate * CpAir; SumSysMCpT += MassFlowRate * CpAir * NodeTemp; } @@ -394,7 +394,7 @@ namespace RoomAir { state.dataMundtSimMgr->SupplyAirTemp = SumSysMCpT / SumSysMCp; } // determine cooling load - CpAir = PsyCpAirFnW(thisZoneHB.ZoneAirHumRat); + CpAir = PsyCpAirFnW(thisZoneHB.airHumRat); state.dataMundtSimMgr->QsysCoolTot = -(SumSysMCpT - ZoneMassFlowRate * CpAir * state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT); } diff --git a/src/EnergyPlus/PurchasedAirManager.cc b/src/EnergyPlus/PurchasedAirManager.cc index 6372676ccf4..8eefba36306 100644 --- a/src/EnergyPlus/PurchasedAirManager.cc +++ b/src/EnergyPlus/PurchasedAirManager.cc @@ -2255,7 +2255,7 @@ void CalcPurchAirLoads(EnergyPlusData &state, state.dataLoopNodes->Node(PurchAir(PurchAirNum).ZoneRecircAirNodeNum).Enthalpy))) { // Calculate supply MassFlowRate based on sensible load but limit to Max Cooling Supply Air Flow Rate if specified - CpAir = PsyCpAirFnW(thisZoneHB.ZoneAirHumRat); + CpAir = PsyCpAirFnW(thisZoneHB.airHumRat); DeltaT = (state.dataLoopNodes->Node(OANodeNum).Temp - state.dataLoopNodes->Node(ZoneNodeNum).Temp); if (DeltaT < -SmallTempDiff) { SupplyMassFlowRate = QZnCoolSP / CpAir / DeltaT; @@ -2278,7 +2278,7 @@ void CalcPurchAirLoads(EnergyPlusData &state, // Mass flow rate to meet sensible load, at Minimum Cooling Supply Air Temperature SupplyMassFlowRateForCool = 0.0; if (CoolOn) { - CpAir = PsyCpAirFnW(thisZoneHB.ZoneAirHumRat); + CpAir = PsyCpAirFnW(thisZoneHB.airHumRat); DeltaT = (PurchAir(PurchAirNum).MinCoolSuppAirTemp - state.dataLoopNodes->Node(ZoneNodeNum).Temp); if (DeltaT < -SmallTempDiff) { SupplyMassFlowRateForCool = QZnCoolSP / CpAir / DeltaT; @@ -2353,7 +2353,7 @@ void CalcPurchAirLoads(EnergyPlusData &state, // In general, in the cooling section, don't let SupplyTemp be set to something that results in heating if (SupplyMassFlowRate > 0.0) { // Calculate supply temp at SupplyMassFlowRate and recheck limit on Minimum Cooling Supply Air Temperature - CpAir = PsyCpAirFnW(thisZoneHB.ZoneAirHumRat); + CpAir = PsyCpAirFnW(thisZoneHB.airHumRat); PurchAir(PurchAirNum).SupplyTemp = QZnCoolSP / (CpAir * SupplyMassFlowRate) + state.dataLoopNodes->Node(ZoneNodeNum).Temp; PurchAir(PurchAirNum).SupplyTemp = max(PurchAir(PurchAirNum).SupplyTemp, PurchAir(PurchAirNum).MinCoolSuppAirTemp); // This is the cooling mode, so SupplyTemp can't be more than MixedAirTemp @@ -2567,7 +2567,7 @@ void CalcPurchAirLoads(EnergyPlusData &state, // Mass flow rate to meet sensible load, at Minimum Cooling Supply Air Temperature SupplyMassFlowRateForHeat = 0.0; if ((HeatOn) && (OperatingMode == OpMode::Heat)) { - CpAir = PsyCpAirFnW(thisZoneHB.ZoneAirHumRat); + CpAir = PsyCpAirFnW(thisZoneHB.airHumRat); DeltaT = (PurchAir(PurchAirNum).MaxHeatSuppAirTemp - state.dataLoopNodes->Node(ZoneNodeNum).Temp); if (DeltaT > SmallTempDiff) { SupplyMassFlowRateForHeat = QZnHeatSP / CpAir / DeltaT; @@ -2643,7 +2643,7 @@ void CalcPurchAirLoads(EnergyPlusData &state, if (SupplyMassFlowRate > 0.0) { if ((HeatOn) && (OperatingMode == OpMode::Heat)) { // Calculate supply temp at SupplyMassFlowRate and check limit on Maximum Heating Supply Air Temperature - CpAir = PsyCpAirFnW(thisZoneHB.ZoneAirHumRat); + CpAir = PsyCpAirFnW(thisZoneHB.airHumRat); PurchAir(PurchAirNum).SupplyTemp = QZnHeatSP / (CpAir * SupplyMassFlowRate) + state.dataLoopNodes->Node(ZoneNodeNum).Temp; PurchAir(PurchAirNum).SupplyTemp = min(PurchAir(PurchAirNum).SupplyTemp, PurchAir(PurchAirNum).MaxHeatSuppAirTemp); // This is the heating mode, so SupplyTemp can't be less than MixedAirTemp @@ -2831,7 +2831,7 @@ void CalcPurchAirLoads(EnergyPlusData &state, SupplyEnthalpy = PsyHFnTdbW(PurchAir(PurchAirNum).SupplyTemp, PurchAir(PurchAirNum).SupplyHumRat); - CpAir = PsyCpAirFnW(thisZoneHB.ZoneAirHumRat); + CpAir = PsyCpAirFnW(thisZoneHB.airHumRat); SysOutputProvided = SupplyMassFlowRate * CpAir * (PurchAir(PurchAirNum).SupplyTemp - state.dataLoopNodes->Node(ZoneNodeNum).Temp); MoistOutputProvided = SupplyMassFlowRate * (PurchAir(PurchAirNum).SupplyHumRat - state.dataLoopNodes->Node(ZoneNodeNum).HumRat); // Latent rate, kg/s @@ -2840,7 +2840,7 @@ void CalcPurchAirLoads(EnergyPlusData &state, PurchAir(PurchAirNum).LatOutputToZone = SupplyMassFlowRate * (SupplyEnthalpy - state.dataLoopNodes->Node(ZoneNodeNum).Enthalpy) - PurchAir(PurchAirNum).SenOutputToZone; - CpAir = PsyCpAirFnW(thisZoneHB.ZoneAirHumRat); + CpAir = PsyCpAirFnW(thisZoneHB.airHumRat); if (PurchAir(PurchAirNum).OutdoorAir) { PurchAir(PurchAirNum).OASenOutput = OAMassFlowRate * CpAir * (state.dataLoopNodes->Node(OANodeNum).Temp - state.dataLoopNodes->Node(ZoneNodeNum).Temp); diff --git a/src/EnergyPlus/RoomAirModelAirflowNetwork.cc b/src/EnergyPlus/RoomAirModelAirflowNetwork.cc index e482cb1b0d0..b645d9c72bb 100644 --- a/src/EnergyPlus/RoomAirModelAirflowNetwork.cc +++ b/src/EnergyPlus/RoomAirModelAirflowNetwork.cc @@ -735,7 +735,7 @@ namespace RoomAir { for (auto const &afnHVAC : afnNode.HVAC) { if (afnHVAC.SupNodeNum == zoneEquipConfig.InletNode(iNode)) { Real64 MassFlowRate = inletNode.MassFlowRate * afnHVAC.SupplyFraction; - Real64 CpAir = PsyCpAirFnW(zoneHB.ZoneAirHumRat); + Real64 CpAir = PsyCpAirFnW(zoneHB.airHumRat); SumSysMCp += MassFlowRate * CpAir; SumSysMCpT += MassFlowRate * CpAir * inletNode.Temp; SumSysM += MassFlowRate; @@ -748,7 +748,7 @@ namespace RoomAir { for (int iNode = 1; iNode <= zoneRetPlenum.NumInletNodes; ++iNode) { // Get node conditions auto const &zoneRetPlenumNode = state.dataLoopNodes->Node(zoneRetPlenum.InletNode(iNode)); - Real64 CpAir = PsyCpAirFnW(zoneHB.ZoneAirHumRat); + Real64 CpAir = PsyCpAirFnW(zoneHB.airHumRat); SumSysMCp += zoneRetPlenumNode.MassFlowRate * CpAir; SumSysMCpT += zoneRetPlenumNode.MassFlowRate * CpAir * zoneRetPlenumNode.Temp; } // NodeNum @@ -757,12 +757,12 @@ namespace RoomAir { int ADUNum = zoneRetPlenum.ADUIndex(iADU); auto const &adu = state.dataDefineEquipment->AirDistUnit(ADUNum); if (adu.UpStreamLeak) { - Real64 CpAir = PsyCpAirFnW(zoneHB.ZoneAirHumRat); + Real64 CpAir = PsyCpAirFnW(zoneHB.airHumRat); SumSysMCp += adu.MassFlowRateUpStrLk * CpAir; SumSysMCpT += adu.MassFlowRateUpStrLk * CpAir * state.dataLoopNodes->Node(adu.InletNodeNum).Temp; } if (adu.DownStreamLeak) { - Real64 CpAir = PsyCpAirFnW(zoneHB.ZoneAirHumRat); + Real64 CpAir = PsyCpAirFnW(zoneHB.airHumRat); SumSysMCp += adu.MassFlowRateDnStrLk * CpAir; SumSysMCpT += adu.MassFlowRateDnStrLk * CpAir * state.dataLoopNodes->Node(adu.OutletNodeNum).Temp; } @@ -771,7 +771,7 @@ namespace RoomAir { // Get node conditions auto const &zoneSupPlenum = state.dataZonePlenum->ZoneSupPlenCond(zoneSupPlenumNum); auto const &inletNode = state.dataLoopNodes->Node(zoneSupPlenum.InletNode); - Real64 CpAir = PsyCpAirFnW(zoneHB.ZoneAirHumRat); + Real64 CpAir = PsyCpAirFnW(zoneHB.airHumRat); SumSysMCp += inletNode.MassFlowRate * CpAir; SumSysMCpT += inletNode.MassFlowRate * CpAir * inletNode.Temp; } diff --git a/src/EnergyPlus/RoomAirModelManager.cc b/src/EnergyPlus/RoomAirModelManager.cc index 5f3369b7a75..817041a80cd 100644 --- a/src/EnergyPlus/RoomAirModelManager.cc +++ b/src/EnergyPlus/RoomAirModelManager.cc @@ -2001,10 +2001,10 @@ namespace RoomAir { AirflowNetwork::iComponentTypeNum::SCR) { // surface type = CRACK surfParams.Width = mzSurf.Width / 2; auto const &zoneHeatBal = state.dataZoneTempPredictorCorrector->zoneHeatBalance(iZone); - Real64 AinCV = state.afn->MultizoneSurfaceCrackData(typeNum).coefficient / - (BaseDischargeCoef * - std::sqrt(2.0 / PsyRhoAirFnPbTdbW( - state, state.dataEnvrn->OutBaroPress, zoneHeatBal.MAT, zoneHeatBal.ZoneAirHumRat))); + Real64 AinCV = + state.afn->MultizoneSurfaceCrackData(typeNum).coefficient / + (BaseDischargeCoef * + std::sqrt(2.0 / PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, zoneHeatBal.MAT, zoneHeatBal.airHumRat))); surfParams.Height = AinCV / surfParams.Width; } diff --git a/src/EnergyPlus/RoomAirModelUserTempPattern.cc b/src/EnergyPlus/RoomAirModelUserTempPattern.cc index f8ae9171169..e275c1499ba 100644 --- a/src/EnergyPlus/RoomAirModelUserTempPattern.cc +++ b/src/EnergyPlus/RoomAirModelUserTempPattern.cc @@ -745,14 +745,14 @@ void SetSurfHBDataForTempDistModel(EnergyPlusData &state, int const ZoneNum) // state.dataHeatBal->RefrigCaseCredit(ZoneNum).LatCaseCreditToZone += state.dataHeatBal->RefrigCaseCredit(ZoneNum).LatCaseCreditToHVAC; // shouldn't the HVAC term be zeroed out then? Real64 SumRetAirLatentGainRate = SumAllReturnAirLatentGains(state, ZoneNum, 0); - zoneHeatBal.ZoneLatentGain += SumRetAirLatentGainRate; + zoneHeatBal.latentGain += SumRetAirLatentGainRate; } } else { returnNode.HumRat = zoneNode.HumRat; state.dataHeatBal->RefrigCaseCredit(ZoneNum).LatCaseCreditToZone += state.dataHeatBal->RefrigCaseCredit(ZoneNum).LatCaseCreditToHVAC; // shouldn't the HVAC term be zeroed out then? - zoneHeatBal.ZoneLatentGain += SumAllReturnAirLatentGains(state, ZoneNum, returnNodeNum); + zoneHeatBal.latentGain += SumAllReturnAirLatentGains(state, ZoneNum, returnNodeNum); } returnNode.Enthalpy = PsyHFnTdbW(returnNode.Temp, returnNode.HumRat); diff --git a/src/EnergyPlus/SwimmingPool.cc b/src/EnergyPlus/SwimmingPool.cc index 1752b9fd7f4..9c3433dfab8 100644 --- a/src/EnergyPlus/SwimmingPool.cc +++ b/src/EnergyPlus/SwimmingPool.cc @@ -909,10 +909,10 @@ void SwimmingPoolData::calculate(EnergyPlusData &state) // Convection coefficient calculation Real64 HConvIn = 0.22 * std::pow(std::abs(this->PoolWaterTemp - thisZoneHB.MAT), 1.0 / 3.0) * this->CurCoverConvFac; // convection coefficient for pool - calcSwimmingPoolEvap(state, EvapRate, SurfNum, thisZoneHB.MAT, thisZoneHB.ZoneAirHumRat); + calcSwimmingPoolEvap(state, EvapRate, SurfNum, thisZoneHB.MAT, thisZoneHB.airHumRat); this->MakeUpWaterMassFlowRate = EvapRate; Real64 EvapEnergyLossPerArea = -EvapRate * - Psychrometrics::PsyHfgAirFnWTdb(thisZoneHB.ZoneAirHumRat, + Psychrometrics::PsyHfgAirFnWTdb(thisZoneHB.airHumRat, thisZoneHB.MAT) / state.dataSurface->Surface(SurfNum).Area; // energy effect of evaporation rate per unit area in W/m2 this->EvapHeatLossRate = EvapEnergyLossPerArea * state.dataSurface->Surface(SurfNum).Area; @@ -965,7 +965,7 @@ void SwimmingPoolData::calculate(EnergyPlusData &state) // Finally take care of the latent and convective gains resulting from the pool state.dataHeatBalFanSys->SumConvPool(ZoneNum) += this->RadConvertToConvect; - state.dataHeatBalFanSys->SumLatentPool(ZoneNum) += EvapRate * Psychrometrics::PsyHfgAirFnWTdb(thisZoneHB.ZoneAirHumRat, thisZoneHB.MAT); + state.dataHeatBalFanSys->SumLatentPool(ZoneNum) += EvapRate * Psychrometrics::PsyHfgAirFnWTdb(thisZoneHB.airHumRat, thisZoneHB.MAT); } void SwimmingPoolData::calcSwimmingPoolEvap(EnergyPlusData &state, diff --git a/src/EnergyPlus/SystemAvailabilityManager.cc b/src/EnergyPlus/SystemAvailabilityManager.cc index 132927a7847..c23e3f5c8fb 100644 --- a/src/EnergyPlus/SystemAvailabilityManager.cc +++ b/src/EnergyPlus/SystemAvailabilityManager.cc @@ -4703,7 +4703,7 @@ namespace SystemAvailabilityManager { // Enthalpy control } break; case HybridVentMode_Enth: { - ZoneAirEnthalpy = PsyHFnTdbW(thisZoneHB.MAT, thisZoneHB.ZoneAirHumRat); + ZoneAirEnthalpy = PsyHFnTdbW(thisZoneHB.MAT, thisZoneHB.airHumRat); if (state.dataEnvrn->OutEnthalpy >= hybridVentMgr.MinOutdoorEnth && state.dataEnvrn->OutEnthalpy <= hybridVentMgr.MaxOutdoorEnth) { hybridVentMgr.VentilationCtrl = HybridVentCtrl_Open; } else { @@ -4874,8 +4874,8 @@ namespace SystemAvailabilityManager { // Dew point control mode if (hybridVentMgr.ControlMode == HybridVentMode_DewPoint) { - ZoneAirRH = PsyRhFnTdbWPb(state, thisZoneHB.MAT, thisZoneHB.ZoneAirHumRat, state.dataEnvrn->OutBaroPress) * 100.0; - ZoneAirDewPoint = PsyTdpFnWPb(state, thisZoneHB.ZoneAirHumRat, state.dataEnvrn->OutBaroPress); + ZoneAirRH = PsyRhFnTdbWPb(state, thisZoneHB.MAT, thisZoneHB.airHumRat, state.dataEnvrn->OutBaroPress) * 100.0; + ZoneAirDewPoint = PsyTdpFnWPb(state, thisZoneHB.airHumRat, state.dataEnvrn->OutBaroPress); if (state.dataZoneCtrls->NumHumidityControlZones == 0) { ++hybridVentMgr.DewPointNoRHErrCount; if (hybridVentMgr.DewPointNoRHErrCount < 2) { diff --git a/src/EnergyPlus/SystemReports.cc b/src/EnergyPlus/SystemReports.cc index e58ec442f40..7a481321d85 100644 --- a/src/EnergyPlus/SystemReports.cc +++ b/src/EnergyPlus/SystemReports.cc @@ -4458,7 +4458,7 @@ void ReportVentilationLoads(EnergyPlusData &state) Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataZoneTempPredictorCorrector->zoneHeatBalance(CtrlZoneNum).MAT, - state.dataZoneTempPredictorCorrector->zoneHeatBalance(CtrlZoneNum).ZoneAirHumRatAvg); + state.dataZoneTempPredictorCorrector->zoneHeatBalance(CtrlZoneNum).airHumRatAvg); if (currentZoneAirDensity > 0.0) thisZoneVentRepVars.OAVolFlowCrntRho = thisZoneVentRepVars.OAMassFlow / currentZoneAirDensity; thisZoneVentRepVars.OAVolCrntRho = thisZoneVentRepVars.OAVolFlowCrntRho * TimeStepSysSec; if (ZoneVolume > 0.0) thisZoneVentRepVars.MechACH = (thisZoneVentRepVars.OAVolCrntRho / TimeStepSys) / ZoneVolume; diff --git a/src/EnergyPlus/ThermalChimney.cc b/src/EnergyPlus/ThermalChimney.cc index 32e22c9a280..b916c39c5be 100644 --- a/src/EnergyPlus/ThermalChimney.cc +++ b/src/EnergyPlus/ThermalChimney.cc @@ -765,8 +765,8 @@ namespace ThermalChimney { AbsorberWallWidthTC = state.dataThermalChimneys->ThermalChimneySys(Loop).AbsorberWallWidth; } - AirDensityThermalChim = PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, thisZoneHB.MAT, thisZoneHB.ZoneAirHumRat); - AirSpecHeatThermalChim = PsyCpAirFnW(thisZoneHB.ZoneAirHumRat); + AirDensityThermalChim = PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, thisZoneHB.MAT, thisZoneHB.airHumRat); + AirSpecHeatThermalChim = PsyCpAirFnW(thisZoneHB.airHumRat); AirOutletCrossAreaTC = state.dataThermalChimneys->ThermalChimneySys(Loop).AirOutletCrossArea; DischargeCoeffTC = state.dataThermalChimneys->ThermalChimneySys(Loop).DischargeCoeff; @@ -788,11 +788,11 @@ namespace ThermalChimney { for (TCZoneNum = 1; TCZoneNum <= state.dataThermalChimneys->ThermalChimneySys(Loop).TotZoneToDistrib; ++TCZoneNum) { TCZoneNumCounter = state.dataThermalChimneys->ThermalChimneySys(Loop).ZonePtr(TCZoneNum); auto &thisTCZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(TCZoneNumCounter); - Process1 += PsyHFnTdbW(thisTCZoneHB.MAT, thisTCZoneHB.ZoneAirHumRat) * + Process1 += PsyHFnTdbW(thisTCZoneHB.MAT, thisTCZoneHB.airHumRat) * state.dataThermalChimneys->ThermalChimneySys(Loop).DistanceThermChimInlet(TCZoneNum) * state.dataThermalChimneys->ThermalChimneySys(Loop).RatioThermChimAirFlow(TCZoneNum); Process2 += state.dataThermalChimneys->ThermalChimneySys(Loop).RatioThermChimAirFlow(TCZoneNum) * - PsyHFnTdbW(state.dataZoneTempPredictorCorrector->zoneHeatBalance(TCZoneNumCounter).MAT, thisTCZoneHB.ZoneAirHumRat); + PsyHFnTdbW(state.dataZoneTempPredictorCorrector->zoneHeatBalance(TCZoneNumCounter).MAT, thisTCZoneHB.airHumRat); } OverallThermalChimLength = Process1 / Process2; @@ -894,8 +894,8 @@ namespace ThermalChimney { AirDensity = PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataZoneTempPredictorCorrector->zoneHeatBalance(TCZoneNumCounter).MAT, - thisTCZoneHB.ZoneAirHumRat); - CpAir = PsyCpAirFnW(thisTCZoneHB.ZoneAirHumRat); + thisTCZoneHB.airHumRat); + CpAir = PsyCpAirFnW(thisTCZoneHB.airHumRat); thisTCZoneHB.MCPThermChim = TCVolumeAirFlowRate * AirDensity * CpAir * state.dataThermalChimneys->ThermalChimneySys(Loop).RatioThermChimAirFlow(TCZoneNum); if (thisTCZoneHB.MCPThermChim <= 0.0) { @@ -965,8 +965,8 @@ namespace ThermalChimney { // Break the infiltration load into heat gain and loss components. AirDensity = PsyRhoAirFnPbTdbW( - state, state.dataEnvrn->OutBaroPress, state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneLoop).MAT, thisZoneHB.ZoneAirHumRat); - CpAir = PsyCpAirFnW(thisZoneHB.ZoneAirHumRat); + state, state.dataEnvrn->OutBaroPress, state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneLoop).MAT, thisZoneHB.airHumRat); + CpAir = PsyCpAirFnW(thisZoneHB.airHumRat); state.dataThermalChimneys->ZnRptThermChim(ZoneLoop).ThermalChimneyVolume = (thisZoneHB.MCPThermChim / CpAir / AirDensity) * TimeStepSysSec; state.dataThermalChimneys->ZnRptThermChim(ZoneLoop).ThermalChimneyMass = (thisZoneHB.MCPThermChim / CpAir) * TimeStepSysSec; diff --git a/src/EnergyPlus/ThermalComfort.cc b/src/EnergyPlus/ThermalComfort.cc index 94c42adaf59..cdce19a7213 100644 --- a/src/EnergyPlus/ThermalComfort.cc +++ b/src/EnergyPlus/ThermalComfort.cc @@ -556,11 +556,11 @@ namespace ThermalComfort { state.dataThermalComforts->RelHum = PsyRhFnTdbWPb(state, state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.dataThermalComforts->ZoneNum).MAT, - thisZoneHB.ZoneAirHumRatAvgComf, + thisZoneHB.airHumRatAvgComf, state.dataEnvrn->OutBaroPress); } else { state.dataThermalComforts->RelHum = - PsyRhFnTdbWPb(state, state.dataThermalComforts->AirTemp, thisZoneHB.ZoneAirHumRatAvgComf, state.dataEnvrn->OutBaroPress); + PsyRhFnTdbWPb(state, state.dataThermalComforts->AirTemp, thisZoneHB.airHumRatAvgComf, state.dataEnvrn->OutBaroPress); } state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).TemperatureInZone = state.dataThermalComforts->AirTemp; state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).RelativeHumidityInZone = state.dataThermalComforts->RelHum * 100.0; @@ -836,7 +836,7 @@ namespace ThermalComfort { state.dataThermalComforts->RadTemp = CalcRadTemp(state, state.dataThermalComforts->PeopleNum); // (var RH) state.dataThermalComforts->RelHum = - PsyRhFnTdbWPb(state, state.dataThermalComforts->AirTemp, thisZoneHB.ZoneAirHumRatAvgComf, state.dataEnvrn->OutBaroPress); + PsyRhFnTdbWPb(state, state.dataThermalComforts->AirTemp, thisZoneHB.airHumRatAvgComf, state.dataEnvrn->OutBaroPress); // Metabolic rate of body (W/m2) (var RM, M) state.dataThermalComforts->ActLevel = GetCurrentScheduleValue(state, state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).ActivityLevelPtr) / BodySurfAreaPierce; @@ -1482,7 +1482,7 @@ namespace ThermalComfort { } state.dataThermalComforts->RadTemp = CalcRadTemp(state, state.dataThermalComforts->PeopleNum); state.dataThermalComforts->RelHum = - PsyRhFnTdbWPb(state, state.dataThermalComforts->AirTemp, thisZoneHB.ZoneAirHumRatAvgComf, state.dataEnvrn->OutBaroPress); + PsyRhFnTdbWPb(state, state.dataThermalComforts->AirTemp, thisZoneHB.airHumRatAvgComf, state.dataEnvrn->OutBaroPress); state.dataThermalComforts->ActLevel = GetCurrentScheduleValue(state, state.dataHeatBal->People(state.dataThermalComforts->PeopleNum).ActivityLevelPtr) / BodySurfArea; state.dataThermalComforts->WorkEff = @@ -2353,10 +2353,10 @@ namespace ThermalComfort { // 8 25.1 Summer 0.000 // check summer clothing conditions isComfortableWithSummerClothes = - isInQuadrilateral(OperTemp, thisZoneHB.ZoneAirHumRatAvgComf, 25.1, 0.0, 23.6, 0.012, 26.8, 0.012, 28.3, 0.0); + isInQuadrilateral(OperTemp, thisZoneHB.airHumRatAvgComf, 25.1, 0.0, 23.6, 0.012, 26.8, 0.012, 28.3, 0.0); // check winter clothing conditions isComfortableWithWinterClothes = - isInQuadrilateral(OperTemp, thisZoneHB.ZoneAirHumRatAvgComf, 21.7, 0.0, 19.6, 0.012, 23.9, 0.012, 26.3, 0.0); + isInQuadrilateral(OperTemp, thisZoneHB.airHumRatAvgComf, 21.7, 0.0, 19.6, 0.012, 23.9, 0.012, 26.3, 0.0); if (isComfortableWithSummerClothes) { state.dataThermalComforts->ThermalComfortInASH55(iZone).timeNotSummer = 0.0; } else { diff --git a/src/EnergyPlus/UFADManager.cc b/src/EnergyPlus/UFADManager.cc index c8159bb98b8..7b6bf1b4aaa 100644 --- a/src/EnergyPlus/UFADManager.cc +++ b/src/EnergyPlus/UFADManager.cc @@ -808,10 +808,10 @@ namespace RoomAir { for (int InNodeIndex = 1; InNodeIndex <= zoneEquipConfig.NumInletNodes; ++InNodeIndex) { Real64 NodeTemp = state.dataLoopNodes->Node(zoneEquipConfig.InletNode(InNodeIndex)).Temp; Real64 MassFlowRate = state.dataLoopNodes->Node(zoneEquipConfig.InletNode(InNodeIndex)).MassFlowRate; - Real64 CpAir = PsyCpAirFnW(thisZoneHB.ZoneAirHumRat); + Real64 CpAir = PsyCpAirFnW(thisZoneHB.airHumRat); SumSysMCp += MassFlowRate * CpAir; SumSysMCpT += MassFlowRate * CpAir * NodeTemp; - TotSysFlow += MassFlowRate / PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, NodeTemp, thisZoneHB.ZoneAirHumRat); + TotSysFlow += MassFlowRate / PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, NodeTemp, thisZoneHB.airHumRat); TSupK += MassFlowRate * NodeTemp; SumSysM += MassFlowRate; } @@ -883,13 +883,13 @@ namespace RoomAir { state.dataHeatBal->Zone(ZoneNum).Volume * (state.dataRoomAir->HeightTransition(ZoneNum) - min(state.dataRoomAir->HeightTransition(ZoneNum), 0.2)) / CeilingHeight * state.dataHeatBal->Zone(ZoneNum).ZoneVolCapMultpSens * - PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAir->MATOC(ZoneNum), thisZoneHB.ZoneAirHumRat) * - PsyCpAirFnW(thisZoneHB.ZoneAirHumRat) / TimeStepSysSec; + PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAir->MATOC(ZoneNum), thisZoneHB.airHumRat) * + PsyCpAirFnW(thisZoneHB.airHumRat) / TimeStepSysSec; state.dataRoomAir->AIRRATMX(ZoneNum) = state.dataHeatBal->Zone(ZoneNum).Volume * (CeilingHeight - state.dataRoomAir->HeightTransition(ZoneNum)) / CeilingHeight * state.dataHeatBal->Zone(ZoneNum).ZoneVolCapMultpSens * - PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAir->MATMX(ZoneNum), thisZoneHB.ZoneAirHumRat) * - PsyCpAirFnW(thisZoneHB.ZoneAirHumRat) / TimeStepSysSec; + PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAir->MATMX(ZoneNum), thisZoneHB.airHumRat) * + PsyCpAirFnW(thisZoneHB.airHumRat) / TimeStepSysSec; if (state.dataHVACGlobal->UseZoneTimeStepHistory) { state.dataRoomAir->ZTMOC(ZoneNum)[2] = state.dataRoomAir->XMATOC(ZoneNum)[2]; @@ -995,7 +995,7 @@ namespace RoomAir { for (int Ctd = 1; Ctd <= 3; ++Ctd) { Real64 TempDepCoef = ufadCC.HA_MX + ufadCC.HA_OC + MCp_Total; - Real64 const thisZoneT1 = thisZoneHB.ZoneT1; + Real64 const thisZoneT1 = thisZoneHB.T1; // Formerly CoefSumhat, coef in zone temp equation with dimensions of h*A(T1 Real64 TempIndCoef = ConvGains + ufadCC.HAT_MX + ufadCC.HAT_OC + MCpT_Total; switch (state.dataHeatBal->ZoneAirSolutionAlgo) { @@ -1231,10 +1231,10 @@ namespace RoomAir { for (int InNodeIndex = 1; InNodeIndex <= zoneEquipConfig.NumInletNodes; ++InNodeIndex) { Real64 NodeTemp = state.dataLoopNodes->Node(zoneEquipConfig.InletNode(InNodeIndex)).Temp; Real64 MassFlowRate = state.dataLoopNodes->Node(zoneEquipConfig.InletNode(InNodeIndex)).MassFlowRate; - Real64 CpAir = PsyCpAirFnW(thisZoneHB.ZoneAirHumRat); + Real64 CpAir = PsyCpAirFnW(thisZoneHB.airHumRat); SumSysMCp += MassFlowRate * CpAir; SumSysMCpT += MassFlowRate * CpAir * NodeTemp; - TotSysFlow += MassFlowRate / PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, NodeTemp, thisZoneHB.ZoneAirHumRat); + TotSysFlow += MassFlowRate / PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, NodeTemp, thisZoneHB.airHumRat); TSupK += MassFlowRate * NodeTemp; SumSysM += MassFlowRate; } @@ -1343,13 +1343,13 @@ namespace RoomAir { state.dataHeatBal->Zone(ZoneNum).Volume * (state.dataRoomAir->HeightTransition(ZoneNum) - min(state.dataRoomAir->HeightTransition(ZoneNum), 0.2)) / CeilingHeight * state.dataHeatBal->Zone(ZoneNum).ZoneVolCapMultpSens * - PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAir->MATOC(ZoneNum), thisZoneHB.ZoneAirHumRat) * - PsyCpAirFnW(thisZoneHB.ZoneAirHumRat) / TimeStepSysSec; + PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAir->MATOC(ZoneNum), thisZoneHB.airHumRat) * + PsyCpAirFnW(thisZoneHB.airHumRat) / TimeStepSysSec; state.dataRoomAir->AIRRATMX(ZoneNum) = state.dataHeatBal->Zone(ZoneNum).Volume * (CeilingHeight - state.dataRoomAir->HeightTransition(ZoneNum)) / CeilingHeight * state.dataHeatBal->Zone(ZoneNum).ZoneVolCapMultpSens * - PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAir->MATMX(ZoneNum), thisZoneHB.ZoneAirHumRat) * - PsyCpAirFnW(thisZoneHB.ZoneAirHumRat) / TimeStepSysSec; + PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAir->MATMX(ZoneNum), thisZoneHB.airHumRat) * + PsyCpAirFnW(thisZoneHB.airHumRat) / TimeStepSysSec; if (state.dataHVACGlobal->UseZoneTimeStepHistory) { state.dataRoomAir->ZTMOC(ZoneNum)[2] = state.dataRoomAir->XMATOC(ZoneNum)[2]; @@ -1448,7 +1448,7 @@ namespace RoomAir { HeightFrac * CeilingHeight < state.dataUFADManager->ThickOccupiedSubzoneMin) { MIXFLAG = true; HeightFrac = 0.0; - Real64 const thisZoneT1 = thisZoneHB.ZoneT1; + Real64 const thisZoneT1 = thisZoneHB.T1; state.dataRoomAir->AvgTempGrad(ZoneNum) = 0.0; state.dataRoomAir->MaxTempGrad(ZoneNum) = 0.0; diff --git a/src/EnergyPlus/UnitarySystem.cc b/src/EnergyPlus/UnitarySystem.cc index d1eb022ebd2..ba8eae3be5e 100644 --- a/src/EnergyPlus/UnitarySystem.cc +++ b/src/EnergyPlus/UnitarySystem.cc @@ -8221,7 +8221,7 @@ namespace UnitarySystems { this->LoadSHR = ZoneLoad / (ZoneLoad + state.dataUnitarySystems->MoistureLoad * Psychrometrics::PsyHgAirFnWTdb( - state.dataZoneTempPredictorCorrector->zoneHeatBalance(this->ControlZoneNum).ZoneAirHumRat, + state.dataZoneTempPredictorCorrector->zoneHeatBalance(this->ControlZoneNum).airHumRat, state.dataZoneTempPredictorCorrector->zoneHeatBalance(this->ControlZoneNum).MAT)); if (this->LoadSHR < 0.0) { this->LoadSHR = 0.0; diff --git a/src/EnergyPlus/VentilatedSlab.cc b/src/EnergyPlus/VentilatedSlab.cc index ddf6fe0bd8a..65636171b26 100644 --- a/src/EnergyPlus/VentilatedSlab.cc +++ b/src/EnergyPlus/VentilatedSlab.cc @@ -2815,8 +2815,8 @@ namespace VentilatedSlab { break; } case ControlType::DewPointTemp: { - SetPointTemp = PsyTdpFnWPb( - state, state.dataZoneTempPredictorCorrector->zoneHeatBalance(ventSlab.ZonePtr).ZoneAirHumRat, state.dataEnvrn->OutBaroPress); + SetPointTemp = + PsyTdpFnWPb(state, state.dataZoneTempPredictorCorrector->zoneHeatBalance(ventSlab.ZonePtr).airHumRat, state.dataEnvrn->OutBaroPress); break; } default: { // Should never get here @@ -3915,7 +3915,7 @@ namespace VentilatedSlab { // conditions. if (state.dataVentilatedSlab->OperatingMode == CoolingMode) { - DewPointTemp = PsyTdpFnWPb(state, thisZoneHB.ZoneAirHumRat, state.dataEnvrn->OutBaroPress); + DewPointTemp = PsyTdpFnWPb(state, thisZoneHB.airHumRat, state.dataEnvrn->OutBaroPress); for (RadSurfNum2 = 1; RadSurfNum2 <= ventSlab.NumOfSurfaces; ++RadSurfNum2) { if (state.dataHeatBalSurf->SurfInsideTempHist(1)(ventSlab.SurfacePtr(RadSurfNum2)) < (DewPointTemp + CondDeltaTemp)) { // Condensation warning--must shut off radiant system @@ -4168,7 +4168,7 @@ namespace VentilatedSlab { if (state.dataVentilatedSlab->OperatingMode == CoolingMode) { DewPointTemp = PsyTdpFnWPb(state, - state.dataZoneTempPredictorCorrector->zoneHeatBalance(ventSlab.ZPtr(RadSurfNum)).ZoneAirHumRat, + state.dataZoneTempPredictorCorrector->zoneHeatBalance(ventSlab.ZPtr(RadSurfNum)).airHumRat, state.dataEnvrn->OutBaroPress); for (RadSurfNum2 = 1; RadSurfNum2 <= ventSlab.NumOfSurfaces; ++RadSurfNum2) { if (state.dataHeatBalSurf->SurfInsideTempHist(1)(ventSlab.SurfacePtr(RadSurfNum2)) < (DewPointTemp + CondDeltaTemp)) { diff --git a/src/EnergyPlus/WaterUse.cc b/src/EnergyPlus/WaterUse.cc index add3570c770..24675ac00a6 100644 --- a/src/EnergyPlus/WaterUse.cc +++ b/src/EnergyPlus/WaterUse.cc @@ -1255,7 +1255,7 @@ namespace WaterUse { this->LatentRate = 0.0; this->LatentEnergy = 0.0; } else { - Real64 ZoneHumRat = thisZoneHB.ZoneAirHumRat; + Real64 ZoneHumRat = thisZoneHB.airHumRat; Real64 ZoneHumRatSat = Psychrometrics::PsyWFnTdbRhPb(state, thisZoneHB.MAT, 1.0, diff --git a/src/EnergyPlus/WindowComplexManager.cc b/src/EnergyPlus/WindowComplexManager.cc index 726826b1efe..56bd893d460 100644 --- a/src/EnergyPlus/WindowComplexManager.cc +++ b/src/EnergyPlus/WindowComplexManager.cc @@ -3299,13 +3299,13 @@ namespace WindowComplexManager { state.dataSurface->SurfWinAirflowDestination(SurfNum) == WindowAirFlowDestination::Return) { auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); if (state.dataSurface->SurfWinAirflowSource(SurfNum) == WindowAirFlowSource::Indoor) { - InletAirHumRat = thisZoneHB.ZoneAirHumRat; + InletAirHumRat = thisZoneHB.airHumRat; } else { // AirflowSource = outside air InletAirHumRat = state.dataEnvrn->OutHumRat; } ZoneTemp = thisZoneHB.MAT; // this should be Tin (account for different reference temps) CpAirOutlet = PsyCpAirFnW(InletAirHumRat); - CpAirZone = PsyCpAirFnW(thisZoneHB.ZoneAirHumRat); + CpAirZone = PsyCpAirFnW(thisZoneHB.airHumRat); ConvHeatGainToZoneAir = TotAirflowGap * (CpAirOutlet * (TAirflowGapOutletC)-CpAirZone * ZoneTemp); if (state.dataSurface->SurfWinAirflowDestination(SurfNum) == WindowAirFlowDestination::Indoor) { state.dataSurface->SurfWinConvHeatGainToZoneAir(SurfNum) = ConvHeatGainToZoneAir; diff --git a/src/EnergyPlus/WindowManager.cc b/src/EnergyPlus/WindowManager.cc index 482d1191d6c..6cf334c42da 100644 --- a/src/EnergyPlus/WindowManager.cc +++ b/src/EnergyPlus/WindowManager.cc @@ -2628,7 +2628,7 @@ namespace WindowManager { // or, for airflow windows, on either or the two glass faces in the airflow gap if (!state.dataConstruction->Construct(surface.Construction).WindowTypeEQL) { InsideGlassTemp = state.dataWindowManager->thetas[2 * state.dataWindowManager->ngllayer - 1] - state.dataWindowManager->TKelvin; - RoomHumRat = thisZoneHB.ZoneAirHumRat; + RoomHumRat = thisZoneHB.airHumRat; RoomDewPoint = PsyTdpFnWPb(state, RoomHumRat, state.dataEnvrn->OutBaroPress); state.dataSurface->SurfWinInsideGlassCondensationFlag(SurfNum) = 0; if (InsideGlassTemp < RoomDewPoint) state.dataSurface->SurfWinInsideGlassCondensationFlag(SurfNum) = 1; @@ -3820,13 +3820,13 @@ namespace WindowManager { state.dataSurface->SurfWinAirflowDestination(SurfNum) == WindowAirFlowDestination::Return) { auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); if (state.dataSurface->SurfWinAirflowSource(SurfNum) == WindowAirFlowSource::Indoor) { - InletAirHumRat = thisZoneHB.ZoneAirHumRat; + InletAirHumRat = thisZoneHB.airHumRat; } else { // AirflowSource = outside air InletAirHumRat = state.dataEnvrn->OutHumRat; } Real64 ZoneTemp = thisZoneHB.MAT; // this should be Tin (account for different reference temps) CpAirOutlet = PsyCpAirFnW(InletAirHumRat); - CpAirZone = PsyCpAirFnW(thisZoneHB.ZoneAirHumRat); + CpAirZone = PsyCpAirFnW(thisZoneHB.airHumRat); state.dataSurface->SurfWinRetHeatGainToZoneAir(SurfNum) = TotAirflowGap * (CpAirOutlet * (TAirflowGapOutletC)-CpAirZone * ZoneTemp); if (state.dataSurface->SurfWinAirflowDestination(SurfNum) == WindowAirFlowDestination::Indoor) { diff --git a/src/EnergyPlus/ZoneContaminantPredictorCorrector.cc b/src/EnergyPlus/ZoneContaminantPredictorCorrector.cc index 507278dc4d9..21e8235b308 100644 --- a/src/EnergyPlus/ZoneContaminantPredictorCorrector.cc +++ b/src/EnergyPlus/ZoneContaminantPredictorCorrector.cc @@ -2046,7 +2046,7 @@ void PredictZoneContaminants(EnergyPlusData &state, Real64 RhoAir = PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, thisZoneHB.ZT, - thisZoneHB.ZoneAirHumRat, + thisZoneHB.airHumRat, RoutineName); // The density of air // Calculate Co2 from infiltration + humidity added from latent load to determine system added/subtracted moisture. @@ -2160,7 +2160,7 @@ void PredictZoneContaminants(EnergyPlusData &state, if (ControlledGCZoneFlag) { // The density of air - Real64 RhoAir = PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, thisZoneHB.ZT, thisZoneHB.ZoneAirHumRat, RoutineName); + Real64 RhoAir = PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, thisZoneHB.ZT, thisZoneHB.airHumRat, RoutineName); // Calculate generic contaminant from infiltration + humidity added from latent load // to determine system added/subtracted moisture. @@ -2648,7 +2648,7 @@ void CorrectZoneContaminants(EnergyPlusData &state, // zone humidity ratio. The A, B, C coefficients are analogous to the // CO2 balance. There are 2 cases that should be considered, system operating and system shutdown. - Real64 RhoAir = PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, thisZoneHB.ZT, thisZoneHB.ZoneAirHumRat, RoutineName); + Real64 RhoAir = PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, thisZoneHB.ZT, thisZoneHB.airHumRat, RoutineName); if (state.dataContaminantBalance->Contaminant.CO2Simulation) state.dataContaminantBalance->ZoneAirDensityCO(ZoneNum) = RhoAir; // Calculate Co2 internal gain diff --git a/src/EnergyPlus/ZoneEquipmentManager.cc b/src/EnergyPlus/ZoneEquipmentManager.cc index b2bb32613df..519388959eb 100644 --- a/src/EnergyPlus/ZoneEquipmentManager.cc +++ b/src/EnergyPlus/ZoneEquipmentManager.cc @@ -395,8 +395,8 @@ void sizeZoneSpaceEquipmentPart1(EnergyPlusData &state, : state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum).NonAirSystemResponse; auto &sysDepZoneLoads = (spaceNum > 0) ? state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).SysDepZoneLoads : state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum).SysDepZoneLoads; - auto &zoneLatentGain = (spaceNum > 0) ? state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).ZoneLatentGain - : state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum).ZoneLatentGain; + auto &zoneLatentGain = (spaceNum > 0) ? state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).latentGain + : state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum).latentGain; auto &zoneNodeNum = (spaceNum > 0) ? state.dataHeatBal->space(spaceNum).SystemZoneNodeNumber : state.dataHeatBal->Zone(zoneNum).SystemZoneNodeNumber; nonAirSystemResponse = 0.0; @@ -5151,14 +5151,14 @@ void CalcZoneLeavingConditions(EnergyPlusData &state, bool const FirstHVACIterat state.dataHeatBal->RefrigCaseCredit(ZoneNum).LatCaseCreditToHVAC; // shouldn't the HVAC term be zeroed out then? SumRetAirLatentGainRate = InternalHeatGains::SumAllReturnAirLatentGains(state, ZoneNum, ReturnNode); - thisZoneHB.ZoneLatentGain += SumRetAirLatentGainRate; + thisZoneHB.latentGain += SumRetAirLatentGainRate; } } else { state.dataLoopNodes->Node(ReturnNode).HumRat = state.dataLoopNodes->Node(ZoneNode).HumRat; state.dataHeatBal->RefrigCaseCredit(ZoneNum).LatCaseCreditToZone += state.dataHeatBal->RefrigCaseCredit(ZoneNum).LatCaseCreditToHVAC; // shouldn't the HVAC term be zeroed out then? SumRetAirLatentGainRate = InternalHeatGains::SumAllReturnAirLatentGains(state, ZoneNum, ReturnNode); - thisZoneHB.ZoneLatentGain += SumRetAirLatentGainRate; + thisZoneHB.latentGain += SumRetAirLatentGainRate; } state.dataLoopNodes->Node(ReturnNode).Enthalpy = @@ -5289,21 +5289,21 @@ void CalcAirFlowSimple(EnergyPlusData &state, // Assign zone air temperature for (auto &thisZoneHB : state.dataZoneTempPredictorCorrector->zoneHeatBalance) { thisZoneHB.MixingMAT = thisZoneHB.MAT; - thisZoneHB.MixingHumRat = thisZoneHB.ZoneAirHumRat; + thisZoneHB.MixingHumRat = thisZoneHB.airHumRat; // This is only temporary fix for CR8867. (L. Gu 8/12) if (SysTimestepLoop == 1) { thisZoneHB.MixingMAT = thisZoneHB.XMPT; - thisZoneHB.MixingHumRat = thisZoneHB.WZoneTimeMinusP; + thisZoneHB.MixingHumRat = thisZoneHB.WTimeMinusP; } } if (state.dataHeatBal->doSpaceHeatBalance) { for (auto &thisSpaceHB : state.dataZoneTempPredictorCorrector->spaceHeatBalance) { thisSpaceHB.MixingMAT = thisSpaceHB.MAT; - thisSpaceHB.MixingHumRat = thisSpaceHB.ZoneAirHumRat; + thisSpaceHB.MixingHumRat = thisSpaceHB.airHumRat; // This is only temporary fix for CR8867. (L. Gu 8/12) if (SysTimestepLoop == 1) { thisSpaceHB.MixingMAT = thisSpaceHB.XMPT; - thisSpaceHB.MixingHumRat = thisSpaceHB.WZoneTimeMinusP; + thisSpaceHB.MixingHumRat = thisSpaceHB.WTimeMinusP; } } } diff --git a/src/EnergyPlus/ZoneTempPredictorCorrector.cc b/src/EnergyPlus/ZoneTempPredictorCorrector.cc index 4760e730392..30e8d7cce6a 100644 --- a/src/EnergyPlus/ZoneTempPredictorCorrector.cc +++ b/src/EnergyPlus/ZoneTempPredictorCorrector.cc @@ -3247,16 +3247,16 @@ void ZoneSpaceHeatBalanceData::beginEnvironmentInit(EnergyPlusData &state) this->DSWPrevZoneTS[i] = state.dataEnvrn->OutHumRat; this->WPrevZoneTSTemp[i] = 0.0; } - this->WZoneTimeMinusP = state.dataEnvrn->OutHumRat; - this->ZoneW1 = state.dataEnvrn->OutHumRat; - this->ZoneWMX = state.dataEnvrn->OutHumRat; - this->ZoneWM2 = state.dataEnvrn->OutHumRat; - this->ZoneAirHumRatTemp = 0.0; - this->TempIndZnLd = 0.0; - this->TempDepZnLd = 0.0; - this->ZoneAirRelHum = 0.0; + this->WTimeMinusP = state.dataEnvrn->OutHumRat; + this->W1 = state.dataEnvrn->OutHumRat; + this->WMX = state.dataEnvrn->OutHumRat; + this->WM2 = state.dataEnvrn->OutHumRat; + this->airHumRatTemp = 0.0; + this->tempIndLoad = 0.0; + this->tempDepLoad = 0.0; + this->airRelHum = 0.0; this->AirPowerCap = 0.0; - this->ZoneT1 = 0.0; + this->T1 = 0.0; } void ZoneSpaceHeatBalanceData::setUpOutputVars(EnergyPlusData &state, std::string_view prefix, std::string_view name) @@ -3271,14 +3271,14 @@ void ZoneSpaceHeatBalanceData::setUpOutputVars(EnergyPlusData &state, std::strin SetupOutputVariable(state, format("{} Air Humidity Ratio", prefix), OutputProcessor::Unit::None, - this->ZoneAirHumRat, + this->airHumRat, OutputProcessor::SOVTimeStepType::System, OutputProcessor::SOVStoreType::Average, name); SetupOutputVariable(state, format("{} Air Relative Humidity", prefix), OutputProcessor::Unit::Perc, - this->ZoneAirRelHum, + this->airRelHum, OutputProcessor::SOVTimeStepType::System, OutputProcessor::SOVStoreType::Average, name); @@ -3425,7 +3425,7 @@ void PredictSystemLoads(EnergyPlusData &state, Tprev = thisZoneHB.MAT; if (ShortenTimeStepSys) Tprev = thisZoneHB.XMPT; } else { - Tprev = thisZoneHB.ZoneT1; + Tprev = thisZoneHB.T1; } switch (state.dataHeatBalFanSys->TempControlType(thisTempControlledZone.ActualZoneNum)) { @@ -3565,8 +3565,8 @@ void ZoneSpaceHeatBalanceData::predictSystemLoad( } this->AirPowerCap = volume * state.dataHeatBal->Zone(zoneNum).ZoneVolCapMultpSens * - Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, this->MAT, this->ZoneAirHumRat) * - Psychrometrics::PsyCpAirFnW(this->ZoneAirHumRat) / TimeStepSysSec; + Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, this->MAT, this->airHumRat) * + Psychrometrics::PsyCpAirFnW(this->airHumRat) / TimeStepSysSec; Real64 RAFNFrac = 0.0; // Calculate the various heat balance sums @@ -3583,8 +3583,8 @@ void ZoneSpaceHeatBalanceData::predictSystemLoad( this->TempDepCoef = this->SumHA + this->SumMCp; this->TempIndCoef = this->SumIntGain + this->SumHATsurf - this->SumHATref + this->SumMCpT + this->SysDepZoneLoadsLagged; this->TempHistoryTerm = this->AirPowerCap * (3.0 * this->ZTM[0] - (3.0 / 2.0) * this->ZTM[1] + (1.0 / 3.0) * this->ZTM[2]); - this->TempDepZnLd = (11.0 / 6.0) * this->AirPowerCap + this->TempDepCoef; - this->TempIndZnLd = this->TempHistoryTerm + this->TempIndCoef; + this->tempDepLoad = (11.0 / 6.0) * this->AirPowerCap + this->TempDepCoef; + this->tempIndLoad = this->TempHistoryTerm + this->TempIndCoef; if (state.dataRoomAir->anyNonMixingRoomAirModel) { if (state.dataRoomAir->AirModel(zoneNum).AirModel == RoomAir::RoomAirModel::AirflowNetwork) { // RoomAirflowNetworkModel - make dynamic term independent of TimeStepSys @@ -3599,8 +3599,8 @@ void ZoneSpaceHeatBalanceData::predictSystemLoad( this->AirPowerCap = afnZoneInfo.Node(RoomAirNode).AirVolume * state.dataHeatBal->Zone(zoneNum).ZoneVolCapMultpSens * afnZoneInfo.Node(RoomAirNode).RhoAir * afnZoneInfo.Node(RoomAirNode).CpAir / TimeStepSysSec; this->TempHistoryTerm = this->AirPowerCap * (3.0 * this->ZTM[0] - (3.0 / 2.0) * this->ZTM[1] + (1.0 / 3.0) * this->ZTM[2]); - this->TempDepZnLd = (11.0 / 6.0) * this->AirPowerCap + this->TempDepCoef; - this->TempIndZnLd = this->TempHistoryTerm + this->TempIndCoef; + this->tempDepLoad = (11.0 / 6.0) * this->AirPowerCap + this->TempDepCoef; + this->tempIndLoad = this->TempHistoryTerm + this->TempIndCoef; if (afnZoneInfo.Node(RoomAirNode).HasHVACAssigned) RAFNFrac = afnZoneInfo.Node(RoomAirNode).HVAC(1).SupplyFraction; } } @@ -3611,8 +3611,8 @@ void ZoneSpaceHeatBalanceData::predictSystemLoad( if (state.dataHeatBal->ZoneAirSolutionAlgo != DataHeatBalance::SolutionAlgo::ThirdOrder) { if (shortenTimeStepSys && TimeStepSys < state.dataGlobal->TimeStepZone) { if (state.dataHVACGlobal->PreviousTimeStep < state.dataGlobal->TimeStepZone) { - this->ZoneT1 = this->ZoneTM2; - this->ZoneW1 = this->ZoneWM2; + this->T1 = this->TM2; + this->W1 = this->WM2; if (state.dataRoomAir->AirModel(zoneNum).AirModel == RoomAir::RoomAirModel::AirflowNetwork) { auto &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(zoneNum); for (auto &afnNode : afnZoneInfo.Node) { @@ -3621,8 +3621,8 @@ void ZoneSpaceHeatBalanceData::predictSystemLoad( } } } else { - this->ZoneT1 = this->ZoneTMX; - this->ZoneW1 = this->ZoneWMX; + this->T1 = this->TMX; + this->W1 = this->WMX; if (state.dataRoomAir->AirModel(zoneNum).AirModel == RoomAir::RoomAirModel::AirflowNetwork) { auto &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(zoneNum); for (auto &afnNode : afnZoneInfo.Node) { @@ -3633,8 +3633,8 @@ void ZoneSpaceHeatBalanceData::predictSystemLoad( } state.dataHVACGlobal->ShortenTimeStepSysRoomAir = true; } else { - this->ZoneT1 = this->ZT; - this->ZoneW1 = this->ZoneAirHumRat; + this->T1 = this->ZT; + this->W1 = this->airHumRat; if (state.dataRoomAir->AirModel(zoneNum).AirModel == RoomAir::RoomAirModel::AirflowNetwork) { auto &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(zoneNum); for (auto &afnNode : afnZoneInfo.Node) { @@ -3643,8 +3643,8 @@ void ZoneSpaceHeatBalanceData::predictSystemLoad( } } } - this->TempDepZnLd = this->TempDepCoef; - this->TempIndZnLd = this->TempIndCoef; + this->tempDepLoad = this->TempDepCoef; + this->tempIndLoad = this->TempIndCoef; } // Calculate the predicted zone load to be provided by the system with the given desired zone air temperature @@ -4077,8 +4077,7 @@ void ZoneSpaceHeatBalanceData::calcPredictedHumidityRatio(EnergyPlusData &state, // Calculate hourly humidity ratio from infiltration + humidity added from latent load // to determine system added/subtracted moisture. - Real64 LatentGain = - this->ZoneLatentGain + state.dataHeatBalFanSys->SumLatentHTRadSys(zoneNum) + state.dataHeatBalFanSys->SumLatentPool(zoneNum); + Real64 LatentGain = this->latentGain + state.dataHeatBalFanSys->SumLatentHTRadSys(zoneNum) + state.dataHeatBalFanSys->SumLatentPool(zoneNum); Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; @@ -4088,8 +4087,8 @@ void ZoneSpaceHeatBalanceData::calcPredictedHumidityRatio(EnergyPlusData &state, // are currently set to zero when the CTF only version is used. // The density of air and latent heat of vaporization are calculated as functions. - Real64 RhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, this->ZT, this->ZoneAirHumRat, RoutineName); - Real64 H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(this->ZoneAirHumRat, this->ZT); + Real64 RhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, this->ZT, this->airHumRat, RoutineName); + Real64 H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(this->airHumRat, this->ZT); // Assume that the system will have flow Real64 A = 0.0; @@ -4139,13 +4138,13 @@ void ZoneSpaceHeatBalanceData::calcPredictedHumidityRatio(EnergyPlusData &state, // Exact solution } else if (state.dataHeatBal->ZoneAirSolutionAlgo == DataHeatBalance::SolutionAlgo::AnalyticalSolution) { if (A == 0.0) { // B=0 - LoadToHumidifySetPoint = C * (WZoneSetPoint - this->ZoneW1) - B; + LoadToHumidifySetPoint = C * (WZoneSetPoint - this->W1) - B; } else { exp_700_A_C = std::exp(min(700.0, -A / C)); // Tuned Save expensive value - LoadToHumidifySetPoint = A * (WZoneSetPoint - this->ZoneW1 * exp_700_A_C) / (1.0 - exp_700_A_C) - B; + LoadToHumidifySetPoint = A * (WZoneSetPoint - this->W1 * exp_700_A_C) / (1.0 - exp_700_A_C) - B; } } else if (state.dataHeatBal->ZoneAirSolutionAlgo == DataHeatBalance::SolutionAlgo::EulerMethod) { - LoadToHumidifySetPoint = C * (WZoneSetPoint - this->ZoneW1) + A * WZoneSetPoint - B; + LoadToHumidifySetPoint = C * (WZoneSetPoint - this->W1) + A * WZoneSetPoint - B; } if (RAFNFrac > 0.0) LoadToHumidifySetPoint = LoadToHumidifySetPoint / RAFNFrac; WZoneSetPoint = @@ -4157,12 +4156,12 @@ void ZoneSpaceHeatBalanceData::calcPredictedHumidityRatio(EnergyPlusData &state, // Exact solution } else if (state.dataHeatBal->ZoneAirSolutionAlgo == DataHeatBalance::SolutionAlgo::AnalyticalSolution) { if (A == 0.0) { // B=0 - LoadToDehumidifySetPoint = C * (WZoneSetPoint - this->ZoneW1) - B; + LoadToDehumidifySetPoint = C * (WZoneSetPoint - this->W1) - B; } else { - LoadToDehumidifySetPoint = A * (WZoneSetPoint - this->ZoneW1 * exp_700_A_C) / (1.0 - exp_700_A_C) - B; // exp_700_A_C set above + LoadToDehumidifySetPoint = A * (WZoneSetPoint - this->W1 * exp_700_A_C) / (1.0 - exp_700_A_C) - B; // exp_700_A_C set above } } else if (state.dataHeatBal->ZoneAirSolutionAlgo == DataHeatBalance::SolutionAlgo::EulerMethod) { - LoadToDehumidifySetPoint = C * (WZoneSetPoint - this->ZoneW1) + A * WZoneSetPoint - B; + LoadToDehumidifySetPoint = C * (WZoneSetPoint - this->W1) + A * WZoneSetPoint - B; } if (RAFNFrac > 0.0) LoadToDehumidifySetPoint = LoadToDehumidifySetPoint / RAFNFrac; @@ -4282,8 +4281,8 @@ Real64 ZoneSpaceHeatBalanceData::correctAirTemp( volume = thisZone.Volume; } this->AirPowerCap = volume * thisZone.ZoneVolCapMultpSens * - Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, this->MAT, this->ZoneAirHumRat, RoutineName) * - Psychrometrics::PsyCpAirFnW(this->ZoneAirHumRat) / TimeStepSysSec; + Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, this->MAT, this->airHumRat, RoutineName) * + Psychrometrics::PsyCpAirFnW(this->airHumRat) / TimeStepSysSec; // SpaceHB TODO: For now, room air model is only for zones if (spaceNum == 0) { @@ -4327,14 +4326,14 @@ Real64 ZoneSpaceHeatBalanceData::correctAirTemp( } break; case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { if (this->TempDepCoef == 0.0) { // B=0 - this->ZT = this->ZoneT1 + this->TempIndCoef / this->AirPowerCap; + this->ZT = this->T1 + this->TempIndCoef / this->AirPowerCap; } else { - this->ZT = (this->ZoneT1 - this->TempIndCoef / this->TempDepCoef) * std::exp(min(700.0, -this->TempDepCoef / this->AirPowerCap)) + + this->ZT = (this->T1 - this->TempIndCoef / this->TempDepCoef) * std::exp(min(700.0, -this->TempDepCoef / this->AirPowerCap)) + this->TempIndCoef / this->TempDepCoef; } } break; case DataHeatBalance::SolutionAlgo::EulerMethod: { - this->ZT = (this->AirPowerCap * this->ZoneT1 + this->TempIndCoef) / (this->AirPowerCap + this->TempDepCoef); + this->ZT = (this->AirPowerCap * this->T1 + this->TempIndCoef) / (this->AirPowerCap + this->TempDepCoef); } break; default: break; @@ -4414,7 +4413,7 @@ Real64 ZoneSpaceHeatBalanceData::correctAirTemp( } // Sensible load is the enthalpy into the zone minus the enthalpy that leaves the zone. - Real64 CpAir = Psychrometrics::PsyCpAirFnW(this->ZoneAirHumRat); + Real64 CpAir = Psychrometrics::PsyCpAirFnW(this->airHumRat); Real64 ZoneEnthalpyIn = this->SumSysMCpT; // SNLOAD is the single zone load, without Zone Multiplier or Zone List Multiplier @@ -4440,14 +4439,14 @@ Real64 ZoneSpaceHeatBalanceData::correctAirTemp( } break; case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { if (this->TempDepCoef == 0.0) { // B=0 - this->ZT = this->ZoneT1 + this->TempIndCoef / this->AirPowerCap; + this->ZT = this->T1 + this->TempIndCoef / this->AirPowerCap; } else { - this->ZT = (this->ZoneT1 - this->TempIndCoef / this->TempDepCoef) * std::exp(min(700.0, -this->TempDepCoef / this->AirPowerCap)) + + this->ZT = (this->T1 - this->TempIndCoef / this->TempDepCoef) * std::exp(min(700.0, -this->TempDepCoef / this->AirPowerCap)) + this->TempIndCoef / this->TempDepCoef; } } break; case DataHeatBalance::SolutionAlgo::EulerMethod: { - this->ZT = (this->AirPowerCap * this->ZoneT1 + this->TempIndCoef) / (this->AirPowerCap + this->TempDepCoef); + this->ZT = (this->AirPowerCap * this->T1 + this->TempIndCoef) / (this->AirPowerCap + this->TempDepCoef); } break; default: break; @@ -4498,8 +4497,8 @@ Real64 ZoneSpaceHeatBalanceData::correctAirTemp( // Final humidity calcs this->correctHumRat(state, zoneNum, spaceNum); - this->ZoneAirHumRat = this->ZoneAirHumRatTemp; - this->ZoneAirRelHum = 100.0 * Psychrometrics::PsyRhFnTdbWPb(state, this->ZT, this->ZoneAirHumRat, state.dataEnvrn->OutBaroPress, RoutineName); + this->airHumRat = this->airHumRatTemp; + this->airRelHum = 100.0 * Psychrometrics::PsyRhFnTdbWPb(state, this->ZT, this->airHumRat, state.dataEnvrn->OutBaroPress, RoutineName); // tempChange is used by HVACManager to determine if the timestep needs to be shortened. bool isMixed = true; @@ -4521,7 +4520,7 @@ Real64 ZoneSpaceHeatBalanceData::correctAirTemp( case DataHeatBalance::SolutionAlgo::AnalyticalSolution: case DataHeatBalance::SolutionAlgo::EulerMethod: { if (isMixed) { - tempChange = max(tempChange, std::abs(this->ZT - this->ZoneT1)); + tempChange = max(tempChange, std::abs(this->ZT - this->T1)); } else { tempChange = max(tempChange, max(std::abs(state.dataRoomAir->ZTOC(zoneNum) - state.dataRoomAir->Zone1OC(zoneNum)), @@ -4585,10 +4584,10 @@ void ZoneSpaceHeatBalanceData::pushZoneTimestepHistory(EnergyPlusData &state, in } this->XMAT[0] = this->ZTAV; // using average for whole zone time step. this->XMPT = this->ZT; - this->WPrevZoneTS[0] = this->ZoneAirHumRatAvg; // using average for whole zone time step. - this->ZoneAirHumRat = this->ZoneAirHumRatTemp; - this->WZoneTimeMinusP = this->ZoneAirHumRatTemp; - this->ZoneAirRelHum = 100.0 * Psychrometrics::PsyRhFnTdbWPb(state, this->ZT, this->ZoneAirHumRat, state.dataEnvrn->OutBaroPress, routineName); + this->WPrevZoneTS[0] = this->airHumRatAvg; // using average for whole zone time step. + this->airHumRat = this->airHumRatTemp; + this->WTimeMinusP = this->airHumRatTemp; + this->airRelHum = 100.0 * Psychrometrics::PsyRhFnTdbWPb(state, this->ZT, this->airHumRat, state.dataEnvrn->OutBaroPress, routineName); // SpaceHB TODO: For now, room air model is only for zones if (spaceNum == 0) { @@ -4630,10 +4629,10 @@ void ZoneSpaceHeatBalanceData::pushZoneTimestepHistory(EnergyPlusData &state, in } if (state.dataHeatBal->ZoneAirSolutionAlgo != DataHeatBalance::SolutionAlgo::ThirdOrder) { - this->ZoneTM2 = this->ZoneTMX; - this->ZoneTMX = this->ZTAV; // using average for whole zone time step. - this->ZoneWM2 = this->ZoneWMX; - this->ZoneWMX = this->ZoneAirHumRatAvg; // using average for whole zone time step. + this->TM2 = this->TMX; + this->TMX = this->ZTAV; // using average for whole zone time step. + this->WM2 = this->WMX; + this->WMX = this->airHumRatAvg; // using average for whole zone time step. // SpaceHB TODO: For now, room air model is only for zones if (spaceNum == 0) { if (thisAirModel.AirModel == RoomAir::RoomAirModel::DispVent3Node || thisAirModel.AirModel == RoomAir::RoomAirModel::UFADInt || @@ -4687,7 +4686,7 @@ void ZoneSpaceHeatBalanceData::pushSystemTimestepHistory(EnergyPlusData &state, this->DSWPrevZoneTS[iHistory] = this->DSWPrevZoneTS[iHistory - 1]; } this->DSXMAT[0] = this->MAT; - this->DSWPrevZoneTS[0] = this->ZoneAirHumRat; + this->DSWPrevZoneTS[0] = this->airHumRat; // SpaceHB TODO: For now, room air model is only for zones if (spaceNum == 0 && state.dataRoomAir->anyNonMixingRoomAirModel) { @@ -4723,10 +4722,10 @@ void ZoneSpaceHeatBalanceData::pushSystemTimestepHistory(EnergyPlusData &state, } if (state.dataHeatBal->ZoneAirSolutionAlgo != DataHeatBalance::SolutionAlgo::ThirdOrder) { - this->ZoneTM2 = this->ZoneTMX; - this->ZoneTMX = this->MAT; // using average for whole zone time step. - this->ZoneWM2 = this->ZoneWMX; - this->ZoneWMX = this->ZoneAirHumRatTemp; // using average for whole zone time step. + this->TM2 = this->TMX; + this->TMX = this->MAT; // using average for whole zone time step. + this->WM2 = this->WMX; + this->WMX = this->airHumRatTemp; // using average for whole zone time step. // SpaceHB TODO: For now, room air model is only for zones if (spaceNum == 0) { @@ -4876,7 +4875,7 @@ void ZoneSpaceHeatBalanceData::correctHumRat(EnergyPlusData &state, int const zo } // Calculate hourly humidity ratio from infiltration + humidity added from latent load + system added moisture - Real64 LatentGain = this->ZoneLatentGain + state.dataHeatBalFanSys->SumLatentHTRadSys(zoneNum) + state.dataHeatBalFanSys->SumLatentPool(zoneNum); + Real64 LatentGain = this->latentGain + state.dataHeatBalFanSys->SumLatentHTRadSys(zoneNum) + state.dataHeatBalFanSys->SumLatentPool(zoneNum); Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec; @@ -4885,8 +4884,8 @@ void ZoneSpaceHeatBalanceData::correctHumRat(EnergyPlusData &state, int const zo // heat balance. There are 2 cases that should be considered, system // operating and system shutdown. - Real64 const RhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, this->ZT, this->ZoneAirHumRat, RoutineName); - Real64 const H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(this->ZoneAirHumRat, this->ZT); + Real64 const RhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, this->ZT, this->airHumRat, RoutineName); + Real64 const H2OHtOfVap = Psychrometrics::PsyHgAirFnWTdb(this->airHumRat, this->ZT); Real64 B = (LatentGain / H2OHtOfVap) + ((this->OAMFL + this->VAMFL + this->CTMFL) * state.dataEnvrn->OutHumRat) + this->EAMFLxHumRat + (MoistureMassFlowRate) + this->SumHmARaW + this->MixingMassFlowXHumRat + this->MDotOA * state.dataEnvrn->OutHumRat; @@ -4912,36 +4911,36 @@ void ZoneSpaceHeatBalanceData::correctHumRat(EnergyPlusData &state, int const zo // auto &zoneW1 = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).ZoneW1; switch (state.dataHeatBal->ZoneAirSolutionAlgo) { case DataHeatBalance::SolutionAlgo::ThirdOrder: { - this->ZoneAirHumRatTemp = + this->airHumRatTemp = (B + C * (3.0 * this->WPrevZoneTSTemp[0] - (3.0 / 2.0) * this->WPrevZoneTSTemp[1] + (1.0 / 3.0) * this->WPrevZoneTSTemp[2])) / ((11.0 / 6.0) * C + A); // Exact solution } break; case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { if (A == 0.0) { // B=0 - this->ZoneAirHumRatTemp = this->ZoneW1 + B / C; + this->airHumRatTemp = this->W1 + B / C; } else { - this->ZoneAirHumRatTemp = (this->ZoneW1 - B / A) * std::exp(min(700.0, -A / C)) + B / A; + this->airHumRatTemp = (this->W1 - B / A) * std::exp(min(700.0, -A / C)) + B / A; } } break; case DataHeatBalance::SolutionAlgo::EulerMethod: { - this->ZoneAirHumRatTemp = (C * this->ZoneW1 + B) / (C + A); + this->airHumRatTemp = (C * this->W1 + B) / (C + A); } break; default: break; } // Set the humidity ratio to zero if the zone has been dried out - if (this->ZoneAirHumRatTemp < 0.0) this->ZoneAirHumRatTemp = 0.0; + if (this->airHumRatTemp < 0.0) this->airHumRatTemp = 0.0; // Check to make sure that is saturated there is condensation in the zone // by resetting to saturation conditions. Real64 const WZSat = Psychrometrics::PsyWFnTdbRhPb(state, this->ZT, 1.0, state.dataEnvrn->OutBaroPress, RoutineName); - if (this->ZoneAirHumRatTemp > WZSat) this->ZoneAirHumRatTemp = WZSat; + if (this->airHumRatTemp > WZSat) this->airHumRatTemp = WZSat; if (state.dataRoomAir->AirModel(zoneNum).AirModel == RoomAir::RoomAirModel::AirflowNetwork) { - this->ZoneAirHumRatTemp = state.dataRoomAir->AFNZoneInfo(zoneNum).Node(state.dataRoomAir->AFNZoneInfo(zoneNum).ControlAirNodeID).HumRat; + this->airHumRatTemp = state.dataRoomAir->AFNZoneInfo(zoneNum).Node(state.dataRoomAir->AFNZoneInfo(zoneNum).ControlAirNodeID).HumRat; } // HybridModel with measured humidity ratio begins @@ -4952,7 +4951,7 @@ void ZoneSpaceHeatBalanceData::correctHumRat(EnergyPlusData &state, int const zo (!state.dataGlobal->WarmupFlag) && (!state.dataGlobal->DoingSizing)) { Real64 LatentGainExceptPeople = 0.0; if (state.dataHybridModel->HybridModelZone(zoneNum).PeopleCountCalc_H) { - LatentGainExceptPeople = this->ZoneLatentGainExceptPeople + state.dataHeatBalFanSys->SumLatentHTRadSys(zoneNum) + + LatentGainExceptPeople = this->latentGainExceptPeople + state.dataHeatBalFanSys->SumLatentHTRadSys(zoneNum) + state.dataHeatBalFanSys->SumLatentPool(zoneNum); } @@ -4966,13 +4965,13 @@ void ZoneSpaceHeatBalanceData::correctHumRat(EnergyPlusData &state, int const zo ZoneNodeNum = state.dataHeatBal->space(spaceNum).SystemZoneNodeNumber; } if (ZoneNodeNum > 0) { - state.dataLoopNodes->Node(ZoneNodeNum).HumRat = this->ZoneAirHumRatTemp; - state.dataLoopNodes->Node(ZoneNodeNum).Enthalpy = Psychrometrics::PsyHFnTdbW(this->ZT, this->ZoneAirHumRatTemp); + state.dataLoopNodes->Node(ZoneNodeNum).HumRat = this->airHumRatTemp; + state.dataLoopNodes->Node(ZoneNodeNum).Enthalpy = Psychrometrics::PsyHFnTdbW(this->ZT, this->airHumRatTemp); } if (state.dataHeatBal->DoLatentSizing) { Real64 sensibleLoad = 0.0; Real64 pSat = Psychrometrics::PsyPsatFnTemp(state, this->ZT, RoutineName); - Real64 Tdp = Psychrometrics::PsyTdpFnWPb(state, this->ZoneAirHumRatTemp, state.dataEnvrn->StdBaroPress); + Real64 Tdp = Psychrometrics::PsyTdpFnWPb(state, this->airHumRatTemp, state.dataEnvrn->StdBaroPress); Real64 vaporPressureDiff = pSat - Psychrometrics::PsyPsatFnTemp(state, Tdp, RoutineName); if (spaceNum > 0) { sensibleLoad = state.dataZoneEnergyDemand->spaceSysEnergyDemand(spaceNum).airSysHeatRate + @@ -5254,8 +5253,8 @@ void InverseModelTemperature(EnergyPlusData &state, Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, thisZoneHB.ZT, - thisZoneHB.ZoneAirHumRat) * - Psychrometrics::PsyCpAirFnW(thisZoneHB.ZoneAirHumRat)) * + thisZoneHB.airHumRat) * + Psychrometrics::PsyCpAirFnW(thisZoneHB.airHumRat)) * (state.dataGlobal->TimeStepZone * Constant::SecInHour); // Inverse equation if ((MultpHM < 1.0) || (MultpHM > 30.0)) { // Temperature capacity multiplier greater than // 1 and less than 30 @@ -5389,7 +5388,7 @@ void InverseModelHumidity(EnergyPlusData &state, zone.ZoneMeasuredHumidityRatio = ScheduleManager::GetCurrentScheduleValue(state, hybridModelZone.ZoneMeasuredHumidityRatioSchedulePtr); if (state.dataEnvrn->DayOfYear >= hybridModelZone.HybridStartDayOfYear && state.dataEnvrn->DayOfYear <= hybridModelZone.HybridEndDayOfYear) { - thisZoneHB.ZoneAirHumRat = zone.ZoneMeasuredHumidityRatio; + thisZoneHB.airHumRat = zone.ZoneMeasuredHumidityRatio; // Hybrid Model calculate air infiltration rate if (hybridModelZone.InfiltrationCalc_H && state.dataHVACGlobal->UseZoneTimeStepHistory) { @@ -5575,7 +5574,7 @@ void ZoneSpaceHeatBalanceData::calcZoneOrSpaceSums(EnergyPlusData &state, // Get node conditions, this next block is of interest to irratic system loads... maybe nodes are not accurate at time of call? // how can we tell? predict step must be lagged ? correct step, systems have run. auto const &node(state.dataLoopNodes->Node(zsec.InletNode(NodeNum))); - Real64 CpAir = Psychrometrics::PsyCpAirFnW(this->ZoneAirHumRat); + Real64 CpAir = Psychrometrics::PsyCpAirFnW(this->airHumRat); Real64 const MassFlowRate_CpAir(node.MassFlowRate * CpAir); this->SumSysMCp += MassFlowRate_CpAir; this->SumSysMCpT += MassFlowRate_CpAir * node.Temp; @@ -5583,7 +5582,7 @@ void ZoneSpaceHeatBalanceData::calcZoneOrSpaceSums(EnergyPlusData &state, } else if (thisZone.IsReturnPlenum) { auto const &zrpc(state.dataZonePlenum->ZoneRetPlenCond(thisZone.PlenumCondNum)); - Real64 const air_hum_rat(this->ZoneAirHumRat); + Real64 const air_hum_rat(this->airHumRat); for (int NodeNum = 1, NodeNum_end = zrpc.NumInletNodes; NodeNum <= NodeNum_end; ++NodeNum) { auto const &node(state.dataLoopNodes->Node(zrpc.InletNode(NodeNum))); Real64 const MassFlowRate_CpAir(node.MassFlowRate * Psychrometrics::PsyCpAirFnW(air_hum_rat)); @@ -5607,7 +5606,7 @@ void ZoneSpaceHeatBalanceData::calcZoneOrSpaceSums(EnergyPlusData &state, } else if (thisZone.IsSupplyPlenum) { Real64 MassFlowRate = state.dataLoopNodes->Node(state.dataZonePlenum->ZoneSupPlenCond(thisZone.PlenumCondNum).InletNode).MassFlowRate; - Real64 CpAir = Psychrometrics::PsyCpAirFnW(this->ZoneAirHumRat); + Real64 CpAir = Psychrometrics::PsyCpAirFnW(this->airHumRat); this->SumSysMCp += MassFlowRate * CpAir; this->SumSysMCpT += MassFlowRate * CpAir * state.dataLoopNodes->Node(state.dataZonePlenum->ZoneSupPlenCond(thisZone.PlenumCondNum).InletNode).Temp; @@ -5852,7 +5851,7 @@ void CalcZoneComponentLoadSums(EnergyPlusData &state, // Get node conditions Real64 const NodeTemp = state.dataLoopNodes->Node(zoneEquipConfig.InletNode(NodeNum)).Temp; Real64 const MassFlowRate = state.dataLoopNodes->Node(zoneEquipConfig.InletNode(NodeNum)).MassFlowRate; - QSensRate = calcZoneSensibleOutput(MassFlowRate, NodeTemp, thisZoneHB.MAT, thisZoneHB.ZoneAirHumRat); + QSensRate = calcZoneSensibleOutput(MassFlowRate, NodeTemp, thisZoneHB.MAT, thisZoneHB.airHumRat); SumMCpDTsystem += QSensRate; if (zoneEquipConfig.InletNodeADUNum(NodeNum) > 0) { @@ -5860,7 +5859,7 @@ void CalcZoneComponentLoadSums(EnergyPlusData &state, Real64 ADUHeatAddRate = calcZoneSensibleOutput(state.dataLoopNodes->Node(airDistUnit.OutletNodeNum).MassFlowRate, state.dataLoopNodes->Node(airDistUnit.OutletNodeNum).Temp, thisZoneHB.MAT, - thisZoneHB.ZoneAirHumRat); + thisZoneHB.airHumRat); airDistUnit.HeatRate = max(0.0, ADUHeatAddRate); airDistUnit.CoolRate = std::abs(min(0.0, ADUHeatAddRate)); airDistUnit.HeatGain = airDistUnit.HeatRate * TimeStepSysSec; @@ -5874,24 +5873,20 @@ void CalcZoneComponentLoadSums(EnergyPlusData &state, QSensRate = calcZoneSensibleOutput(state.dataLoopNodes->Node(zoneRetPlenCond.InletNode(NodeNum)).MassFlowRate, state.dataLoopNodes->Node(zoneRetPlenCond.InletNode(NodeNum)).Temp, thisZoneHB.MAT, - thisZoneHB.ZoneAirHumRat); + thisZoneHB.airHumRat); SumMCpDTsystem += QSensRate; } // add in the leaks for (int ADUListIndex = 1; ADUListIndex <= zoneRetPlenCond.NumADUs; ++ADUListIndex) { auto &airDistUnit = state.dataDefineEquipment->AirDistUnit(zoneRetPlenCond.ADUIndex(ADUListIndex)); if (airDistUnit.UpStreamLeak) { - QSensRate = calcZoneSensibleOutput(airDistUnit.MassFlowRateUpStrLk, - state.dataLoopNodes->Node(airDistUnit.InletNodeNum).Temp, - thisZoneHB.MAT, - thisZoneHB.ZoneAirHumRat); + QSensRate = calcZoneSensibleOutput( + airDistUnit.MassFlowRateUpStrLk, state.dataLoopNodes->Node(airDistUnit.InletNodeNum).Temp, thisZoneHB.MAT, thisZoneHB.airHumRat); SumMCpDTsystem += QSensRate; } if (airDistUnit.DownStreamLeak) { - QSensRate = calcZoneSensibleOutput(airDistUnit.MassFlowRateDnStrLk, - state.dataLoopNodes->Node(airDistUnit.OutletNodeNum).Temp, - thisZoneHB.MAT, - thisZoneHB.ZoneAirHumRat); + QSensRate = calcZoneSensibleOutput( + airDistUnit.MassFlowRateDnStrLk, state.dataLoopNodes->Node(airDistUnit.OutletNodeNum).Temp, thisZoneHB.MAT, thisZoneHB.airHumRat); SumMCpDTsystem += QSensRate; } } @@ -5901,7 +5896,7 @@ void CalcZoneComponentLoadSums(EnergyPlusData &state, QSensRate = calcZoneSensibleOutput(state.dataLoopNodes->Node(zoneSupPlenCond.InletNode).MassFlowRate, state.dataLoopNodes->Node(zoneSupPlenCond.InletNode).Temp, thisZoneHB.MAT, - thisZoneHB.ZoneAirHumRat); + thisZoneHB.airHumRat); SumMCpDTsystem += QSensRate; } @@ -5975,8 +5970,8 @@ void CalcZoneComponentLoadSums(EnergyPlusData &state, } // now calculate air energy storage source term. // capacitance is volume * density * heat capacity - Real64 CpAir = Psychrometrics::PsyCpAirFnW(thisZoneHB.ZoneAirHumRat); - Real64 RhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, thisZoneHB.MAT, thisZoneHB.ZoneAirHumRat); + Real64 CpAir = Psychrometrics::PsyCpAirFnW(thisZoneHB.airHumRat); + Real64 RhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, thisZoneHB.MAT, thisZoneHB.airHumRat); switch (state.dataHeatBal->ZoneAirSolutionAlgo) { case DataHeatBalance::SolutionAlgo::ThirdOrder: { @@ -5987,7 +5982,7 @@ void CalcZoneComponentLoadSums(EnergyPlusData &state, CzdTdt = TempIndCoef - TempDepCoef * thisZoneHB.MAT; } break; case DataHeatBalance::SolutionAlgo::EulerMethod: { - CzdTdt = thisZoneHB.AirPowerCap * (thisZoneHB.MAT - thisZoneHB.ZoneT1); + CzdTdt = thisZoneHB.AirPowerCap * (thisZoneHB.MAT - thisZoneHB.T1); } break; default: break; @@ -6771,7 +6766,7 @@ void AdjustCoolingSetPointforTempAndHumidityControl(EnergyPlusData &state, ZoneOvercoolRange = min(ZoneOvercoolRange, MaxAllowedOvercoolRange); } // Calculate difference between zone air relative humidity and the dehumidifying setpoint - Real64 RelativeHumidityDiff = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ActualZoneNum).ZoneAirRelHum - + Real64 RelativeHumidityDiff = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ActualZoneNum).airRelHum - ScheduleManager::GetCurrentScheduleValue(state, tempControlledZone.DehumidifyingSchedIndex); if (RelativeHumidityDiff > 0.0 && ZoneOvercoolControlRatio > 0.0) { // proportionally reset the cooling setpoint temperature downward (zone Overcool) @@ -7113,7 +7108,7 @@ void ZoneSpaceHeatBalanceData::updateTemperatures(EnergyPlusData &state, state.dataHVACGlobal->NumOfSysTimeStepsLastZoneTimeStep) { // cannot reuse existing DS data, interpolate from zone time Real64 TimeStepSys = state.dataHVACGlobal->TimeStepSys; this->MAT = DownInterpolate4HistoryValues(PriorTimeStep, TimeStepSys, this->XMAT, this->DSXMAT); - this->ZoneAirHumRat = DownInterpolate4HistoryValues(PriorTimeStep, TimeStepSys, this->WPrevZoneTS, this->DSWPrevZoneTS); + this->airHumRat = DownInterpolate4HistoryValues(PriorTimeStep, TimeStepSys, this->WPrevZoneTS, this->DSWPrevZoneTS); if (spaceNum == 0 && state.dataRoomAir->anyNonMixingRoomAirModel) { if (state.dataRoomAir->IsZoneDispVent3Node(zoneNum) || state.dataRoomAir->IsZoneUFAD(zoneNum)) { @@ -7178,22 +7173,22 @@ void ZoneSpaceHeatBalanceData::calcPredictedSystemLoad(EnergyPlusData &state, Re case DataHVACGlobals::ThermostatType::SingleHeating: switch (state.dataHeatBal->ZoneAirSolutionAlgo) { case DataHeatBalance::SolutionAlgo::ThirdOrder: { - LoadToHeatingSetPoint = (this->TempDepZnLd * thisTempZoneThermostatSetPoint - this->TempIndZnLd); + LoadToHeatingSetPoint = (this->tempDepLoad * thisTempZoneThermostatSetPoint - this->tempIndLoad); break; } case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { - if (this->TempDepZnLd == 0.0) { // B=0 - LoadToHeatingSetPoint = this->AirPowerCap * (thisTempZoneThermostatSetPoint - this->ZoneT1) - this->TempIndZnLd; + if (this->tempDepLoad == 0.0) { // B=0 + LoadToHeatingSetPoint = this->AirPowerCap * (thisTempZoneThermostatSetPoint - this->T1) - this->tempIndLoad; } else { - Real64 const exp_700_TA(std::exp(min(700.0, -this->TempDepZnLd / this->AirPowerCap))); + Real64 const exp_700_TA(std::exp(min(700.0, -this->tempDepLoad / this->AirPowerCap))); LoadToHeatingSetPoint = - this->TempDepZnLd * (thisTempZoneThermostatSetPoint - this->ZoneT1 * exp_700_TA) / (1.0 - exp_700_TA) - this->TempIndZnLd; + this->tempDepLoad * (thisTempZoneThermostatSetPoint - this->T1 * exp_700_TA) / (1.0 - exp_700_TA) - this->tempIndLoad; } break; } case DataHeatBalance::SolutionAlgo::EulerMethod: { - LoadToHeatingSetPoint = this->AirPowerCap * (thisTempZoneThermostatSetPoint - this->ZoneT1) + - this->TempDepZnLd * (thisTempZoneThermostatSetPoint) - this->TempIndZnLd; + LoadToHeatingSetPoint = this->AirPowerCap * (thisTempZoneThermostatSetPoint - this->T1) + + this->tempDepLoad * (thisTempZoneThermostatSetPoint) - this->tempIndLoad; break; } default: { @@ -7212,22 +7207,22 @@ void ZoneSpaceHeatBalanceData::calcPredictedSystemLoad(EnergyPlusData &state, Re case DataHVACGlobals::ThermostatType::SingleCooling: switch (state.dataHeatBal->ZoneAirSolutionAlgo) { case DataHeatBalance::SolutionAlgo::ThirdOrder: { - LoadToCoolingSetPoint = this->TempDepZnLd * thisTempZoneThermostatSetPoint - this->TempIndZnLd; + LoadToCoolingSetPoint = this->tempDepLoad * thisTempZoneThermostatSetPoint - this->tempIndLoad; break; } case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { - if (this->TempDepZnLd == 0.0) { // B=0 - LoadToCoolingSetPoint = this->AirPowerCap * (thisTempZoneThermostatSetPoint - this->ZoneT1) - this->TempIndZnLd; + if (this->tempDepLoad == 0.0) { // B=0 + LoadToCoolingSetPoint = this->AirPowerCap * (thisTempZoneThermostatSetPoint - this->T1) - this->tempIndLoad; } else { - Real64 const exp_700_TA(std::exp(min(700.0, -this->TempDepZnLd / this->AirPowerCap))); + Real64 const exp_700_TA(std::exp(min(700.0, -this->tempDepLoad / this->AirPowerCap))); LoadToCoolingSetPoint = - this->TempDepZnLd * (thisTempZoneThermostatSetPoint - this->ZoneT1 * exp_700_TA) / (1.0 - exp_700_TA) - this->TempIndZnLd; + this->tempDepLoad * (thisTempZoneThermostatSetPoint - this->T1 * exp_700_TA) / (1.0 - exp_700_TA) - this->tempIndLoad; } break; } case DataHeatBalance::SolutionAlgo::EulerMethod: { - LoadToCoolingSetPoint = this->AirPowerCap * (thisTempZoneThermostatSetPoint - this->ZoneT1) + - this->TempDepZnLd * thisTempZoneThermostatSetPoint - this->TempIndZnLd; + LoadToCoolingSetPoint = this->AirPowerCap * (thisTempZoneThermostatSetPoint - this->T1) + + this->tempDepLoad * thisTempZoneThermostatSetPoint - this->tempIndLoad; break; } default: { @@ -7236,7 +7231,7 @@ void ZoneSpaceHeatBalanceData::calcPredictedSystemLoad(EnergyPlusData &state, Re } if (RAFNFrac > 0.0) LoadToHeatingSetPoint = LoadToHeatingSetPoint / RAFNFrac; if (thisZone.HasAdjustedReturnTempByITE && !(state.dataGlobal->BeginSimFlag)) { - LoadToCoolingSetPoint = this->TempDepZnLd * thisZone.AdjustedReturnTempByITE - this->TempIndZnLd; + LoadToCoolingSetPoint = this->tempDepLoad * thisZone.AdjustedReturnTempByITE - this->tempIndLoad; } totalLoad = LoadToCoolingSetPoint; ZoneSetPoint = thisTempZoneThermostatSetPoint; @@ -7248,28 +7243,28 @@ void ZoneSpaceHeatBalanceData::calcPredictedSystemLoad(EnergyPlusData &state, Re case DataHVACGlobals::ThermostatType::SingleHeatCool: switch (state.dataHeatBal->ZoneAirSolutionAlgo) { case DataHeatBalance::SolutionAlgo::ThirdOrder: { - LoadToHeatingSetPoint = (this->TempDepZnLd * (thisTempZoneThermostatSetPoint) - this->TempIndZnLd); - LoadToCoolingSetPoint = (this->TempDepZnLd * (thisTempZoneThermostatSetPoint) - this->TempIndZnLd); + LoadToHeatingSetPoint = (this->tempDepLoad * (thisTempZoneThermostatSetPoint) - this->tempIndLoad); + LoadToCoolingSetPoint = (this->tempDepLoad * (thisTempZoneThermostatSetPoint) - this->tempIndLoad); break; } case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { - if (this->TempDepZnLd == 0.0) { // B=0 - LoadToHeatingSetPoint = this->AirPowerCap * (thisTempZoneThermostatSetPoint - this->ZoneT1) - this->TempIndZnLd; - LoadToCoolingSetPoint = this->AirPowerCap * (thisTempZoneThermostatSetPoint - this->ZoneT1) - this->TempIndZnLd; + if (this->tempDepLoad == 0.0) { // B=0 + LoadToHeatingSetPoint = this->AirPowerCap * (thisTempZoneThermostatSetPoint - this->T1) - this->tempIndLoad; + LoadToCoolingSetPoint = this->AirPowerCap * (thisTempZoneThermostatSetPoint - this->T1) - this->tempIndLoad; } else { - Real64 const exp_700_TA(std::exp(min(700.0, -this->TempDepZnLd / this->AirPowerCap))); + Real64 const exp_700_TA(std::exp(min(700.0, -this->tempDepLoad / this->AirPowerCap))); LoadToHeatingSetPoint = - this->TempDepZnLd * (thisTempZoneThermostatSetPoint - this->ZoneT1 * exp_700_TA) / (1.0 - exp_700_TA) - this->TempIndZnLd; + this->tempDepLoad * (thisTempZoneThermostatSetPoint - this->T1 * exp_700_TA) / (1.0 - exp_700_TA) - this->tempIndLoad; LoadToCoolingSetPoint = - this->TempDepZnLd * (thisTempZoneThermostatSetPoint - this->ZoneT1 * exp_700_TA) / (1.0 - exp_700_TA) - this->TempIndZnLd; + this->tempDepLoad * (thisTempZoneThermostatSetPoint - this->T1 * exp_700_TA) / (1.0 - exp_700_TA) - this->tempIndLoad; } break; } case DataHeatBalance::SolutionAlgo::EulerMethod: { - LoadToHeatingSetPoint = this->AirPowerCap * (thisTempZoneThermostatSetPoint - this->ZoneT1) + - this->TempDepZnLd * thisTempZoneThermostatSetPoint - this->TempIndZnLd; - LoadToCoolingSetPoint = this->AirPowerCap * (thisTempZoneThermostatSetPoint - this->ZoneT1) + - this->TempDepZnLd * thisTempZoneThermostatSetPoint - this->TempIndZnLd; + LoadToHeatingSetPoint = this->AirPowerCap * (thisTempZoneThermostatSetPoint - this->T1) + + this->tempDepLoad * thisTempZoneThermostatSetPoint - this->tempIndLoad; + LoadToCoolingSetPoint = this->AirPowerCap * (thisTempZoneThermostatSetPoint - this->T1) + + this->tempDepLoad * thisTempZoneThermostatSetPoint - this->tempIndLoad; break; } default: { @@ -7281,7 +7276,7 @@ void ZoneSpaceHeatBalanceData::calcPredictedSystemLoad(EnergyPlusData &state, Re if (RAFNFrac > 0.0) LoadToCoolingSetPoint = LoadToCoolingSetPoint / RAFNFrac; if (thisZone.HasAdjustedReturnTempByITE && !(state.dataGlobal->BeginSimFlag)) { - LoadToCoolingSetPoint = this->TempDepZnLd * thisZone.AdjustedReturnTempByITE - this->TempIndZnLd; + LoadToCoolingSetPoint = this->tempDepLoad * thisZone.AdjustedReturnTempByITE - this->tempIndLoad; } // Note that LoadToHeatingSetPoint is generally not equal to LoadToCoolingSetPoint @@ -7303,8 +7298,8 @@ void ZoneSpaceHeatBalanceData::calcPredictedSystemLoad(EnergyPlusData &state, Re ShowContinueErrorTimeStamp(state, format("occurs in Zone={}", thisZone.Name)); ShowContinueError(state, format("LoadToHeatingSetPoint={:.3R}, LoadToCoolingSetPoint={:.3R}", LoadToHeatingSetPoint, LoadToCoolingSetPoint)); - ShowContinueError(state, format("Zone TempDepZnLd={:.2R}", this->TempDepZnLd)); - ShowContinueError(state, format("Zone TempIndZnLd={:.2R}", this->TempIndZnLd)); + ShowContinueError(state, format("Zone TempDepZnLd={:.2R}", this->tempDepLoad)); + ShowContinueError(state, format("Zone TempIndZnLd={:.2R}", this->tempIndLoad)); ShowContinueError(state, format("Zone ThermostatSetPoint={:.2R}", thisTempZoneThermostatSetPoint)); ShowFatalError(state, "Program terminates due to above conditions."); } @@ -7327,8 +7322,8 @@ void ZoneSpaceHeatBalanceData::calcPredictedSystemLoad(EnergyPlusData &state, Re ShowContinueErrorTimeStamp(state, format("occurs in Zone={}", thisZone.Name)); ShowContinueError(state, format("LoadToHeatingSetPoint={:.3R}, LoadToCoolingSetPoint={:.3R}", LoadToHeatingSetPoint, LoadToCoolingSetPoint)); - ShowContinueError(state, format("Zone TempDepZnLd={:.2R}", this->TempDepZnLd)); - ShowContinueError(state, format("Zone TempIndZnLd={:.2R}", this->TempIndZnLd)); + ShowContinueError(state, format("Zone TempDepZnLd={:.2R}", this->tempDepLoad)); + ShowContinueError(state, format("Zone TempIndZnLd={:.2R}", this->tempIndLoad)); ShowContinueError(state, format("Zone ThermostatSetPoint={:.2R}", thisTempZoneThermostatSetPoint)); ShowFatalError(state, "Program terminates due to above conditions."); } @@ -7336,28 +7331,28 @@ void ZoneSpaceHeatBalanceData::calcPredictedSystemLoad(EnergyPlusData &state, Re case DataHVACGlobals::ThermostatType::DualSetPointWithDeadBand: switch (state.dataHeatBal->ZoneAirSolutionAlgo) { case DataHeatBalance::SolutionAlgo::ThirdOrder: { - LoadToHeatingSetPoint = (this->TempDepZnLd * (thisZoneThermostatSetPointLo) - this->TempIndZnLd); - LoadToCoolingSetPoint = (this->TempDepZnLd * (thisZoneThermostatSetPointHi) - this->TempIndZnLd); + LoadToHeatingSetPoint = (this->tempDepLoad * (thisZoneThermostatSetPointLo) - this->tempIndLoad); + LoadToCoolingSetPoint = (this->tempDepLoad * (thisZoneThermostatSetPointHi) - this->tempIndLoad); break; } case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { - if (this->TempDepZnLd == 0.0) { // B=0 - LoadToHeatingSetPoint = this->AirPowerCap * (thisZoneThermostatSetPointLo - this->ZoneT1) - this->TempIndZnLd; - LoadToCoolingSetPoint = this->AirPowerCap * (thisZoneThermostatSetPointHi - this->ZoneT1) - this->TempIndZnLd; + if (this->tempDepLoad == 0.0) { // B=0 + LoadToHeatingSetPoint = this->AirPowerCap * (thisZoneThermostatSetPointLo - this->T1) - this->tempIndLoad; + LoadToCoolingSetPoint = this->AirPowerCap * (thisZoneThermostatSetPointHi - this->T1) - this->tempIndLoad; } else { - Real64 const exp_700_TA(std::exp(min(700.0, -this->TempDepZnLd / this->AirPowerCap))); + Real64 const exp_700_TA(std::exp(min(700.0, -this->tempDepLoad / this->AirPowerCap))); LoadToHeatingSetPoint = - this->TempDepZnLd * (thisZoneThermostatSetPointLo - this->ZoneT1 * exp_700_TA) / (1.0 - exp_700_TA) - this->TempIndZnLd; + this->tempDepLoad * (thisZoneThermostatSetPointLo - this->T1 * exp_700_TA) / (1.0 - exp_700_TA) - this->tempIndLoad; LoadToCoolingSetPoint = - this->TempDepZnLd * (thisZoneThermostatSetPointHi - this->ZoneT1 * exp_700_TA) / (1.0 - exp_700_TA) - this->TempIndZnLd; + this->tempDepLoad * (thisZoneThermostatSetPointHi - this->T1 * exp_700_TA) / (1.0 - exp_700_TA) - this->tempIndLoad; } break; } case DataHeatBalance::SolutionAlgo::EulerMethod: { - LoadToHeatingSetPoint = this->AirPowerCap * (thisZoneThermostatSetPointLo - this->ZoneT1) + - this->TempDepZnLd * thisZoneThermostatSetPointLo - this->TempIndZnLd; - LoadToCoolingSetPoint = this->AirPowerCap * (thisZoneThermostatSetPointHi - this->ZoneT1) + - this->TempDepZnLd * thisZoneThermostatSetPointHi - this->TempIndZnLd; + LoadToHeatingSetPoint = + this->AirPowerCap * (thisZoneThermostatSetPointLo - this->T1) + this->tempDepLoad * thisZoneThermostatSetPointLo - this->tempIndLoad; + LoadToCoolingSetPoint = + this->AirPowerCap * (thisZoneThermostatSetPointHi - this->T1) + this->tempDepLoad * thisZoneThermostatSetPointHi - this->tempIndLoad; break; } default: { @@ -7368,7 +7363,7 @@ void ZoneSpaceHeatBalanceData::calcPredictedSystemLoad(EnergyPlusData &state, Re if (RAFNFrac > 0.0) LoadToCoolingSetPoint = LoadToCoolingSetPoint / RAFNFrac; if (thisZone.HasAdjustedReturnTempByITE && !(state.dataGlobal->BeginSimFlag)) { - LoadToCoolingSetPoint = this->TempDepZnLd * thisZone.AdjustedReturnTempByITE - this->TempIndZnLd; + LoadToCoolingSetPoint = this->tempDepLoad * thisZone.AdjustedReturnTempByITE - this->tempIndLoad; } // Possible combinations: @@ -7385,8 +7380,8 @@ void ZoneSpaceHeatBalanceData::calcPredictedSystemLoad(EnergyPlusData &state, Re ShowContinueErrorTimeStamp(state, format("occurs in Zone={}", thisZone.Name)); ShowContinueError(state, format("LoadToHeatingSetPoint={:.3R}, LoadToCoolingSetPoint={:.3R}", LoadToHeatingSetPoint, LoadToCoolingSetPoint)); - ShowContinueError(state, format("Zone TempDepZnLd={:.2R}", this->TempDepZnLd)); - ShowContinueError(state, format("Zone TempIndZnLd={:.2R}", this->TempIndZnLd)); + ShowContinueError(state, format("Zone TempDepZnLd={:.2R}", this->tempDepLoad)); + ShowContinueError(state, format("Zone TempIndZnLd={:.2R}", this->tempIndLoad)); ShowContinueError(state, format("Zone Heating ThermostatSetPoint={:.2R}", thisZoneThermostatSetPointLo)); ShowContinueError(state, format("Zone Cooling ThermostatSetPoint={:.2R}", thisZoneThermostatSetPointHi)); ShowFatalError(state, "Program terminates due to above conditions."); @@ -7415,8 +7410,8 @@ void ZoneSpaceHeatBalanceData::calcPredictedSystemLoad(EnergyPlusData &state, Re format("LoadToHeatingSetPoint={:.3R}, LoadToCoolingSetPoint={:.3R}", LoadToHeatingSetPoint, LoadToCoolingSetPoint)); ShowContinueError(state, format("Zone Heating Set-point={:.2R}", thisZoneThermostatSetPointLo)); ShowContinueError(state, format("Zone Cooling Set-point={:.2R}", thisZoneThermostatSetPointHi)); - ShowContinueError(state, format("Zone TempDepZnLd={:.2R}", this->TempDepZnLd)); - ShowContinueError(state, format("Zone TempIndZnLd={:.2R}", this->TempIndZnLd)); + ShowContinueError(state, format("Zone TempDepZnLd={:.2R}", this->tempDepLoad)); + ShowContinueError(state, format("Zone TempIndZnLd={:.2R}", this->tempIndLoad)); ShowContinueError(state, format("Zone ThermostatSetPoint={:.2R}", thisTempZoneThermostatSetPoint)); ShowFatalError(state, "Program terminates due to above conditions."); @@ -7452,22 +7447,22 @@ void ZoneSpaceHeatBalanceData::calcPredictedSystemLoad(EnergyPlusData &state, Re } else if (stageNum < 0) { // Cooling load switch (state.dataHeatBal->ZoneAirSolutionAlgo) { case DataHeatBalance::SolutionAlgo::ThirdOrder: { - LoadToCoolingSetPoint = (this->TempDepZnLd * (thisZoneThermostatSetPointHi) - this->TempIndZnLd); + LoadToCoolingSetPoint = (this->tempDepLoad * (thisZoneThermostatSetPointHi) - this->tempIndLoad); break; } case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { - if (this->TempDepZnLd == 0.0) { // B=0 - LoadToCoolingSetPoint = this->AirPowerCap * (thisZoneThermostatSetPointHi - this->ZoneT1) - this->TempIndZnLd; + if (this->tempDepLoad == 0.0) { // B=0 + LoadToCoolingSetPoint = this->AirPowerCap * (thisZoneThermostatSetPointHi - this->T1) - this->tempIndLoad; } else { - Real64 const exp_700_TA(std::exp(min(700.0, -this->TempDepZnLd / this->AirPowerCap))); + Real64 const exp_700_TA(std::exp(min(700.0, -this->tempDepLoad / this->AirPowerCap))); LoadToCoolingSetPoint = - this->TempDepZnLd * (thisZoneThermostatSetPointHi - this->ZoneT1 * exp_700_TA) / (1.0 - exp_700_TA) - this->TempIndZnLd; + this->tempDepLoad * (thisZoneThermostatSetPointHi - this->T1 * exp_700_TA) / (1.0 - exp_700_TA) - this->tempIndLoad; } break; } case DataHeatBalance::SolutionAlgo::EulerMethod: { - LoadToCoolingSetPoint = this->AirPowerCap * (thisZoneThermostatSetPointHi - this->ZoneT1) + - this->TempDepZnLd * thisZoneThermostatSetPointHi - this->TempIndZnLd; + LoadToCoolingSetPoint = this->AirPowerCap * (thisZoneThermostatSetPointHi - this->T1) + + this->tempDepLoad * thisZoneThermostatSetPointHi - this->tempIndLoad; break; } default: { @@ -7481,22 +7476,22 @@ void ZoneSpaceHeatBalanceData::calcPredictedSystemLoad(EnergyPlusData &state, Re } else { // Heating load switch (state.dataHeatBal->ZoneAirSolutionAlgo) { case DataHeatBalance::SolutionAlgo::ThirdOrder: { - LoadToHeatingSetPoint = (this->TempDepZnLd * thisZoneThermostatSetPointLo - this->TempIndZnLd); + LoadToHeatingSetPoint = (this->tempDepLoad * thisZoneThermostatSetPointLo - this->tempIndLoad); break; } case DataHeatBalance::SolutionAlgo::AnalyticalSolution: { - if (this->TempDepZnLd == 0.0) { // B=0 - LoadToHeatingSetPoint = this->AirPowerCap * (thisZoneThermostatSetPointLo - this->ZoneT1) - this->TempIndZnLd; + if (this->tempDepLoad == 0.0) { // B=0 + LoadToHeatingSetPoint = this->AirPowerCap * (thisZoneThermostatSetPointLo - this->T1) - this->tempIndLoad; } else { - Real64 const exp_700_TA(std::exp(min(700.0, -this->TempDepZnLd / this->AirPowerCap))); + Real64 const exp_700_TA(std::exp(min(700.0, -this->tempDepLoad / this->AirPowerCap))); LoadToHeatingSetPoint = - this->TempDepZnLd * (thisZoneThermostatSetPointLo - this->ZoneT1 * exp_700_TA) / (1.0 - exp_700_TA) - this->TempIndZnLd; + this->tempDepLoad * (thisZoneThermostatSetPointLo - this->T1 * exp_700_TA) / (1.0 - exp_700_TA) - this->tempIndLoad; } break; } case DataHeatBalance::SolutionAlgo::EulerMethod: { - LoadToHeatingSetPoint = this->AirPowerCap * (thisZoneThermostatSetPointLo - this->ZoneT1) + - this->TempDepZnLd * (thisZoneThermostatSetPointLo) - this->TempIndZnLd; + LoadToHeatingSetPoint = this->AirPowerCap * (thisZoneThermostatSetPointLo - this->T1) + + this->tempDepLoad * (thisZoneThermostatSetPointLo) - this->tempIndLoad; break; } default: { @@ -7516,9 +7511,9 @@ void ZoneSpaceHeatBalanceData::calcPredictedSystemLoad(EnergyPlusData &state, Re state.dataLoopNodes->Node(zoneNodeNum).TempSetPoint = ZoneSetPoint; } - state.dataZoneEnergyDemand->Setback(zoneNum) = (ZoneSetPoint > this->ZoneSetPointLast); + state.dataZoneEnergyDemand->Setback(zoneNum) = (ZoneSetPoint > this->setPointLast); - this->ZoneSetPointLast = ZoneSetPoint; + this->setPointLast = ZoneSetPoint; state.dataHeatBalFanSys->TempZoneThermostatSetPoint(zoneNum) = ZoneSetPoint; // needed to fix Issue # 5048 state.dataZoneEnergyDemand->DeadBandOrSetback(zoneNum) = thisDeadBandOrSetBack; state.dataZoneEnergyDemand->CurDeadBandOrSetback(zoneNum) = thisDeadBandOrSetBack; diff --git a/src/EnergyPlus/ZoneTempPredictorCorrector.hh b/src/EnergyPlus/ZoneTempPredictorCorrector.hh index 01721743896..b7b00285095 100644 --- a/src/EnergyPlus/ZoneTempPredictorCorrector.hh +++ b/src/EnergyPlus/ZoneTempPredictorCorrector.hh @@ -134,32 +134,29 @@ namespace ZoneTempPredictorCorrector { DataHeatBalance::ZoneInitialTemp, DataHeatBalance::ZoneInitialTemp}; // Down Stepped air temperature history storage // Exact and Euler solutions - Real64 ZoneTMX = DataHeatBalance::ZoneInitialTemp; // Temporary air temperature to test convergence in Exact and Euler method - Real64 ZoneTM2 = DataHeatBalance::ZoneInitialTemp; // Temporary air temperature at timestep t-2 in Exact and Euler method - Real64 ZoneT1 = 0.0; // Air temperature at the previous time step used in Exact and Euler method + Real64 TMX = DataHeatBalance::ZoneInitialTemp; // Temporary air temperature to test convergence in Exact and Euler method + Real64 TM2 = DataHeatBalance::ZoneInitialTemp; // Temporary air temperature at timestep t-2 in Exact and Euler method + Real64 T1 = 0.0; // Air temperature at the previous time step used in Exact and Euler method // Zone or space air moisture conditions - Real64 ZoneAirHumRat = 0.01; // Air Humidity Ratio - Real64 ZoneAirHumRatAvg = 0.01; // Air Humidity Ratio averaged over the zone time step - Real64 ZoneAirHumRatTemp = 0.01; // Temporary air humidity ratio at time plus 1 - Real64 ZoneAirHumRatAvgComf = 0.01; // Air Humidity Ratio averaged over the zone time - // step used in thermal comfort models (currently Fang model only) - // TODO: lagged? could ZoneAirHumRatAvg be used instead? + Real64 airHumRat = 0.01; // Air Humidity Ratio + Real64 airHumRatAvg = 0.01; // Air Humidity Ratio averaged over the zone time step + Real64 airHumRatTemp = 0.01; // Temporary air humidity ratio at time plus 1 + Real64 airHumRatAvgComf = 0.01; // Air Humidity Ratio averaged over the zone time + // step used in thermal comfort models (currently Fang model only) + // TODO: lagged? could ZoneAirHumRatAvg be used instead? std::array WPrevZoneTS = {0.0, 0.0, 0.0, 0.0}; // Air Humidity Ratio zone time step history std::array DSWPrevZoneTS = {0.0, 0.0, 0.0, 0.0}; // DownStepped Air Humidity Ratio zone time step history for 3rd order derivative - Real64 WZoneTimeMinusP = 0.0; // Air Humidity Ratio at previous system time step + Real64 WTimeMinusP = 0.0; // Air Humidity Ratio at previous system time step // Exact and Euler solutions - Real64 ZoneWMX = 0.0; // Temporary humidity ratio to test convergence in Exact and Euler method - Real64 ZoneWM2 = 0.0; // Temporary humidity ratio at timestep t-2 in Exact and Euler method - Real64 ZoneW1 = 0.0; // Zone/space humidity ratio at the previous time step used in Exact and Euler method + Real64 WMX = 0.0; // Temporary humidity ratio to test convergence in Exact and Euler method + Real64 WM2 = 0.0; // Temporary humidity ratio at timestep t-2 in Exact and Euler method + Real64 W1 = 0.0; // Zone/space humidity ratio at the previous time step used in Exact and Euler method std::array ZTM = { 0.0, 0.0, 0.0, 0.0}; // air temperature at previous 3 zone timesteps (sized to 4 to be compatible with other similar arrays) std::array WPrevZoneTSTemp = {0.0, 0.0, 0.0, 0.0}; // Temporary Air Humidity Ratio zone time step history (4th term not used) - // Real64 WZoneTimeMinus1Temp = 0.0; // Zone air humidity ratio at previous timestep - // Real64 WZoneTimeMinus2Temp = 0.0; // Zone air humidity ratio at timestep T-2 - // Real64 WZoneTimeMinus3Temp = 0.0; // Zone air humidity ratio at timestep T-3 Real64 SumIntGain = 0.0; // Sum of convective internal gains Real64 SumHA = 0.0; // Sum of Hc*Area @@ -181,27 +178,27 @@ namespace ZoneTempPredictorCorrector { Real64 TempIndCoef = 0.0; // Temperature ndependent coefficient Real64 TempHistoryTerm = 0.0; - Real64 MCPI = 0.0; // INFILTRATION MASS FLOW * AIR SPECIFIC HEAT - Real64 MCPTI = 0.0; // INFILTRATION MASS FLOW * AIR CP * AIR TEMPERATURE - Real64 MCPV = 0.0; // VENTILATION MASS FLOW * AIR SPECIFIC HEAT - Real64 MCPTV = 0.0; // VENTILATION MASS FLOW * AIR CP * AIR TEMPERATURE - Real64 MCPM = 0.0; // Mixing MASS FLOW * AIR SPECIFIC HEAT - Real64 MCPTM = 0.0; // Mixing MASS FLOW * AIR CP * AIR TEMPERATURE - Real64 MCPE = 0.0; // EARTHTUBE MASS FLOW * AIR SPECIFIC HEAT - Real64 EAMFL = 0.0; // OUTDOOR AIR MASS FLOW for EarthTube - Real64 EAMFLxHumRat = 0.0; // OUTDOOR AIR MASS FLOW * Humidity Ratio for EarthTube (water vapor mass flow) - Real64 MCPTE = 0.0; // EARTHTUBE MASS FLOW * AIR CP * AIR TEMPERATURE - Real64 MCPC = 0.0; // COOLTOWER MASS FLOW * AIR SPECIFIC HEAT - Real64 CTMFL = 0.0; // OUTDOOR AIR MASS FLOW for cooltower - Real64 MCPTC = 0.0; // COOLTOWER MASS FLOW * AIR CP * AIR TEMPERATURE - Real64 ThermChimAMFL = 0.0; // OUTDOOR AIR MASS FLOW for THERMALCHIMNEY - Real64 MCPTThermChim = 0.0; // THERMALCHIMNEY MASS FLOW * AIR SPECIFIC HEAT - Real64 MCPThermChim = 0.0; // THERMALCHIMNEY MASS FLOW * AIR CP * AIR TEMPERATURE - Real64 ZoneLatentGain = 0.0; // Latent Energy from each Zone (People, equipment) - Real64 ZoneLatentGainExceptPeople = 0.0; // Added for hybrid model -- Latent Energy from each Zone (equipment) - Real64 OAMFL = 0.0; // OUTDOOR AIR MASS FLOW (kg/s) for infiltration - Real64 VAMFL = 0.0; // OUTDOOR AIR MASS FLOW (kg/s) for ventilation - Real64 NonAirSystemResponse = 0.0; // Convective heat addition rate from non forced air + Real64 MCPI = 0.0; // INFILTRATION MASS FLOW * AIR SPECIFIC HEAT + Real64 MCPTI = 0.0; // INFILTRATION MASS FLOW * AIR CP * AIR TEMPERATURE + Real64 MCPV = 0.0; // VENTILATION MASS FLOW * AIR SPECIFIC HEAT + Real64 MCPTV = 0.0; // VENTILATION MASS FLOW * AIR CP * AIR TEMPERATURE + Real64 MCPM = 0.0; // Mixing MASS FLOW * AIR SPECIFIC HEAT + Real64 MCPTM = 0.0; // Mixing MASS FLOW * AIR CP * AIR TEMPERATURE + Real64 MCPE = 0.0; // EARTHTUBE MASS FLOW * AIR SPECIFIC HEAT + Real64 EAMFL = 0.0; // OUTDOOR AIR MASS FLOW for EarthTube + Real64 EAMFLxHumRat = 0.0; // OUTDOOR AIR MASS FLOW * Humidity Ratio for EarthTube (water vapor mass flow) + Real64 MCPTE = 0.0; // EARTHTUBE MASS FLOW * AIR CP * AIR TEMPERATURE + Real64 MCPC = 0.0; // COOLTOWER MASS FLOW * AIR SPECIFIC HEAT + Real64 CTMFL = 0.0; // OUTDOOR AIR MASS FLOW for cooltower + Real64 MCPTC = 0.0; // COOLTOWER MASS FLOW * AIR CP * AIR TEMPERATURE + Real64 ThermChimAMFL = 0.0; // OUTDOOR AIR MASS FLOW for THERMALCHIMNEY + Real64 MCPTThermChim = 0.0; // THERMALCHIMNEY MASS FLOW * AIR SPECIFIC HEAT + Real64 MCPThermChim = 0.0; // THERMALCHIMNEY MASS FLOW * AIR CP * AIR TEMPERATURE + Real64 latentGain = 0.0; // Latent Energy from each Zone (People, equipment) + Real64 latentGainExceptPeople = 0.0; // Added for hybrid model -- Latent Energy from each Zone (equipment) + Real64 OAMFL = 0.0; // OUTDOOR AIR MASS FLOW (kg/s) for infiltration + Real64 VAMFL = 0.0; // OUTDOOR AIR MASS FLOW (kg/s) for ventilation + Real64 NonAirSystemResponse = 0.0; // Convective heat addition rate from non forced air // equipment such as baseboards plus heat from lights to Real64 SysDepZoneLoads = 0.0; // Convective heat addition or subtraction rate from sources that // depend on what is happening with the HVAC system. Such as: @@ -218,11 +215,11 @@ namespace ZoneTempPredictorCorrector { Real64 MixingMassFlowZone = 0.0; // Mixing MASS FLOW (kg/s) Real64 MixingMassFlowXHumRat = 0.0; // Mixing MASS FLOW * Humidity Ratio - Real64 ZoneSetPointLast = 0.0; - Real64 TempIndZnLd = 0.0; - Real64 TempDepZnLd = 0.0; - Real64 ZoneAirRelHum = 0.0; // Zone relative humidity in percent - Real64 AirPowerCap = 0.0; // "air power capacity" Vol*VolMult*rho*Cp/timestep [W/degK] + Real64 setPointLast = 0.0; + Real64 tempIndLoad = 0.0; + Real64 tempDepLoad = 0.0; + Real64 airRelHum = 0.0; // Zone relative humidity in percent + Real64 AirPowerCap = 0.0; // "air power capacity" Vol*VolMult*rho*Cp/timestep [W/degK] void beginEnvironmentInit(EnergyPlusData &state); @@ -461,7 +458,7 @@ struct ZoneTempPredictorCorrectorData : BaseGlobalStruct void clear_state() override { - *this = ZoneTempPredictorCorrectorData(); + new (this) ZoneTempPredictorCorrectorData(); } }; diff --git a/tst/EnergyPlus/unit/AirflowNetworkConditions.unit.cc b/tst/EnergyPlus/unit/AirflowNetworkConditions.unit.cc index 2eea2c19960..ff2ca30e7a1 100644 --- a/tst/EnergyPlus/unit/AirflowNetworkConditions.unit.cc +++ b/tst/EnergyPlus/unit/AirflowNetworkConditions.unit.cc @@ -6022,7 +6022,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_BasicAdvancedSingleSidedAvoidCrashTest) // #6912 state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 23.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.001; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.001; state->dataEnvrn->OutDryBulbTemp = -17.29025; state->dataEnvrn->OutHumRat = 0.0008389; state->dataEnvrn->OutBaroPress = 99063.0; diff --git a/tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc b/tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc index c808d9aa5d9..ffba57db953 100644 --- a/tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc +++ b/tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc @@ -2245,14 +2245,14 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestPressureStat) state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).MAT = 23.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance(3).MAT = 23.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance(4).MAT = 5.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.0007; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).ZoneAirHumRat = 0.0011; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(3).ZoneAirHumRat = 0.0012; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(4).ZoneAirHumRat = 0.0008; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRatAvg = 0.0007; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).ZoneAirHumRatAvg = 0.0011; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(3).ZoneAirHumRatAvg = 0.0012; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(4).ZoneAirHumRatAvg = 0.0008; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.0007; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).airHumRat = 0.0011; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(3).airHumRat = 0.0012; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(4).airHumRat = 0.0008; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvg = 0.0007; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).airHumRatAvg = 0.0011; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(3).airHumRatAvg = 0.0012; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(4).airHumRatAvg = 0.0008; state->dataZoneEquip->ZoneEquipConfig.allocate(4); state->dataZoneEquip->ZoneEquipConfig(1).IsControlled = false; state->dataZoneEquip->ZoneEquipConfig(2).IsControlled = false; @@ -2277,14 +2277,14 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestPressureStat) EXPECT_NEAR(91.8528571, state->afn->AirflowNetworkReportData(3).MultiZoneInfiLatLossW, 0.0001); auto &thisZoneHB = state->dataZoneTempPredictorCorrector->zoneHeatBalance(1); - Real64 hg = Psychrometrics::PsyHgAirFnWTdb(thisZoneHB.ZoneAirHumRat, thisZoneHB.MAT); - Real64 hzone = Psychrometrics::PsyHFnTdbW(thisZoneHB.MAT, thisZoneHB.ZoneAirHumRat); + Real64 hg = Psychrometrics::PsyHgAirFnWTdb(thisZoneHB.airHumRat, thisZoneHB.MAT); + Real64 hzone = Psychrometrics::PsyHFnTdbW(thisZoneHB.MAT, thisZoneHB.airHumRat); Real64 hamb = Psychrometrics::PsyHFnTdbW(0.0, state->dataEnvrn->OutHumRat); Real64 hdiff = state->afn->AirflowNetworkLinkSimu(1).FLOW2 * (hzone - hamb); Real64 sum = state->afn->AirflowNetworkReportData(1).MultiZoneInfiSenLossW - state->afn->AirflowNetworkReportData(1).MultiZoneInfiLatGainW; // Existing code uses T_average to calculate hg, get close results EXPECT_NEAR(hdiff, sum, 0.4); - Real64 dhlatent = state->afn->AirflowNetworkLinkSimu(1).FLOW2 * hg * (thisZoneHB.ZoneAirHumRat - state->dataEnvrn->OutHumRat); + Real64 dhlatent = state->afn->AirflowNetworkLinkSimu(1).FLOW2 * hg * (thisZoneHB.airHumRat - state->dataEnvrn->OutHumRat); // when hg is calculated with indoor temperature, get exact results sum = state->afn->AirflowNetworkReportData(1).MultiZoneInfiSenLossW + dhlatent; EXPECT_NEAR(hdiff, sum, 0.001); @@ -6024,8 +6024,8 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_MultiAirLoopTest) state->dataZoneEquip->ZoneEquipConfig.allocate(5); for (auto &thisZoneHB : state->dataZoneTempPredictorCorrector->zoneHeatBalance) { thisZoneHB.MAT = 23.0; - thisZoneHB.ZoneAirHumRat = 0.001; - thisZoneHB.ZoneAirHumRatAvg = 0.001; + thisZoneHB.airHumRat = 0.001; + thisZoneHB.airHumRatAvg = 0.001; } state->dataHeatBal->Zone(1).OutDryBulbTemp = state->dataEnvrn->OutDryBulbTemp; state->dataHeatBal->Zone(2).OutDryBulbTemp = state->dataEnvrn->OutDryBulbTemp; @@ -10488,11 +10488,11 @@ TEST_F(EnergyPlusFixture, DISABLED_AirLoopNumTest) state->dataZoneTempPredictorCorrector->zoneHeatBalance(3).MAT = 23.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance(4).MAT = 23.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance(5).MAT = 23.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.001; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).ZoneAirHumRat = 0.001; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(3).ZoneAirHumRat = 0.001; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(4).ZoneAirHumRat = 0.001; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(5).ZoneAirHumRat = 0.001; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.001; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).airHumRat = 0.001; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(3).airHumRat = 0.001; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(4).airHumRat = 0.001; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(5).airHumRat = 0.001; DataZoneEquipment::GetZoneEquipmentData(*state); ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); @@ -16245,7 +16245,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_DuctSizingTest) state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(3); for (auto &thisZoneHB : state->dataZoneTempPredictorCorrector->zoneHeatBalance) { thisZoneHB.MAT = 23.0; - thisZoneHB.ZoneAirHumRat = 0.0008400; + thisZoneHB.airHumRat = 0.0008400; } state->dataZoneEquip->ZoneEquipList(1).EquipIndex(1) = 1; diff --git a/tst/EnergyPlus/unit/ConvectionCoefficients.unit.cc b/tst/EnergyPlus/unit/ConvectionCoefficients.unit.cc index 3677c0a16a5..4ab480b5e04 100644 --- a/tst/EnergyPlus/unit/ConvectionCoefficients.unit.cc +++ b/tst/EnergyPlus/unit/ConvectionCoefficients.unit.cc @@ -830,7 +830,7 @@ TEST_F(ConvectionCoefficientsFixture, initIntConvCoeffAdjRatio) state->dataHeatBalSurf->SurfTempInTmp.dimension(7, 20.0); state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 25.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRatAvg = 0.006; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvg = 0.006; state->dataHeatBalSurf->SurfHConvInt.allocate(7); state->dataHeatBalSurf->SurfHConvInt(7) = 0.0; diff --git a/tst/EnergyPlus/unit/CoolTower.unit.cc b/tst/EnergyPlus/unit/CoolTower.unit.cc index 79b46a5ae7a..533df9f7978 100644 --- a/tst/EnergyPlus/unit/CoolTower.unit.cc +++ b/tst/EnergyPlus/unit/CoolTower.unit.cc @@ -92,7 +92,7 @@ TEST_F(EnergyPlusFixture, ExerciseCoolTower) state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MCPC = 1; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MCPTC = 1; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).CTMFL = 1; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 1; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 1; state->dataEnvrn->OutDryBulbTemp = 35.0; state->dataEnvrn->OutWetBulbTemp = 26.0; diff --git a/tst/EnergyPlus/unit/HVACManager.unit.cc b/tst/EnergyPlus/unit/HVACManager.unit.cc index b48074b4040..c80efbabdc5 100644 --- a/tst/EnergyPlus/unit/HVACManager.unit.cc +++ b/tst/EnergyPlus/unit/HVACManager.unit.cc @@ -103,10 +103,10 @@ TEST_F(EnergyPlusFixture, CrossMixingReportTest) state->dataEnvrn->OutBaroPress = 101325.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 22.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).MAT = 25.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.001; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).ZoneAirHumRat = 0.0011; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRatAvg = 0.001; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).ZoneAirHumRatAvg = 0.0011; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.001; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).airHumRat = 0.0011; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvg = 0.001; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).airHumRatAvg = 0.0011; state->dataEnvrn->StdRhoAir = 1.20; state->dataHeatBal->CrossMixing(1).ZonePtr = 1; @@ -211,10 +211,10 @@ TEST_F(EnergyPlusFixture, InfiltrationObjectLevelReport) state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).MAT = 22.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance(3).MAT = 23.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance(4).MAT = 24.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.001; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).ZoneAirHumRat = 0.001; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(3).ZoneAirHumRat = 0.001; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(4).ZoneAirHumRat = 0.001; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.001; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).airHumRat = 0.001; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(3).airHumRat = 0.001; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(4).airHumRat = 0.001; state->dataHeatBal->AirFlowFlag = true; state->dataEnvrn->OutBaroPress = 101325.0; @@ -389,10 +389,10 @@ TEST_F(EnergyPlusFixture, InfiltrationReportTest) state->dataEnvrn->OutHumRat = 0.0005; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 22.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).MAT = 25.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.001; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).ZoneAirHumRat = 0.0011; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRatAvg = 0.001; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).ZoneAirHumRatAvg = 0.0011; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.001; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).airHumRat = 0.0011; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvg = 0.001; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).airHumRatAvg = 0.0011; state->dataEnvrn->StdRhoAir = 1.20; state->dataHeatBal->Zone(1).OutDryBulbTemp = 20.0; state->dataHeatBal->Zone(2).OutDryBulbTemp = 20.0; @@ -423,12 +423,12 @@ TEST_F(EnergyPlusFixture, InfiltrationReportTest) 3600.0 * (Psychrometrics::PsyHFnTdbW(state->dataHeatBal->Zone(1).OutDryBulbTemp, state->dataEnvrn->OutHumRat) - Psychrometrics::PsyHFnTdbW(state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT, - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat)); + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat)); EXPECT_NEAR(-deltah, state->dataHeatBal->ZnAirRpt(1).InfilTotalLoss, 0.0001); deltah = state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MCPV / (Psychrometrics::PsyCpAirFnW(state->dataEnvrn->OutHumRat)) * 3600.0 * (Psychrometrics::PsyHFnTdbW(state->dataHeatBal->Zone(1).OutDryBulbTemp, state->dataEnvrn->OutHumRat) - Psychrometrics::PsyHFnTdbW(state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT, - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat)); + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat)); EXPECT_NEAR(-deltah, state->dataHeatBal->ZnAirRpt(1).VentilTotalLoss, 0.0001); } @@ -453,10 +453,10 @@ TEST_F(EnergyPlusFixture, ExfilAndExhaustReportTest) state->dataEnvrn->OutHumRat = 0.0005; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 22.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).MAT = 25.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.001; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).ZoneAirHumRat = 0.0011; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRatAvg = 0.001; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).ZoneAirHumRatAvg = 0.0011; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.001; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).airHumRat = 0.0011; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvg = 0.001; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).airHumRatAvg = 0.0011; state->dataEnvrn->StdRhoAir = 1.20; state->dataHeatBal->Zone(1).OutDryBulbTemp = 20.0; state->dataHeatBal->Zone(2).OutDryBulbTemp = 20.0; diff --git a/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc b/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc index 4185d2b2c5a..8129933d325 100644 --- a/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc @@ -804,7 +804,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfTempCalcHeatBalanceI state->dataGlobal->TimeStepZoneSec = 900; SolarShading::AllocateModuleArrays(*state); HeatBalanceManager::AllocateZoneHeatBalArrays(*state); - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.001; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.001; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 24.0; AllocateSurfaceHeatBalArrays(*state); createFacilityElectricPowerServiceObject(*state); @@ -1358,7 +1358,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfTempCalcHeatBalanceI createFacilityElectricPowerServiceObject(*state); HeatBalanceManager::AllocateZoneHeatBalArrays(*state); state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 24.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.001; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.001; SolarShading::AllocateModuleArrays(*state); SolarShading::DetermineShadowingCombinations(*state); for (int loop = 1; loop <= state->dataSurface->TotSurfaces; ++loop) { @@ -1835,7 +1835,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfPropertyLocalEnv) state->dataEnvrn->OutBaroPress = 101325.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 24.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.001; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.001; state->dataLoopNodes->Node.allocate(4); @@ -2412,7 +2412,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfPropertySrdSurfLWR) state->dataEnvrn->OutBaroPress = 101325.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 24.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.001; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.001; state->dataLoopNodes->Node.allocate(4); @@ -2982,7 +2982,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfTempCalcHeatBalanceA state->dataEnvrn->OutBaroPress = 101325.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 24.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.001; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.001; state->dataLoopNodes->Node.allocate(4); @@ -3194,7 +3194,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestResilienceMetricReport) state->dataHeatBal->Resilience.allocate(state->dataGlobal->NumOfZones); state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(state->dataGlobal->NumOfZones); state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 0.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRatAvg = 0.0; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvg = 0.0; state->dataHeatBalFanSys->ZoneThermostatSetPointLo.dimension(state->dataGlobal->NumOfZones, 22.0); state->dataHeatBalFanSys->ZoneThermostatSetPointHi.dimension(state->dataGlobal->NumOfZones, 28.0); @@ -3221,7 +3221,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestResilienceMetricReport) state->dataGlobal->HourOfDay = 1; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 25; state->dataThermalComforts->ThermalComfortData(1).FangerPMV = -4.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRatAvg = 0.00988; // RH = 50% + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvg = 0.00988; // RH = 50% CalcThermalResilience(*state); ReportThermalResilience(*state); EXPECT_NEAR(25, state->dataHeatBal->Resilience(1).ZoneHeatIndex, 0.5); @@ -3230,7 +3230,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestResilienceMetricReport) // Heat Index Case 2: Zone RH > 85, 80 < T < 87 F; state->dataGlobal->HourOfDay = 2; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 27; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRatAvg = 0.02035; // RH = 90% + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvg = 0.02035; // RH = 90% CalcThermalResilience(*state); ReportThermalResilience(*state); EXPECT_NEAR(31, state->dataHeatBal->Resilience(1).ZoneHeatIndex, 0.5); @@ -3239,7 +3239,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestResilienceMetricReport) // Heat Index Case 3: < Zone RH > 85, 80 < T < 87 F; state->dataGlobal->HourOfDay = 3; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 27; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRatAvg = 0.0022; // RH = 10% + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvg = 0.0022; // RH = 10% CalcThermalResilience(*state); ReportThermalResilience(*state); EXPECT_NEAR(26, state->dataHeatBal->Resilience(1).ZoneHeatIndex, 0.5); @@ -3248,7 +3248,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestResilienceMetricReport) // Heat Index Case 4: Rothfusz regression, other than the above conditions; state->dataGlobal->HourOfDay = 4; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 30; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRatAvg = 0.01604; // RH = 60% + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvg = 0.01604; // RH = 60% CalcThermalResilience(*state); ReportThermalResilience(*state); EXPECT_NEAR(33, state->dataHeatBal->Resilience(1).ZoneHeatIndex, 0.5); @@ -3740,7 +3740,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestThermalResilienceReportR state->dataHeatBal->Resilience.allocate(state->dataGlobal->NumOfZones); state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(state->dataGlobal->NumOfZones); state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 0.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRatAvg = 0.0; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvg = 0.0; state->dataHeatBal->Zone.allocate(state->dataGlobal->NumOfZones); state->dataHeatBalFanSys->ZoneThermostatSetPointLo.dimension(state->dataGlobal->NumOfZones, 22.0); @@ -3803,7 +3803,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestThermalResilienceReportR state->dataGlobal->HourOfDay = 1; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 25; state->dataThermalComforts->ThermalComfortData(1).FangerPMV = -4.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRatAvg = 0.00988; // RH = 50% + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvg = 0.00988; // RH = 50% CalcThermalResilience(*state); ReportThermalResilience(*state); EXPECT_NEAR(25, state->dataHeatBal->Resilience(1).ZoneHeatIndex, 0.5); @@ -3812,7 +3812,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestThermalResilienceReportR // Heat Index Case 2: Zone RH > 85, 80 < T < 87 F; state->dataGlobal->HourOfDay = 2; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 27; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRatAvg = 0.02035; // RH = 90% + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvg = 0.02035; // RH = 90% CalcThermalResilience(*state); ReportThermalResilience(*state); EXPECT_NEAR(31, state->dataHeatBal->Resilience(1).ZoneHeatIndex, 0.5); @@ -3821,7 +3821,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestThermalResilienceReportR // Heat Index Case 3: < Zone RH > 85, 80 < T < 87 F; state->dataGlobal->HourOfDay = 3; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 27; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRatAvg = 0.0022; // RH = 10% + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvg = 0.0022; // RH = 10% CalcThermalResilience(*state); ReportThermalResilience(*state); EXPECT_NEAR(26, state->dataHeatBal->Resilience(1).ZoneHeatIndex, 0.5); @@ -3830,7 +3830,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestThermalResilienceReportR // Heat Index Case 4: Rothfusz regression, other than the above conditions; state->dataGlobal->HourOfDay = 4; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 30; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRatAvg = 0.01604; // RH = 60% + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvg = 0.01604; // RH = 60% CalcThermalResilience(*state); ReportThermalResilience(*state); EXPECT_NEAR(33, state->dataHeatBal->Resilience(1).ZoneHeatIndex, 0.5); @@ -5928,8 +5928,8 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestTDDSurfWinHeatGain) state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(2); for (auto &thisZoneHB : state->dataZoneTempPredictorCorrector->zoneHeatBalance) { thisZoneHB.MAT = 24.0; - thisZoneHB.ZoneAirHumRat = 0.001; - thisZoneHB.ZoneAirHumRatAvg = 0.001; + thisZoneHB.airHumRat = 0.001; + thisZoneHB.airHumRatAvg = 0.001; } state->dataLoopNodes->Node.allocate(4); @@ -7049,7 +7049,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfPropertySurfToGndLWR state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 24.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.001; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.001; state->dataLoopNodes->Node.allocate(4); auto &InletNode1 = state->dataLoopNodes->Node(1); @@ -8292,7 +8292,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfPropertyViewFactorsR state->dataSize->ZoneEqSizing.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 24.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.001; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.001; state->dataLoopNodes->Node.allocate(4); auto &InletNode1 = state->dataLoopNodes->Node(1); diff --git a/tst/EnergyPlus/unit/HybridModel.unit.cc b/tst/EnergyPlus/unit/HybridModel.unit.cc index 6cbf38e1c5e..050b53bfd0f 100644 --- a/tst/EnergyPlus/unit/HybridModel.unit.cc +++ b/tst/EnergyPlus/unit/HybridModel.unit.cc @@ -210,7 +210,7 @@ TEST_F(EnergyPlusFixture, HybridModel_correctZoneAirTempsTest) state->dataHeatBalFanSys->PreviousMeasuredZT2(1) = 0.2; state->dataHeatBalFanSys->PreviousMeasuredZT3(1) = 0.3; state->dataHeatBal->Zone(1).OutDryBulbTemp = -5.21; - thisZoneHB.ZoneAirHumRat = 0.002083; + thisZoneHB.airHumRat = 0.002083; thisZoneHB.MCPV = 1414.60; // Assign TempDepCoef thisZoneHB.MCPTV = -3335.10; // Assign TempIndCoef state->dataEnvrn->OutBaroPress = 99166.67; @@ -235,7 +235,7 @@ TEST_F(EnergyPlusFixture, HybridModel_correctZoneAirTempsTest) state->dataHeatBalFanSys->PreviousMeasuredZT3(1) = 0.06; state->dataHeatBal->Zone(1).ZoneVolCapMultpSens = 8.0; state->dataHeatBal->Zone(1).OutDryBulbTemp = -6.71; - thisZoneHB.ZoneAirHumRat = 0.002083; + thisZoneHB.airHumRat = 0.002083; thisZoneHB.MCPV = 539.49; // Assign TempDepCoef thisZoneHB.MCPTV = 270.10; // Assign TempIndCoef state->dataEnvrn->OutBaroPress = 99250; @@ -257,7 +257,7 @@ TEST_F(EnergyPlusFixture, HybridModel_correctZoneAirTempsTest) state->dataHeatBal->Zone(1).Volume = 4000; state->dataHeatBal->Zone(1).OutDryBulbTemp = -10.62; state->dataHeatBal->Zone(1).ZoneVolCapMultpMoist = 1.0; - thisZoneHB.ZoneAirHumRat = 0.001120003; + thisZoneHB.airHumRat = 0.001120003; thisZoneHB.ZT = -6.08; state->dataEnvrn->OutHumRat = 0.0011366887816818931; state->dataHeatBalFanSys->PreviousMeasuredHumRat1(1) = 0.0011186324286; @@ -290,7 +290,7 @@ TEST_F(EnergyPlusFixture, HybridModel_correctZoneAirTempsTest) state->dataHeatBalFanSys->PreviousMeasuredZT3(1) = -2.909294101; state->dataHeatBal->Zone(1).ZoneVolCapMultpSens = 1.0; state->dataHeatBal->Zone(1).OutDryBulbTemp = -6.71; - thisZoneHB.ZoneAirHumRat = 0.0024964; + thisZoneHB.airHumRat = 0.0024964; state->dataEnvrn->OutBaroPress = 98916.7; thisZoneHB.MCPV = 5163.5; // Assign TempDepCoef thisZoneHB.MCPTV = -15956.8; // Assign TempIndCoef @@ -314,13 +314,13 @@ TEST_F(EnergyPlusFixture, HybridModel_correctZoneAirTempsTest) state->dataHeatBal->Zone(1).Volume = 4000; state->dataHeatBal->Zone(1).OutDryBulbTemp = -10.62; state->dataHeatBal->Zone(1).ZoneVolCapMultpMoist = 1.0; - thisZoneHB.ZoneAirHumRat = 0.0024964; + thisZoneHB.airHumRat = 0.0024964; thisZoneHB.ZT = -2.92; state->dataEnvrn->OutHumRat = 0.0025365002784602363; state->dataEnvrn->OutBaroPress = 98916.7; thisZoneHB.OAMFL = 0.700812; - thisZoneHB.ZoneLatentGain = 211.2; - thisZoneHB.ZoneLatentGainExceptPeople = 0.0; + thisZoneHB.latentGain = 211.2; + thisZoneHB.latentGainExceptPeople = 0.0; state->dataHeatBalFanSys->PreviousMeasuredHumRat1(1) = 0.002496356; state->dataHeatBalFanSys->PreviousMeasuredHumRat2(1) = 0.002489048; state->dataHeatBalFanSys->PreviousMeasuredHumRat3(1) = 0.002480404; @@ -349,7 +349,7 @@ TEST_F(EnergyPlusFixture, HybridModel_correctZoneAirTempsTest) state->dataHeatBalFanSys->PreviousMeasuredZT3(1) = 15.56; state->dataHeatBal->Zone(1).ZoneVolCapMultpSens = 1.0; state->dataHeatBal->Zone(1).OutDryBulbTemp = -10.62; - thisZoneHB.ZoneAirHumRat = 0.0077647; + thisZoneHB.airHumRat = 0.0077647; thisZoneHB.MCPV = 4456; // Assign TempDepCoef thisZoneHB.MCPTV = 60650; // Assign TempIndCoef state->dataEnvrn->OutBaroPress = 99500; @@ -379,7 +379,7 @@ TEST_F(EnergyPlusFixture, HybridModel_correctZoneAirTempsTest) state->dataHeatBal->Zone(1).Volume = 4000; state->dataHeatBal->Zone(1).OutDryBulbTemp = -10.62; state->dataHeatBal->Zone(1).ZoneVolCapMultpMoist = 1.0; - thisZoneHB.ZoneAirHumRat = 0.001120003; + thisZoneHB.airHumRat = 0.001120003; thisZoneHB.ZT = -6.08; state->dataEnvrn->OutHumRat = 0.0011366887816818931; state->dataHeatBalFanSys->PreviousMeasuredHumRat1(1) = 0.007855718; @@ -414,7 +414,7 @@ TEST_F(EnergyPlusFixture, HybridModel_correctZoneAirTempsTest) state->dataHeatBalFanSys->PreviousMeasuredZT3(1) = 21.11; state->dataHeatBal->Zone(1).ZoneVolCapMultpSens = 1.0; state->dataHeatBal->Zone(1).OutDryBulbTemp = -6.71; - thisZoneHB.ZoneAirHumRat = 0.0024964; + thisZoneHB.airHumRat = 0.0024964; state->dataEnvrn->OutBaroPress = 98916.7; thisZoneHB.MCPV = 6616; // Assign TempDepCoef thisZoneHB.MCPTV = 138483.2; // Assign TempIndCoef @@ -448,7 +448,7 @@ TEST_F(EnergyPlusFixture, HybridModel_correctZoneAirTempsTest) state->dataHeatBal->Zone(1).Volume = 4000; state->dataHeatBal->Zone(1).OutDryBulbTemp = -10.62; state->dataHeatBal->Zone(1).ZoneVolCapMultpMoist = 1.0; - thisZoneHB.ZoneAirHumRat = 0.001120003; + thisZoneHB.airHumRat = 0.001120003; thisZoneHB.ZT = -6.08; state->dataEnvrn->OutHumRat = 0.0011366887816818931; state->dataHeatBalFanSys->PreviousMeasuredHumRat1(1) = 0.011085257; @@ -578,7 +578,7 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneContaminantsTest) state->dataHybridModel->HybridModelZone(1).HybridStartDayOfYear = 1; state->dataHybridModel->HybridModelZone(1).HybridEndDayOfYear = 2; state->dataHeatBal->Zone(1).ZoneVolCapMultpCO2 = 1.0; - thisZoneHB.ZoneAirHumRat = 0.001120003; + thisZoneHB.airHumRat = 0.001120003; state->dataContaminantBalance->OutdoorCO2 = 387.6064554; state->dataEnvrn->OutHumRat = 0.001147; state->dataEnvrn->OutBaroPress = 99500; @@ -607,7 +607,7 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneContaminantsTest) state->dataHeatBal->Zone(1).ZoneVolCapMultpCO2 = 1.0; state->dataHeatBal->Zone(1).OutDryBulbTemp = -1.0394166434012677; thisZoneHB.ZT = -2.92; - thisZoneHB.ZoneAirHumRat = 0.00112; + thisZoneHB.airHumRat = 0.00112; state->dataContaminantBalance->OutdoorCO2 = 387.6064554; state->dataEnvrn->OutBaroPress = 98916.7; thisZoneHB.OAMFL = 0.700812; @@ -634,7 +634,7 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneContaminantsTest) state->dataHybridModel->HybridModelZone(1).HybridEndDayOfYear = 2; state->dataHeatBal->Zone(1).ZoneVolCapMultpCO2 = 1.0; thisZoneHB.ZT = 15.56; - thisZoneHB.ZoneAirHumRat = 0.00809; + thisZoneHB.airHumRat = 0.00809; state->dataHeatBal->Zone(1).OutDryBulbTemp = -10.7; state->dataEnvrn->OutBaroPress = 99500; state->dataContaminantBalance->ZoneCO2Gain(1) = 0.0; @@ -666,7 +666,7 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneContaminantsTest) state->dataHybridModel->HybridModelZone(1).HybridEndDayOfYear = 2; state->dataHeatBal->Zone(1).ZoneVolCapMultpCO2 = 1.0; thisZoneHB.ZT = 21.1; - thisZoneHB.ZoneAirHumRat = 0.01102; + thisZoneHB.airHumRat = 0.01102; state->dataEnvrn->OutBaroPress = 98933.3; state->dataContaminantBalance->ZoneCO2Gain(1) = 0.00003333814; state->dataContaminantBalance->ZoneCO2GainExceptPeople(1) = 0.0; diff --git a/tst/EnergyPlus/unit/InternalHeatGains.unit.cc b/tst/EnergyPlus/unit/InternalHeatGains.unit.cc index 2313b840041..aaf60d0ad99 100644 --- a/tst/EnergyPlus/unit/InternalHeatGains.unit.cc +++ b/tst/EnergyPlus/unit/InternalHeatGains.unit.cc @@ -477,7 +477,7 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_ElectricEquipITE_BeginEnvironmentRes state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 24.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.008; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.008; InternalHeatGains::GetInternalHeatGainsInput(*state); InternalHeatGains::CalcZoneITEq(*state); @@ -893,7 +893,7 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_ElectricEquipITE_ApproachTemperature state->dataZoneEquip->ZoneEquipConfig.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 24.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.008; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.008; InternalHeatGains::GetInternalHeatGainsInput(*state); @@ -1045,7 +1045,7 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_ElectricEquipITE_DefaultCurves) state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 24.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.008; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.008; InternalHeatGains::GetInternalHeatGainsInput(*state); InternalHeatGains::CalcZoneITEq(*state); @@ -1565,7 +1565,7 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_AdjustedSupplyGoodInletNode) state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 24.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.008; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.008; InternalHeatGains::GetInternalHeatGainsInput(*state); ASSERT_FALSE(ErrorsFound); @@ -1787,7 +1787,7 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_AdjustedSupplyBadInletNode) state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 24.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.008; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.008; EXPECT_ANY_THROW(InternalHeatGains::GetInternalHeatGainsInput(*state)); } @@ -2012,7 +2012,7 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_FlowControlWithApproachTemperaturesG state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 24.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.008; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.008; InternalHeatGains::GetInternalHeatGainsInput(*state); ASSERT_FALSE(ErrorsFound); @@ -2238,7 +2238,7 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_FlowControlWithApproachTemperaturesB state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 24.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.008; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.008; ASSERT_ANY_THROW(InternalHeatGains::GetInternalHeatGainsInput(*state)); } @@ -2463,7 +2463,7 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_WarnMissingInletNode) state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 24.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.008; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.008; InternalHeatGains::GetInternalHeatGainsInput(*state); ASSERT_FALSE(ErrorsFound); @@ -2641,7 +2641,7 @@ TEST_F(EnergyPlusFixture, ITEwithUncontrolledZoneTest) state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 24.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.008; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.008; InternalHeatGains::GetInternalHeatGainsInput(*state); ASSERT_FALSE(ErrorsFound); @@ -2782,7 +2782,7 @@ TEST_F(EnergyPlusFixture, ITE_Env_Class_Fix_41C) // Test 1: 41C; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 41.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.015; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.015; InternalHeatGains::GetInternalHeatGainsInput(*state); ASSERT_FALSE(ErrorsFound); @@ -2983,7 +2983,7 @@ TEST_F(EnergyPlusFixture, ITE_Env_Class_Fix_39C) // Test 2: 39C; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 39.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.015; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.015; InternalHeatGains::GetInternalHeatGainsInput(*state); ASSERT_FALSE(ErrorsFound); @@ -3193,7 +3193,7 @@ TEST_F(EnergyPlusFixture, ITE_Env_Class_Update_Class_H1) // Test: 41C state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 41.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.015; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.015; InternalHeatGains::GetInternalHeatGainsInput(*state); ASSERT_FALSE(ErrorsFound); diff --git a/tst/EnergyPlus/unit/MoistureBalanceEMPD.unit.cc b/tst/EnergyPlus/unit/MoistureBalanceEMPD.unit.cc index 8ef951dfdb2..b77d605f323 100644 --- a/tst/EnergyPlus/unit/MoistureBalanceEMPD.unit.cc +++ b/tst/EnergyPlus/unit/MoistureBalanceEMPD.unit.cc @@ -114,7 +114,7 @@ TEST_F(EnergyPlusFixture, CheckEMPDCalc) state->dataMstBal->HMassConvInFD.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 20.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.0061285406810457849; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.0061285406810457849; // Construction surface.Construction = 1; @@ -234,7 +234,7 @@ TEST_F(EnergyPlusFixture, EMPDRcoating) state->dataMstBal->HMassConvInFD.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 20.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.0061285406810457849; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.0061285406810457849; // Construction surface.Construction = 1; @@ -319,7 +319,7 @@ TEST_F(EnergyPlusFixture, CheckEMPDCalc_Slope) state->dataMstBal->HMassConvInFD.allocate(surfNum); state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(zoneNum); state->dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum).MAT = 20.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum).ZoneAirHumRat = 0.0061285406810457849; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum).airHumRat = 0.0061285406810457849; // Construction int constNum = 1; diff --git a/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc b/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc index b1e6d48887b..4d1e2287c7b 100644 --- a/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc +++ b/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc @@ -3866,7 +3866,7 @@ TEST_F(EnergyPlusFixture, PTACDrawAirfromReturnNodeAndPlenum_Test) state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(6); for (auto &thisZoneHB : state->dataZoneTempPredictorCorrector->zoneHeatBalance) { thisZoneHB.MAT = 23.0; - thisZoneHB.ZoneAirHumRat = 0.001; + thisZoneHB.airHumRat = 0.001; } state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(state->dataGlobal->NumOfZones); @@ -3885,7 +3885,7 @@ TEST_F(EnergyPlusFixture, PTACDrawAirfromReturnNodeAndPlenum_Test) state->dataLoopNodes->Node(state->dataZoneEquip->ZoneEquipConfig(i).ZoneNode).Temp = state->dataZoneTempPredictorCorrector->zoneHeatBalance(i).MAT; state->dataLoopNodes->Node(state->dataZoneEquip->ZoneEquipConfig(i).ZoneNode).HumRat = - state->dataZoneTempPredictorCorrector->zoneHeatBalance(i).ZoneAirHumRat; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(i).airHumRat; state->dataLoopNodes->Node(state->dataZoneEquip->ZoneEquipConfig(i).ZoneNode).Enthalpy = Psychrometrics::PsyHFnTdbW(state->dataLoopNodes->Node(state->dataZoneEquip->ZoneEquipConfig(i).ZoneNode).Temp, state->dataLoopNodes->Node(state->dataZoneEquip->ZoneEquipConfig(i).ZoneNode).HumRat); @@ -3953,7 +3953,7 @@ TEST_F(EnergyPlusFixture, PTACDrawAirfromReturnNodeAndPlenum_Test) state->dataLoopNodes->Node(state->dataZoneEquip->ZoneEquipConfig(i).ZoneNode).Temp = state->dataZoneTempPredictorCorrector->zoneHeatBalance(i).MAT; state->dataLoopNodes->Node(state->dataZoneEquip->ZoneEquipConfig(i).ZoneNode).HumRat = - state->dataZoneTempPredictorCorrector->zoneHeatBalance(i).ZoneAirHumRat; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(i).airHumRat; state->dataLoopNodes->Node(state->dataZoneEquip->ZoneEquipConfig(i).ZoneNode).Enthalpy = Psychrometrics::PsyHFnTdbW(state->dataLoopNodes->Node(state->dataZoneEquip->ZoneEquipConfig(i).ZoneNode).Temp, state->dataLoopNodes->Node(state->dataZoneEquip->ZoneEquipConfig(i).ZoneNode).HumRat); diff --git a/tst/EnergyPlus/unit/PurchasedAirManager.unit.cc b/tst/EnergyPlus/unit/PurchasedAirManager.unit.cc index c8aa863ce74..c65354826f1 100644 --- a/tst/EnergyPlus/unit/PurchasedAirManager.unit.cc +++ b/tst/EnergyPlus/unit/PurchasedAirManager.unit.cc @@ -131,7 +131,7 @@ class ZoneIdealLoadsTest : public EnergyPlusFixture state->dataZoneEnergyDemand->DeadBandOrSetback.allocate(1); state->dataZoneEnergyDemand->DeadBandOrSetback(1) = false; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.07; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.07; state->dataZoneEquip->ZoneEquipInputsFilled = false; } diff --git a/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc b/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc index 69768beea1c..d8630d03e6c 100644 --- a/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc +++ b/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc @@ -298,21 +298,21 @@ TEST_F(RoomAirflowNetworkTest, RAFNTest) auto &thisZoneHB = state->dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); thisZoneHB.MAT = 20.0; - thisZoneHB.ZoneAirHumRat = 0.001; + thisZoneHB.airHumRat = 0.001; state->dataHeatBalSurf->SurfHConvInt(1) = 1.0; state->dataHeatBalSurf->SurfHConvInt(2) = 1.0; state->dataHeatBalSurf->SurfTempInTmp(1) = 25.0; state->dataHeatBalSurf->SurfTempInTmp(2) = 30.0; - state->dataMstBal->RhoVaporAirIn(1) = PsyRhovFnTdbWPb(thisZoneHB.MAT, thisZoneHB.ZoneAirHumRat, state->dataEnvrn->OutBaroPress); - state->dataMstBal->RhoVaporAirIn(2) = PsyRhovFnTdbWPb(thisZoneHB.MAT, thisZoneHB.ZoneAirHumRat, state->dataEnvrn->OutBaroPress); + state->dataMstBal->RhoVaporAirIn(1) = PsyRhovFnTdbWPb(thisZoneHB.MAT, thisZoneHB.airHumRat, state->dataEnvrn->OutBaroPress); + state->dataMstBal->RhoVaporAirIn(2) = PsyRhovFnTdbWPb(thisZoneHB.MAT, thisZoneHB.airHumRat, state->dataEnvrn->OutBaroPress); state->dataMstBal->HMassConvInFD(1) = state->dataHeatBalSurf->SurfHConvInt(1) / - ((PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, thisZoneHB.MAT, thisZoneHB.ZoneAirHumRat) + state->dataMstBal->RhoVaporAirIn(1)) * - PsyCpAirFnW(thisZoneHB.ZoneAirHumRat)); + ((PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, thisZoneHB.MAT, thisZoneHB.airHumRat) + state->dataMstBal->RhoVaporAirIn(1)) * + PsyCpAirFnW(thisZoneHB.airHumRat)); state->dataMstBal->HMassConvInFD(2) = state->dataHeatBalSurf->SurfHConvInt(2) / - ((PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, thisZoneHB.MAT, thisZoneHB.ZoneAirHumRat) + state->dataMstBal->RhoVaporAirIn(2)) * - PsyCpAirFnW(thisZoneHB.ZoneAirHumRat)); + ((PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, thisZoneHB.MAT, thisZoneHB.airHumRat) + state->dataMstBal->RhoVaporAirIn(2)) * + PsyCpAirFnW(thisZoneHB.airHumRat)); RoomAirNode = 1; InitRoomAirModelAFN(*state, ZoneNum, RoomAirNode); diff --git a/tst/EnergyPlus/unit/SecondaryDXCoils.unit.cc b/tst/EnergyPlus/unit/SecondaryDXCoils.unit.cc index 6b682e393fa..be3a005a437 100644 --- a/tst/EnergyPlus/unit/SecondaryDXCoils.unit.cc +++ b/tst/EnergyPlus/unit/SecondaryDXCoils.unit.cc @@ -162,7 +162,7 @@ TEST_F(EnergyPlusFixture, SecondaryDXHeatingCoilSingleSpeed_Test4) state->dataLoopNodes->Node.allocate(2); state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZT = 10.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.003; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.003; state->dataDXCoils->DXCoil(DXCoilNum).SecCoilAirFlow = 1.0; state->dataDXCoils->DXCoil(DXCoilNum).CompressorPartLoadRatio = 1.0; state->dataDXCoils->DXCoil(DXCoilNum).SecCoilRatedSHR = 1.0; @@ -243,7 +243,7 @@ TEST_F(EnergyPlusFixture, SecondaryDXHeatingCoilMultiSpeed_Test5) state->dataLoopNodes->Node.allocate(2); state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZT = 10.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.003; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.003; state->dataDXCoils->DXCoil(DXCoilNum).MSSecCoilAirFlow(1) = 1.0; state->dataDXCoils->DXCoil(DXCoilNum).MSSecCoilAirFlow(2) = 1.0; state->dataDXCoils->DXCoil(DXCoilNum).MSSecCoilSHRFT(1) = 0; diff --git a/tst/EnergyPlus/unit/ThermalChimney.unit.cc b/tst/EnergyPlus/unit/ThermalChimney.unit.cc index 1e95d1cda1c..ddbecabb69c 100644 --- a/tst/EnergyPlus/unit/ThermalChimney.unit.cc +++ b/tst/EnergyPlus/unit/ThermalChimney.unit.cc @@ -1155,7 +1155,7 @@ TEST_F(EnergyPlusFixture, ThermalChimney_EMSAirflow_Test) state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(state->dataGlobal->NumOfZones); for (auto &thisZoneHB : state->dataZoneTempPredictorCorrector->zoneHeatBalance) { thisZoneHB.MAT = 23.0; - thisZoneHB.ZoneAirHumRat = 0.01; + thisZoneHB.airHumRat = 0.01; } state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); diff --git a/tst/EnergyPlus/unit/ThermalComfort.unit.cc b/tst/EnergyPlus/unit/ThermalComfort.unit.cc index 164841c7dc3..3aecea23a40 100644 --- a/tst/EnergyPlus/unit/ThermalComfort.unit.cc +++ b/tst/EnergyPlus/unit/ThermalComfort.unit.cc @@ -724,7 +724,7 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcThermalComfortFanger) state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAVComf = 25.0; state->dataHeatBal->ZoneMRT(1) = 26.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRatAvgComf = 0.00529; // 0.002 to 0.006 + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvgComf = 0.00529; // 0.002 to 0.006 CalcThermalComfortFanger(*state); @@ -733,7 +733,7 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcThermalComfortFanger) state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAVComf = 26.0; state->dataHeatBal->ZoneMRT(1) = 27.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRatAvgComf = 0.00529; // 0.002 to 0.006 + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvgComf = 0.00529; // 0.002 to 0.006 CalcThermalComfortFanger(*state); @@ -742,7 +742,7 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcThermalComfortFanger) state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAVComf = 27.0; state->dataHeatBal->ZoneMRT(1) = 28.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRatAvgComf = 0.00529; // 0.002 to 0.006 + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvgComf = 0.00529; // 0.002 to 0.006 CalcThermalComfortFanger(*state); @@ -751,7 +751,7 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcThermalComfortFanger) state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAVComf = 25.0; state->dataHeatBal->ZoneMRT(1) = 26.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRatAvgComf = 0.00629; // 0.002 to 0.006 + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvgComf = 0.00629; // 0.002 to 0.006 CalcThermalComfortFanger(*state); @@ -1052,7 +1052,7 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcThermalComfortASH55) state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(state->dataGlobal->NumOfZones); state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAVComf = AirTemp; state->dataHeatBal->ZoneMRT(1) = RadTemp; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRatAvgComf = Psychrometrics::PsyWFnTdbRhPb( + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvgComf = Psychrometrics::PsyWFnTdbRhPb( *state, state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAVComf, RelHum, state->dataEnvrn->OutBaroPress); state->dataScheduleMgr->Schedule(1).CurrentValue = ActMet * BodySurfaceArea * ThermalComfort::ActLevelConv; state->dataScheduleMgr->Schedule(2).CurrentValue = CloUnit; @@ -1617,7 +1617,7 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcThermalComfortFanger_Correct_TimeSt EXPECT_NEAR(state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAVComf, 14.863733439268286, 0.001); - EXPECT_NEAR(state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRatAvgComf, 0.010564839505489259, 0.0001); + EXPECT_NEAR(state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvgComf, 0.010564839505489259, 0.0001); EXPECT_NEAR(state->dataThermalComforts->ThermalComfortData(1).FangerPMV, -5.5896341565108720, 0.001); diff --git a/tst/EnergyPlus/unit/UnitarySystem.unit.cc b/tst/EnergyPlus/unit/UnitarySystem.unit.cc index cc2d2f8e8eb..def1044d0ac 100644 --- a/tst/EnergyPlus/unit/UnitarySystem.unit.cc +++ b/tst/EnergyPlus/unit/UnitarySystem.unit.cc @@ -16166,7 +16166,7 @@ Dimensionless; !- Output Unit Type state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); auto &zoneHeatBalance = state->dataZoneTempPredictorCorrector->zoneHeatBalance(1); - zoneHeatBalance.ZoneAirHumRat = zoneNode.HumRat; + zoneHeatBalance.airHumRat = zoneNode.HumRat; zoneHeatBalance.MAT = zoneNode.Temp; state->dataZoneEquip->ZoneEquipList(1).EquipIndex(1) = 1; state->dataZoneEnergyDemand->CurDeadBandOrSetback.allocate(1); @@ -16222,7 +16222,7 @@ Dimensionless; !- Output Unit Type mixedAirNode.Temp = 24.18496; // 24C db mixedAirNode.HumRat = 0.0121542; // 17C wb mixedAirNode.Enthalpy = Psychrometrics::PsyHFnTdbW(mixedAirNode.Temp, mixedAirNode.HumRat); - zoneHeatBalance.ZoneAirHumRat = state->dataLoopNodes->Node(1).HumRat; + zoneHeatBalance.airHumRat = state->dataLoopNodes->Node(1).HumRat; zoneHeatBalance.MAT = state->dataLoopNodes->Node(1).Temp; zoneSysEnergyDemand.RemainingOutputRequired = -397.162; @@ -17610,7 +17610,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiSpeedDXCoilsDirectSolutionTes state->dataLoopNodes->Node(1).Enthalpy = Psychrometrics::PsyHFnTdbW(state->dataLoopNodes->Node(1).Temp, state->dataLoopNodes->Node(1).HumRat); state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = state->dataLoopNodes->Node(1).HumRat; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = state->dataLoopNodes->Node(1).HumRat; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = state->dataLoopNodes->Node(1).Temp; state->dataZoneEquip->ZoneEquipList(1).EquipIndex(1) = 1; state->dataZoneEnergyDemand->CurDeadBandOrSetback.allocate(1); diff --git a/tst/EnergyPlus/unit/WindowManager.unit.cc b/tst/EnergyPlus/unit/WindowManager.unit.cc index 523b5fffc40..1883bc2636d 100644 --- a/tst/EnergyPlus/unit/WindowManager.unit.cc +++ b/tst/EnergyPlus/unit/WindowManager.unit.cc @@ -213,7 +213,7 @@ TEST_F(EnergyPlusFixture, WindowFrameTest) state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZT = 0.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 0.0; state->dataHeatBal->ZoneMRT(1) = 0.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRatAvg = 0.0; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvg = 0.0; HeatBalanceManager::ManageHeatBalance(*state); @@ -249,8 +249,8 @@ TEST_F(EnergyPlusFixture, WindowFrameTest) state->dataSurface->SurfWinIRfromParentZone(winNum) = Constant::StefanBoltzmann * std::pow(T_in + Constant::KelvinConv, 4); state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = T_in; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRatAvg = 0.01; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.01; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvg = 0.01; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.01; // initial guess temperatures int numTemps = 2 + 2 * state->dataConstruction->Construct(cNum).TotGlassLayers; @@ -544,8 +544,8 @@ TEST_F(EnergyPlusFixture, WindowManager_RefAirTempTest) state->dataHeatBal->Zone(1).IsControlled = true; state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 25.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRatAvg = 0.011; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.011; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvg = 0.011; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.011; state->dataHeatBalSurf->SurfQdotRadHVACInPerArea.allocate(3); state->dataHeatBal->SurfWinQRadSWwinAbs.allocate(3, 1); @@ -2808,8 +2808,8 @@ TEST_F(EnergyPlusFixture, WindowManager_SrdLWRTest) state->dataHeatBal->Zone(1).IsControlled = true; state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 25.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRatAvg = 0.011; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.011; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvg = 0.011; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.011; // initialize simple glazing adjustment ratio state->dataHeatBalSurf->SurfWinCoeffAdjRatio.allocate(3); @@ -7682,7 +7682,7 @@ TEST_F(EnergyPlusFixture, CFS_InteriorSolarDistribution_Test) state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZT = 0.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZTAV = 0.0; state->dataHeatBal->ZoneMRT(1) = 0.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRatAvg = 0.0; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvg = 0.0; HeatBalanceManager::ManageHeatBalance(*state); @@ -7704,8 +7704,8 @@ TEST_F(EnergyPlusFixture, CFS_InteriorSolarDistribution_Test) } } state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRatAvg = 0.01; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.01; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRatAvg = 0.01; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.01; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = T_in; state->dataEnvrn->SOLCOS(1) = 0.84471127222777276; diff --git a/tst/EnergyPlus/unit/ZoneContaminantPredictorCorrector.unit.cc b/tst/EnergyPlus/unit/ZoneContaminantPredictorCorrector.unit.cc index d925a332faf..9aa175ca412 100644 --- a/tst/EnergyPlus/unit/ZoneContaminantPredictorCorrector.unit.cc +++ b/tst/EnergyPlus/unit/ZoneContaminantPredictorCorrector.unit.cc @@ -216,7 +216,7 @@ TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_AddMDotOATest) state->dataLoopNodes->Node(4).MassFlowRate = 0.03; // Zone return node state->dataLoopNodes->Node(4).HumRat = 0.000; state->dataLoopNodes->Node(5).HumRat = 0.000; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.008; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.008; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZT = 24.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MixingMassFlowZone = 0.0; @@ -346,7 +346,7 @@ TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_CorrectZoneContamina state->dataLoopNodes->Node(4).MassFlowRate = 0.03; // Zone return node state->dataLoopNodes->Node(4).HumRat = 0.000; state->dataLoopNodes->Node(5).HumRat = 0.000; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.008; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.008; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZT = 24.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MixingMassFlowZone = 0.0; @@ -515,11 +515,11 @@ TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_MultiZoneCO2ControlT state->dataLoopNodes->Node(4).MassFlowRate = 0.03; // Zone return node state->dataLoopNodes->Node(4).HumRat = 0.000; state->dataLoopNodes->Node(5).HumRat = 0.000; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.008; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.008; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZT = 24.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).ZoneAirHumRat = 0.008; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).airHumRat = 0.008; state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).ZT = 23.5; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(3).ZoneAirHumRat = 0.008; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(3).airHumRat = 0.008; state->dataZoneTempPredictorCorrector->zoneHeatBalance(3).ZT = 24.5; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MixingMassFlowZone = 0.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).MixingMassFlowZone = 0.0; @@ -701,11 +701,11 @@ TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_MultiZoneGCControlTe state->dataLoopNodes->Node(4).MassFlowRate = 0.03; // Zone return node state->dataLoopNodes->Node(4).HumRat = 0.000; state->dataLoopNodes->Node(5).HumRat = 0.000; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.008; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.008; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZT = 24.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).ZoneAirHumRat = 0.008; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).airHumRat = 0.008; state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).ZT = 23.5; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(3).ZoneAirHumRat = 0.008; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(3).airHumRat = 0.008; state->dataZoneTempPredictorCorrector->zoneHeatBalance(3).ZT = 24.5; state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MixingMassFlowZone = 0.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).MixingMassFlowZone = 0.0; diff --git a/tst/EnergyPlus/unit/ZoneEquipmentManager.unit.cc b/tst/EnergyPlus/unit/ZoneEquipmentManager.unit.cc index 105c43aa237..1658532a985 100644 --- a/tst/EnergyPlus/unit/ZoneEquipmentManager.unit.cc +++ b/tst/EnergyPlus/unit/ZoneEquipmentManager.unit.cc @@ -401,11 +401,11 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_MultiCrossMixingTest) state->dataZoneTempPredictorCorrector->zoneHeatBalance(3).MAT = 23.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance(4).MAT = 24.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance(5).MAT = 25.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.001; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).ZoneAirHumRat = 0.001; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(3).ZoneAirHumRat = 0.001; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(4).ZoneAirHumRat = 0.001; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(5).ZoneAirHumRat = 0.001; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.001; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).airHumRat = 0.001; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(3).airHumRat = 0.001; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(4).airHumRat = 0.001; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(5).airHumRat = 0.001; state->dataHeatBal->AirFlowFlag = true; state->dataScheduleMgr->Schedule(ScheduleManager::GetScheduleIndex(*state, "MIXINGAVAILSCHED")).CurrentValue = 1.0; @@ -4396,8 +4396,8 @@ TEST_F(EnergyPlusFixture, CalcAirFlowSimple_CO2andGCforRefrigerationDoorsTest) state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).MAT = 21.0; state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).MAT = 22.0; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).ZoneAirHumRat = 0.0021; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).ZoneAirHumRat = 0.0022; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(1).airHumRat = 0.0021; + state->dataZoneTempPredictorCorrector->zoneHeatBalance(2).airHumRat = 0.0022; state->dataHeatBal->TotRefDoorMixing = 1; state->dataHeatBal->TotMixing = 0; @@ -4711,7 +4711,7 @@ TEST_F(EnergyPlusFixture, CalcAirFlowSimple_WindAndStackArea) state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(state->dataGlobal->NumOfZones); auto &thisZoneHB = state->dataZoneTempPredictorCorrector->zoneHeatBalance(1); thisZoneHB.MAT = 21.0; - thisZoneHB.ZoneAirHumRat = 0.0021; + thisZoneHB.airHumRat = 0.0021; thisZoneHB.MixingMAT = 20.0; state->dataHeatBal->TotRefDoorMixing = 0; diff --git a/tst/EnergyPlus/unit/ZoneTempPredictorCorrector.unit.cc b/tst/EnergyPlus/unit/ZoneTempPredictorCorrector.unit.cc index bc7b325bc81..49c2b47d7b1 100644 --- a/tst/EnergyPlus/unit/ZoneTempPredictorCorrector.unit.cc +++ b/tst/EnergyPlus/unit/ZoneTempPredictorCorrector.unit.cc @@ -155,7 +155,7 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_CorrectZoneHumRatTest) state->dataHeatBal->ZoneIntGain.allocate(1); // Case 1 - All flows at the same humrat - thisZoneHB.ZoneW1 = 0.008; + thisZoneHB.W1 = 0.008; state->dataLoopNodes->Node(1).MassFlowRate = 0.01; // Zone inlet node 1 state->dataLoopNodes->Node(1).HumRat = 0.008; state->dataLoopNodes->Node(2).MassFlowRate = 0.02; // Zone inlet node 2 @@ -163,11 +163,11 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_CorrectZoneHumRatTest) state->dataZoneEquip->ZoneEquipConfig(1).ZoneExhBalanced = 0.0; state->dataLoopNodes->Node(3).MassFlowRate = 0.00; // Zone exhaust node 1 state->dataZoneEquip->ZoneEquipConfig(1).ZoneExh = state->dataLoopNodes->Node(3).MassFlowRate; - state->dataLoopNodes->Node(3).HumRat = thisZoneHB.ZoneW1; + state->dataLoopNodes->Node(3).HumRat = thisZoneHB.W1; state->dataLoopNodes->Node(4).MassFlowRate = 0.03; // Zone return node state->dataLoopNodes->Node(4).HumRat = 0.000; state->dataLoopNodes->Node(5).HumRat = 0.000; - thisZoneHB.ZoneAirHumRat = 0.008; + thisZoneHB.airHumRat = 0.008; thisZoneHB.OAMFL = 0.0; thisZoneHB.VAMFL = 0.0; thisZoneHB.EAMFL = 0.0; @@ -182,7 +182,7 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_CorrectZoneHumRatTest) EXPECT_NEAR(0.008, state->dataLoopNodes->Node(5).HumRat, 0.00001); // Case 2 - Unbalanced exhaust flow - thisZoneHB.ZoneW1 = 0.008; + thisZoneHB.W1 = 0.008; state->dataLoopNodes->Node(1).MassFlowRate = 0.01; // Zone inlet node 1 state->dataLoopNodes->Node(1).HumRat = 0.008; state->dataLoopNodes->Node(2).MassFlowRate = 0.02; // Zone inlet node 2 @@ -190,11 +190,11 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_CorrectZoneHumRatTest) state->dataZoneEquip->ZoneEquipConfig(1).ZoneExhBalanced = 0.0; state->dataLoopNodes->Node(3).MassFlowRate = 0.02; // Zone exhaust node 1 state->dataZoneEquip->ZoneEquipConfig(1).ZoneExh = state->dataLoopNodes->Node(3).MassFlowRate; - state->dataLoopNodes->Node(3).HumRat = thisZoneHB.ZoneW1; + state->dataLoopNodes->Node(3).HumRat = thisZoneHB.W1; state->dataLoopNodes->Node(4).MassFlowRate = 0.01; // Zone return node - state->dataLoopNodes->Node(4).HumRat = thisZoneHB.ZoneW1; + state->dataLoopNodes->Node(4).HumRat = thisZoneHB.W1; state->dataLoopNodes->Node(5).HumRat = 0.000; - thisZoneHB.ZoneAirHumRat = 0.008; + thisZoneHB.airHumRat = 0.008; thisZoneHB.OAMFL = 0.0; thisZoneHB.VAMFL = 0.0; thisZoneHB.EAMFL = 0.0; @@ -209,7 +209,7 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_CorrectZoneHumRatTest) EXPECT_NEAR(0.008, state->dataLoopNodes->Node(5).HumRat, 0.00001); // Case 3 - Balanced exhaust flow with proper source flow from mixing - thisZoneHB.ZoneW1 = 0.008; + thisZoneHB.W1 = 0.008; state->dataLoopNodes->Node(1).MassFlowRate = 0.01; // Zone inlet node 1 state->dataLoopNodes->Node(1).HumRat = 0.008; state->dataLoopNodes->Node(2).MassFlowRate = 0.02; // Zone inlet node 2 @@ -217,11 +217,11 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_CorrectZoneHumRatTest) state->dataZoneEquip->ZoneEquipConfig(1).ZoneExhBalanced = 0.02; state->dataLoopNodes->Node(3).MassFlowRate = 0.02; // Zone exhaust node 1 state->dataZoneEquip->ZoneEquipConfig(1).ZoneExh = state->dataLoopNodes->Node(3).MassFlowRate; - state->dataLoopNodes->Node(3).HumRat = thisZoneHB.ZoneW1; + state->dataLoopNodes->Node(3).HumRat = thisZoneHB.W1; state->dataLoopNodes->Node(4).MassFlowRate = 0.03; // Zone return node - state->dataLoopNodes->Node(4).HumRat = thisZoneHB.ZoneW1; + state->dataLoopNodes->Node(4).HumRat = thisZoneHB.W1; state->dataLoopNodes->Node(5).HumRat = 0.000; - thisZoneHB.ZoneAirHumRat = 0.008; + thisZoneHB.airHumRat = 0.008; thisZoneHB.OAMFL = 0.0; thisZoneHB.VAMFL = 0.0; thisZoneHB.EAMFL = 0.0; @@ -236,7 +236,7 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_CorrectZoneHumRatTest) EXPECT_NEAR(0.008, state->dataLoopNodes->Node(5).HumRat, 0.00001); // Case 4 - Balanced exhaust flow without source flow from mixing - thisZoneHB.ZoneW1 = 0.008; + thisZoneHB.W1 = 0.008; state->dataLoopNodes->Node(1).MassFlowRate = 0.01; // Zone inlet node 1 state->dataLoopNodes->Node(1).HumRat = 0.008; state->dataLoopNodes->Node(2).MassFlowRate = 0.02; // Zone inlet node 2 @@ -244,11 +244,11 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_CorrectZoneHumRatTest) state->dataZoneEquip->ZoneEquipConfig(1).ZoneExhBalanced = 0.02; state->dataLoopNodes->Node(3).MassFlowRate = 0.02; // Zone exhaust node 1 state->dataZoneEquip->ZoneEquipConfig(1).ZoneExh = state->dataLoopNodes->Node(3).MassFlowRate; - state->dataLoopNodes->Node(3).HumRat = thisZoneHB.ZoneW1; + state->dataLoopNodes->Node(3).HumRat = thisZoneHB.W1; state->dataLoopNodes->Node(4).MassFlowRate = 0.01; // Zone return node - state->dataLoopNodes->Node(4).HumRat = thisZoneHB.ZoneW1; + state->dataLoopNodes->Node(4).HumRat = thisZoneHB.W1; state->dataLoopNodes->Node(5).HumRat = 0.000; - thisZoneHB.ZoneAirHumRat = 0.008; + thisZoneHB.airHumRat = 0.008; thisZoneHB.OAMFL = 0.0; thisZoneHB.VAMFL = 0.0; thisZoneHB.EAMFL = 0.0; @@ -516,7 +516,7 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_ReportingTest) int SetPointTempSchedIndex = state->dataZoneCtrls->TempControlledZone(HeatZoneNum).SchIndx_SingleHeatSetPoint; state->dataScheduleMgr->Schedule(SetPointTempSchedIndex).CurrentValue = 20.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(HeatZoneNum).TotalOutputRequired = -1000.0; // cooling load - state->dataZoneTempPredictorCorrector->zoneHeatBalance(HeatZoneNum).TempDepZnLd = + state->dataZoneTempPredictorCorrector->zoneHeatBalance(HeatZoneNum).tempDepLoad = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(HeatZoneNum).TotalOutputRequired / state->dataScheduleMgr->Schedule(SetPointTempSchedIndex).CurrentValue; @@ -532,21 +532,21 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_ReportingTest) SetPointTempSchedIndex = state->dataZoneCtrls->TempControlledZone(HeatZoneNum).SchIndx_SingleHeatSetPoint; state->dataScheduleMgr->Schedule(SetPointTempSchedIndex).CurrentValue = 21.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(HeatZoneNum).TotalOutputRequired = 1000.0; // heating load - state->dataZoneTempPredictorCorrector->zoneHeatBalance(HeatZoneNum).TempDepZnLd = + state->dataZoneTempPredictorCorrector->zoneHeatBalance(HeatZoneNum).tempDepLoad = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(HeatZoneNum).TotalOutputRequired / state->dataScheduleMgr->Schedule(SetPointTempSchedIndex).CurrentValue; SetPointTempSchedIndex = state->dataZoneCtrls->TempControlledZone(CoolZoneNum).SchIndx_SingleCoolSetPoint; state->dataScheduleMgr->Schedule(SetPointTempSchedIndex).CurrentValue = 23.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(CoolZoneNum).TotalOutputRequired = -3000.0; // cooling load - state->dataZoneTempPredictorCorrector->zoneHeatBalance(CoolZoneNum).TempDepZnLd = + state->dataZoneTempPredictorCorrector->zoneHeatBalance(CoolZoneNum).tempDepLoad = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(CoolZoneNum).TotalOutputRequired / state->dataScheduleMgr->Schedule(SetPointTempSchedIndex).CurrentValue; SetPointTempSchedIndex = state->dataZoneCtrls->TempControlledZone(CoolHeatZoneNum).SchIndx_SingleHeatCoolSetPoint; state->dataScheduleMgr->Schedule(SetPointTempSchedIndex).CurrentValue = 22.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(CoolHeatZoneNum).TotalOutputRequired = -4000.0; // cooling load - state->dataZoneTempPredictorCorrector->zoneHeatBalance(CoolHeatZoneNum).TempDepZnLd = + state->dataZoneTempPredictorCorrector->zoneHeatBalance(CoolHeatZoneNum).tempDepLoad = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(CoolHeatZoneNum).TotalOutputRequired / state->dataScheduleMgr->Schedule(SetPointTempSchedIndex).CurrentValue; @@ -555,7 +555,7 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_ReportingTest) SetPointTempSchedIndex = state->dataZoneCtrls->TempControlledZone(DualZoneNum).SchIndx_DualSetPointWDeadBandHeat; state->dataScheduleMgr->Schedule(SetPointTempSchedIndex).CurrentValue = 20.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(DualZoneNum).TotalOutputRequired = 2500.0; // heating load - state->dataZoneTempPredictorCorrector->zoneHeatBalance(DualZoneNum).TempDepZnLd = + state->dataZoneTempPredictorCorrector->zoneHeatBalance(DualZoneNum).tempDepLoad = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(DualZoneNum).TotalOutputRequired / state->dataScheduleMgr->Schedule(SetPointTempSchedIndex).CurrentValue; @@ -597,10 +597,10 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_ReportingTest) state->dataScheduleMgr->Schedule(SetPointTempSchedIndex).CurrentValue = 25.0; state->dataZoneEnergyDemand->ZoneSysEnergyDemand(DualZoneNum).TotalOutputRequired = 1000.0; // LoadToCoolingSetPoint = ( TempDepZnLd( ZoneNum ) * ( TempZoneThermostatSetPoint( ZoneNum ) ) - TempIndZnLd( ZoneNum ) ); - state->dataZoneTempPredictorCorrector->zoneHeatBalance(DualZoneNum).TempDepZnLd = + state->dataZoneTempPredictorCorrector->zoneHeatBalance(DualZoneNum).tempDepLoad = state->dataZoneEnergyDemand->ZoneSysEnergyDemand(DualZoneNum).TotalOutputRequired / state->dataScheduleMgr->Schedule(SetPointTempSchedIndex).CurrentValue; - state->dataZoneTempPredictorCorrector->zoneHeatBalance(DualZoneNum).TempIndZnLd = 3500.0; // results in a cooling load + state->dataZoneTempPredictorCorrector->zoneHeatBalance(DualZoneNum).tempIndLoad = 3500.0; // results in a cooling load CalcZoneAirTempSetPoints(*state); state->dataZoneTempPredictorCorrector->zoneHeatBalance(DualZoneNum).calcPredictedSystemLoad(*state, 1.0, DualZoneNum); @@ -979,7 +979,7 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_calcZoneOrSpaceSums_SurfCon state->dataZoneTempPredictorCorrector->spaceHeatBalance.allocate(1); auto &thisZoneHB = state->dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum); thisZoneHB.MAT = 24.0; - thisZoneHB.ZoneAirHumRat = 0.001; + thisZoneHB.airHumRat = 0.001; state->dataHeatBal->space.allocate(1); state->dataHeatBal->spaceIntGainDevices.allocate(1); @@ -1232,11 +1232,11 @@ TEST_F(EnergyPlusFixture, SetPointWithCutoutDeltaT_test) state->dataZoneTempPredictorCorrector->spaceHeatBalance.allocate(1); auto &thisZoneHB = state->dataZoneTempPredictorCorrector->zoneHeatBalance(1); thisZoneHB.AirPowerCap = 2000; - thisZoneHB.TempDepZnLd = 1.0; - thisZoneHB.TempIndZnLd = 1.0; + thisZoneHB.tempDepLoad = 1.0; + thisZoneHB.tempIndLoad = 1.0; thisZoneHB.MAT = 20.0; - thisZoneHB.ZoneT1 = thisZoneHB.MAT; + thisZoneHB.T1 = thisZoneHB.MAT; state->dataZoneTempPredictorCorrector->NumOnOffCtrZone = 1; CalcZoneAirTempSetPoints(*state); @@ -1244,7 +1244,7 @@ TEST_F(EnergyPlusFixture, SetPointWithCutoutDeltaT_test) EXPECT_EQ(24.0, state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1)); thisZoneHB.MAT = 23.0; - thisZoneHB.ZoneT1 = thisZoneHB.MAT; + thisZoneHB.T1 = thisZoneHB.MAT; state->dataZoneCtrls->TempControlledZone(1).HeatModeLast = true; CalcZoneAirTempSetPoints(*state); PredictSystemLoads(*state, false, false, 0.01); @@ -1258,7 +1258,7 @@ TEST_F(EnergyPlusFixture, SetPointWithCutoutDeltaT_test) state->dataZoneTempPredictorCorrector->SetPointSingleCooling(1).TempSchedIndex = 3; state->dataScheduleMgr->Schedule(3).CurrentValue = 26.0; thisZoneHB.MAT = 25.0; - thisZoneHB.ZoneT1 = thisZoneHB.MAT; + thisZoneHB.T1 = thisZoneHB.MAT; state->dataZoneCtrls->TempControlledZone(1).CoolModeLast = true; CalcZoneAirTempSetPoints(*state); @@ -1267,7 +1267,7 @@ TEST_F(EnergyPlusFixture, SetPointWithCutoutDeltaT_test) state->dataZoneCtrls->TempControlledZone(1).CoolModeLast = false; thisZoneHB.MAT = 27.0; - thisZoneHB.ZoneT1 = thisZoneHB.MAT; + thisZoneHB.T1 = thisZoneHB.MAT; CalcZoneAirTempSetPoints(*state); PredictSystemLoads(*state, false, false, 0.01); EXPECT_EQ(24.0, state->dataHeatBalFanSys->ZoneThermostatSetPointHi(1)); @@ -1279,7 +1279,7 @@ TEST_F(EnergyPlusFixture, SetPointWithCutoutDeltaT_test) state->dataZoneTempPredictorCorrector->SetPointSingleHeatCool(1).TempSchedIndex = 3; state->dataScheduleMgr->Schedule(3).CurrentValue = 24.0; thisZoneHB.MAT = 25.0; - thisZoneHB.ZoneT1 = thisZoneHB.MAT; + thisZoneHB.T1 = thisZoneHB.MAT; CalcZoneAirTempSetPoints(*state); PredictSystemLoads(*state, false, false, 0.01); @@ -1296,7 +1296,7 @@ TEST_F(EnergyPlusFixture, SetPointWithCutoutDeltaT_test) state->dataScheduleMgr->Schedule(2).CurrentValue = 22.0; state->dataScheduleMgr->Schedule(3).CurrentValue = 26.0; thisZoneHB.MAT = 25.0; - thisZoneHB.ZoneT1 = thisZoneHB.MAT; + thisZoneHB.T1 = thisZoneHB.MAT; state->dataZoneCtrls->TempControlledZone(1).CoolModeLast = true; state->dataZoneCtrls->TempControlledZone(1).HeatModeLast = true; @@ -1308,7 +1308,7 @@ TEST_F(EnergyPlusFixture, SetPointWithCutoutDeltaT_test) // DualSetPointWithDeadBand : Adjust heating setpoint thisZoneHB.MAT = 21.0; - thisZoneHB.ZoneT1 = thisZoneHB.MAT; + thisZoneHB.T1 = thisZoneHB.MAT; CalcZoneAirTempSetPoints(*state); PredictSystemLoads(*state, false, false, 0.01); EXPECT_EQ(24.0, state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1)); @@ -1317,7 +1317,7 @@ TEST_F(EnergyPlusFixture, SetPointWithCutoutDeltaT_test) // DualSetPointWithDeadBand : Adjust cooling setpoint state->dataZoneCtrls->TempControlledZone(1).CoolModeLast = true; thisZoneHB.MAT = 27.0; - thisZoneHB.ZoneT1 = thisZoneHB.MAT; + thisZoneHB.T1 = thisZoneHB.MAT; CalcZoneAirTempSetPoints(*state); PredictSystemLoads(*state, false, false, 0.01); EXPECT_EQ(22.0, state->dataHeatBalFanSys->ZoneThermostatSetPointLo(1)); @@ -1359,8 +1359,8 @@ TEST_F(EnergyPlusFixture, TempAtPrevTimeStepWithCutoutDeltaT_test) state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(1); auto &thisZoneHB = state->dataZoneTempPredictorCorrector->zoneHeatBalance(1); thisZoneHB.AirPowerCap = 2000; - thisZoneHB.TempDepZnLd = 1.0; - thisZoneHB.TempIndZnLd = 1.0; + thisZoneHB.tempDepLoad = 1.0; + thisZoneHB.tempIndLoad = 1.0; thisZoneHB.MAT = 20.0; thisZoneHB.XMPT = 23.0; From b800be6ed869a3d7f5237bbf6e9f36e6ed845267 Mon Sep 17 00:00:00 2001 From: jcyuan Date: Mon, 28 Aug 2023 16:06:50 -0500 Subject: [PATCH 44/80] Revise exhaust control flow ratio calling for Exhaust System Controls. --- src/EnergyPlus/ExhaustAirSystemManager.cc | 2 +- src/EnergyPlus/ExhaustAirSystemManager.hh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EnergyPlus/ExhaustAirSystemManager.cc b/src/EnergyPlus/ExhaustAirSystemManager.cc index 55c200018de..ab75c0be2d0 100644 --- a/src/EnergyPlus/ExhaustAirSystemManager.cc +++ b/src/EnergyPlus/ExhaustAirSystemManager.cc @@ -695,7 +695,7 @@ namespace ExhaustAirSystemManager { Real64 Tin = state.dataZoneTempPredictorCorrector->zoneHeatBalance(thisExhCtrl.ZoneNum).ZT; Real64 thisExhCtrlAvailScheVal = ScheduleManager::GetCurrentScheduleValue(state, thisExhCtrl.AvailScheduleNum); - if (FlowRatio != 0.0) { + if (FlowRatio >= 0.0) { thisExhCtrl.BalancedFlow *= FlowRatio; thisExhCtrl.UnbalancedFlow *= FlowRatio; diff --git a/src/EnergyPlus/ExhaustAirSystemManager.hh b/src/EnergyPlus/ExhaustAirSystemManager.hh index 0d2ef96c4c0..9ffd895afb3 100644 --- a/src/EnergyPlus/ExhaustAirSystemManager.hh +++ b/src/EnergyPlus/ExhaustAirSystemManager.hh @@ -133,7 +133,7 @@ namespace ExhaustAirSystemManager { void SimZoneHVACExhaustControls(EnergyPlusData &state); - void CalcZoneHVACExhaustControl(EnergyPlusData &state, int const ZoneHVACExhaustControlNum, Real64 const FlowRatio = 1.0); + void CalcZoneHVACExhaustControl(EnergyPlusData &state, int const ZoneHVACExhaustControlNum, Real64 const FlowRatio = -1.0); void SizeExhaustSystem(EnergyPlusData &state, int const exhSysNum); From dfaaacb6f28e44c2e0c237725a9de5659c52a4f3 Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Mon, 28 Aug 2023 16:24:22 -0500 Subject: [PATCH 45/80] Delete unused vars in ATMixer --- src/EnergyPlus/SingleDuct.hh | 148 +++++++---------------------------- 1 file changed, 29 insertions(+), 119 deletions(-) diff --git a/src/EnergyPlus/SingleDuct.hh b/src/EnergyPlus/SingleDuct.hh index 4a5ed056643..68cfbf9d25d 100644 --- a/src/EnergyPlus/SingleDuct.hh +++ b/src/EnergyPlus/SingleDuct.hh @@ -279,52 +279,33 @@ namespace SingleDuct { { // Members // Input data - std::string Name; // name of unit - int MixerType; // type of inlet mixer, 1 = inlet side, 2 = supply side - int ZoneHVACUnitType; // type of Zone HVAC unit. ZoneHVAC:WaterToAirHeatPump =1, ZoneHVAC:FourPipeFanCoil = 2 - std::string ZoneHVACUnitName; // name of Zone HVAC unit - int SecInNode; // secondary air inlet node number - int PriInNode; // primary air inlet node number - int MixedAirOutNode; // mixed air outlet node number - int ZoneInletNode; // zone inlet node that ultimately receives air from this mixer - Real64 ZoneAirTemp; // zone air in temp - Real64 ZoneAirHumRat; // zone air in hum rat - Real64 ZoneAirEnthalpy; // zone air in enthalpy - Real64 ZoneAirPressure; // zone air in pressure - Real64 ZoneAirMassFlowRate; // zone air in mass flow rate - Real64 DOASTemp; // DOAS air in temp - Real64 DOASHumRat; // DOAS air in hum rat - Real64 DOASEnthalpy; // DOAS air in enthalpy - Real64 DOASPressure; // DOAS air in pressure - Real64 DOASMassFlowRate; // DOAS air in mass flow rate - Real64 MixedAirTemp; // mixed air in temp - Real64 MixedAirHumRat; // mixed air in hum rat - Real64 MixedAirEnthalpy; // mixed air in enthalpy - Real64 MixedAirPressure; // mixed air in pressure - Real64 MixedAirMassFlowRate; // mixed air in mass flow rate - Real64 MassFlowRateMaxAvail; // maximum air mass flow rate allowed through component - int ADUNum; // index of Air Distribution Unit - int TermUnitSizingIndex; // Pointer to TermUnitSizing and TermUnitFinalZoneSizing data for this terminal unit - bool OneTimeInitFlag; // true if one-time inits should be done - bool OneTimeInitFlag2; // true if more one-time inits should be done - int CtrlZoneInNodeIndex; // which controlled zone inlet node number corresponds with this unit - int ZoneNum; - bool NoOAFlowInputFromUser; // avoids OA calculation if no input specified by user - int OARequirementsPtr; // - Index to DesignSpecification:OutdoorAir object - int AirLoopNum; // System sizing adjustments - Real64 DesignPrimaryAirVolRate; // System sizing adjustments, filled from design OA spec using sizing mode flags. - DataZoneEquipment::PerPersonVentRateMode OAPerPersonMode; // mode for how per person rates are determined, DCV or design. - bool printWarning; // flag to print warnings only once - // Default Constructor - AirTerminalMixerData() - : MixerType(0), ZoneHVACUnitType(0), SecInNode(0), PriInNode(0), MixedAirOutNode(0), ZoneInletNode(0), ZoneAirTemp(0.0), - ZoneAirHumRat(0.0), ZoneAirEnthalpy(0.0), ZoneAirPressure(0.0), ZoneAirMassFlowRate(0.0), DOASTemp(0.0), DOASHumRat(0.0), - DOASEnthalpy(0.0), DOASPressure(0.0), DOASMassFlowRate(0.0), MixedAirTemp(0.0), MixedAirHumRat(0.0), MixedAirEnthalpy(0.0), - MixedAirPressure(0.0), MixedAirMassFlowRate(0.0), MassFlowRateMaxAvail(0.0), ADUNum(0), TermUnitSizingIndex(0), OneTimeInitFlag(true), - OneTimeInitFlag2(true), CtrlZoneInNodeIndex(0), ZoneNum(0), NoOAFlowInputFromUser(true), OARequirementsPtr(0), AirLoopNum(0), - DesignPrimaryAirVolRate(0.0), OAPerPersonMode(DataZoneEquipment::PerPersonVentRateMode::Invalid), printWarning(true) - { - } + std::string Name; // name of unit + int MixerType = 0; // type of inlet mixer, 1 = inlet side, 2 = supply side + int ZoneHVACUnitType = 0; // type of Zone HVAC unit. ZoneHVAC:WaterToAirHeatPump =1, ZoneHVAC:FourPipeFanCoil = 2 + std::string ZoneHVACUnitName; // name of Zone HVAC unit + int SecInNode = 0; // secondary air inlet node number + int PriInNode = 0; // primary air inlet node number + int MixedAirOutNode = 0; // mixed air outlet node number + int ZoneInletNode = 0; // zone inlet node that ultimately receives air from this mixer + Real64 MixedAirTemp = 0.0; // mixed air in temp + Real64 MixedAirHumRat = 0.0; // mixed air in hum rat + Real64 MixedAirEnthalpy = 0.0; // mixed air in enthalpy + Real64 MixedAirPressure = 0.0; // mixed air in pressure + Real64 MixedAirMassFlowRate = 0.0; // mixed air in mass flow rate + Real64 MassFlowRateMaxAvail = 0.0; // maximum air mass flow rate allowed through component + int ADUNum = 0; // index of Air Distribution Unit + int TermUnitSizingIndex = 0; // Pointer to TermUnitSizing and TermUnitFinalZoneSizing data for this terminal unit + bool OneTimeInitFlag = true; // true if one-time inits should be done + bool OneTimeInitFlag2 = true; // true if more one-time inits should be done + int CtrlZoneInNodeIndex = 0; // which controlled zone inlet node number corresponds with this unit + int ZoneNum = 0; + bool NoOAFlowInputFromUser = true; // avoids OA calculation if no input specified by user + int OARequirementsPtr = 0; // - Index to DesignSpecification:OutdoorAir object + int AirLoopNum = 0; // System sizing adjustments + Real64 DesignPrimaryAirVolRate = 0.0; // System sizing adjustments, filled from design OA spec using sizing mode flags. + DataZoneEquipment::PerPersonVentRateMode OAPerPersonMode = + DataZoneEquipment::PerPersonVentRateMode::Invalid; // mode for how per person rates are determined, DCV or design. + bool printWarning = true; // flag to print warnings only once void InitATMixer(EnergyPlusData &state, bool FirstHVACIteration); }; @@ -377,7 +358,7 @@ namespace SingleDuct { struct SingleDuctData : BaseGlobalStruct { - Array1D SysATMixer; + EPVector SysATMixer; Array1D sd_airterminal; std::unordered_map SysUniqueNames; Array1D_bool CheckEquipName; @@ -456,78 +437,7 @@ struct SingleDuctData : BaseGlobalStruct void clear_state() override { - this->SysATMixer.deallocate(); - this->sd_airterminal.deallocate(); - this->SysUniqueNames.clear(); - this->CheckEquipName.deallocate(); - this->NumATMixers = 0; - this->NumConstVolSys = 0; - this->NumSDAirTerminal = 0; - this->GetInputFlag = true; - this->GetATMixerFlag = true; - this->InitSysFlag = true; - this->InitATMixerFlag = true; - this->ZoneEquipmentListChecked = false; - - this->SysNumGSI = 0; // The Sys that you are currently loading input into - this->SysIndexGSI = 0; // The Sys that you are currently loading input into - this->NumVAVSysGSI = 0; - this->NumNoRHVAVSysGSI = 0; - this->NumVAVVSGSI = 0; - this->NumCBVAVSysGSI = 0; - this->NumNoRHCBVAVSysGSI = 0; - this->NumAlphasGSI = 0; - this->NumNumsGSI = 0; - this->NumCVNoReheatSysGSI = 0; - this->MaxNumsGSI = 0; // Maximum number of numeric input fields - this->MaxAlphasGSI = 0; // Maximum number of alpha input fields - this->TotalArgsGSI = 0; // Total number of alpha and numeric arguments = max for a - this->CoilInTempSS = 0.0; - this->DesCoilLoadSS = 0.0; - this->DesZoneHeatLoadSS = 0.0; - this->ZoneDesTempSS = 0.0; - this->ZoneDesHumRatSS = 0.0; - this->CoilWaterInletNodeSS = 0; - this->CoilWaterOutletNodeSS = 0; - this->CoilSteamInletNodeSS = 0; - this->CoilSteamOutletNodeSS = 0; - this->DummyWaterIndexSS = 1; - this->UserInputMaxHeatAirVolFlowRateSS = 0.0; // user input for MaxHeatAirVolFlowRate - this->MinAirMassFlowRevActSVAV = 0.0; // minimum air mass flow rate used in "reverse action" air mass flow rate calculation - this->MaxAirMassFlowRevActSVAV = 0.0; // maximum air mass flow rate used in "reverse action" air mass flow rate calculation - this->ZoneTempSCBVAV = 0.0; // zone air temperature [C] - this->MaxHeatTempSCBVAV = 0.0; // maximum supply air temperature [C] - this->MassFlowReqSCBVAV = 0.0; // air mass flow rate required to meet the coil heating load [W] - this->MassFlowActualSCBVAV = 0.0; // air mass flow rate actually used [W] - this->QZoneMaxSCBVAV = 0.0; // maximum zone heat addition rate given constraints of MaxHeatTemp and max / - this->MinMassAirFlowSCBVAV = 0.0; // the air flow rate during heating for normal acting damper - this->QZoneMax2SCBVAV = 0.0; // temporary variable - this->QZoneMax3SCBVAV = 0.0; // temporary variable - this->TAirMaxSCV = 0.0; // Maximum zone supply air temperature [C] - this->QMaxSCV = 0.0; // Maximum heat addition rate imposed by the max zone supply air temperature [W] - this->ZoneTempSCV = 0.0; // Zone temperature [C] - this->QMax2SCV = 0.0; - this->SysNumSATM = 0; - this->PriMassFlowRateCATM = 0.0; - this->PriEnthalpyCATM = 0.0; - this->PriHumRatCATM = 0.0; - this->PriTempCATM = 0.0; - this->SecAirMassFlowRateCATM = 0.0; - this->SecAirEnthalpyCATM = 0.0; - this->SecAirHumRatCATM = 0.0; - this->SecAirTempCATM = 0.0; - this->MixedAirMassFlowRateCATM = 0.0; - this->MixedAirEnthalpyCATM = 0.0; - this->MixedAirHumRatCATM = 0.0; - this->MixedAirTempCATM = 0.0; - - this->ZoneTempSDAT = 0.0; // zone air temperature [C] - this->MaxHeatTempSDAT = 0.0; // maximum supply air temperature [C] - this->MaxDeviceAirMassFlowReheatSDAT = 0.0; // air mass flow rate required to meet the coil heating load [W] - this->MassFlowReqToLimitLeavingTempSDAT = 0.0; // air mass flow rate actually used [W] - this->QZoneMaxRHTempLimitSDAT = 0.0; // maximum zone heat addition rate given constraints of MaxHeatTemp and max - this->MinMassAirFlowSDAT = 0.0; // the air flow rate during heating for normal acting damper - this->QZoneMax2SDAT = 0.0; // temporary variable + new (this) SingleDuctData(); } }; From d5e5689f0b9da6574b643c63fb75d56154bdecd0 Mon Sep 17 00:00:00 2001 From: jcyuan Date: Mon, 28 Aug 2023 23:13:36 -0500 Subject: [PATCH 46/80] Added check and reset for negative schedule values on flow fractions for zone exhaust controls. --- src/EnergyPlus/ExhaustAirSystemManager.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/EnergyPlus/ExhaustAirSystemManager.cc b/src/EnergyPlus/ExhaustAirSystemManager.cc index ab75c0be2d0..3134ddaeb2a 100644 --- a/src/EnergyPlus/ExhaustAirSystemManager.cc +++ b/src/EnergyPlus/ExhaustAirSystemManager.cc @@ -713,11 +713,17 @@ namespace ExhaustAirSystemManager { Real64 FlowFrac = 0.0; if (thisExhCtrl.MinExhFlowFracScheduleNum > 0) { FlowFrac = ScheduleManager::GetCurrentScheduleValue(state, thisExhCtrl.ExhaustFlowFractionScheduleNum); + if (FlowFrac < 0.0) { + FlowFrac = 0.0; + } } Real64 MinFlowFrac = 0.0; if (thisExhCtrl.MinExhFlowFracScheduleNum > 0) { MinFlowFrac = ScheduleManager::GetCurrentScheduleValue(state, thisExhCtrl.MinExhFlowFracScheduleNum); + if (MinFlowFrac < 0.0) { + MinFlowFrac = 0.0; + } } if (FlowFrac < MinFlowFrac) { From 98e76627db4cb9f3c710e747e317394a1c4cd3ef Mon Sep 17 00:00:00 2001 From: jcyuan Date: Tue, 29 Aug 2023 00:03:36 -0500 Subject: [PATCH 47/80] Zone Exhaust Controls added warning messaged for resetting negative schedule values. --- src/EnergyPlus/ExhaustAirSystemManager.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/EnergyPlus/ExhaustAirSystemManager.cc b/src/EnergyPlus/ExhaustAirSystemManager.cc index 3134ddaeb2a..6d17a69adca 100644 --- a/src/EnergyPlus/ExhaustAirSystemManager.cc +++ b/src/EnergyPlus/ExhaustAirSystemManager.cc @@ -714,6 +714,9 @@ namespace ExhaustAirSystemManager { if (thisExhCtrl.MinExhFlowFracScheduleNum > 0) { FlowFrac = ScheduleManager::GetCurrentScheduleValue(state, thisExhCtrl.ExhaustFlowFractionScheduleNum); if (FlowFrac < 0.0) { + ShowWarningError( + state, format("Exhaust Flow Fraction Schedule value is negative for Zone Exhaust Control Named: {};", thisExhCtrl.Name)); + ShowContinueError(state, "Reset value to zero and continue the simulation."); FlowFrac = 0.0; } } @@ -722,6 +725,10 @@ namespace ExhaustAirSystemManager { if (thisExhCtrl.MinExhFlowFracScheduleNum > 0) { MinFlowFrac = ScheduleManager::GetCurrentScheduleValue(state, thisExhCtrl.MinExhFlowFracScheduleNum); if (MinFlowFrac < 0.0) { + ShowWarningError( + state, + format("Minimum Exhaust Flow Fraction Schedule value is negative for Zone Exhaust Control Named: {};", thisExhCtrl.Name)); + ShowContinueError(state, "Reset value to zero and continue the simulation."); MinFlowFrac = 0.0; } } From a32294ea4ac77ad7b814fcbb809412d19fb9f9c3 Mon Sep 17 00:00:00 2001 From: jcyuan Date: Tue, 29 Aug 2023 07:43:11 -0500 Subject: [PATCH 48/80] Unit test. --- tst/EnergyPlus/unit/ExhaustSystem.unit.cc | 319 ++++++++++++++++++++++ 1 file changed, 319 insertions(+) diff --git a/tst/EnergyPlus/unit/ExhaustSystem.unit.cc b/tst/EnergyPlus/unit/ExhaustSystem.unit.cc index abebfb21d0a..1ce647be21b 100644 --- a/tst/EnergyPlus/unit/ExhaustSystem.unit.cc +++ b/tst/EnergyPlus/unit/ExhaustSystem.unit.cc @@ -62,6 +62,7 @@ #include #include #include +#include #include #include #include @@ -71,6 +72,7 @@ #include #include #include +#include #include #include @@ -582,3 +584,320 @@ TEST_F(EnergyPlusFixture, ZoneExhaustCtrl_CheckSupplyNode_Test) EXPECT_EQ(state->dataErrTracking->TotalSevereErrors, 1); EXPECT_EQ(state->dataErrTracking->LastSevereError, "GetExhaustControlInput: ZoneHVAC:ExhaustControl="); } + +TEST_F(EnergyPlusFixture, ZoneExhaustCtrl_Test_CalcZoneHVACExhaustControl_Call) +{ + std::string const idf_objects = delimited_string({ + "! Zone1,", + "! Zone2,", + "! Zone3,", + "! Zone4,", + + "AirLoopHVAC:ZoneMixer,", + " Mixer1, !-Name", + " Central_ExhFan_1_Inlet, !-Outlet Node Name", + " Zone1 Exhaust Outlet Node, !-Inlet 1 Node Name", + " Zone4 Exhaust Outlet Node; !-Inlet 2 Node Name", + + "AirLoopHVAC:ZoneMixer,", + " Mixer2, !-Name", + " Central_ExhFan_2_Inlet, !-Outlet Node Name", + " Zone2 Exhaust Outlet Node, !-Inlet 1 Node Name", + " Zone3 Exhaust Outlet Node; !-Inlet 2 Node Name", + + "Fan:SystemModel,", + " CentralExhaustFan1, !- Name", + " Omni_Sched, !- Availability Schedule Name", + " Central_ExhFan_1_Inlet, !- Air Inlet Node Name", + " Central_ExhFan_1_Outlet, !- Air Outlet Node Name", + " 1, !- Design Maximum Air Flow Rate {m3/s}", + " Discrete, !- Speed Control Method", + " 0.2, !- Electric Power Minimum Flow Rate Fraction", + " 10, !- Design Pressure Rise {Pa}", + " 0.9, !- Motor Efficiency", + " 1, !- Motor In Air Stream Fraction", + " autosize, !- Design Electric Power Consumption {W}", + " PowerPerFlowPerPressure, !- Design Power Sizing Method", + " , !- Electric Power Per Unit Flow Rate {W/(m3/s)}", + " 1.66667, !- Electric Power Per Unit Flow Rate Per Unit Pressure {W/((m3/s)-Pa)}", + " 0.7, !- Fan Total Efficiency", + " , !- Electric Power Function of Flow Fraction Curve Name", + " , !- Night Ventilation Mode Pressure Rise {Pa}", + " , !- Night Ventilation Mode Flow Fraction", + " , !- Motor Loss Zone Name", + " , !- Motor Loss Radiative Fraction", + " General, !- End-Use Subcategory", + " 1; !- Number of Speeds", + + "Fan:SystemModel,", + " CentralExhaustFan2, !- Name", + " Omni_Sched, !- Availability Schedule Name", + " Central_ExhFan_2_Inlet, !- Air Inlet Node Name", + " Central_ExhFan_2_Outlet, !- Air Outlet Node Name", + " 1, !- Design Maximum Air Flow Rate {m3/s}", + " Discrete, !- Speed Control Method", + " 0.2, !- Electric Power Minimum Flow Rate Fraction", + " 15, !- Design Pressure Rise {Pa}", + " 0.9, !- Motor Efficiency", + " 1, !- Motor In Air Stream Fraction", + " autosize, !- Design Electric Power Consumption {W}", + " PowerPerFlowPerPressure, !- Design Power Sizing Method", + " , !- Electric Power Per Unit Flow Rate {W/(m3/s)}", + " 1.66667, !- Electric Power Per Unit Flow Rate Per Unit Pressure {W/((m3/s)-Pa)}", + " 0.7, !- Fan Total Efficiency", + " , !- Electric Power Function of Flow Fraction Curve Name", + " , !- Night Ventilation Mode Pressure Rise {Pa}", + " , !- Night Ventilation Mode Flow Fraction", + " , !- Motor Loss Zone Name", + " , !- Motor Loss Radiative Fraction", + " General, !- End-Use Subcategory", + " 1; !- Number of Speeds", + + "AirLoopHVAC:ExhaustSystem,", + " Central Exhaust 1, !-Name", + " Mixer1, !-AirLoopHVAC:ZoneMixer Name", + " Fan:SystemModel, !-Fan Object Type", + " CentralExhaustFan1; !-Fan Name", + + "AirLoopHVAC:ExhaustSystem,", + " Central Exhaust 2, !-Name", + " Mixer2, !-AirLoopHVAC:ZoneMixer Name", + " Fan:SystemModel, !-Fan Object Type", + " CentralExhaustFan2; !-Fan Name", + + "ZoneHVAC:ExhaustControl,", + " Zone1 Exhaust Control, !-Name", + " HVACOperationSchd1, !- Availability Schedule Name", + " Zone1, !- Zone Name", + " Zone1 Exhaust Node, !- Inlet Node Name", + " Zone1 Exhaust Oulet Node, !- Outlet Node Name", + " 0.1, !- Design Flow Rate {m3/s}", + " Scheduled, !- Flow Control Type (Scheduled, or FollowSupply)", + " Zone1Exh Exhaust Flow Frac Sched, !- Flow Fraction Schedule Name", + " , !- Supply Node or NodeList Name (used with FollowSupply control type)", + " , !- Minimum Zone Temperature Limit Schedule Name", + " Zone1Exh Min Exhaust Flow Frac Sched, !- Minimum Flow Fraction Schedule Name", + " Zone1Exh FlowBalancedSched; !-Balanced Exhaust Fraction Schedule Name", + + "ZoneHVAC:ExhaustControl,", + " Zone2 Exhaust Control, !-Name", + " HVACOperationSchd, !- Availability Schedule Name", + " Zone2, !- Zone Name", + " Zone2 Exhaust Node, !- Inlet Node Name", + " Zone2 Exhaust Outlet Node, !- Outlet Node Name", + " autosize, !- Design Flow Rate {m3/s}", + " Scheduled,", + " , !- Flow Fraction Schedule Name", + " ,", + " , !- Minimum Zone Temperature Limit Schedule Name", + " Zone2Exh Min Exhaust Flow Frac Sched, !- Minimum Flow Fraction Schedule Name", + " Zone2Exh FlowBalancedSched; !-Balanced Exhaust Fraction Schedule Name", + + "ZoneHVAC:ExhaustControl,", + " Zone3 Exhaust Control, !-Name", + " HVACOperationSchd, !- Availability Schedule Name", + " Zone3, !- Zone Name", + " Zone3 Exhaust Node, !- Inlet Node Name", + " Zone3 Exhaust Outlet Node, !- Outlet Node Name", + " 0.3, !- Design Flow Rate {m3/s}", + " Scheduled, !- Flow Control Type (Scheduled, or FollowSupply)", + " Zone3Exh Exhaust Flow Frac Sched, !- Flow Fraction Schedule Name", + " , !- Supply Node or NodeList Name (used with FollowSupply control type)", + " , !- Minimum Zone Temperature Limit Schedule Name", + " Zone3Exh Min Exhaust Flow Frac Sched, !- Minimum Flow Fraction Schedule Name", + " Zone3Exh FlowBalancedSched; !-Balanced Exhaust Fraction Schedule Name", + + "ZoneHVAC:ExhaustControl,", + " Zone4 Exhaust Control, !-Name", + " HVACOperationSchd, !- Availability Schedule Name", + " Zone4, !- Zone Name", + " Zone4 Exhaust Node, !- Inlet Node Name", + " Zone4 Exhaust Outlet Node, !- Outlet Node Name", + " 0.4, !- Design Flow Rate {m3/s}", + " Scheduled, !- Flow Control Type (Scheduled, or FollowSupply)", + " Zone4Exh Exhaust Flow Frac Sched, !- Flow Fraction Schedule Name", + " , !- Supply Node or NodeList Name (used with FollowSupply control type)", + " Zone4_MinZoneTempLimitSched, !- Minimum Zone Temperature Limit Schedule Name", + " Zone4Exh Min Exhaust Flow Frac Sched, !- Minimum Flow Fraction Schedule Name", + " Zone4Exh FlowBalancedSched; !-Balanced Exhaust Fraction Schedule Name", + + "Schedule:Compact,", + " Omni_Sched, !- Name", + " Fraction, !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: AllDays, !- Field 2", + " Until: 24:00,1.0; !- Field 3", + + "Schedule:Compact,", + " HVACOperationSchd, !- Name", + " Fraction, !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: AllDays, !- Field 2", + " Until: 24:00,1.0; !- Field 3", + + "Schedule:Compact,", + " HVACOperationSchd1, !- Name", + " Fraction, !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: AllDays, !- Field 2", + " Until: 24:00,0.0; !- Field 3", + + "Schedule:Compact,", + " Zone1Exh Exhaust Flow Frac Sched, !- Name", + " Fraction, !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: AllDays, !- Field 2", + " Until: 24:00,1.0; !- Field 3", + + "Schedule:Compact,", + " Zone1_MinZoneTempLimitSched, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: AllDays, !- Field 2", + " Until: 24:00, 20; !- Field 3", + + "Schedule:Compact,", + " Zone1Exh Min Exhaust Flow Frac Sched, !- Name", + " Fraction, !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: AllDays, !- Field 2", + " Until: 24:00, 0.2; !- Field 3", + + "Schedule:Compact,", + " Zone1Exh_FlowBalancedSched, !- Name", + " Fraction, !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: AllDays, !- Field 2", + " Until: 24:00, 0.2; !- Field 3", + + "Schedule:Compact,", + " Zone2Exh Exhaust Flow Frac Sched, !- Name", + " Fraction, !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: AllDays, !- Field 2", + " Until: 24:00,1.0; !- Field 3", + + "Schedule:Compact,", + " Zone2_MinZoneTempLimitSched, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: AllDays, !- Field 2", + " Until: 24:00, 20; !- Field 3", + + "Schedule:Compact,", + " Zone2Exh Min Exhaust Flow Frac Sched, !- Name", + " Fraction, !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: AllDays, !- Field 2", + " Until: 24:00, 0.2; !- Field 3", + + "Schedule:Compact,", + " Zone2Exh_FlowBalancedSched, !- Name", + " Fraction, !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: AllDays, !- Field 2", + " Until: 24:00, 0.2; !- Field 3", + + "Schedule:Compact,", + " Zone3Exh Exhaust Flow Frac Sched, !- Name", + " Fraction, !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: AllDays, !- Field 2", + " Until: 24:00,1.0; !- Field 3", + + "Schedule:Compact,", + " Zone3_MinZoneTempLimitSched, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: AllDays, !- Field 2", + " Until: 24:00, 20; !- Field 3", + + "Schedule:Compact,", + " Zone3Exh Min Exhaust Flow Frac Sched, !- Name", + " Fraction, !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: AllDays, !- Field 2", + " Until: 24:00, 0.2; !- Field 3", + + "Schedule:Compact,", + " Zone3Exh_FlowBalancedSched, !- Name", + " Fraction, !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: AllDays, !- Field 2", + " Until: 24:00, 0.2; !- Field 3", + + "Schedule:Compact,", + " Zone4Exh Exhaust Flow Frac Sched, !- Name", + " Fraction, !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: AllDays, !- Field 2", + " Until: 24:00,1.0; !- Field 3", + + "Schedule:Compact,", + " Zone4_MinZoneTempLimitSched, !- Name", + " , !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: AllDays, !- Field 2", + " Until: 24:00, 20; !- Field 3", + + "Schedule:Compact,", + " Zone4Exh Min Exhaust Flow Frac Sched, !- Name", + " Fraction, !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: AllDays, !- Field 2", + " Until: 24:00, 0.2; !- Field 3", + + "Schedule:Compact,", + " Zone4Exh_FlowBalancedSched, !- Name", + " Fraction, !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: AllDays, !- Field 2", + " Until: 24:00, 0.2; !- Field 3", + + "ScheduleTypeLimits,", + " Fraction, !- Name", + " 0.0, !- Lower Limit Value", + " 1.0, !- Upper Limit Value", + " CONTINUOUS; !- Numeric Type", + }); + + // Preset some elements + state->dataHeatBal->Zone.allocate(4); + state->dataHeatBal->Zone(1).Name = "ZONE1"; + state->dataHeatBal->Zone(2).Name = "ZONE2"; + state->dataHeatBal->Zone(3).Name = "ZONE3"; + state->dataHeatBal->Zone(4).Name = "ZONE4"; + + state->dataSize->FinalZoneSizing.allocate(4); + state->dataSize->FinalZoneSizing(2).MinOA = 0.25; + + ASSERT_TRUE(process_idf(idf_objects)); + ScheduleManager::ProcessScheduleInput(*state); + + // Call the processing codes + ExhaustAirSystemManager::GetZoneExhaustControlInput(*state); + ExhaustAirSystemManager::GetExhaustAirSystemInput(*state); + + // Test out function call + int ExhaustControlNum = 1; + auto &thisExhCtrl1 = state->dataZoneEquip->ZoneExhaustControlSystem(1); + + int zoneNum = thisExhCtrl1.ZoneNum; + state->dataZoneTempPredictorCorrector->zoneHeatBalance.allocate(zoneNum); + + auto &thisExhInlet = state->dataLoopNodes->Node(thisExhCtrl1.InletNodeNum); + auto &thisExhOutlet = state->dataLoopNodes->Node(thisExhCtrl1.OutletNodeNum); + + // Manually set inlet flow rate to non-zero + thisExhInlet.MassFlowRate = 0.25; + + EXPECT_NEAR(thisExhInlet.MassFlowRate, 0.25, 1e-5); + + // If default call was made correctly, the inlet flow should be reset to zero + ExhaustAirSystemManager::CalcZoneHVACExhaustControl(*state, ExhaustControlNum); + + EXPECT_NEAR(thisExhInlet.MassFlowRate, 0.0, 1e-5); + EXPECT_NEAR(thisExhOutlet.MassFlowRate, 0.0, 1e-5); + EXPECT_NEAR(thisExhCtrl1.BalancedFlow, 0.0, 1e-5); + EXPECT_NEAR(thisExhCtrl1.UnbalancedFlow, 0.0, 1e-5); +} From a3be34bafb95074d9b65780bc5e90b8bc1aea40d Mon Sep 17 00:00:00 2001 From: jcyuan Date: Tue, 29 Aug 2023 11:19:08 -0500 Subject: [PATCH 49/80] Uses constexpr for angle tolerances cosntant values. --- src/EnergyPlus/SurfaceGeometry.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/EnergyPlus/SurfaceGeometry.cc b/src/EnergyPlus/SurfaceGeometry.cc index 41a40d746f1..70a2aece73a 100644 --- a/src/EnergyPlus/SurfaceGeometry.cc +++ b/src/EnergyPlus/SurfaceGeometry.cc @@ -7677,10 +7677,12 @@ namespace SurfaceGeometry { int Found; int AlphaOffset; // local temp var std::string Roughness; - int ThisSurf; // do loop counter - Real64 AvgAzimuth; // temp for error checking - Real64 AvgTilt; // temp for error checking - int SurfID; // local surface "pointer" + int ThisSurf; // do loop counter + Real64 AvgAzimuth; // temp for error checking + Real64 AvgTilt; // temp for error checking + constexpr Real64 AZITOL = 15.0; // Degree Azimuth Angle Tolerance + constexpr Real64 TILTOL = 10.0; // Degree Tilt Angle Tolerance + int SurfID; // local surface "pointer" bool IsBlank; bool ErrorInName; auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject; @@ -7878,14 +7880,14 @@ namespace SurfaceGeometry { surfaceArea; // Autodesk:F2C++ Functions handle array subscript usage for (ThisSurf = 1; ThisSurf <= state.dataHeatBal->ExtVentedCavity(Item).NumSurfs; ++ThisSurf) { SurfID = state.dataHeatBal->ExtVentedCavity(Item).SurfPtrs(ThisSurf); - if (General::rotAzmDiffDeg(state.dataSurface->Surface(SurfID).Azimuth, AvgAzimuth) > 15.0) { + if (General::rotAzmDiffDeg(state.dataSurface->Surface(SurfID).Azimuth, AvgAzimuth) > AZITOL) { ShowWarningError(state, format("{}=\"{}, Surface {} has Azimuth different from others in the associated group.", cCurrentModuleObject, state.dataHeatBal->ExtVentedCavity(Item).Name, state.dataSurface->Surface(SurfID).Name)); } - if (std::abs(state.dataSurface->Surface(SurfID).Tilt - AvgTilt) > 10.0) { + if (std::abs(state.dataSurface->Surface(SurfID).Tilt - AvgTilt) > TILTOL) { ShowWarningError(state, format("{}=\"{}, Surface {} has Tilt different from others in the associated group.", cCurrentModuleObject, From 748ca0659bf770d66e233cc231cd192a0f5a4c87 Mon Sep 17 00:00:00 2001 From: jcyuan Date: Tue, 29 Aug 2023 11:26:30 -0500 Subject: [PATCH 50/80] rotAzmDiffDeg(): changed from passing-by-constant-reference to passing-by-value. --- src/EnergyPlus/General.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EnergyPlus/General.cc b/src/EnergyPlus/General.cc index 46360edd5b7..0efa6426672 100644 --- a/src/EnergyPlus/General.cc +++ b/src/EnergyPlus/General.cc @@ -1407,7 +1407,7 @@ void findReportPeriodIdx(EnergyPlusData &state, } } -Real64 rotAzmDiffDeg(Real64 const &AzmA, Real64 const &AzmB) +Real64 rotAzmDiffDeg(Real64 AzmA, Real64 AzmB) { // This function takes two (azimuth) angles in Degree(s), // and returns the rotational angle difference in Degree(s). From 4a559a2df3a9a8bd9f63eb03b5686e30523ad8a7 Mon Sep 17 00:00:00 2001 From: jcyuan Date: Tue, 29 Aug 2023 11:57:28 -0500 Subject: [PATCH 51/80] rotAzmDiffDeg() header file General.hh changes for changing from passing-by-constant-reference to passing-by-value. --- src/EnergyPlus/General.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EnergyPlus/General.hh b/src/EnergyPlus/General.hh index 7b8ec1d7fd3..1cedd3bd53b 100644 --- a/src/EnergyPlus/General.hh +++ b/src/EnergyPlus/General.hh @@ -248,7 +248,7 @@ namespace General { int nReportPeriods, Array1D_bool &inReportPeriodFlags); - Real64 rotAzmDiffDeg(Real64 const &AzmA, Real64 const &AzmB); + Real64 rotAzmDiffDeg(Real64 AzmA, Real64 AzmB); inline Real64 epexp(const Real64 numerator, const Real64 denominator) { From 1e27bc36e3bae05282df8649ad23b9bdc9b16a5d Mon Sep 17 00:00:00 2001 From: Scott Horowitz Date: Wed, 30 Aug 2023 09:51:18 -0600 Subject: [PATCH 52/80] Fixes multispeed DX coil so that the combination of ReverseCycle and Timed control works the same as the single speed coil. --- src/EnergyPlus/DXCoils.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/EnergyPlus/DXCoils.cc b/src/EnergyPlus/DXCoils.cc index 10b27efa831..512f417b32b 100644 --- a/src/EnergyPlus/DXCoils.cc +++ b/src/EnergyPlus/DXCoils.cc @@ -13811,8 +13811,7 @@ void CalcMultiSpeedDXCoilHeating(EnergyPlusData &state, if (FractionalDefrostTime > 0.0) { // Calculate defrost adjustment factors depending on defrost control strategy - if (thisDXCoil.DefrostStrategy == StandardRatings::DefrostStrat::ReverseCycle && - thisDXCoil.DefrostControl == StandardRatings::HPdefrostControl::OnDemand) { + if (thisDXCoil.DefrostStrategy == StandardRatings::DefrostStrat::ReverseCycle) { DefrostEIRTempModFac = CurveValue(state, thisDXCoil.DefrostEIRFT, max(15.555, InletAirWetBulbC), max(15.555, OutdoorDryBulb)); LoadDueToDefrostLS = (0.01 * FractionalDefrostTime) * (7.222 - OutdoorDryBulb) * (thisDXCoil.MSRatedTotCap(SpeedNumLS) / 1.01667); @@ -14026,8 +14025,7 @@ void CalcMultiSpeedDXCoilHeating(EnergyPlusData &state, if (FractionalDefrostTime > 0.0) { // Calculate defrost adjustment factors depending on defrost control strategy - if (thisDXCoil.DefrostStrategy == StandardRatings::DefrostStrat::ReverseCycle && - thisDXCoil.DefrostControl == StandardRatings::HPdefrostControl::OnDemand) { + if (thisDXCoil.DefrostStrategy == StandardRatings::DefrostStrat::ReverseCycle) { LoadDueToDefrost = (0.01 * FractionalDefrostTime) * (7.222 - OutdoorDryBulb) * (thisDXCoil.MSRatedTotCap(1) / 1.01667); DefrostEIRTempModFac = CurveValue(state, thisDXCoil.DefrostEIRFT, max(15.555, InletAirWetBulbC), max(15.555, OutdoorDryBulb)); thisDXCoil.DefrostPower = DefrostEIRTempModFac * (thisDXCoil.MSRatedTotCap(1) / 1.01667) * FractionalDefrostTime; From e518d2236e0dafe6ba398dc566186acf17383562 Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Thu, 31 Aug 2023 10:10:08 -0500 Subject: [PATCH 53/80] Revert some EPVectors --- src/EnergyPlus/DataSizing.hh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/EnergyPlus/DataSizing.hh b/src/EnergyPlus/DataSizing.hh index d66b6f73a75..a1f08aea2e5 100644 --- a/src/EnergyPlus/DataSizing.hh +++ b/src/EnergyPlus/DataSizing.hh @@ -391,14 +391,14 @@ namespace DataSizing { Real64 MinOA = 0.0; // design minimum outside air in m3/s Real64 DesCoolMinAirFlow2 = 0.0; // design cooling minimum air flow rate [m3/s] derived from DesCoolMinAirFlowPerArea Real64 DesHeatMaxAirFlow2 = 0.0; // design heating maximum air flow rate [m3/s] derived from DesHeatMaxAirFlowPerArea - EPVector HeatFlowSeq; // daily sequence of zone heating air mass flow rate (zone time step) [kg/s] - EPVector HeatFlowSeqNoOA; // daily sequence of zone heating air mass flow rate (zone time step) without MinOA limit [kg/s] - EPVector CoolFlowSeq; // daily sequence of zone cooling air mass flow rate (zone time step) [kg/s] - EPVector CoolFlowSeqNoOA; // daily sequence of zone cooling air mass flow rate (zone time step) without MinOA limit [kg/s] + Array1D HeatFlowSeq; // daily sequence of zone heating air mass flow rate (zone time step) [kg/s] + Array1D HeatFlowSeqNoOA; // daily sequence of zone heating air mass flow rate (zone time step) without MinOA limit [kg/s] + Array1D CoolFlowSeq; // daily sequence of zone cooling air mass flow rate (zone time step) [kg/s] + Array1D CoolFlowSeqNoOA; // daily sequence of zone cooling air mass flow rate (zone time step) without MinOA limit [kg/s] EPVector HeatZoneTempSeq; // daily sequence of zone temperatures (heating, zone time step) - EPVector HeatZoneRetTempSeq; // daily sequence of zone return temperatures (heating, zone time step) + Array1D HeatZoneRetTempSeq; // daily sequence of zone return temperatures (heating, zone time step) EPVector CoolZoneTempSeq; // daily sequence of zone temperatures (cooling, zone time step) - EPVector CoolZoneRetTempSeq; // daily sequence of zone return temperatures (cooling, zone time step) + Array1D CoolZoneRetTempSeq; // daily sequence of zone return temperatures (cooling, zone time step) Real64 ZoneADEffCooling = 1.0; // the zone air distribution effectiveness in cooling mode Real64 ZoneADEffHeating = 1.0; // the zone air distribution effectiveness in heating mode Real64 ZoneSecondaryRecirculation = 0.0; // the zone secondary air recirculation fraction @@ -575,8 +575,8 @@ namespace DataSizing { Array1D LatentCoolLoadSeq; // daily sequence of zone latent cooling load (zone time step) [W] Array1D HeatLatentLoadNoDOASSeq; // daily sequence of zone latent heating load No DOAS (zone time step) [W] Array1D CoolLatentLoadNoDOASSeq; // daily sequence of zone latent cooling load No DOAS (zone time step) [W] - EPVector LatentCoolFlowSeq; // daily sequence of zone latent cooling supply mass flow rate (zone time step) [Kg/s] - EPVector LatentHeatFlowSeq; // daily sequence of zone latent heating supply mass flow rate (zone time step) [Kg/s] + Array1D LatentCoolFlowSeq; // daily sequence of zone latent cooling supply mass flow rate (zone time step) [Kg/s] + Array1D LatentHeatFlowSeq; // daily sequence of zone latent heating supply mass flow rate (zone time step) [Kg/s] bool zoneLatentSizing = false; // trigger to do RH control during zone sizing Real64 zoneRHDehumidifySetPoint = 50.0; // RH dehumidifying set point used during sizing, default to 50% int zoneRHDehumidifySchIndex = 0; // index to zone RH dehumidifying schedule used for zone sizing From 7a0a420e61e1004e28458fe764b5cc71b040e7fd Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Thu, 31 Aug 2023 10:11:39 -0500 Subject: [PATCH 54/80] New MovingAvg and remove duplicate --- src/EnergyPlus/General.cc | 53 ++++++++++++++++----------------------- src/EnergyPlus/General.hh | 2 -- 2 files changed, 22 insertions(+), 33 deletions(-) diff --git a/src/EnergyPlus/General.cc b/src/EnergyPlus/General.cc index b99a128019e..7665137d62c 100644 --- a/src/EnergyPlus/General.cc +++ b/src/EnergyPlus/General.cc @@ -288,42 +288,33 @@ void SolveRoot(const EnergyPlusData &state, XRes = XTemp; } -void MovingAvg(EPVector &DataIn, int const NumItemsInAvg) -{ - if (NumItemsInAvg <= 1) return; // no need to average/smooth - - EPVector TempData; - TempData.allocate(2 * DataIn.size()); // a scratch array twice the size, bottom end duplicate of top end - - for (std::size_t i = 1; i <= DataIn.size(); ++i) { - TempData(i) = TempData(DataIn.size() + i) = DataIn(i); // initialize both bottom and top end - DataIn(i) = 0.0; - } - - for (std::size_t i = 1; i <= DataIn.size(); ++i) { - for (int j = 1; j <= NumItemsInAvg; ++j) { - DataIn(i) += TempData(DataIn.size() - NumItemsInAvg + i + j); // sum top end including NumItemsInAvg history terms - } - DataIn(i) /= NumItemsInAvg; // average to smooth over NumItemsInAvg window - } -} - void MovingAvg(Array1D &DataIn, int const NumItemsInAvg) { if (NumItemsInAvg <= 1) return; // no need to average/smooth - - Array1D TempData(2 * DataIn.size()); // a scratch array twice the size, bottom end duplicate of top end - - for (std::size_t i = 1; i <= DataIn.size(); ++i) { - TempData(i) = TempData(DataIn.size() + i) = DataIn(i); // initialize both bottom and top end - DataIn(i) = 0.0; + //if (std::accumulate(DataIn.begin(), DataIn.end(), 0.0) == 0.0) { + // return; // no noeed to average if all zeroes + //} + + Array1D movingWindow(NumItemsInAvg, 0.0); // holds the last NumItemsInAvg values + Real64 movingSum = 0.0; // holds the sum of movingWindow + + // Initialize movingWindow with last NumItemsInAvg - 1 elements of DataIn + int iWindow; + for (iWindow = 1; iWindow <= NumItemsInAvg - 1; ++iWindow) { + movingWindow(iWindow) = DataIn(DataIn.size() - (NumItemsInAvg - 1) + iWindow); + movingSum += movingWindow(iWindow); } - for (std::size_t i = 1; i <= DataIn.size(); ++i) { - for (int j = 1; j <= NumItemsInAvg; ++j) { - DataIn(i) += TempData(DataIn.size() - NumItemsInAvg + i + j); // sum top end including NumItemsInAvg history terms - } - DataIn(i) /= NumItemsInAvg; // average to smooth over NumItemsInAvg window + // For every new element, slide movingWindow and movingSum forward one. + for (int i = 1; i <= (int)DataIn.size(); ++i) { + movingWindow(iWindow) = DataIn(i); + movingSum += movingWindow(iWindow); + DataIn(i) = movingSum / NumItemsInAvg; + // movingWindow is indexed in circular fashion + ++iWindow; + if (iWindow > NumItemsInAvg) iWindow = 1; + // Subtract value of oldest element in movingWindow from movingSum + movingSum -= movingWindow(iWindow); } } diff --git a/src/EnergyPlus/General.hh b/src/EnergyPlus/General.hh index 9f154a4a4ee..7cdec26e2bb 100644 --- a/src/EnergyPlus/General.hh +++ b/src/EnergyPlus/General.hh @@ -98,8 +98,6 @@ namespace General { } } - void MovingAvg(EPVector &DataIn, int NumItemsInAvg); - void MovingAvg(Array1D &DataIn, int NumItemsInAvg); void ProcessDateString(EnergyPlusData &state, From 0049fda04970fb7645a5fe2ddae2a7ccd04d41f7 Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Thu, 31 Aug 2023 11:40:04 -0500 Subject: [PATCH 55/80] Add zero check to MovingAvg --- src/EnergyPlus/General.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/EnergyPlus/General.cc b/src/EnergyPlus/General.cc index 7665137d62c..a9c2157bf39 100644 --- a/src/EnergyPlus/General.cc +++ b/src/EnergyPlus/General.cc @@ -291,9 +291,9 @@ void SolveRoot(const EnergyPlusData &state, void MovingAvg(Array1D &DataIn, int const NumItemsInAvg) { if (NumItemsInAvg <= 1) return; // no need to average/smooth - //if (std::accumulate(DataIn.begin(), DataIn.end(), 0.0) == 0.0) { - // return; // no noeed to average if all zeroes - //} + if (std::accumulate(DataIn.begin(), DataIn.end(), 0.0) == 0.0) { + return; // no noeed to average if all zeroes + } Array1D movingWindow(NumItemsInAvg, 0.0); // holds the last NumItemsInAvg values Real64 movingSum = 0.0; // holds the sum of movingWindow From ae38207d3becfd199af125ca4fead553d47f7d9d Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Thu, 31 Aug 2023 13:24:49 -0500 Subject: [PATCH 56/80] Revert MovingAvg --- src/EnergyPlus/General.cc | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/src/EnergyPlus/General.cc b/src/EnergyPlus/General.cc index a9c2157bf39..aada86ee9af 100644 --- a/src/EnergyPlus/General.cc +++ b/src/EnergyPlus/General.cc @@ -291,30 +291,19 @@ void SolveRoot(const EnergyPlusData &state, void MovingAvg(Array1D &DataIn, int const NumItemsInAvg) { if (NumItemsInAvg <= 1) return; // no need to average/smooth - if (std::accumulate(DataIn.begin(), DataIn.end(), 0.0) == 0.0) { - return; // no noeed to average if all zeroes - } - Array1D movingWindow(NumItemsInAvg, 0.0); // holds the last NumItemsInAvg values - Real64 movingSum = 0.0; // holds the sum of movingWindow + Array1D TempData(2 * DataIn.size()); // a scratch array twice the size, bottom end duplicate of top end - // Initialize movingWindow with last NumItemsInAvg - 1 elements of DataIn - int iWindow; - for (iWindow = 1; iWindow <= NumItemsInAvg - 1; ++iWindow) { - movingWindow(iWindow) = DataIn(DataIn.size() - (NumItemsInAvg - 1) + iWindow); - movingSum += movingWindow(iWindow); + for (std::size_t i = 1; i <= DataIn.size(); ++i) { + TempData(i) = TempData(DataIn.size() + i) = DataIn(i); // initialize both bottom and top end + DataIn(i) = 0.0; } - // For every new element, slide movingWindow and movingSum forward one. - for (int i = 1; i <= (int)DataIn.size(); ++i) { - movingWindow(iWindow) = DataIn(i); - movingSum += movingWindow(iWindow); - DataIn(i) = movingSum / NumItemsInAvg; - // movingWindow is indexed in circular fashion - ++iWindow; - if (iWindow > NumItemsInAvg) iWindow = 1; - // Subtract value of oldest element in movingWindow from movingSum - movingSum -= movingWindow(iWindow); + for (std::size_t i = 1; i <= DataIn.size(); ++i) { + for (int j = 1; j <= NumItemsInAvg; ++j) { + DataIn(i) += TempData(DataIn.size() - NumItemsInAvg + i + j); // sum top end including NumItemsInAvg history terms + } + DataIn(i) /= NumItemsInAvg; // average to smooth over NumItemsInAvg window } } From 76c8113f2bde215311f35bd5a6bef7d6df494e93 Mon Sep 17 00:00:00 2001 From: Scott Horowitz Date: Fri, 1 Sep 2023 17:31:09 -0600 Subject: [PATCH 57/80] Fix typos in warnings, and other misc typos. --- src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 32 +++++++++---------- src/EnergyPlus/UnitarySystem.cc | 32 +++++++++---------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index ba032fcffe2..9f8dd4e8f54 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -3921,7 +3921,7 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) // If defrost is disabled in the VRF condenser, it must be disabled in the DX coil // Defrost primarily handled in parent object, set defrost capacity to 1 to avoid autosizing. // Defrost capacity is used for nothing more than setting defrost power/consumption report - // variables which are not reported. The coil's defrost algorythm IS used to derate the coil + // variables which are not reported. The coil's defrost algorithm IS used to derate the coil SetDXCoolingCoilData(state, thisVrfTU.HeatCoilIndex, ErrorsFound, @@ -4156,7 +4156,7 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) // If defrost is disabled in the VRF condenser, it must be disabled in the DX coil // Defrost primarily handled in parent object, set defrost capacity to 1 to avoid autosizing. // Defrost capacity is used for nothing more than setting defrost power/consumption report - // variables which are not reported. The coil's defrost algorythm IS used to derate the coil + // variables which are not reported. The coil's defrost algorithm IS used to derate the coil SetDXCoolingCoilData(state, thisVrfTU.HeatCoilIndex, ErrorsFound, @@ -4220,7 +4220,7 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) _, state.dataHVACVarRefFlow->VRF(thisVrfTU.VRFSysNum).HeatingCapacitySizeRatio); } - // Check VRF DX heating coil heating capacity as a fuction of temperature performance curve. Only report here for + // Check VRF DX heating coil heating capacity as a function of temperature performance curve. Only report here for // biquadratic curve type. if (thisVrfTU.VRFSysNum > 0 && thisVrfTU.HeatCoilIndex > 0 && state.dataCurveManager->PerfCurve(GetDXCoilCapFTCurveIndex(state, thisVrfTU.HeatCoilIndex, ErrorsFound))->numDims == 2) { @@ -4543,7 +4543,7 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) ShowWarningError(state, cCurrentModuleObject + " = " + thisVrfTU.Name + " with Fan:SystemModel is used in " + cAlphaArgs(8) + "\""); ShowContinueError(state, format("...The number of speed = {:.0R}.", double(NumSpeeds))); - ShowContinueError(state, "...Multiple speed fan will be appiled to this unit. The speed number is determined by load."); + ShowContinueError(state, "...Multiple speed fan will be applied to this unit. The speed number is determined by load."); } } } @@ -9790,7 +9790,7 @@ void VRFTerminalUnitEquipment::CalcVRF(EnergyPlusData &state, } } - Real64 LatentLoadMet = 0.0; // latent load deleivered [kgWater/s] + Real64 LatentLoadMet = 0.0; // latent load delivered [kgWater/s] Real64 TempOut = 0.0; Real64 TempIn = 0.0; if (this->ATMixerExists) { @@ -9970,7 +9970,7 @@ void ReportVRFTerminalUnit(EnergyPlusData &state, int const VRFTUNum) // index t TempOut = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUOutletNodeNum).Temp; TempIn = state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).Temp; } - // latent heat vaporization/condensation used in moist air psychometrics + // latent heat vaporization/condensation used in moist air psychrometrics Real64 const H2OHtOfVap = PsyHgAirFnWTdb(0.0, TempOut); // convert latent in kg/s to watts TotalConditioning = SensibleConditioning + (LatentConditioning * H2OHtOfVap); @@ -10994,7 +10994,7 @@ void getVRFTUZoneLoad( if (InitFlag) { // this will need more investigation. Using Remaining* variable during the initial load calculation seems wrong. // This may also have implications when VRF TUs are in the air loop or if SP control is used - // another question is whether initialization of the opeating mode should look at TotalOutputRequired or RemainingOutputRequired + // another question is whether initialization of the operating mode should look at TotalOutputRequired or RemainingOutputRequired zoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).ZoneNum).RemainingOutputRequired / state.dataHVACVarRefFlow->VRFTU(VRFTUNum).controlZoneMassFlowFrac; LoadToCoolingSP = @@ -12804,7 +12804,7 @@ void VRFTerminalUnitEquipment::ControlVRF_FluidTCtrl(EnergyPlusData &state, auto f = [&state, VRFTUNum, FirstHVACIteration, QZnReq, OnOffAirFlowRatio](Real64 const PartLoadRatio) { Real64 QZnReqTemp = QZnReq; // denominator representing zone load (W) Real64 ActualOutput; // delivered capacity of VRF terminal unit - Real64 SuppHeatCoilLoad = 0.0; // supplemetal heating coil load (W) + Real64 SuppHeatCoilLoad = 0.0; // supplemental heating coil load (W) bool setPointControlled = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).isSetPointControlled; Real64 nonConstOnOffAirFlowRatio = OnOffAirFlowRatio; @@ -13718,7 +13718,7 @@ void VRFCondenserEquipment::VRFOU_TeModification( // PURPOSE OF THIS SUBROUTINE: // This is part of the low load modification algorithm for the VRF-FluidTCtrl model. It aims - // to find a new Te (Te_update) that can generate a new compressor suction temperature (Tsuction) equalling + // to find a new Te (Te_update) that can generate a new compressor suction temperature (Tsuction) equaling // to the given compressor suction temperature (Te_low). This requires the re-calculate of piping loss. // METHODOLOGY EMPLOYED: @@ -14134,7 +14134,7 @@ void VRFCondenserEquipment::VRFOU_CalcCompC(EnergyPlusData &state, // RE-ENGINEERED na // PURPOSE OF THIS SUBROUTINE: - // This subroutine simulates the compressor performance at given oprtaional conditions (cooling mode). More specifically, it sepcifies + // This subroutine simulates the compressor performance at given operational conditions (cooling mode). More specifically, it specifies // the compressor speed to provide sufficient evaporative capacity, and calculate the power of the compressor running at the specified // speed. Note that it may be needed to manipulate the operational conditions to further adjust system capacity at low load conditions. // The low load modification logics are different for cooling mode and heating mode. @@ -14288,7 +14288,7 @@ void VRFCondenserEquipment::VRFOU_CalcCompC(EnergyPlusData &state, // Pipe_Pe_assumed, Pipe_m_ref, Pipe_SH_merged ); { // Initialization of Iteration_Te (Label11) - // i.e., find a new Te (Pipe_Te_assumed) that can generate a new T_suction equalling to SmallLoadTe. + // i.e., find a new Te (Pipe_Te_assumed) that can generate a new T_suction equaling to SmallLoadTe. // This requires the re-calculate of piping loss. NumIteTe = 1; MaxNumIteTe = (this->EvaporatingTemp - SmallLoadTe) / 0.1 + 1; // upper bound and lower bound of Te iterations @@ -14689,7 +14689,7 @@ void VRFCondenserEquipment::VRFHR_OU_HR_Mode(EnergyPlusData &state, // // PURPOSE OF THIS SUBROUTINE: // Determine the operational mode of the VRF-HR system, given the terminal unit side load conditions. - // Compressor and OU hex performance are analysed for each mode. + // Compressor and OU hex performance are analyzed for each mode. // A number of OU side operational parameters are also calculated here, including: // (1) OU evaporator load Q_c_OU (2) OU condenser load Q_h_OU (3) OU fan energy consumption // (4) OU compressor speed and energy consumption @@ -15462,7 +15462,7 @@ void VRFTerminalUnitEquipment::CalcVRFSuppHeatingCoil(EnergyPlusData &state, state, this->SuppHeatCoilName, FirstHVACIteration, this->SuppHeatCoilIndex, QActual, this->OpMode, PartLoadRatio); if (QActual > SuppHeatCoilLoad) { auto f = [&state, VRFTUNum, FirstHVACIteration, SuppHeatCoilLoad](Real64 const PartLoadFrac) { - Real64 QActual = 0.0; // actual heating load deleivered [W] + Real64 QActual = 0.0; // actual heating load delivered [W] Real64 mdot = state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow * PartLoadFrac; state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).SuppHeatCoilFluidInletNode).MassFlowRate = mdot; WaterCoils::SimulateWaterCoilComponents(state, @@ -15522,7 +15522,7 @@ Real64 VRFTerminalUnitEquipment::HotWaterHeatingCoilResidual(EnergyPlusData &sta // fraction residual to zero. // METHODOLOGY EMPLOYED: - // runs Coil:Heating:Water component object to get the actual heating load deleivered [W] at a + // runs Coil:Heating:Water component object to get the actual heating load delivered [W] at a // given part load ratio and calculates the residual as defined above // Return value @@ -15532,7 +15532,7 @@ Real64 VRFTerminalUnitEquipment::HotWaterHeatingCoilResidual(EnergyPlusData &sta int VRFTUNum = int(Par[1]); // index to current terminal unit simulated bool FirstHVACIteration = Par[2]; // 0 flag if it first HVAC iteration, or else 1 Real64 SuppHeatCoilLoad = Par[3]; // supplemental heating coil load to be met [W] - Real64 QActual = 0.0; // actual heating load deleivered [W] + Real64 QActual = 0.0; // actual heating load delivered [W] // Real64 mdot = min(state.dataLoopNodes->Node(VRFTU(VRFTUNum).SuppHeatCoilFluidOutletNode).MassFlowRateMaxAvail, // VRFTU(VRFTUNum).SuppHeatCoilFluidMaxFlow * PartLoadFrac); @@ -15570,7 +15570,7 @@ Real64 VRFTerminalUnitEquipment::HeatingCoilCapacityLimit( // ( m_dot_air * Cp_air_avg * DeltaT_air_across_heating_coil) [W] // Return value - Real64 HeatCoilCapacityAllowed; // heating coil maximum capacity that can be deleivered at current time [W] + Real64 HeatCoilCapacityAllowed; // heating coil maximum capacity that can be delivered at current time [W] Real64 MDotAir = state.dataLoopNodes->Node(HeatCoilAirInletNode).MassFlowRate; Real64 CpAirIn = Psychrometrics::PsyCpAirFnW(state.dataLoopNodes->Node(HeatCoilAirInletNode).HumRat); diff --git a/src/EnergyPlus/UnitarySystem.cc b/src/EnergyPlus/UnitarySystem.cc index d1eb022ebd2..356fcd1a409 100644 --- a/src/EnergyPlus/UnitarySystem.cc +++ b/src/EnergyPlus/UnitarySystem.cc @@ -1282,8 +1282,8 @@ namespace UnitarySystems { void UnitarySys::frostControlSetPointLimit(EnergyPlusData &state, Real64 &TempSetPoint, // temperature setpoint of the sensor node Real64 &HumRatSetPoint, // humidity ratio setpoint of the sensor node - Real64 const BaroPress, // baromtric pressure, Pa [N/m^2] - Real64 const TfrostControl, // minimum temperature limit for forst control + Real64 const BaroPress, // barometric pressure, Pa [N/m^2] + Real64 const TfrostControl, // minimum temperature limit for frost control int const ControlMode // temperature or humidity control mode ) { @@ -1293,7 +1293,7 @@ namespace UnitarySystems { // DATE WRITTEN January 2013 // PURPOSE OF THIS SUBROUTINE: - // Controls the forst formation condition based on user specified minimum DX coil outlet + // Controls the frost formation condition based on user specified minimum DX coil outlet // air temperature. Resets the cooling setpoint based on the user specified limiting // temperature for frost control. @@ -1353,7 +1353,7 @@ namespace UnitarySystems { // DATE WRITTEN February 2013 // PURPOSE OF THIS SUBROUTINE: - // This subroutine is for sizing unitary system components for which nominal cpacities + // This subroutine is for sizing unitary system components for which nominal capacities // and flow rates have not been specified in the input. Coil sizing is preformed in the coil module. // Future modifications will size coils here and "push" this info to the specific coil. @@ -1398,7 +1398,7 @@ namespace UnitarySystems { select_EqSizing = &OASysEqSizing(state.dataSize->CurOASysNum); } else if (state.dataSize->CurSysNum > 0) { select_EqSizing = &state.dataSize->UnitarySysEqSizing(state.dataSize->CurSysNum); - // this was reseting data set by OutdoorAirUnit when UnitarySystem is child + // this was resetting data set by OutdoorAirUnit when UnitarySystem is child // question is then who resets these (#8751 temporary fix)? // move here for now and only reset UnitarySystem flags, then find better way to do this select_EqSizing->AirFlow = false; @@ -1558,7 +1558,7 @@ namespace UnitarySystems { if (!this->m_HeatCoilExists) state.dataSize->ZoneCoolingOnlyFan = true; TempSize = this->m_MaxCoolAirVolFlow; SaveCurDuctType = state.dataSize->CurDuctType; - // might want to rethink this method. Tries to find the larger of cooling or heating capcity + // might want to rethink this method. Tries to find the larger of cooling or heating capacity // however, if there is no heating coil the cooling air flow rate is used, not the main flow rate // this is fine if there are no other systems on the branch. CoilSystem does not do this (#8761). if (this->m_sysType == SysType::Unitary) state.dataSize->CurDuctType = DataHVACGlobals::AirDuctType::Cooling; @@ -2549,7 +2549,7 @@ namespace UnitarySystems { } } - // TODO: Determine operating mode based on dehumdification stuff, using normalMode for now + // TODO: Determine operating mode based on dehumidification stuff, using normalMode for now if (this->m_NumOfSpeedCooling != (int)newCoil.performance.normalMode.speeds.size()) { ShowWarningError(state, format("{}: {} = {}", RoutineName, CompType, CompName)); ShowContinueError(state, "Number of cooling speeds does not match coil object."); @@ -2688,7 +2688,7 @@ namespace UnitarySystems { DXCoils::SimDXCoilMultiSpeed(state, blankString, 1.0, 1.0, this->m_CoolingCoilIndex, 0, 0, DataHVACGlobals::CompressorOperation::Off); if (!HardSizeNoDesRun && EqSizing.Capacity) { // do nothing, the vars EqSizing.DesCoolingLoad and DataSizing::DXCoolCap are already set earlier and the values could be max of the - // cooling and heating autosized values. Thus reseting them here to user specified value may not be the design size used else where + // cooling and heating autosized values. Thus resetting them here to user specified value may not be the design size used else where } else { state.dataSize->DXCoolCap = DXCoils::GetCoilCapacityByIndexType(state, this->m_CoolingCoilIndex, this->m_CoolingCoilType_Num, ErrFound); @@ -4054,7 +4054,7 @@ namespace UnitarySystems { } if (!AirLoopFound && !ZoneEquipmentFound && !OASysFound) { - // Unsucessful attempt to get all input data. + // Unsuccessful attempt to get all input data. return; } else if (ZoneEquipmentFound || OASysFound || (AirLoopFound && (this->m_ZoneInletNode > 0 || this->m_ControlType == UnitarySysCtrlType::Setpoint))) { @@ -5540,7 +5540,7 @@ namespace UnitarySystems { } // Users may not provide SA flow input fields (below) and leave them blank. Check if other coil is AutoSized first to - // alieviate input requirements. check if coil has no air flow input (VolFlow = 0) and other coil isDataSizing::AutoSized. If so, + // alleviate input requirements. check if coil has no air flow input (VolFlow = 0) and other coil isDataSizing::AutoSized. If so, // use AutoSize for coil with 0 air flow rate. This means that the coils MUST mine the air flow rate if it exists if (this->m_CoolCoilExists && this->m_HeatCoilExists) { if (this->m_MaxCoolAirVolFlow == DataSizing::AutoSize && this->m_MaxHeatAirVolFlow == 0 && loc_m_HeatingSAFMethod == "") { @@ -6448,7 +6448,7 @@ namespace UnitarySystems { // UnitarySystem has a single field for max outlet temp this->DesignMaxOutletTemp = input_data.maximum_supply_air_temperature; } else { - // PTHP has a field for max outlet temp for supplmental heater and max outlet temp for SZVAV + // PTHP has a field for max outlet temp for supplemental heater and max outlet temp for SZVAV if (this->m_ControlType == UnitarySysCtrlType::CCMASHRAE) { this->DesignMaxOutletTemp = input_data.maximum_supply_air_temperature; } else { @@ -6839,7 +6839,7 @@ namespace UnitarySystems { cCurrentModuleObject + " = " + this->Name + " with Fan:SystemModel is used in " + this->input_specs.supply_fan_name + "\""); ShowContinueError(state, format("...The number of speed = {:.0R}.", double(NumSpeeds))); - ShowContinueError(state, "...Multiple speed fan will be appiled to this unit. The speed number is determined by load."); + ShowContinueError(state, "...Multiple speed fan will be applied to this unit. The speed number is determined by load."); } } } @@ -15228,7 +15228,7 @@ namespace UnitarySystems { void UnitarySys::simMultiSpeedCoils(EnergyPlusData &state, int const AirLoopNum, // Index to air loop bool const FirstHVACIteration, // True when first HVAC iteration - DataHVACGlobals::CompressorOperation &CompressorOn, // compresor on/off control + DataHVACGlobals::CompressorOperation &CompressorOn, // compressor on/off control bool const SensibleLoad, bool const LatentLoad, Real64 const PartLoadFrac, @@ -16210,7 +16210,7 @@ namespace UnitarySystems { // DX Coil output depends on the compressor speed which is being varied to zero the residual. // METHODOLOGY EMPLOYED: - // Calls calc routine sof multi speed or variable speed coils to get outlet humidity ratio at the given compressor speed + // Calls calc routines of multi speed or variable speed coils to get outlet humidity ratio at the given compressor speed // and calculates the residual as defined above // FUNCTION LOCAL VARIABLE DECLARATIONS: @@ -17876,7 +17876,7 @@ namespace UnitarySystems { state.dataUnitarySystems->setupOutputOnce = false; } else { ShowSevereError(state, - "setupAllOutputVar: Developer error. Should never get here. Remove when confortable that UnitarySys::allocateUnitarySys " + "setupAllOutputVar: Developer error. Should never get here. Remove when comfortable that UnitarySys::allocateUnitarySys " "is working as expected."); ShowFatalError(state, "setupAllOutputVar: Developer error. Conflict in number of UnitarySystems."); } @@ -17943,7 +17943,7 @@ namespace UnitarySystems { highSpeedEconMassFlowRate, highSpeedEconMassFlowRate / this->m_CoolMassFlowRate[this->m_NumOfSpeedCooling]); econClgOutput = cpAir * highSpeedEconMassFlowRate * (zoneTemp - (outdoorAirTemp + highSpeedFanDT)); - // check if economizer alone can meet the load, or if we have reached the maximumm cooling speed + // check if economizer alone can meet the load, or if we have reached the maximum cooling speed if (econClgOutput > std::abs(zoneLoad) || clgSpd == this->m_NumOfSpeedCooling) { // low speed economizer operation is handled through normal process (i.e., no staging operation) if (clgSpd > 1) { From 8f2959c72bbaa98bff0795461bf8678df2d8da19 Mon Sep 17 00:00:00 2001 From: Scott Horowitz Date: Thu, 7 Sep 2023 09:54:30 -0600 Subject: [PATCH 58/80] Fix sentence [decent_ci_skip] --- .../src/overview/group-condenser-equipment.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/input-output-reference/src/overview/group-condenser-equipment.tex b/doc/input-output-reference/src/overview/group-condenser-equipment.tex index 07457dadedc..2c6495d206c 100644 --- a/doc/input-output-reference/src/overview/group-condenser-equipment.tex +++ b/doc/input-output-reference/src/overview/group-condenser-equipment.tex @@ -3385,7 +3385,7 @@ \subsubsection{Inputs} \paragraph{Field: G-Function Reference Ratio}\label{field-g-function-reference-ratio} -The G-Functions may be formulated slightly differently based on the program which generated them. The original g-functions as defined by Eskilson are based on an borehole radius to active length ratio of 0.0005. If the physical ratio is different from this, a correction must be applied. EnergyPlus will apply the correction, based on the reference ratio entered in this field. Therefore, therefore two possible input configurations. +The G-Functions may be formulated slightly differently based on the program which generated them. The original g-functions as defined by Eskilson are based on an borehole radius to active length ratio of 0.0005. If the physical ratio is different from this, a correction must be applied. EnergyPlus will apply the correction, based on the reference ratio entered in this field. Therefore, there are two possible input configurations. \begin{itemize} \item From 415b095afc5bfaae794a6a31cc15f38cc00dc60a Mon Sep 17 00:00:00 2001 From: Scott Horowitz Date: Thu, 7 Sep 2023 22:28:26 -0600 Subject: [PATCH 59/80] Fix water heater outputs. --- .../src/overview/group-water-heaters.tex | 4 ++-- .../standard-output-reports/output-table-summaryreports.tex | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/input-output-reference/src/overview/group-water-heaters.tex b/doc/input-output-reference/src/overview/group-water-heaters.tex index 01d16a04aac..73d5696bd74 100644 --- a/doc/input-output-reference/src/overview/group-water-heaters.tex +++ b/doc/input-output-reference/src/overview/group-water-heaters.tex @@ -443,7 +443,7 @@ \subsubsection{Outputs}\label{outputs-040} \item HVAC,Average,Water Heater Total Demand Heat Transfer Rate {[}W{]} \item - HVAC,Sum,Water Heater Total Demand Energy {[}J{]} + HVAC,Sum,Water Heater Total Demand Heat Transfer Energy {[}J{]} \item HVAC,Average,Water Heater Heating Rate {[}W{]} \item @@ -562,7 +562,7 @@ \subsubsection{Outputs}\label{outputs-040} The average heating rate demanded to maintain the setpoint temperature. -\paragraph{Water Heater Total Demand Energy {[}J{]}}\label{water-heater-total-demand-energy-j} +\paragraph{Water Heater Total Demand Heat Transfer Energy {[}J{]}}\label{water-heater-total-demand-heat-transfer-energy-j} The heating energy demanded to maintain the setpoint temperature. diff --git a/doc/input-output-reference/src/standard-output-reports/output-table-summaryreports.tex b/doc/input-output-reference/src/standard-output-reports/output-table-summaryreports.tex index 827b146a3a8..e993c30e3f3 100644 --- a/doc/input-output-reference/src/standard-output-reports/output-table-summaryreports.tex +++ b/doc/input-output-reference/src/standard-output-reports/output-table-summaryreports.tex @@ -1406,7 +1406,7 @@ \subsubsection{Predefined Monthly Summary Reports}\label{predefined-monthly-summ \begin{itemize} \item - Water Heater Total Demand Energy (SumOrAverage) + Water Heater Total Demand Heat Transfer Energy (SumOrAverage) \item Water Heater Use Side Heat Transfer Energy (SumOrAverage) \item @@ -1414,7 +1414,7 @@ \subsubsection{Predefined Monthly Summary Reports}\label{predefined-monthly-summ \item Water Heater Gas Consumption (SumOrAverage) \item - Water Heater Total Demand Energy (HoursNonZero) + Water Heater Total Demand Heat Transfer Energy (HoursNonZero) \item Water Heater Loss Demand Energy (SumOrAverage) \item From 92c6d7cefb9847566afacb874c3e4efb63414196 Mon Sep 17 00:00:00 2001 From: Scott Horowitz Date: Thu, 7 Sep 2023 22:44:08 -0600 Subject: [PATCH 60/80] Fix WaterHeaterReportMonthly output fields --- src/EnergyPlus/InputProcessing/InputProcessor.cc | 2 +- src/EnergyPlus/OutputReportTabular.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EnergyPlus/InputProcessing/InputProcessor.cc b/src/EnergyPlus/InputProcessing/InputProcessor.cc index d6b437768eb..6016650d5f9 100644 --- a/src/EnergyPlus/InputProcessing/InputProcessor.cc +++ b/src/EnergyPlus/InputProcessing/InputProcessor.cc @@ -2369,7 +2369,7 @@ void InputProcessor::addVariablesForMonthlyReport(EnergyPlusData &state, std::st addRecordToOutputVariableStructure(state, "*", "WATER HEATER HEAT LOSS ENERGY"); addRecordToOutputVariableStructure(state, "*", "WATER HEATER TANK TEMPERATURE"); addRecordToOutputVariableStructure(state, "*", "WATER HEATER HEAT RECOVERY SUPPLY ENERGY"); - addRecordToOutputVariableStructure(state, "*", "WATER HEATER SOURCE ENERGY"); + addRecordToOutputVariableStructure(state, "*", "WATER HEATER SOURCE SIDE HEAT TRANSFER ENERGY"); } else if (reportName == "GENERATORREPORTMONTHLY") { addRecordToOutputVariableStructure(state, "*", "GENERATOR PRODUCED AC ELECTRICITY ENERGY"); diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index 0aaadc08999..0bd6c6cfb46 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -2664,7 +2664,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Water Heater Heat Loss Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Water Heater Tank Temperature", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Water Heater Heat Recovery Supply Energy", "", AggType::SumOrAvg); - AddMonthlyFieldSetInput(state, curReport, "Water Heater Source Energy", "", AggType::SumOrAvg); + AddMonthlyFieldSetInput(state, curReport, "Water Heater Source Side Heat Transfer Energy", "", AggType::SumOrAvg); } if (ort->namedMonthly(51).show) { curReport = AddMonthlyReport(state, "GeneratorReportMonthly", 2); From e56ce5c3f1225a3e6e2aa681801cce66311f12e3 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 8 Sep 2023 10:20:22 +0200 Subject: [PATCH 61/80] Add a unit test for #9621 fails with diff ``` With diff: @@ -1,1 +1,434 @@ - ** Warning ** In Output:Table:Monthly 'SPACE GAINS ANNUAL REPORT' invalid Variable or Meter Name 'NON EXISTANT VARIABLE'\n + ** Warning ** In Output:Table:Monthly 'SPACE GAINS ANNUAL REPORT' invalid Variable or Meter Name 'NON EXISTANT VARIABLE' + ** Warning ** In Output:Table:Monthly 'ZoneCoolingSummaryMonthly' invalid Variable or Meter Name 'ZONE AIR SYSTEM SENSIBLE COOLING ENERGY' + ** Warning ** In Output:Table:Monthly 'ZoneCoolingSummaryMonthly' invalid Variable or Meter Name 'ZONE AIR SYSTEM SENSIBLE COOLING RATE' + ** Warning ** In Output:Table:Monthly 'ZoneCoolingSummaryMonthly' invalid Variable or Meter Name 'SITE OUTDOOR AIR DRYBULB TEMPERATURE' + ** Warning ** In Output:Table:Monthly 'ZoneCoolingSummaryMonthly' invalid Variable or Meter Name 'SITE OUTDOOR AIR WETBULB TEMPERATURE' + ** Warning ** In Output:Table:Monthly 'ZoneCoolingSummaryMonthly' invalid Variable or Meter Name 'ZONE TOTAL INTERNAL LATENT GAIN ENERGY' + ** Warning ** In Output:Table:Monthly 'ZoneCoolingSummaryMonthly' invalid Variable or Meter Name 'ZONE TOTAL INTERNAL LATENT GAIN RATE' + ** Warning ** In Output:Table:Monthly 'ZoneCoolingSummaryMonthly' invalid Variable or Meter Name 'SITE OUTDOOR AIR DRYBULB TEMPERATURE' + ** Warning ** In Output:Table:Monthly 'ZoneCoolingSummaryMonthly' invalid Variable or Meter Name 'SITE OUTDOOR AIR WETBULB TEMPERATURE' + ** Warning ** In Output:Table:Monthly 'ZoneHeatingSummaryMonthly' invalid Variable or Meter Name 'ZONE AIR SYSTEM SENSIBLE HEATING ENERGY' [...] ``` --- .../unit/OutputReportTabular.unit.cc | 54 +++++++++++++++++-- 1 file changed, 50 insertions(+), 4 deletions(-) diff --git a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc index 2b222d85238..8c27bd49726 100644 --- a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc +++ b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc @@ -7183,10 +7183,7 @@ TEST_F(SQLiteFixture, OutputReportTabular_WriteLoadComponentSummaryTables_AirLoo state->dataSize->SysSizInput.allocate(state->dataSize->NumSysSizInput); state->dataSize->SysSizInput(1).AirLoopNum = 1; state->dataSize->SysSizInput(1).SizingOption = DataSizing::NonCoincident; - auto degC_to_F = [](Real64 celsius) constexpr - { - return celsius * (9.0 / 5.0) + 32.0; - }; + auto degC_to_F = [](Real64 celsius) constexpr { return celsius * (9.0 / 5.0) + 32.0; }; constexpr Real64 coolMixTempSys = 26.2; constexpr Real64 coolMixTempSysIP = degC_to_F(coolMixTempSys); constexpr Real64 heatMixTempSys = -1.7; @@ -12586,3 +12583,52 @@ TEST_F(SQLiteFixture, UpdateSizing_EndSysSizingCalc) Real64 return_val = execAndReturnFirstDouble(query); EXPECT_EQ(return_val, 5080.22); } + +TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_WarnOnMissingMonthlyVariable) +{ + // #9621 - Only warn if a bad variable is defined in a Monthly table user requested, not on the AllSummaryAndMonthly ones + std::string const idf_objects = delimited_string({ + "Output:Table:Monthly,", + " Space Gains Annual Report, !- Name", + " 2, !- Digits After Decimal", + " Exterior Lights Electricity Energy, !- Variable or Meter 1 Name", + " SumOrAverage, !- Aggregation Type for Variable or Meter 1", + " NON EXISTANT VARIABLE, !- Variable or Meter 2 Name", + " Maximum; !- Aggregation Type for Variable or Meter 2", + + "Output:Table:SummaryReports,", + " AllSummaryAndMonthly; !- Report 1 Name", + }); + + ASSERT_TRUE(process_idf(idf_objects)); + + Real64 extLitUse; + + SetupOutputVariable(*state, + "Exterior Lights Electricity Energy", + OutputProcessor::Unit::J, + extLitUse, + OutputProcessor::SOVTimeStepType::Zone, + OutputProcessor::SOVStoreType::Summed, + "Lite1", + {}, + "Electricity", + "Exterior Lights", + "General"); + + state->dataGlobal->DoWeathSim = true; + state->dataGlobal->TimeStepZone = 0.25; + state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * 60.0; + + GetInputTabularMonthly(*state); + EXPECT_EQ(state->dataOutRptTab->MonthlyInputCount, 1); + GetInputOutputTableSummaryReports(*state); + EXPECT_EQ(state->dataOutRptTab->MonthlyInputCount, numNamedMonthly + 1); + + InitializeTabularMonthly(*state); + + std::string const expected_error = delimited_string({ + " ** Warning ** In Output:Table:Monthly 'SPACE GAINS ANNUAL REPORT' invalid Variable or Meter Name 'NON EXISTANT VARIABLE'", + }); + compare_err_stream(expected_error); +} From 8b3a9e11cba0691a77862bdfbd76682400c03c7d Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 8 Sep 2023 10:27:07 +0200 Subject: [PATCH 62/80] Fix #9621 - Do not issue a warning for Invalid Variable or Meter Name in Monthly table if it's one of the Named Monthly ones --- src/EnergyPlus/OutputReportTabular.cc | 136 +++++++++++++------------- src/EnergyPlus/OutputReportTabular.hh | 20 ++-- 2 files changed, 78 insertions(+), 78 deletions(-) diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index 0aaadc08999..2327170dc44 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -407,7 +407,7 @@ void GetInputTabularMonthly(EnergyPlusData &state) } } -int AddMonthlyReport(EnergyPlusData &state, std::string const &inReportName, int const inNumDigitsShown) +int AddMonthlyReport(EnergyPlusData &state, std::string const &inReportName, int const inNumDigitsShown, bool isNamedMonthly) { // SUBROUTINE INFORMATION: // AUTHOR Jason Glazer @@ -458,6 +458,7 @@ int AddMonthlyReport(EnergyPlusData &state, std::string const &inReportName, int // initialize new record ort->MonthlyInput(ort->MonthlyInputCount).name = inReportName; ort->MonthlyInput(ort->MonthlyInputCount).showDigits = inNumDigitsShown; + ort->MonthlyInput(ort->MonthlyInputCount).isNamedMonthly = isNamedMonthly; return ort->MonthlyInputCount; } @@ -618,8 +619,11 @@ void InitializeTabularMonthly(EnergyPlusData &state) int KeyCount = 0; GetVariableKeyCountandType(state, curVariMeter, KeyCount, TypeVar, AvgSumVar, StepTypeVar, UnitsVar); if (TypeVar == OutputProcessor::VariableType::NotFound) { - ShowWarningError( - state, format("In Output:Table:Monthly '{}' invalid Variable or Meter Name '{}'", ort->MonthlyInput(TabNum).name, curVariMeter)); + if (!ort->MonthlyInput(TabNum).isNamedMonthly) { + ShowWarningError( + state, + format("In Output:Table:Monthly '{}' invalid Variable or Meter Name '{}'", ort->MonthlyInput(TabNum).name, curVariMeter)); + } } // IF (KeyCount > maxKeyCount) THEN // DEALLOCATE(NamesOfKeys) @@ -2165,7 +2169,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) // ---------------------------------------------------------------------------------------- if (ort->namedMonthly(1).show) { - curReport = AddMonthlyReport(state, "ZoneCoolingSummaryMonthly", 2); + curReport = AddMonthlyReport(state, "ZoneCoolingSummaryMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Zone Air System Sensible Cooling Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Zone Air System Sensible Cooling Rate", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "Site Outdoor Air Drybulb Temperature", "", AggType::ValueWhenMaxMin); @@ -2176,20 +2180,20 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Site Outdoor Air Wetbulb Temperature", "", AggType::ValueWhenMaxMin); } if (ort->namedMonthly(2).show) { - curReport = AddMonthlyReport(state, "ZoneHeatingSummaryMonthly", 2); + curReport = AddMonthlyReport(state, "ZoneHeatingSummaryMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Zone Air System Sensible Heating Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Zone Air System Sensible Heating Rate", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "Site Outdoor Air Drybulb Temperature", "", AggType::ValueWhenMaxMin); } if (ort->namedMonthly(3).show) { - curReport = AddMonthlyReport(state, "ZoneElectricSummaryMonthly", 2); + curReport = AddMonthlyReport(state, "ZoneElectricSummaryMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Zone Lights Electricity Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Zone Lights Electricity Energy", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "Zone Electric Equipment Electricity Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Zone Electric Equipment Electricity Energy", "", AggType::Maximum); } if (ort->namedMonthly(4).show) { - curReport = AddMonthlyReport(state, "SpaceGainsMonthly", 2); + curReport = AddMonthlyReport(state, "SpaceGainsMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Zone People Total Heating Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Zone Lights Total Heating Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Zone Electric Equipment Total Heating Energy", "", AggType::SumOrAvg); @@ -2201,7 +2205,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Zone Infiltration Sensible Heat Loss Energy", "", AggType::SumOrAvg); } if (ort->namedMonthly(5).show) { - curReport = AddMonthlyReport(state, "PeakSpaceGainsMonthly", 2); + curReport = AddMonthlyReport(state, "PeakSpaceGainsMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Zone People Total Heating Energy", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "Zone Lights Total Heating Energy", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "Zone Electric Equipment Total Heating Energy", "", AggType::Maximum); @@ -2213,7 +2217,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Zone Infiltration Sensible Heat Loss Energy", "", AggType::Maximum); } if (ort->namedMonthly(6).show) { - curReport = AddMonthlyReport(state, "SpaceGainComponentsAtCoolingPeakMonthly", 2); + curReport = AddMonthlyReport(state, "SpaceGainComponentsAtCoolingPeakMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Zone Air System Sensible Cooling Rate", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "Zone People Total Heating Energy", "", AggType::ValueWhenMaxMin); AddMonthlyFieldSetInput(state, curReport, "Zone Lights Total Heating Energy", "", AggType::ValueWhenMaxMin); @@ -2226,21 +2230,21 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Zone Infiltration Sensible Heat Loss Energy", "", AggType::ValueWhenMaxMin); } if (ort->namedMonthly(7).show) { - curReport = AddMonthlyReport(state, "EnergyConsumptionElectricityNaturalGasMonthly", 2); + curReport = AddMonthlyReport(state, "EnergyConsumptionElectricityNaturalGasMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Electricity:Facility", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Electricity:Facility", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "NaturalGas:Facility", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "NaturalGas:Facility", "", AggType::Maximum); } if (ort->namedMonthly(8).show) { - curReport = AddMonthlyReport(state, "EnergyConsumptionElectricityGeneratedPropaneMonthly", 2); + curReport = AddMonthlyReport(state, "EnergyConsumptionElectricityGeneratedPropaneMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "ElectricityProduced:Facility", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "ElectricityProduced:Facility", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "Propane:Facility", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Propane:Facility", "", AggType::Maximum); } if (ort->namedMonthly(9).show) { - curReport = AddMonthlyReport(state, "EnergyConsumptionDieselFuelOilMonthly", 2); + curReport = AddMonthlyReport(state, "EnergyConsumptionDieselFuelOilMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Diesel:Facility", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Diesel:Facility", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "FuelOilNo1:Facility", "", AggType::SumOrAvg); @@ -2249,7 +2253,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "FuelOilNo2:Facility", "", AggType::Maximum); } if (ort->namedMonthly(10).show) { - curReport = AddMonthlyReport(state, "EnergyConsumptionDistrictHeatingCoolingMonthly", 2); + curReport = AddMonthlyReport(state, "EnergyConsumptionDistrictHeatingCoolingMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "DistrictCooling:Facility", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "DistrictCooling:Facility", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "DistrictHeatingWater:Facility", "", AggType::SumOrAvg); @@ -2258,21 +2262,21 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "DistrictHeatingSteam:Facility", "", AggType::Maximum); } if (ort->namedMonthly(11).show) { - curReport = AddMonthlyReport(state, "EnergyConsumptionCoalGasolineMonthly", 2); + curReport = AddMonthlyReport(state, "EnergyConsumptionCoalGasolineMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Coal:Facility", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Coal:Facility", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "Gasoline:Facility", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Gasoline:Facility", "", AggType::Maximum); } if (ort->namedMonthly(12).show) { - curReport = AddMonthlyReport(state, "EnergyConsumptionOtherFuelsMonthly", 2); + curReport = AddMonthlyReport(state, "EnergyConsumptionOtherFuelsMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "OtherFuel1:Facility", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "OtherFuel1:Facility", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "OtherFuel2:Facility", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "OtherFuel2:Facility", "", AggType::Maximum); } if (ort->namedMonthly(13).show) { - curReport = AddMonthlyReport(state, "EndUseEnergyConsumptionElectricityMonthly", 2); + curReport = AddMonthlyReport(state, "EndUseEnergyConsumptionElectricityMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "InteriorLights:Electricity", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "ExteriorLights:Electricity", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "InteriorEquipment:Electricity", "", AggType::SumOrAvg); @@ -2288,7 +2292,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Cogeneration:Electricity", "", AggType::SumOrAvg); } if (ort->namedMonthly(14).show) { - curReport = AddMonthlyReport(state, "EndUseEnergyConsumptionNaturalGasMonthly", 2); + curReport = AddMonthlyReport(state, "EndUseEnergyConsumptionNaturalGasMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "InteriorEquipment:NaturalGas", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "ExteriorEquipment:NaturalGas", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Heating:NaturalGas", "", AggType::SumOrAvg); @@ -2298,7 +2302,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Humidifier:NaturalGas", "", AggType::SumOrAvg); } if (ort->namedMonthly(15).show) { - curReport = AddMonthlyReport(state, "EndUseEnergyConsumptionDieselMonthly", 2); + curReport = AddMonthlyReport(state, "EndUseEnergyConsumptionDieselMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "ExteriorEquipment:Diesel", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Cooling:Diesel", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Heating:Diesel", "", AggType::SumOrAvg); @@ -2306,7 +2310,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Cogeneration:Diesel", "", AggType::SumOrAvg); } if (ort->namedMonthly(16).show) { - curReport = AddMonthlyReport(state, "EndUseEnergyConsumptionFuelOilMonthly", 2); + curReport = AddMonthlyReport(state, "EndUseEnergyConsumptionFuelOilMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "ExteriorEquipment:FuelOilNo1", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Cooling:FuelOilNo1", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Heating:FuelOilNo1", "", AggType::SumOrAvg); @@ -2319,13 +2323,13 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Cogeneration:FuelOilNo2", "", AggType::SumOrAvg); } if (ort->namedMonthly(17).show) { - curReport = AddMonthlyReport(state, "EndUseEnergyConsumptionCoalMonthly", 2); + curReport = AddMonthlyReport(state, "EndUseEnergyConsumptionCoalMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "ExteriorEquipment:Coal", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Heating:Coal", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "WaterSystems:Coal", "", AggType::SumOrAvg); } if (ort->namedMonthly(18).show) { - curReport = AddMonthlyReport(state, "EndUseEnergyConsumptionPropaneMonthly", 2); + curReport = AddMonthlyReport(state, "EndUseEnergyConsumptionPropaneMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "ExteriorEquipment:Propane", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Cooling:Propane", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Heating:Propane", "", AggType::SumOrAvg); @@ -2334,7 +2338,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Humidifier:Propane", "", AggType::SumOrAvg); } if (ort->namedMonthly(19).show) { - curReport = AddMonthlyReport(state, "EndUseEnergyConsumptionGasolineMonthly", 2); + curReport = AddMonthlyReport(state, "EndUseEnergyConsumptionGasolineMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "ExteriorEquipment:Gasoline", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Cooling:Gasoline", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Heating:Gasoline", "", AggType::SumOrAvg); @@ -2342,7 +2346,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Cogeneration:Gasoline", "", AggType::SumOrAvg); } if (ort->namedMonthly(20).show) { - curReport = AddMonthlyReport(state, "EndUseEnergyConsumptionOtherFuelsMonthly", 2); + curReport = AddMonthlyReport(state, "EndUseEnergyConsumptionOtherFuelsMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "ExteriorEquipment:OtherFuel1", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Cooling:OtherFuel1", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Heating:OtherFuel1", "", AggType::SumOrAvg); @@ -2355,7 +2359,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Cogeneration:OtherFuel2", "", AggType::SumOrAvg); } if (ort->namedMonthly(21).show) { - curReport = AddMonthlyReport(state, "PeakEnergyEndUseElectricityPart1Monthly", 2); + curReport = AddMonthlyReport(state, "PeakEnergyEndUseElectricityPart1Monthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "InteriorLights:Electricity", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "ExteriorLights:Electricity", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "InteriorEquipment:Electricity", "", AggType::Maximum); @@ -2365,7 +2369,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Heating:Electricity", "", AggType::Maximum); } if (ort->namedMonthly(22).show) { - curReport = AddMonthlyReport(state, "PeakEnergyEndUseElectricityPart2Monthly", 2); + curReport = AddMonthlyReport(state, "PeakEnergyEndUseElectricityPart2Monthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Cooling:Electricity", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "HeatRejection:Electricity", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "Humidifier:Electricity", "", AggType::Maximum); @@ -2374,7 +2378,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Cogeneration:Electricity", "", AggType::Maximum); } if (ort->namedMonthly(23).show) { - curReport = AddMonthlyReport(state, "ElectricComponentsOfPeakDemandMonthly", 2); + curReport = AddMonthlyReport(state, "ElectricComponentsOfPeakDemandMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Electricity:Facility", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "InteriorLights:Electricity", "", AggType::ValueWhenMaxMin); AddMonthlyFieldSetInput(state, curReport, "InteriorEquipment:Electricity", "", AggType::ValueWhenMaxMin); @@ -2387,7 +2391,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "HeatRejection:Electricity", "", AggType::ValueWhenMaxMin); } if (ort->namedMonthly(24).show) { - curReport = AddMonthlyReport(state, "PeakEnergyEndUseNaturalGasMonthly", 2); + curReport = AddMonthlyReport(state, "PeakEnergyEndUseNaturalGasMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "InteriorEquipment:NaturalGas", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "ExteriorEquipment:NaturalGas", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "Heating:NaturalGas", "", AggType::Maximum); @@ -2396,7 +2400,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Cogeneration:NaturalGas", "", AggType::Maximum); } if (ort->namedMonthly(25).show) { - curReport = AddMonthlyReport(state, "PeakEnergyEndUseDieselMonthly", 2); + curReport = AddMonthlyReport(state, "PeakEnergyEndUseDieselMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "ExteriorEquipment:Diesel", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "Cooling:Diesel", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "Heating:Diesel", "", AggType::Maximum); @@ -2404,7 +2408,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Cogeneration:Diesel", "", AggType::Maximum); } if (ort->namedMonthly(26).show) { - curReport = AddMonthlyReport(state, "PeakEnergyEndUseFuelOilMonthly", 2); + curReport = AddMonthlyReport(state, "PeakEnergyEndUseFuelOilMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "ExteriorEquipment:FuelOilNo1", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "Cooling:FuelOilNo1", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "Heating:FuelOilNo1", "", AggType::Maximum); @@ -2417,13 +2421,13 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Cogeneration:FuelOilNo2", "", AggType::Maximum); } if (ort->namedMonthly(27).show) { - curReport = AddMonthlyReport(state, "PeakEnergyEndUseCoalMonthly", 2); + curReport = AddMonthlyReport(state, "PeakEnergyEndUseCoalMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "ExteriorEquipment:Coal", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "Heating:Coal", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "WaterSystems:Coal", "", AggType::Maximum); } if (ort->namedMonthly(28).show) { - curReport = AddMonthlyReport(state, "PeakEnergyEndUsePropaneMonthly", 2); + curReport = AddMonthlyReport(state, "PeakEnergyEndUsePropaneMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "ExteriorEquipment:Propane", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "Cooling:Propane", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "Heating:Propane", "", AggType::Maximum); @@ -2431,7 +2435,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Cogeneration:Propane", "", AggType::Maximum); } if (ort->namedMonthly(29).show) { - curReport = AddMonthlyReport(state, "PeakEnergyEndUseGasolineMonthly", 2); + curReport = AddMonthlyReport(state, "PeakEnergyEndUseGasolineMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "ExteriorEquipment:Gasoline", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "Cooling:Gasoline", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "Heating:Gasoline", "", AggType::Maximum); @@ -2439,7 +2443,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Cogeneration:Gasoline", "", AggType::Maximum); } if (ort->namedMonthly(30).show) { - curReport = AddMonthlyReport(state, "PeakEnergyEndUseOtherFuelsMonthly", 2); + curReport = AddMonthlyReport(state, "PeakEnergyEndUseOtherFuelsMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "ExteriorEquipment:OtherFuel1", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "Cooling:OtherFuel1", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "Heating:OtherFuel1", "", AggType::Maximum); @@ -2452,7 +2456,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Cogeneration:OtherFuel2", "", AggType::Maximum); } if (ort->namedMonthly(31).show) { - curReport = AddMonthlyReport(state, "SetpointsNotMetWithTemperaturesMonthly", 2); + curReport = AddMonthlyReport(state, "SetpointsNotMetWithTemperaturesMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Zone Heating Setpoint Not Met Time", "", AggType::HoursNonZero); AddMonthlyFieldSetInput(state, curReport, "Zone Mean Air Temperature", "", AggType::SumOrAverageHoursShown); AddMonthlyFieldSetInput(state, curReport, "Zone Heating Setpoint Not Met While Occupied Time", "", AggType::HoursNonZero); @@ -2463,7 +2467,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Zone Mean Air Temperature", "", AggType::SumOrAverageHoursShown); } if (ort->namedMonthly(32).show) { - curReport = AddMonthlyReport(state, "ComfortReportSimple55Monthly", 2); + curReport = AddMonthlyReport(state, "ComfortReportSimple55Monthly", 2, true); AddMonthlyFieldSetInput( state, curReport, "Zone Thermal Comfort ASHRAE 55 Simple Model Summer Clothes Not Comfortable Time", "", AggType::HoursNonZero); AddMonthlyFieldSetInput(state, curReport, "Zone Mean Air Temperature", "", AggType::SumOrAverageHoursShown); @@ -2475,14 +2479,14 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Zone Mean Air Temperature", "", AggType::SumOrAverageHoursShown); } if (ort->namedMonthly(33).show) { - curReport = AddMonthlyReport(state, "UnglazedTranspiredSolarCollectorSummaryMonthly", 5); + curReport = AddMonthlyReport(state, "UnglazedTranspiredSolarCollectorSummaryMonthly", 5, true); AddMonthlyFieldSetInput(state, curReport, "Solar Collector System Efficiency", "", AggType::HoursNonZero); AddMonthlyFieldSetInput(state, curReport, "Solar Collector System Efficiency", "", AggType::SumOrAverageHoursShown); AddMonthlyFieldSetInput(state, curReport, "Solar Collector Outside Face Suction Velocity", "", AggType::SumOrAverageHoursShown); AddMonthlyFieldSetInput(state, curReport, "Solar Collector Sensible Heating Rate", "", AggType::SumOrAverageHoursShown); } if (ort->namedMonthly(34).show) { - curReport = AddMonthlyReport(state, "OccupantComfortDataSummaryMonthly", 5); + curReport = AddMonthlyReport(state, "OccupantComfortDataSummaryMonthly", 5, true); AddMonthlyFieldSetInput(state, curReport, "People Occupant Count", "", AggType::HoursNonZero); AddMonthlyFieldSetInput(state, curReport, "People Air Temperature", "", AggType::SumOrAverageHoursShown); AddMonthlyFieldSetInput(state, curReport, "People Air Relative Humidity", "", AggType::SumOrAverageHoursShown); @@ -2490,7 +2494,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Zone Thermal Comfort Fanger Model PPD", "", AggType::SumOrAverageHoursShown); } if (ort->namedMonthly(35).show) { - curReport = AddMonthlyReport(state, "ChillerReportMonthly", 2); + curReport = AddMonthlyReport(state, "ChillerReportMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Chiller Electricity Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Chiller Electricity Rate", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "Chiller Electricity Energy", "", AggType::HoursNonZero); @@ -2503,7 +2507,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Chiller Part Load Ratio", "", AggType::Maximum); } if (ort->namedMonthly(36).show) { - curReport = AddMonthlyReport(state, "TowerReportMonthly", 2); + curReport = AddMonthlyReport(state, "TowerReportMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Cooling Tower Fan Electricity Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Cooling Tower Fan Electricity Energy", "", AggType::HoursNonZero); AddMonthlyFieldSetInput(state, curReport, "Cooling Tower Fan Electricity Rate", "", AggType::Maximum); @@ -2513,7 +2517,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Cooling Tower Mass Flow Rate", "", AggType::SumOrAvg); } if (ort->namedMonthly(37).show) { - curReport = AddMonthlyReport(state, "BoilerReportMonthly", 2); + curReport = AddMonthlyReport(state, "BoilerReportMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Boiler Heating Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Boiler Gas Consumption", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Boiler Heating Energy", "", AggType::HoursNonZero); @@ -2527,7 +2531,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Boiler Part Load Ratio", "", AggType::Maximum); } if (ort->namedMonthly(38).show) { - curReport = AddMonthlyReport(state, "DXReportMonthly", 2); + curReport = AddMonthlyReport(state, "DXReportMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Cooling Coil Total Cooling Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Cooling Coil Electricity Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Cooling Coil Total Cooling Energy", "", AggType::HoursNonZero); @@ -2543,7 +2547,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Cooling Coil Crankcase Heater Electricity Rate", "", AggType::Maximum); } if (ort->namedMonthly(39).show) { - curReport = AddMonthlyReport(state, "WindowReportMonthly", 2); + curReport = AddMonthlyReport(state, "WindowReportMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Surface Window Transmitted Solar Radiation Rate", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Surface Window Transmitted Beam Solar Radiation Rate", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Surface Window Transmitted Diffuse Solar Radiation Rate", "", AggType::SumOrAvg); @@ -2554,7 +2558,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Surface Storm Window On Off Status", "", AggType::HoursNonZero); } if (ort->namedMonthly(40).show) { - curReport = AddMonthlyReport(state, "WindowEnergyReportMonthly", 2); + curReport = AddMonthlyReport(state, "WindowEnergyReportMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Surface Window Transmitted Solar Radiation Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Surface Window Transmitted Beam Solar Radiation Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Surface Window Transmitted Diffuse Solar Radiation Energy", "", AggType::SumOrAvg); @@ -2562,7 +2566,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Surface Window Heat Loss Energy", "", AggType::SumOrAvg); } if (ort->namedMonthly(41).show) { - curReport = AddMonthlyReport(state, "WindowZoneSummaryMonthly", 2); + curReport = AddMonthlyReport(state, "WindowZoneSummaryMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Zone Windows Total Heat Gain Rate", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Zone Windows Total Heat Loss Rate", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Zone Windows Total Transmitted Solar Radiation Rate", "", AggType::SumOrAvg); @@ -2572,7 +2576,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Zone Interior Windows Total Transmitted Beam Solar Radiation Rate", "", AggType::SumOrAvg); } if (ort->namedMonthly(42).show) { - curReport = AddMonthlyReport(state, "WindowEnergyZoneSummaryMonthly", 2); + curReport = AddMonthlyReport(state, "WindowEnergyZoneSummaryMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Zone Windows Total Heat Gain Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Zone Windows Total Heat Loss Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Zone Windows Total Transmitted Solar Radiation Energy", "", AggType::SumOrAvg); @@ -2582,7 +2586,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Zone Interior Windows Total Transmitted Beam Solar Radiation Energy", "", AggType::SumOrAvg); } if (ort->namedMonthly(43).show) { - curReport = AddMonthlyReport(state, "AverageOutdoorConditionsMonthly", 2); + curReport = AddMonthlyReport(state, "AverageOutdoorConditionsMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Site Outdoor Air Drybulb Temperature", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Site Outdoor Air Wetbulb Temperature", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Site Outdoor Air Dewpoint Temperature", "", AggType::SumOrAvg); @@ -2593,7 +2597,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Site Rain Status", "", AggType::SumOrAvg); } if (ort->namedMonthly(44).show) { - curReport = AddMonthlyReport(state, "OutdoorConditionsMaximumDryBulbMonthly", 2); + curReport = AddMonthlyReport(state, "OutdoorConditionsMaximumDryBulbMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Site Outdoor Air Drybulb Temperature", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "Site Outdoor Air Wetbulb Temperature", "", AggType::ValueWhenMaxMin); AddMonthlyFieldSetInput(state, curReport, "Site Outdoor Air Dewpoint Temperature", "", AggType::ValueWhenMaxMin); @@ -2603,7 +2607,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Site Direct Solar Radiation Rate per Area", "", AggType::ValueWhenMaxMin); } if (ort->namedMonthly(45).show) { - curReport = AddMonthlyReport(state, "OutdoorConditionsMinimumDryBulbMonthly", 2); + curReport = AddMonthlyReport(state, "OutdoorConditionsMinimumDryBulbMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Site Outdoor Air Drybulb Temperature", "", AggType::Minimum); AddMonthlyFieldSetInput(state, curReport, "Site Outdoor Air Wetbulb Temperature", "", AggType::ValueWhenMaxMin); AddMonthlyFieldSetInput(state, curReport, "Site Outdoor Air Dewpoint Temperature", "", AggType::ValueWhenMaxMin); @@ -2613,7 +2617,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Site Direct Solar Radiation Rate per Area", "", AggType::ValueWhenMaxMin); } if (ort->namedMonthly(46).show) { - curReport = AddMonthlyReport(state, "OutdoorConditionsMaximumWetBulbMonthly", 2); + curReport = AddMonthlyReport(state, "OutdoorConditionsMaximumWetBulbMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Site Outdoor Air Wetbulb Temperature", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "Site Outdoor Air Drybulb Temperature", "", AggType::ValueWhenMaxMin); AddMonthlyFieldSetInput(state, curReport, "Site Outdoor Air Dewpoint Temperature", "", AggType::ValueWhenMaxMin); @@ -2623,7 +2627,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Site Direct Solar Radiation Rate per Area", "", AggType::ValueWhenMaxMin); } if (ort->namedMonthly(47).show) { - curReport = AddMonthlyReport(state, "OutdoorConditionsMaximumDewPointMonthly", 2); + curReport = AddMonthlyReport(state, "OutdoorConditionsMaximumDewPointMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Site Outdoor Air Dewpoint Temperature", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "Site Outdoor Air Drybulb Temperature", "", AggType::ValueWhenMaxMin); AddMonthlyFieldSetInput(state, curReport, "Site Outdoor Air Wetbulb Temperature", "", AggType::ValueWhenMaxMin); @@ -2633,7 +2637,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Site Direct Solar Radiation Rate per Area", "", AggType::ValueWhenMaxMin); } if (ort->namedMonthly(48).show) { - curReport = AddMonthlyReport(state, "OutdoorGroundConditionsMonthly", 2); + curReport = AddMonthlyReport(state, "OutdoorGroundConditionsMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Site Ground Temperature", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Site Surface Ground Temperature", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Site Deep Ground Temperature", "", AggType::SumOrAvg); @@ -2642,7 +2646,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Site Snow on Ground Status", "", AggType::SumOrAvg); } if (ort->namedMonthly(49).show) { - curReport = AddMonthlyReport(state, "WindowACReportMonthly", 2); + curReport = AddMonthlyReport(state, "WindowACReportMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Zone Window Air Conditioner Total Cooling Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Zone Window Air Conditioner Electricity Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Zone Window Air Conditioner Total Cooling Energy", "", AggType::HoursNonZero); @@ -2654,7 +2658,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Zone Window Air Conditioner Electricity Rate", "", AggType::ValueWhenMaxMin); } if (ort->namedMonthly(50).show) { - curReport = AddMonthlyReport(state, "WaterHeaterReportMonthly", 2); + curReport = AddMonthlyReport(state, "WaterHeaterReportMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Water Heater Total Demand Heat Transfer Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Water Heater Use Side Heat Transfer Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Water Heater Burner Heating Energy", "", AggType::SumOrAvg); @@ -2667,7 +2671,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Water Heater Source Energy", "", AggType::SumOrAvg); } if (ort->namedMonthly(51).show) { - curReport = AddMonthlyReport(state, "GeneratorReportMonthly", 2); + curReport = AddMonthlyReport(state, "GeneratorReportMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Generator Produced AC Electricity Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Generator Diesel Consumption", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Generator Gas Consumption", "", AggType::SumOrAvg); @@ -2679,7 +2683,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Generator Exhaust Air Temperature", "", AggType::SumOrAvg); } if (ort->namedMonthly(52).show) { - curReport = AddMonthlyReport(state, "DaylightingReportMonthly", 2); + curReport = AddMonthlyReport(state, "DaylightingReportMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Site Exterior Beam Normal Illuminance", "", AggType::HoursNonZero); AddMonthlyFieldSetInput(state, curReport, "Daylighting Lighting Power Multiplier", "", AggType::SumOrAverageHoursShown); AddMonthlyFieldSetInput(state, curReport, "Daylighting Lighting Power Multiplier", "", AggType::MinimumDuringHoursShown); @@ -2693,7 +2697,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Daylighting Reference Point 2 Daylight Illuminance Setpoint Exceeded Time", "", AggType::SumOrAvg); } if (ort->namedMonthly(53).show) { - curReport = AddMonthlyReport(state, "CoilReportMonthly", 2); + curReport = AddMonthlyReport(state, "CoilReportMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Heating Coil Heating Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Heating Coil Heating Rate", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "Cooling Coil Total Cooling Energy", "", AggType::SumOrAvg); @@ -2703,21 +2707,21 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Cooling Coil Wetted Area Fraction", "", AggType::SumOrAvg); } if (ort->namedMonthly(54).show) { - curReport = AddMonthlyReport(state, "PlantLoopDemandReportMonthly", 2); + curReport = AddMonthlyReport(state, "PlantLoopDemandReportMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Plant Supply Side Cooling Demand Rate", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Plant Supply Side Cooling Demand Rate", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "Plant Supply Side Heating Demand Rate", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Plant Supply Side Heating Demand Rate", "", AggType::Maximum); } if (ort->namedMonthly(55).show) { - curReport = AddMonthlyReport(state, "FanReportMonthly", 2); + curReport = AddMonthlyReport(state, "FanReportMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Fan Electricity Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Fan Rise in Air Temperature", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Fan Electricity Rate", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "Fan Rise in Air Temperature", "", AggType::ValueWhenMaxMin); } if (ort->namedMonthly(56).show) { - curReport = AddMonthlyReport(state, "PumpReportMonthly", 2); + curReport = AddMonthlyReport(state, "PumpReportMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Pump Electricity Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Pump Fluid Heat Gain Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Pump Electricity Rate", "", AggType::Maximum); @@ -2727,7 +2731,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Pump Mass Flow Rate", "", AggType::ValueWhenMaxMin); } if (ort->namedMonthly(57).show) { - curReport = AddMonthlyReport(state, "CondLoopDemandReportMonthly", 2); + curReport = AddMonthlyReport(state, "CondLoopDemandReportMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Plant Supply Side Cooling Demand Rate", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Plant Supply Side Cooling Demand Rate", "", AggType::Maximum); AddMonthlyFieldSetInput(state, curReport, "Plant Supply Side Inlet Temperature", "", AggType::ValueWhenMaxMin); @@ -2736,12 +2740,12 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Plant Supply Side Heating Demand Rate", "", AggType::Maximum); } if (ort->namedMonthly(58).show) { - curReport = AddMonthlyReport(state, "ZoneTemperatureOscillationReportMonthly", 2); + curReport = AddMonthlyReport(state, "ZoneTemperatureOscillationReportMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Zone Oscillating Temperatures Time", "", AggType::HoursNonZero); AddMonthlyFieldSetInput(state, curReport, "Zone People Occupant Count", "", AggType::SumOrAverageHoursShown); } if (ort->namedMonthly(59).show) { - curReport = AddMonthlyReport(state, "AirLoopSystemEnergyAndWaterUseMonthly", 2); + curReport = AddMonthlyReport(state, "AirLoopSystemEnergyAndWaterUseMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Air System Hot Water Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Air System Steam Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Air System Chilled Water Energy", "", AggType::SumOrAvg); @@ -2751,7 +2755,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) } if (ort->namedMonthly(60).show) { - curReport = AddMonthlyReport(state, "AirLoopSystemComponentLoadsMonthly", 2); + curReport = AddMonthlyReport(state, "AirLoopSystemComponentLoadsMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Air System Fan Air Heating Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Air System Cooling Coil Total Cooling Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Air System Heating Coil Total Heating Energy", "", AggType::SumOrAvg); @@ -2762,7 +2766,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Air System Desiccant Dehumidifier Total Cooling Energy", "", AggType::SumOrAvg); } if (ort->namedMonthly(61).show) { - curReport = AddMonthlyReport(state, "AirLoopSystemComponentEnergyUseMonthly", 2); + curReport = AddMonthlyReport(state, "AirLoopSystemComponentEnergyUseMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Air System Fan Electricity Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Air System Heating Coil Hot Water Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Air System Cooling Coil Chilled Water Energy", "", AggType::SumOrAvg); @@ -2777,7 +2781,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Air System Desiccant Dehumidifier Electricity Energy", "", AggType::SumOrAvg); } if (ort->namedMonthly(62).show) { - curReport = AddMonthlyReport(state, "MechanicalVentilationLoadsMonthly", 2); + curReport = AddMonthlyReport(state, "MechanicalVentilationLoadsMonthly", 2, true); AddMonthlyFieldSetInput(state, curReport, "Zone Mechanical Ventilation No Load Heat Removal Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Zone Mechanical Ventilation Cooling Load Increase Energy", "", AggType::SumOrAvg); AddMonthlyFieldSetInput( @@ -2791,7 +2795,7 @@ void CreatePredefinedMonthlyReports(EnergyPlusData &state) AddMonthlyFieldSetInput(state, curReport, "Zone Mechanical Ventilation Air Changes per Hour", "", AggType::SumOrAvg); } if (ort->namedMonthly(63).show) { - curReport = AddMonthlyReport(state, "HeatEmissionsReportMonthly", 2); + curReport = AddMonthlyReport(state, "HeatEmissionsReportMonthly", 2, true); // Place holder AddMonthlyFieldSetInput(state, curReport, "Site Total Surface Heat Emission to Air", "", AggType::SumOrAvg); AddMonthlyFieldSetInput(state, curReport, "Site Total Zone Exfiltration Heat Loss", "", AggType::SumOrAvg); diff --git a/src/EnergyPlus/OutputReportTabular.hh b/src/EnergyPlus/OutputReportTabular.hh index f96d1c6a659..b0287813f88 100644 --- a/src/EnergyPlus/OutputReportTabular.hh +++ b/src/EnergyPlus/OutputReportTabular.hh @@ -331,17 +331,13 @@ namespace OutputReportTabular { struct MonthlyInputType { // Members - std::string name; // identifier - int numFieldSet; // number of monthly field sets - int firstFieldSet; // pointer to the first field set - int numTables; // number of tables - int firstTable; // pointer to the first table - int showDigits; // the number of digits to be shown - - // Default Constructor - MonthlyInputType() : numFieldSet(0), firstFieldSet(0), numTables(0), firstTable(0), showDigits(0) - { - } + std::string name; // identifier + int numFieldSet = 0; // number of monthly field sets + int firstFieldSet = 0; // pointer to the first field set + int numTables = 0; // number of tables + int firstTable = 0; // pointer to the first table + int showDigits = 0; // the number of digits to be shown + bool isNamedMonthly = false; }; struct MonthlyFieldSetInputType @@ -523,7 +519,7 @@ namespace OutputReportTabular { void GetInputTabularMonthly(EnergyPlusData &state); - int AddMonthlyReport(EnergyPlusData &state, std::string const &inReportName, int const inNumDigitsShown); + int AddMonthlyReport(EnergyPlusData &state, std::string const &inReportName, int const inNumDigitsShown, bool isNamedMonthly = false); void AddMonthlyFieldSetInput( EnergyPlusData &state, int const inMonthReport, std::string const &inVariMeter, std::string const &inColHead, AggType const inAggregate); From 9818a480f8976eebef43950fb99ffdd5fe01dbf5 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 8 Sep 2023 13:24:05 +0200 Subject: [PATCH 63/80] Add lots of testing with the desired behavior in each case. --- .../unit/OutputReportTabular.unit.cc | 245 +++++++++++++++++- 1 file changed, 239 insertions(+), 6 deletions(-) diff --git a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc index 8c27bd49726..415d8a5e86f 100644 --- a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc +++ b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc @@ -8602,6 +8602,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_8317_ValidateOutputTableMon state->dataGlobal->DoWeathSim = true; state->dataGlobal->TimeStepZone = 0.25; state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * 60.0; + state->dataGlobal->DisplayExtraWarnings = false; InitializeOutput(*state); @@ -8623,12 +8624,10 @@ TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_8317_ValidateOutputTableMon OutputReportTabular::GetInputTabularMonthly(*state); OutputReportTabular::InitializeTabularMonthly(*state); - std::string expected_error = delimited_string({ - " ** Warning ** In Output:Table:Monthly 'MY REPORT' invalid Variable or Meter Name 'HEATING:GAS'", - " ** Warning ** In Output:Table:Monthly 'MY REPORT' invalid Variable or Meter Name 'EXTERIOR LIGHTS ELECTRIC POWER'", - " ** Warning ** In Output:Table:Monthly 'MY REPORT' invalid Variable or Meter Name 'ALWAYSON'", + std::string const expected_error = delimited_string({ + " ** Warning ** Processing Monthly Tabular Reports: Variable names not valid for this simulation", + " ** ~~~ ** ...use Output:Diagnostics,DisplayExtraWarnings; to show more details on individual variables.", }); - compare_err_stream(expected_error); } @@ -12584,7 +12583,7 @@ TEST_F(SQLiteFixture, UpdateSizing_EndSysSizingCalc) EXPECT_EQ(return_val, 5080.22); } -TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_WarnOnMissingMonthlyVariable) +TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_WarnMonthly) { // #9621 - Only warn if a bad variable is defined in a Monthly table user requested, not on the AllSummaryAndMonthly ones std::string const idf_objects = delimited_string({ @@ -12617,8 +12616,139 @@ TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_WarnOnMissingMonthlyVariabl "General"); state->dataGlobal->DoWeathSim = true; + state->dataGlobal->KindOfSim = Constant::KindOfSim::RunPeriodWeather; // Trigger the extra warning + state->dataGlobal->TimeStepZone = 0.25; + state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * 60.0; + state->dataGlobal->DisplayExtraWarnings = false; + + GetInputTabularMonthly(*state); + EXPECT_EQ(state->dataOutRptTab->MonthlyInputCount, 1); + GetInputOutputTableSummaryReports(*state); + EXPECT_EQ(state->dataOutRptTab->MonthlyInputCount, numNamedMonthly + 1); + + InitializeTabularMonthly(*state); + + std::string const expected_error = delimited_string({ + " ** Warning ** Processing Monthly Tabular Reports: Variable names not valid for this simulation", + " ** ~~~ ** ...use Output:Diagnostics,DisplayExtraWarnings; to show more details on individual variables.", + }); + compare_err_stream(expected_error); +} + +TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_WarnMonthly_AlwaysIfWeatherRunRequested) +{ + // #9621 - Only warn if a bad variable is defined in a Monthly table user requested, not on the AllSummaryAndMonthly ones + // If I request a Weater File run Period I expect a warning + // Regardless of the fact that the sizing run happens first + std::string const idf_objects = delimited_string({ + "SimulationControl,", + " No, !- Do Zone Sizing Calculation", + " No, !- Do System Sizing Calculation", + " No, !- Do Plant Sizing Calculation", + " Yes, !- Run Simulation for Sizing Periods", + " Yes; !- Run Simulation for Weather File Run Periods", + + "Output:Table:Monthly,", + " Space Gains Annual Report, !- Name", + " 2, !- Digits After Decimal", + " Exterior Lights Electricity Energy, !- Variable or Meter 1 Name", + " SumOrAverage, !- Aggregation Type for Variable or Meter 1", + " NON EXISTANT VARIABLE, !- Variable or Meter 2 Name", + " Maximum; !- Aggregation Type for Variable or Meter 2", + + "Output:Table:SummaryReports,", + " AllSummaryAndMonthly; !- Report 1 Name", + }); + + ASSERT_TRUE(process_idf(idf_objects)); + + SimulationManager::GetProjectData(*state); + EXPECT_TRUE(state->dataGlobal->DoDesDaySim); + EXPECT_TRUE(state->dataGlobal->DoWeathSim); + + Real64 extLitUse; + + SetupOutputVariable(*state, + "Exterior Lights Electricity Energy", + OutputProcessor::Unit::J, + extLitUse, + OutputProcessor::SOVTimeStepType::Zone, + OutputProcessor::SOVStoreType::Summed, + "Lite1", + {}, + "Electricity", + "Exterior Lights", + "General"); + + // In a regular simulation with the above SimulationControl, when InitializeTabularMonthly is called it's DesignDay + state->dataGlobal->KindOfSim = Constant::KindOfSim::DesignDay; + state->dataGlobal->TimeStepZone = 0.25; + state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * 60.0; + state->dataGlobal->DisplayExtraWarnings = false; + + GetInputTabularMonthly(*state); + EXPECT_EQ(state->dataOutRptTab->MonthlyInputCount, 1); + GetInputOutputTableSummaryReports(*state); + EXPECT_EQ(state->dataOutRptTab->MonthlyInputCount, numNamedMonthly + 1); + + InitializeTabularMonthly(*state); + + std::string const expected_error = delimited_string({ + " ** Warning ** Processing Monthly Tabular Reports: Variable names not valid for this simulation", + " ** ~~~ ** ...use Output:Diagnostics,DisplayExtraWarnings; to show more details on individual variables.", + }); + compare_err_stream(expected_error); +} + +TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_WarnMonthlyDisplayExtraWarnings) +{ + // #9621 - Only warn if a bad variable is defined in a Monthly table user requested, not on the AllSummaryAndMonthly ones + std::string const idf_objects = delimited_string({ + "Output:Table:Monthly,", + " Space Gains Annual Report, !- Name", + " 2, !- Digits After Decimal", + " NON EXISTANT VARIABLE, !- Variable or Meter 1 Name", + " SumOrAverage, !- Aggregation Type for Variable or Meter 1", + " NON EXISTANT VARIABLE BIS, !- Variable or Meter 2 Name", + " Maximum; !- Aggregation Type for Variable or Meter 2", + + "Output:Table:SummaryReports,", + " AllSummaryAndMonthly; !- Report 1 Name", + }); + + ASSERT_TRUE(process_idf(idf_objects)); + + Real64 extLitUse; + + SetupOutputVariable(*state, + "Exterior Lights Electricity Energy", + OutputProcessor::Unit::J, + extLitUse, + OutputProcessor::SOVTimeStepType::Zone, + OutputProcessor::SOVStoreType::Summed, + "Lite1", + {}, + "Electricity", + "Exterior Lights", + "General"); + + SetupOutputVariable(*state, + "Exterior Lights Electricity Energy", + OutputProcessor::Unit::J, + extLitUse, + OutputProcessor::SOVTimeStepType::Zone, + OutputProcessor::SOVStoreType::Summed, + "Lite2", + {}, + "Electricity", + "Exterior Lights", + "General"); + + state->dataGlobal->DoWeathSim = true; + state->dataGlobal->KindOfSim = Constant::KindOfSim::RunPeriodWeather; // Trigger the extra warning state->dataGlobal->TimeStepZone = 0.25; state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * 60.0; + state->dataGlobal->DisplayExtraWarnings = true; GetInputTabularMonthly(*state); EXPECT_EQ(state->dataOutRptTab->MonthlyInputCount, 1); @@ -12628,7 +12758,110 @@ TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_WarnOnMissingMonthlyVariabl InitializeTabularMonthly(*state); std::string const expected_error = delimited_string({ + " ** Warning ** Processing Monthly Tabular Reports: Variable names not valid for this simulation", + " ** ~~~ ** ..Variables not valid for this simulation will have \"[Invalid/Undefined]\" in the Units Column of the Table Report.", " ** Warning ** In Output:Table:Monthly 'SPACE GAINS ANNUAL REPORT' invalid Variable or Meter Name 'NON EXISTANT VARIABLE'", + " ** Warning ** In Output:Table:Monthly 'SPACE GAINS ANNUAL REPORT' invalid Variable or Meter Name 'NON EXISTANT VARIABLE BIS'", }); compare_err_stream(expected_error); } + +TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_NoWarnMonthlIfNoWeatherFileRun) +{ + // #9621 - Only warn if a bad variable is defined in a Monthly table user requested, not on the AllSummaryAndMonthly ones + std::string const idf_objects = delimited_string({ + "Output:Table:Monthly,", + " Space Gains Annual Report, !- Name", + " 2, !- Digits After Decimal", + " NON EXISTANT VARIABLE, !- Variable or Meter 1 Name", + " SumOrAverage, !- Aggregation Type for Variable or Meter 1", + " NON EXISTANT VARIABLE BIS, !- Variable or Meter 2 Name", + " Maximum; !- Aggregation Type for Variable or Meter 2", + + "Output:Table:SummaryReports,", + " AllSummaryAndMonthly; !- Report 1 Name", + }); + + ASSERT_TRUE(process_idf(idf_objects)); + + Real64 extLitUse; + + SetupOutputVariable(*state, + "Exterior Lights Electricity Energy", + OutputProcessor::Unit::J, + extLitUse, + OutputProcessor::SOVTimeStepType::Zone, + OutputProcessor::SOVStoreType::Summed, + "Lite1", + {}, + "Electricity", + "Exterior Lights", + "General"); + + SetupOutputVariable(*state, + "Exterior Lights Electricity Energy", + OutputProcessor::Unit::J, + extLitUse, + OutputProcessor::SOVTimeStepType::Zone, + OutputProcessor::SOVStoreType::Summed, + "Lite2", + {}, + "Electricity", + "Exterior Lights", + "General"); + + state->dataGlobal->DoWeathSim = false; // <- here + state->dataGlobal->KindOfSim = Constant::KindOfSim::DesignDay; + state->dataGlobal->TimeStepZone = 0.25; + state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * 60.0; + state->dataGlobal->DisplayExtraWarnings = true; + + GetInputTabularMonthly(*state); + EXPECT_EQ(state->dataOutRptTab->MonthlyInputCount, 1); + GetInputOutputTableSummaryReports(*state); + EXPECT_EQ(state->dataOutRptTab->MonthlyInputCount, numNamedMonthly + 1); + + InitializeTabularMonthly(*state); + + compare_err_stream(""); +} + +TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_DontWarnMonthlyIfOnlyNamedReports) +{ + // #9621 - Only warn if a bad variable is defined in a Monthly table user requested, not on the AllSummaryAndMonthly ones + std::string const idf_objects = delimited_string({ + "Output:Table:SummaryReports,", + " AllSummaryAndMonthly; !- Report 1 Name", + }); + + ASSERT_TRUE(process_idf(idf_objects)); + + Real64 extLitUse; + + SetupOutputVariable(*state, + "Exterior Lights Electricity Energy", + OutputProcessor::Unit::J, + extLitUse, + OutputProcessor::SOVTimeStepType::Zone, + OutputProcessor::SOVStoreType::Summed, + "Lite1", + {}, + "Electricity", + "Exterior Lights", + "General"); + + state->dataGlobal->DoWeathSim = true; + state->dataGlobal->KindOfSim = Constant::KindOfSim::RunPeriodWeather; // Trigger the extra warning + state->dataGlobal->TimeStepZone = 0.25; + state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * 60.0; + state->dataGlobal->DisplayExtraWarnings = true; + + GetInputTabularMonthly(*state); + EXPECT_EQ(state->dataOutRptTab->MonthlyInputCount, 0); + GetInputOutputTableSummaryReports(*state); + EXPECT_EQ(state->dataOutRptTab->MonthlyInputCount, numNamedMonthly); + + InitializeTabularMonthly(*state); + + compare_err_stream(""); +} From f29246f246063547b582aae35faf80d622cf49cc Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 8 Sep 2023 13:26:14 +0200 Subject: [PATCH 64/80] Adjust the monthly warnings * Avoid printing two warnings when display extra warning (My fault, in #8348) * Do not print individual variables if non display extra warning * Reorganize when single line warning is issued to be more logical * Reduce number of printed lines --- src/EnergyPlus/OutputReportTabular.cc | 70 ++++++++++----------------- src/EnergyPlus/OutputReportTabular.hh | 2 - 2 files changed, 25 insertions(+), 47 deletions(-) diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index 2327170dc44..397421cec84 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -614,15 +614,13 @@ void InitializeTabularMonthly(EnergyPlusData &state) // #ifdef ITM_KEYCACHE // Noel comment: First time in this TabNum/ColNum loop, let's save the results // of GetVariableKeyCountandType & GetVariableKeys. - std::string const &curVariMeter = UtilityRoutines::makeUPPER(ort->MonthlyFieldSetInput(FirstColumn + colNum - 1).variMeter); + std::string const curVariMeter = UtilityRoutines::makeUPPER(ort->MonthlyFieldSetInput(FirstColumn + colNum - 1).variMeter); // call the key count function but only need count during this pass int KeyCount = 0; GetVariableKeyCountandType(state, curVariMeter, KeyCount, TypeVar, AvgSumVar, StepTypeVar, UnitsVar); if (TypeVar == OutputProcessor::VariableType::NotFound) { if (!ort->MonthlyInput(TabNum).isNamedMonthly) { - ShowWarningError( - state, - format("In Output:Table:Monthly '{}' invalid Variable or Meter Name '{}'", ort->MonthlyInput(TabNum).name, curVariMeter)); + ++state.dataOutRptTab->ErrCount1; } } // IF (KeyCount > maxKeyCount) THEN @@ -725,6 +723,22 @@ void InitializeTabularMonthly(EnergyPlusData &state) ort->MonthlyColumns(colNum).duration = 0.0; } + // std::count_if(ort->MonthlyInput.begin(), ort->MonthlyInputCount.end(), [](auto& monthlyInput) + // If no weather file run requested, don't bother issuing a warning + bool issueWarnings = false; + if (state.dataGlobal->DoWeathSim && (state.dataOutRptTab->ErrCount1 > 0)) { + ShowWarningError(state, "Processing Monthly Tabular Reports: Variable names not valid for this simulation"); + + if (!state.dataGlobal->DisplayExtraWarnings) { + ShowContinueError(state, "...use Output:Diagnostics,DisplayExtraWarnings; to show more details on individual variables."); + } else { + ShowContinueError(state, + "..Variables not valid for this simulation will have \"[Invalid/Undefined]\" in the Units Column of " + "the Table Report."); + issueWarnings = true; + } + } + int ColumnsRecount = 0; int TablesRecount = 0; for (int TabNum = 1; TabNum <= ort->MonthlyInputCount; ++TabNum) { @@ -734,45 +748,16 @@ void InitializeTabularMonthly(EnergyPlusData &state) int UniqueKeyCount = 0; bool environmentKeyFound = false; for (int colNum = 1; colNum <= NumColumns; ++colNum) { - // #ifdef ITM_KEYCACHE - // Noel comment: Here is where we could use the saved values std::string const &curVariMeter = ort->MonthlyFieldSetInput(FirstColumn + colNum - 1).variMeterUpper; const int KeyCount = ort->MonthlyFieldSetInput(FirstColumn + colNum - 1).keyCount; TypeVar = ort->MonthlyFieldSetInput(FirstColumn + colNum - 1).typeOfVar; AvgSumVar = ort->MonthlyFieldSetInput(FirstColumn + colNum - 1).varAvgSum; StepTypeVar = ort->MonthlyFieldSetInput(FirstColumn + colNum - 1).varStepType; UnitsVar = ort->MonthlyFieldSetInput(FirstColumn + colNum - 1).varUnits; - // DO iKey = 1, KeyCount !noel - // NamesOfKeys(iKey) = MonthlyFieldSetInput(FirstColumn + ColNum - 1)%NamesOfKeys(iKey) !noel - // IndexesForKeyVar(iKey) = MonthlyFieldSetInput(FirstColumn + ColNum - 1)%IndexesForKeyVar(iKey) !noel - // ENDDO - // #else - // curVariMeter = UtilityRoutines::makeUPPER(MonthlyFieldSetInput(FirstColumn + ColNum - 1)%variMeter) - // ! call the key count function but only need count during this pass - // CALL GetVariableKeyCountandType(state, curVariMeter,KeyCount,TypeVar,AvgSumVar,StepTypeVar,UnitsVar) - // ALLOCATE(NamesOfKeys(KeyCount)) - // ALLOCATE(IndexesForKeyVar(KeyCount)) - // CALL GetVariableKeys(state, curVariMeter,TypeVar,NamesOfKeys,IndexesForKeyVar) - // #endif - if (KeyCount == 0) { - ++state.dataOutRptTab->ErrCount1; - if (state.dataOutRptTab->ErrCount1 == 1 && !state.dataGlobal->DisplayExtraWarnings && - state.dataGlobal->KindOfSim == Constant::KindOfSim::RunPeriodWeather) { - ShowWarningError(state, "Processing Monthly Tabular Reports: Variable names not valid for this simulation"); - ShowContinueError(state, "...use Output:Diagnostics,DisplayExtraWarnings; to show more details on individual variables."); - } - // fixing CR5878 removed the showing of the warning once about a specific variable. - if (state.dataGlobal->DisplayExtraWarnings && state.dataGlobal->KindOfSim == Constant::KindOfSim::RunPeriodWeather) { - ShowWarningError(state, format("Processing Monthly Tabular Reports: {}", ort->MonthlyInput(TabNum).name)); - ShowContinueError(state, format("..Variable name={} not valid for this simulation.", curVariMeter)); - if (state.dataOutRptTab->VarWarning) { - ShowContinueError(state, - "..Variables not valid for this simulation will have \"[Invalid/Undefined]\" in the Units Column of " - "the Table Report."); - state.dataOutRptTab->VarWarning = false; - } - } + if (KeyCount == 0 && issueWarnings && !ort->MonthlyInput(TabNum).isNamedMonthly) { + ShowWarningError( + state, format("In Output:Table:Monthly '{}' invalid Variable or Meter Name '{}'", ort->MonthlyInput(TabNum).name, curVariMeter)); } for (int iKey = 1; iKey <= KeyCount; ++iKey) { found = 0; @@ -930,17 +915,12 @@ void InitializeTabularMonthly(EnergyPlusData &state) } } else { // if no key corresponds to this instance of the report // fixing CR5878 removed the showing of the warning once about a specific variable. - if (state.dataGlobal->DisplayExtraWarnings && state.dataGlobal->KindOfSim == Constant::KindOfSim::RunPeriodWeather) { - ShowWarningError(state, format("Processing Monthly Tabular Reports: {}", ort->MonthlyInput(TabNum).name)); - ShowContinueError(state, format("..Variable name={} not valid for this simulation.", curVariMeter)); + if (issueWarnings && !ort->MonthlyInput(TabNum).isNamedMonthly) { + ShowWarningError( + state, + format("In Output:Table:Monthly '{}' invalid Variable or Meter Name '{}'", ort->MonthlyInput(TabNum).name, curVariMeter)); ShowContinueError( state, format("..i.e., Variable name={}:{} not valid for this simulation.", UniqueKeyNames(kUniqueKey), curVariMeter)); - if (state.dataOutRptTab->VarWarning) { - ShowContinueError(state, - "..Variables not valid for this simulation will have \"[Invalid/Undefined]\" in the Units Column " - "of the Table Report."); - state.dataOutRptTab->VarWarning = false; - } } ort->MonthlyColumns(mColumn).varName = curVariMeter; ort->MonthlyColumns(mColumn).varNum = 0; diff --git a/src/EnergyPlus/OutputReportTabular.hh b/src/EnergyPlus/OutputReportTabular.hh index b0287813f88..305ed6b1c43 100644 --- a/src/EnergyPlus/OutputReportTabular.hh +++ b/src/EnergyPlus/OutputReportTabular.hh @@ -1240,7 +1240,6 @@ struct OutputReportTabularData : BaseGlobalStruct int numPeopleAdaptive = 0; Real64 BigNum = 0.0; - bool VarWarning = true; int ErrCount1 = 0; Array1D MonthlyColumnsTypeOfVar; Array1D MonthlyColumnsStepType; @@ -1541,7 +1540,6 @@ struct OutputReportTabularData : BaseGlobalStruct this->numPeopleAdaptive = 0; this->BigNum = 0.0; - this->VarWarning = true; this->ErrCount1 = 0; this->MonthlyColumnsTypeOfVar.clear(); this->MonthlyColumnsStepType.clear(); From 85b5f09f1bcf1d4834e16929672da8170f8ffc73 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 8 Sep 2023 14:51:12 +0200 Subject: [PATCH 65/80] Clang format change that snuck in --- tst/EnergyPlus/unit/OutputReportTabular.unit.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc index 415d8a5e86f..de13324b99a 100644 --- a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc +++ b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc @@ -7183,7 +7183,10 @@ TEST_F(SQLiteFixture, OutputReportTabular_WriteLoadComponentSummaryTables_AirLoo state->dataSize->SysSizInput.allocate(state->dataSize->NumSysSizInput); state->dataSize->SysSizInput(1).AirLoopNum = 1; state->dataSize->SysSizInput(1).SizingOption = DataSizing::NonCoincident; - auto degC_to_F = [](Real64 celsius) constexpr { return celsius * (9.0 / 5.0) + 32.0; }; + auto degC_to_F = [](Real64 celsius) constexpr + { + return celsius * (9.0 / 5.0) + 32.0; + }; constexpr Real64 coolMixTempSys = 26.2; constexpr Real64 coolMixTempSysIP = degC_to_F(coolMixTempSys); constexpr Real64 heatMixTempSys = -1.7; From c39acfff7d73f67b9c693d2461cc68e6bd2e0769 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 8 Sep 2023 14:59:46 +0200 Subject: [PATCH 66/80] Fix failing test --- tst/EnergyPlus/unit/OutputReportTabular.unit.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc index de13324b99a..0eca5a46938 100644 --- a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc +++ b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc @@ -12822,11 +12822,15 @@ TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_NoWarnMonthlIfNoWeatherFile GetInputTabularMonthly(*state); EXPECT_EQ(state->dataOutRptTab->MonthlyInputCount, 1); GetInputOutputTableSummaryReports(*state); - EXPECT_EQ(state->dataOutRptTab->MonthlyInputCount, numNamedMonthly + 1); + EXPECT_EQ(state->dataOutRptTab->MonthlyInputCount, numNamedMonthly); InitializeTabularMonthly(*state); - compare_err_stream(""); + std::string const expected_error = delimited_string({ + " ** Warning ** Output:Table:Monthly requested with SimulationControl Run Simulation for Weather File Run Periods set to No so " + "Output:Table:Monthly will not be generated", + }); + compare_err_stream(expected_error); } TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_DontWarnMonthlyIfOnlyNamedReports) From 73042a7e1a839a512200d01fbfedaa5f9b429f74 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 8 Sep 2023 16:34:21 +0200 Subject: [PATCH 67/80] Remove useless comment --- src/EnergyPlus/OutputReportTabular.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index 397421cec84..a35e869d8cb 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -723,7 +723,6 @@ void InitializeTabularMonthly(EnergyPlusData &state) ort->MonthlyColumns(colNum).duration = 0.0; } - // std::count_if(ort->MonthlyInput.begin(), ort->MonthlyInputCount.end(), [](auto& monthlyInput) // If no weather file run requested, don't bother issuing a warning bool issueWarnings = false; if (state.dataGlobal->DoWeathSim && (state.dataOutRptTab->ErrCount1 > 0)) { From d8f3b60feb52781447b72caf7b1997d8cd7eea60 Mon Sep 17 00:00:00 2001 From: Scott Horowitz Date: Fri, 8 Sep 2023 10:22:29 -0600 Subject: [PATCH 68/80] Fix the Heat Pump Water Heater Information table. --- src/EnergyPlus/WaterThermalTanks.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EnergyPlus/WaterThermalTanks.cc b/src/EnergyPlus/WaterThermalTanks.cc index 280096598b5..3975079617f 100644 --- a/src/EnergyPlus/WaterThermalTanks.cc +++ b/src/EnergyPlus/WaterThermalTanks.cc @@ -4183,7 +4183,7 @@ bool GetWaterThermalTankInput(EnergyPlusData &state) "Standard Rated Energy Factor\n"); static constexpr std::string_view Format_721( "! ,Type,Name,Volume {{m3}},Maximum Capacity {{W}},Standard Rated Recovery " - "Efficiency,Standard Rated Energy Factor,\"DX Coil Total Cooling Rate {{W, HPWH Only}}\"\n"); + "Efficiency,Standard Rated Energy Factor,DX Coil Total Cooling Rate (HPWH Only) {{W}}\n"); static constexpr std::string_view Format_722( "! ,Node Number,Height {{m}},Volume {{m3}},Maximum Capacity " "{{W}},Off-Cycle UA {{W/K}},On-Cycle UA {{W/K}},Number Of Inlets,Number Of Outlets\n"); From 8bcedec9eaf267cb711946227231a8c309c8e81b Mon Sep 17 00:00:00 2001 From: Scott Horowitz Date: Fri, 8 Sep 2023 11:30:14 -0600 Subject: [PATCH 69/80] Suggestion by @mjwitte --- src/EnergyPlus/WaterThermalTanks.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EnergyPlus/WaterThermalTanks.cc b/src/EnergyPlus/WaterThermalTanks.cc index 3975079617f..eff7ac77136 100644 --- a/src/EnergyPlus/WaterThermalTanks.cc +++ b/src/EnergyPlus/WaterThermalTanks.cc @@ -4183,7 +4183,7 @@ bool GetWaterThermalTankInput(EnergyPlusData &state) "Standard Rated Energy Factor\n"); static constexpr std::string_view Format_721( "! ,Type,Name,Volume {{m3}},Maximum Capacity {{W}},Standard Rated Recovery " - "Efficiency,Standard Rated Energy Factor,DX Coil Total Cooling Rate (HPWH Only) {{W}}\n"); + "Efficiency,Standard Rated Energy Factor,DX Coil Total Cooling Rate {{W}}\n"); static constexpr std::string_view Format_722( "! ,Node Number,Height {{m}},Volume {{m3}},Maximum Capacity " "{{W}},Off-Cycle UA {{W/K}},On-Cycle UA {{W/K}},Number Of Inlets,Number Of Outlets\n"); From c7c193225b4dc9c5a3ea9d34c1255059f3dfb56c Mon Sep 17 00:00:00 2001 From: Scott Horowitz Date: Fri, 8 Sep 2023 13:41:10 -0600 Subject: [PATCH 70/80] Update OutputChanges23-1-0-to-23-2-0.md [decent_ci_skip] --- .../OutputRulesFiles/OutputChanges23-1-0-to-23-2-0.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Transition/OutputRulesFiles/OutputChanges23-1-0-to-23-2-0.md b/src/Transition/OutputRulesFiles/OutputChanges23-1-0-to-23-2-0.md index 5b5c657723f..f68085a80b4 100644 --- a/src/Transition/OutputRulesFiles/OutputChanges23-1-0-to-23-2-0.md +++ b/src/Transition/OutputRulesFiles/OutputChanges23-1-0-to-23-2-0.md @@ -8,7 +8,7 @@ This file documents the structural changes on the output of EnergyPlus that coul This will eventually become a more structured file, but currently it isn't clear what format is best. As an intermediate solution, and to allow the form to be formed organically, this plain text file is being used. Entries should be clearly delimited. It isn't expected that there will be but maybe a couple each release at most. Entries should also include some reference back to the repo. At least a PR number or whatever. ### EIO System Sizing Information User Design Capacity header -Missing unit is added to the EIO ystem Sizing Information table "User Design Capacity" header as shown below: +Missing unit is added to the EIO System Sizing Information table "User Design Capacity" header as shown below: - , System Name, Load Type, Peak Load Kind, User Design Capacity [W], Calc Des Air Flow Rate [m3/s], User Des Air Flow Rate [m3/s], Design Day Name, Date/Time of Peak - This change also impacts the html tabular output report file: report name "Initialization Summary" and table name "System Sizing Information". @@ -22,7 +22,7 @@ Since each EnergyPlus IDF file could generate an RMD file, the Ruleset Checking #### Adding reporting entries to existing tabular reports -New variables related to Std 229 are appendeded to the right of the following existing tables: +New variables related to Std 229 are appended to the right of the following existing tables: - Equipment Summary - Heating Coils - Equipment Summary - DX Heating Coils @@ -69,3 +69,9 @@ See pull request [#9982](https://github.com/NREL/EnergyPlus/pull/9982) for more (d) "Steam" to "DistrictHeatingSteam" See [9260](https://github.com/NREL/EnergyPlus/pull/9260) + +### Heat Pump Water Heater Information table + +Columns `"DX Coil Total Cooling Rate {W` and `HPWH Only}"` have been merged into a single `DX Coil Total Cooling Rate {W}`. + + See [10214](https://github.com/NREL/EnergyPlus/pull/10214) \ No newline at end of file From 993bf85e458f42535d2476c738c91300ce420aae Mon Sep 17 00:00:00 2001 From: Scott Horowitz Date: Fri, 8 Sep 2023 13:44:34 -0600 Subject: [PATCH 71/80] Update OutputChanges23-1-0-to-23-2-0.md [decent_ci_skip] --- .../OutputRulesFiles/OutputChanges23-1-0-to-23-2-0.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Transition/OutputRulesFiles/OutputChanges23-1-0-to-23-2-0.md b/src/Transition/OutputRulesFiles/OutputChanges23-1-0-to-23-2-0.md index 5b5c657723f..16e43491296 100644 --- a/src/Transition/OutputRulesFiles/OutputChanges23-1-0-to-23-2-0.md +++ b/src/Transition/OutputRulesFiles/OutputChanges23-1-0-to-23-2-0.md @@ -69,3 +69,9 @@ See pull request [#9982](https://github.com/NREL/EnergyPlus/pull/9982) for more (d) "Steam" to "DistrictHeatingSteam" See [9260](https://github.com/NREL/EnergyPlus/pull/9260) + +### WaterHeaterReportMonthly report + +Column "Water Heater Source Energy []" renamed to "Water Heater Source Side Heat Transfer Energy [J]". + +See [10209](https://github.com/NREL/EnergyPlus/pull/10209) From 6402d8c504b8cea3964052ecee8ea9fa78d01251 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Mon, 17 Jul 2023 15:11:07 +0200 Subject: [PATCH 72/80] Test for 9873 --- tst/EnergyPlus/unit/SurfaceGeometry.unit.cc | 116 ++++++++++++++++++++ 1 file changed, 116 insertions(+) diff --git a/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc b/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc index a899b87fd84..5990ff376dd 100644 --- a/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc +++ b/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc @@ -10265,6 +10265,122 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_GetVerticesDropDuplicates) EXPECT_NEAR(11.80, sf_temps(2).Perimeter, 0.02); } +TEST_F(EnergyPlusFixture, SurfaceGeometry_GetVerticesDropDuplicates_Tiny) +{ + // Test for #9873 + std::string const idf_objects = delimited_string({ + + "BuildingSurface:Detailed,", + " Zn001:Ceiling002, !- Name", + " Ceiling, !- Surface Type", + " FLOOR, !- Construction Name", + " ZONE 1, !- Zone Name", + " , !- Space Name", + " Surface, !- Outside Boundary Condition", + " Zn002:Flr002, !- Outside Boundary Condition Object", + " NoSun, !- Sun Exposure", + " NoWind, !- Wind Exposure", + " , !- View Factor to Ground", + " , !- Number of Vertices", + " -41.27, -37.05, 0.00, !- X,Y,Z ==> Vertex 1 {m}", + " -41.27, -37.04, 0.00, !- X,Y,Z ==> Vertex 2 {m}", + " -41.25, -37.04, 0.00, !- X,Y,Z ==> Vertex 3 {m}", + " -41.25, -33.59, 0.00, !- X,Y,Z ==> Vertex 4 {m}", + " -41.28, -33.59, 0.00, !- X,Y,Z ==> Vertex 5 {m}", + " -41.28, -37.05, 0.00; !- X,Y,Z ==> Vertex 6 {m}", + + "BuildingSurface:Detailed,", + " Zn002:Flr002, !- Name", + " Floor, !- Surface Type", + " FLOOR, !- Construction Name", + " ZONE 2, !- Zone Name", + " , !- Space Name", + " Surface, !- Outside Boundary Condition", + " Zn001:Ceiling002, !- Outside Boundary Condition Object", + " NoSun, !- Sun Exposure", + " NoWind, !- Wind Exposure", + " , !- View Factor to Ground", + " , !- Number of Vertices", + " -41.28, -37.05, 0.00, !- X,Y,Z ==> Vertex 1 {m}", + " -41.28, -33.59, 0.00, !- X,Y,Z ==> Vertex 2 {m}", + " -41.25, -33.59, 0.00, !- X,Y,Z ==> Vertex 3 {m}", + " -41.25, -37.04, 0.00, !- X,Y,Z ==> Vertex 4 {m}", + " -41.27, -37.04, 0.00, !- X,Y,Z ==> Vertex 5 {m}", + " -41.27, -37.05, 0.00; !- X,Y,Z ==> Vertex 6 {m}", + + }); + + ASSERT_TRUE(process_idf(idf_objects)); + + state->dataGlobal->NumOfZones = 2; + state->dataHeatBal->Zone.allocate(2); + state->dataHeatBal->Zone(1).Name = "ZONE 1"; + state->dataHeatBal->Zone(2).Name = "ZONE 2"; + state->dataSurfaceGeometry->SurfaceTmp.allocate(2); + int SurfNum = 0; + int TotHTSurfs = 2; + Array1D_string const BaseSurfCls(3, {"WALL", "FLOOR", "ROOF"}); + Array1D const BaseSurfIDs( + 3, {DataSurfaces::SurfaceClass::Wall, DataSurfaces::SurfaceClass::Floor, DataSurfaces::SurfaceClass::Roof}); + int NeedToAddSurfaces; + + bool ErrorsFound(false); + GetGeometryParameters(*state, ErrorsFound); + EXPECT_FALSE(ErrorsFound); + + state->dataSurfaceGeometry->CosZoneRelNorth.allocate(2); + state->dataSurfaceGeometry->SinZoneRelNorth.allocate(2); + + state->dataSurfaceGeometry->CosZoneRelNorth = 1.0; + state->dataSurfaceGeometry->SinZoneRelNorth = 0.0; + state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; + state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; + + state->dataHeatBal->TotConstructs = 1; + state->dataConstruction->Construct.allocate(1); + state->dataConstruction->Construct(1).Name = "FLOOR"; + + state->dataGlobal->DisplayExtraWarnings = true; + + GetHTSurfaceData(*state, ErrorsFound, SurfNum, TotHTSurfs, 0, 0, 0, BaseSurfCls, BaseSurfIDs, NeedToAddSurfaces); + EXPECT_FALSE(ErrorsFound); + + EXPECT_EQ(2, SurfNum); + auto const error_string = delimited_string({ + " ** Warning ** GetVertices: Distance between two vertices < .01, possibly coincident. for Surface=ZN001:CEILING002, in Zone=ZONE 1", + " ** ~~~ ** Vertex [5]=(54.37,-28.88,0.00)", + " ** ~~~ ** Vertex [6]=(54.37,-28.89,0.00)", + " ** ~~~ ** Dropping Vertex [6].", + " ** Warning ** GetVertices: Distance between two vertices < .01, possibly coincident. for Surface=ZN001:CEILING002, in Zone=ZONE 1", + " ** ~~~ ** Vertex [5]=(54.37,-28.88,0.00)", + " ** ~~~ ** Vertex [1]=(54.38,-28.89,0.00)", + " ** ~~~ ** Dropping Vertex [1].", + " ** Warning ** GetVertices: Distance between two vertices < .01, possibly coincident. for Surface=ZN002:FLR002, in Zone=ZONE 2", + " ** ~~~ ** Vertex [1]=(54.37,-28.89,0.00)", + " ** ~~~ ** Vertex [2]=(54.37,-28.88,0.00)", + " ** ~~~ ** Dropping Vertex [2].", + " ** Warning ** GetVertices: Distance between two vertices < .01, possibly coincident. for Surface=ZN002:FLR002, in Zone=ZONE 2", + " ** ~~~ ** Vertex [5]=(54.38,-28.89,0.00)", + " ** ~~~ ** Vertex [1]=(54.37,-28.89,0.00)", + " ** ~~~ ** Dropping Vertex [1].", + }); + EXPECT_TRUE(compare_err_stream(error_string, true)); + + const auto &sf_temps = state->dataSurfaceGeometry->SurfaceTmp; + EXPECT_EQ(2, sf_temps.size()); + EXPECT_EQ("ZN001:CEILING002", sf_temps(1).Name); + EXPECT_EQ("ZN002:FLR002", sf_temps(2).Name); + + EXPECT_EQ(4, sf_temps(1).Sides); + EXPECT_EQ(4, sf_temps(1).Vertex.size()); + + EXPECT_EQ(4, sf_temps(2).Sides); + EXPECT_EQ(4, sf_temps(2).Vertex.size()); + + EXPECT_NEAR(11.80, sf_temps(1).Perimeter, 0.02); + EXPECT_NEAR(11.80, sf_temps(2).Perimeter, 0.02); +} + TEST_F(EnergyPlusFixture, Wrong_Window_Construction) { // Test for #9331 - Crash in debug when wrong construction name is used for a Window From a7735422824a13746e4a58c2e9c969272dbae12a Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Mon, 17 Jul 2023 15:11:20 +0200 Subject: [PATCH 73/80] parametrize the test --- tst/EnergyPlus/unit/SurfaceGeometry.unit.cc | 113 +++++++++++--------- 1 file changed, 64 insertions(+), 49 deletions(-) diff --git a/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc b/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc index 5990ff376dd..88a164f1591 100644 --- a/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc +++ b/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc @@ -10268,48 +10268,63 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_GetVerticesDropDuplicates) TEST_F(EnergyPlusFixture, SurfaceGeometry_GetVerticesDropDuplicates_Tiny) { // Test for #9873 - std::string const idf_objects = delimited_string({ - - "BuildingSurface:Detailed,", - " Zn001:Ceiling002, !- Name", - " Ceiling, !- Surface Type", - " FLOOR, !- Construction Name", - " ZONE 1, !- Zone Name", - " , !- Space Name", - " Surface, !- Outside Boundary Condition", - " Zn002:Flr002, !- Outside Boundary Condition Object", - " NoSun, !- Sun Exposure", - " NoWind, !- Wind Exposure", - " , !- View Factor to Ground", - " , !- Number of Vertices", - " -41.27, -37.05, 0.00, !- X,Y,Z ==> Vertex 1 {m}", - " -41.27, -37.04, 0.00, !- X,Y,Z ==> Vertex 2 {m}", - " -41.25, -37.04, 0.00, !- X,Y,Z ==> Vertex 3 {m}", - " -41.25, -33.59, 0.00, !- X,Y,Z ==> Vertex 4 {m}", - " -41.28, -33.59, 0.00, !- X,Y,Z ==> Vertex 5 {m}", - " -41.28, -37.05, 0.00; !- X,Y,Z ==> Vertex 6 {m}", - - "BuildingSurface:Detailed,", - " Zn002:Flr002, !- Name", - " Floor, !- Surface Type", - " FLOOR, !- Construction Name", - " ZONE 2, !- Zone Name", - " , !- Space Name", - " Surface, !- Outside Boundary Condition", - " Zn001:Ceiling002, !- Outside Boundary Condition Object", - " NoSun, !- Sun Exposure", - " NoWind, !- Wind Exposure", - " , !- View Factor to Ground", - " , !- Number of Vertices", - " -41.28, -37.05, 0.00, !- X,Y,Z ==> Vertex 1 {m}", - " -41.28, -33.59, 0.00, !- X,Y,Z ==> Vertex 2 {m}", - " -41.25, -33.59, 0.00, !- X,Y,Z ==> Vertex 3 {m}", - " -41.25, -37.04, 0.00, !- X,Y,Z ==> Vertex 4 {m}", - " -41.27, -37.04, 0.00, !- X,Y,Z ==> Vertex 5 {m}", - " -41.27, -37.05, 0.00; !- X,Y,Z ==> Vertex 6 {m}", - - }); + constexpr double offset = 0.01; + + constexpr double min_x = -41.28; + constexpr double max_x = min_x + 0.03; + constexpr double off_x = min_x + offset; + + constexpr double min_y = -37.05; + constexpr double max_y = min_y + 0.09; + constexpr double off_y = min_y + offset; + + std::string const idf_objects = fmt::format(R"idf( + BuildingSurface:Detailed, + Zn001:Ceiling002, !- Name + Ceiling, !- Surface Type + FLOOR, !- Construction Name + ZONE 1, !- Zone Name + , !- Space Name + Surface, !- Outside Boundary Condition + Zn002:Flr002, !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + , !- View Factor to Ground + , !- Number of Vertices + {off_x:.2f}, {min_y:.2f}, 0.00, !- X,Y,Z ==> Vertex 1 + {off_x:.2f}, {off_y:.2f}, 0.00, !- X,Y,Z ==> Vertex 2 + {max_x:.2f}, {off_y:.2f}, 0.00, !- X,Y,Z ==> Vertex 3 + {max_x:.2f}, {max_y:.2f}, 0.00, !- X,Y,Z ==> Vertex 4 + {min_x:.2f}, {max_y:.2f}, 0.00, !- X,Y,Z ==> Vertex 5 + {min_x:.2f}, {min_y:.2f}, 0.00; !- X,Y,Z ==> Vertex 6 + + BuildingSurface:Detailed, + Zn002:Flr002, !- Name + Floor, !- Surface Type + FLOOR, !- Construction Name + ZONE 2, !- Zone Name + , !- Space Name + Surface, !- Outside Boundary Condition + Zn001:Ceiling002, !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + , !- View Factor to Ground + , !- Number of Vertices + {min_x:.2f}, {min_y:.2f}, 0.00, !- X,Y,Z ==> Vertex 1 + {min_x:.2f}, {max_y:.2f}, 0.00, !- X,Y,Z ==> Vertex 2 + {max_x:.2f}, {max_y:.2f}, 0.00, !- X,Y,Z ==> Vertex 3 + {max_x:.2f}, {off_y:.2f}, 0.00, !- X,Y,Z ==> Vertex 4 + {off_x:.2f}, {off_y:.2f}, 0.00, !- X,Y,Z ==> Vertex 5 + {off_x:.2f}, {min_y:.2f}, 0.00; !- X,Y,Z ==> Vertex 6 + + )idf", + fmt::arg("min_x", min_x), + fmt::arg("max_x", max_x), + fmt::arg("off_x", off_x), + fmt::arg("min_y", min_y), + fmt::arg("max_y", max_y), + fmt::arg("off_y", off_y)); ASSERT_TRUE(process_idf(idf_objects)); state->dataGlobal->NumOfZones = 2; @@ -10348,17 +10363,17 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_GetVerticesDropDuplicates_Tiny) EXPECT_EQ(2, SurfNum); auto const error_string = delimited_string({ " ** Warning ** GetVertices: Distance between two vertices < .01, possibly coincident. for Surface=ZN001:CEILING002, in Zone=ZONE 1", - " ** ~~~ ** Vertex [5]=(54.37,-28.88,0.00)", - " ** ~~~ ** Vertex [6]=(54.37,-28.89,0.00)", - " ** ~~~ ** Dropping Vertex [6].", + fmt::format(" ** ~~~ ** Vertex [1]=({:.2f},{:.2f},0.00)", off_x, min_y), + fmt::format(" ** ~~~ ** Vertex [2]=({:.2f},{:.2f},0.00)", off_x, off_y), + " ** ~~~ ** Dropping Vertex [2].", " ** Warning ** GetVertices: Distance between two vertices < .01, possibly coincident. for Surface=ZN001:CEILING002, in Zone=ZONE 1", - " ** ~~~ ** Vertex [5]=(54.37,-28.88,0.00)", - " ** ~~~ ** Vertex [1]=(54.38,-28.89,0.00)", + fmt::format(" ** ~~~ ** Vertex [5]=({:.2f},{:.2f},0.00)", min_x, min_y), + fmt::format(" ** ~~~ ** Vertex [1]=({:.2f},{:.2f},0.00)", off_x, min_y), " ** ~~~ ** Dropping Vertex [1].", " ** Warning ** GetVertices: Distance between two vertices < .01, possibly coincident. for Surface=ZN002:FLR002, in Zone=ZONE 2", - " ** ~~~ ** Vertex [1]=(54.37,-28.89,0.00)", - " ** ~~~ ** Vertex [2]=(54.37,-28.88,0.00)", - " ** ~~~ ** Dropping Vertex [2].", + fmt::format(" ** ~~~ ** Vertex [5]=({:.2f},{:.2f},0.00)", off_x, off_y), + fmt::format(" ** ~~~ ** Vertex [6]=({:.2f},{:.2f},0.00)", off_x, min_y), + " ** ~~~ ** Dropping Vertex [6].", " ** Warning ** GetVertices: Distance between two vertices < .01, possibly coincident. for Surface=ZN002:FLR002, in Zone=ZONE 2", " ** ~~~ ** Vertex [5]=(54.38,-28.89,0.00)", " ** ~~~ ** Vertex [1]=(54.37,-28.89,0.00)", From ee42e0ef0ea93ffcdb2d81f24cef562a40de6bec Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Tue, 18 Jul 2023 11:50:42 +0200 Subject: [PATCH 74/80] Finish the test with the wanted behavior --- tst/EnergyPlus/unit/SurfaceGeometry.unit.cc | 87 +++++++++++---------- 1 file changed, 46 insertions(+), 41 deletions(-) diff --git a/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc b/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc index 88a164f1591..793e5beca9d 100644 --- a/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc +++ b/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc @@ -10267,7 +10267,19 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_GetVerticesDropDuplicates) TEST_F(EnergyPlusFixture, SurfaceGeometry_GetVerticesDropDuplicates_Tiny) { - // Test for #9873 + // Test for #9873 - We expect the point marked "x" to be popped + // ▲ ▲ + // │ │ + // 2 o────────o 3 5 o────────o 4 + // │ │ │ │ + // ┤ │ │ │ + // │ Floor │ │Ceiling │ + // ┤ │ │ │ + // │ 5 │ │ 2 │ + // ┤ o─────o 4 │ o─────o 3 + // │ │ │ │ + // o──x──┬──┬───► o──x─────────► + // 1 6 x 6 1 constexpr double offset = 0.01; @@ -10276,29 +10288,12 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_GetVerticesDropDuplicates_Tiny) constexpr double off_x = min_x + offset; constexpr double min_y = -37.05; - constexpr double max_y = min_y + 0.09; + constexpr double max_y = min_y + 0.04; constexpr double off_y = min_y + offset; - std::string const idf_objects = fmt::format(R"idf( - BuildingSurface:Detailed, - Zn001:Ceiling002, !- Name - Ceiling, !- Surface Type - FLOOR, !- Construction Name - ZONE 1, !- Zone Name - , !- Space Name - Surface, !- Outside Boundary Condition - Zn002:Flr002, !- Outside Boundary Condition Object - NoSun, !- Sun Exposure - NoWind, !- Wind Exposure - , !- View Factor to Ground - , !- Number of Vertices - {off_x:.2f}, {min_y:.2f}, 0.00, !- X,Y,Z ==> Vertex 1 - {off_x:.2f}, {off_y:.2f}, 0.00, !- X,Y,Z ==> Vertex 2 - {max_x:.2f}, {off_y:.2f}, 0.00, !- X,Y,Z ==> Vertex 3 - {max_x:.2f}, {max_y:.2f}, 0.00, !- X,Y,Z ==> Vertex 4 - {min_x:.2f}, {max_y:.2f}, 0.00, !- X,Y,Z ==> Vertex 5 - {min_x:.2f}, {min_y:.2f}, 0.00; !- X,Y,Z ==> Vertex 6 + constexpr double perimeter = 2 * ((max_x - min_x) + (max_y - min_y)); + std::string const idf_objects = fmt::format(R"idf( BuildingSurface:Detailed, Zn002:Flr002, !- Name Floor, !- Surface Type @@ -10318,6 +10313,24 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_GetVerticesDropDuplicates_Tiny) {off_x:.2f}, {off_y:.2f}, 0.00, !- X,Y,Z ==> Vertex 5 {off_x:.2f}, {min_y:.2f}, 0.00; !- X,Y,Z ==> Vertex 6 + BuildingSurface:Detailed, + Zn001:Ceiling002, !- Name + Ceiling, !- Surface Type + FLOOR, !- Construction Name + ZONE 1, !- Zone Name + , !- Space Name + Surface, !- Outside Boundary Condition + Zn002:Flr002, !- Outside Boundary Condition Object + NoSun, !- Sun Exposure + NoWind, !- Wind Exposure + , !- View Factor to Ground + , !- Number of Vertices + {off_x:.2f}, {min_y:.2f}, 0.00, !- X,Y,Z ==> Vertex 1 + {off_x:.2f}, {off_y:.2f}, 0.00, !- X,Y,Z ==> Vertex 2 + {max_x:.2f}, {off_y:.2f}, 0.00, !- X,Y,Z ==> Vertex 3 + {max_x:.2f}, {max_y:.2f}, 0.00, !- X,Y,Z ==> Vertex 4 + {min_x:.2f}, {max_y:.2f}, 0.00, !- X,Y,Z ==> Vertex 5 + {min_x:.2f}, {min_y:.2f}, 0.00; !- X,Y,Z ==> Vertex 6 )idf", fmt::arg("min_x", min_x), fmt::arg("max_x", max_x), @@ -10362,38 +10375,30 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_GetVerticesDropDuplicates_Tiny) EXPECT_EQ(2, SurfNum); auto const error_string = delimited_string({ - " ** Warning ** GetVertices: Distance between two vertices < .01, possibly coincident. for Surface=ZN001:CEILING002, in Zone=ZONE 1", - fmt::format(" ** ~~~ ** Vertex [1]=({:.2f},{:.2f},0.00)", off_x, min_y), - fmt::format(" ** ~~~ ** Vertex [2]=({:.2f},{:.2f},0.00)", off_x, off_y), - " ** ~~~ ** Dropping Vertex [2].", - " ** Warning ** GetVertices: Distance between two vertices < .01, possibly coincident. for Surface=ZN001:CEILING002, in Zone=ZONE 1", - fmt::format(" ** ~~~ ** Vertex [5]=({:.2f},{:.2f},0.00)", min_x, min_y), - fmt::format(" ** ~~~ ** Vertex [1]=({:.2f},{:.2f},0.00)", off_x, min_y), - " ** ~~~ ** Dropping Vertex [1].", " ** Warning ** GetVertices: Distance between two vertices < .01, possibly coincident. for Surface=ZN002:FLR002, in Zone=ZONE 2", - fmt::format(" ** ~~~ ** Vertex [5]=({:.2f},{:.2f},0.00)", off_x, off_y), fmt::format(" ** ~~~ ** Vertex [6]=({:.2f},{:.2f},0.00)", off_x, min_y), + fmt::format(" ** ~~~ ** Vertex [1]=({:.2f},{:.2f},0.00)", min_x, min_y), " ** ~~~ ** Dropping Vertex [6].", - " ** Warning ** GetVertices: Distance between two vertices < .01, possibly coincident. for Surface=ZN002:FLR002, in Zone=ZONE 2", - " ** ~~~ ** Vertex [5]=(54.38,-28.89,0.00)", - " ** ~~~ ** Vertex [1]=(54.37,-28.89,0.00)", + " ** Warning ** GetVertices: Distance between two vertices < .01, possibly coincident. for Surface=ZN001:CEILING002, in Zone=ZONE 1", + fmt::format(" ** ~~~ ** Vertex [1]=({:.2f},{:.2f},0.00)", off_x, min_y), + fmt::format(" ** ~~~ ** Vertex [2]=({:.2f},{:.2f},0.00)", off_x, off_y), " ** ~~~ ** Dropping Vertex [1].", }); EXPECT_TRUE(compare_err_stream(error_string, true)); const auto &sf_temps = state->dataSurfaceGeometry->SurfaceTmp; EXPECT_EQ(2, sf_temps.size()); - EXPECT_EQ("ZN001:CEILING002", sf_temps(1).Name); - EXPECT_EQ("ZN002:FLR002", sf_temps(2).Name); + EXPECT_EQ("ZN002:FLR002", sf_temps(1).Name); + EXPECT_EQ("ZN001:CEILING002", sf_temps(2).Name); - EXPECT_EQ(4, sf_temps(1).Sides); - EXPECT_EQ(4, sf_temps(1).Vertex.size()); + EXPECT_EQ(5, sf_temps(1).Sides); + EXPECT_EQ(5, sf_temps(1).Vertex.size()); - EXPECT_EQ(4, sf_temps(2).Sides); - EXPECT_EQ(4, sf_temps(2).Vertex.size()); + EXPECT_EQ(5, sf_temps(2).Sides); + EXPECT_EQ(5, sf_temps(2).Vertex.size()); - EXPECT_NEAR(11.80, sf_temps(1).Perimeter, 0.02); - EXPECT_NEAR(11.80, sf_temps(2).Perimeter, 0.02); + EXPECT_NEAR(perimeter, sf_temps(1).Perimeter, 0.02); + EXPECT_NEAR(perimeter, sf_temps(2).Perimeter, 0.02); } TEST_F(EnergyPlusFixture, Wrong_Window_Construction) From 3bc9b3db5afec360197b3c8b81129f97d6337b1d Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Tue, 18 Jul 2023 11:53:19 +0200 Subject: [PATCH 75/80] Fix #9873 - Always pop the worst coincident vertex, not the first one found. * We calculate the distance between the vertex and the next one (distanceThisToNext), as well as its previous one (distanceThisToPrev). * We find the vertex for which: * at least one of these two distances is less than the tolerance, and, * that minimizes the sum of distanceThisToPrev + distanceThisToNext --- src/EnergyPlus/SurfaceGeometry.cc | 147 +++++++++++++++++++++--------- 1 file changed, 103 insertions(+), 44 deletions(-) diff --git a/src/EnergyPlus/SurfaceGeometry.cc b/src/EnergyPlus/SurfaceGeometry.cc index f67572ba9b2..13417c77da7 100644 --- a/src/EnergyPlus/SurfaceGeometry.cc +++ b/src/EnergyPlus/SurfaceGeometry.cc @@ -9308,6 +9308,65 @@ namespace SurfaceGeometry { } } + struct PopCoincidentVertexReturn + { + // bool popNeeded; + double perimeter; + int poppedVertexPos = -1; // This is a STL vector position, 0-indexed + int keptVertexPos = -1; + }; + + PopCoincidentVertexReturn checkPopCoincidentVertex(const Array1D &vertices) + { + constexpr double tolerance = 0.01; + + size_t const nSides = vertices.size(); + + // Vector of distance from this vertex to the next one + std::vector distances(nSides); + size_t index = 0; + double min_distance = std::numeric_limits::max(); + double perimeter = 0.0; + for (auto it = vertices.begin(); it != vertices.end(); ++it) { + auto itnext = std::next(it); + if (itnext == std::end(vertices)) { + itnext = std::begin(vertices); + } + const auto dist = distance(*it, *itnext); + distances[index++] = dist; + min_distance = std::min(min_distance, dist); + perimeter += dist; + } + if (min_distance >= tolerance) { + return {perimeter}; + } + + Real64 min_weight = std::numeric_limits::max(); + int poppedVertexPos = -1; + int keptVertexPos = -1; + + for (size_t index = 0; index < nSides; ++index) { + size_t const prevIndex = (index == 0) ? nSides - 1 : index - 1; + Real64 &distanceThisToNext = distances[index]; + Real64 &distanceThisToPrev = distances[prevIndex]; + if ((distanceThisToNext >= tolerance) && (distanceThisToPrev >= tolerance)) { + continue; + } + Real64 const weight = distanceThisToNext + distanceThisToPrev; + if (weight < min_weight) { + min_weight = weight; + poppedVertexPos = static_cast(index); + if (distanceThisToPrev < distanceThisToNext) { + keptVertexPos = prevIndex; + } else { + keptVertexPos = static_cast((index == nSides - 1) ? 0 : index + 1); + } + } + } + + return {perimeter, poppedVertexPos, keptVertexPos}; + } + void GetVertices(EnergyPlusData &state, int const SurfNum, // Current surface number int const NSides, // Number of sides to figure @@ -9365,7 +9424,6 @@ namespace SurfaceGeometry { std::string TiltString; Real64 ThisWidth; Real64 ThisHeight; - Real64 DistanceCheck; // unused REAL(r64) :: ccwtest // unused LOGICAL :: SurfaceCCW Real64 dotp; @@ -9483,54 +9541,55 @@ namespace SurfaceGeometry { auto &vertices = surface.Vertex; auto &nSides = surface.Sides; - bool poppedVertex = true; - while (poppedVertex) { - poppedVertex = false; - Perimeter = 0.0; + while (true) { + PopCoincidentVertexReturn const popResult = checkPopCoincidentVertex(vertices); + Perimeter = popResult.perimeter; + if (popResult.poppedVertexPos < 0) { + // No pop needed, we're done + break; + } - for (auto it = vertices.begin(); it != vertices.end(); ++it) { - auto itnext = std::next(it); - if (itnext == std::end(vertices)) { - itnext = std::begin(vertices); - } + auto it = vertices.begin(); + std::advance(it, popResult.poppedVertexPos); + int const poppedVertexIndex = popResult.poppedVertexPos + 1; - // TODO: use isAlmostEqual3Pt for consistency? (which uses 0.0127 m / 1/2inch instead of 0.01 m) - DistanceCheck = distance(*it, *itnext); - if (DistanceCheck < 0.01) { - int curVertexIndex = std::distance(vertices.begin(), it) + 1; - int nextVertexIndex = std::distance(vertices.begin(), itnext) + 1; - if (state.dataGlobal->DisplayExtraWarnings) { - ShowWarningError(state, - format("{}Distance between two vertices < .01, possibly coincident. for Surface={}, in Zone={}", - RoutineName, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, - state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName)); - ShowContinueError(state, format("Vertex [{}]=({:.2R},{:.2R},{:.2R})", curVertexIndex, it->x, it->y, it->z)); - ShowContinueError(state, format("Vertex [{}]=({:.2R},{:.2R},{:.2R})", nextVertexIndex, itnext->x, itnext->y, it->z)); - } - ++state.dataErrTracking->TotalCoincidentVertices; - if (nSides > 3) { - if (state.dataGlobal->DisplayExtraWarnings) { - ShowContinueError(state, format("Dropping Vertex [{}].", nextVertexIndex)); - } - --nSides; - vertices.erase(itnext); - poppedVertex = true; - break; - } else { - if (state.dataGlobal->DisplayExtraWarnings) { - ShowContinueError(state, - format("Cannot Drop Vertex [{}]; Number of Surface Sides at minimum. This surface is now a " - "degenerate surface.", - curVertexIndex)); - } - ++state.dataErrTracking->TotalDegenerateSurfaces; - // mark degenerate surface? - } + auto itKept = vertices.begin(); + std::advance(itKept, popResult.keptVertexPos); + int const keptVertexIndex = popResult.keptVertexPos + 1; + + if (state.dataGlobal->DisplayExtraWarnings) { + ShowWarningError(state, + format("{}Distance between two vertices < .01, possibly coincident. for Surface={}, in Zone={}", + RoutineName, + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, + state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName)); + if (poppedVertexIndex > keptVertexIndex && poppedVertexIndex != nSides) { + ShowContinueError(state, format("Vertex [{}]=({:.2R},{:.2R},{:.2R})", keptVertexIndex, itKept->x, itKept->y, itKept->z)); + ShowContinueError(state, format("Vertex [{}]=({:.2R},{:.2R},{:.2R})", poppedVertexIndex, it->x, it->y, it->z)); } else { - Perimeter += DistanceCheck; + ShowContinueError(state, format("Vertex [{}]=({:.2R},{:.2R},{:.2R})", poppedVertexIndex, it->x, it->y, it->z)); + ShowContinueError(state, format("Vertex [{}]=({:.2R},{:.2R},{:.2R})", keptVertexIndex, itKept->x, itKept->y, itKept->z)); } } + ++state.dataErrTracking->TotalCoincidentVertices; + if (nSides <= 3) { + if (state.dataGlobal->DisplayExtraWarnings) { + ShowContinueError(state, + format("Cannot Drop Vertex [{}]; Number of Surface Sides at minimum. This surface is now a " + "degenerate surface.", + poppedVertexIndex)); + } + ++state.dataErrTracking->TotalDegenerateSurfaces; + // mark degenerate surface? + break; + } + + if (state.dataGlobal->DisplayExtraWarnings) { + ShowContinueError(state, format("Dropping Vertex [{}].", poppedVertexIndex)); + } + --nSides; + vertices.erase(it); + // No need to recompute perimeter, because it'll be done in the next iteration, until no popping or degenerate happens } state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Perimeter = Perimeter; From 571b957a438847f38324c38cf23e30f01e5ade5e Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Tue, 18 Jul 2023 16:49:19 +0200 Subject: [PATCH 76/80] Adjust existing test and fix order of vertices being printed when a wrap around is happening --- src/EnergyPlus/SurfaceGeometry.cc | 11 ++- tst/EnergyPlus/unit/SurfaceGeometry.unit.cc | 84 ++++++++++++--------- 2 files changed, 57 insertions(+), 38 deletions(-) diff --git a/src/EnergyPlus/SurfaceGeometry.cc b/src/EnergyPlus/SurfaceGeometry.cc index 13417c77da7..0cfe9cbce94 100644 --- a/src/EnergyPlus/SurfaceGeometry.cc +++ b/src/EnergyPlus/SurfaceGeometry.cc @@ -9310,7 +9310,6 @@ namespace SurfaceGeometry { struct PopCoincidentVertexReturn { - // bool popNeeded; double perimeter; int poppedVertexPos = -1; // This is a STL vector position, 0-indexed int keptVertexPos = -1; @@ -9563,12 +9562,16 @@ namespace SurfaceGeometry { RoutineName, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Name, state.dataSurfaceGeometry->SurfaceTmp(SurfNum).ZoneName)); - if (poppedVertexIndex > keptVertexIndex && poppedVertexIndex != nSides) { - ShowContinueError(state, format("Vertex [{}]=({:.2R},{:.2R},{:.2R})", keptVertexIndex, itKept->x, itKept->y, itKept->z)); + + bool const printPoppedFirst = (poppedVertexIndex < keptVertexIndex) ? !(poppedVertexIndex == 1 && keptVertexIndex == nSides) + : (poppedVertexIndex == nSides && keptVertexIndex == 1); + + if (printPoppedFirst) { ShowContinueError(state, format("Vertex [{}]=({:.2R},{:.2R},{:.2R})", poppedVertexIndex, it->x, it->y, it->z)); + ShowContinueError(state, format("Vertex [{}]=({:.2R},{:.2R},{:.2R})", keptVertexIndex, itKept->x, itKept->y, itKept->z)); } else { - ShowContinueError(state, format("Vertex [{}]=({:.2R},{:.2R},{:.2R})", poppedVertexIndex, it->x, it->y, it->z)); ShowContinueError(state, format("Vertex [{}]=({:.2R},{:.2R},{:.2R})", keptVertexIndex, itKept->x, itKept->y, itKept->z)); + ShowContinueError(state, format("Vertex [{}]=({:.2R},{:.2R},{:.2R})", poppedVertexIndex, it->x, it->y, it->z)); } } ++state.dataErrTracking->TotalCoincidentVertices; diff --git a/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc b/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc index 793e5beca9d..3b107476868 100644 --- a/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc +++ b/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc @@ -10152,27 +10152,25 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_GetSurfaceGroundSurfsTest) TEST_F(EnergyPlusFixture, SurfaceGeometry_GetVerticesDropDuplicates) { - // Test for #9123 + // Test for #9123 - We expect the point marked "x" to be popped. + // Once it is popped, point "y" is still below tolerance with the "#" point: + // * Floor: originally 6 but now 5 + // * Ceiling: 1 + // + // ▲ ▲ + // │ │ + // 4 o────────o 5 3 o────────o 2 + // │ │ │ │ + // ╵ ╵ ╵ ╵ + // ╵ Floor ╵ ╵Ceiling ╵ + // ╵ ╵ ╵ ╵ + // 3 │ 2 │ 4 │ 5 │ + // o─────y │ o─────y │ + // │ │ │ │ │ │ + // └─────x──#───► └─────x──#───► + // 1 6 6 1 + std::string const idf_objects = delimited_string({ - "BuildingSurface:Detailed,", - " Zn001:Ceiling002, !- Name", - " Ceiling, !- Surface Type", - " FLOOR, !- Construction Name", - " ZONE 1, !- Zone Name", - " , !- Space Name", - " Surface, !- Outside Boundary Condition", - " Zn002:Flr002, !- Outside Boundary Condition Object", - " NoSun, !- Sun Exposure", - " NoWind, !- Wind Exposure", - " , !- View Factor to Ground", - " , !- Number of Vertices", - " 54.379, -28.887, 3.7, !- X,Y,Z Vertex 1 {m}", - " 54.379, -23.003, 3.7, !- X,Y,Z Vertex 2 {m}", - " 54.36, -23.003, 3.7, !- X,Y,Z Vertex 3 {m}", - " 54.36, -28.881, 3.7, !- X,Y,Z Vertex 4 {m}", - " 54.373, -28.881, 3.7, !- X,Y,Z Vertex 5 {m}", - " 54.373, -28.887, 3.7; !- X,Y,Z Vertex 6 {m}", - "", "BuildingSurface:Detailed,", " Zn002:Flr002, !- Name", " Floor, !- Surface Type", @@ -10192,6 +10190,24 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_GetVerticesDropDuplicates) " 54.379, -23.003, 3.7, !- X,Y,Z Vertex 5 {m}", " 54.379, -28.887, 3.7; !- X,Y,Z Vertex 6 {m}", + "BuildingSurface:Detailed,", + " Zn001:Ceiling002, !- Name", + " Ceiling, !- Surface Type", + " FLOOR, !- Construction Name", + " ZONE 1, !- Zone Name", + " , !- Space Name", + " Surface, !- Outside Boundary Condition", + " Zn002:Flr002, !- Outside Boundary Condition Object", + " NoSun, !- Sun Exposure", + " NoWind, !- Wind Exposure", + " , !- View Factor to Ground", + " , !- Number of Vertices", + " 54.379, -28.887, 3.7, !- X,Y,Z Vertex 1 {m}", + " 54.379, -23.003, 3.7, !- X,Y,Z Vertex 2 {m}", + " 54.36, -23.003, 3.7, !- X,Y,Z Vertex 3 {m}", + " 54.36, -28.881, 3.7, !- X,Y,Z Vertex 4 {m}", + " 54.373, -28.881, 3.7, !- X,Y,Z Vertex 5 {m}", + " 54.373, -28.887, 3.7; !- X,Y,Z Vertex 6 {m}", }); ASSERT_TRUE(process_idf(idf_objects)); @@ -10231,29 +10247,29 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_GetVerticesDropDuplicates) EXPECT_EQ(2, SurfNum); auto const error_string = delimited_string({ - " ** Warning ** GetVertices: Distance between two vertices < .01, possibly coincident. for Surface=ZN001:CEILING002, in Zone=ZONE 1", - " ** ~~~ ** Vertex [5]=(54.37,-28.88,3.70)", - " ** ~~~ ** Vertex [6]=(54.37,-28.89,3.70)", - " ** ~~~ ** Dropping Vertex [6].", - " ** Warning ** GetVertices: Distance between two vertices < .01, possibly coincident. for Surface=ZN001:CEILING002, in Zone=ZONE 1", - " ** ~~~ ** Vertex [5]=(54.37,-28.88,3.70)", - " ** ~~~ ** Vertex [1]=(54.38,-28.89,3.70)", - " ** ~~~ ** Dropping Vertex [1].", " ** Warning ** GetVertices: Distance between two vertices < .01, possibly coincident. for Surface=ZN002:FLR002, in Zone=ZONE 2", " ** ~~~ ** Vertex [1]=(54.37,-28.89,3.70)", " ** ~~~ ** Vertex [2]=(54.37,-28.88,3.70)", - " ** ~~~ ** Dropping Vertex [2].", + " ** ~~~ ** Dropping Vertex [1].", " ** Warning ** GetVertices: Distance between two vertices < .01, possibly coincident. for Surface=ZN002:FLR002, in Zone=ZONE 2", " ** ~~~ ** Vertex [5]=(54.38,-28.89,3.70)", - " ** ~~~ ** Vertex [1]=(54.37,-28.89,3.70)", + " ** ~~~ ** Vertex [1]=(54.37,-28.88,3.70)", " ** ~~~ ** Dropping Vertex [1].", + " ** Warning ** GetVertices: Distance between two vertices < .01, possibly coincident. for Surface=ZN001:CEILING002, in Zone=ZONE 1", + " ** ~~~ ** Vertex [6]=(54.37,-28.89,3.70)", + " ** ~~~ ** Vertex [1]=(54.38,-28.89,3.70)", + " ** ~~~ ** Dropping Vertex [6].", + " ** Warning ** GetVertices: Distance between two vertices < .01, possibly coincident. for Surface=ZN001:CEILING002, in Zone=ZONE 1", + " ** ~~~ ** Vertex [5]=(54.37,-28.88,3.70)", + " ** ~~~ ** Vertex [1]=(54.38,-28.89,3.70)", + " ** ~~~ ** Dropping Vertex [5].", }); EXPECT_TRUE(compare_err_stream(error_string, true)); const auto &sf_temps = state->dataSurfaceGeometry->SurfaceTmp; EXPECT_EQ(2, sf_temps.size()); - EXPECT_EQ("ZN001:CEILING002", sf_temps(1).Name); - EXPECT_EQ("ZN002:FLR002", sf_temps(2).Name); + EXPECT_EQ("ZN002:FLR002", sf_temps(1).Name); + EXPECT_EQ("ZN001:CEILING002", sf_temps(2).Name); EXPECT_EQ(4, sf_temps(1).Sides); EXPECT_EQ(4, sf_temps(1).Vertex.size()); @@ -10265,9 +10281,9 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_GetVerticesDropDuplicates) EXPECT_NEAR(11.80, sf_temps(2).Perimeter, 0.02); } -TEST_F(EnergyPlusFixture, SurfaceGeometry_GetVerticesDropDuplicates_Tiny) +TEST_F(EnergyPlusFixture, SurfaceGeometry_GetVerticesDropDuplicates_Once) { - // Test for #9873 - We expect the point marked "x" to be popped + // Test for #9873 - We expect the point marked "x" to be popped. Once it is popped, there are no distances that are below tolerance. // ▲ ▲ // │ │ // 2 o────────o 3 5 o────────o 4 From 3e7104012839d443a429d886a1e72b447bdffe60 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Sat, 9 Sep 2023 08:43:38 +0200 Subject: [PATCH 77/80] Add some comments as requested --- src/EnergyPlus/SurfaceGeometry.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/EnergyPlus/SurfaceGeometry.cc b/src/EnergyPlus/SurfaceGeometry.cc index 0cfe9cbce94..bdca2e379d2 100644 --- a/src/EnergyPlus/SurfaceGeometry.cc +++ b/src/EnergyPlus/SurfaceGeometry.cc @@ -9321,7 +9321,7 @@ namespace SurfaceGeometry { size_t const nSides = vertices.size(); - // Vector of distance from this vertex to the next one + // Pass one: Vector of distance from this vertex to the next one std::vector distances(nSides); size_t index = 0; double min_distance = std::numeric_limits::max(); @@ -9336,10 +9336,13 @@ namespace SurfaceGeometry { min_distance = std::min(min_distance, dist); perimeter += dist; } + // Return early if nothing to be popped if (min_distance >= tolerance) { return {perimeter}; } + // Pass two: figure out the vertex that is coincident with its previous and/or next vertex and + // that minimizes the (distanceThisToNext + distanceThisToPrev). Real64 min_weight = std::numeric_limits::max(); int poppedVertexPos = -1; int keptVertexPos = -1; @@ -9363,6 +9366,7 @@ namespace SurfaceGeometry { } } + // Return the keptVertexPos (which can be the previous or the next), so we can print the displayExtraWarning correctly return {perimeter, poppedVertexPos, keptVertexPos}; } @@ -9548,6 +9552,7 @@ namespace SurfaceGeometry { break; } + // Grab the popped one, and the kept one (regardless of whether it's previous or next) auto it = vertices.begin(); std::advance(it, popResult.poppedVertexPos); int const poppedVertexIndex = popResult.poppedVertexPos + 1; @@ -9583,6 +9588,7 @@ namespace SurfaceGeometry { poppedVertexIndex)); } ++state.dataErrTracking->TotalDegenerateSurfaces; + // If degenerate, we won't be able to pop now nor later, so exit // mark degenerate surface? break; } From d3a4c866d617c8d7f488486837ab62a75f163906 Mon Sep 17 00:00:00 2001 From: Rick Strand Date: Mon, 11 Sep 2023 14:35:43 -0500 Subject: [PATCH 78/80] Solution and Unit Test Implementation of the solution to the issue submitted by Trane. Some minor code clean-up/modernization included. Unit test exercises part of the solution to show that the necessary initialization is happening. --- src/EnergyPlus/HeatBalanceAirManager.cc | 43 ++++++-------- src/EnergyPlus/ZoneEquipmentManager.cc | 2 +- .../unit/HeatBalanceAirManager.unit.cc | 58 +++++++++++++++++++ 3 files changed, 78 insertions(+), 25 deletions(-) diff --git a/src/EnergyPlus/HeatBalanceAirManager.cc b/src/EnergyPlus/HeatBalanceAirManager.cc index 932fb3aa9b2..f6f29939fef 100644 --- a/src/EnergyPlus/HeatBalanceAirManager.cc +++ b/src/EnergyPlus/HeatBalanceAirManager.cc @@ -3099,6 +3099,7 @@ void GetSimpleAirModelInputs(EnergyPlusData &state, bool &ErrorsFound) // IF err if (ReceivingCount > 0) { state.dataHeatBal->MassConservation(ZoneNum).ZoneMixingReceivingPtr.allocate(ReceivingCount); state.dataHeatBal->MassConservation(ZoneNum).ZoneMixingReceivingFr.allocate(ReceivingCount); + state.dataHeatBal->MassConservation(ZoneNum).ZoneMixingReceivingFr = 0.0; for (int Loop = 1; Loop <= ReceivingCount; ++Loop) { state.dataHeatBal->MassConservation(ZoneNum).ZoneMixingReceivingPtr(Loop) = ZoneMixingNum(Loop); } @@ -4816,40 +4817,34 @@ void InitSimpleMixingConvectiveHeatGains(EnergyPlusData &state) // Select type of airflow calculation if (state.dataHeatBal->AirFlowFlag) { // Simplified airflow calculation // Process the scheduled Mixing for air heat balance - for (int Loop = 1; Loop <= state.dataHeatBal->TotMixing; ++Loop) { - state.dataHeatBal->Mixing(Loop).DesiredAirFlowRate = - state.dataHeatBal->Mixing(Loop).DesignLevel * - ScheduleManager::GetCurrentScheduleValue(state, state.dataHeatBal->Mixing(Loop).SchedPtr); - if (state.dataHeatBal->Mixing(Loop).EMSSimpleMixingOn) - state.dataHeatBal->Mixing(Loop).DesiredAirFlowRate = state.dataHeatBal->Mixing(Loop).EMSimpleMixingFlowRate; - state.dataHeatBal->Mixing(Loop).DesiredAirFlowRateSaved = state.dataHeatBal->Mixing(Loop).DesiredAirFlowRate; + for (auto &thisMixing : state.dataHeatBal->Mixing) { + thisMixing.DesiredAirFlowRate = thisMixing.DesignLevel * ScheduleManager::GetCurrentScheduleValue(state, thisMixing.SchedPtr); + if (thisMixing.EMSSimpleMixingOn) thisMixing.DesiredAirFlowRate = thisMixing.EMSimpleMixingFlowRate; + thisMixing.DesiredAirFlowRateSaved = thisMixing.DesiredAirFlowRate; } // if zone air mass flow balance enforced calculate the fraction of // contribution of each mixing object to a zone mixed flow rate, BAN Feb 2014 if (state.dataHeatBal->ZoneAirMassFlow.EnforceZoneMassBalance) { - for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { + for (auto &massConservZone : state.dataHeatBal->MassConservation) { ZoneMixingFlowSum = 0.0; - int NumOfMixingObjects = state.dataHeatBal->MassConservation(ZoneNum).NumReceivingZonesMixingObject; + int NumOfMixingObjects = massConservZone.NumReceivingZonesMixingObject; for (int Loop = 1; Loop <= NumOfMixingObjects; ++Loop) { - ZoneMixingFlowSum = ZoneMixingFlowSum + state.dataHeatBal->Mixing(Loop).DesignLevel; + ZoneMixingFlowSum += state.dataHeatBal->Mixing(Loop).DesignLevel; + massConservZone.ZoneMixingReceivingFr(Loop) = 0.0; } if (ZoneMixingFlowSum > 0.0) { for (int Loop = 1; Loop <= NumOfMixingObjects; ++Loop) { - state.dataHeatBal->MassConservation(ZoneNum).ZoneMixingReceivingFr(Loop) = - state.dataHeatBal->Mixing(Loop).DesignLevel / ZoneMixingFlowSum; + massConservZone.ZoneMixingReceivingFr(Loop) = state.dataHeatBal->Mixing(Loop).DesignLevel / ZoneMixingFlowSum; } } } } // Process the scheduled CrossMixing for air heat balance - for (int Loop = 1; Loop <= state.dataHeatBal->TotCrossMixing; ++Loop) { - state.dataHeatBal->CrossMixing(Loop).DesiredAirFlowRate = - state.dataHeatBal->CrossMixing(Loop).DesignLevel * - ScheduleManager::GetCurrentScheduleValue(state, state.dataHeatBal->CrossMixing(Loop).SchedPtr); - if (state.dataHeatBal->CrossMixing(Loop).EMSSimpleMixingOn) - state.dataHeatBal->CrossMixing(Loop).DesiredAirFlowRate = state.dataHeatBal->CrossMixing(Loop).EMSimpleMixingFlowRate; + for (auto &thisCrossMix : state.dataHeatBal->CrossMixing) { + thisCrossMix.DesiredAirFlowRate = thisCrossMix.DesignLevel * ScheduleManager::GetCurrentScheduleValue(state, thisCrossMix.SchedPtr); + if (thisCrossMix.EMSSimpleMixingOn) thisCrossMix.DesiredAirFlowRate = thisCrossMix.EMSimpleMixingFlowRate; } // Note - do each Pair a Single time, so must do increment reports for both zones @@ -4860,12 +4855,12 @@ void InitSimpleMixingConvectiveHeatGains(EnergyPlusData &state) if (state.dataHeatBal->TotRefDoorMixing > 0) { for (int NZ = 1; NZ <= (state.dataGlobal->NumOfZones - 1); ++NZ) { // Can't have %ZonePtr==NumOfZones because lesser zone # of pair placed in ZonePtr in input - if (!state.dataHeatBal->RefDoorMixing(NZ).RefDoorMixFlag) continue; - if (state.dataHeatBal->RefDoorMixing(NZ).ZonePtr == NZ) { - for (int J = 1; J <= state.dataHeatBal->RefDoorMixing(NZ).NumRefDoorConnections; ++J) { - state.dataHeatBal->RefDoorMixing(NZ).VolRefDoorFlowRate(J) = 0.0; - if (state.dataHeatBal->RefDoorMixing(NZ).EMSRefDoorMixingOn(J)) - state.dataHeatBal->RefDoorMixing(NZ).VolRefDoorFlowRate(J) = state.dataHeatBal->RefDoorMixing(NZ).EMSRefDoorFlowRate(J); + auto &thisRefDoor = state.dataHeatBal->RefDoorMixing(NZ); + if (!thisRefDoor.RefDoorMixFlag) continue; + if (thisRefDoor.ZonePtr == NZ) { + for (int J = 1; J <= thisRefDoor.NumRefDoorConnections; ++J) { + thisRefDoor.VolRefDoorFlowRate(J) = 0.0; + if (thisRefDoor.EMSRefDoorMixingOn(J)) thisRefDoor.VolRefDoorFlowRate(J) = thisRefDoor.EMSRefDoorFlowRate(J); } } } diff --git a/src/EnergyPlus/ZoneEquipmentManager.cc b/src/EnergyPlus/ZoneEquipmentManager.cc index 9926bd155a1..b59f35fb672 100644 --- a/src/EnergyPlus/ZoneEquipmentManager.cc +++ b/src/EnergyPlus/ZoneEquipmentManager.cc @@ -4501,9 +4501,9 @@ void CalcZoneMassBalance(EnergyPlusData &state, bool const FirstHVACIteration) BuildingZoneReturnFlow = 0.0; for (int ZoneNum1 = 1; ZoneNum1 <= state.dataGlobal->NumOfZones; ++ZoneNum1) { - if (!state.dataZoneEquip->ZoneEquipConfig(ZoneNum1).IsControlled) continue; int ZoneNum = ZoneNum1; if (state.dataHeatBal->ZoneAirMassFlow.EnforceZoneMassBalance) ZoneNum = state.dataHeatBalFanSys->ZoneReOrder(ZoneNum1); + if (!state.dataZoneEquip->ZoneEquipConfig(ZoneNum).IsControlled) continue; auto &massConservation = state.dataHeatBal->MassConservation(ZoneNum); auto &zoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(ZoneNum); Real64 TotExhaustAirMassFlowRate = 0.0; diff --git a/tst/EnergyPlus/unit/HeatBalanceAirManager.unit.cc b/tst/EnergyPlus/unit/HeatBalanceAirManager.unit.cc index acf73fd1117..e502500004b 100644 --- a/tst/EnergyPlus/unit/HeatBalanceAirManager.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalanceAirManager.unit.cc @@ -860,4 +860,62 @@ TEST_F(EnergyPlusFixture, HeatBalanceAirManager_GetMixingAndCrossMixing) } } +TEST_F(EnergyPlusFixture, HeatBalanceAirManager_InitSimpleMixingConvectiveHeatGains_Test) +{ + Real64 expectedResult1; + Real64 expectedResult2; + Real64 constexpr allowedTolerance = 0.00001; + + // Base line data that do not change between tests + state->dataHeatBal->TotRefDoorMixing = 0; + state->dataHeatBal->TotCrossMixing = 0; + state->dataHeatBal->TotMixing = 3; + state->dataHeatBal->Mixing.allocate(state->dataHeatBal->TotMixing); + state->dataHeatBal->Mixing(1).SchedPtr = -1; // this returns a value of one + state->dataHeatBal->Mixing(2).SchedPtr = -1; // this returns a value of one + state->dataHeatBal->Mixing(3).SchedPtr = -1; // this returns a value of one + state->dataHeatBal->Mixing(1).EMSSimpleMixingOn = false; + state->dataHeatBal->Mixing(2).EMSSimpleMixingOn = false; + state->dataHeatBal->Mixing(3).EMSSimpleMixingOn = false; + state->dataHeatBal->ZoneAirMassFlow.EnforceZoneMassBalance = true; + state->dataHeatBal->MassConservation.allocate(2); + state->dataHeatBal->MassConservation(1).NumReceivingZonesMixingObject = 2; + state->dataHeatBal->MassConservation(2).NumReceivingZonesMixingObject = 0; + state->dataHeatBal->MassConservation(1).ZoneMixingReceivingFr.allocate(2); + + // Test 1: not air flow flag--don't do anything + state->dataHeatBal->AirFlowFlag = false; + state->dataHeatBal->MassConservation(1).ZoneMixingReceivingFr(1) = -9999.9; + state->dataHeatBal->MassConservation(1).ZoneMixingReceivingFr(2) = -9999.9; + expectedResult1 = -9999.9; + expectedResult2 = -9999.9; + HeatBalanceAirManager::InitSimpleMixingConvectiveHeatGains(*state); + EXPECT_NEAR(expectedResult1, state->dataHeatBal->MassConservation(1).ZoneMixingReceivingFr(1), allowedTolerance); + EXPECT_NEAR(expectedResult2, state->dataHeatBal->MassConservation(1).ZoneMixingReceivingFr(2), allowedTolerance); + + // Test 2: yes to air flow flag, but no mixing flow sum, set ZoneMixingReceivingFr to zero + state->dataHeatBal->AirFlowFlag = true; + state->dataHeatBal->Mixing(1).DesignLevel = 0.0; + state->dataHeatBal->Mixing(2).DesignLevel = 0.0; + state->dataHeatBal->MassConservation(1).ZoneMixingReceivingFr(1) = -9999.9; + state->dataHeatBal->MassConservation(1).ZoneMixingReceivingFr(2) = -9999.9; + expectedResult1 = 0.0; + expectedResult2 = 0.0; + HeatBalanceAirManager::InitSimpleMixingConvectiveHeatGains(*state); + EXPECT_NEAR(expectedResult1, state->dataHeatBal->MassConservation(1).ZoneMixingReceivingFr(1), allowedTolerance); + EXPECT_NEAR(expectedResult2, state->dataHeatBal->MassConservation(1).ZoneMixingReceivingFr(2), allowedTolerance); + + // Test 3: yes to air flow flag, with mixing, ZoneMixingReceivingFr set to appropriate value + state->dataHeatBal->AirFlowFlag = true; + state->dataHeatBal->Mixing(1).DesignLevel = 100.0; + state->dataHeatBal->Mixing(2).DesignLevel = 300.0; + state->dataHeatBal->MassConservation(1).ZoneMixingReceivingFr(1) = -9999.9; + state->dataHeatBal->MassConservation(1).ZoneMixingReceivingFr(2) = -9999.9; + expectedResult1 = 0.25; + expectedResult2 = 0.75; + HeatBalanceAirManager::InitSimpleMixingConvectiveHeatGains(*state); + EXPECT_NEAR(expectedResult1, state->dataHeatBal->MassConservation(1).ZoneMixingReceivingFr(1), allowedTolerance); + EXPECT_NEAR(expectedResult2, state->dataHeatBal->MassConservation(1).ZoneMixingReceivingFr(2), allowedTolerance); +} + } // namespace EnergyPlus From e3317131b1df278abd3811c1c7b827e1ae7b58fc Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Wed, 13 Sep 2023 11:21:42 -0500 Subject: [PATCH 79/80] format --- src/EnergyPlus/UnitarySystem.cc | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/EnergyPlus/UnitarySystem.cc b/src/EnergyPlus/UnitarySystem.cc index e05fdead5f7..a1ce6e64b55 100644 --- a/src/EnergyPlus/UnitarySystem.cc +++ b/src/EnergyPlus/UnitarySystem.cc @@ -8513,18 +8513,18 @@ namespace UnitarySystems { int constexpr MaxIter = 100; // maximum number of iterations // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int SpeedNum; // multi-speed coil speed number - Real64 SensOutputOn; // sensible output at PLR = 1 [W] - Real64 LatOutputOn; // latent output at PLR = 1 [W] - Real64 TempLoad; // represents either a sensible or latent load [W] - Real64 TempSysOutput; // represents either a sensible or latent capacity [W] - Real64 TempSensOutput; // iterative sensible capacity [W] - Real64 TempLatOutput; // iterative latent capacity [W] - Real64 TempMinPLR; // iterative minimum PLR - Real64 TempMaxPLR; // iterative maximum PLR - Real64 CpAir; // specific heat of air [J/kg_C] - Real64 FullLoadAirOutletTemp; // saved full load outlet air temperature [C] - Real64 FullLoadAirOutletHumRat; // saved full load outlet air humidity ratio [kg/kg] + int SpeedNum; // multi-speed coil speed number + Real64 SensOutputOn; // sensible output at PLR = 1 [W] + Real64 LatOutputOn; // latent output at PLR = 1 [W] + Real64 TempLoad; // represents either a sensible or latent load [W] + Real64 TempSysOutput; // represents either a sensible or latent capacity [W] + Real64 TempSensOutput; // iterative sensible capacity [W] + Real64 TempLatOutput; // iterative latent capacity [W] + Real64 TempMinPLR; // iterative minimum PLR + Real64 TempMaxPLR; // iterative maximum PLR + Real64 CpAir; // specific heat of air [J/kg_C] + Real64 FullLoadAirOutletTemp; // saved full load outlet air temperature [C] + Real64 FullLoadAirOutletHumRat; // saved full load outlet air humidity ratio [kg/kg] std::string CompName = this->Name; int OutletNode = this->AirOutNode; From 627d866f3642aea1fa1c98cbd63f8db28eed766c Mon Sep 17 00:00:00 2001 From: Edwin Lee Date: Wed, 13 Sep 2023 11:54:56 -0500 Subject: [PATCH 80/80] Fix conflict resolution issue, reapply formatting [decent_ci_skip] --- .../unit/OutputReportTabular.unit.cc | 309 +++++++++--------- 1 file changed, 154 insertions(+), 155 deletions(-) diff --git a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc index 08584512e70..48f0f58ccf9 100644 --- a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc +++ b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc @@ -12871,176 +12871,175 @@ TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_DontWarnMonthlyIfOnlyNamedR InitializeTabularMonthly(*state); compare_err_stream(""); +} - TEST_F(SQLiteFixture, OutputReportTabular_DistrictHeating) - { - // Test for #10190 - District Heating Steam is empty - state->dataSQLiteProcedures->sqlite->createSQLiteSimulationsRecord(1, "EnergyPlus Version", "Current Time"); +TEST_F(SQLiteFixture, OutputReportTabular_DistrictHeating) +{ + // Test for #10190 - District Heating Steam is empty + state->dataSQLiteProcedures->sqlite->createSQLiteSimulationsRecord(1, "EnergyPlus Version", "Current Time"); - state->dataOutRptTab->displayTabularBEPS = true; - state->dataOutRptTab->displayDemandEndUse = true; - state->dataOutRptTab->displayLEEDSummary = true; + state->dataOutRptTab->displayTabularBEPS = true; + state->dataOutRptTab->displayDemandEndUse = true; + state->dataOutRptTab->displayLEEDSummary = true; - state->dataOutRptTab->WriteTabularFiles = true; + state->dataOutRptTab->WriteTabularFiles = true; - SetupUnitConversions(*state); - state->dataOutRptTab->unitsStyle = OutputReportTabular::UnitsStyle::JtoKWH; - state->dataOutRptTab->unitsStyle_SQLite = OutputReportTabular::UnitsStyle::JtoKWH; + SetupUnitConversions(*state); + state->dataOutRptTab->unitsStyle = OutputReportTabular::UnitsStyle::JtoKWH; + state->dataOutRptTab->unitsStyle_SQLite = OutputReportTabular::UnitsStyle::JtoKWH; - // Needed to avoid crash (from ElectricPowerServiceManager.hh) - createFacilityElectricPowerServiceObject(*state); + // Needed to avoid crash (from ElectricPowerServiceManager.hh) + createFacilityElectricPowerServiceObject(*state); - SetPredefinedTables(*state); + SetPredefinedTables(*state); - Real64 DistrictHeatingWater = 4e8; - SetupOutputVariable(*state, - "Exterior Equipment DistrictHeatingWater Energy", - OutputProcessor::Unit::J, - DistrictHeatingWater, - OutputProcessor::SOVTimeStepType::Zone, - OutputProcessor::SOVStoreType::Summed, - "DHWaterExtEq", - {}, - "DistrictHeatingWater", - "ExteriorEquipment", - "General"); + Real64 DistrictHeatingWater = 4e8; + SetupOutputVariable(*state, + "Exterior Equipment DistrictHeatingWater Energy", + OutputProcessor::Unit::J, + DistrictHeatingWater, + OutputProcessor::SOVTimeStepType::Zone, + OutputProcessor::SOVStoreType::Summed, + "DHWaterExtEq", + {}, + "DistrictHeatingWater", + "ExteriorEquipment", + "General"); - Real64 DistrictHeatingSteam = 5e8; - SetupOutputVariable(*state, - "Exterior Equipment DistrictHeatingSteam Energy", - OutputProcessor::Unit::J, - DistrictHeatingSteam, - OutputProcessor::SOVTimeStepType::Zone, - OutputProcessor::SOVStoreType::Summed, - "DHSteamExtEq", - {}, - "DistrictHeatingSteam", - "ExteriorEquipment", - "General"); - - state->dataGlobal->DoWeathSim = true; - state->dataGlobal->TimeStepZone = 1.0; - state->dataGlobal->MinutesPerTimeStep = state->dataGlobal->TimeStepZone * 60; - state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * 3600.0; - state->dataOutRptTab->displayTabularBEPS = true; - // OutputProcessor::TimeValue.allocate(2); - - auto timeStep = 1.0; - - SetupTimePointers(*state, OutputProcessor::SOVTimeStepType::Zone, timeStep); - SetupTimePointers(*state, OutputProcessor::SOVTimeStepType::HVAC, timeStep); - - *state->dataOutputProcessor->TimeValue.at(OutputProcessor::TimeStepType::Zone).TimeStep = 60; - *state->dataOutputProcessor->TimeValue.at(OutputProcessor::TimeStepType::System).TimeStep = 60; - - GetInputOutputTableSummaryReports(*state); - - state->dataEnvrn->Month = 12; - - UpdateMeterReporting(*state); - UpdateDataandReport(*state, OutputProcessor::TimeStepType::Zone); - GatherBEPSResultsForTimestep(*state, OutputProcessor::TimeStepType::Zone); - GatherPeakDemandForTimestep(*state, OutputProcessor::TimeStepType::Zone); - - auto &ort = state->dataOutRptTab; - constexpr int dhWaterIndex = 4; - constexpr int dhSteamIndex = 5; - EXPECT_EQ("DistrictHeatingWater", ort->resourceTypeNames(dhWaterIndex)); - EXPECT_EQ("DistrictHeatingSteam", ort->resourceTypeNames(dhSteamIndex)); - - EXPECT_NEAR(DistrictHeatingWater, state->dataOutRptTab->gatherTotalsBEPS(dhWaterIndex), 1.); - EXPECT_NEAR(DistrictHeatingWater, - state->dataOutRptTab->gatherEndUseBEPS(dhWaterIndex, static_cast(Constant::EndUse::ExteriorEquipment) + 1), - 1.); - // General - EXPECT_NEAR(DistrictHeatingWater, - state->dataOutRptTab->gatherEndUseSubBEPS(1, static_cast(Constant::EndUse::ExteriorEquipment) + 1, dhWaterIndex), - 1.); - - EXPECT_NEAR(DistrictHeatingSteam, state->dataOutRptTab->gatherTotalsBEPS(dhSteamIndex), 1.); - EXPECT_NEAR(DistrictHeatingSteam, - state->dataOutRptTab->gatherEndUseBEPS(dhSteamIndex, static_cast(Constant::EndUse::ExteriorEquipment) + 1), - 1.); - // General - EXPECT_NEAR(DistrictHeatingSteam, - state->dataOutRptTab->gatherEndUseSubBEPS(1, static_cast(Constant::EndUse::ExteriorEquipment) + 1, dhSteamIndex), - 1.); - - UpdateMeterReporting(*state); - UpdateDataandReport(*state, OutputProcessor::TimeStepType::Zone); - GatherBEPSResultsForTimestep(*state, OutputProcessor::TimeStepType::Zone); - GatherPeakDemandForTimestep(*state, OutputProcessor::TimeStepType::Zone); - EXPECT_NEAR(DistrictHeatingWater * 2, state->dataOutRptTab->gatherTotalsBEPS(dhWaterIndex), 1.); - EXPECT_NEAR(DistrictHeatingWater * 2, - state->dataOutRptTab->gatherEndUseBEPS(dhWaterIndex, static_cast(Constant::EndUse::ExteriorEquipment) + 1), - 1.); - // General - EXPECT_NEAR(DistrictHeatingWater * 2, - state->dataOutRptTab->gatherEndUseSubBEPS(1, static_cast(Constant::EndUse::ExteriorEquipment) + 1, dhWaterIndex), - 1.); - - EXPECT_NEAR(DistrictHeatingSteam * 2, state->dataOutRptTab->gatherTotalsBEPS(dhSteamIndex), 1.); - EXPECT_NEAR(DistrictHeatingSteam * 2, - state->dataOutRptTab->gatherEndUseBEPS(dhSteamIndex, static_cast(Constant::EndUse::ExteriorEquipment) + 1), - 1.); - // General - EXPECT_NEAR(DistrictHeatingSteam * 2, - state->dataOutRptTab->gatherEndUseSubBEPS(1, static_cast(Constant::EndUse::ExteriorEquipment) + 1, dhSteamIndex), - 1.); - - OutputReportTabular::WriteBEPSTable(*state); - OutputReportTabular::WriteDemandEndUseSummary(*state); - - // We test for Heating and Total, since they should be the same - std::vector testReportNames = {"AnnualBuildingUtilityPerformanceSummary", "DemandEndUseComponentsSummary"}; - std::vector endUseSubCategoryNames = {"General"}; - - // Query End Use - { - std::string query(R"sql( + Real64 DistrictHeatingSteam = 5e8; + SetupOutputVariable(*state, + "Exterior Equipment DistrictHeatingSteam Energy", + OutputProcessor::Unit::J, + DistrictHeatingSteam, + OutputProcessor::SOVTimeStepType::Zone, + OutputProcessor::SOVStoreType::Summed, + "DHSteamExtEq", + {}, + "DistrictHeatingSteam", + "ExteriorEquipment", + "General"); + + state->dataGlobal->DoWeathSim = true; + state->dataGlobal->TimeStepZone = 1.0; + state->dataGlobal->MinutesPerTimeStep = state->dataGlobal->TimeStepZone * 60; + state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * 3600.0; + state->dataOutRptTab->displayTabularBEPS = true; + // OutputProcessor::TimeValue.allocate(2); + + auto timeStep = 1.0; + + SetupTimePointers(*state, OutputProcessor::SOVTimeStepType::Zone, timeStep); + SetupTimePointers(*state, OutputProcessor::SOVTimeStepType::HVAC, timeStep); + + *state->dataOutputProcessor->TimeValue.at(OutputProcessor::TimeStepType::Zone).TimeStep = 60; + *state->dataOutputProcessor->TimeValue.at(OutputProcessor::TimeStepType::System).TimeStep = 60; + + GetInputOutputTableSummaryReports(*state); + + state->dataEnvrn->Month = 12; + + UpdateMeterReporting(*state); + UpdateDataandReport(*state, OutputProcessor::TimeStepType::Zone); + GatherBEPSResultsForTimestep(*state, OutputProcessor::TimeStepType::Zone); + GatherPeakDemandForTimestep(*state, OutputProcessor::TimeStepType::Zone); + + auto &ort = state->dataOutRptTab; + constexpr int dhWaterIndex = 4; + constexpr int dhSteamIndex = 5; + EXPECT_EQ("DistrictHeatingWater", ort->resourceTypeNames(dhWaterIndex)); + EXPECT_EQ("DistrictHeatingSteam", ort->resourceTypeNames(dhSteamIndex)); + + EXPECT_NEAR(DistrictHeatingWater, state->dataOutRptTab->gatherTotalsBEPS(dhWaterIndex), 1.); + EXPECT_NEAR( + DistrictHeatingWater, state->dataOutRptTab->gatherEndUseBEPS(dhWaterIndex, static_cast(Constant::EndUse::ExteriorEquipment) + 1), 1.); + // General + EXPECT_NEAR(DistrictHeatingWater, + state->dataOutRptTab->gatherEndUseSubBEPS(1, static_cast(Constant::EndUse::ExteriorEquipment) + 1, dhWaterIndex), + 1.); + + EXPECT_NEAR(DistrictHeatingSteam, state->dataOutRptTab->gatherTotalsBEPS(dhSteamIndex), 1.); + EXPECT_NEAR( + DistrictHeatingSteam, state->dataOutRptTab->gatherEndUseBEPS(dhSteamIndex, static_cast(Constant::EndUse::ExteriorEquipment) + 1), 1.); + // General + EXPECT_NEAR(DistrictHeatingSteam, + state->dataOutRptTab->gatherEndUseSubBEPS(1, static_cast(Constant::EndUse::ExteriorEquipment) + 1, dhSteamIndex), + 1.); + + UpdateMeterReporting(*state); + UpdateDataandReport(*state, OutputProcessor::TimeStepType::Zone); + GatherBEPSResultsForTimestep(*state, OutputProcessor::TimeStepType::Zone); + GatherPeakDemandForTimestep(*state, OutputProcessor::TimeStepType::Zone); + EXPECT_NEAR(DistrictHeatingWater * 2, state->dataOutRptTab->gatherTotalsBEPS(dhWaterIndex), 1.); + EXPECT_NEAR(DistrictHeatingWater * 2, + state->dataOutRptTab->gatherEndUseBEPS(dhWaterIndex, static_cast(Constant::EndUse::ExteriorEquipment) + 1), + 1.); + // General + EXPECT_NEAR(DistrictHeatingWater * 2, + state->dataOutRptTab->gatherEndUseSubBEPS(1, static_cast(Constant::EndUse::ExteriorEquipment) + 1, dhWaterIndex), + 1.); + + EXPECT_NEAR(DistrictHeatingSteam * 2, state->dataOutRptTab->gatherTotalsBEPS(dhSteamIndex), 1.); + EXPECT_NEAR(DistrictHeatingSteam * 2, + state->dataOutRptTab->gatherEndUseBEPS(dhSteamIndex, static_cast(Constant::EndUse::ExteriorEquipment) + 1), + 1.); + // General + EXPECT_NEAR(DistrictHeatingSteam * 2, + state->dataOutRptTab->gatherEndUseSubBEPS(1, static_cast(Constant::EndUse::ExteriorEquipment) + 1, dhSteamIndex), + 1.); + + OutputReportTabular::WriteBEPSTable(*state); + OutputReportTabular::WriteDemandEndUseSummary(*state); + + // We test for Heating and Total, since they should be the same + std::vector testReportNames = {"AnnualBuildingUtilityPerformanceSummary", "DemandEndUseComponentsSummary"}; + std::vector endUseSubCategoryNames = {"General"}; + + // Query End Use + { + std::string query(R"sql( SELECT Value From TabularDataWithStrings WHERE TableName = 'End Uses' AND ReportName = 'AnnualBuildingUtilityPerformanceSummary' AND ColumnName = 'District Heating Water' AND RowName = 'Exterior Equipment')sql"); - auto const result = queryResult(query, "TabularDataWithStrings"); - Real64 const return_val1 = execAndReturnFirstDouble(query); + auto const result = queryResult(query, "TabularDataWithStrings"); + Real64 const return_val1 = execAndReturnFirstDouble(query); - ASSERT_EQ(1u, result.size()) << "Failed for query: " << query; - EXPECT_NEAR(DistrictHeatingWater * 2 / 3.6e6, return_val1, 0.01) << "Failed for query: " << query; - } + ASSERT_EQ(1u, result.size()) << "Failed for query: " << query; + EXPECT_NEAR(DistrictHeatingWater * 2 / 3.6e6, return_val1, 0.01) << "Failed for query: " << query; + } - { - std::string query("SELECT Value From TabularDataWithStrings" - " WHERE TableName = 'End Uses'" - " AND ReportName = 'AnnualBuildingUtilityPerformanceSummary'" - " AND ColumnName = 'District Heating Steam'" - " AND RowName = 'Exterior Equipment'"); - auto const result = queryResult(query, "TabularDataWithStrings"); - Real64 const return_val = execAndReturnFirstDouble(query); - - ASSERT_EQ(1u, result.size()) << "Failed for query: " << query; - EXPECT_NEAR(DistrictHeatingSteam * 2 / 3.6e6, return_val, 0.01) << "Failed for query: " << query; - } + { + std::string query("SELECT Value From TabularDataWithStrings" + " WHERE TableName = 'End Uses'" + " AND ReportName = 'AnnualBuildingUtilityPerformanceSummary'" + " AND ColumnName = 'District Heating Steam'" + " AND RowName = 'Exterior Equipment'"); + auto const result = queryResult(query, "TabularDataWithStrings"); + Real64 const return_val = execAndReturnFirstDouble(query); - // Query End Use with Subcategory - { - std::string const query("SELECT Value From TabularDataWithStrings" - " WHERE TableName = 'End Uses By Subcategory'" - " AND ReportName = 'AnnualBuildingUtilityPerformanceSummary'" - " AND ColumnName = 'District Heating Water'" - " AND RowName = 'Exterior Equipment:General'"); - Real64 const return_val = execAndReturnFirstDouble(query); - EXPECT_NEAR(DistrictHeatingWater * 2 / 3.6e6, return_val, 0.01) << "Failed for query: " << query; - } + ASSERT_EQ(1u, result.size()) << "Failed for query: " << query; + EXPECT_NEAR(DistrictHeatingSteam * 2 / 3.6e6, return_val, 0.01) << "Failed for query: " << query; + } - { - std::string query("SELECT Value From TabularDataWithStrings" - " WHERE TableName = 'End Uses By Subcategory'" - " AND ReportName = 'AnnualBuildingUtilityPerformanceSummary'" - " AND ColumnName = 'District Heating Steam'" - " AND RowName = 'Exterior Equipment:General'"); - Real64 return_val = execAndReturnFirstDouble(query); - EXPECT_NEAR(DistrictHeatingSteam * 2 / 3.6e6, return_val, 0.01) << "Failed for query: " << query; - } + // Query End Use with Subcategory + { + std::string const query("SELECT Value From TabularDataWithStrings" + " WHERE TableName = 'End Uses By Subcategory'" + " AND ReportName = 'AnnualBuildingUtilityPerformanceSummary'" + " AND ColumnName = 'District Heating Water'" + " AND RowName = 'Exterior Equipment:General'"); + Real64 const return_val = execAndReturnFirstDouble(query); + EXPECT_NEAR(DistrictHeatingWater * 2 / 3.6e6, return_val, 0.01) << "Failed for query: " << query; } + + { + std::string query("SELECT Value From TabularDataWithStrings" + " WHERE TableName = 'End Uses By Subcategory'" + " AND ReportName = 'AnnualBuildingUtilityPerformanceSummary'" + " AND ColumnName = 'District Heating Steam'" + " AND RowName = 'Exterior Equipment:General'"); + Real64 return_val = execAndReturnFirstDouble(query); + EXPECT_NEAR(DistrictHeatingSteam * 2 / 3.6e6, return_val, 0.01) << "Failed for query: " << query; + } +}