diff --git a/src/EnergyPlus/DaylightingManager.cc b/src/EnergyPlus/DaylightingManager.cc index 073ad84dffe..7ae0f6da916 100644 --- a/src/EnergyPlus/DaylightingManager.cc +++ b/src/EnergyPlus/DaylightingManager.cc @@ -771,7 +771,7 @@ void CalcDayltgCoeffsRefPoints(EnergyPlusData &state, int const daylightCtrlNum) } auto &thisDayltgCtrl = dl->daylightControl(daylightCtrlNum); - auto &thisEnclDaylight = dl->enclDaylight(thisDayltgCtrl.enclIndex); + auto const &thisEnclDaylight = dl->enclDaylight(thisDayltgCtrl.enclIndex); int zoneNum = thisDayltgCtrl.zoneIndex; // Azimuth of view vector in absolute coord sys Real64 AZVIEW = (thisDayltgCtrl.ViewAzimuthForGlare + state.dataHeatBal->Zone(zoneNum).RelNorth + state.dataHeatBal->BuildingAzimuth + @@ -811,7 +811,7 @@ void CalcDayltgCoeffsRefPoints(EnergyPlusData &state, int const daylightCtrlNum) BRef = 0; for (int IL = 1; IL <= thisDayltgCtrl.TotalDaylRefPoints; ++IL) { - auto &refPt = thisDayltgCtrl.refPts(IL); + auto const &refPt = thisDayltgCtrl.refPts(IL); // Reference point in absolute coordinate system Vector3 RREF = refPt.absCoords; @@ -1067,7 +1067,6 @@ void CalcDayltgCoeffsMapPoints(EnergyPlusData &state, int const mapNum) // In the following four variables, I=1 for clear sky, 2 for overcast. int numRefPts; // Number of daylighting reference points in a zone - int IL; // Reference point counter // glare calculation (radians) int IConst; // Construction counter int ICtrl; // Window control counter @@ -1122,7 +1121,7 @@ void CalcDayltgCoeffsMapPoints(EnergyPlusData &state, int const mapNum) Vector3 VIEWVC2; if (dl->mapFirstTime && (int)dl->illumMaps.size() > 0) { - IL = -999; + int IL = -999; for (int MapNum = 1; MapNum <= (int)dl->illumMaps.size(); ++MapNum) { IL = max(IL, dl->illumMaps(MapNum).TotalMapRefPoints); } @@ -1132,7 +1131,7 @@ void CalcDayltgCoeffsMapPoints(EnergyPlusData &state, int const mapNum) auto &illumMap = dl->illumMaps(mapNum); int enclNum = illumMap.enclIndex; - auto &thisEnclDaylight = dl->enclDaylight(enclNum); + auto const &thisEnclDaylight = dl->enclDaylight(enclNum); // Azimuth of view vector in absolute coord sys - set to zero here, because glare isn't calculated for map points // but these are arguments to some of the functions that are shared with regular reference points, so initalize here. @@ -1165,7 +1164,7 @@ void CalcDayltgCoeffsMapPoints(EnergyPlusData &state, int const mapNum) } for (int IL = 1; IL <= numRefPts; ++IL) { - auto &refPt = illumMap.refPts(IL); + auto const &refPt = illumMap.refPts(IL); Vector3 RREF = refPt.absCoords; // ------------- @@ -2407,7 +2406,7 @@ void InitializeCFSStateData(EnergyPlusData &state, } } // do JSurf = 1, TotSurfaces if (TotHits <= 0) { - auto &sIncRay = state.dataBSDFWindow->ComplexWind(iWin).Geom(CurFenState).sInc(IRay); + auto const &sIncRay = state.dataBSDFWindow->ComplexWind(iWin).Geom(CurFenState).sInc(IRay); // This ray reached the sky or ground unobstructed if (sIncRay.z < 0.0) { // A ground ray @@ -2665,7 +2664,7 @@ Real64 CalcObstrMultiplier(EnergyPlusData &state, // Phi = 0 at the horizon; Phi = Pi/2 at the zenith. // Locals - auto &dl = state.dataDayltg; + auto const &dl = state.dataDayltg; auto &s_surf = state.dataSurface; bool hitObs; // True iff obstruction is hit @@ -3962,7 +3961,6 @@ void GetInputIlluminanceMap(EnergyPlusData &state, bool &ErrorsFound) CheckForGeometricTransform(state, doTransform, OldAspectRatio, NewAspectRatio); - auto &ip = state.dataInputProcessing->inputProcessor; auto const &ipsc = state.dataIPShortCut; ipsc->cCurrentModuleObject = "Output:IlluminanceMap"; int TotIllumMaps = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, ipsc->cCurrentModuleObject); @@ -3973,6 +3971,7 @@ void GetInputIlluminanceMap(EnergyPlusData &state, bool &ErrorsFound) int IOStat; int NumAlpha; int NumNumber; + auto &ip = state.dataInputProcessing->inputProcessor; for (int MapNum = 1; MapNum <= TotIllumMaps; ++MapNum) { ip->getObjectItem(state, ipsc->cCurrentModuleObject, @@ -4736,7 +4735,7 @@ void GetInputDayliteRefPt(EnergyPlusData &state, bool &ErrorsFound) { // Perform GetInput function for the Daylighting:ReferencePoint object // Glazer - July 2016 - auto &dl = state.dataDayltg; + auto const &dl = state.dataDayltg; auto &ip = state.dataInputProcessing->inputProcessor; auto const &ipsc = state.dataIPShortCut; ipsc->cCurrentModuleObject = "Daylighting:ReferencePoint"; @@ -4784,7 +4783,7 @@ void GetInputDayliteRefPt(EnergyPlusData &state, bool &ErrorsFound) bool doesDayLightingUseDElight(EnergyPlusData &state) { - auto &dl = state.dataDayltg; + auto const &dl = state.dataDayltg; for (auto const &znDayl : dl->daylightControl) { if (znDayl.DaylightMethod == DaylightingMethod::DElight) { return true; @@ -5630,7 +5629,7 @@ void manageDaylighting(EnergyPlusData &state) if (state.dataEnvrn->SunIsUp && (state.dataEnvrn->BeamSolarRad + state.dataEnvrn->GndSolarRad + state.dataEnvrn->DifSolarRad > 0.0)) { for (int enclNum = 1; enclNum <= state.dataViewFactor->NumOfSolarEnclosures; ++enclNum) { - auto &enclSol = state.dataViewFactor->EnclSolInfo(enclNum); + auto const &enclSol = state.dataViewFactor->EnclSolInfo(enclNum); if (enclSol.TotalEnclosureDaylRefPoints == 0 || !enclSol.HasInterZoneWindow) continue; DayltgInterReflIllFrIntWins(state, enclNum); @@ -5699,7 +5698,6 @@ void DayltgInteriorIllum(EnergyPlusData &state, int ISWFLG; // Switchable glazing flag: =1 if one or more windows in a zone // has switchable glazing that adjusts visible transmittance to just meet // daylighting setpoint; =0 otherwise. - int ICtrl; // Window shading control pointer Real64 VTRAT; // Ratio between switched and unswitched visible transmittance at normal incidence Real64 BACL; // Window background (surround) luminance for glare calc (cd/m2) Real64 SkyWeight; // Weighting factor used to average two different sky types @@ -5937,22 +5935,22 @@ void DayltgInteriorIllum(EnergyPlusData &state, auto &daylFromWinAtRefPt = thisDayltgCtrl.refPts(IL).extWins(loop).lums; auto &tmpDayl = tmpDaylFromWinAtRefPt(IL, loop); for (int iWinCover = 0; iWinCover < (int)WinCover::Num; ++iWinCover) { - auto const &dfhr = DFHR[iWinCover]; - auto const &bfhr = BFHR[iWinCover]; - auto const &sfhr = SFHR[iWinCover]; + auto const &dfhr3 = DFHR[iWinCover]; + auto const &bfhr3 = BFHR[iWinCover]; + auto const &sfhr3 = SFHR[iWinCover]; // What is this? if (iWinCover == iWinCover_Shaded && !ShadedOrDiffusingGlassWin) break; daylFromWinAtRefPt[iLum_Illum][iWinCover] = - dfhr.sun * state.dataEnvrn->HISUNF + - HorIllSkyFac * (dfhr.sky[iSky1] * SkyWeight * horIllSky1 + dfhr.sky[iSky2] * (1.0 - SkyWeight) * horIllSky2); + dfhr3.sun * state.dataEnvrn->HISUNF + + HorIllSkyFac * (dfhr3.sky[iSky1] * SkyWeight * horIllSky1 + dfhr3.sky[iSky2] * (1.0 - SkyWeight) * horIllSky2); daylFromWinAtRefPt[iLum_Back][iWinCover] = - bfhr.sun * state.dataEnvrn->HISUNF + - HorIllSkyFac * (bfhr.sky[iSky1] * SkyWeight * horIllSky1 + bfhr.sky[iSky2] * (1.0 - SkyWeight) * horIllSky2); + bfhr3.sun * state.dataEnvrn->HISUNF + + HorIllSkyFac * (bfhr3.sky[iSky1] * SkyWeight * horIllSky1 + bfhr3.sky[iSky2] * (1.0 - SkyWeight) * horIllSky2); daylFromWinAtRefPt[iLum_Source][iWinCover] = - sfhr.sun * state.dataEnvrn->HISUNF + - HorIllSkyFac * (sfhr.sky[iSky1] * SkyWeight * horIllSky1 + sfhr.sky[iSky2] * (1.0 - SkyWeight) * horIllSky2); + sfhr3.sun * state.dataEnvrn->HISUNF + + HorIllSkyFac * (sfhr3.sky[iSky1] * SkyWeight * horIllSky1 + sfhr3.sky[iSky2] * (1.0 - SkyWeight) * horIllSky2); daylFromWinAtRefPt[iLum_Source][iWinCover] = max(daylFromWinAtRefPt[iLum_Source][iWinCover], 0.0); @@ -6238,7 +6236,7 @@ void DayltgInteriorIllum(EnergyPlusData &state, continueOuterLoop = false; continue; } - ICtrl = s_surf->Surface(IWin).activeWindowShadingControl; + int ICtrl = s_surf->Surface(IWin).activeWindowShadingControl; if (!s_surf->Surface(IWin).HasShadeControl) { continueOuterLoop = false; continue; @@ -6271,7 +6269,7 @@ void DayltgInteriorIllum(EnergyPlusData &state, rdayil[iLum_Back] = refPt.lums[iLum_Back] - wdayil[iLum_Back][iWinCover_Bare] + wdayil[iLum_Back][iWinCover_Shaded]; } else { // switchable glazings already in partially switched state when calc the RDAYIL(IL) & RBACLU(IL) - auto &tmpDayl = tmpDaylFromWinAtRefPt(loop, IL); + auto const &tmpDayl = tmpDaylFromWinAtRefPt(loop, IL); rdayil[iLum_Illum] = dl->DaylIllum(IL) - wdayil[iLum_Illum][iWinCover_Shaded] + tmpDayl[iLum_Illum][iWinCover_Shaded]; rdayil[iLum_Back] = refPt.lums[iLum_Back] - wdayil[iLum_Back][iWinCover_Shaded] + tmpDayl[iLum_Back][iWinCover_Shaded]; } @@ -6379,7 +6377,7 @@ void DayltgInteriorIllum(EnergyPlusData &state, ANY_BLIND(s_surf->SurfWinShadingFlag(IWin))) continue; - ICtrl = s_surf->Surface(IWin).activeWindowShadingControl; + int ICtrl = s_surf->Surface(IWin).activeWindowShadingControl; if (!s_surf->Surface(IWin).HasShadeControl) continue; if (s_surf->WindowShadingControl(ICtrl).GlareControlIsActive) { @@ -8324,7 +8322,7 @@ Real64 DayltgSkyLuminance(EnergyPlusData const &state, // PHSKY ranges from 0 to Pi starting with 0 at the horizon and Pi/2 at the zenith. // FUNCTION LOCAL VARIABLE DECLARATIONS: - auto &dl = state.dataDayltg; + auto const &dl = state.dataDayltg; Real64 G = 0.0; // Angle between sun and element of sky (radians) Real64 COSG = 0.0; // Cosine of G @@ -8766,11 +8764,11 @@ void DayltgInteriorMapIllum(EnergyPlusData &state) if (s_surf->SurfWinWindowModelType(IWin) == WindowModel::BSDF) break; if (NOT_SHADED(s_surf->SurfWinShadingFlag(IWin)) && !s_surf->SurfWinSolarDiffusing(IWin)) break; } - auto const &dfhr = DFHR[iWinCover]; + auto const &dfhr3 = DFHR[iWinCover]; thisMap.refPts(ILB).winLums(loop)[iWinCover] = tmpDFHR[iWinCover].sun * state.dataEnvrn->HISUNF + - HorIllSkyFac * (dfhr.sky[iSky1] * SkyWeight * tmpHorIll.sky[iSky1] + - dfhr.sky[iSky2] * (1.0 - SkyWeight) * tmpHorIll.sky[iSky2]); + HorIllSkyFac * (dfhr3.sky[iSky1] * SkyWeight * tmpHorIll.sky[iSky1] + + dfhr3.sky[iSky2] * (1.0 - SkyWeight) * tmpHorIll.sky[iSky2]); } } // End of reference point loop @@ -9521,7 +9519,7 @@ void DayltgInterReflIllFrIntWins(EnergyPlusData &state, int const enclNum) auto &s_surf = state.dataSurface; auto &enclDayl = dl->enclDaylight(enclNum); - auto &enclSol = state.dataViewFactor->EnclSolInfo(enclNum); + auto const &enclSol = state.dataViewFactor->EnclSolInfo(enclNum); enclDayl.InterReflIllFrIntWins = 0.0; @@ -9617,8 +9615,7 @@ void CalcMinIntWinSolidAngs(EnergyPlusData &state) Vector3 W23 = W3 - W2; Real64 HW = W21.magnitude(); Real64 WW = W23.magnitude(); - Vector3 WC = - (is_Rectangle) ? (W2 + (W23 + W21) / 2.0) : (is_Triangle ? (W2 + (W23 + W21) / 3.0) : (W2 + (W23 + W21) / 3.0)); + Vector3 WC = (is_Rectangle) ? (W2 + (W23 + W21) / 2.0) : (W2 + (W23 + W21) / 3.0); // Vector from ref point to center of window Vector3 REFWC = WC - RREF;