From a4c65416777bdf957ce9461310f9dbac7213e57b Mon Sep 17 00:00:00 2001 From: Dareum Nam Date: Mon, 30 Dec 2024 00:09:00 -0700 Subject: [PATCH] clang format --- src/EnergyPlus/Construction.hh | 41 +++-- src/EnergyPlus/DaylightingManager.cc | 152 +++++++++--------- src/EnergyPlus/HeatBalanceManager.cc | 61 +++---- src/EnergyPlus/SolarShading.cc | 105 ++++++------ src/EnergyPlus/WindowManager.cc | 84 +++++----- src/EnergyPlus/WindowManager.hh | 41 +++-- .../unit/HeatBalanceSurfaceManager.unit.cc | 2 +- 7 files changed, 251 insertions(+), 235 deletions(-) diff --git a/src/EnergyPlus/Construction.hh b/src/EnergyPlus/Construction.hh index dfaa407b402..4315d1a0283 100644 --- a/src/EnergyPlus/Construction.hh +++ b/src/EnergyPlus/Construction.hh @@ -213,24 +213,24 @@ namespace Construction { // Sol diffuse absorptance per glass layer with blind on Array1D> layerSlatBlindDfAbs; - Array1D AbsDiffBack; // Diffuse back solar absorptance for each glass layer - Real64 AbsDiffShade = 0.0; // Diffuse solar absorptance for shade - Real64 AbsDiffBackShade = 0.0; // Diffuse back solar absorptance for shade - Real64 ShadeAbsorpThermal = 0.0; // Diffuse back thermal absorptance of shade + Array1D AbsDiffBack; // Diffuse back solar absorptance for each glass layer + Real64 AbsDiffShade = 0.0; // Diffuse solar absorptance for shade + Real64 AbsDiffBackShade = 0.0; // Diffuse back solar absorptance for shade + Real64 ShadeAbsorpThermal = 0.0; // Diffuse back thermal absorptance of shade Array1D> AbsBeamCoef; // Coefficients of incidence-angle polynomial for solar // absorptance for each solid glazing layer - Array1D> AbsBeamBackCoef; // As for AbsBeamCoef but for back-incident solar - std::array AbsBeamShadeCoef = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Shade abs inc-angle coefs + Array1D> AbsBeamBackCoef; // As for AbsBeamCoef but for back-incident solar + std::array AbsBeamShadeCoef = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // Shade abs inc-angle coefs Real64 TransDiff = 0.0; // Diffuse solar transmittance, bare glass or shade on Real64 TransDiffVis; // Diffuse visible transmittance, bare glass or shade on Real64 ReflectSolDiffBack = 0.0; // Diffuse back solar reflectance, bare glass or shade on Real64 ReflectSolDiffFront = 0.0; // Diffuse front solar reflectance, bare glass or shade on Real64 ReflectVisDiffBack = 0.0; // Diffuse back visible reflectance, bare glass or shade on Real64 ReflectVisDiffFront = 0.0; // Diffuse front visible reflectance, bare glass or shade on - std::array TransSolBeamCoef = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // beam sol trans inc-angle coefs - std::array TransVisBeamCoef = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // beam vis trans inc-angle coefs + std::array TransSolBeamCoef = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // beam sol trans inc-angle coefs + std::array TransVisBeamCoef = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // beam vis trans inc-angle coefs std::array ReflSolBeamFrontCoef = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // beam sol ref front inc-angle coefs - std::array ReflSolBeamBackCoef = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // beam sol ref back inc-angle coefs + std::array ReflSolBeamBackCoef = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; // beam sol ref back inc-angle coefs Array1D> tBareSolCoef; // Isolated glass solar transmittance coeffs of inc. angle polynomial Array1D> tBareVisCoef; // Isolated glass visible transmittance coeffs of inc. angle polynomial Array1D> rfBareSolCoef; // Isolated glass front solar reflectance coeffs of inc. angle polynomial @@ -239,16 +239,16 @@ namespace Construction { Array1D> rbBareVisCoef; // Isolated glass back visible reflectance coeffs of inc. angle polynomial Array1D> afBareSolCoef; // Isolated glass front solar absorptance coeffs of inc. angle polynomial Array1D> abBareSolCoef; // Isolated glass back solar absorptance coeffs of inc. angle polynomial - Array1D tBareSolDiff; // Isolated glass diffuse solar transmittance - Array1D tBareVisDiff; // Isolated glass diffuse visible transmittance - Array1D rfBareSolDiff; // Isolated glass diffuse solar front reflectance - Array1D rfBareVisDiff; // Isolated glass diffuse visible front reflectance - Array1D rbBareSolDiff; // Isolated glass diffuse solar back reflectance - Array1D rbBareVisDiff; // Isolated glass diffuse visible back reflectance - Array1D afBareSolDiff; // Isolated glass diffuse solar front absorptance - Array1D abBareSolDiff; // Isolated glass diffuse solar back absorptance - bool FromWindow5DataFile = false; // True if this is a window construction extracted from the Window5 data file - Real64 W5FileMullionWidth = 0.0; // Width of mullion for construction from Window5 data file (m) + Array1D tBareSolDiff; // Isolated glass diffuse solar transmittance + Array1D tBareVisDiff; // Isolated glass diffuse visible transmittance + Array1D rfBareSolDiff; // Isolated glass diffuse solar front reflectance + Array1D rfBareVisDiff; // Isolated glass diffuse visible front reflectance + Array1D rbBareSolDiff; // Isolated glass diffuse solar back reflectance + Array1D rbBareVisDiff; // Isolated glass diffuse visible back reflectance + Array1D afBareSolDiff; // Isolated glass diffuse solar front absorptance + Array1D abBareSolDiff; // Isolated glass diffuse solar back absorptance + bool FromWindow5DataFile = false; // True if this is a window construction extracted from the Window5 data file + Real64 W5FileMullionWidth = 0.0; // Width of mullion for construction from Window5 data file (m) DataWindowEquivalentLayer::Orientation W5FileMullionOrientation = DataWindowEquivalentLayer::Orientation::Invalid; // Orientation of mullion, if present, for Window5 data file construction, Real64 W5FileGlazingSysWidth = 0.0; // Glass width for construction from Window5 data file (m) @@ -322,8 +322,7 @@ namespace Construction { // Default Constructor ConstructionProps() - : LayerPoint(MaxLayersInConstruct, 0), TransDiffVis(0.0), - tBareSolDiff(5, 0.0), tBareVisDiff(5, 0.0), rfBareSolDiff(5, 0.0), + : LayerPoint(MaxLayersInConstruct, 0), TransDiffVis(0.0), tBareSolDiff(5, 0.0), tBareVisDiff(5, 0.0), rfBareSolDiff(5, 0.0), rfBareVisDiff(5, 0.0), rbBareSolDiff(5, 0.0), rbBareVisDiff(5, 0.0), afBareSolDiff(5, 0.0), abBareSolDiff(5, 0.0), AbsDiffFrontEQL(DataWindowEquivalentLayer::CFSMAXNL, 0.0), AbsDiffBackEQL(DataWindowEquivalentLayer::CFSMAXNL, 0.0) { diff --git a/src/EnergyPlus/DaylightingManager.cc b/src/EnergyPlus/DaylightingManager.cc index 943355845cf..3a2611f4510 100644 --- a/src/EnergyPlus/DaylightingManager.cc +++ b/src/EnergyPlus/DaylightingManager.cc @@ -529,9 +529,9 @@ void CalcDayltgCoefficients(EnergyPlusData &state) dl->DaylRefPt(thisDayltgCtrl.refPts(refPtNum).num).Name, DaylFac); } // for (refPtNum) - } // for (iSky) - } // for (windowCounter) - } // for (controlNum) + } // for (iSky) + } // for (windowCounter) + } // for (controlNum) dl->FirstTimeDaylFacCalc = false; dl->doSkyReporting = false; } // if (detailedIntegration etc.) @@ -621,11 +621,11 @@ void CalcDayltgCoefficients(EnergyPlusData &state) illums.sky[(int)SkyType::Overcast]); } // for (refPtNum) Reference Point - } // for (IHR) hour - } // for (ISlatAngle) slat angle - } // if (SolarEnclIndex == enclNum) - } // for (windowCounter) exterior windows in enclosure - } // for (controlNum) daylighting control + } // for (IHR) hour + } // for (ISlatAngle) slat angle + } // if (SolarEnclIndex == enclNum) + } // for (windowCounter) exterior windows in enclosure + } // for (controlNum) daylighting control } // CalcDayltgCoefficients() void CalcDayltgCoeffsRefMapPoints(EnergyPlusData &state) @@ -804,9 +804,9 @@ void CalcDayltgCoeffsRefPoints(EnergyPlusData &state, int const daylightCtrlNum) daylFac[iLum_Source] = Illums(); daylFac[iLum_Back] = Illums(); } // for (iSlatAng) - } // for (iRefPt) - } // for (iWin) - } // for (iHr) + } // for (iRefPt) + } // for (iWin) + } // for (iHr) BRef = 0; @@ -961,7 +961,7 @@ void CalcDayltgCoeffsRefPoints(EnergyPlusData &state, int const daylightCtrlNum) TVISIntWin, TVISIntWinDisk); - } // End of hourly sun position loop, IHR + } // End of hourly sun position loop, IHR } else { // timestep integrated if (state.dataEnvrn->SunIsUp && !dl->MySunIsUpFlag) { ISunPos = 0; @@ -1014,7 +1014,7 @@ void CalcDayltgCoeffsRefPoints(EnergyPlusData &state, int const daylightCtrlNum) } } // End of window Y-element loop, IY - } // End of window X-element loop, IX + } // End of window X-element loop, IX // Loop again over hourly sun positions and calculate daylight factors by adding // direct and inter-reflected illum components, then dividing by exterior horiz illum. @@ -1368,7 +1368,7 @@ void CalcDayltgCoeffsMapPoints(EnergyPlusData &state, int const mapNum) mapNum); } } // End of window Y-element loop, IY - } // End of window X-element loop, IX + } // End of window X-element loop, IX if (!state.dataSysVars->DetailedSolarTimestepIntegration) { // Loop again over hourly sun positions and calculate daylight factors by adding @@ -1976,7 +1976,7 @@ void FigureDayltgCoeffsAtPointsForWindowElements( hitIntObs = true; } } // End of check if this is an ext win in an adjacent zone - } // End of check if TDD:Diffuser or regular exterior window or complex fenestration + } // End of check if TDD:Diffuser or regular exterior window or complex fenestration // Check for interior obstructions if (extWinType == ExtWinType::InZone && !hitIntObs) { @@ -2381,9 +2381,9 @@ void InitializeCFSStateData(EnergyPlusData &state, ++TotHits; } } // if (.NOT.Surface(JSurf)%HeatTransSurf .AND. Surface(JSurf)%SchedShadowSurfIndex == 0) then - } // if (TotHits > 1) then - } // if (TransRSurf > 0.0d0) then - } else { // if (HitDsq >= LeastHitDsq) then + } // if (TotHits > 1) then + } // if (TransRSurf > 0.0d0) then + } else { // if (HitDsq >= LeastHitDsq) then // A new closest hit. If it is opaque, drop the current hit list, // otherwise add it at the front LeastHitDsq = HitDsq; @@ -2450,7 +2450,7 @@ void InitializeCFSStateData(EnergyPlusData &state, StateRefPoint.HitSurfDSq({1, MaxTotHits}, {1, NReflSurf}, curWinEl) = TmpHSurfDSq({1, MaxTotHits}, {1, NReflSurf}); StateRefPoint.HitPt({1, MaxTotHits}, {1, NReflSurf}, curWinEl) = TmpHitPt({1, MaxTotHits}, {1, NReflSurf}); } // do IY = 1, NWY - } // do IX = 1, NWX + } // do IX = 1, NWX } void AllocateForCFSRefPointsState( @@ -2745,7 +2745,7 @@ Real64 CalcObstrMultiplier(EnergyPlusData &state, // Sky is hit SkyGndObs += IncAngSolidAngFac; } // End of azimuth loop - } // End of altitude loop + } // End of altitude loop // in case ground point is surrounded by obstructions (SkyGndUnObs == 0), then multiplier will be equal to zero // This should not happen anyway because in that case ray would not be able to reach ground point @@ -3032,7 +3032,7 @@ void FigureDayltgCoeffsAtPointsForSunPosition( // Contribution from beam solar reflected from ground (beam reaching ground point // can be obstructed [SunObstructionMult < 1.0] if CalcSolRefl = .TRUE.) } // End of check if ray is going up or down - } // for (iSky) + } // for (iSky) if (PHRAY <= 0.0) { // SunObstructionMult = 1.0; //Tuned @@ -3117,7 +3117,7 @@ void FigureDayltgCoeffsAtPointsForSunPosition( Window::POLYF(COSBIntWin, state.dataConstruction->Construct(surfIntWinDisk.Construction).TransVisBeamCoef); break; } // for (IntWinDisk) - } // for (spaceNum) + } // for (spaceNum) if (!hitIntWinDisk) { // Vector from RP to sun does not pass through interior window ObTransDisk = 0.0; @@ -3240,10 +3240,10 @@ void FigureDayltgCoeffsAtPointsForSunPosition( dl->avgWinLum(iHour)[iWinCover_Shaded].sunDisk = XAVWL * TVISS * transBmBmMult * ObTransDisk; } } // Position Factor - } // if (calledFrom == RefPt) - } // if (ObTransDisk > 1e-6) // Beam avoids all obstructions - } // if (hitWin) - } // if (COSI > 0.0) // Sun on front side + } // if (calledFrom == RefPt) + } // if (ObTransDisk > 1e-6) // Beam avoids all obstructions + } // if (hitWin) + } // if (COSI > 0.0) // Sun on front side // Beam solar reaching reference point after beam-beam (specular) reflection from // an exterior surface @@ -3405,11 +3405,11 @@ void FigureDayltgCoeffsAtPointsForSunPosition( } } } // End of check that obstruction can specularly reflect - } // End of loop over obstructions associated with this window + } // End of loop over obstructions associated with this window } // End of check if this window has associated obstructions - } // End of check to see if this is exterior type window - } // End of check if exterior reflection calculation is in effect + } // End of check to see if this is exterior type window + } // End of check if exterior reflection calculation is in effect } // Last pass @@ -3846,8 +3846,8 @@ void GetDaylightingParametersInput(EnergyPlusData &state) varKey); } } // for (controlNum) - } // for (enclSurfNum) - } // for (enclNum) + } // for (enclSurfNum) + } // for (enclNum) } // RJH DElight Modification Begin - Calls to DElight preprocessing subroutines @@ -4255,8 +4255,8 @@ void GetInputIlluminanceMap(EnergyPlusData &state, bool &ErrorsFound) (refPt.absCoords.z < zone.MinimumZ) ? (zone.MinimumZ - refPt.absCoords.z) : (refPt.absCoords.z - zone.MaximumZ))); } } // for (X) - } // for (Y) - } // for (MapNum) + } // for (Y) + } // for (MapNum) ZoneMsgDone.dimension(state.dataGlobal->NumOfZones, false); for (auto const &illumMap : dl->illumMaps) { @@ -4556,7 +4556,7 @@ void GetDaylightingControls(EnergyPlusData &state, bool &ErrorsFound) OutputProcessor::StoreType::Sum, daylightControl.Name); } // if (DaylightMethod == SplitFlux) - } // for (RefPtNum) + } // for (RefPtNum) // Register Error if 0 DElight RefPts have been input for valid DElight object if (countRefPts < 1) { @@ -4727,7 +4727,7 @@ void GeometryTransformForDaylighting(EnergyPlusData &state) (refPt.absCoords.z < zone.MinimumZ) ? (zone.MinimumZ - refPt.absCoords.z) : (refPt.absCoords.z - zone.MaximumZ))); } } // for (refPt) - } // for (daylightCtrl) + } // for (daylightCtrl) } // GeometryTransformForDaylighting() void GetInputDayliteRefPt(EnergyPlusData &state, bool &ErrorsFound) @@ -5486,9 +5486,9 @@ void initDaylighting(EnergyPlusData &state, bool const initSurfaceHeatBalancefir refPt.lumWinRep = daylCtrlRefPt.extWins(extWinNum).lums[iLum_Source][(int)winCover]; } } // for (controlNum) - } // for (extWinNum) - } // for (enclNum) - } // if (SunIsUp) + } // for (extWinNum) + } // for (enclNum) + } // if (SunIsUp) if (state.dataEnvrn->SunIsUp && (int)state.dataDaylightingDevicesData->TDDPipe.size() > 0) { if (initSurfaceHeatBalancefirstTime) DisplayString(state, "Computing Interior Daylighting Illumination for TDD pipes"); @@ -5883,7 +5883,7 @@ void DayltgInteriorIllum(EnergyPlusData &state, bfhr2.sky[iSky] = VTRatio * (wgtCurrHr * backFac2Curr.sky[iSky] + wgtPrevHr * backFac2Prev.sky[iSky]); sfhr2.sky[iSky] = VTRatio * (wgtCurrHr * sourceFac2Curr.sky[iSky] + wgtPrevHr * sourceFac2Prev.sky[iSky]); } // End of check if window is shaded or has diffusing glass - } // for (iSky) + } // for (iSky) // Sun daylight factor for bare/shaded window DFHR[iWinCover_Bare].sun = @@ -5961,7 +5961,7 @@ void DayltgInteriorIllum(EnergyPlusData &state, } // for for (iWinCover) } // End of reference point loop, IL - } // End of first loop over exterior windows associated with this zone + } // End of first loop over exterior windows associated with this zone // Initialize flag that one or more windows has switchable glazing // control that adjusts visible transmittance to just meet dayltg setpoint @@ -6045,7 +6045,7 @@ void DayltgInteriorIllum(EnergyPlusData &state, !previously_shaded(loop) ? daylFromWinAtRefPt[(int)winCover] : daylFromWinAtRefPt[iWinCover_Shaded]; } } // for (IWin) - } // for (igroup) + } // for (igroup) // Transmittance multiplier for (auto &shadeGroupLums : shadeGroupsLums) { @@ -6130,7 +6130,7 @@ void DayltgInteriorIllum(EnergyPlusData &state, daylFromWinAtRefPt[iLum_Back][iWinCover_Shaded] = VTRAT * tmpDayl[iLum_Back][iWinCover_Shaded]; daylFromWinAtRefPt[iLum_Source][iWinCover_Shaded] = VTRAT * tmpDayl[iLum_Source][iWinCover_Shaded]; } // for (IL) - } // if (loop > 0 && ASETIL < 1) + } // if (loop > 0 && ASETIL < 1) // If new daylight does not exceed the illuminance setpoint, done, no more checking other groups of switchable glazings if (dl->DaylIllum(1) <= SetPnt(1)) { breakOuterLoop = true; @@ -6181,7 +6181,7 @@ void DayltgInteriorIllum(EnergyPlusData &state, s_surf->SurfWinShadingFlag(IWin) = WinShadingType::ShadeOff; } } // for (IWin) - } // for (igroup) + } // for (igroup) // Calculate glare index at each reference point assuming the daylight illuminance setpoint is // met at both reference points, either by daylight or electric lights @@ -6311,8 +6311,8 @@ void DayltgInteriorIllum(EnergyPlusData &state, shadeGroupLums.switchedTvis = Window::POLYF(1.0, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac; } // if (switchableGlazing) - } // if (GlareControlIsActive) - } // for (IWin) + } // if (GlareControlIsActive) + } // for (IWin) if (continueOuterLoop) continue; if (atLeastOneGlareControlIsActive) { @@ -6565,11 +6565,11 @@ void DayltgInteriorIllum(EnergyPlusData &state, break; } } // if (glareOK) - } // if (glareControlIsActive) - } // for (IWin) + } // if (glareControlIsActive) + } // for (IWin) if (breakOuterLoop) break; } // for (igroup) - } // if (GlareFlag) + } // if (GlareFlag) // Loop again over windows and reset remaining shading flags that // are 10 or higher (i.e., conditionally off) to off @@ -6766,8 +6766,8 @@ void DayltgElecLightingControl(EnergyPlusData &state) FP += (1.0 / double(thisDayltgCtrl.LightControlSteps)); } } // XRAN - } // Light Control Probability < 1 - } // Lighting System Type + } // Light Control Probability < 1 + } // Lighting System Type refPt.powerReductionFactor = FP; @@ -6816,7 +6816,7 @@ void DayltgElecLightingControl(EnergyPlusData &state) } } } // for (mapNum) - } // if (MapSize > 0) + } // if (MapSize > 0) } // DayltgElecLightingControl() Real64 DayltgGlarePositionFactor(Real64 X, // Lateral and vertical distance of luminous window element from @@ -7314,7 +7314,7 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, // cosine of incidence angle of light from sky or ground element for COSBintWin = SPH * std::sin(surfIntWin.phi) + CPH * std::cos(surfIntWin.phi) * std::cos(TH - surfIntWin.theta); TVISBR *= Window::POLYF(COSBintWin, - state.dataConstruction->Construct(s_surf->Surface(IntWinNum).Construction).TransVisBeamCoef); + state.dataConstruction->Construct(s_surf->Surface(IntWinNum).Construction).TransVisBeamCoef); break; } } @@ -7342,7 +7342,7 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, } } // End of check if window with daylighting shelf or normal window - } // End of check if TDD:DOME or bare window + } // End of check if TDD:DOME or bare window // Check if window has shade or blind ICtrl = s_surf->Surface(IWin).activeWindowShadingControl; @@ -7519,7 +7519,7 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, } // End of window with shade, screen, blind or diffusing glass } // End of azimuth integration loop, ITH - } // End of altitude integration loop, IPH + } // End of altitude integration loop, IPH if (OutShelfSurf > 0) { // Outside daylighting shelf // Add exterior diffuse illuminance due to outside shelf @@ -7559,7 +7559,7 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, eintsk.sky[iSky] = (flfwsk.sky[iSky] * surfWin.rhoFloorWall + flcwsk.sky[iSky] * surfWin.rhoCeilingWall) * (surf.Area / surfWin.glazedFrac) / (EnclInsideSurfArea * (1.0 - dl->enclDaylight(enclNum).aveVisDiffReflect)); } // for (iSky) - } // for (iWinCover) + } // for (iWinCover) // BEAM SOLAR RADIATION ON WINDOW @@ -7706,8 +7706,8 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, FLFW[iWinCover_Shaded].sunDisk = ZSU1 * transBmBmMult; FLCW[iWinCover_Shaded].sun += ZSU1 * transMult * surfWin.fractionUpgoing; } // if (BlindOn || ShadeOn) - } // if (COSBSun > 0) - } // if (SurfSunlitFracHR > 0) + } // if (COSBSun > 0) + } // if (SurfSunlitFracHR > 0) // Beam reaching window after specular reflection from exterior obstruction @@ -7780,14 +7780,14 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, surfWin.lightWellEff; } } // End of check of interior/exterior/between-glass blind - } // if (Blind) + } // if (Blind) dl->winLum(IHR)[iWinCover_Shaded].sun += ZSU1refl * transMult / Constant::Pi; FLFW[iWinCover_Shaded].sun += ZSU1refl * transMult * (1.0 - surfWin.fractionUpgoing); FLCW[iWinCover_Shaded].sun += ZSU1refl * transMult * surfWin.fractionUpgoing; } // End of check if window has shade, blind or diffusing glass - } // End of check if ZSU1refl > 0.0 - } // End of check if solar reflections are in effect + } // End of check if ZSU1refl > 0.0 + } // End of check if solar reflections are in effect // Sun-related portion of internally reflected illuminance @@ -8474,7 +8474,7 @@ void DayltgClosestObstruction(EnergyPlusData &state, NearestHitPt = HitPt; } } // End of check if obstruction was hit - } // for (ObsSurfNum) + } // for (ObsSurfNum) } else { // Surface octree search @@ -8719,7 +8719,7 @@ void DayltgInteriorMapIllum(EnergyPlusData &state) // Shade, screen, blind with fixed slats, or diffusing glass dfhrSh.sky[iSky] = VTRatio * (wgtThisHr * illShSkyCurr.sky[iSky] + wgtPrevHr * illShSkyPrev.sky[iSky]); } // End of check if window is shaded or has diffusing glass - } // for (iSky) + } // for (iSky) // Sun daylight factor for bare/shaded window std::array tmpDFHR; @@ -8768,7 +8768,7 @@ void DayltgInteriorMapIllum(EnergyPlusData &state) } } // End of reference point loop - } // End of first loop over windows + } // End of first loop over windows // Second loop over windows. Find total daylight illuminance // and background luminance for each ref pt from all windows in @@ -8959,7 +8959,7 @@ void ReportIllumMap(EnergyPlusData &state, int const MapNum) dl->IllumValue(X, Y) = -dl->IllumValue(X, Y); } } // X Loop - } // Y Loop + } // Y Loop // We need DataGlobals::CalendarYear, and not DataEnvironment::Year because // otherwise if you run a TMY file, you'll get for eg 1977, 1981, etc @@ -8975,8 +8975,8 @@ void ReportIllumMap(EnergyPlusData &state, int const MapNum) dl->IllumValue); } // WriteOutputToSQLite - } // end time step - } // not Warmup + } // end time step + } // not Warmup } void CloseReportIllumMaps(EnergyPlusData &state) @@ -9208,9 +9208,9 @@ void DayltgSetupAdjZoneListsAndPointers(EnergyPlusData &state) intWinAdjEnclExtWin.IntWinNum(++IntWinIndex) = SurfNumAdj2; } } // for (SurfNumAdj2) - } // for (SurfNumAdj) - } // for (adjEnclNum) - } // End of primary enclosure loop + } // for (SurfNumAdj) + } // for (adjEnclNum) + } // End of primary enclosure loop Array1D_int enclExtWin; enclExtWin.dimension(state.dataViewFactor->NumOfSolarEnclosures, 0); @@ -9245,7 +9245,7 @@ void DayltgSetupAdjZoneListsAndPointers(EnergyPlusData &state) } } } // for (adjEnclNum) - } // for (enclNum) + } // for (enclNum) dl->maxShadeDeployOrderExtWins = 0; for (int enclNum = 1; enclNum <= state.dataViewFactor->NumOfSolarEnclosures; ++enclNum) { @@ -9309,8 +9309,8 @@ void DayltgSetupAdjZoneListsAndPointers(EnergyPlusData &state) } } } // for (SurfNumAdj) - } // for (adjEnclNum) - } // if (thisEnclDaylight.NumOfIntWinAdjEncls > 0) + } // for (adjEnclNum) + } // if (thisEnclDaylight.NumOfIntWinAdjEncls > 0) thisEnclDaylight.NumOfDayltgExtWins = enclExtWin(enclNum); int winSize = enclExtWin(enclNum); @@ -9495,7 +9495,7 @@ void MapShadeDeploymentOrderToLoopNumber(EnergyPlusData &state, int const enclNu } } } // for (listOfExtWin) - } // for (controlNum) + } // for (controlNum) } // MapShadeDeploymentOrderToLoopNumber() void DayltgInterReflIllFrIntWins(EnergyPlusData &state, int const enclNum) @@ -9632,9 +9632,9 @@ void CalcMinIntWinSolidAngs(EnergyPlusData &state) thisEnclDaylight.MinIntWinSolidAng = min(thisEnclDaylight.MinIntWinSolidAng, IntWinSolidAng); } } // for (IL) - } // for (controlNum) - } // for (IWin) - } // for (enclNum) + } // for (controlNum) + } // for (IWin) + } // for (enclNum) } void CheckForGeometricTransform(EnergyPlusData &state, bool &doTransform, Real64 &OldAspectRatio, Real64 &NewAspectRatio) diff --git a/src/EnergyPlus/HeatBalanceManager.cc b/src/EnergyPlus/HeatBalanceManager.cc index 8030bafdab2..68247acb3e0 100644 --- a/src/EnergyPlus/HeatBalanceManager.cc +++ b/src/EnergyPlus/HeatBalanceManager.cc @@ -1976,7 +1976,7 @@ namespace HeatBalanceManager { ErrorsFound = true; } } // Loop - } // ZoneNum + } // ZoneNum } } // ListNum @@ -3622,30 +3622,31 @@ namespace HeatBalanceManager { int FrDivNum; // FrameDivider number Array1D WinHeight(2); // Height, width for glazing system (m) Array1D WinWidth(2); - Array1D UValCenter(2); // Center of glass U-value (W/m2-K) for glazing system - Array1D SCCenter(2); // Center of glass shading coefficient for glazing system - Array1D SHGCCenter(2); // Center of glass solar heat gain coefficient for glazing system - Array1D TVisCenter(2); // Center of glass visible transmittance for glazing system - Array1D TsolTemp(Window::numPhis+1); // Solar transmittance vs incidence angle; diffuse trans. + Array1D UValCenter(2); // Center of glass U-value (W/m2-K) for glazing system + Array1D SCCenter(2); // Center of glass shading coefficient for glazing system + Array1D SHGCCenter(2); // Center of glass solar heat gain coefficient for glazing system + Array1D TVisCenter(2); // Center of glass visible transmittance for glazing system + Array1D TsolTemp(Window::numPhis + 1); // Solar transmittance vs incidence angle; diffuse trans. std::array Tsol; - Array2D AbsSolTemp(Window::maxGlassLayers, Window::numPhis+1); // Solar absorptance vs inc. angle in each glass layer - Array1D> AbsSol(Window::maxGlassLayers); // Solar absorptance vs inc. angle in each glass layer - Array1D RfsolTemp(Window::numPhis+1); // Front solar reflectance vs inc. angle + Array2D AbsSolTemp(Window::maxGlassLayers, Window::numPhis + 1); // Solar absorptance vs inc. angle in each glass layer + Array1D> AbsSol(Window::maxGlassLayers); // Solar absorptance vs inc. angle in each glass layer + Array1D RfsolTemp(Window::numPhis + 1); // Front solar reflectance vs inc. angle std::array Rfsol; - Array1D RbsolTemp(Window::numPhis+1); // Back solar reflectance vs inc. angle + Array1D RbsolTemp(Window::numPhis + 1); // Back solar reflectance vs inc. angle std::array Rbsol; - Array1D TvisTemp(Window::numPhis+1); // Visible transmittance vs inc. angle + Array1D TvisTemp(Window::numPhis + 1); // Visible transmittance vs inc. angle std::array Tvis; - Array1D RfvisTemp(Window::numPhis+1); // Front visible reflectance vs inc. angle + Array1D RfvisTemp(Window::numPhis + 1); // Front visible reflectance vs inc. angle std::array Rfvis; - Array1D RbvisTemp(Window::numPhis+1); // Back visible reflectance vs inc. angle + Array1D RbvisTemp(Window::numPhis + 1); // Back visible reflectance vs inc. angle std::array Rbvis; - - std::array tsolFit; // Fitted solar transmittance vs incidence angle - std::array tvisFit; // Fitted visible transmittance vs incidence angle - std::array rfsolFit; // Fitted solar front reflectance vs incidence angle - Array1D> solabsFit(Window::maxGlassLayers); // Fitted solar absorptance vs incidence angle for each glass layer - Array1D_string DividerType(2); // Divider type: DividedLite or Suspended + + std::array tsolFit; // Fitted solar transmittance vs incidence angle + std::array tvisFit; // Fitted visible transmittance vs incidence angle + std::array rfsolFit; // Fitted solar front reflectance vs incidence angle + Array1D> solabsFit( + Window::maxGlassLayers); // Fitted solar absorptance vs incidence angle for each glass layer + Array1D_string DividerType(2); // Divider type: DividedLite or Suspended Real64 FrameWidth; Real64 MullionWidth; Real64 FrameProjectionOut; @@ -4239,7 +4240,7 @@ namespace HeatBalanceManager { ShowContinueError(state, format("Line (~{}) in error (first 100 characters)={}", FileLineCount, NextLine.data.substr(0, 100))); ErrorsFound = true; } - + for (IGlass = 1; IGlass <= NGlass(IGlSys); ++IGlass) { NextLine = W5DataFile.readLine(); ++FileLineCount; @@ -4320,20 +4321,20 @@ namespace HeatBalanceManager { DesiredConstructionName)); for (int iPhi = 0; iPhi < Window::numPhis; ++iPhi) { - Tsol[iPhi] = TsolTemp(iPhi+1); - Tvis[iPhi] = TvisTemp(iPhi+1); - Rfsol[iPhi] = RfsolTemp(iPhi+1); - Rbsol[iPhi] = RbsolTemp(iPhi+1); - Rfvis[iPhi] = RfvisTemp(iPhi+1); - Rbvis[iPhi] = RbvisTemp(iPhi+1); + Tsol[iPhi] = TsolTemp(iPhi + 1); + Tvis[iPhi] = TvisTemp(iPhi + 1); + Rfsol[iPhi] = RfsolTemp(iPhi + 1); + Rbsol[iPhi] = RbsolTemp(iPhi + 1); + Rfvis[iPhi] = RfvisTemp(iPhi + 1); + Rbvis[iPhi] = RbvisTemp(iPhi + 1); } for (IGlass = 1; IGlass <= NGlass(IGlSys); ++IGlass) { for (int iPhi = 0; iPhi < Window::numPhis; ++iPhi) { - AbsSol(IGlass)[iPhi] = AbsSolTemp(IGlass, iPhi+1); + AbsSol(IGlass)[iPhi] = AbsSolTemp(IGlass, iPhi + 1); } } - + // Hemis thisConstruct.TransDiff = TsolTemp(11); thisConstruct.TransDiffVis = TvisTemp(11); @@ -4342,7 +4343,7 @@ namespace HeatBalanceManager { thisConstruct.ReflectVisDiffFront = RfvisTemp(11); thisConstruct.ReflectVisDiffBack = RbvisTemp(11); - // Using pre-calculated/hard-coded cosPhis in this module is okay. Shrug. + // Using pre-calculated/hard-coded cosPhis in this module is okay. Shrug. Window::W5LsqFit(Window::cosPhis, Tsol, thisConstruct.TransSolBeamCoef); Window::W5LsqFit(Window::cosPhis, Tvis, thisConstruct.TransVisBeamCoef); Window::W5LsqFit(Window::cosPhis, Rfsol, thisConstruct.ReflSolBeamFrontCoef); @@ -4356,7 +4357,7 @@ namespace HeatBalanceManager { tvisFit[iPhi] = Window::POLYF(Window::cosPhis[iPhi], thisConstruct.TransVisBeamCoef); rfsolFit[iPhi] = Window::POLYF(Window::cosPhis[iPhi], thisConstruct.ReflSolBeamFrontCoef); for (IGlass = 1; IGlass <= NGlass(IGlSys); ++IGlass) { - solabsFit(IGlass)[iPhi] = Window::POLYF(Window::cosPhis[iPhi], thisConstruct.AbsBeamCoef(IGlass)); + solabsFit(IGlass)[iPhi] = Window::POLYF(Window::cosPhis[iPhi], thisConstruct.AbsBeamCoef(IGlass)); } } // end diff --git a/src/EnergyPlus/SolarShading.cc b/src/EnergyPlus/SolarShading.cc index 1bebd923eaf..7d99b653c13 100644 --- a/src/EnergyPlus/SolarShading.cc +++ b/src/EnergyPlus/SolarShading.cc @@ -2363,7 +2363,7 @@ void AllocateModuleArrays(EnergyPlusData &state) surf.Name); } } // end non extsolar reporting as advanced variables - } // Window Reporting + } // Window Reporting if (surf.Class == SurfaceClass::Window && surf.ExtBoundCond > 0 && surf.ExtBoundCond != SurfLoop) { // Interzone window // CurrentModuleObject='InterzoneWindows' SetupOutputVariable(state, @@ -4826,9 +4826,9 @@ void CalcPerSolarBeam(EnergyPlusData &state, } } } // for (timestep) - } // for (hour) - } // for (spaceNum) - } // for (zoneNum) + } // for (hour) + } // for (spaceNum) + } // for (zoneNum) for (auto &e : s_surf->SurfaceWindow) { std::fill(e.OutProjSLFracMult.begin(), e.OutProjSLFracMult.end(), 1.0); @@ -4880,7 +4880,7 @@ void CalcPerSolarBeam(EnergyPlusData &state, for (TS = 1; TS <= state.dataGlobal->NumOfTimeStepInHour; ++TS) { FigureSolarBeamAtTimestep(state, iHour, TS); } // TimeStep Loop - } // Hour Loop + } // Hour Loop } else { FigureSolarBeamAtTimestep(state, state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep); } @@ -5050,8 +5050,8 @@ void FigureSolarBeamAtTimestep(EnergyPlusData &state, int const iHour, int const state.dataSolarShading->SurfWoShdgHoriz(SurfNum) += Fac1WoShdg; } } // End of surface loop - } // End of Theta loop - } // End of Phi loop + } // End of Theta loop + } // End of Phi loop for (int SurfNum : s_surf->AllExtSolAndShadingSurfaceList) { // Original conditions: @@ -5337,7 +5337,7 @@ void DetermineShadowingCombinations(EnergyPlusData &state) } } - } // ...end of surfaces DO loop (GSSNR) + } // ...end of surfaces DO loop (GSSNR) } else { // Simplified Distribution -- still check for Shading Subsurfaces for (GSSNR = 1; GSSNR <= s_surf->TotSurfaces; ++GSSNR) { // Loop through all surfaces (looking for surfaces which could shade GRSNR) ... @@ -6493,7 +6493,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) BackBeamAbs = Interp(btarBack1Lo.Abs, btarBack1Hi.Abs, profInterpFac); } } // if (SunLitFrac > 0.0) - } // if (ANY_BLIND) + } // if (ANY_BLIND) if (SunlitFracWithoutReveal) { @@ -6539,7 +6539,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) if (ShadeFlag == WinShadingType::IntShade) { // Exterior beam absorbed by INTERIOR SHADE // Note that AbsBeamShadeCoef includes effect of shade/glazing inter-reflection Real64 AbsShade = Window::POLYF(CosInc, - thisConstructSh.AbsBeamShadeCoef); // Interior shade or blind beam solar absorptance + thisConstructSh.AbsBeamShadeCoef); // Interior shade or blind beam solar absorptance state.dataSolarShading->SurfWinExtBeamAbsByShadFac(SurfNum) = (AbsShade * CosInc * SunLitFract * InOutProjSLFracMult + s_surf->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * thisConstructSh.AbsDiffShade) * @@ -6596,8 +6596,8 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 RhoBlBack = BackBeamDiffRefl; // Blind solar back beam-diffuse reflectance Real64 RhoBlDiffBack = BackDiffDiffRefl; // Blind solar back diffuse reflectance Real64 RGlFront = - Window::POLYF(CosInc, thisConstruct.ReflSolBeamFrontCoef); // Glazing system solar front beam-beam reflectance - Real64 RGlDiffFront = thisConstruct.ReflectSolDiffFront; // Glazing system front diffuse solar reflectance + Window::POLYF(CosInc, thisConstruct.ReflSolBeamFrontCoef); // Glazing system solar front beam-beam reflectance + Real64 RGlDiffFront = thisConstruct.ReflectSolDiffFront; // Glazing system front diffuse solar reflectance for (int Lay = 1; Lay <= NGlass; ++Lay) { Real64 ADiffWin = thisConstruct.AbsDiff(Lay); // Diffuse solar absorptance of glass layer, bare window Real64 AGlDiffFront = thisConstruct.AbsDiff(Lay); // Glass layer front diffuse solar absorptance @@ -6647,9 +6647,10 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 RScBack = BilinearInterp(b11.RefSolFront, b12.RefSolFront, b21.RefSolFront, b22.RefSolFront, coeffs); Real64 RScDifBack = screen->DfRef; - Real64 RGlFront = Window::POLYF(CosInc, thisConstruct.ReflSolBeamFrontCoef); // Glazing system solar front beam-beam reflectance - Real64 RGlDiffFront = thisConstruct.ReflectSolDiffFront; // Glazing system front diffuse solar reflectance - Real64 RGlDifFr = thisConstruct.ReflectSolDiffFront; // Diffuse front reflectance of glass + Real64 RGlFront = + Window::POLYF(CosInc, thisConstruct.ReflSolBeamFrontCoef); // Glazing system solar front beam-beam reflectance + Real64 RGlDiffFront = thisConstruct.ReflectSolDiffFront; // Glazing system front diffuse solar reflectance + Real64 RGlDifFr = thisConstruct.ReflectSolDiffFront; // Diffuse front reflectance of glass // Reduce the bare window absorbed beam by the screen beam transmittance and then account for // interreflections for (int Lay = 1; Lay <= NGlass; ++Lay) { @@ -6675,9 +6676,10 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 RScBack = btar.RefSolFront; Real64 RScDifBack = screen->DfRef; - Real64 RGlFront = Window::POLYF(CosInc, thisConstruct.ReflSolBeamFrontCoef); // Glazing system solar front beam-beam reflectance - Real64 RGlDiffFront = thisConstruct.ReflectSolDiffFront; // Glazing system front diffuse solar reflectance - Real64 RGlDifFr = thisConstruct.ReflectSolDiffFront; // Diffuse front reflectance of glass + Real64 RGlFront = + Window::POLYF(CosInc, thisConstruct.ReflSolBeamFrontCoef); // Glazing system solar front beam-beam reflectance + Real64 RGlDiffFront = thisConstruct.ReflectSolDiffFront; // Glazing system front diffuse solar reflectance + Real64 RGlDifFr = thisConstruct.ReflectSolDiffFront; // Diffuse front reflectance of glass // Reduce the bare window absorbed beam by the screen beam transmittance and then account for // interreflections for (int Lay = 1; Lay <= NGlass; ++Lay) { @@ -6698,13 +6700,15 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // Between-glass blind o // Isolated glass and blind properties at current incidence angle, profile angle and slat angle Real64 t1 = Window::POLYF(CosInc, - thisConstruct.tBareSolCoef(1)); // Bare-glass beam solar trans for glass layers 1,2 and 3 + thisConstruct.tBareSolCoef(1)); // Bare-glass beam solar trans for glass layers 1,2 and 3 Real64 t2 = Window::POLYF(CosInc, thisConstruct.tBareSolCoef(2)); - Real64 af1 = Window::POLYF(CosInc, - thisConstruct.afBareSolCoef(1)); // Bare-glass beam solar front abs for glass layers 1,2 and 3 + Real64 af1 = + Window::POLYF(CosInc, + thisConstruct.afBareSolCoef(1)); // Bare-glass beam solar front abs for glass layers 1,2 and 3 Real64 af2 = Window::POLYF(CosInc, thisConstruct.afBareSolCoef(2)); - Real64 ab1 = Window::POLYF(CosInc, - thisConstruct.abBareSolCoef(1)); // Bare-glass beam solar back absorptance for glass layers 1,2 and 3 + Real64 ab1 = Window::POLYF( + CosInc, + thisConstruct.abBareSolCoef(1)); // Bare-glass beam solar back absorptance for glass layers 1,2 and 3 Real64 ab2 = Window::POLYF(CosInc, thisConstruct.abBareSolCoef(2)); Real64 rf2 = Window::POLYF(CosInc, thisConstruct.rfBareSolCoef(2)); Real64 td1 = thisConstruct.tBareSolDiff(1); // Bare-glass diffuse solar transmittance for glass layers 1,2 and 3 @@ -6782,7 +6786,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) AbsShade * CosInc * SunLitFract * InOutProjSLFracMult + s_surf->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * AbsShadeDiff; } // End of check if blind is interior, exterior or between-glass - } // End of check if a blind is on + } // End of check if a blind is on if (ShadeFlag != WinShadingType::SwitchableGlazing) { // Interior or between glass shade or blind on @@ -6996,9 +7000,9 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) state.dataDaylightingDevicesData->TDDPipe(PipeNum).TransSolBeam = TBmDif; // Report variable } else if (s_surf->SurfWinWindowModelType(SurfNum) == WindowModel::Detailed) { // Regular window if (!s_surf->SurfWinSolarDiffusing(SurfNum)) { // Clear glazing - TBmBm = Window::POLYF(CosInc, thisConstruct.TransSolBeamCoef); //[-] + TBmBm = Window::POLYF(CosInc, thisConstruct.TransSolBeamCoef); //[-] } else { // Diffusing glazing - TBmDif = Window::POLYF(CosInc, thisConstruct.TransSolBeamCoef); //[-] + TBmDif = Window::POLYF(CosInc, thisConstruct.TransSolBeamCoef); //[-] } } else if (s_surf->SurfWinWindowModelType(SurfNum) == WindowModel::BSDF) { // Need to check what effect, if any, defining these here has @@ -7080,7 +7084,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 RScDifBack = screen->DfRef; Real64 RGlBmFr = Window::POLYF(CosInc, thisConstruct.ReflSolBeamFrontCoef); // Beam front reflectance of glass - Real64 RGlDifFr = thisConstruct.ReflectSolDiffFront; // Diffuse front reflectance of glass + Real64 RGlDifFr = thisConstruct.ReflectSolDiffFront; // Diffuse front reflectance of glass // beam transmittance (written in subroutine CalcScreenTransmittance each time step) TScBmBm = BilinearInterp(b11.BmTrans, b12.BmTrans, b21.BmTrans, b22.BmTrans, coeffs); TBmBmSc = TBmBm * TScBmBm; @@ -7102,7 +7106,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 RScDifBack = screen->DfRef; Real64 RGlBmFr = Window::POLYF(CosInc, thisConstruct.ReflSolBeamFrontCoef); // Beam front reflectance of glass - Real64 RGlDifFr = thisConstruct.ReflectSolDiffFront; // Diffuse front reflectance of glass + Real64 RGlDifFr = thisConstruct.ReflectSolDiffFront; // Diffuse front reflectance of glass // beam transmittance (written in subroutine CalcScreenTransmittance each time step) TScBmBm = btar.BmTrans; TBmBmSc = TBmBm * TScBmBm; @@ -7186,8 +7190,8 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) } } } // End of check if ShadeFlag > 0 and ShadeFlag < 10 - } // end of checking if not eql window model - } // end of checking if sunlitfract > 0 + } // end of checking if not eql window model + } // end of checking if sunlitfract > 0 if (ShadeFlag == WinShadingType::SwitchableGlazing) { // Switchable glazing @@ -7430,8 +7434,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // or interior window WITHOUT SHADING this timestep if (NOT_SHADED(ShadeFlagBack)) { for (int Lay = 1; Lay <= NBackGlass; ++Lay) { - state.dataSolarShading->SurfWinAbsBeam(Lay) = - Window::POLYF(CosIncBack, constrBack.AbsBeamBackCoef(Lay)); + state.dataSolarShading->SurfWinAbsBeam(Lay) = Window::POLYF(CosIncBack, constrBack.AbsBeamBackCoef(Lay)); } TransBeamWin = Window::POLYF(CosIncBack, constrBack.TransSolBeamCoef); } @@ -7441,7 +7444,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) if (ANY_SHADE(ShadeFlagBack)) { for (int Lay = 1; Lay <= state.dataConstruction->Construct(ConstrNumBackSh).TotGlassLayers; ++Lay) { state.dataSolarShading->SurfWinAbsBeam(Lay) = - Window::POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBackSh).AbsBeamBackCoef(Lay)); + Window::POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBackSh).AbsBeamBackCoef(Lay)); } TransBeamWin = Window::POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBackSh).TransSolBeamCoef); } @@ -7537,10 +7540,13 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Interp(btar.Sol.Bk.Bm[profIdxLoBack].Abs, btar.Sol.Bk.Bm[profIdxHiBack].Abs, profInterpFacBack); Real64 RhoBlDiffFront = FrontDiffDiffRefl; // Glazing system solar back beam-beam reflectance - Real64 RGlBack = Window::POLYF(CosIncBack, constrBack.ReflSolBeamBackCoef); // Glazing system back diffuse solar reflectance + Real64 RGlBack = Window::POLYF( + CosIncBack, constrBack.ReflSolBeamBackCoef); // Glazing system back diffuse solar reflectance Real64 RGlDiffBack = constrBack.ReflectSolDiffBack; for (int Lay = 1; Lay <= NBackGlass; ++Lay) { - Real64 AbWinBack = Window::POLYF(CosIncBack, constrBack.AbsBeamBackCoef(Lay)); // Factor for back beam radiation absorbed in window glass layer + Real64 AbWinBack = Window::POLYF( + CosIncBack, + constrBack.AbsBeamBackCoef(Lay)); // Factor for back beam radiation absorbed in window glass layer Real64 AGlDiffBack = constrBack.AbsDiffBack(Lay); // Glass layer back diffuse solar absorptance state.dataSolarShading->SurfWinAbsBeam(Lay) = TBlBmBmBack * AbWinBack + ((TBlBmBmBack * RGlBack * RhoBlFront + TBlBmDiffBack) * AGlDiffBack / @@ -7548,8 +7554,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) } // Interior beam transmitted by exterior back window with INTERIOR BLIND - Real64 TGlDif = - constrBack.TransDiff; // Bare diffuse transmittance of back window + Real64 TGlDif = constrBack.TransDiff; // Bare diffuse transmittance of back window TransBeamWin = TBlBmBmBack * (TGlBmBack + TGlDif * RGlBack * RhoBlFront / (1.0 - RGlDiffBack * RhoBlDiffFront)) + TBlBmDiffBack * TGlDif / (1.0 - RGlDiffBack * RhoBlDiffFront); @@ -7793,12 +7798,14 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 SwitchFac = s_surf->SurfWinSwitchingFactor(SurfNum); // Switching factor for a window Real64 AbsBeamWinSh; // Glass layer beam solar absorptance of a shaded window for (int Lay = 1; Lay <= NBackGlass; ++Lay) { - AbsBeamWinSh = Window::POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBackSh).AbsBeamBackCoef(Lay)); + AbsBeamWinSh = + Window::POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBackSh).AbsBeamBackCoef(Lay)); state.dataSolarShading->SurfWinAbsBeam(Lay) = Window::InterpSw(SwitchFac, state.dataSolarShading->SurfWinAbsBeam(Lay), AbsBeamWinSh); } // Beam solar transmittance of a shaded window - Real64 TransBeamWinSh = Window::POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBackSh).TransSolBeamCoef); + Real64 TransBeamWinSh = + Window::POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBackSh).TransSolBeamCoef); TransBeamWin = Window::InterpSw(SwitchFac, TransBeamWin, TransBeamWinSh); } @@ -7947,8 +7954,8 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // AWinOverlap array needs to contain flux and not absorbed energy because later in the code // this will be multiplied with window area s_surf->SurfWinACFOverlap(BackSurfaceNumber, Lay) += - constrBack.BSDFInput.Layer(Lay).BkAbs(bestBackTrn, 1) * - CFDirBoverlap(IBack, CurTrnDir) / s_surf->Surface(BackSurfaceNumber).Area; + constrBack.BSDFInput.Layer(Lay).BkAbs(bestBackTrn, 1) * CFDirBoverlap(IBack, CurTrnDir) / + s_surf->Surface(BackSurfaceNumber).Area; // END IF } @@ -8113,7 +8120,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // ***************************** - } // IF (SurfaceWindow(SurfNum)%WindowModelType /= WindowModel:: BSDF) THEN + } // IF (SurfaceWindow(SurfNum)%WindowModelType /= WindowModel:: BSDF) THEN } else { // Simple interior solar distribution. All beam from exterior windows falls on floor; // some of this is absorbed/transmitted, rest is reflected to other surfaces. @@ -8174,10 +8181,10 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) } } // End of loop over floor sections - } // End of check on complex vs. simple interior solar distribution + } // End of check on complex vs. simple interior solar distribution } // End of sunlit fraction > 0 test - } // End of first loop over surfaces in zone + } // End of first loop over surfaces in zone Real64 BABSZoneSSG = 0.0; // Beam radiation from exterior windows absorbed in a zone (only for scheduled surface gains) Real64 BTOTZoneSSG = 0.0; // Solar entering a zone in case of scheduled surface gains @@ -9397,7 +9404,7 @@ void WindowShadingManager(EnergyPlusData &state) // Vis trans at normal incidence of unswitched glass. Counting the GlazedFrac if (IConst > 0) s_surf->SurfWinVisTransSelected(ISurf) = - Window::POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac; + Window::POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac; // Window has shading control // select the active window shading control and corresponding constructions @@ -10135,8 +10142,8 @@ void WindowGapAirflowControl(EnergyPlusData &state) break; } } // End of surface loop - } // End of space loop - } // End of zone loop + } // End of space loop + } // End of zone loop } void SkyDifSolarShading(EnergyPlusData &state) @@ -10312,8 +10319,8 @@ void SkyDifSolarShading(EnergyPlusData &state) state.dataSolarShading->SurfWoShdgHoriz(SurfNum) += Fac1WoShdg; } } // End of surface loop - } // End of Theta loop - } // End of Phi loop + } // End of Theta loop + } // End of Phi loop for (int SurfNum : s_surf->AllExtSolAndShadingSurfaceList) { diff --git a/src/EnergyPlus/WindowManager.cc b/src/EnergyPlus/WindowManager.cc index 7027514f6ab..e1c9cd57bcd 100644 --- a/src/EnergyPlus/WindowManager.cc +++ b/src/EnergyPlus/WindowManager.cc @@ -232,12 +232,12 @@ namespace Window { std::array solabsShadePhi; // These need to stay as Array1D for a little longer because changing them spreads into many source files - std::array tsolPhi; // Glazing system solar transmittance for each angle of incidence - std::array rfsolPhi; // Glazing system solar front reflectance for each angle of incidence - std::array rbsolPhi; // Glazing system solar back reflectance for each angle of incidence - std::array tvisPhi; // Glazing system visible transmittance for each angle of incidence - std::array rfvisPhi; // Glazing system visible front reflectance for each angle of incidence - std::array rbvisPhi; // Glazing system visible back reflectance for each angle of incidence + std::array tsolPhi; // Glazing system solar transmittance for each angle of incidence + std::array rfsolPhi; // Glazing system solar front reflectance for each angle of incidence + std::array rbsolPhi; // Glazing system solar back reflectance for each angle of incidence + std::array tvisPhi; // Glazing system visible transmittance for each angle of incidence + std::array rfvisPhi; // Glazing system visible front reflectance for each angle of incidence + std::array rbvisPhi; // Glazing system visible back reflectance for each angle of incidence Real64 ab1; // = abBareSolPhi(,1)(,2) Real64 ab2; @@ -631,12 +631,13 @@ namespace Window { // Get glass layer properties, then glazing system properties (which include the // effect of inter-reflection among glass layers) at each incidence angle. - // Apparently, using pre-calcaulated and hard-coded cosPhis (e.g., Window::cosPhis) causes a bunch of - // diffs, including some big ones - std::array cosPhisLocal; - - for (int iPhi = 0; iPhi < numPhis; ++iPhi) cosPhisLocal[iPhi] = std::cos((double)iPhi * dPhiDeg * Constant::DegToRad); - + // Apparently, using pre-calcaulated and hard-coded cosPhis (e.g., Window::cosPhis) causes a bunch of + // diffs, including some big ones + std::array cosPhisLocal; + + for (int iPhi = 0; iPhi < numPhis; ++iPhi) + cosPhisLocal[iPhi] = std::cos((double)iPhi * dPhiDeg * Constant::DegToRad); + for (int iPhi = 0; iPhi < numPhis; ++iPhi) { // For each wavelength, get glass layer properties at this angle of incidence // from properties at normal incidence @@ -1361,7 +1362,7 @@ namespace Window { cbtar.Vis.Bk.Df.Ref = rb3v + td3v * (rbshv + rbshv * rf3v * rbshv + tshv * rb2v * tshv + tshv * td2v * rb1v * td2v * tshv) * td3v; } // if (NGlass == 3) - } // for (iSlatAng) + } // for (iSlatAng) // Exterior screen } else if (ExtScreen) { @@ -1493,7 +1494,7 @@ namespace Window { surfShade.effGlassEmi = surfShade.glass.epsIR * TauShIR / (1.0 - surfShade.glass.rhoIR * RhoShIR); } // End of check if interior shade or interior blind - } // End of surface loop + } // End of surface loop for (int SurfNum = 1; SurfNum <= s_surf->TotSurfaces; ++SurfNum) { auto const &surf = s_surf->Surface(SurfNum); @@ -1783,7 +1784,7 @@ namespace Window { } } // End of wavelength loop - } // SystemSpectralPropertiesAtPhi() + } // SystemSpectralPropertiesAtPhi() //************************************************************************ @@ -2503,7 +2504,6 @@ namespace Window { //**************************************************************************** - //**************************************************************************** void GetHeatBalanceEqCoefMatrixSimple(EnergyPlusData &state, @@ -4508,7 +4508,7 @@ namespace Window { dens = rhomix; } // End of check if single or multiple gases in gap - } // WindowGasPropertiesAtTemp() + } // WindowGasPropertiesAtTemp() //******************************************************************************** @@ -5296,8 +5296,8 @@ namespace Window { //************************************************************************** void W5LsqFit(std::array const &ivars, // Independent variables - std::array const &dvars, // Dependent variables - std::array &coeffs // Polynomial coefficients from fit + std::array const &dvars, // Dependent variables + std::array &coeffs // Polynomial coefficients from fit ) { @@ -5314,9 +5314,9 @@ namespace Window { // form C1*X + C2*X**2 + C3*X**3 + ... +CN*X**N, where N <= 6. // Adapted from BLAST subroutine LSQFIT. - std::array, maxPolyCoef> A; // Least squares derivative matrix - std::array B; // Least squares derivative vector - std::array, maxPolyCoef> D; // Powers of independent variable + std::array, maxPolyCoef> A; // Least squares derivative matrix + std::array B; // Least squares derivative vector + std::array, maxPolyCoef> D; // Powers of independent variable // Set up least squares matrix for (int M = 0; M < numPhis; ++M) { @@ -5359,7 +5359,7 @@ namespace Window { } // Perform back substitution - coeffs[maxPolyCoef-1] = B[maxPolyCoef-1] / A[maxPolyCoef-1][maxPolyCoef-1]; + coeffs[maxPolyCoef - 1] = B[maxPolyCoef - 1] / A[maxPolyCoef - 1][maxPolyCoef - 1]; int LP1 = maxPolyCoef - 1; int L = maxPolyCoef - 2; @@ -5373,7 +5373,7 @@ namespace Window { --L; } } // W5LsqFit() - + //******************************************************************************** void W5LsqFit2(Array1A const IndepVar, // Independent variables @@ -5469,7 +5469,7 @@ namespace Window { } // W5LsqFit2() //*********************************************************************** - + Real64 DiffuseAverage(std::array const &props) // Property value at angles of incidence { @@ -5502,7 +5502,7 @@ namespace Window { return (avg < 0.0) ? 0.0 : avg; } // DiffuseAverage() - + //************************************************************************************* void CalcWinFrameAndDividerTemps(EnergyPlusData &state, @@ -5717,7 +5717,7 @@ namespace Window { if (ANY_INTERIOR_SHADE_BLIND(s_surf->SurfWinShadingFlag(SurfNum))) s_surf->SurfWinDividerHeatGain(SurfNum) = DividerHeatGain; // DivTempOut = s_surf->SurfWinDividerTempSurfOut(SurfNum) + Constant::Kelvin; } // End of check if window has dividers - } // CalcWinFrameAndDividerTemps() + } // CalcWinFrameAndDividerTemps() //************************************************************************************ @@ -6087,8 +6087,8 @@ namespace Window { TVisNorm = TBlBmBm * (TBmBmVis + TDifVis * RGlFrontVis * RhoBlBackVis / (1 - RGlDiffFrontVis * RhoBlDiffBackVis)) + TBlBmDifVis * TDifVis / (1.0 - RGlDiffFrontVis * RhoBlDiffBackVis); } // (ExtBlind) - } // (Screen or Blind) - } // (Shade, Blind, or Screen) + } // (Screen or Blind) + } // (Shade, Blind, or Screen) // Fill the layer properties needed for the thermal calculation. @@ -7004,8 +7004,8 @@ namespace Window { break; } } // for (i) - } // if (construct.TypeIsWindow) - } // for (ThisNum) + } // if (construct.TypeIsWindow) + } // for (ThisNum) } else if (wm->HasWindows) { @@ -7173,7 +7173,7 @@ namespace Window { btar.Vis.Bk.Bm[IProfAng].DfRef = st_lay(8); } } // End of loop over slat angles - } // End of loop over profile angles + } // End of loop over profile angles if (ISolVis == 1) { @@ -7225,7 +7225,7 @@ namespace Window { } // End of loop over solar vs. visible properties } // End of loop over blinds - } // CalcWindowBlindProperties() + } // CalcWindowBlindProperties() //************************************************************************************* @@ -7468,7 +7468,7 @@ namespace Window { print(screenCsvFile, "\n\n"); } } // if (PrintTransMap) - } // CalcWindowScreenProperties() + } // CalcWindowScreenProperties() void BlindOpticsDiffuse(EnergyPlusData &state, int const BlindNum, // Blind number @@ -7503,7 +7503,7 @@ namespace Window { c.dim(15); p.dim(16); - Array1D fEdgeA(2); // Average slat edge correction factor for upper and lower quadrants + Array1D fEdgeA(2); // Average slat edge correction factor for upper and lower quadrants // seen by window blind Array1D j(6); // Slat section radiosity vector Array1D G(6); // Slat section irradiance vector @@ -7605,10 +7605,12 @@ namespace Window { // Slat edge correction factor std::array fEdgeSource; // Slat edge correction factor vs source elevation - - Real64 const phib = b_el; // Elevation of slat normal vector (radians) - Real64 constexpr delphis = Constant::PiOvr2 / 10.0; // Angle increment for integration over source distribution (radians) // This is a bug, the delta is 10.0, PiOvr2/10.0 is 9.0. - + + Real64 const phib = b_el; // Elevation of slat normal vector (radians) + Real64 constexpr delphis = + Constant::PiOvr2 / + 10.0; // Angle increment for integration over source distribution (radians) // This is a bug, the delta is 10.0, PiOvr2/10.0 is 9.0. + for (int IUpDown = 1; IUpDown <= 2; ++IUpDown) { for (int iPhi = 0; iPhi < numPhis; ++iPhi) { Real64 phis = -((double)iPhi + 0.5) * delphis; // Source elevation (radians) @@ -7773,7 +7775,7 @@ namespace Window { p(15) = max(0.0001, 1.0 - p(13) - BlindIRreflBack); } // End of IR properties calculation - } // BlindOpticsDiffuse() + } // BlindOpticsDiffuse() //********************************************************************************************** @@ -8008,7 +8010,7 @@ namespace Window { p(6 + i) = G(1) * (1.0 - fEdge) + fEdge * c(8); } // End of loop over front and back side properties of blind - } // BlindOpticsBeam() + } // BlindOpticsBeam() //******************************************************************************************** diff --git a/src/EnergyPlus/WindowManager.hh b/src/EnergyPlus/WindowManager.hh index 988f50a4865..0c39204751c 100644 --- a/src/EnergyPlus/WindowManager.hh +++ b/src/EnergyPlus/WindowManager.hh @@ -80,10 +80,17 @@ namespace Window { Real64 constexpr dPhiDeg = 10.0; Real64 constexpr dPhiRad = dPhiDeg * Constant::DegToRad; - constexpr std::array cosPhis = - {1.0, 0.98480775301220802, 0.93969262078590842, 0.86602540378443871, 0.76604444311897812, - 0.64278760968653936, 0.50000000000000011, 0.34202014332566882, 0.17364817766693041, 0.0}; // 6.123233995736766E-17 - + constexpr std::array cosPhis = {1.0, + 0.98480775301220802, + 0.93969262078590842, + 0.86602540378443871, + 0.76604444311897812, + 0.64278760968653936, + 0.50000000000000011, + 0.34202014332566882, + 0.17364817766693041, + 0.0}; // 6.123233995736766E-17 + constexpr int maxPolyCoef = 6; class CWindowModel; @@ -233,14 +240,14 @@ namespace Window { Array1D &b // Matrix and vector in a.x = b; ); - constexpr Real64 POLYF(Real64 const X, // Cosine of angle of incidence + constexpr Real64 POLYF(Real64 const X, // Cosine of angle of incidence std::array const &A // Polynomial coefficients ) { return (X < 0.0 || X > 1.0) ? 0.0 : (X * (A[0] + X * (A[1] + X * (A[2] + X * (A[3] + X * (A[4] + X * A[5])))))); } -#ifdef GET_OUT +#ifdef GET_OUT constexpr Real64 POLYF(Real64 const X, // Cosine of angle of incidence Array1D const &A // Polynomial coefficients ) @@ -252,7 +259,7 @@ namespace Window { } } #endif // GET_OUT - + void WindowGasConductance(EnergyPlusData &state, Real64 tleft, // Temperature of gap surface closest to outside (K) Real64 tright, // Temperature of gap surface closest to zone (K) @@ -301,8 +308,8 @@ namespace Window { Real64 InterpolateBetweenFourValues( Real64 X, Real64 Y, Real64 X1, Real64 X2, Real64 Y1, Real64 Y2, Real64 Fx1y1, Real64 Fx1y2, Real64 Fx2y1, Real64 Fx2y2); - void W5LsqFit(std::array const &ivars, // Independent variables - std::array const &dvars, // Dependent variables + void W5LsqFit(std::array const &ivars, // Independent variables + std::array const &dvars, // Dependent variables std::array &coeffs // Polynomial coeffients from fit ); @@ -481,14 +488,14 @@ struct WindowManagerData : BaseGlobalStruct std::array thick = {0.0}; // Glass layer thickness (m) std::array scon = {0.0}; // Glass layer conductance--conductivity/thickness (W/m2-K) - std::array tir = {0.0}; // Front and back IR transmittance for each glass layer - std::array emis = {0.0}; // Front and back IR emissivity for each glass layer - std::array rir = {0.0}; // Front and back IR reflectance for each glass layer - // (program calculates from tir and emis) - std::array AbsRadGlassFace = { - 0.0}; // Solar radiation and IR radiation from internal gains absorbed by glass face - std::array thetas = {0.0}; // Glass surface temperatures (K) - std::array thetasPrev = {0.0}; // Previous-iteration glass surface temperatures (K) + std::array tir = {0.0}; // Front and back IR transmittance for each glass layer + std::array emis = {0.0}; // Front and back IR emissivity for each glass layer + std::array rir = {0.0}; // Front and back IR reflectance for each glass layer + // (program calculates from tir and emis) + std::array AbsRadGlassFace = { + 0.0}; // Solar radiation and IR radiation from internal gains absorbed by glass face + std::array thetas = {0.0}; // Glass surface temperatures (K) + std::array thetasPrev = {0.0}; // Previous-iteration glass surface temperatures (K) std::array hrgap = {0.0}; // Radiative gap conductance diff --git a/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc b/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc index 9d39f32e09b..74ec7167d4e 100644 --- a/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc @@ -4910,7 +4910,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_IncSolarMultiplier) int ConstrNum = 1; state->dataSurface->Surface(SurfNum).Construction = ConstrNum; auto &constr = state->dataConstruction->Construct(ConstrNum); - + state->dataSurface->SurfActiveConstruction(SurfNum) = state->dataSurface->Surface(SurfNum).Construction; state->dataConstruction->Construct(ConstrNum).TransDiff = 0.1; // Why is this being written and immediately overwritten?