From 71257e5a5a1c40955b59e365c88261f0a81cf687 Mon Sep 17 00:00:00 2001 From: amirroth Date: Tue, 24 Dec 2024 16:25:13 -0500 Subject: [PATCH 1/8] std::array for window incident angles --- src/EnergyPlus/Construction.cc | 34 +- src/EnergyPlus/Construction.hh | 34 +- src/EnergyPlus/DElightManagerF.cc | 12 +- src/EnergyPlus/General.hh | 9 +- src/EnergyPlus/HeatBalanceManager.cc | 146 +++--- src/EnergyPlus/SurfaceGeometry.cc | 32 +- src/EnergyPlus/WindowManager.cc | 449 +++++++++++------- src/EnergyPlus/WindowManager.hh | 23 +- .../unit/HeatBalanceSurfaceManager.unit.cc | 7 +- tst/EnergyPlus/unit/SolarShading.unit.cc | 4 +- 10 files changed, 438 insertions(+), 312 deletions(-) diff --git a/src/EnergyPlus/Construction.cc b/src/EnergyPlus/Construction.cc index 267e9f56ed5..ba748b49c83 100644 --- a/src/EnergyPlus/Construction.cc +++ b/src/EnergyPlus/Construction.cc @@ -2025,18 +2025,6 @@ void ConstructionProps::setArraysBasedOnMaxSolidWinLayers(EnergyPlusData &state) this->rbBareVisCoef.allocate(state.dataHeatBal->MaxSolidWinLayers); this->afBareSolCoef.allocate(state.dataHeatBal->MaxSolidWinLayers); this->abBareSolCoef.allocate(state.dataHeatBal->MaxSolidWinLayers); - for (int Layer = 1; Layer <= state.dataHeatBal->MaxSolidWinLayers; ++Layer) { - this->AbsBeamCoef(Layer).allocate(DataSurfaces::MaxPolyCoeff); - this->AbsBeamBackCoef(Layer).allocate(DataSurfaces::MaxPolyCoeff); - this->tBareSolCoef(Layer).allocate(DataSurfaces::MaxPolyCoeff); - this->tBareVisCoef(Layer).allocate(DataSurfaces::MaxPolyCoeff); - this->rfBareSolCoef(Layer).allocate(DataSurfaces::MaxPolyCoeff); - this->rfBareVisCoef(Layer).allocate(DataSurfaces::MaxPolyCoeff); - this->rbBareSolCoef(Layer).allocate(DataSurfaces::MaxPolyCoeff); - this->rbBareVisCoef(Layer).allocate(DataSurfaces::MaxPolyCoeff); - this->afBareSolCoef(Layer).allocate(DataSurfaces::MaxPolyCoeff); - this->abBareSolCoef(Layer).allocate(DataSurfaces::MaxPolyCoeff); - } for (int Layer = 1; Layer <= state.dataHeatBal->MaxSolidWinLayers; ++Layer) { this->AbsDiff(Layer) = 0.0; @@ -2053,18 +2041,16 @@ void ConstructionProps::setArraysBasedOnMaxSolidWinLayers(EnergyPlusData &state) } } for (int Layer = 1; Layer <= state.dataHeatBal->MaxSolidWinLayers; ++Layer) { - for (int Index = 1; Index <= DataSurfaces::MaxPolyCoeff; ++Index) { - this->AbsBeamCoef(Layer)(Index) = 0.0; - this->AbsBeamBackCoef(Layer)(Index) = 0.0; - this->tBareSolCoef(Layer)(Index) = 0.0; - this->tBareVisCoef(Layer)(Index) = 0.0; - this->rfBareSolCoef(Layer)(Index) = 0.0; - this->rfBareVisCoef(Layer)(Index) = 0.0; - this->rbBareSolCoef(Layer)(Index) = 0.0; - this->rbBareVisCoef(Layer)(Index) = 0.0; - this->afBareSolCoef(Layer)(Index) = 0.0; - this->abBareSolCoef(Layer)(Index) = 0.0; - } + std::fill(this->AbsBeamCoef(Layer).begin(), this->AbsBeamCoef(Layer).end(), 0.0); + std::fill(this->AbsBeamBackCoef(Layer).begin(), this->AbsBeamBackCoef(Layer).end(), 0.0); + std::fill(this->tBareSolCoef(Layer).begin(), this->tBareSolCoef(Layer).end(), 0.0); + std::fill(this->tBareVisCoef(Layer).begin(), this->tBareVisCoef(Layer).end(), 0.0); + std::fill(this->rfBareSolCoef(Layer).begin(), this->rfBareSolCoef(Layer).end(), 0.0); + std::fill(this->rfBareVisCoef(Layer).begin(), this->rfBareVisCoef(Layer).end(), 0.0); + std::fill(this->rbBareSolCoef(Layer).begin(), this->rbBareSolCoef(Layer).end(), 0.0); + std::fill(this->rbBareVisCoef(Layer).begin(), this->rbBareVisCoef(Layer).end(), 0.0); + std::fill(this->afBareSolCoef(Layer).begin(), this->afBareSolCoef(Layer).end(), 0.0); + std::fill(this->abBareSolCoef(Layer).begin(), this->abBareSolCoef(Layer).end(), 0.0); } } diff --git a/src/EnergyPlus/Construction.hh b/src/EnergyPlus/Construction.hh index 1c95c7b513a..9b8fe438e84 100644 --- a/src/EnergyPlus/Construction.hh +++ b/src/EnergyPlus/Construction.hh @@ -216,10 +216,10 @@ namespace Construction { 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 + 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 - Array1D AbsBeamShadeCoef; // Coefficients of incidence-angle polynomial for solar + Array1D> AbsBeamBackCoef; // As for AbsBeamCoef but for back-incident solar + std::array AbsBeamShadeCoef; // Coefficients of incidence-angle polynomial for solar // absorptance of shade Real64 TransDiff = 0.0; // Diffuse solar transmittance, bare glass or shade on Real64 TransDiffVis; // Diffuse visible transmittance, bare glass or shade on @@ -227,21 +227,21 @@ namespace Construction { 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 - Array1D TransSolBeamCoef; // Coeffs of incidence-angle polynomial for beam sol trans, + std::array TransSolBeamCoef; // Coeffs of incidence-angle polynomial for beam sol trans, // bare glass or shade on - Array1D TransVisBeamCoef; // Coeffs of incidence-angle polynomial for beam vis trans, + std::array TransVisBeamCoef; // Coeffs of incidence-angle polynomial for beam vis trans, // bare glass or shade on - Array1D ReflSolBeamFrontCoef; // Coeffs of incidence-angle polynomial for beam sol front refl, + std::array ReflSolBeamFrontCoef; // Coeffs of incidence-angle polynomial for beam sol front refl, // bare glass or shade on - Array1D ReflSolBeamBackCoef; // Like ReflSolBeamFrontCoef, but for back-incident beam solar - 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 - Array1D> rfBareVisCoef; // Isolated glass front visible reflectance coeffs of inc. angle polynomial - Array1D> rbBareSolCoef; // Isolated glass back solar reflectance coeffs of inc. angle polynomial - 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 + std::array ReflSolBeamBackCoef; // Like ReflSolBeamFrontCoef, but for back-incident beam solar + 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 + Array1D> rfBareVisCoef; // Isolated glass front visible reflectance coeffs of inc. angle polynomial + Array1D> rbBareSolCoef; // Isolated glass back solar reflectance coeffs of inc. angle polynomial + 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 @@ -325,8 +325,8 @@ namespace Construction { // Default Constructor ConstructionProps() - : LayerPoint(MaxLayersInConstruct, 0), AbsBeamShadeCoef(6, 0.0), TransDiffVis(0.0), TransSolBeamCoef(6, 0.0), TransVisBeamCoef(6, 0.0), - ReflSolBeamFrontCoef(6, 0.0), ReflSolBeamBackCoef(6, 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/DElightManagerF.cc b/src/EnergyPlus/DElightManagerF.cc index 1be42160c7e..4b73aa71e0a 100644 --- a/src/EnergyPlus/DElightManagerF.cc +++ b/src/EnergyPlus/DElightManagerF.cc @@ -687,12 +687,12 @@ namespace DElightManagerF { iWndoConstIndexes(iconst) + 10000, state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransDiffVis, state.dataConstruction->Construct(iWndoConstIndexes(iconst)).ReflectVisDiffBack, - state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(1), - state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(2), - state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(3), - state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(4), - state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(5), - state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef(6)); + state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef[0], + state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef[1], + state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef[2], + state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef[3], + state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef[4], + state.dataConstruction->Construct(iWndoConstIndexes(iconst)).TransVisBeamCoef[5]); } // Glass Type loop diff --git a/src/EnergyPlus/General.hh b/src/EnergyPlus/General.hh index 31f26cdf9f4..11afea846c1 100644 --- a/src/EnergyPlus/General.hh +++ b/src/EnergyPlus/General.hh @@ -82,6 +82,13 @@ namespace General { Real64 X_0, // 1st bound of interval that contains the solution Real64 X_1); // 2nd bound of interval that contains the solution + 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])))))); + } + constexpr Real64 POLYF(Real64 const X, // Cosine of angle of incidence Array1D const &A // Polynomial coefficients ) @@ -92,7 +99,7 @@ namespace General { return X * (A(1) + X * (A(2) + X * (A(3) + X * (A(4) + X * (A(5) + X * A(6)))))); } } - + void MovingAvg(Array1D &DataIn, int NumItemsInAvg); void ProcessDateString(EnergyPlusData &state, diff --git a/src/EnergyPlus/HeatBalanceManager.cc b/src/EnergyPlus/HeatBalanceManager.cc index a4c2d6ceed3..8e01a55501f 100644 --- a/src/EnergyPlus/HeatBalanceManager.cc +++ b/src/EnergyPlus/HeatBalanceManager.cc @@ -3628,21 +3628,27 @@ namespace HeatBalanceManager { 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 Tsol(11); // Solar transmittance vs incidence angle; diffuse trans. - Array2D AbsSol(11, 5); // Solar absorptance vs inc. angle in each glass layer - Array1D Rfsol(11); // Front solar reflectance vs inc. angle - Array1D Rbsol(11); // Back solar reflectance vs inc. angle - Array1D Tvis(11); // Visible transmittance vs inc. angle - Array1D Rfvis(11); // Front visible reflectance vs inc. angle - Array1D Rbvis(11); // Back visible reflectance vs inc. angle - Array1D CosPhiIndepVar(10); // Cosine of incidence angle from 0 to 90 deg in 10 deg increments - int IPhi; // Incidence angle counter - Real64 Phi; // Incidence angle (deg) - Array1D CosPhi(10); // Cosine of incidence angle - Array1D tsolFit(10); // Fitted solar transmittance vs incidence angle - Array1D tvisFit(10); // Fitted visible transmittance vs incidence angle - Array1D rfsolFit(10); // Fitted solar front reflectance vs incidence angle - Array2D solabsFit(5, 10); // Fitted solar absorptance vs incidence angle for each glass layer + 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 + std::array Rfsol; + Array1D RbsolTemp(Window::numPhis+1); // Back solar reflectance vs inc. angle + std::array Rbsol; + Array1D TvisTemp(Window::numPhis+1); // Visible transmittance vs inc. angle + std::array Tvis; + 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 + std::array Rbvis; + + // std::array CosPhiIndepVar; // Cosine of incidence angle from 0 to 90 deg in 10 deg increments + // std::array CosPhi; // Cosine of incidence angle + 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; @@ -4135,16 +4141,16 @@ namespace HeatBalanceManager { ++FileLineCount; // Pre-calculate constants - for (IPhi = 1; IPhi <= 10; ++IPhi) { - CosPhiIndepVar(IPhi) = std::cos((IPhi - 1) * 10.0 * Constant::DegToRadians); - } + // for (int iPhi = 0; iPhi < 10; ++iPhi) { + // CosPhiIndepVar[iPhi] = std::cos(iPhi * 10.0 * Constant::DegToRad); + // } - // Pre-calculate constants - for (IPhi = 1; IPhi <= 10; ++IPhi) { - Phi = double(IPhi - 1) * 10.0; - CosPhi(IPhi) = std::cos(Phi * Constant::DegToRadians); - if (std::abs(CosPhi(IPhi)) < 0.0001) CosPhi(IPhi) = 0.0; - } + // Pre-calculate constants // Why do we need both of these? + // for (int iPhi = 0; iPhi < Window::numPhis; ++iPhi) { + // Real64 Phi = double(iPhi) * 10.0; + // CosPhi[iPhi] = std::cos(Phi * Constant::DegToRad); + // if (std::abs(CosPhi[iPhi]) < 0.0001) CosPhi[iPhi] = 0.0; + // } for (IGlSys = 1; IGlSys <= NGlSys; ++IGlSys) { ConstrNum = state.dataHeatBal->TotConstructs - NGlSys + IGlSys; @@ -4186,7 +4192,7 @@ namespace HeatBalanceManager { thisConstruct.AbsDiffShade = 0.0; thisConstruct.AbsDiffBackShade = 0.0; thisConstruct.ShadeAbsorpThermal = 0.0; - thisConstruct.AbsBeamShadeCoef = 0.0; + std::fill(thisConstruct.AbsBeamShadeCoef.begin(), thisConstruct.AbsBeamShadeCoef.end(), 0.0); thisConstruct.AbsDiffIn = 0.0; thisConstruct.AbsDiffOut = 0.0; thisConstruct.TransDiff = 0.0; @@ -4195,20 +4201,18 @@ namespace HeatBalanceManager { thisConstruct.ReflectSolDiffFront = 0.0; thisConstruct.ReflectVisDiffBack = 0.0; thisConstruct.ReflectVisDiffFront = 0.0; - thisConstruct.TransSolBeamCoef = 0.0; - thisConstruct.TransVisBeamCoef = 0.0; - thisConstruct.ReflSolBeamFrontCoef = 0.0; - thisConstruct.ReflSolBeamBackCoef = 0.0; + std::fill(thisConstruct.TransSolBeamCoef.begin(), thisConstruct.TransSolBeamCoef.end(), 0.0); + std::fill(thisConstruct.TransVisBeamCoef.begin(), thisConstruct.TransVisBeamCoef.end(), 0.0); + std::fill(thisConstruct.ReflSolBeamFrontCoef.begin(), thisConstruct.ReflSolBeamFrontCoef.end(), 0.0); + std::fill(thisConstruct.ReflSolBeamBackCoef.begin(), thisConstruct.ReflSolBeamBackCoef.end(), 0.0); thisConstruct.W5FrameDivider = 0; thisConstruct.TotLayers = NGlass(IGlSys) + NGaps(IGlSys); thisConstruct.TotGlassLayers = NGlass(IGlSys); thisConstruct.TotSolidLayers = NGlass(IGlSys); for (int Layer = 1; Layer <= state.dataHeatBal->MaxSolidWinLayers; ++Layer) { - for (int index = 1; index <= DataSurfaces::MaxPolyCoeff; ++index) { - thisConstruct.AbsBeamCoef(Layer)(index) = 0.0; - thisConstruct.AbsBeamBackCoef(Layer)(index) = 0.0; - } + std::fill(thisConstruct.AbsBeamCoef(Layer).begin(), thisConstruct.AbsBeamCoef(Layer).end(), 0.0); + std::fill(thisConstruct.AbsBeamBackCoef(Layer).begin(), thisConstruct.AbsBeamBackCoef(Layer).end(), 0.0); } for (IGlass = 1; IGlass <= NGlass(IGlSys); ++IGlass) { @@ -4242,25 +4246,26 @@ namespace HeatBalanceManager { NextLine = W5DataFile.readLine(); if (NextLine.eof) goto Label1000; ++FileLineCount; - if (!readItem(NextLine.data.substr(5), Tsol)) { + if (!readItem(NextLine.data.substr(5), TsolTemp)) { ShowSevereError(state, "HeatBalanceManager: SearchWindow5DataFile: Error in Read of TSol values."); ShowContinueError(state, format("Line (~{}) in error (first 100 characters)={}", FileLineCount, NextLine.data.substr(0, 100))); ErrorsFound = true; - } else if (any_lt(Tsol, 0.0) || any_gt(Tsol, 1.0)) { + } else if (any_lt(TsolTemp, 0.0) || any_gt(TsolTemp, 1.0)) { ShowSevereError(state, "HeatBalanceManager: SearchWindow5DataFile: Error in Read of TSol values. (out of range [0,1])"); 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; - if (!readItem(NextLine.data.substr(5), AbsSol(_, IGlass))) { + if (!readItem(NextLine.data.substr(5), AbsSolTemp(IGlass, _))) { ShowSevereError(state, format("HeatBalanceManager: SearchWindow5DataFile: Error in Read of AbsSol values. For Glass={}", IGlass)); ShowContinueError(state, format("Line (~{}) in error (first 100 characters)={}", FileLineCount, NextLine.data.substr(0, 100))); ErrorsFound = true; - } else if (any_lt(AbsSol(_, IGlass), 0.0) || any_gt(AbsSol(_, IGlass), 1.0)) { + } else if (any_lt(AbsSolTemp(IGlass, _), 0.0) || any_gt(AbsSolTemp(IGlass, _), 1.0)) { ShowSevereError( state, format("HeatBalanceManager: SearchWindow5DataFile: Error in Read of AbsSol values. (out of range [0,1]) For Glass={}", @@ -4275,48 +4280,48 @@ namespace HeatBalanceManager { DataLine(ILine) = NextLine.data; } - if (!readItem(DataLine(1).substr(5), Rfsol)) { + if (!readItem(DataLine(1).substr(5), RfsolTemp)) { ShowSevereError(state, "HeatBalanceManager: SearchWindow5DataFile: Error in Read of RfSol values."); ShowContinueError(state, format("Line (~{}) in error (first 100 characters)={}", FileLineCount + 1, DataLine(1).substr(0, 100))); ErrorsFound = true; - } else if (any_lt(Rfsol, 0.0) || any_gt(Rfsol, 1.0)) { + } else if (any_lt(RfsolTemp, 0.0) || any_gt(RfsolTemp, 1.0)) { ShowSevereError(state, "HeatBalanceManager: SearchWindow5DataFile: Error in Read of RfSol values. (out of range [0,1])"); ShowContinueError(state, format("Line (~{}) in error (first 100 characters)={}", FileLineCount + 1, DataLine(1).substr(0, 100))); ErrorsFound = true; } - if (!readItem(DataLine(2).substr(5), Rbsol)) { + if (!readItem(DataLine(2).substr(5), RbsolTemp)) { ShowSevereError(state, "HeatBalanceManager: SearchWindow5DataFile: Error in Read of RbSol values."); ShowContinueError(state, format("Line (~{}) in error (first 100 characters)={}", FileLineCount + 2, DataLine(2).substr(0, 100))); ErrorsFound = true; - } else if (any_lt(Rbsol, 0.0) || any_gt(Rbsol, 1.0)) { + } else if (any_lt(RbsolTemp, 0.0) || any_gt(RbsolTemp, 1.0)) { ShowSevereError(state, "HeatBalanceManager: SearchWindow5DataFile: Error in Read of RbSol values. (out of range [0,1])"); ShowContinueError(state, format("Line (~{}) in error (first 100 characters)={}", FileLineCount + 2, DataLine(2).substr(0, 100))); ErrorsFound = true; } - if (!readItem(DataLine(3).substr(5), Tvis)) { + if (!readItem(DataLine(3).substr(5), TvisTemp)) { ShowSevereError(state, "HeatBalanceManager: SearchWindow5DataFile: Error in Read of Tvis values."); ShowContinueError(state, format("Line (~{}) in error (first 100 characters)={}", FileLineCount + 3, DataLine(3).substr(0, 100))); ErrorsFound = true; - } else if (any_lt(Tvis, 0.0) || any_gt(Tvis, 1.0)) { + } else if (any_lt(TvisTemp, 0.0) || any_gt(TvisTemp, 1.0)) { ShowSevereError(state, "HeatBalanceManager: SearchWindow5DataFile: Error in Read of Tvis values. (out of range [0,1])"); ShowContinueError(state, format("Line (~{}) in error (first 100 characters)={}", FileLineCount + 3, DataLine(3).substr(0, 100))); ErrorsFound = true; } - if (!readItem(DataLine(4).substr(5), Rfvis)) { + if (!readItem(DataLine(4).substr(5), RfvisTemp)) { ShowSevereError(state, "HeatBalanceManager: SearchWindow5DataFile: Error in Read of Rfvis values."); ShowContinueError(state, format("Line (~{}) in error (first 100 characters)={}", FileLineCount + 4, DataLine(4).substr(0, 100))); ErrorsFound = true; - } else if (any_lt(Rfvis, 0.0) || any_gt(Rfvis, 1.0)) { + } else if (any_lt(RfvisTemp, 0.0) || any_gt(RfvisTemp, 1.0)) { ShowSevereError(state, "HeatBalanceManager: SearchWindow5DataFile: Error in Read of Rfvis values. (out of range [0,1])"); ShowContinueError(state, format("Line (~{}) in error (first 100 characters)={}", FileLineCount + 4, DataLine(4).substr(0, 100))); ErrorsFound = true; } - if (!readItem(DataLine(5).substr(5), Rbvis)) { + if (!readItem(DataLine(5).substr(5), RbvisTemp)) { ShowSevereError(state, "HeatBalanceManager: SearchWindow5DataFile: Error in Read of Rbvis values."); ShowContinueError(state, format("Line (~{}) in error (first 100 characters)={}", FileLineCount + 5, DataLine(5).substr(0, 100))); ErrorsFound = true; - } else if (any_lt(Rbvis, 0.0) || any_gt(Rbvis, 1.0)) { + } else if (any_lt(RbvisTemp, 0.0) || any_gt(RbvisTemp, 1.0)) { ShowSevereError(state, "HeatBalanceManager: SearchWindow5DataFile: Error in Read of Rbvis values. (out of range [0,1])"); ShowContinueError(state, format("Line (~{}) in error (first 100 characters)={}", FileLineCount + 5, DataLine(5).substr(0, 100))); ErrorsFound = true; @@ -4330,28 +4335,43 @@ namespace HeatBalanceManager { "of above errors", 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); + } + + for (IGlass = 1; IGlass <= NGlass(IGlSys); ++IGlass) { + for (int iPhi = 0; iPhi < Window::numPhis; ++iPhi) { + AbsSol(IGlass)[iPhi] = AbsSolTemp(IGlass, iPhi+1); + } + } + // Hemis - thisConstruct.TransDiff = Tsol(11); - thisConstruct.TransDiffVis = Tvis(11); - thisConstruct.ReflectSolDiffFront = Rfsol(11); - thisConstruct.ReflectSolDiffBack = Rbsol(11); - thisConstruct.ReflectVisDiffFront = Rfvis(11); - thisConstruct.ReflectVisDiffBack = Rbvis(11); - - Window::W5LsqFit(CosPhiIndepVar, Tsol, 6, 1, 10, thisConstruct.TransSolBeamCoef); - Window::W5LsqFit(CosPhiIndepVar, Tvis, 6, 1, 10, thisConstruct.TransVisBeamCoef); - Window::W5LsqFit(CosPhiIndepVar, Rfsol, 6, 1, 10, thisConstruct.ReflSolBeamFrontCoef); + thisConstruct.TransDiff = TsolTemp(11); + thisConstruct.TransDiffVis = TvisTemp(11); + thisConstruct.ReflectSolDiffFront = RfsolTemp(11); + thisConstruct.ReflectSolDiffBack = RbsolTemp(11); + thisConstruct.ReflectVisDiffFront = RfvisTemp(11); + thisConstruct.ReflectVisDiffBack = RbvisTemp(11); + + Window::W5LsqFit(Window::cosPhis, Tsol, thisConstruct.TransSolBeamCoef); + Window::W5LsqFit(Window::cosPhis, Tvis, thisConstruct.TransVisBeamCoef); + Window::W5LsqFit(Window::cosPhis, Rfsol, thisConstruct.ReflSolBeamFrontCoef); for (IGlass = 1; IGlass <= NGlass(IGlSys); ++IGlass) { - Window::W5LsqFit(CosPhiIndepVar, AbsSol(_, IGlass), 6, 1, 10, thisConstruct.AbsBeamCoef(IGlass)); + Window::W5LsqFit(Window::cosPhis, AbsSol(IGlass), thisConstruct.AbsBeamCoef(IGlass)); } // For comparing fitted vs. input distribution in incidence angle - for (IPhi = 1; IPhi <= 10; ++IPhi) { - tsolFit(IPhi) = POLYF(CosPhi(IPhi), thisConstruct.TransSolBeamCoef); - tvisFit(IPhi) = POLYF(CosPhi(IPhi), thisConstruct.TransVisBeamCoef); - rfsolFit(IPhi) = POLYF(CosPhi(IPhi), thisConstruct.ReflSolBeamFrontCoef); + for (int iPhi = 0; iPhi < Window::numPhis; ++iPhi) { + tsolFit[iPhi] = POLYF(Window::cosPhis[iPhi], thisConstruct.TransSolBeamCoef); + tvisFit[iPhi] = POLYF(Window::cosPhis[iPhi], thisConstruct.TransVisBeamCoef); + rfsolFit[iPhi] = POLYF(Window::cosPhis[iPhi], thisConstruct.ReflSolBeamFrontCoef); for (IGlass = 1; IGlass <= NGlass(IGlSys); ++IGlass) { - solabsFit(IGlass, IPhi) = POLYF(CosPhi(IPhi), thisConstruct.AbsBeamCoef(IGlass)); + solabsFit(IGlass)[iPhi] = POLYF(Window::cosPhis[iPhi], thisConstruct.AbsBeamCoef(IGlass)); } } // end diff --git a/src/EnergyPlus/SurfaceGeometry.cc b/src/EnergyPlus/SurfaceGeometry.cc index faf30f55f0c..64d87f2c11c 100644 --- a/src/EnergyPlus/SurfaceGeometry.cc +++ b/src/EnergyPlus/SurfaceGeometry.cc @@ -13273,17 +13273,17 @@ namespace SurfaceGeometry { thisConstructNewSh.AbsDiffShade = 0.0; thisConstructNewSh.AbsDiffBackShade = 0.0; thisConstructNewSh.ShadeAbsorpThermal = 0.0; - thisConstructNewSh.AbsBeamShadeCoef = 0.0; + std::fill(thisConstructNewSh.AbsBeamShadeCoef.begin(), thisConstructNewSh.AbsBeamShadeCoef.end(), 0.0); thisConstructNewSh.TransDiff = 0.0; thisConstructNewSh.TransDiffVis = 0.0; thisConstructNewSh.ReflectSolDiffBack = 0.0; thisConstructNewSh.ReflectSolDiffFront = 0.0; thisConstructNewSh.ReflectVisDiffBack = 0.0; thisConstructNewSh.ReflectVisDiffFront = 0.0; - thisConstructNewSh.TransSolBeamCoef = 0.0; - thisConstructNewSh.TransVisBeamCoef = 0.0; - thisConstructNewSh.ReflSolBeamFrontCoef = 0.0; - thisConstructNewSh.ReflSolBeamBackCoef = 0.0; + std::fill(thisConstructNewSh.TransSolBeamCoef.begin(), thisConstructNewSh.TransSolBeamCoef.end(), 0.0); + std::fill(thisConstructNewSh.TransVisBeamCoef.begin(), thisConstructNewSh.TransVisBeamCoef.end(), 0.0); + std::fill(thisConstructNewSh.ReflSolBeamFrontCoef.begin(), thisConstructNewSh.ReflSolBeamFrontCoef.end(), 0.0); + std::fill(thisConstructNewSh.ReflSolBeamBackCoef.begin(), thisConstructNewSh.ReflSolBeamBackCoef.end(), 0.0); thisConstructNewSh.W5FrameDivider = 0; thisConstructNewSh.FromWindow5DataFile = false; @@ -13295,10 +13295,8 @@ namespace SurfaceGeometry { thisConstructNewSh.IsUsed = true; for (int Layer = 1; Layer <= state.dataHeatBal->MaxSolidWinLayers; ++Layer) { - for (int index = 1; index <= DataSurfaces::MaxPolyCoeff; ++index) { - thisConstructNewSh.AbsBeamCoef(Layer)(index) = 0.0; - thisConstructNewSh.AbsBeamBackCoef(Layer)(index) = 0.0; - } + std::fill(thisConstructNewSh.AbsBeamCoef(Layer).begin(), thisConstructNewSh.AbsBeamCoef(Layer).end(), 0.0); + std::fill(thisConstructNewSh.AbsBeamBackCoef(Layer).begin(), thisConstructNewSh.AbsBeamBackCoef(Layer).end(), 0.0); } } } @@ -13475,17 +13473,17 @@ namespace SurfaceGeometry { thisConstruct.AbsDiffShade = 0.0; thisConstruct.AbsDiffBackShade = 0.0; thisConstruct.ShadeAbsorpThermal = 0.0; - thisConstruct.AbsBeamShadeCoef = 0.0; + std::fill(thisConstruct.AbsBeamShadeCoef.begin(), thisConstruct.AbsBeamShadeCoef.end(), 0.0); thisConstruct.TransDiff = 0.0; thisConstruct.TransDiffVis = 0.0; thisConstruct.ReflectSolDiffBack = 0.0; thisConstruct.ReflectSolDiffFront = 0.0; thisConstruct.ReflectVisDiffBack = 0.0; thisConstruct.ReflectVisDiffFront = 0.0; - thisConstruct.TransSolBeamCoef = 0.0; - thisConstruct.TransVisBeamCoef = 0.0; - thisConstruct.ReflSolBeamFrontCoef = 0.0; - thisConstruct.ReflSolBeamBackCoef = 0.0; + std::fill(thisConstruct.TransSolBeamCoef.begin(), thisConstruct.TransSolBeamCoef.end(), 0.0); + std::fill(thisConstruct.TransVisBeamCoef.begin(), thisConstruct.TransVisBeamCoef.end(), 0.0); + std::fill(thisConstruct.ReflSolBeamFrontCoef.begin(), thisConstruct.ReflSolBeamFrontCoef.end(), 0.0); + std::fill(thisConstruct.ReflSolBeamBackCoef.begin(), thisConstruct.ReflSolBeamBackCoef.end(), 0.0); thisConstruct.W5FrameDivider = 0; thisConstruct.FromWindow5DataFile = false; thisConstruct.W5FileMullionWidth = 0.0; @@ -13493,10 +13491,8 @@ namespace SurfaceGeometry { thisConstruct.W5FileGlazingSysWidth = 0.0; thisConstruct.W5FileGlazingSysHeight = 0.0; for (int Layer = 1; Layer <= state.dataHeatBal->MaxSolidWinLayers; ++Layer) { - for (int index = 1; index <= DataSurfaces::MaxPolyCoeff; ++index) { - thisConstruct.AbsBeamCoef(Layer)(index) = 0.0; - thisConstruct.AbsBeamBackCoef(Layer)(index) = 0.0; - } + std::fill(thisConstruct.AbsBeamCoef(Layer).begin(), thisConstruct.AbsBeamCoef(Layer).end(), 0.0); + std::fill(thisConstruct.AbsBeamBackCoef(Layer).begin(), thisConstruct.AbsBeamBackCoef(Layer).end(), 0.0); } } return (newConstruct); diff --git a/src/EnergyPlus/WindowManager.cc b/src/EnergyPlus/WindowManager.cc index 47ac924d445..bb4f4763f79 100644 --- a/src/EnergyPlus/WindowManager.cc +++ b/src/EnergyPlus/WindowManager.cc @@ -203,49 +203,49 @@ namespace Window { // Glazing system layer solar absorptance for each glass layer Array1D solabsDiff(maxGlassLayers); // Glazing system solar absorptance for a layer at each incidence angle - Array1D solabsPhiLay(maxIncidentAngles); + std::array solabsPhiLay; // Glazing system solar transmittance from fit at each incidence angle - Array1D tsolPhiFit(maxIncidentAngles); + std::array tsolPhiFit; // Glazing system visible transmittance from fit at each incidence angle - Array1D tvisPhiFit(maxIncidentAngles); + std::array tvisPhiFit; // Isolated glass solar transmittance for each incidence angle - Array2D tBareSolPhi(maxGlassLayers, maxIncidentAngles); + Array1D> tBareSolPhi(maxGlassLayers); Real64 t1; // = tBareSolPhi(,1)(,2) Real64 t2; // Isolated glass visible transmittance for each incidence angle - Array2D tBareVisPhi(maxGlassLayers, maxIncidentAngles); + Array1D> tBareVisPhi(maxGlassLayers); Real64 t1v; // = tBareVisPhi(,1)(,2) Real64 t2v; // Isolated glass front solar reflectance for each incidence angle - Array2D rfBareSolPhi(maxGlassLayers, maxIncidentAngles); + Array1D> rfBareSolPhi(maxGlassLayers); // Isolated glass front visible reflectance for each incidence angle - Array2D rfBareVisPhi(maxGlassLayers, maxIncidentAngles); + Array1D> rfBareVisPhi(maxGlassLayers); // Isolated glass back solar reflectance for each incidence angle - Array2D rbBareSolPhi(maxGlassLayers, maxIncidentAngles); + Array1D> rbBareSolPhi(maxGlassLayers); // Isolated glass back visible reflectance for each incidence angle - Array2D rbBareVisPhi(maxGlassLayers, maxIncidentAngles); + Array1D> rbBareVisPhi(maxGlassLayers); // Isolated glass front solar absorptance for each incidence angle - Array2D afBareSolPhi(maxGlassLayers, maxIncidentAngles); + Array1D> afBareSolPhi(maxGlassLayers); Real64 af1; // = afBareSolPhi(,1)(,2) Real64 af2; Real64 rbmf2; // Isolated glass #2 front beam reflectance // Isolated glass back solar absorptance for each incidence angle - Array2D abBareSolPhi(maxGlassLayers, maxIncidentAngles); + Array1D> abBareSolPhi(maxGlassLayers); // Glazing system solar absorptance for each angle of incidence - Array2D solabsPhi(maxGlassLayers, maxIncidentAngles); + Array1D> solabsPhi(maxGlassLayers); // Glazing system back solar absorptance for each angle of incidence - Array2D solabsBackPhi(maxGlassLayers, maxIncidentAngles); + Array1D> solabsBackPhi(maxGlassLayers); // Glazing system interior shade solar absorptance for each angle of incidence - Array1D solabsShadePhi(maxIncidentAngles); + std::array solabsShadePhi; // These need to stay as Array1D for a little longer because changing them spreads into many source files - Array1D tsolPhi(maxIncidentAngles); // Glazing system solar transmittance for each angle of incidence - Array1D rfsolPhi(maxIncidentAngles); // Glazing system solar front reflectance for each angle of incidence - Array1D rbsolPhi(maxIncidentAngles); // Glazing system solar back reflectance for each angle of incidence - Array1D tvisPhi(maxIncidentAngles); // Glazing system visible transmittance for each angle of incidence - Array1D rfvisPhi(maxIncidentAngles); // Glazing system visible front reflectance for each angle of incidence - Array1D rbvisPhi(maxIncidentAngles); // Glazing system visible back reflectance for each angle of incidence - Array1D CosPhiIndepVar(maxIncidentAngles); // Cos of incidence angles at 10-deg increments for curve fits + 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 CosPhiIndepVar; // Cos of incidence angles at 10-deg increments for curve fits Real64 ab1; // = abBareSolPhi(,1)(,2) Real64 ab2; @@ -280,8 +280,8 @@ namespace Window { Real64 RhoGlIR; // IR reflectance of inside face of inside glass int NGlass; // Number of glass layers in a construction int LayPtr; // Material number corresponding to LayNum - Real64 Phi; // Incidence angle (deg) - Real64 CosPhi; // Cosine of incidence angle + // Real64 Phi; // Incidence angle (deg) + // Real64 CosPhi; // Cosine of incidence angle Real64 tsolDiff; // Glazing system diffuse solar transmittance Real64 tvisDiff; // Glazing system diffuse visible transmittance int IGlassBack; // Glass layer number counted from back of window @@ -363,9 +363,10 @@ namespace Window { if (thisConstruct.WindowTypeEQL) continue; // skip Equivalent Layer Fenestration // handling of optical properties - for (int IPhi = 1; IPhi <= 10; ++IPhi) { - CosPhiIndepVar(IPhi) = std::cos((IPhi - 1) * 10.0 * Constant::DegToRadians); - } + constexpr int TotalIPhi = 10; + // for (int iPhi = 0; iPhi < TotalIPhi; ++iPhi) { + // CosPhiIndepVar[iPhi] = std::cos(iPhi * 10.0 * Constant::DegToRad); + // } TotLay = thisConstruct.TotLayers; @@ -496,7 +497,6 @@ namespace Window { lquasi = false; AllGlassIsSpectralAverage = true; - int constexpr TotalIPhi = 10; wm->LayerNum = {0}; // Loop over glass layers in the construction @@ -642,14 +642,14 @@ namespace Window { } } // End of loop over glass layers in the construction for front calculation - if (TotalIPhi > maxIncidentAngles) { + if (TotalIPhi > numPhis) { ShowSevereError(state, format("WindowManage::InitGlassOpticalCalculations = {}, Invalid maximum value of common incident angles = {}.", thisConstruct.Name, TotalIPhi)); ShowContinueError( state, - format("The maximum number of incident angles for each construct is {}. Please rearrange the dataset.", maxIncidentAngles)); + format("The maximum number of incident angles for each construct is {}. Please rearrange the dataset.", numPhis)); ShowFatalError(state, "Errors found getting inputs. Previous error(s) cause program termination."); } @@ -657,11 +657,11 @@ namespace Window { // Get glass layer properties, then glazing system properties (which include the // effect of inter-reflection among glass layers) at each incidence angle. - for (int IPhi = 1; IPhi <= TotalIPhi; ++IPhi) { + for (int iPhi = 0; iPhi < TotalIPhi; ++iPhi) { // 10 degree increment for incident angle is only value for a construction without a layer = SpectralAndAngle - Phi = double(IPhi - 1) * 10.0; - CosPhi = std::cos(Phi * Constant::DegToRadians); - if (std::abs(CosPhi) < 0.0001) CosPhi = 0.0; + // Real64 Phi = double(iPhi) * 10.0; + // Real64 CosPhi = std::cos(Phi * Constant::DegToRadians); + // if (std::abs(CosPhi) < 0.0001) CosPhi = 0.0; // For each wavelength, get glass layer properties at this angle of incidence // from properties at normal incidence @@ -671,7 +671,7 @@ namespace Window { assert(matGlass != nullptr); if (matGlass->windowOpticalData != Window::OpticalDataModel::SpectralAndAngle) { for (int ILam = 1; ILam <= numpt[IGlass - 1]; ++ILam) { - TransAndReflAtPhi(CosPhi, + TransAndReflAtPhi(cosPhis[iPhi], t[IGlass - 1][ILam - 1], rff[IGlass - 1][ILam - 1], rbb[IGlass - 1][ILam - 1], @@ -686,23 +686,23 @@ namespace Window { for (int ILam = 1; ILam <= (int)wm->wle.size(); ++ILam) { Real64 lam = wm->wle[ILam - 1]; wlt[IGlass - 1][ILam - 1] = lam; - tPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngTransDataPtr, Phi, lam); - rfPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngFRefleDataPtr, Phi, lam); - rbPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngBRefleDataPtr, Phi, lam); + tPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngTransDataPtr, iPhi * 10.0, lam); + rfPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngFRefleDataPtr, iPhi * 10.0, lam); + rbPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngBRefleDataPtr, iPhi * 10.0, lam); } } // For use with between-glass shade/blind, save angular properties of isolated glass // for case that all glass layers were input with spectral-average properties // only used by between-glass shades or blinds if (AllGlassIsSpectralAverage) { - tBareSolPhi(IGlass, IPhi) = tPhi[IGlass - 1][0]; - tBareVisPhi(IGlass, IPhi) = tPhi[IGlass - 1][1]; - rfBareSolPhi(IGlass, IPhi) = rfPhi[IGlass - 1][0]; - rfBareVisPhi(IGlass, IPhi) = rfPhi[IGlass - 1][1]; - rbBareSolPhi(IGlass, IPhi) = rbPhi[IGlass - 1][0]; - rbBareVisPhi(IGlass, IPhi) = rbPhi[IGlass - 1][1]; - afBareSolPhi(IGlass, IPhi) = max(0.0, 1.0 - (tBareSolPhi(IGlass, IPhi) + rfBareSolPhi(IGlass, IPhi))); - abBareSolPhi(IGlass, IPhi) = max(0.0, 1.0 - (tBareSolPhi(IGlass, IPhi) + rbBareSolPhi(IGlass, IPhi))); + tBareSolPhi(IGlass)[iPhi] = tPhi[IGlass - 1][0]; + tBareVisPhi(IGlass)[iPhi] = tPhi[IGlass - 1][1]; + rfBareSolPhi(IGlass)[iPhi] = rfPhi[IGlass - 1][0]; + rfBareVisPhi(IGlass)[iPhi] = rfPhi[IGlass - 1][1]; + rbBareSolPhi(IGlass)[iPhi] = rbPhi[IGlass - 1][0]; + rbBareVisPhi(IGlass)[iPhi] = rbPhi[IGlass - 1][1]; + afBareSolPhi(IGlass)[iPhi] = max(0.0, 1.0 - (tBareSolPhi(IGlass)[iPhi] + rfBareSolPhi(IGlass)[iPhi])); + abBareSolPhi(IGlass)[iPhi] = max(0.0, 1.0 - (tBareSolPhi(IGlass)[iPhi] + rbBareSolPhi(IGlass)[iPhi])); } } @@ -721,15 +721,15 @@ namespace Window { // Get solar properties of system by integrating over solar irradiance spectrum. // For now it is assumed that the exterior and interior irradiance spectra are the same. - tsolPhi(IPhi) = solarSpectrumAverage(state, stPhi); - rfsolPhi(IPhi) = solarSpectrumAverage(state, srfPhi); - rbsolPhi(IPhi) = solarSpectrumAverage(state, srbPhi); + tsolPhi[iPhi] = solarSpectrumAverage(state, stPhi); + rfsolPhi[iPhi] = solarSpectrumAverage(state, srfPhi); + rbsolPhi[iPhi] = solarSpectrumAverage(state, srbPhi); for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { for (int ILam = 1; ILam <= nume; ++ILam) { sabsPhi(ILam) = saPhi(IGlass, ILam); } - solabsPhi(IGlass, IPhi) = solarSpectrumAverage(state, sabsPhi); + solabsPhi(IGlass)[iPhi] = solarSpectrumAverage(state, sabsPhi); } // Get visible properties of system by integrating over solar irradiance @@ -740,23 +740,23 @@ namespace Window { // without spectral data, as indicated by the argument "2". if (lquasi) SystemSpectralPropertiesAtPhi(state, 2, NGlass, 0.37, 0.78, numpt, wlt, tPhi, rfPhi, rbPhi, stPhi, srfPhi, srbPhi, saPhi); - tvisPhi(IPhi) = visibleSpectrumAverage(state, stPhi); - rfvisPhi(IPhi) = visibleSpectrumAverage(state, srfPhi); - rbvisPhi(IPhi) = visibleSpectrumAverage(state, srbPhi); + tvisPhi[iPhi] = visibleSpectrumAverage(state, stPhi); + rfvisPhi[iPhi] = visibleSpectrumAverage(state, srfPhi); + rbvisPhi[iPhi] = visibleSpectrumAverage(state, srbPhi); } // End of loop over incidence angles for front calculation // only used by between-glass shades or blinds if (AllGlassIsSpectralAverage) { for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { - W5LsqFit(CosPhiIndepVar, tBareSolPhi(IGlass, _), 6, 1, TotalIPhi, thisConstruct.tBareSolCoef(IGlass)); - W5LsqFit(CosPhiIndepVar, tBareVisPhi(IGlass, _), 6, 1, TotalIPhi, thisConstruct.tBareVisCoef(IGlass)); - W5LsqFit(CosPhiIndepVar, rfBareSolPhi(IGlass, _), 6, 1, TotalIPhi, thisConstruct.rfBareSolCoef(IGlass)); - W5LsqFit(CosPhiIndepVar, rfBareVisPhi(IGlass, _), 6, 1, TotalIPhi, thisConstruct.rfBareVisCoef(IGlass)); - W5LsqFit(CosPhiIndepVar, rbBareSolPhi(IGlass, _), 6, 1, TotalIPhi, thisConstruct.rbBareSolCoef(IGlass)); - W5LsqFit(CosPhiIndepVar, rbBareVisPhi(IGlass, _), 6, 1, TotalIPhi, thisConstruct.rbBareVisCoef(IGlass)); - W5LsqFit(CosPhiIndepVar, afBareSolPhi(IGlass, _), 6, 1, TotalIPhi, thisConstruct.afBareSolCoef(IGlass)); - W5LsqFit(CosPhiIndepVar, abBareSolPhi(IGlass, _), 6, 1, TotalIPhi, thisConstruct.abBareSolCoef(IGlass)); + W5LsqFit(cosPhis, tBareSolPhi(IGlass), thisConstruct.tBareSolCoef(IGlass)); + W5LsqFit(cosPhis, tBareVisPhi(IGlass), thisConstruct.tBareVisCoef(IGlass)); + W5LsqFit(cosPhis, rfBareSolPhi(IGlass), thisConstruct.rfBareSolCoef(IGlass)); + W5LsqFit(cosPhis, rfBareVisPhi(IGlass), thisConstruct.rfBareVisCoef(IGlass)); + W5LsqFit(cosPhis, rbBareSolPhi(IGlass), thisConstruct.rbBareSolCoef(IGlass)); + W5LsqFit(cosPhis, rbBareVisPhi(IGlass), thisConstruct.rbBareVisCoef(IGlass)); + W5LsqFit(cosPhis, afBareSolPhi(IGlass), thisConstruct.afBareSolCoef(IGlass)); + W5LsqFit(cosPhis, abBareSolPhi(IGlass), thisConstruct.abBareSolCoef(IGlass)); } } @@ -770,7 +770,7 @@ namespace Window { thisConstruct.TransDiff = tsolDiff; thisConstruct.TransDiffVis = tvisDiff; for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { - solabsPhiLay({1, TotalIPhi}) = solabsPhi(IGlass, {1, TotalIPhi}); + solabsPhiLay = solabsPhi(IGlass); // Is this a deep copy? solabsDiff(IGlass) = DiffuseAverage(solabsPhiLay); thisConstruct.AbsDiff(IGlass) = solabsDiff(IGlass); @@ -778,12 +778,12 @@ namespace Window { // all glass layers were input with spectral-average properties // only used by between-glass shades or blinds if (AllGlassIsSpectralAverage) { - thisConstruct.tBareSolDiff(IGlass) = DiffuseAverage(tBareSolPhi(IGlass, {1, TotalIPhi})); - thisConstruct.tBareVisDiff(IGlass) = DiffuseAverage(tBareVisPhi(IGlass, {1, TotalIPhi})); - thisConstruct.rfBareSolDiff(IGlass) = DiffuseAverage(rfBareSolPhi(IGlass, {1, TotalIPhi})); - thisConstruct.rfBareVisDiff(IGlass) = DiffuseAverage(rfBareVisPhi(IGlass, {1, TotalIPhi})); - thisConstruct.rbBareSolDiff(IGlass) = DiffuseAverage(rbBareSolPhi(IGlass, {1, TotalIPhi})); - thisConstruct.rbBareVisDiff(IGlass) = DiffuseAverage(rbBareVisPhi(IGlass, {1, TotalIPhi})); + thisConstruct.tBareSolDiff(IGlass) = DiffuseAverage(tBareSolPhi(IGlass)); + thisConstruct.tBareVisDiff(IGlass) = DiffuseAverage(tBareVisPhi(IGlass)); + thisConstruct.rfBareSolDiff(IGlass) = DiffuseAverage(rfBareSolPhi(IGlass)); + thisConstruct.rfBareVisDiff(IGlass) = DiffuseAverage(rfBareVisPhi(IGlass)); + thisConstruct.rbBareSolDiff(IGlass) = DiffuseAverage(rbBareSolPhi(IGlass)); + thisConstruct.rbBareVisDiff(IGlass) = DiffuseAverage(rbBareVisPhi(IGlass)); thisConstruct.afBareSolDiff(IGlass) = max(0.0, 1.0 - (thisConstruct.tBareSolDiff(IGlass) + thisConstruct.rfBareSolDiff(IGlass))); thisConstruct.abBareSolDiff(IGlass) = max(0.0, 1.0 - (thisConstruct.tBareSolDiff(IGlass) + thisConstruct.rbBareSolDiff(IGlass))); } @@ -858,10 +858,10 @@ namespace Window { // The glazing system properties include the effect of inter-reflection among glass layers, // but exclude the effect of a shade or blind if present in the construction. // When a construction has a layer = SpectralAndAngle, the 10 degree increment will be overridden. - for (int IPhi = 1; IPhi <= TotalIPhi; ++IPhi) { - Phi = double(IPhi - 1) * 10.0; - CosPhi = std::cos(Phi * Constant::DegToRadians); - if (std::abs(CosPhi) < 0.0001) CosPhi = 0.0; + for (int iPhi = 0; iPhi < TotalIPhi; ++iPhi) { + // Real64 Phi = double(iPhi) * 10.0; + // Real64 CosPhi = std::cos(Phi * Constant::DegToRad); + // if (std::abs(CosPhi) < 0.0001) CosPhi = 0.0; // For each wavelength, get glass layer properties at this angle of incidence // from properties at normal incidence @@ -872,7 +872,7 @@ namespace Window { if (matGlass->windowOpticalData != Window::OpticalDataModel::SpectralAndAngle) { for (int ILam = 1; ILam <= numpt[IGlass - 1]; ++ILam) { - TransAndReflAtPhi(CosPhi, + TransAndReflAtPhi(cosPhis[iPhi], t[IGlass - 1][ILam - 1], rff[IGlass - 1][ILam - 1], rbb[IGlass - 1][ILam - 1], @@ -888,9 +888,9 @@ namespace Window { for (int ILam = 1; ILam <= (int)wm->wle.size(); ++ILam) { Real64 lam = wm->wle[ILam - 1]; wlt[IGlass - 1][ILam - 1] = lam; - tPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngTransDataPtr, Phi, lam); - rfPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngFRefleDataPtr, Phi, lam); - rbPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngBRefleDataPtr, Phi, lam); + tPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngTransDataPtr, iPhi * dPhiDeg, lam); + rfPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngFRefleDataPtr, iPhi * dPhiDeg, lam); + rbPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngBRefleDataPtr, iPhi * dPhiDeg, lam); } } } @@ -912,14 +912,14 @@ namespace Window { for (int j = 1; j <= nume; ++j) { sabsPhi(j) = saPhi(IGlass, j); } - solabsBackPhi(IGlass, IPhi) = solarSpectrumAverage(state, sabsPhi); + solabsBackPhi(IGlass)[iPhi] = solarSpectrumAverage(state, sabsPhi); } } // End of loop over incidence angles for back calculation for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { IGlassBack = NGlass - IGlass + 1; - thisConstruct.AbsDiffBack(IGlass) = DiffuseAverage(solabsBackPhi(IGlassBack, {1, 10})); + thisConstruct.AbsDiffBack(IGlass) = DiffuseAverage(solabsBackPhi(IGlassBack)); } //----------------------------------------------------------------------- @@ -957,13 +957,13 @@ namespace Window { ShadeReflFacVis = 1.0 / (1.0 - ShadeReflVis * constr.ReflectVisDiffBack); // Front incident solar, beam, interior shade - for (int IPhi = 1; IPhi <= 10; ++IPhi) { + for (int iPhi = 0; iPhi < TotalIPhi; ++iPhi) { for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { - solabsPhi(IGlass, IPhi) += tsolPhi(IPhi) * ShadeRefl * ShadeReflFac * constr.AbsDiffBack(IGlass); + solabsPhi(IGlass)[iPhi] += tsolPhi[iPhi] * ShadeRefl * ShadeReflFac * constr.AbsDiffBack(IGlass); } - solabsShadePhi(IPhi) = tsolPhi(IPhi) * ShadeReflFac * ShadeAbs; - tsolPhi(IPhi) *= ShadeReflFac * ShadeTrans; - tvisPhi(IPhi) *= ShadeReflFacVis * ShadeTransVis; + solabsShadePhi[iPhi] = tsolPhi[iPhi] * ShadeReflFac * ShadeAbs; + tsolPhi[iPhi] *= ShadeReflFac * ShadeTrans; + tvisPhi[iPhi] *= ShadeReflFacVis * ShadeTransVis; } // Front incident solar, diffuse, interior shade @@ -1006,13 +1006,13 @@ namespace Window { ShadeReflFac = 1.0 / (1.0 - ShadeRefl * constr.ReflectSolDiffFront); ShadeReflFacVis = 1.0 / (1.0 - ShadeReflVis * constr.ReflectVisDiffFront); - for (int IPhi = 1; IPhi <= 10; ++IPhi) { + for (int iPhi = 0; iPhi < TotalIPhi; ++iPhi) { for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { - solabsPhi(IGlass, IPhi) = ShadeTrans * solabsDiff(IGlass) * ShadeReflFac; + solabsPhi(IGlass)[iPhi] = ShadeTrans * solabsDiff(IGlass) * ShadeReflFac; } - tsolPhi(IPhi) = ShadeTrans * ShadeReflFac * tsolDiff; - tvisPhi(IPhi) = ShadeTransVis * ShadeReflFacVis * tvisDiff; - solabsShadePhi(IPhi) = ShadeAbs * (1.0 + ShadeTrans * ShadeReflFac * constr.ReflectSolDiffFront); + tsolPhi[iPhi] = ShadeTrans * ShadeReflFac * tsolDiff; + tvisPhi[iPhi] = ShadeTransVis * ShadeReflFacVis * tvisDiff; + solabsShadePhi[iPhi] = ShadeAbs * (1.0 + ShadeTrans * ShadeReflFac * constr.ReflectSolDiffFront); } // Front incident solar, diffuse, exterior shade/screen/blind @@ -1074,16 +1074,16 @@ namespace Window { // Front incident solar, beam, between-glass shade, NGlass = 2 - for (int IPhi = 1; IPhi <= 10; ++IPhi) { - t1 = tBareSolPhi(1, IPhi); - t1v = tBareVisPhi(1, IPhi); - af1 = afBareSolPhi(1, IPhi); - ab1 = abBareSolPhi(1, IPhi); - tsolPhi(IPhi) = t1 * (tsh + rsh * rb1 * tsh + tsh * rf2 * rsh) * td2; - tvisPhi(IPhi) = t1v * (tshv + rshv * rb1v * tshv + tshv * rf2v * rshv) * td2v; - solabsShadePhi(IPhi) = t1 * (ash + rsh * rb1 + tsh * rf2) * ash; - solabsPhi(1, IPhi) = af1 + t1 * (rsh + rsh * rb1 * rsh + tsh * rf2 * tsh) * abd1; - solabsPhi(2, IPhi) = t1 * (tsh + rsh * rb1 * tsh + tsh * rf2 * rsh) * afd2; + for (int iPhi = 0; iPhi < TotalIPhi; ++iPhi) { + t1 = tBareSolPhi(1)[iPhi]; + t1v = tBareVisPhi(1)[iPhi]; + af1 = afBareSolPhi(1)[iPhi]; + ab1 = abBareSolPhi(1)[iPhi]; + tsolPhi[iPhi] = t1 * (tsh + rsh * rb1 * tsh + tsh * rf2 * rsh) * td2; + tvisPhi[iPhi] = t1v * (tshv + rshv * rb1v * tshv + tshv * rf2v * rshv) * td2v; + solabsShadePhi[iPhi] = t1 * (ash + rsh * rb1 + tsh * rf2) * ash; + solabsPhi(1)[iPhi] = af1 + t1 * (rsh + rsh * rb1 * rsh + tsh * rf2 * tsh) * abd1; + solabsPhi(2)[iPhi] = t1 * (tsh + rsh * rb1 * tsh + tsh * rf2 * rsh) * afd2; } // End of loop over incidence angles // Front incident solar, diffuse, between-glass shade, NGlass = 2 @@ -1117,23 +1117,23 @@ namespace Window { // Front incident solar, beam, between-glass shade, NGlass = 3 - for (int IPhi = 1; IPhi <= 10; ++IPhi) { - t1 = tBareSolPhi(1, IPhi); - t1v = tBareVisPhi(1, IPhi); - t2 = tBareSolPhi(2, IPhi); - t2v = tBareVisPhi(2, IPhi); - af1 = afBareSolPhi(1, IPhi); - af2 = afBareSolPhi(2, IPhi); - ab1 = abBareSolPhi(1, IPhi); - ab2 = abBareSolPhi(2, IPhi); + for (int iPhi = 0; iPhi < TotalIPhi; ++iPhi) { + t1 = tBareSolPhi(1)[iPhi]; + t1v = tBareVisPhi(1)[iPhi]; + t2 = tBareSolPhi(2)[iPhi]; + t2v = tBareVisPhi(2)[iPhi]; + af1 = afBareSolPhi(1)[iPhi]; + af2 = afBareSolPhi(2)[iPhi]; + ab1 = abBareSolPhi(1)[iPhi]; + ab2 = abBareSolPhi(2)[iPhi]; rbmf2 = max(0.0, 1.0 - (t2 + af2)); - tsolPhi(IPhi) = t1 * t2 * (tsh + tsh * rf3 * rsh + rsh * td2 * rb1 * td2 * tsh + rsh * rb2 * tsh) * td3; - tvisPhi(IPhi) = t1v * t2v * (tshv + tshv * rf3v * rshv + rshv * td2v * rb1v * td2v * tshv + rshv * rb2v * tshv) * td3v; - solabsShadePhi(IPhi) = t1 * t2 * (1 + rsh * td2 * rb1 * td2 + rsh * rb2) * ash; - solabsPhi(1, IPhi) = af1 + rbmf2 * ab1 + t1 * t2 * rsh * (1 + rf3 * tsh + rb2 * rsh + td2 * rb1 * td2 * rsh) * td2 * abd1; - solabsPhi(2, IPhi) = t1 * af2 + t1 * t2 * ((rsh + tsh * rf3 * tsh + rsh * rb2 * rsh) * abd2 + rsh * td2 * rb1 * afd2); - solabsPhi(3, IPhi) = t1 * t2 * (tsh + rsh * (rb2 * tsh + td2 * rb2 * td2 * tsh + rf3 * rsh)) * afd3; + tsolPhi[iPhi] = t1 * t2 * (tsh + tsh * rf3 * rsh + rsh * td2 * rb1 * td2 * tsh + rsh * rb2 * tsh) * td3; + tvisPhi[iPhi] = t1v * t2v * (tshv + tshv * rf3v * rshv + rshv * td2v * rb1v * td2v * tshv + rshv * rb2v * tshv) * td3v; + solabsShadePhi[iPhi] = t1 * t2 * (1 + rsh * td2 * rb1 * td2 + rsh * rb2) * ash; + solabsPhi(1)[iPhi] = af1 + rbmf2 * ab1 + t1 * t2 * rsh * (1 + rf3 * tsh + rb2 * rsh + td2 * rb1 * td2 * rsh) * td2 * abd1; + solabsPhi(2)[iPhi] = t1 * af2 + t1 * t2 * ((rsh + tsh * rf3 * tsh + rsh * rb2 * rsh) * abd2 + rsh * td2 * rb1 * afd2); + solabsPhi(3)[iPhi] = t1 * t2 * (tsh + rsh * (rb2 * tsh + td2 * rb2 * td2 * tsh + rf3 * rsh)) * afd3; } // End of loop over incidence angle // Front incident solar, diffuse, between-glass shade, NGlass = 3 @@ -1438,44 +1438,38 @@ namespace Window { // visible transmittance as polynomials in cosine of incidence angle if (!BlindOn && !ScreenOn) { // Bare glass or shade on - W5LsqFit(CosPhiIndepVar, tsolPhi, 6, 1, TotalIPhi, thisConstruct.TransSolBeamCoef); - W5LsqFit(CosPhiIndepVar, rfsolPhi, 6, 1, TotalIPhi, thisConstruct.ReflSolBeamFrontCoef); - W5LsqFit(CosPhiIndepVar, rbsolPhi, 6, 1, TotalIPhi, thisConstruct.ReflSolBeamBackCoef); - W5LsqFit(CosPhiIndepVar, tvisPhi, 6, 1, TotalIPhi, thisConstruct.TransVisBeamCoef); - Array1D DepVarCurveFit(TotalIPhi); - Array1D CoeffsCurveFit(6); + W5LsqFit(cosPhis, tsolPhi, thisConstruct.TransSolBeamCoef); + W5LsqFit(cosPhis, rfsolPhi, thisConstruct.ReflSolBeamFrontCoef); + W5LsqFit(cosPhis, rbsolPhi, thisConstruct.ReflSolBeamBackCoef); + W5LsqFit(cosPhis, tvisPhi, thisConstruct.TransVisBeamCoef); for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { // Front absorptance coefficients for glass layers - DepVarCurveFit = solabsPhi(IGlass, {1, TotalIPhi}); - W5LsqFit(CosPhiIndepVar, DepVarCurveFit, 6, 1, TotalIPhi, CoeffsCurveFit); - thisConstruct.AbsBeamCoef(IGlass) = CoeffsCurveFit; + W5LsqFit(cosPhis, solabsPhi(IGlass), thisConstruct.AbsBeamCoef(IGlass)); + // Back absorptance coefficients for glass layers IGlassBack = NGlass - IGlass + 1; - DepVarCurveFit = solabsBackPhi(IGlassBack, {1, TotalIPhi}); - W5LsqFit(CosPhiIndepVar, DepVarCurveFit, 6, 1, TotalIPhi, CoeffsCurveFit); - thisConstruct.AbsBeamBackCoef(IGlass) = CoeffsCurveFit; + W5LsqFit(cosPhis, solabsBackPhi(IGlassBack), thisConstruct.AbsBeamBackCoef(IGlass)); } // To check goodness of fit //Tuned - for (int IPhi = 1; IPhi <= TotalIPhi; ++IPhi) { - tsolPhiFit(IPhi) = 0.0; - tvisPhiFit(IPhi) = 0.0; - - Phi = double(IPhi - 1) * 10.0; - CosPhi = std::cos(Phi * Constant::DegToRadians); - if (std::abs(CosPhi) < 0.0001) CosPhi = 0.0; - Real64 cos_pow(1.0); - for (int CoefNum = 1; CoefNum <= 6; ++CoefNum) { - cos_pow *= CosPhi; - tsolPhiFit(IPhi) += thisConstruct.TransSolBeamCoef(CoefNum) * cos_pow; - tvisPhiFit(IPhi) += thisConstruct.TransVisBeamCoef(CoefNum) * cos_pow; + for (int iPhi = 0; iPhi < TotalIPhi; ++iPhi) { + tsolPhiFit[iPhi] = 0.0; + tvisPhiFit[iPhi] = 0.0; + + // Real64 Phi = double(iPhi) * 10.0; + // Real64 CosPhi = std::cos(Phi * Constant::DegToRad); + // if (std::abs(CosPhi) < 0.0001) CosPhi = 0.0; + + for (int CoefNum = 0; CoefNum < DataSurfaces::MaxPolyCoeff; ++CoefNum) { + tsolPhiFit[iPhi] += thisConstruct.TransSolBeamCoef[CoefNum] * cosPhis[iPhi]; + tvisPhiFit[iPhi] += thisConstruct.TransVisBeamCoef[CoefNum] * cosPhis[iPhi]; } } } - if (ShadeOn) W5LsqFit(CosPhiIndepVar, solabsShadePhi, 6, 1, TotalIPhi, thisConstruct.AbsBeamShadeCoef); + if (ShadeOn) W5LsqFit(cosPhis, solabsShadePhi, thisConstruct.AbsBeamShadeCoef); } // End of loop over constructions @@ -1604,28 +1598,28 @@ namespace Window { auto &s_mat = state.dataMaterial; auto &s_surf = state.dataSurface; - for (int ConstrNum = 1; ConstrNum <= state.dataHeatBal->TotConstructs; ++ConstrNum) { - auto &thisConstruct = state.dataConstruction->Construct(ConstrNum); - if (thisConstruct.FromWindow5DataFile) continue; - if (thisConstruct.WindowTypeBSDF) continue; - thisConstruct.TransDiff = 0.0; - thisConstruct.TransDiffVis = 0.0; - thisConstruct.AbsDiffBackShade = 0.0; - thisConstruct.ShadeAbsorpThermal = 0.0; - thisConstruct.ReflectSolDiffBack = 0.0; - thisConstruct.ReflectSolDiffFront = 0.0; - thisConstruct.ReflectVisDiffFront = 0.0; - thisConstruct.AbsBeamShadeCoef = 0.0; - thisConstruct.TransSolBeamCoef = 0.0; - thisConstruct.ReflSolBeamFrontCoef = 0.0; - thisConstruct.ReflSolBeamBackCoef = 0.0; - thisConstruct.TransVisBeamCoef = 0.0; - thisConstruct.AbsDiff = 0.0; - thisConstruct.AbsDiffBack = 0.0; + for (auto &constr : state.dataConstruction->Construct) { + if (constr.FromWindow5DataFile) continue; + if (constr.WindowTypeBSDF) continue; + constr.TransDiff = 0.0; + constr.TransDiffVis = 0.0; + constr.AbsDiffBackShade = 0.0; + constr.ShadeAbsorpThermal = 0.0; + constr.ReflectSolDiffBack = 0.0; + constr.ReflectSolDiffFront = 0.0; + constr.ReflectVisDiffFront = 0.0; + + std::fill(constr.AbsBeamShadeCoef.begin(), constr.AbsBeamShadeCoef.end(), 0.0); + std::fill(constr.TransSolBeamCoef.begin(), constr.TransSolBeamCoef.end(), 0.0); + std::fill(constr.ReflSolBeamFrontCoef.begin(), constr.ReflSolBeamFrontCoef.end(), 0.0); + std::fill(constr.ReflSolBeamBackCoef.begin(), constr.ReflSolBeamBackCoef.begin(), 0.0); + std::fill(constr.TransVisBeamCoef.begin(), constr.TransVisBeamCoef.end(), 0.0); + constr.AbsDiff = 0.0; + constr.AbsDiffBack = 0.0; for (int Layer = 1; Layer <= state.dataHeatBal->MaxSolidWinLayers; ++Layer) { - for (int index = 1; index <= DataSurfaces::MaxPolyCoeff; ++index) { - state.dataConstruction->Construct(state.dataHeatBal->TotConstructs).AbsBeamCoef(Layer)(index) = 0.0; - state.dataConstruction->Construct(state.dataHeatBal->TotConstructs).AbsBeamBackCoef(Layer)(index) = 0.0; + for (int index = 0; index < DataSurfaces::MaxPolyCoeff; ++index) { + state.dataConstruction->Construct(state.dataHeatBal->TotConstructs).AbsBeamCoef(Layer)[index] = 0.0; + state.dataConstruction->Construct(state.dataHeatBal->TotConstructs).AbsBeamBackCoef(Layer)[index] = 0.0; } } } @@ -5452,7 +5446,7 @@ namespace Window { } // InterpolateBetweenFourValues() //************************************************************************** - +#ifdef GET_OUT void W5LsqFit(Array1S const IndepVar, // Independent variables Array1S const DepVar, // Dependent variables int const N, // Order of polynomial @@ -5538,7 +5532,87 @@ namespace Window { --L; } } // W5LsqFit() +#endif // GET_OUT + + void W5LsqFit(std::array const &ivars, // Independent variables + std::array const &dvars, // Dependent variables + std::array &coeffs // Polynomial coefficients from fit + ) + { + + // SUBROUTINE INFORMATION: + // AUTHOR George Walton + // DATE WRITTEN April 1976 + // MODIFIED November 1999 F.Winkelmann + // RE-ENGINEERED na + // PURPOSE OF THIS SUBROUTINE: + // Does least squares fit for coefficients of a polynomial + // that gives a window property, such as transmittance, as a function of + // the cosine of the angle of incidence. The polynomial is of the + // form C1*X + C2*X**2 + C3*X**3 + ... +CN*X**N, where N <= 6. + // Adapted from BLAST subroutine LSQFIT. + + std::array, DataSurfaces::MaxPolyCoeff> A; // Least squares derivative matrix + std::array B; // Least squares derivative vector + std::array, DataSurfaces::MaxPolyCoeff> D; // Powers of independent variable + + // Set up least squares matrix + for (int M = 0; M < numPhis; ++M) { + D[0][M] = ivars[M]; + } + + for (int i = 1; i < DataSurfaces::MaxPolyCoeff; ++i) { + for (int M = 0; M < numPhis; ++M) { + D[i][M] = D[i - 1][M] * ivars[M]; + } + } + + for (int i = 0; i < DataSurfaces::MaxPolyCoeff; ++i) { + Real64 SUM = 0.0; + for (int M = 0; M < numPhis; ++M) { + SUM += dvars[M] * D[i][M]; + } + B[i] = SUM; + for (int j = 0; j < DataSurfaces::MaxPolyCoeff; ++j) { + Real64 SUM2 = 0.0; + for (int M = 0; M < numPhis; ++M) { + SUM2 += D[i][M] * D[j][M]; + } + A[j][i] = SUM2; + A[i][j] = SUM2; + } + } + + // Solve the simultaneous equations using Gauss elimination + int order1 = DataSurfaces::MaxPolyCoeff - 1; + for (int K = 0; K < order1; ++K) { + int KP1 = K + 1; + for (int i = KP1; i < DataSurfaces::MaxPolyCoeff; ++i) { + Real64 ACON = A[K][i] / A[K][K]; + B[i] -= B[K] * ACON; + for (int j = K; j < DataSurfaces::MaxPolyCoeff; ++j) { + A[j][i] -= A[j][K] * ACON; + } + } + } + + // Perform back substitution + coeffs[DataSurfaces::MaxPolyCoeff-1] = B[DataSurfaces::MaxPolyCoeff-1] / A[DataSurfaces::MaxPolyCoeff-1][DataSurfaces::MaxPolyCoeff-1]; + int LP1 = DataSurfaces::MaxPolyCoeff - 1; + int L = DataSurfaces::MaxPolyCoeff - 2; + + while (L >= 0) { + Real64 SUM = 0.0; + for (int j = LP1; j < DataSurfaces::MaxPolyCoeff; ++j) { + SUM += A[j][L] * coeffs[j]; + } + coeffs[L] = (B[L] - SUM) / A[L][L]; + LP1 = L; + --L; + } + } // W5LsqFit() + //******************************************************************************** void W5LsqFit2(Array1A const IndepVar, // Independent variables @@ -5634,7 +5708,7 @@ namespace Window { } // W5LsqFit2() //*********************************************************************** - +#ifdef GET_OUT Real64 DiffuseAverage(Array1S const PropertyValue) // Property value at angles of incidence { @@ -5661,18 +5735,50 @@ namespace Window { // SUBROUTINE ARGUMENT DEFINITIONS: // 0,10,20,...,80,90 degrees - Real64 const DPhiR(10.0 * Constant::DegToRadians); // Half of 10-deg incidence angle increment (radians) - DiffuseAverage = 0.0; for (int IPhi = 1; IPhi <= 9; ++IPhi) { DiffuseAverage += - 0.5 * DPhiR * (PropertyValue(IPhi) * std::sin(2.0 * (IPhi - 1) * DPhiR) + PropertyValue(IPhi + 1) * std::sin(2.0 * IPhi * DPhiR)); + 0.5 * DPhiR * (PropertyValue(IPhi) * std::sin(2.0 * (IPhi - 1) * dPhiRad) + PropertyValue(IPhi + 1) * std::sin(2.0 * IPhi * dPhiRad)); } if (DiffuseAverage < 0.0) DiffuseAverage = 0.0; return DiffuseAverage; } // DiffuseAverage() +#endif // GET_OUT + + Real64 DiffuseAverage(std::array const &props) // Property value at angles of incidence + { + + // FUNCTION INFORMATION: + // AUTHOR Fred Winkelmann + // DATE WRITTEN November 1999 + // MODIFIED na + // RE-ENGINEERED na + // PURPOSE OF THIS FUNCTION: + // Calculate value of property, such as transmittance, for hemispherical + // diffuse radiation from property values at angles of incidence from + // 0 to 90 degrees in 10 degree increments. + + // METHODOLOGY EMPLOYED: + // By Simpson's rule, evaluates the integral from 0 to 90 deg of + // 2*PropertyValue(phi)*cos(phi)*sin(phi)*dphi (which is same as + // PropertyValue(phi)*sin(2*phi)*dphi) + + // Locals + // SUBROUTINE ARGUMENT DEFINITIONS: + // 0,10,20,...,80,90 degrees + + constexpr Real64 dPhiR = dPhiDeg * Constant::DegToRad; // Half of 10-deg incidence angle increment (radians) + + Real64 avg = 0.0; + for (int iPhi = 0; iPhi < numPhis - 1; ++iPhi) { + avg += 0.5 * dPhiR * (props[iPhi] * std::sin(2.0 * iPhi * dPhiR) + props[iPhi + 1] * std::sin(2.0 * (iPhi + 1) * dPhiR)); + } + + return (avg < 0.0) ? 0.0 : avg; + } // DiffuseAverage() + //************************************************************************************* void CalcWinFrameAndDividerTemps(EnergyPlusData &state, @@ -7673,7 +7779,6 @@ namespace Window { c.dim(15); p.dim(16); - Array1D fEdgeSource(10); // Slat edge correction factor vs source elevation Array1D fEdgeA(2); // Average slat edge correction factor for upper and lower quadrants // seen by window blind Array1D j(6); // Slat section radiosity vector @@ -7766,7 +7871,6 @@ namespace Window { } // Irradiances - for (int k = 1; k <= 6; ++k) { G(k) = 0.0; for (int m = 1; m <= 6; ++m) { @@ -7776,13 +7880,16 @@ 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) + 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 Iphis = 1; Iphis <= 10; ++Iphis) { - Real64 phis = -(Iphis - 0.5) * delphis; // Source elevation (radians) - if (IUpDown == 2) phis = (Iphis - 0.5) * delphis; - fEdgeSource(Iphis) = 0.0; + for (int iPhi = 0; iPhi < numPhis; ++iPhi) { + Real64 phis = -((double)iPhi + 0.5) * delphis; // Source elevation (radians) + if (IUpDown == 2) phis = ((double)iPhi + 0.5) * delphis; + fEdgeSource[iPhi] = 0.0; Real64 fEdge1 = 0.0; Real64 gamma = phib - phis; if (std::abs(std::sin(gamma)) > 0.01) { @@ -7791,7 +7898,7 @@ namespace Window { fEdge1 = matBlind->SlatThickness * std::abs(std::sin(gamma)) / ((matBlind->SlatSeparation + matBlind->SlatThickness / std::abs(std::sin(phib))) * std::cos(phis)); } - fEdgeSource(Iphis) = min(1.0, std::abs(fEdge1)); + fEdgeSource[iPhi] = min(1.0, std::abs(fEdge1)); } } fEdgeA(IUpDown) = DiffuseAverage(fEdgeSource); diff --git a/src/EnergyPlus/WindowManager.hh b/src/EnergyPlus/WindowManager.hh index 730049a628d..68fd287d7c7 100644 --- a/src/EnergyPlus/WindowManager.hh +++ b/src/EnergyPlus/WindowManager.hh @@ -52,7 +52,6 @@ #include #include #include -#include // EnergyPlus Headers #include @@ -75,9 +74,16 @@ namespace Window { int constexpr maxGlassLayers = 5; int constexpr maxGapLayers = 5; - int constexpr maxIncidentAngles = 20; int constexpr maxSpectralDataElements = 800; // Maximum number in Spectral Data arrays. + int constexpr numPhis = 10; + 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, 6.123233995736766E-17}; + class CWindowModel; class CWindowOpticalModel; class CWindowConstructionsSimplified; @@ -277,14 +283,12 @@ 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(Array1S IndepVar, // Independent variables - Array1S DepVar, // Dependent variables - int N, // Order of polynomial - int N1, // First and last data points used - int N2, - Array1S CoeffsCurve // Polynomial coeffients from fit + void W5LsqFit(std::array const &ivars, // Independent variables + std::array const &dvars, // Dependent variables + std::array &coeffs // Polynomial coeffients from fit ); +#ifdef GET_OUT void W5LsqFit2(Array1A IndepVar, // Independent variables Array1A DepVar, // Dependent variables int N, // Order of polynomial @@ -294,6 +298,9 @@ namespace Window { ); Real64 DiffuseAverage(Array1S PropertyValue); // Property value at angles of incidence +#endif // GET_OUT + + Real64 DiffuseAverage(std::array const &props); // Property value at angles of incidence Real64 DiffuseAverageProfAngGnd(Array1S Property); // Property value vs. profile angle diff --git a/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc b/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc index dbb84bbd90a..9d39f32e09b 100644 --- a/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc @@ -4909,10 +4909,13 @@ 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; - state->dataConstruction->Construct(ConstrNum).TransSolBeamCoef = 0.1; - state->dataConstruction->Construct(ConstrNum).TransSolBeamCoef = 0.2; + // Why is this being written and immediately overwritten? + std::fill(constr.TransSolBeamCoef.begin(), constr.TransSolBeamCoef.end(), 0.1); + std::fill(constr.TransSolBeamCoef.begin(), constr.TransSolBeamCoef.end(), 0.2); state->dataSurface->SurfaceWindow.allocate(totSurf); state->dataSurface->SurfaceWindow(SurfNum).OutProjSLFracMult[state->dataGlobal->HourOfDay] = 999.0; diff --git a/tst/EnergyPlus/unit/SolarShading.unit.cc b/tst/EnergyPlus/unit/SolarShading.unit.cc index 23d8830f682..26d993ae1e8 100644 --- a/tst/EnergyPlus/unit/SolarShading.unit.cc +++ b/tst/EnergyPlus/unit/SolarShading.unit.cc @@ -5223,7 +5223,7 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_CalcBeamSolarOnWinRevealSurface) construct1.LayerPoint(1) = 1; construct1.Name = "Construction1"; construct1.TotGlassLayers = 1; - construct1.TransSolBeamCoef(1) = 0.9; + construct1.TransSolBeamCoef[0] = 0.9; auto &s_mat = state->dataMaterial; @@ -5250,7 +5250,7 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_CalcBeamSolarOnWinRevealSurface) state->dataHeatBal->SurfSunlitFracWithoutReveal(state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep, 2) = 1.0; Window::W5InitGlassParameters(*state); - construct1.TransSolBeamCoef(1) = 0.9; + construct1.TransSolBeamCoef[0] = 0.9; state->dataSurface->SurfWinTanProfileAngVert(1) = 10.0; state->dataSurface->SurfWinTanProfileAngVert(2) = 10.0; state->dataSurface->SurfWinTanProfileAngHor(1) = 10.0; From ff10fb8809f3c95e3cd29ddb9a0993df51f1f7f2 Mon Sep 17 00:00:00 2001 From: amirroth Date: Tue, 24 Dec 2024 17:29:47 -0500 Subject: [PATCH 2/8] Delete unused code --- src/EnergyPlus/HeatBalanceManager.cc | 14 -- src/EnergyPlus/WindowManager.cc | 268 +-------------------------- src/EnergyPlus/WindowManager.hh | 26 --- 3 files changed, 3 insertions(+), 305 deletions(-) diff --git a/src/EnergyPlus/HeatBalanceManager.cc b/src/EnergyPlus/HeatBalanceManager.cc index 8e01a55501f..29bca853092 100644 --- a/src/EnergyPlus/HeatBalanceManager.cc +++ b/src/EnergyPlus/HeatBalanceManager.cc @@ -3643,8 +3643,6 @@ namespace HeatBalanceManager { Array1D RbvisTemp(Window::numPhis+1); // Back visible reflectance vs inc. angle std::array Rbvis; - // std::array CosPhiIndepVar; // Cosine of incidence angle from 0 to 90 deg in 10 deg increments - // std::array CosPhi; // Cosine of incidence angle 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 @@ -4140,18 +4138,6 @@ namespace HeatBalanceManager { if (NextLine.eof) goto Label1000; ++FileLineCount; - // Pre-calculate constants - // for (int iPhi = 0; iPhi < 10; ++iPhi) { - // CosPhiIndepVar[iPhi] = std::cos(iPhi * 10.0 * Constant::DegToRad); - // } - - // Pre-calculate constants // Why do we need both of these? - // for (int iPhi = 0; iPhi < Window::numPhis; ++iPhi) { - // Real64 Phi = double(iPhi) * 10.0; - // CosPhi[iPhi] = std::cos(Phi * Constant::DegToRad); - // if (std::abs(CosPhi[iPhi]) < 0.0001) CosPhi[iPhi] = 0.0; - // } - for (IGlSys = 1; IGlSys <= NGlSys; ++IGlSys) { ConstrNum = state.dataHeatBal->TotConstructs - NGlSys + IGlSys; auto &thisConstruct = state.dataConstruction->Construct(ConstrNum); diff --git a/src/EnergyPlus/WindowManager.cc b/src/EnergyPlus/WindowManager.cc index bb4f4763f79..45dac7d9da4 100644 --- a/src/EnergyPlus/WindowManager.cc +++ b/src/EnergyPlus/WindowManager.cc @@ -245,7 +245,6 @@ namespace Window { 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 CosPhiIndepVar; // Cos of incidence angles at 10-deg increments for curve fits Real64 ab1; // = abBareSolPhi(,1)(,2) Real64 ab2; @@ -280,8 +279,6 @@ namespace Window { Real64 RhoGlIR; // IR reflectance of inside face of inside glass int NGlass; // Number of glass layers in a construction int LayPtr; // Material number corresponding to LayNum - // Real64 Phi; // Incidence angle (deg) - // Real64 CosPhi; // Cosine of incidence angle Real64 tsolDiff; // Glazing system diffuse solar transmittance Real64 tvisDiff; // Glazing system diffuse visible transmittance int IGlassBack; // Glass layer number counted from back of window @@ -364,9 +361,6 @@ namespace Window { // handling of optical properties constexpr int TotalIPhi = 10; - // for (int iPhi = 0; iPhi < TotalIPhi; ++iPhi) { - // CosPhiIndepVar[iPhi] = std::cos(iPhi * 10.0 * Constant::DegToRad); - // } TotLay = thisConstruct.TotLayers; @@ -658,11 +652,6 @@ namespace Window { // effect of inter-reflection among glass layers) at each incidence angle. for (int iPhi = 0; iPhi < TotalIPhi; ++iPhi) { - // 10 degree increment for incident angle is only value for a construction without a layer = SpectralAndAngle - // Real64 Phi = double(iPhi) * 10.0; - // Real64 CosPhi = std::cos(Phi * Constant::DegToRadians); - // if (std::abs(CosPhi) < 0.0001) CosPhi = 0.0; - // For each wavelength, get glass layer properties at this angle of incidence // from properties at normal incidence for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { @@ -686,9 +675,9 @@ namespace Window { for (int ILam = 1; ILam <= (int)wm->wle.size(); ++ILam) { Real64 lam = wm->wle[ILam - 1]; wlt[IGlass - 1][ILam - 1] = lam; - tPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngTransDataPtr, iPhi * 10.0, lam); - rfPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngFRefleDataPtr, iPhi * 10.0, lam); - rbPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngBRefleDataPtr, iPhi * 10.0, lam); + tPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngTransDataPtr, iPhi * dPhiDeg, lam); + rfPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngFRefleDataPtr, iPhi * dPhiDeg, lam); + rbPhi[IGlass - 1][ILam - 1] = Curve::CurveValue(state, matGlass->GlassSpecAngBRefleDataPtr, iPhi * dPhiDeg, lam); } } // For use with between-glass shade/blind, save angular properties of isolated glass @@ -859,10 +848,6 @@ namespace Window { // but exclude the effect of a shade or blind if present in the construction. // When a construction has a layer = SpectralAndAngle, the 10 degree increment will be overridden. for (int iPhi = 0; iPhi < TotalIPhi; ++iPhi) { - // Real64 Phi = double(iPhi) * 10.0; - // Real64 CosPhi = std::cos(Phi * Constant::DegToRad); - // if (std::abs(CosPhi) < 0.0001) CosPhi = 0.0; - // For each wavelength, get glass layer properties at this angle of incidence // from properties at normal incidence for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { @@ -1458,10 +1443,6 @@ namespace Window { tsolPhiFit[iPhi] = 0.0; tvisPhiFit[iPhi] = 0.0; - // Real64 Phi = double(iPhi) * 10.0; - // Real64 CosPhi = std::cos(Phi * Constant::DegToRad); - // if (std::abs(CosPhi) < 0.0001) CosPhi = 0.0; - for (int CoefNum = 0; CoefNum < DataSurfaces::MaxPolyCoeff; ++CoefNum) { tsolPhiFit[iPhi] += thisConstruct.TransSolBeamCoef[CoefNum] * cosPhis[iPhi]; tvisPhiFit[iPhi] += thisConstruct.TransVisBeamCoef[CoefNum] * cosPhis[iPhi]; @@ -2426,9 +2407,6 @@ namespace Window { wm->thetas = {0.0}; wm->thetasPrev = {0.0}; -#ifdef GET_OUT - wm->fvec = {0.0}; -#endif // GET_OUT // Calculate window face temperatures @@ -2539,121 +2517,6 @@ namespace Window { //**************************************************************************** -#ifdef GET_OUT - void WindowHeatBalanceEquations(EnergyPlusData &state, int const SurfNum) // Surface number - { - - // SUBROUTINE INFORMATION: - // AUTHOR F. Winkelmann - // DATE WRITTEN February 2000 - - // PURPOSE OF THIS SUBROUTINE: - // Evaluates heat balance functions at each glass face. - // Also evaluates Jacobian. - // Currently limited to three glass layers. - - Array1D hgap(maxGlassLayers); // Gap gas conductance - Real64 gr; // Gap gas Grashof number - Real64 con; // Gap gas conductivity - Real64 pr; // Gap gas Prandtl number - Real64 nu; // Gap gas Nusselt number - Real64 thetas_2_3_4; - Real64 thetas_4_5_4; - Real64 thetas_6_7_4; - - auto &wm = state.dataWindowManager; - auto &s_surf = state.dataSurface; - - auto const &surfWin = s_surf->SurfaceWindow(SurfNum); - - // Have to zero fvec each time since LUdecompostion and LUsolution may - // add values to this array in unexpected places - - wm->fvec = {0.0}; - - switch (wm->ngllayer) { - - case 1: { // single pane - wm->fvec[0] = wm->Outir * wm->emis[0] - wm->emis[0] * Constant::StefanBoltzmann * pow_4(wm->thetas[0]) + - wm->scon[0] * (wm->thetas[1] - wm->thetas[0]) + wm->hcout * (wm->tout - wm->thetas[0]) + wm->AbsRadGlassFace[0]; - wm->fvec[1] = wm->Rmir * wm->emis[1] - wm->emis[1] * Constant::StefanBoltzmann * pow_4(wm->thetas[1]) + - wm->scon[0] * (wm->thetas[0] - wm->thetas[1]) + wm->hcin * (wm->tin - wm->thetas[1]) + wm->AbsRadGlassFace[1]; - } break; - case 2: { // double pane - WindowGasConductance(state, wm->thetas[1], wm->thetas[2], 1, con, pr, gr); - NusseltNumber(state, SurfNum, wm->thetas[1], wm->thetas[2], 1, gr, pr, nu); - hgap(1) = (con / wm->gaps[0].width * nu) * surfWin.edgeGlassCorrFac; - - wm->fvec[0] = wm->Outir * wm->emis[0] - wm->emis[0] * Constant::StefanBoltzmann * pow_4(wm->thetas[0]) + - wm->scon[0] * (wm->thetas[1] - wm->thetas[0]) + wm->hcout * (wm->tout - wm->thetas[0]) + wm->AbsRadGlassFace[0]; - thetas_2_3_4 = pow_4(wm->thetas[1]) - pow_4(wm->thetas[2]); - wm->fvec[1] = wm->scon[0] * (wm->thetas[0] - wm->thetas[1]) + hgap(1) * (wm->thetas[2] - wm->thetas[1]) + wm->A23 * thetas_2_3_4 + - wm->AbsRadGlassFace[1]; - wm->fvec[2] = hgap(1) * (wm->thetas[1] - wm->thetas[2]) + wm->scon[1] * (wm->thetas[3] - wm->thetas[2]) - wm->A23 * thetas_2_3_4 + - wm->AbsRadGlassFace[2]; - wm->fvec[3] = wm->Rmir * wm->emis[3] - wm->emis[3] * Constant::StefanBoltzmann * pow_4(wm->thetas[3]) + - wm->scon[1] * (wm->thetas[2] - wm->thetas[3]) + wm->hcin * (wm->tin - wm->thetas[3]) + wm->AbsRadGlassFace[3]; - } break; - case 3: { // Triple Pane - WindowGasConductance(state, wm->thetas[1], wm->thetas[2], 1, con, pr, gr); - NusseltNumber(state, SurfNum, wm->thetas[1], wm->thetas[2], 1, gr, pr, nu); - hgap(1) = con / wm->gaps[0].width * nu * surfWin.edgeGlassCorrFac; - - WindowGasConductance(state, wm->thetas[3], wm->thetas[4], 2, con, pr, gr); - NusseltNumber(state, SurfNum, wm->thetas[3], wm->thetas[4], 2, gr, pr, nu); - hgap(2) = con / wm->gaps[1].width * nu * surfWin.edgeGlassCorrFac; - - thetas_2_3_4 = pow_4(wm->thetas[1]) - pow_4(wm->thetas[2]); - thetas_4_5_4 = pow_4(wm->thetas[3]) - pow_4(wm->thetas[4]); - wm->fvec[0] = wm->Outir * wm->emis[0] - wm->emis[0] * Constant::StefanBoltzmann * pow_4(wm->thetas[0]) + - wm->scon[0] * (wm->thetas[1] - wm->thetas[0]) + wm->hcout * (wm->tout - wm->thetas[0]) + wm->AbsRadGlassFace[0]; - wm->fvec[1] = wm->scon[0] * (wm->thetas[0] - wm->thetas[1]) + hgap(1) * (wm->thetas[2] - wm->thetas[1]) + wm->A23 * thetas_2_3_4 + - wm->AbsRadGlassFace[1]; - wm->fvec[2] = hgap(1) * (wm->thetas[1] - wm->thetas[2]) + wm->scon[1] * (wm->thetas[3] - wm->thetas[2]) - wm->A23 * thetas_2_3_4 + - wm->AbsRadGlassFace[2]; - wm->fvec[3] = wm->scon[1] * (wm->thetas[2] - wm->thetas[3]) + hgap(2) * (wm->thetas[4] - wm->thetas[3]) + wm->A45 * thetas_4_5_4 + - wm->AbsRadGlassFace[3]; - wm->fvec[4] = hgap(2) * (wm->thetas[3] - wm->thetas[4]) + wm->scon[2] * (wm->thetas[5] - wm->thetas[4]) - wm->A45 * thetas_4_5_4 + - wm->AbsRadGlassFace[4]; - wm->fvec[5] = wm->Rmir * wm->emis[5] - wm->emis[5] * Constant::StefanBoltzmann * pow_4(wm->thetas[5]) + - wm->scon[2] * (wm->thetas[4] - wm->thetas[5]) + wm->hcin * (wm->tin - wm->thetas[5]) + wm->AbsRadGlassFace[5]; - } break; - case 4: { // Quad Pane - WindowGasConductance(state, wm->thetas[1], wm->thetas[2], 1, con, pr, gr); - NusseltNumber(state, SurfNum, wm->thetas[1], wm->thetas[2], 1, gr, pr, nu); - hgap(1) = con / wm->gaps[0].width * nu * surfWin.edgeGlassCorrFac; - - WindowGasConductance(state, wm->thetas[3], wm->thetas[4], 2, con, pr, gr); - NusseltNumber(state, SurfNum, wm->thetas[3], wm->thetas[4], 2, gr, pr, nu); - hgap(2) = con / wm->gaps[1].width * nu * surfWin.edgeGlassCorrFac; - - WindowGasConductance(state, wm->thetas[5], wm->thetas[6], 3, con, pr, gr); - NusseltNumber(state, SurfNum, wm->thetas[5], wm->thetas[6], 3, gr, pr, nu); - hgap(3) = con / wm->gaps[2].width * nu * surfWin.edgeGlassCorrFac; - - thetas_2_3_4 = pow_4(wm->thetas[1]) - pow_4(wm->thetas[2]); - thetas_4_5_4 = pow_4(wm->thetas[3]) - pow_4(wm->thetas[4]); - thetas_6_7_4 = pow_4(wm->thetas[5]) - pow_4(wm->thetas[6]); - wm->fvec[0] = wm->Outir * wm->emis[0] - wm->emis[0] * Constant::StefanBoltzmann * pow_4(wm->thetas[0]) + - wm->scon[0] * (wm->thetas[1] - wm->thetas[0]) + wm->hcout * (wm->tout - wm->thetas[0]) + wm->AbsRadGlassFace[0]; - wm->fvec[1] = wm->scon[0] * (wm->thetas[0] - wm->thetas[1]) + hgap(1) * (wm->thetas[2] - wm->thetas[1]) + wm->A23 * thetas_2_3_4 + - wm->AbsRadGlassFace[1]; - wm->fvec[2] = hgap(1) * (wm->thetas[1] - wm->thetas[2]) + wm->scon[1] * (wm->thetas[3] - wm->thetas[2]) - wm->A23 * thetas_2_3_4 + - wm->AbsRadGlassFace[2]; - wm->fvec[3] = wm->scon[1] * (wm->thetas[2] - wm->thetas[3]) + hgap(2) * (wm->thetas[4] - wm->thetas[3]) + wm->A45 * thetas_4_5_4 + - wm->AbsRadGlassFace[3]; - wm->fvec[4] = hgap(2) * (wm->thetas[3] - wm->thetas[4]) + wm->scon[2] * (wm->thetas[5] - wm->thetas[4]) - wm->A45 * thetas_4_5_4 + - wm->AbsRadGlassFace[4]; - wm->fvec[5] = wm->scon[2] * (wm->thetas[4] - wm->thetas[5]) + hgap(3) * (wm->thetas[6] - wm->thetas[5]) + wm->A67 * thetas_6_7_4 + - wm->AbsRadGlassFace[5]; - wm->fvec[6] = hgap(3) * (wm->thetas[5] - wm->thetas[6]) + wm->scon[3] * (wm->thetas[7] - wm->thetas[6]) - wm->A67 * thetas_6_7_4 + - wm->AbsRadGlassFace[6]; - wm->fvec[7] = wm->Rmir * wm->emis[7] - wm->emis[7] * Constant::StefanBoltzmann * pow_4(wm->thetas[7]) + - wm->scon[3] * (wm->thetas[6] - wm->thetas[7]) + wm->hcin * (wm->tin - wm->thetas[7]) + wm->AbsRadGlassFace[7]; - } break; - } // switch - } // WindowHeatBalanceEquations() -#endif // GET_OUT //**************************************************************************** @@ -5446,94 +5309,6 @@ namespace Window { } // InterpolateBetweenFourValues() //************************************************************************** -#ifdef GET_OUT - void W5LsqFit(Array1S const IndepVar, // Independent variables - Array1S const DepVar, // Dependent variables - int const N, // Order of polynomial - int const N1, // First and last data points used - int const N2, - Array1S CoeffsCurve // Polynomial coefficients from fit - ) - { - - // SUBROUTINE INFORMATION: - // AUTHOR George Walton - // DATE WRITTEN April 1976 - // MODIFIED November 1999 F.Winkelmann - // RE-ENGINEERED na - - // PURPOSE OF THIS SUBROUTINE: - // Does least squares fit for coefficients of a polynomial - // that gives a window property, such as transmittance, as a function of - // the cosine of the angle of incidence. The polynomial is of the - // form C1*X + C2*X**2 + C3*X**3 + ... +CN*X**N, where N <= 6. - // Adapted from BLAST subroutine LSQFIT. - - Array2D A(6, 6); // Least squares derivative matrix - Array1D B(6); // Least squares derivative vector - Array2D D(6, 16); // Powers of independent variable - Real64 ACON; // Intermediate variables - Real64 SUM; - int LP1; - int NM1; - - // Set up least squares matrix - for (int M = N1; M <= N2; ++M) { - D(1, M) = IndepVar(M); - } - - for (int i = 2; i <= N; ++i) { - for (int M = N1; M <= N2; ++M) { - D(i, M) = D(i - 1, M) * IndepVar(M); - } - } - - for (int i = 1; i <= N; ++i) { - SUM = 0.0; - for (int M = N1; M <= N2; ++M) { - SUM += DepVar(M) * D(i, M); - } - B(i) = SUM; - for (int j = 1; j <= N; ++j) { - SUM = 0.0; - for (int M = N1; M <= N2; ++M) { - SUM += D(i, M) * D(j, M); - } - A(j, i) = SUM; - A(i, j) = SUM; - } - } - - // Solve the simultaneous equations using Gauss elimination - NM1 = N - 1; - for (int K = 1; K <= NM1; ++K) { - int KP1 = K + 1; - for (int i = KP1; i <= N; ++i) { - ACON = A(K, i) / A(K, K); - B(i) -= B(K) * ACON; - for (int j = K; j <= N; ++j) { - A(j, i) -= A(j, K) * ACON; - } - } - } - - // Perform back substitution - CoeffsCurve(N) = B(N) / A(N, N); - LP1 = N; - int L = N - 1; - - while (L > 0) { - SUM = 0.0; - for (int j = LP1; j <= N; ++j) { - SUM += A(j, L) * CoeffsCurve(j); - } - CoeffsCurve(L) = (B(L) - SUM) / A(L, L); - LP1 = L; - --L; - } - } // W5LsqFit() -#endif // GET_OUT - void W5LsqFit(std::array const &ivars, // Independent variables std::array const &dvars, // Dependent variables std::array &coeffs // Polynomial coefficients from fit @@ -5708,43 +5483,6 @@ namespace Window { } // W5LsqFit2() //*********************************************************************** -#ifdef GET_OUT - Real64 DiffuseAverage(Array1S const PropertyValue) // Property value at angles of incidence - { - - // FUNCTION INFORMATION: - // AUTHOR Fred Winkelmann - // DATE WRITTEN November 1999 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS FUNCTION: - // Calculate value of property, such as transmittance, for hemispherical - // diffuse radiation from property values at angles of incidence from - // 0 to 90 degrees in 10 degree increments. - - // METHODOLOGY EMPLOYED: - // By Simpson's rule, evaluates the integral from 0 to 90 deg of - // 2*PropertyValue(phi)*cos(phi)*sin(phi)*dphi (which is same as - // PropertyValue(phi)*sin(2*phi)*dphi) - - // Return value - Real64 DiffuseAverage; - - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // 0,10,20,...,80,90 degrees - - DiffuseAverage = 0.0; - for (int IPhi = 1; IPhi <= 9; ++IPhi) { - DiffuseAverage += - 0.5 * DPhiR * (PropertyValue(IPhi) * std::sin(2.0 * (IPhi - 1) * dPhiRad) + PropertyValue(IPhi + 1) * std::sin(2.0 * IPhi * dPhiRad)); - } - if (DiffuseAverage < 0.0) DiffuseAverage = 0.0; - - return DiffuseAverage; - } // DiffuseAverage() -#endif // GET_OUT Real64 DiffuseAverage(std::array const &props) // Property value at angles of incidence { diff --git a/src/EnergyPlus/WindowManager.hh b/src/EnergyPlus/WindowManager.hh index 68fd287d7c7..451c197a9c7 100644 --- a/src/EnergyPlus/WindowManager.hh +++ b/src/EnergyPlus/WindowManager.hh @@ -145,10 +145,6 @@ namespace Window { Real64 &SurfOutsideTemp // Outside surface temperature (C) ); -#ifdef GET_OUT - void WindowHeatBalanceEquations(EnergyPlusData &state, int SurfNum); // Surface number -#endif // GET_OUT - void GetHeatBalanceEqCoefMatrixSimple(EnergyPlusData &state, int nglasslayer, // Number of glass layers Array1D const &hr, // Radiative conductance (W/m2-K) @@ -288,24 +284,8 @@ namespace Window { std::array &coeffs // Polynomial coeffients from fit ); -#ifdef GET_OUT - void W5LsqFit2(Array1A IndepVar, // Independent variables - Array1A DepVar, // Dependent variables - int N, // Order of polynomial - int N1, // First and last data points used - int N2, - Array1A CoeffsCurve // Polynomial coeffients from fit - ); - - Real64 DiffuseAverage(Array1S PropertyValue); // Property value at angles of incidence -#endif // GET_OUT - Real64 DiffuseAverage(std::array const &props); // Property value at angles of incidence - Real64 DiffuseAverageProfAngGnd(Array1S Property); // Property value vs. profile angle - - Real64 DiffuseAverageProfAngSky(Array1S Property); // Property value vs. profile angle - void CalcWinFrameAndDividerTemps(EnergyPlusData &state, int SurfNum, // Surface number Real64 tout, // Outside air temperature (K) @@ -487,9 +467,6 @@ struct WindowManagerData : BaseGlobalStruct 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) -#ifdef GET_OUT - std::array fvec = {0.0}; // Glass face heat balance function -#endif // GET_OUT std::array hrgap = {0.0}; // Radiative gap conductance @@ -560,9 +537,6 @@ struct WindowManagerData : BaseGlobalStruct this->AbsRadGlassFace = {0.0}; this->thetas = {0.0}; this->thetasPrev = {0.0}; -#ifdef GET_OUT - this->fvec = {0.0}; -#endif // GET_OUT this->hrgap = {0.0}; this->A23P = 0.0; this->A32P = 0.0; From 7a8f4b4fe8468b64e85cf70ea49d66df78b9746f Mon Sep 17 00:00:00 2001 From: amirroth Date: Thu, 26 Dec 2024 12:54:29 -0500 Subject: [PATCH 3/8] Move POLY to Window module. --- src/EnergyPlus/Construction.hh | 31 +++++----- src/EnergyPlus/DataSurfaces.hh | 3 - src/EnergyPlus/DaylightingDevices.cc | 7 +-- src/EnergyPlus/DaylightingManager.cc | 58 +++++++++--------- src/EnergyPlus/General.hh | 18 ------ src/EnergyPlus/HeatBalanceManager.cc | 10 ++-- src/EnergyPlus/HeatBalanceSurfaceManager.cc | 10 ++-- src/EnergyPlus/SolarReflectionManager.cc | 7 +-- src/EnergyPlus/SolarShading.cc | 30 ++++------ src/EnergyPlus/WindowEquivalentLayer.hh | 1 + src/EnergyPlus/WindowManager.cc | 65 +++++++++------------ src/EnergyPlus/WindowManager.hh | 24 +++++++- 12 files changed, 121 insertions(+), 143 deletions(-) diff --git a/src/EnergyPlus/Construction.hh b/src/EnergyPlus/Construction.hh index 9b8fe438e84..952fa8e4ed9 100644 --- a/src/EnergyPlus/Construction.hh +++ b/src/EnergyPlus/Construction.hh @@ -55,6 +55,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -216,10 +217,10 @@ namespace Construction { 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 + 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; // Coefficients of incidence-angle polynomial for solar + Array1D> AbsBeamBackCoef; // As for AbsBeamCoef but for back-incident solar + std::array AbsBeamShadeCoef; // Coefficients of incidence-angle polynomial for solar // absorptance of shade Real64 TransDiff = 0.0; // Diffuse solar transmittance, bare glass or shade on Real64 TransDiffVis; // Diffuse visible transmittance, bare glass or shade on @@ -227,21 +228,21 @@ namespace Construction { 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; // Coeffs of incidence-angle polynomial for beam sol trans, + std::array TransSolBeamCoef; // Coeffs of incidence-angle polynomial for beam sol trans, // bare glass or shade on - std::array TransVisBeamCoef; // Coeffs of incidence-angle polynomial for beam vis trans, + std::array TransVisBeamCoef; // Coeffs of incidence-angle polynomial for beam vis trans, // bare glass or shade on - std::array ReflSolBeamFrontCoef; // Coeffs of incidence-angle polynomial for beam sol front refl, + std::array ReflSolBeamFrontCoef; // Coeffs of incidence-angle polynomial for beam sol front refl, // bare glass or shade on - std::array ReflSolBeamBackCoef; // Like ReflSolBeamFrontCoef, but for back-incident beam solar - 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 - Array1D> rfBareVisCoef; // Isolated glass front visible reflectance coeffs of inc. angle polynomial - Array1D> rbBareSolCoef; // Isolated glass back solar reflectance coeffs of inc. angle polynomial - 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 + std::array ReflSolBeamBackCoef; // Like ReflSolBeamFrontCoef, but for back-incident beam solar + 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 + Array1D> rfBareVisCoef; // Isolated glass front visible reflectance coeffs of inc. angle polynomial + Array1D> rbBareSolCoef; // Isolated glass back solar reflectance coeffs of inc. angle polynomial + 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 diff --git a/src/EnergyPlus/DataSurfaces.hh b/src/EnergyPlus/DataSurfaces.hh index c1c96b5beb2..c9d83ac1755 100644 --- a/src/EnergyPlus/DataSurfaces.hh +++ b/src/EnergyPlus/DataSurfaces.hh @@ -80,9 +80,6 @@ namespace DataSurfaces { using DataBSDFWindow::BSDFWindowDescript; using DataVectorTypes::Vector; - // MODULE PARAMETER DEFINITIONS: - constexpr int MaxPolyCoeff(6); - // Not sure this is the right module for this stuff, may move it later enum class Compass4 { diff --git a/src/EnergyPlus/DaylightingDevices.cc b/src/EnergyPlus/DaylightingDevices.cc index 2766b34a142..4da5536cde6 100644 --- a/src/EnergyPlus/DaylightingDevices.cc +++ b/src/EnergyPlus/DaylightingDevices.cc @@ -1328,9 +1328,6 @@ namespace Dayltg { // Swift, P. D., and Smith, G. B. "Cylindrical Mirror Light Pipes", // Solar Energy Materials and Solar Cells 36 (1995), pp. 159-168. - // Using/Aliasing - using General::POLYF; - // Return value Real64 TransTDD; @@ -1353,7 +1350,7 @@ namespace Dayltg { // Get the transmittance of each component and of total TDD switch (RadiationType) { case RadType::VisibleBeam: { - transDome = POLYF(COSI, state.dataConstruction->Construct(constDome).TransVisBeamCoef); + transDome = Window::POLYF(COSI, state.dataConstruction->Construct(constDome).TransVisBeamCoef); transPipe = InterpolatePipeTransBeam(state, COSI, state.dataDaylightingDevicesData->TDDPipe(PipeNum).PipeTransVisBeam); transDiff = state.dataConstruction->Construct(constDiff).TransDiffVis; // May want to change to POLYF also! @@ -1361,7 +1358,7 @@ namespace Dayltg { } break; case RadType::SolarBeam: { - transDome = POLYF(COSI, state.dataConstruction->Construct(constDome).TransSolBeamCoef); + transDome = Window::POLYF(COSI, state.dataConstruction->Construct(constDome).TransSolBeamCoef); transPipe = InterpolatePipeTransBeam(state, COSI, state.dataDaylightingDevicesData->TDDPipe(PipeNum).PipeTransSolBeam); transDiff = state.dataConstruction->Construct(constDiff).TransDiff; // May want to change to POLYF also! diff --git a/src/EnergyPlus/DaylightingManager.cc b/src/EnergyPlus/DaylightingManager.cc index 8718da982b4..943355845cf 100644 --- a/src/EnergyPlus/DaylightingManager.cc +++ b/src/EnergyPlus/DaylightingManager.cc @@ -1526,7 +1526,7 @@ void FigureDayltgCoeffsAtPointsSetupForWindow(EnergyPlusData &state, LSHCAL = 0; // Visible transmittance at normal incidence - s_surf->SurfWinVisTransSelected(IWin) = General::POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac; + s_surf->SurfWinVisTransSelected(IWin) = Window::POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac; // For windows with switchable glazing, ratio of visible transmittance at normal // incidence for fully switched (dark) state to that of unswitched state s_surf->SurfWinVisTransRatio(IWin) = 1.0; @@ -1534,8 +1534,8 @@ void FigureDayltgCoeffsAtPointsSetupForWindow(EnergyPlusData &state, if (ShType == WinShadingType::SwitchableGlazing) { int IConstShaded = surf.activeShadedConstruction; // Shaded construction counter s_surf->SurfWinVisTransRatio(IWin) = - General::SafeDivide(General::POLYF(1.0, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef), - General::POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef)); + General::SafeDivide(Window::POLYF(1.0, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef), + Window::POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef)); } } @@ -1929,7 +1929,7 @@ void FigureDayltgCoeffsAtPointsForWindowElements( } else { // Regular window if (s_surf->SurfWinWindowModelType(IWin) != WindowModel::BSDF) { // Vis trans of glass for COSB incidence angle - TVISB = General::POLYF(COSB, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac * surfWin.lightWellEff; + TVISB = Window::POLYF(COSB, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac * surfWin.lightWellEff; } else { // Complex fenestration needs to use different equation for visible transmittance. That will be calculated later // in the code since it depends on different incoming directions. For now, just put zero to differentiate from @@ -1963,7 +1963,7 @@ void FigureDayltgCoeffsAtPointsForWindowElements( IntWinHitNum = 0; continue; } - TVISIntWin = General::POLYF(COSBIntWin, state.dataConstruction->Construct(surfIntWin.Construction).TransVisBeamCoef); + TVISIntWin = Window::POLYF(COSBIntWin, state.dataConstruction->Construct(surfIntWin.Construction).TransVisBeamCoef); TVISB *= TVISIntWin; break; // Ray passes thru interior window; exit from DO loop } @@ -3114,7 +3114,7 @@ void FigureDayltgCoeffsAtPointsForSunPosition( continue; } TVISIntWinDisk = - General::POLYF(COSBIntWin, state.dataConstruction->Construct(surfIntWinDisk.Construction).TransVisBeamCoef); + Window::POLYF(COSBIntWin, state.dataConstruction->Construct(surfIntWinDisk.Construction).TransVisBeamCoef); break; } // for (IntWinDisk) } // for (spaceNum) @@ -3170,7 +3170,7 @@ void FigureDayltgCoeffsAtPointsForSunPosition( TVISS = 0.0; } else { // Beam transmittance for bare window and all types of blinds - TVISS = General::POLYF(COSI, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac * + TVISS = Window::POLYF(COSI, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac * surfWin.lightWellEff; if (extWinType == ExtWinType::AdjZone && hitIntWinDisk) TVISS *= TVISIntWinDisk; } @@ -3343,15 +3343,15 @@ void FigureDayltgCoeffsAtPointsForSunPosition( if (s_surf->Surface(ReflSurfNum).Class == SurfaceClass::Window) { int const ConstrNumRefl = s_surf->SurfActiveConstruction(ReflSurfNum); SpecReflectance = - General::POLYF(std::abs(CosIncAngRefl), state.dataConstruction->Construct(ConstrNumRefl).ReflSolBeamFrontCoef); + Window::POLYF(std::abs(CosIncAngRefl), state.dataConstruction->Construct(ConstrNumRefl).ReflSolBeamFrontCoef); } if (s_surf->Surface(ReflSurfNum).IsShadowing && s_surf->SurfShadowGlazingConstruct(ReflSurfNum) > 0) SpecReflectance = s_surf->SurfShadowGlazingFrac(ReflSurfNum) * - General::POLYF( + Window::POLYF( std::abs(CosIncAngRefl), state.dataConstruction->Construct(s_surf->SurfShadowGlazingConstruct(ReflSurfNum)).ReflSolBeamFrontCoef); - TVisRefl = General::POLYF(CosIncAngRec, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac * + TVisRefl = Window::POLYF(CosIncAngRec, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac * surfWin.lightWellEff; dl->dirIllum(iHour)[iWinCover_Bare].sunDisk += SunVecMir.z * SpecReflectance * TVisRefl; // Bare window @@ -5809,8 +5809,8 @@ void DayltgInteriorIllum(EnergyPlusData &state, // based on the master construction. They need to be adjusted by the VTRatio, including: // ZoneDaylight()%DaylIllFacSky, DaylIllFacSun, DaylIllFacSunDisk; DaylBackFacSky, // DaylBackFacSun, DaylBackFacSunDisk, DaylSourceFacSky, DaylSourceFacSun, DaylSourceFacSunDisk - VTNow = General::POLYF(1.0, construction.TransVisBeamCoef); - VTMaster = General::POLYF(1.0, state.dataConstruction->Construct(construction.TCMasterConstrNum).TransVisBeamCoef); + VTNow = Window::POLYF(1.0, construction.TransVisBeamCoef); + VTMaster = Window::POLYF(1.0, state.dataConstruction->Construct(construction.TCMasterConstrNum).TransVisBeamCoef); VTRatio = VTNow / VTMaster; } } @@ -6084,12 +6084,12 @@ void DayltgInteriorIllum(EnergyPlusData &state, int const IConst = s_surf->SurfActiveConstruction(IWin); // Vis trans at normal incidence of unswitched glass shadeGroupLums.unswitchedTvis = - General::POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac; + Window::POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac; // Vis trans at normal incidence of fully switched glass int const IConstShaded = s_surf->Surface(IWin).activeShadedConstruction; shadeGroupLums.switchedTvis = - General::POLYF(1.0, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac; + Window::POLYF(1.0, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac; // Reset shading flag to indicate that window is shaded by being partially or fully switched s_surf->SurfWinShadingFlag(IWin) = WinShadingType::SwitchableGlazing; @@ -6304,12 +6304,12 @@ void DayltgInteriorIllum(EnergyPlusData &state, int const IConst = s_surf->SurfActiveConstruction(IWin); // Vis trans at normal incidence of unswitched glass shadeGroupLums.unswitchedTvis = - General::POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac; + Window::POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac; // Vis trans at normal incidence of fully switched glass int const IConstShaded = s_surf->Surface(IWin).activeShadedConstruction; shadeGroupLums.switchedTvis = - General::POLYF(1.0, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac; + Window::POLYF(1.0, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac; } // if (switchableGlazing) } // if (GlareControlIsActive) } // for (IWin) @@ -7287,7 +7287,7 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, } else { // Bare window // Transmittance of bare window for this sky/ground element - TVISBR = General::POLYF(COSB, construct.TransVisBeamCoef) * surfWin.glazedFrac * surfWin.lightWellEff; + TVISBR = Window::POLYF(COSB, construct.TransVisBeamCoef) * surfWin.glazedFrac * surfWin.lightWellEff; if (InShelfSurf > 0) { // Inside daylighting shelf // Daylighting shelf simplification: All light is diffuse @@ -7313,7 +7313,7 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, if (hitObs) { // disk passes thru // 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 *= General::POLYF(COSBintWin, + TVISBR *= Window::POLYF(COSBintWin, state.dataConstruction->Construct(s_surf->Surface(IntWinNum).Construction).TransVisBeamCoef); break; } @@ -7387,7 +7387,7 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, transMult = TransTDD(state, PipeNum, COSB, RadType::VisibleBeam) * surfWin.glazedFrac; } else { // Shade only, no TDD // Calculate transmittance of the combined window and shading device for this sky/ground element - transMult = General::POLYF(COSB, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac * + transMult = Window::POLYF(COSB, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac * surfWin.lightWellEff; } @@ -7448,7 +7448,7 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, (1.0 - ReflGlDiffDiffFront * ReflBlDiffDiffBack) * surfWin.lightWellEff; } else { // Between-glass blind - Real64 t1 = General::POLYF(COSB, construct.tBareVisCoef(1)); + Real64 t1 = Window::POLYF(COSB, construct.tBareVisCoef(1)); td2 = construct.tBareVisDiff(2); rbd1 = construct.rbBareVisDiff(1); rfd2 = construct.rfBareVisDiff(2); @@ -7459,7 +7459,7 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, if (construct.TotGlassLayers == 2) { // 2 glass layers transMult = t1 * (tfshBd * (1.0 + rfd2 * rbshd) + rfshB * rbd1 * tfshd) * td2 * surfWin.lightWellEff; } else { // 3 glass layers; blind between layers 2 and 3 - Real64 t2 = General::POLYF(COSB, construct.tBareVisCoef(2)); + Real64 t2 = Window::POLYF(COSB, construct.tBareVisCoef(2)); td3 = construct.tBareVisDiff(3); rfd3 = construct.rfBareVisDiff(3); rbd2 = construct.rbBareVisDiff(2); @@ -7470,7 +7470,7 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, transBmBmMult = TVISBR * matBlind->BeamBeamTrans(ProfAng, surfShade.blind.slatAng); } else { // Diffusing glass - transMult = General::POLYF(COSB, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac * + transMult = Window::POLYF(COSB, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac * surfWin.lightWellEff; } // End of check if shade, blind or diffusing glass @@ -7594,7 +7594,7 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, FLCW[iWinCover_Bare].sun += ZSU1 * TVISBSun * surfWin.fractionUpgoing; } else { // Bare window - TVISBSun = General::POLYF(COSBSun, construct.TransVisBeamCoef) * surfWin.glazedFrac * surfWin.lightWellEff; + TVISBSun = Window::POLYF(COSBSun, construct.TransVisBeamCoef) * surfWin.glazedFrac * surfWin.lightWellEff; // Daylighting shelf simplification: No beam makes it past end of shelf, all light is diffuse if (InShelfSurf > 0) { // Inside daylighting shelf @@ -7640,7 +7640,7 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, } else { int IConstShaded = s_surf->SurfWinActiveShadedConstruction(IWin); if (s_surf->SurfWinSolarDiffusing(IWin)) IConstShaded = surf.Construction; - transMult = General::POLYF(COSBSun, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac * + transMult = Window::POLYF(COSBSun, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac * surfWin.lightWellEff; } @@ -7675,13 +7675,13 @@ void DayltgInterReflectedIllum(EnergyPlusData &state, surfWin.glazedFrac * surfWin.lightWellEff; } else { // Between-glass blind - Real64 t1 = General::POLYF(COSBSun, construct.tBareVisCoef(1)); + Real64 t1 = Window::POLYF(COSBSun, construct.tBareVisCoef(1)); Real64 tfshBd = Interp(btar.Vis.Ft.Bm[idxLo].DfTra, btar.Vis.Ft.Bm[idxHi].DfTra, interpFac); Real64 rfshB = Interp(btar.Vis.Ft.Bm[idxLo].DfRef, btar.Vis.Ft.Bm[idxHi].DfRef, interpFac); if (construct.TotGlassLayers == 2) { // 2 glass layers transMult = t1 * (tfshBd * (1.0 + rfd2 * rbshd) + rfshB * rbd1 * tfshd) * td2 * surfWin.lightWellEff; } else { // 3 glass layers; blind between layers 2 and 3 - Real64 t2 = General::POLYF(COSBSun, construct.tBareVisCoef(2)); + Real64 t2 = Window::POLYF(COSBSun, construct.tBareVisCoef(2)); transMult = t1 * t2 * (tfshBd * (1.0 + rfd3 * rbshd) + rfshB * (rbd2 * tfshd + td2 * rbd1 * td2 * tfshd)) * td3 * surfWin.lightWellEff; } @@ -8684,8 +8684,8 @@ void DayltgInteriorMapIllum(EnergyPlusData &state) // based on the master construction. They need to be adjusted by the VTRatio, including: // ZoneDaylight()%DaylIllFacSky, DaylIllFacSun, DaylIllFacSunDisk; DaylBackFacSky, // DaylBackFacSun, DaylBackFacSunDisk, DaylSourceFacSky, DaylSourceFacSun, DaylSourceFacSunDisk - Real64 VTNow = General::POLYF(1.0, construction.TransVisBeamCoef); - Real64 VTMaster = General::POLYF(1.0, state.dataConstruction->Construct(construction.TCMasterConstrNum).TransVisBeamCoef); + Real64 VTNow = Window::POLYF(1.0, construction.TransVisBeamCoef); + Real64 VTMaster = Window::POLYF(1.0, state.dataConstruction->Construct(construction.TCMasterConstrNum).TransVisBeamCoef); VTRatio = VTNow / VTMaster; } } @@ -8793,7 +8793,7 @@ void DayltgInteriorMapIllum(EnergyPlusData &state) int IConstShaded = s_surf->Surface(IWin).activeShadedConstruction; if (IConstShaded > 0) { // Visible transmittance (VT) of electrochromic (EC) windows in fully dark state - Real64 VTDark = General::POLYF(1.0, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac; + Real64 VTDark = Window::POLYF(1.0, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * surfWin.glazedFrac; if (VTDark > 0) VTMULT = s_surf->SurfWinVisTransSelected(IWin) / VTDark; } } diff --git a/src/EnergyPlus/General.hh b/src/EnergyPlus/General.hh index 11afea846c1..4890eb21287 100644 --- a/src/EnergyPlus/General.hh +++ b/src/EnergyPlus/General.hh @@ -82,24 +82,6 @@ namespace General { Real64 X_0, // 1st bound of interval that contains the solution Real64 X_1); // 2nd bound of interval that contains the solution - 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])))))); - } - - constexpr Real64 POLYF(Real64 const X, // Cosine of angle of incidence - Array1D const &A // Polynomial coefficients - ) - { - if (X < 0.0 || X > 1.0) { - return 0.0; - } else { - return X * (A(1) + X * (A(2) + X * (A(3) + X * (A(4) + X * (A(5) + X * A(6)))))); - } - } - void MovingAvg(Array1D &DataIn, int NumItemsInAvg); void ProcessDateString(EnergyPlusData &state, diff --git a/src/EnergyPlus/HeatBalanceManager.cc b/src/EnergyPlus/HeatBalanceManager.cc index 29bca853092..a8552c410f2 100644 --- a/src/EnergyPlus/HeatBalanceManager.cc +++ b/src/EnergyPlus/HeatBalanceManager.cc @@ -79,7 +79,6 @@ #include #include #include -#include #include #include #include @@ -3592,7 +3591,6 @@ namespace HeatBalanceManager { // Using/Aliasing using namespace DataStringGlobals; using DataSystemVariables::CheckForActualFilePath; - using General::POLYF; // POLYF ! Polynomial in cosine of angle of incidence // SUBROUTINE PARAMETER DEFINITIONS: Array1D_string const NumName(5, {"1", "2", "3", "4", "5"}); @@ -4353,11 +4351,11 @@ namespace HeatBalanceManager { // For comparing fitted vs. input distribution in incidence angle for (int iPhi = 0; iPhi < Window::numPhis; ++iPhi) { - tsolFit[iPhi] = POLYF(Window::cosPhis[iPhi], thisConstruct.TransSolBeamCoef); - tvisFit[iPhi] = POLYF(Window::cosPhis[iPhi], thisConstruct.TransVisBeamCoef); - rfsolFit[iPhi] = POLYF(Window::cosPhis[iPhi], thisConstruct.ReflSolBeamFrontCoef); + tsolFit[iPhi] = Window::POLYF(Window::cosPhis[iPhi], thisConstruct.TransSolBeamCoef); + 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] = POLYF(Window::cosPhis[iPhi], thisConstruct.AbsBeamCoef(IGlass)); + solabsFit(IGlass)[iPhi] = Window::POLYF(Window::cosPhis[iPhi], thisConstruct.AbsBeamCoef(IGlass)); } } // end diff --git a/src/EnergyPlus/HeatBalanceSurfaceManager.cc b/src/EnergyPlus/HeatBalanceSurfaceManager.cc index 385ca236569..656d30a38a3 100644 --- a/src/EnergyPlus/HeatBalanceSurfaceManager.cc +++ b/src/EnergyPlus/HeatBalanceSurfaceManager.cc @@ -88,7 +88,6 @@ #include #include #include -#include #include #include #include @@ -2427,7 +2426,6 @@ void InitSolarHeatGains(EnergyPlusData &state) // Using/Aliasing using Dayltg::TransTDD; - using General::POLYF; using SolarShading::CalcInteriorSolarDistribution; using namespace DataWindowEquivalentLayer; using SolarShading::SurfaceScheduledSolarInc; @@ -3341,13 +3339,13 @@ void InitSolarHeatGains(EnergyPlusData &state) // Beam solar on outside of frame FrIncSolarOut += (BeamFrHorFaceInc + BeamFrVertFaceInc) * FrProjOut; if (FrProjIn > 0.0) { - Real64 TransGl = General::POLYF(CosInc, thisConstruct.TransSolBeamCoef); + Real64 TransGl = Window::POLYF(CosInc, thisConstruct.TransSolBeamCoef); TransDiffGl = thisConstruct.TransDiff; if (ShadeFlag == DataSurfaces::WinShadingType::SwitchableGlazing) { // Switchable glazing Real64 SwitchFac = state.dataSurface->SurfWinSwitchingFactor(SurfNum); int ConstrNumSh = Surface(SurfNum).activeShadedConstruction; auto const &constructionSh = state.dataConstruction->Construct(ConstrNumSh); - Real64 TransGlSh = General::POLYF(CosInc, constructionSh.TransSolBeamCoef); + Real64 TransGlSh = Window::POLYF(CosInc, constructionSh.TransSolBeamCoef); TransGl = Window::InterpSw(SwitchFac, TransGl, TransGlSh); Real64 TransDiffGlSh = constructionSh.TransDiff; TransDiffGl = Window::InterpSw(SwitchFac, TransDiffGl, TransDiffGlSh); @@ -3433,14 +3431,14 @@ void InitSolarHeatGains(EnergyPlusData &state) DivIncSolarOutBm = BeamFaceInc + BeamDivHorFaceInc + BeamDivVertFaceInc; DivIncSolarOutDif = DifSolarFaceInc * (1.0 + state.dataSurface->SurfWinProjCorrDivOut(SurfNum)); if (DivProjIn > 0.0) { - Real64 TransGl = General::POLYF(CosInc, thisConstruct.TransSolBeamCoef); + Real64 TransGl = Window::POLYF(CosInc, thisConstruct.TransSolBeamCoef); Real64 TransDiffGl = thisConstruct.TransDiff; // Diffuse solar transmittance if (ShadeFlag == DataSurfaces::WinShadingType::SwitchableGlazing) { // Switchable glazing Real64 SwitchFac = state.dataSurface->SurfWinSwitchingFactor(SurfNum); int ConstrNumSh = Surface(SurfNum).activeShadedConstruction; auto const &constructionSh = state.dataConstruction->Construct(ConstrNumSh); - Real64 TransGlSh = General::POLYF(CosInc, constructionSh.TransSolBeamCoef); + Real64 TransGlSh = Window::POLYF(CosInc, constructionSh.TransSolBeamCoef); // Outer glass solar trans, refl, absorptance if switched TransGl = Window::InterpSw(SwitchFac, TransGl, TransGlSh); Real64 TransDiffGlSh = constructionSh.TransDiff; diff --git a/src/EnergyPlus/SolarReflectionManager.cc b/src/EnergyPlus/SolarReflectionManager.cc index 8cbecf1b3c9..588fa58cd75 100644 --- a/src/EnergyPlus/SolarReflectionManager.cc +++ b/src/EnergyPlus/SolarReflectionManager.cc @@ -891,9 +891,6 @@ namespace SolarReflectionManager { // REFERENCES: // na - // Using/Aliasing - using General::POLYF; - // Locals // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Array1D ReflBmToDiffSolObs(state.dataSurface->MaxRecPts); // Irradiance at a receiving point for @@ -1034,7 +1031,7 @@ namespace SolarReflectionManager { state.dataSolarReflectionManager->SpecReflectance = 0.0; if (state.dataSurface->Surface(ReflSurfNum).Class == SurfaceClass::Window) { state.dataSolarReflectionManager->ConstrNumRefl = state.dataSurface->Surface(ReflSurfNum).Construction; - state.dataSolarReflectionManager->SpecReflectance = POLYF( + state.dataSolarReflectionManager->SpecReflectance = Window::POLYF( std::abs(state.dataSolarReflectionManager->CosIncAngRefl), state.dataConstruction->Construct(state.dataSolarReflectionManager->ConstrNumRefl).ReflSolBeamFrontCoef); } @@ -1043,7 +1040,7 @@ namespace SolarReflectionManager { state.dataSolarReflectionManager->ConstrNumRefl = state.dataSurface->SurfShadowGlazingConstruct(ReflSurfNum); state.dataSolarReflectionManager->SpecReflectance = state.dataSurface->SurfShadowGlazingFrac(ReflSurfNum) * - POLYF( + Window::POLYF( std::abs(state.dataSolarReflectionManager->CosIncAngRefl), state.dataConstruction->Construct(state.dataSolarReflectionManager->ConstrNumRefl).ReflSolBeamFrontCoef); } diff --git a/src/EnergyPlus/SolarShading.cc b/src/EnergyPlus/SolarShading.cc index 9ffe7a922e9..8caf90d01a6 100644 --- a/src/EnergyPlus/SolarShading.cc +++ b/src/EnergyPlus/SolarShading.cc @@ -6323,7 +6323,6 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // surfaces and interior solar radiation distribution using Dayltg::TransTDD; - using General::POLYF; using ScheduleManager::GetCurrentScheduleValue; using namespace DataWindowEquivalentLayer; @@ -6509,7 +6508,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) int NGlass = thisConstruct.TotGlassLayers; Array1D AbWin(NGlass); // Factor for front beam radiation absorbed in window glass layer for (int Lay = 1; Lay <= NGlass; ++Lay) { - AbWin(Lay) = POLYF(CosInc, thisConstruct.AbsBeamCoef(Lay)) * CosInc * SunLitFract * + AbWin(Lay) = Window::POLYF(CosInc, thisConstruct.AbsBeamCoef(Lay)) * CosInc * SunLitFract * s_surf->SurfaceWindow(SurfNum).OutProjSLFracMult[state.dataGlobal->HourOfDay]; } if (!IS_SHADED_NO_GLARE_CTRL(ShadeFlag)) { @@ -6534,12 +6533,12 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) auto const &thisConstructSh = state.dataConstruction->Construct(ConstrNumSh); // Shade or switchable glazing on for (int Lay = 1; Lay <= NGlass; ++Lay) { - AbWinSh(Lay) = POLYF(CosInc, thisConstructSh.AbsBeamCoef(Lay)) * CosInc * FracSunLit; + AbWinSh(Lay) = Window::POLYF(CosInc, thisConstructSh.AbsBeamCoef(Lay)) * CosInc * FracSunLit; ADiffWinSh(Lay) = thisConstructSh.AbsDiff(Lay); } if (ShadeFlag == WinShadingType::IntShade) { // Exterior beam absorbed by INTERIOR SHADE // Note that AbsBeamShadeCoef includes effect of shade/glazing inter-reflection - Real64 AbsShade = POLYF(CosInc, + Real64 AbsShade = Window::POLYF(CosInc, thisConstructSh.AbsBeamShadeCoef); // Interior shade or blind beam solar absorptance state.dataSolarShading->SurfWinExtBeamAbsByShadFac(SurfNum) = (AbsShade * CosInc * SunLitFract * InOutProjSLFracMult + @@ -6549,7 +6548,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) } else if (ShadeFlag == WinShadingType::ExtShade) { // Exterior beam absorbed by EXTERIOR SHADE state.dataSolarShading->SurfWinExtBeamAbsByShadFac(SurfNum) = thisConstructSh.AbsDiffShade * CosInc * SunLitFract; } else if (ShadeFlag == WinShadingType::BGShade) { // Exterior beam absorbed by BETWEEN-GLASS SHADE - Real64 AbsShade = POLYF(CosInc, thisConstructSh.AbsBeamShadeCoef); + Real64 AbsShade = Window::POLYF(CosInc, thisConstructSh.AbsBeamShadeCoef); state.dataSolarShading->SurfWinExtBeamAbsByShadFac(SurfNum) = AbsShade * CosInc * SunLitFract + s_surf->SurfWinOutsRevealDiffOntoGlazing(SurfNum) * thisConstructSh.AbsDiffShade; @@ -6560,7 +6559,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) ProfAng = surfShade.blind.profAng; if (ShadeFlag == WinShadingType::IntBlind) { // Interior blind on - Real64 TBmBm = POLYF(CosInc, thisConstruct.TransSolBeamCoef); + Real64 TBmBm = Window::POLYF(CosInc, thisConstruct.TransSolBeamCoef); Real64 RGlDiffBack = thisConstruct.ReflectSolDiffBack; // Glazing system back diffuse solar reflectance Real64 RhoBlFront = FrontBeamDiffRefl; // Blind solar front beam reflectance Real64 RhoBlDiffFront = FrontDiffDiffRefl; // Blind solar front diffuse reflectance @@ -6597,7 +6596,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 RhoBlBack = BackBeamDiffRefl; // Blind solar back beam-diffuse reflectance Real64 RhoBlDiffBack = BackDiffDiffRefl; // Blind solar back diffuse reflectance Real64 RGlFront = - POLYF(CosInc, thisConstruct.ReflSolBeamFrontCoef); // Glazing system solar front beam-beam 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 @@ -9324,7 +9323,6 @@ void WindowShadingManager(EnergyPlusData &state) // na // Using/Aliasing - using General::POLYF; using ScheduleManager::GetCurrentScheduleValue; int IConst; // Construction @@ -9407,7 +9405,7 @@ void WindowShadingManager(EnergyPlusData &state) // Vis trans at normal incidence of unswitched glass. Counting the GlazedFrac if (IConst > 0) s_surf->SurfWinVisTransSelected(ISurf) = - 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 @@ -9763,7 +9761,7 @@ void WindowShadingManager(EnergyPlusData &state) // Vis trans at normal incidence of fully switched glass IConst = s_surf->Surface(ISurf).activeShadedConstruction; s_surf->SurfWinVisTransSelected(ISurf) = - POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac; + Window::POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * surfWin.glazedFrac; } // Slat angle control for blinds @@ -10756,10 +10754,6 @@ void CalcBeamSolarOnWinRevealSurface(EnergyPlusData &state) // REFERENCES // na - // USE STATEMENTS - // Using/Aliasing - using General::POLYF; - // Locals // SUBROUTINE ARGUMENT DEFINITIONS:na @@ -10880,8 +10874,8 @@ void CalcBeamSolarOnWinRevealSurface(EnergyPlusData &state) ConstrNumSh = s_surf->SurfWinActiveShadedConstruction(SurfNum); auto const &thisConstruct = state.dataConstruction->Construct(ConstrNum); - SolTransGlass = POLYF(state.dataHeatBal->SurfCosIncAng(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, SurfNum), - thisConstruct.TransSolBeamCoef); + SolTransGlass = Window::POLYF(state.dataHeatBal->SurfCosIncAng(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, SurfNum), + thisConstruct.TransSolBeamCoef); TanProfileAngVert = s_surf->SurfWinTanProfileAngVert(SurfNum); TanProfileAngHor = s_surf->SurfWinTanProfileAngHor(SurfNum); FrameDivNum = surf.FrameDivider; @@ -11110,8 +11104,8 @@ void CalcBeamSolarOnWinRevealSurface(EnergyPlusData &state) if (ShadeFlag == WinShadingType::SwitchableGlazing) { auto const &thisConstructSh = state.dataConstruction->Construct(ConstrNumSh); SolTransGlassSh = - POLYF(state.dataHeatBal->SurfCosIncAng(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, SurfNum), - thisConstructSh.TransSolBeamCoef); + Window::POLYF(state.dataHeatBal->SurfCosIncAng(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, SurfNum), + thisConstructSh.TransSolBeamCoef); SolTransGlass = Window::InterpSw(s_surf->SurfWinSwitchingFactor(SurfNum), SolTransGlass, SolTransGlassSh); DiffReflGlassSh = thisConstructSh.ReflectSolDiffBack; DiffReflGlass = Window::InterpSw(s_surf->SurfWinSwitchingFactor(SurfNum), DiffReflGlass, DiffReflGlassSh); diff --git a/src/EnergyPlus/WindowEquivalentLayer.hh b/src/EnergyPlus/WindowEquivalentLayer.hh index affd940c6fc..14910db93c3 100644 --- a/src/EnergyPlus/WindowEquivalentLayer.hh +++ b/src/EnergyPlus/WindowEquivalentLayer.hh @@ -60,6 +60,7 @@ // EnergyPlus Headers #include +#include #include #include diff --git a/src/EnergyPlus/WindowManager.cc b/src/EnergyPlus/WindowManager.cc index 45dac7d9da4..4c73a1768d9 100644 --- a/src/EnergyPlus/WindowManager.cc +++ b/src/EnergyPlus/WindowManager.cc @@ -54,7 +54,6 @@ // ObjexxFCL Headers #include -#include // EnergyPlus Headers #include @@ -66,16 +65,10 @@ #include #include #include -#include -#include #include -#include -#include -#include #include #include #include -#include #include #include #include @@ -1443,7 +1436,7 @@ namespace Window { tsolPhiFit[iPhi] = 0.0; tvisPhiFit[iPhi] = 0.0; - for (int CoefNum = 0; CoefNum < DataSurfaces::MaxPolyCoeff; ++CoefNum) { + for (int CoefNum = 0; CoefNum < maxPolyCoef; ++CoefNum) { tsolPhiFit[iPhi] += thisConstruct.TransSolBeamCoef[CoefNum] * cosPhis[iPhi]; tvisPhiFit[iPhi] += thisConstruct.TransVisBeamCoef[CoefNum] * cosPhis[iPhi]; } @@ -1598,7 +1591,7 @@ namespace Window { constr.AbsDiff = 0.0; constr.AbsDiffBack = 0.0; for (int Layer = 1; Layer <= state.dataHeatBal->MaxSolidWinLayers; ++Layer) { - for (int index = 0; index < DataSurfaces::MaxPolyCoeff; ++index) { + for (int index = 0; index < maxPolyCoef; ++index) { state.dataConstruction->Construct(state.dataHeatBal->TotConstructs).AbsBeamCoef(Layer)[index] = 0.0; state.dataConstruction->Construct(state.dataHeatBal->TotConstructs).AbsBeamBackCoef(Layer)[index] = 0.0; } @@ -5311,7 +5304,7 @@ 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 &coeffs // Polynomial coefficients from fit ) { @@ -5328,28 +5321,28 @@ namespace Window { // form C1*X + C2*X**2 + C3*X**3 + ... +CN*X**N, where N <= 6. // Adapted from BLAST subroutine LSQFIT. - std::array, DataSurfaces::MaxPolyCoeff> A; // Least squares derivative matrix - std::array B; // Least squares derivative vector - std::array, DataSurfaces::MaxPolyCoeff> 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) { D[0][M] = ivars[M]; } - for (int i = 1; i < DataSurfaces::MaxPolyCoeff; ++i) { + for (int i = 1; i < maxPolyCoef; ++i) { for (int M = 0; M < numPhis; ++M) { D[i][M] = D[i - 1][M] * ivars[M]; } } - for (int i = 0; i < DataSurfaces::MaxPolyCoeff; ++i) { + for (int i = 0; i < maxPolyCoef; ++i) { Real64 SUM = 0.0; for (int M = 0; M < numPhis; ++M) { SUM += dvars[M] * D[i][M]; } B[i] = SUM; - for (int j = 0; j < DataSurfaces::MaxPolyCoeff; ++j) { + for (int j = 0; j < maxPolyCoef; ++j) { Real64 SUM2 = 0.0; for (int M = 0; M < numPhis; ++M) { SUM2 += D[i][M] * D[j][M]; @@ -5360,26 +5353,26 @@ namespace Window { } // Solve the simultaneous equations using Gauss elimination - int order1 = DataSurfaces::MaxPolyCoeff - 1; + int order1 = maxPolyCoef - 1; for (int K = 0; K < order1; ++K) { int KP1 = K + 1; - for (int i = KP1; i < DataSurfaces::MaxPolyCoeff; ++i) { + for (int i = KP1; i < maxPolyCoef; ++i) { Real64 ACON = A[K][i] / A[K][K]; B[i] -= B[K] * ACON; - for (int j = K; j < DataSurfaces::MaxPolyCoeff; ++j) { + for (int j = K; j < maxPolyCoef; ++j) { A[j][i] -= A[j][K] * ACON; } } } // Perform back substitution - coeffs[DataSurfaces::MaxPolyCoeff-1] = B[DataSurfaces::MaxPolyCoeff-1] / A[DataSurfaces::MaxPolyCoeff-1][DataSurfaces::MaxPolyCoeff-1]; - int LP1 = DataSurfaces::MaxPolyCoeff - 1; - int L = DataSurfaces::MaxPolyCoeff - 2; + coeffs[maxPolyCoef-1] = B[maxPolyCoef-1] / A[maxPolyCoef-1][maxPolyCoef-1]; + int LP1 = maxPolyCoef - 1; + int L = maxPolyCoef - 2; while (L >= 0) { Real64 SUM = 0.0; - for (int j = LP1; j < DataSurfaces::MaxPolyCoeff; ++j) { + for (int j = LP1; j < maxPolyCoef; ++j) { SUM += A[j][L] * coeffs[j]; } coeffs[L] = (B[L] - SUM) / A[L][L]; @@ -5972,11 +5965,11 @@ namespace Window { return; } - TSolNorm = General::POLYF(1.0, state.dataConstruction->Construct(ConstrNum).TransSolBeamCoef); - TVisNorm = General::POLYF(1.0, state.dataConstruction->Construct(ConstrNum).TransVisBeamCoef); + TSolNorm = POLYF(1.0, state.dataConstruction->Construct(ConstrNum).TransSolBeamCoef); + TVisNorm = POLYF(1.0, state.dataConstruction->Construct(ConstrNum).TransVisBeamCoef); AbsBeamShadeNorm = 0.0; if (ShadeFlag == WinShadingType::IntShade || ShadeFlag == WinShadingType::ExtShade) { // Exterior or interior shade on - AbsBeamShadeNorm = General::POLYF(1.0, state.dataConstruction->Construct(ConstrNum).AbsBeamShadeCoef); + AbsBeamShadeNorm = POLYF(1.0, state.dataConstruction->Construct(ConstrNum).AbsBeamShadeCoef); // Exterior blind or screen or interior blind on } else if (ShadeFlag == WinShadingType::IntBlind || ShadeFlag == WinShadingType::ExtBlind || ShadeFlag == WinShadingType::ExtScreen) { // Find unshaded construction that goes with this construction w/blind or screen @@ -6007,8 +6000,8 @@ namespace Window { } auto const &constructBare = state.dataConstruction->Construct(ConstrNumBare); - TBmBm = General::POLYF(1.0, constructBare.TransSolBeamCoef); - TBmBmVis = General::POLYF(1.0, constructBare.TransVisBeamCoef); + TBmBm = POLYF(1.0, constructBare.TransSolBeamCoef); + TBmBmVis = POLYF(1.0, constructBare.TransVisBeamCoef); if (ShadeFlag == WinShadingType::ExtScreen) { // Don't need to call subroutine, use normal incident properties (SUBROUTINE CalcNominalWindowCond) @@ -6026,8 +6019,8 @@ namespace Window { RScBackVis = matScreen->ShadeRefVis; RScDifBack = matScreen->DfRef; RScDifBackVis = matScreen->DfRefVis; - RGlFront = General::POLYF(1.0, constructBare.ReflSolBeamFrontCoef); - RGlFrontVis = General::POLYF(1.0, constructBare.ReflSolBeamFrontCoef); + RGlFront = POLYF(1.0, constructBare.ReflSolBeamFrontCoef); + RGlFrontVis = POLYF(1.0, constructBare.ReflSolBeamFrontCoef); RGlDiffFront = constructBare.ReflectSolDiffFront; RGlDiffFrontVis = constructBare.ReflectVisDiffFront; TSolNorm = TScBmBm * (TBmBm + TDif * RGlFront * RScBack / (1 - RGlDiffFront * RScDifBack)) + @@ -6079,8 +6072,8 @@ namespace Window { (TBlBmBm + TBlBmDifVis + TBlDifDifVis * RhoBlFrontVis * RGlDiffBackVis / (1.0 - RhoBlDiffFrontVis * RGlDiffBackVis)); } else if (ShadeFlag == WinShadingType::ExtBlind) { - RGlFront = General::POLYF(1.0, constructBare.ReflSolBeamFrontCoef); - RGlFrontVis = General::POLYF(1.0, constructBare.ReflSolBeamFrontCoef); + RGlFront = POLYF(1.0, constructBare.ReflSolBeamFrontCoef); + RGlFrontVis = POLYF(1.0, constructBare.ReflSolBeamFrontCoef); AbsBlFront = blindTAR.Sol.Ft.Bm[profIdxLo].Abs; AbsBlBack = blindTAR.Sol.Bk.Bm[profIdxLo].Abs; AbsBlDiffBack = blindTAR.Sol.Bk.Df.Abs; @@ -6134,20 +6127,20 @@ namespace Window { wm->emis[2 * IGlass - 1] = matGlass->AbsorpThermalBack; wm->tir[2 * IGlass - 2] = matGlass->TransThermal; wm->tir[2 * IGlass - 1] = matGlass->TransThermal; - AbsBeamNorm(IGlass) = General::POLYF(1.0, state.dataConstruction->Construct(ConstrNum).AbsBeamCoef(IGlass)); + AbsBeamNorm(IGlass) = POLYF(1.0, state.dataConstruction->Construct(ConstrNum).AbsBeamCoef(IGlass)); if (ShadeFlag == WinShadingType::IntBlind) { // Interior blind on auto const &constructBare = state.dataConstruction->Construct(ConstrNumBare); - AbsBeamNorm(IGlass) = General::POLYF(1.0, constructBare.AbsBeamCoef(IGlass)); + AbsBeamNorm(IGlass) = POLYF(1.0, constructBare.AbsBeamCoef(IGlass)); AGlDiffBack = constructBare.AbsDiffBack(IGlass); AbsBeamNorm(IGlass) += TBmBm * AGlDiffBack * RhoBlFront / (1.0 - RhoBlFront * RGlDiffBack); } else if (ShadeFlag == WinShadingType::ExtBlind) { // Exterior blind on auto const &constructBare = state.dataConstruction->Construct(ConstrNumBare); - AbsBeamNorm(IGlass) = General::POLYF(1.0, constructBare.AbsBeamCoef(IGlass)); + AbsBeamNorm(IGlass) = POLYF(1.0, constructBare.AbsBeamCoef(IGlass)); AbsBeamNorm(IGlass) = TBlBmBm * AbsBeamNorm(IGlass) + (TBlBmBm * RGlFront * RhoBlBack + TBlBmDif) * constructBare.AbsDiff(IGlass) / (1.0 - RGlDiffFront * RhoBlDiffBack); } else if (ShadeFlag == WinShadingType::ExtScreen) { // Exterior screen on auto const &constructBare = state.dataConstruction->Construct(ConstrNumBare); - AbsBeamNorm(IGlass) = General::POLYF(1.0, constructBare.AbsBeamCoef(IGlass)); + AbsBeamNorm(IGlass) = POLYF(1.0, constructBare.AbsBeamCoef(IGlass)); AbsBeamNorm(IGlass) = TScBmBm * AbsBeamNorm(IGlass) + (TScBmBm * RGlFront * RScBack + TScBmDif) * constructBare.AbsDiff(IGlass) / (1.0 - RGlDiffFront * RScDifBack); } diff --git a/src/EnergyPlus/WindowManager.hh b/src/EnergyPlus/WindowManager.hh index 451c197a9c7..e265fadc18c 100644 --- a/src/EnergyPlus/WindowManager.hh +++ b/src/EnergyPlus/WindowManager.hh @@ -56,7 +56,7 @@ // EnergyPlus Headers #include #include -#include +#include #include #include #include @@ -84,6 +84,8 @@ namespace Window { {1.0, 0.98480775301220802, 0.93969262078590842, 0.86602540378443871, 0.76604444311897812, 0.64278760968653936, 0.50000000000000011, 0.34202014332566882, 0.17364817766693041, 6.123233995736766E-17}; + constexpr int maxPolyCoef = 6; + class CWindowModel; class CWindowOpticalModel; class CWindowConstructionsSimplified; @@ -231,6 +233,24 @@ namespace Window { Array1D &b // Matrix and vector in a.x = b; ); + 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])))))); + } + + constexpr Real64 POLYF(Real64 const X, // Cosine of angle of incidence + Array1D const &A // Polynomial coefficients + ) + { + if (X < 0.0 || X > 1.0) { + return 0.0; + } else { + return X * (A(1) + X * (A(2) + X * (A(3) + X * (A(4) + X * (A(5) + X * A(6)))))); + } + } + void WindowGasConductance(EnergyPlusData &state, Real64 tleft, // Temperature of gap surface closest to outside (K) Real64 tright, // Temperature of gap surface closest to zone (K) @@ -281,7 +301,7 @@ namespace Window { void W5LsqFit(std::array const &ivars, // Independent variables std::array const &dvars, // Dependent variables - std::array &coeffs // Polynomial coeffients from fit + std::array &coeffs // Polynomial coeffients from fit ); Real64 DiffuseAverage(std::array const &props); // Property value at angles of incidence From a7ec0c0a9f20131c3fbe11e7da0ea0efdb36e9c7 Mon Sep 17 00:00:00 2001 From: Amir Roth Date: Fri, 27 Dec 2024 21:43:49 -0500 Subject: [PATCH 4/8] This was the source of the diffs? THIS? --- src/EnergyPlus/Construction.hh | 14 ++---- src/EnergyPlus/HeatBalanceManager.cc | 1 + src/EnergyPlus/WindowManager.cc | 71 +++++++++++++--------------- src/EnergyPlus/WindowManager.hh | 2 +- 4 files changed, 39 insertions(+), 49 deletions(-) diff --git a/src/EnergyPlus/Construction.hh b/src/EnergyPlus/Construction.hh index 952fa8e4ed9..dfaa407b402 100644 --- a/src/EnergyPlus/Construction.hh +++ b/src/EnergyPlus/Construction.hh @@ -220,21 +220,17 @@ namespace Construction { 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; // Coefficients of incidence-angle polynomial for solar - // absorptance of shade + 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; // Coeffs of incidence-angle polynomial for beam sol trans, - // bare glass or shade on - std::array TransVisBeamCoef; // Coeffs of incidence-angle polynomial for beam vis trans, - // bare glass or shade on - std::array ReflSolBeamFrontCoef; // Coeffs of incidence-angle polynomial for beam sol front refl, - // bare glass or shade on - std::array ReflSolBeamBackCoef; // Like ReflSolBeamFrontCoef, but for back-incident beam solar + 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 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 diff --git a/src/EnergyPlus/HeatBalanceManager.cc b/src/EnergyPlus/HeatBalanceManager.cc index a8552c410f2..8030bafdab2 100644 --- a/src/EnergyPlus/HeatBalanceManager.cc +++ b/src/EnergyPlus/HeatBalanceManager.cc @@ -4342,6 +4342,7 @@ namespace HeatBalanceManager { thisConstruct.ReflectVisDiffFront = RfvisTemp(11); thisConstruct.ReflectVisDiffBack = RbvisTemp(11); + // 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); diff --git a/src/EnergyPlus/WindowManager.cc b/src/EnergyPlus/WindowManager.cc index 4c73a1768d9..7027514f6ab 100644 --- a/src/EnergyPlus/WindowManager.cc +++ b/src/EnergyPlus/WindowManager.cc @@ -353,8 +353,6 @@ namespace Window { if (thisConstruct.WindowTypeEQL) continue; // skip Equivalent Layer Fenestration // handling of optical properties - constexpr int TotalIPhi = 10; - TotLay = thisConstruct.TotLayers; auto const *mat = s_mat->materials(thisConstruct.LayerPoint(1)); @@ -629,22 +627,17 @@ namespace Window { } } // End of loop over glass layers in the construction for front calculation - if (TotalIPhi > numPhis) { - ShowSevereError(state, - format("WindowManage::InitGlassOpticalCalculations = {}, Invalid maximum value of common incident angles = {}.", - thisConstruct.Name, - TotalIPhi)); - ShowContinueError( - state, - format("The maximum number of incident angles for each construct is {}. Please rearrange the dataset.", numPhis)); - ShowFatalError(state, "Errors found getting inputs. Previous error(s) cause program termination."); - } - // Loop over incidence angle from 0 to 90 deg in 10 deg increments. // Get glass layer properties, then glazing system properties (which include the // effect of inter-reflection among glass layers) at each incidence angle. - for (int iPhi = 0; iPhi < TotalIPhi; ++iPhi) { + // 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 for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { @@ -653,7 +646,7 @@ namespace Window { assert(matGlass != nullptr); if (matGlass->windowOpticalData != Window::OpticalDataModel::SpectralAndAngle) { for (int ILam = 1; ILam <= numpt[IGlass - 1]; ++ILam) { - TransAndReflAtPhi(cosPhis[iPhi], + TransAndReflAtPhi(cosPhisLocal[iPhi], t[IGlass - 1][ILam - 1], rff[IGlass - 1][ILam - 1], rbb[IGlass - 1][ILam - 1], @@ -731,14 +724,14 @@ namespace Window { // only used by between-glass shades or blinds if (AllGlassIsSpectralAverage) { for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { - W5LsqFit(cosPhis, tBareSolPhi(IGlass), thisConstruct.tBareSolCoef(IGlass)); - W5LsqFit(cosPhis, tBareVisPhi(IGlass), thisConstruct.tBareVisCoef(IGlass)); - W5LsqFit(cosPhis, rfBareSolPhi(IGlass), thisConstruct.rfBareSolCoef(IGlass)); - W5LsqFit(cosPhis, rfBareVisPhi(IGlass), thisConstruct.rfBareVisCoef(IGlass)); - W5LsqFit(cosPhis, rbBareSolPhi(IGlass), thisConstruct.rbBareSolCoef(IGlass)); - W5LsqFit(cosPhis, rbBareVisPhi(IGlass), thisConstruct.rbBareVisCoef(IGlass)); - W5LsqFit(cosPhis, afBareSolPhi(IGlass), thisConstruct.afBareSolCoef(IGlass)); - W5LsqFit(cosPhis, abBareSolPhi(IGlass), thisConstruct.abBareSolCoef(IGlass)); + W5LsqFit(cosPhisLocal, tBareSolPhi(IGlass), thisConstruct.tBareSolCoef(IGlass)); + W5LsqFit(cosPhisLocal, tBareVisPhi(IGlass), thisConstruct.tBareVisCoef(IGlass)); + W5LsqFit(cosPhisLocal, rfBareSolPhi(IGlass), thisConstruct.rfBareSolCoef(IGlass)); + W5LsqFit(cosPhisLocal, rfBareVisPhi(IGlass), thisConstruct.rfBareVisCoef(IGlass)); + W5LsqFit(cosPhisLocal, rbBareSolPhi(IGlass), thisConstruct.rbBareSolCoef(IGlass)); + W5LsqFit(cosPhisLocal, rbBareVisPhi(IGlass), thisConstruct.rbBareVisCoef(IGlass)); + W5LsqFit(cosPhisLocal, afBareSolPhi(IGlass), thisConstruct.afBareSolCoef(IGlass)); + W5LsqFit(cosPhisLocal, abBareSolPhi(IGlass), thisConstruct.abBareSolCoef(IGlass)); } } @@ -840,7 +833,7 @@ namespace Window { // The glazing system properties include the effect of inter-reflection among glass layers, // but exclude the effect of a shade or blind if present in the construction. // When a construction has a layer = SpectralAndAngle, the 10 degree increment will be overridden. - for (int iPhi = 0; iPhi < TotalIPhi; ++iPhi) { + for (int iPhi = 0; iPhi < numPhis; ++iPhi) { // For each wavelength, get glass layer properties at this angle of incidence // from properties at normal incidence for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { @@ -850,7 +843,7 @@ namespace Window { if (matGlass->windowOpticalData != Window::OpticalDataModel::SpectralAndAngle) { for (int ILam = 1; ILam <= numpt[IGlass - 1]; ++ILam) { - TransAndReflAtPhi(cosPhis[iPhi], + TransAndReflAtPhi(cosPhisLocal[iPhi], t[IGlass - 1][ILam - 1], rff[IGlass - 1][ILam - 1], rbb[IGlass - 1][ILam - 1], @@ -935,7 +928,7 @@ namespace Window { ShadeReflFacVis = 1.0 / (1.0 - ShadeReflVis * constr.ReflectVisDiffBack); // Front incident solar, beam, interior shade - for (int iPhi = 0; iPhi < TotalIPhi; ++iPhi) { + for (int iPhi = 0; iPhi < numPhis; ++iPhi) { for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { solabsPhi(IGlass)[iPhi] += tsolPhi[iPhi] * ShadeRefl * ShadeReflFac * constr.AbsDiffBack(IGlass); } @@ -984,7 +977,7 @@ namespace Window { ShadeReflFac = 1.0 / (1.0 - ShadeRefl * constr.ReflectSolDiffFront); ShadeReflFacVis = 1.0 / (1.0 - ShadeReflVis * constr.ReflectVisDiffFront); - for (int iPhi = 0; iPhi < TotalIPhi; ++iPhi) { + for (int iPhi = 0; iPhi < numPhis; ++iPhi) { for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { solabsPhi(IGlass)[iPhi] = ShadeTrans * solabsDiff(IGlass) * ShadeReflFac; } @@ -1052,7 +1045,7 @@ namespace Window { // Front incident solar, beam, between-glass shade, NGlass = 2 - for (int iPhi = 0; iPhi < TotalIPhi; ++iPhi) { + for (int iPhi = 0; iPhi < numPhis; ++iPhi) { t1 = tBareSolPhi(1)[iPhi]; t1v = tBareVisPhi(1)[iPhi]; af1 = afBareSolPhi(1)[iPhi]; @@ -1095,7 +1088,7 @@ namespace Window { // Front incident solar, beam, between-glass shade, NGlass = 3 - for (int iPhi = 0; iPhi < TotalIPhi; ++iPhi) { + for (int iPhi = 0; iPhi < numPhis; ++iPhi) { t1 = tBareSolPhi(1)[iPhi]; t1v = tBareVisPhi(1)[iPhi]; t2 = tBareSolPhi(2)[iPhi]; @@ -1416,34 +1409,34 @@ namespace Window { // visible transmittance as polynomials in cosine of incidence angle if (!BlindOn && !ScreenOn) { // Bare glass or shade on - W5LsqFit(cosPhis, tsolPhi, thisConstruct.TransSolBeamCoef); - W5LsqFit(cosPhis, rfsolPhi, thisConstruct.ReflSolBeamFrontCoef); - W5LsqFit(cosPhis, rbsolPhi, thisConstruct.ReflSolBeamBackCoef); - W5LsqFit(cosPhis, tvisPhi, thisConstruct.TransVisBeamCoef); + W5LsqFit(cosPhisLocal, tsolPhi, thisConstruct.TransSolBeamCoef); + W5LsqFit(cosPhisLocal, rfsolPhi, thisConstruct.ReflSolBeamFrontCoef); + W5LsqFit(cosPhisLocal, rbsolPhi, thisConstruct.ReflSolBeamBackCoef); + W5LsqFit(cosPhisLocal, tvisPhi, thisConstruct.TransVisBeamCoef); for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { // Front absorptance coefficients for glass layers - W5LsqFit(cosPhis, solabsPhi(IGlass), thisConstruct.AbsBeamCoef(IGlass)); + W5LsqFit(cosPhisLocal, solabsPhi(IGlass), thisConstruct.AbsBeamCoef(IGlass)); // Back absorptance coefficients for glass layers IGlassBack = NGlass - IGlass + 1; - W5LsqFit(cosPhis, solabsBackPhi(IGlassBack), thisConstruct.AbsBeamBackCoef(IGlass)); + W5LsqFit(cosPhisLocal, solabsBackPhi(IGlassBack), thisConstruct.AbsBeamBackCoef(IGlass)); } // To check goodness of fit //Tuned - for (int iPhi = 0; iPhi < TotalIPhi; ++iPhi) { + for (int iPhi = 0; iPhi < numPhis; ++iPhi) { tsolPhiFit[iPhi] = 0.0; tvisPhiFit[iPhi] = 0.0; for (int CoefNum = 0; CoefNum < maxPolyCoef; ++CoefNum) { - tsolPhiFit[iPhi] += thisConstruct.TransSolBeamCoef[CoefNum] * cosPhis[iPhi]; - tvisPhiFit[iPhi] += thisConstruct.TransVisBeamCoef[CoefNum] * cosPhis[iPhi]; + tsolPhiFit[iPhi] += thisConstruct.TransSolBeamCoef[CoefNum] * cosPhisLocal[iPhi]; + tvisPhiFit[iPhi] += thisConstruct.TransVisBeamCoef[CoefNum] * cosPhisLocal[iPhi]; } } } - if (ShadeOn) W5LsqFit(cosPhis, solabsShadePhi, thisConstruct.AbsBeamShadeCoef); + if (ShadeOn) W5LsqFit(cosPhisLocal, solabsShadePhi, thisConstruct.AbsBeamShadeCoef); } // End of loop over constructions diff --git a/src/EnergyPlus/WindowManager.hh b/src/EnergyPlus/WindowManager.hh index e265fadc18c..eb5ab78a01f 100644 --- a/src/EnergyPlus/WindowManager.hh +++ b/src/EnergyPlus/WindowManager.hh @@ -82,7 +82,7 @@ namespace Window { constexpr std::array cosPhis = {1.0, 0.98480775301220802, 0.93969262078590842, 0.86602540378443871, 0.76604444311897812, - 0.64278760968653936, 0.50000000000000011, 0.34202014332566882, 0.17364817766693041, 6.123233995736766E-17}; + 0.64278760968653936, 0.50000000000000011, 0.34202014332566882, 0.17364817766693041, 0.0}; // 6.123233995736766E-17 constexpr int maxPolyCoef = 6; From 73e9bbcbe1c7ccb8ba3d96ceb86818c66ead93d7 Mon Sep 17 00:00:00 2001 From: Amir Roth Date: Sat, 28 Dec 2024 09:15:54 -0500 Subject: [PATCH 5/8] Merge develop --- src/EnergyPlus/SolarShading.cc | 186 +++++++++++++++----------------- src/EnergyPlus/WindowManager.hh | 4 +- 2 files changed, 92 insertions(+), 98 deletions(-) diff --git a/src/EnergyPlus/SolarShading.cc b/src/EnergyPlus/SolarShading.cc index 8caf90d01a6..1bebd923eaf 100644 --- a/src/EnergyPlus/SolarShading.cc +++ b/src/EnergyPlus/SolarShading.cc @@ -80,7 +80,7 @@ #include #include #include -#include +// #include #include #include #include @@ -6647,8 +6647,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 RScBack = BilinearInterp(b11.RefSolFront, b12.RefSolFront, b21.RefSolFront, b22.RefSolFront, coeffs); Real64 RScDifBack = screen->DfRef; - Real64 RGlFront = - POLYF(CosInc, thisConstruct.ReflSolBeamFrontCoef); // Glazing system solar front beam-beam 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 Real64 RGlDifFr = thisConstruct.ReflectSolDiffFront; // Diffuse front reflectance of glass // Reduce the bare window absorbed beam by the screen beam transmittance and then account for @@ -6676,8 +6675,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 RScBack = btar.RefSolFront; Real64 RScDifBack = screen->DfRef; - Real64 RGlFront = - POLYF(CosInc, thisConstruct.ReflSolBeamFrontCoef); // Glazing system solar front beam-beam 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 Real64 RGlDifFr = thisConstruct.ReflectSolDiffFront; // Diffuse front reflectance of glass // Reduce the bare window absorbed beam by the screen beam transmittance and then account for @@ -6699,18 +6697,16 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) } else if (ShadeFlag == WinShadingType::BGBlind) { // Between-glass blind o // Isolated glass and blind properties at current incidence angle, profile angle and slat angle - Real64 t1 = POLYF(CosInc, - thisConstruct.tBareSolCoef(1)); // Bare-glass beam solar transmittance for glass layers 1,2 and 3 - Real64 t2 = POLYF(CosInc, thisConstruct.tBareSolCoef(2)); - Real64 af1 = - POLYF(CosInc, - thisConstruct.afBareSolCoef(1)); // Bare-glass beam solar front absorptance for glass layers 1,2 and 3 - Real64 af2 = POLYF(CosInc, thisConstruct.afBareSolCoef(2)); - Real64 ab1 = - POLYF(CosInc, + Real64 t1 = Window::POLYF(CosInc, + 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 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 ab2 = POLYF(CosInc, thisConstruct.abBareSolCoef(2)); - Real64 rf2 = POLYF(CosInc, thisConstruct.rfBareSolCoef(2)); + 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 Real64 td2 = thisConstruct.tBareSolDiff(2); Real64 afd1 = thisConstruct.afBareSolDiff(1); // Bare-glass diffuse solar front absorptance for glass layers 1,2 and 3 @@ -6755,8 +6751,8 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) } else if (NGlass == 3) { Real64 t1t2 = t1 * t2; // t1*t2 Real64 td1td2 = td1 * td2; - Real64 af3 = POLYF(CosInc, thisConstruct.afBareSolCoef(3)); - Real64 rf3 = POLYF(CosInc, thisConstruct.rfBareSolCoef(3)); + Real64 af3 = Window::POLYF(CosInc, thisConstruct.afBareSolCoef(3)); + Real64 rf3 = Window::POLYF(CosInc, thisConstruct.rfBareSolCoef(3)); Real64 afd3 = thisConstruct.afBareSolDiff(3); Real64 rfd3 = thisConstruct.rfBareSolDiff(3); Real64 td2 = thisConstruct.tBareSolDiff(2); @@ -7000,9 +6996,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 = POLYF(CosInc, thisConstruct.TransSolBeamCoef); //[-] + TBmBm = Window::POLYF(CosInc, thisConstruct.TransSolBeamCoef); //[-] } else { // Diffusing glazing - TBmDif = 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 @@ -7046,10 +7042,10 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) if (s_surf->SurfWinWindowModelType(SurfNum) != WindowModel::EQL) { if (IS_SHADED_NO_GLARE_CTRL(ShadeFlag)) { // Shade or screen or blind on, or switchable glazing - // (note in the following that diffusing glass is not allowed in a window with shade, blind or switchable glazing) + // (note in the following that diffusing glass is not oallowed in a window with shade, blind or switchable glazing) if (ANY_SHADE(ShadeFlag) || ShadeFlag == WinShadingType::SwitchableGlazing) { // Shade on or switchable glazing - TBmAllShBlSc = POLYF(CosInc, thisConstructSh.TransSolBeamCoef); + TBmAllShBlSc = Window::POLYF(CosInc, thisConstructSh.TransSolBeamCoef); } else { // Blind or Screen on Real64 TScBmDif; // Beam-diffuse solar transmittance of screen @@ -7083,7 +7079,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 RScBack = BilinearInterp(b11.RefSolFront, b12.RefSolFront, b21.RefSolFront, b22.RefSolFront, coeffs); Real64 RScDifBack = screen->DfRef; - Real64 RGlBmFr = POLYF(CosInc, thisConstruct.ReflSolBeamFrontCoef); // Beam front reflectance of glass + Real64 RGlBmFr = Window::POLYF(CosInc, thisConstruct.ReflSolBeamFrontCoef); // Beam 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); @@ -7105,7 +7101,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 RScBack = btar.RefSolFront; Real64 RScDifBack = screen->DfRef; - Real64 RGlBmFr = POLYF(CosInc, thisConstruct.ReflSolBeamFrontCoef); // Beam front reflectance of glass + Real64 RGlBmFr = Window::POLYF(CosInc, thisConstruct.ReflSolBeamFrontCoef); // Beam 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; @@ -7139,7 +7135,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) } else if (ShadeFlag == WinShadingType::ExtBlind) { Real64 RhoBlBmDifBk = BackBeamDiffRefl; // Beam-diffuse back reflectance of blind Real64 RhoBlDifDifBk = BackDiffDiffRefl; // Diffuse-diffuse back reflectance of blind - Real64 RGlBmFr = POLYF(CosInc, thisConstruct.ReflSolBeamFrontCoef); + Real64 RGlBmFr = Window::POLYF(CosInc, thisConstruct.ReflSolBeamFrontCoef); Real64 RGlDifFr = thisConstruct.ReflectSolDiffFront; // beam-beam and diffuse transmittance of exterior beam TBmBmBl = TBmBm * TBlBmBm; @@ -7156,11 +7152,11 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 rfshd = FrontDiffDiffRefl; Real64 rbshd = BackDiffDiffRefl; Real64 tfshBd = FrontBeamDiffTrans; - Real64 t1 = POLYF(CosInc, thisConstruct.tBareSolCoef(1)); - Real64 t2 = POLYF(CosInc, thisConstruct.tBareSolCoef(2)); + Real64 t1 = Window::POLYF(CosInc, thisConstruct.tBareSolCoef(1)); + Real64 t2 = Window::POLYF(CosInc, thisConstruct.tBareSolCoef(2)); Real64 tfshBB = surfShade.blind.bmBmTrans; if (NGlass == 2) { - Real64 rf2 = POLYF(CosInc, thisConstruct.rfBareSolCoef(2)); + Real64 rf2 = Window::POLYF(CosInc, thisConstruct.rfBareSolCoef(2)); Real64 rfshB = FrontBeamDiffRefl; Real64 rfd2 = thisConstruct.rfBareSolDiff(2); TBmBmBl = t1 * tfshBB * t2; @@ -7168,9 +7164,9 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) t1 * (tfshBB * rf2 * rbshB + tfshBd * (1.0 + rfd2 * rbshd) + rfshB * rbd1 * rfshd) * td2; } else { // NGlass = 3 Real64 t1t2 = t1 * t2; - Real64 t3 = POLYF(CosInc, thisConstruct.tBareSolCoef(3)); + Real64 t3 = Window::POLYF(CosInc, thisConstruct.tBareSolCoef(3)); Real64 td3 = thisConstruct.tBareSolDiff(3); - Real64 rf3 = POLYF(CosInc, thisConstruct.rfBareSolCoef(3)); + Real64 rf3 = Window::POLYF(CosInc, thisConstruct.rfBareSolCoef(3)); Real64 rbd2 = thisConstruct.rbBareSolDiff(2); Real64 rfd3 = thisConstruct.rfBareSolDiff(3); Real64 tfshd = FrontDiffDiffTrans; @@ -7389,8 +7385,9 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) auto &surfShadeBack = s_surf->surfShades(BackSurfNum); int ConstrNumBack = s_surf->SurfActiveConstruction(BackSurfNum); + auto const &constrBack = state.dataConstruction->Construct(ConstrNumBack); - int NBackGlass = state.dataConstruction->Construct(ConstrNumBack).TotGlassLayers; + int NBackGlass = constrBack.TotGlassLayers; // Irradiated (overlap) area for this back surface, projected onto window plane // (includes effect of shadowing on exterior window) Real64 AOverlap = @@ -7398,7 +7395,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // Back surface area irradiated by beam solar from an exterior window, projected onto window plane Real64 BOverlap = TBm * AOverlap * CosInc; //[m2] // AOverlap multiplied by exterior window beam transmittance and cosine of incidence angle - if (state.dataConstruction->Construct(ConstrNumBack).TransDiff <= 0.0) { + if (constrBack.TransDiff <= 0.0) { // Back surface is opaque interior or exterior wall // Interior solar absorptance of opaque surface @@ -7434,9 +7431,9 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) if (NOT_SHADED(ShadeFlagBack)) { for (int Lay = 1; Lay <= NBackGlass; ++Lay) { state.dataSolarShading->SurfWinAbsBeam(Lay) = - POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).AbsBeamBackCoef(Lay)); + Window::POLYF(CosIncBack, constrBack.AbsBeamBackCoef(Lay)); } - TransBeamWin = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).TransSolBeamCoef); + TransBeamWin = Window::POLYF(CosIncBack, constrBack.TransSolBeamCoef); } // Interior beam absorptance of glass layers and beam transmittance @@ -7444,9 +7441,9 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) if (ANY_SHADE(ShadeFlagBack)) { for (int Lay = 1; Lay <= state.dataConstruction->Construct(ConstrNumBackSh).TotGlassLayers; ++Lay) { state.dataSolarShading->SurfWinAbsBeam(Lay) = - POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBackSh).AbsBeamBackCoef(Lay)); + Window::POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBackSh).AbsBeamBackCoef(Lay)); } - TransBeamWin = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBackSh).TransSolBeamCoef); + TransBeamWin = Window::POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBackSh).TransSolBeamCoef); } // Interior beam absorbed by INTERIOR SHADE of back exterior window @@ -7459,15 +7456,14 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // Interior beam absorbed by EXTERIOR SHADE of back exterior window } else if (ShadeFlagBack == WinShadingType::ExtShade) { - Real64 RGlFront = state.dataConstruction->Construct(ConstrNumBack).ReflectSolDiffFront; + Real64 RGlFront = constrBack.ReflectSolDiffFront; auto const *matSh = s_mat->materials(state.dataConstruction->Construct(ConstrNumBackSh).LayerPoint(1)); auto const *matFenSh = dynamic_cast(matSh); assert(matFenSh != nullptr); Real64 AbsSh = matFenSh->AbsorpSolar; Real64 RhoSh = 1.0 - AbsSh - matFenSh->Trans; - Real64 AShBack = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).TransSolBeamCoef) * AbsSh / - (1.0 - RGlFront * RhoSh); + Real64 AShBack = Window::POLYF(CosIncBack, constrBack.TransSolBeamCoef) * AbsSh / (1.0 - RGlFront * RhoSh); BABSZone += BOverlap * AShBack; backSurfBeamSolInTrans += BOverlap * AShBack; state.dataSolarShading->SurfWinIntBeamAbsByShadFac(BackSurfNum) = @@ -7475,11 +7471,11 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // Interior beam absorbed by BETWEEN-GLASS SHADE of back exterior window } else if (ShadeFlagBack == WinShadingType::BGShade) { - Real64 rbd1k = state.dataConstruction->Construct(ConstrNumBack).rbBareSolDiff(1); - Real64 rfd2k = state.dataConstruction->Construct(ConstrNumBack).rfBareSolDiff(2); + Real64 rbd1k = constrBack.rbBareSolDiff(1); + Real64 rfd2k = constrBack.rfBareSolDiff(2); Real64 AShBack; // System shade absorptance for interior beam solar if (NBackGlass == 2) { - Real64 t2k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).tBareSolCoef(2)); + Real64 t2k = Window::POLYF(CosIncBack, constrBack.tBareSolCoef(2)); auto const *matShade = dynamic_cast( s_mat->materials(state.dataConstruction->Construct(ConstrNumBackSh).LayerPoint(3))); assert(matShade != nullptr); @@ -7488,10 +7484,10 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 AbsSh = min(1.0, max(0.0, 1 - TrSh - RhoSh)); // Shade material solar absorptance AShBack = t2k * (1 + RhoSh * rfd2k + TrSh * rbd1k) * AbsSh; } else { // NBackGlass = 3 - Real64 t3k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).tBareSolCoef(3)); - Real64 td2k = state.dataConstruction->Construct(ConstrNumBack).tBareSolDiff(2); - Real64 rbd2k = state.dataConstruction->Construct(ConstrNumBack).rbBareSolDiff(2); - Real64 rfd3k = state.dataConstruction->Construct(ConstrNumBack).rfBareSolDiff(3); + Real64 t3k = Window::POLYF(CosIncBack, constrBack.tBareSolCoef(3)); + Real64 td2k = constrBack.tBareSolDiff(2); + Real64 rbd2k = constrBack.rbBareSolDiff(2); + Real64 rfd3k = constrBack.rfBareSolDiff(3); auto const *matShade = dynamic_cast( s_mat->materials(state.dataConstruction->Construct(ConstrNumBackSh).LayerPoint(5))); assert(matShade != nullptr); @@ -7521,7 +7517,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) int profIdxHiBack = surfShadeBack.blind.profAngIdxHi; Real64 profInterpFacBack = surfShadeBack.blind.profAngInterpFac; - Real64 TGlBmBack = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).TransSolBeamCoef); + Real64 TGlBmBack = Window::POLYF(CosIncBack, constrBack.TransSolBeamCoef); Real64 TBlBmBmBack = matBlindBack->BeamBeamTrans(profAngBack, Constant::Pi - slatAngBack); // Blind solar back beam-diffuse transmittance @@ -7541,17 +7537,11 @@ 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 = POLYF(CosIncBack, - state.dataConstruction->Construct(ConstrNumBack) - .ReflSolBeamBackCoef); // Glazing system back diffuse solar reflectance - Real64 RGlDiffBack = state.dataConstruction->Construct(ConstrNumBack).ReflectSolDiffBack; + 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 = - POLYF(CosIncBack, - state.dataConstruction->Construct(ConstrNumBack) - .AbsBeamBackCoef(Lay)); // Factor for back beam radiation absorbed in window glass layer - Real64 AGlDiffBack = state.dataConstruction->Construct(ConstrNumBack) - .AbsDiffBack(Lay); // Glass layer back diffuse solar absorptance + 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 / (1.0 - RGlDiffBack * RhoBlDiffFront)); @@ -7559,7 +7549,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // Interior beam transmitted by exterior back window with INTERIOR BLIND Real64 TGlDif = - state.dataConstruction->Construct(ConstrNumBack).TransDiff; // Bare diffuse transmittance of back window + constrBack.TransDiff; // Bare diffuse transmittance of back window TransBeamWin = TBlBmBmBack * (TGlBmBack + TGlDif * RGlBack * RhoBlFront / (1.0 - RGlDiffBack * RhoBlDiffFront)) + TBlBmDiffBack * TGlDif / (1.0 - RGlDiffBack * RhoBlDiffFront); @@ -7592,9 +7582,8 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Interp(btar.Sol.Bk.Bm[profIdxLoBack].Abs, btar.Sol.Bk.Bm[profIdxHiBack].Abs, profInterpFacBack); for (int Lay = 1; Lay <= NBackGlass; ++Lay) { - Real64 AbWinBack = - POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).AbsBeamBackCoef(Lay)); - Real64 AGlDiffFront = state.dataConstruction->Construct(ConstrNumBack).AbsDiff(Lay); + Real64 AbWinBack = Window::POLYF(CosIncBack, constrBack.AbsBeamBackCoef(Lay)); + Real64 AGlDiffFront = constrBack.AbsDiff(Lay); state.dataSolarShading->SurfWinAbsBeam(Lay) = AbWinBack + (TGlBmBack * AGlDiffFront * RhoBlBack / (1.0 - RhoBlBack * RGlDiffFront)); } @@ -7616,21 +7605,21 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) } else { // ShadeFlagBack == BGBlindOn - Real64 t1k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).tBareSolCoef(1)); - Real64 t2k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).tBareSolCoef(2)); - Real64 af2k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).afBareSolCoef(2)); - Real64 ab1k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).abBareSolCoef(1)); - Real64 ab2k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).abBareSolCoef(2)); - Real64 rb1k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).rbBareSolCoef(1)); - Real64 rb2k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).rbBareSolCoef(2)); - Real64 td1k = state.dataConstruction->Construct(ConstrNumBack).tBareSolDiff(1); - Real64 td2k = state.dataConstruction->Construct(ConstrNumBack).tBareSolDiff(2); - Real64 afd2k = state.dataConstruction->Construct(ConstrNumBack).afBareSolDiff(2); - Real64 abd1k = state.dataConstruction->Construct(ConstrNumBack).abBareSolDiff(1); - Real64 abd2k = state.dataConstruction->Construct(ConstrNumBack).abBareSolDiff(2); - Real64 rfd2k = state.dataConstruction->Construct(ConstrNumBack).rfBareSolDiff(2); - Real64 rbd1k = state.dataConstruction->Construct(ConstrNumBack).rbBareSolDiff(1); - Real64 rbd2k = state.dataConstruction->Construct(ConstrNumBack).rbBareSolDiff(2); + Real64 t1k = Window::POLYF(CosIncBack, constrBack.tBareSolCoef(1)); + Real64 t2k = Window::POLYF(CosIncBack, constrBack.tBareSolCoef(2)); + Real64 af2k = Window::POLYF(CosIncBack, constrBack.afBareSolCoef(2)); + Real64 ab1k = Window::POLYF(CosIncBack, constrBack.abBareSolCoef(1)); + Real64 ab2k = Window::POLYF(CosIncBack, constrBack.abBareSolCoef(2)); + Real64 rb1k = Window::POLYF(CosIncBack, constrBack.rbBareSolCoef(1)); + Real64 rb2k = Window::POLYF(CosIncBack, constrBack.rbBareSolCoef(2)); + Real64 td1k = constrBack.tBareSolDiff(1); + Real64 td2k = constrBack.tBareSolDiff(2); + Real64 afd2k = constrBack.afBareSolDiff(2); + Real64 abd1k = constrBack.abBareSolDiff(1); + Real64 abd2k = constrBack.abBareSolDiff(2); + Real64 rfd2k = constrBack.rfBareSolDiff(2); + Real64 rbd1k = constrBack.rbBareSolDiff(1); + Real64 rbd2k = constrBack.rbBareSolDiff(2); Real64 tfshBBk = matBlindBack->BeamBeamTrans(profAngBack, slatAngBack); Real64 tbshBBk = matBlindBack->BeamBeamTrans(profAngBack, Constant::Pi - slatAngBack); @@ -7668,11 +7657,11 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) // Interior beam absorbed by BLIND on exterior back window with BETWEEN-GLASS BLIND ABlBack = t2k * (abshBk + tbshBBk * rb1k * afshBk + rbshBk * rfd2k * abshdk + tbshBdk * rbd1k * afshdk); } else { // NBackGlass = 3 - Real64 t3k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).tBareSolCoef(3)); - Real64 af3k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).afBareSolCoef(3)); - Real64 ab3k = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).abBareSolCoef(3)); - Real64 afd3k = state.dataConstruction->Construct(ConstrNumBack).afBareSolDiff(3); - Real64 rfd3k = state.dataConstruction->Construct(ConstrNumBack).rfBareSolDiff(3); + Real64 t3k = Window::POLYF(CosIncBack, constrBack.tBareSolCoef(3)); + Real64 af3k = Window::POLYF(CosIncBack, constrBack.afBareSolCoef(3)); + Real64 ab3k = Window::POLYF(CosIncBack, constrBack.abBareSolCoef(3)); + Real64 afd3k = constrBack.afBareSolDiff(3); + Real64 rfd3k = constrBack.rfBareSolDiff(3); state.dataSolarShading->SurfWinAbsBeam(3) = ab3k + t3k * tbshBBk * (rb2k + t2k * rb1k * t2k) * tfshBBk * af3k + t3k * @@ -7705,8 +7694,8 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) } else if (ShadeFlagBack == WinShadingType::ExtScreen) { // Interior beam absorptance of GLASS LAYERS of exterior back window with EXTERIOR SCREEN - Real64 TGlBmBack = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).TransSolBeamCoef); - Real64 RGlDiffFront = state.dataConstruction->Construct(ConstrNumBack).ReflectSolDiffFront; + Real64 TGlBmBack = Window::POLYF(CosIncBack, constrBack.TransSolBeamCoef); + Real64 RGlDiffFront = constrBack.ReflectSolDiffFront; auto const *screen = dynamic_cast(s_mat->materials(ScNum)); assert(screen != nullptr); @@ -7735,8 +7724,8 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 RScBack = BilinearInterp(b11.RefSolFront, b12.RefSolFront, b21.RefSolFront, b22.RefSolFront, coeffs); Real64 RScDifBack = screen->DfRef; for (int Lay = 1; Lay <= NBackGlass; ++Lay) { - Real64 AbWinBack = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).AbsBeamBackCoef(Lay)); - Real64 AGlDiffFront = state.dataConstruction->Construct(ConstrNumBack).AbsDiff(Lay); + Real64 AbWinBack = Window::POLYF(CosIncBack, constrBack.AbsBeamBackCoef(Lay)); + Real64 AGlDiffFront = constrBack.AbsDiff(Lay); state.dataSolarShading->SurfWinAbsBeam(Lay) = AbWinBack + (TGlBmBack * AGlDiffFront * RScBack / (1.0 - RScDifBack * RGlDiffFront)); } @@ -7770,8 +7759,8 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) Real64 RScBack = btar.RefSolFront; Real64 RScDifBack = screen->DfRef; for (int Lay = 1; Lay <= NBackGlass; ++Lay) { - Real64 AbWinBack = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBack).AbsBeamBackCoef(Lay)); - Real64 AGlDiffFront = state.dataConstruction->Construct(ConstrNumBack).AbsDiff(Lay); + Real64 AbWinBack = Window::POLYF(CosIncBack, constrBack.AbsBeamBackCoef(Lay)); + Real64 AGlDiffFront = constrBack.AbsDiff(Lay); state.dataSolarShading->SurfWinAbsBeam(Lay) = AbWinBack + (TGlBmBack * AGlDiffFront * RScBack / (1.0 - RScDifBack * RGlDiffFront)); } @@ -7804,12 +7793,12 @@ 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 = 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 = POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBackSh).TransSolBeamCoef); + Real64 TransBeamWinSh = Window::POLYF(CosIncBack, state.dataConstruction->Construct(ConstrNumBackSh).TransSolBeamCoef); TransBeamWin = Window::InterpSw(SwitchFac, TransBeamWin, TransBeamWinSh); } @@ -7899,6 +7888,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) for (int IBack = 1; IBack <= NBkSurf; ++IBack) { int BackSurfaceNumber = state.dataShadowComb->ShadowComb(BaseSurf).BackSurf(IBack); int ConstrNumBack = s_surf->Surface(BackSurfaceNumber).Construction; + auto const &constrBack = state.dataConstruction->Construct(ConstrNumBack); // Do not perform any calculation if surface is scheduled for incoming solar radiation int SurfSolIncPtr = SurfaceScheduledSolarInc(state, BackSurfaceNumber, ConstrNumBack); @@ -7950,14 +7940,14 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) babs * state.dataEnvrn->BeamSolarRad; //[W] // Absorptance from current back direction - int TotSolidLay = state.dataConstruction->Construct(ConstrNumBack).TotSolidLayers; + int TotSolidLay = constrBack.TotSolidLayers; for (int Lay = 1; Lay <= TotSolidLay; ++Lay) { // IF (ALLOCATED(Construct(ConstrNumBack)%BSDFInput)) THEN // CFDirBoverlap is energy transmitted for current basis beam. It is important to note that // 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) += - state.dataConstruction->Construct(ConstrNumBack).BSDFInput.Layer(Lay).BkAbs(bestBackTrn, 1) * + constrBack.BSDFInput.Layer(Lay).BkAbs(bestBackTrn, 1) * CFDirBoverlap(IBack, CurTrnDir) / s_surf->Surface(BackSurfaceNumber).Area; // END IF } @@ -7984,9 +7974,9 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) } } } else { - if (state.dataConstruction->Construct(ConstrNumBack).TransDiff <= 0.0) { + if (constrBack.TransDiff <= 0.0) { // Do not take into account this window if it is scheduled for surface gains - Real64 AbsIntSurf = state.dataConstruction->Construct(ConstrNumBack).InsideAbsorpSolar; + Real64 AbsIntSurf = constrBack.InsideAbsorpSolar; s_surf->SurfOpaqAI(BackSurfaceNumber) += CFBoverlap(IBack) * AbsIntSurf / s_surf->Surface(BackSurfaceNumber).Area; BABSZone += CFBoverlap(IBack) * AbsIntSurf; @@ -8011,7 +8001,8 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) if (s_surf->SurfWinWindowModelType(IBack) != WindowModel::EQL) continue; // only EQL back window is allowed int ConstrNumBack = s_surf->Surface(BackSurfNum).Construction; - int NBackGlass = state.dataConstruction->Construct(ConstrNumBack).TotGlassLayers; + auto const &constrBack = state.dataConstruction->Construct(ConstrNumBack); + int NBackGlass = constrBack.TotGlassLayers; // Irradiated (overlap) area for this back surface, projected onto window plane // (includes effect of shadowing on exterior window) @@ -8019,7 +8010,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) state.dataHeatBal->SurfWinOverlapAreas(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, IBack, SurfNum); Real64 BOverlap = TBm * AOverlap * CosInc; //[m2] - if (state.dataConstruction->Construct(ConstrNumBack).TransDiff <= 0.0) { + if (constrBack.TransDiff <= 0.0) { // Back surface is opaque interior or exterior wall Real64 AbsIntSurf = state.dataHeatBalSurf->SurfAbsSolarInt(BackSurfNum); @@ -8045,7 +8036,7 @@ void CalcInteriorSolarDistribution(EnergyPlusData &state) WindowEquivalentLayer::CalcEQLOpticalProperty( state, BackSurfNum, SolarArrays::BEAM, state.dataSolarShading->SurfWinAbsSolBeamBackEQL); auto &CFS = state.dataWindowEquivLayer->CFS; - int EQLNum = state.dataConstruction->Construct(ConstrNumBack).EQLConsPtr; + int EQLNum = constrBack.EQLConsPtr; state.dataSolarShading->SurfWinAbsBeamEQL({1, CFS(EQLNum).NL}) = state.dataSolarShading->SurfWinAbsSolBeamBackEQL(1, {1, CFS(EQLNum).NL}); // get the interior beam transmitted through back exterior or interior EQL window @@ -8594,13 +8585,14 @@ void CalcInteriorSolarDistributionWCESimple(EnergyPlusData &state) if (BackSurfNum == 0) break; // No more irradiated back surfaces for this exterior window int ConstrNumBack = s_surf->Surface(BackSurfNum).Construction; + auto const &constrBack = state.dataConstruction->Construct(ConstrNumBack); // NBackGlass = Construct( ConstrNumBack ).TotGlassLayers; // Irradiated (overlap) area for this back surface, projected onto window plane // (includes effect of shadowing on exterior window) Real64 AOverlap = state.dataHeatBal->SurfWinOverlapAreas(state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep, IBack, SurfNum); Real64 BOverlap = TBm * AOverlap * CosInc; //[m2] - if (state.dataConstruction->Construct(ConstrNumBack).TransDiff <= 0.0) { + if (constrBack.TransDiff <= 0.0) { // Back surface is opaque interior or exterior wall Real64 AbsIntSurf = state.dataHeatBalSurf->SurfAbsSolarInt(BackSurfNum); diff --git a/src/EnergyPlus/WindowManager.hh b/src/EnergyPlus/WindowManager.hh index eb5ab78a01f..988f50a4865 100644 --- a/src/EnergyPlus/WindowManager.hh +++ b/src/EnergyPlus/WindowManager.hh @@ -240,6 +240,7 @@ namespace Window { 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 constexpr Real64 POLYF(Real64 const X, // Cosine of angle of incidence Array1D const &A // Polynomial coefficients ) @@ -250,7 +251,8 @@ namespace Window { return X * (A(1) + X * (A(2) + X * (A(3) + X * (A(4) + X * (A(5) + X * A(6)))))); } } - +#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) From a4c65416777bdf957ce9461310f9dbac7213e57b Mon Sep 17 00:00:00 2001 From: Dareum Nam Date: Mon, 30 Dec 2024 00:09:00 -0700 Subject: [PATCH 6/8] 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? From a395dd55fa1f4f2a509cb4deddb42e5d1406374b Mon Sep 17 00:00:00 2001 From: Edwin Lee Date: Mon, 30 Dec 2024 09:58:32 -0600 Subject: [PATCH 7/8] Add upterm to test pr yaml --- .github/workflows/test_pull_requests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test_pull_requests.yml b/.github/workflows/test_pull_requests.yml index 153b38d8f89..83e0ae8dd98 100644 --- a/.github/workflows/test_pull_requests.yml +++ b/.github/workflows/test_pull_requests.yml @@ -200,6 +200,8 @@ jobs: const script = require('${{ github.workspace }}/regressions/summary.js') console.log(script({github, context})) + - uses: lhotari/action-upterm@v1 + - name: Fail on Regressions from Forked Repository if: always() && matrix.run_regressions && steps.regressions.outcome == 'failure' && github.event.pull_request.head.repo.full_name != 'NREL/EnergyPlus' run: | From 7494ea61fc592d4fce4eec4179a78dd76fd853d1 Mon Sep 17 00:00:00 2001 From: Dareum Nam Date: Fri, 3 Jan 2025 22:33:02 -0700 Subject: [PATCH 8/8] clang format version 10.0 --- src/EnergyPlus/DaylightingManager.cc | 150 +++++++++++++-------------- src/EnergyPlus/HeatBalanceManager.cc | 2 +- src/EnergyPlus/SolarShading.cc | 38 +++---- src/EnergyPlus/WindowManager.cc | 28 ++--- src/EnergyPlus/WindowManager.hh | 16 +-- 5 files changed, 117 insertions(+), 117 deletions(-) diff --git a/src/EnergyPlus/DaylightingManager.cc b/src/EnergyPlus/DaylightingManager.cc index 3a2611f4510..d1c54d7262b 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 @@ -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 68247acb3e0..79c91b27d9f 100644 --- a/src/EnergyPlus/HeatBalanceManager.cc +++ b/src/EnergyPlus/HeatBalanceManager.cc @@ -1976,7 +1976,7 @@ namespace HeatBalanceManager { ErrorsFound = true; } } // Loop - } // ZoneNum + } // ZoneNum } } // ListNum diff --git a/src/EnergyPlus/SolarShading.cc b/src/EnergyPlus/SolarShading.cc index 7d99b653c13..fb2dab04c3f 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) { @@ -6786,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 @@ -7190,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 @@ -8120,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. @@ -8181,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 @@ -10142,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) @@ -10319,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 e1c9cd57bcd..f186f5f8684 100644 --- a/src/EnergyPlus/WindowManager.cc +++ b/src/EnergyPlus/WindowManager.cc @@ -1362,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) { @@ -1494,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); @@ -1784,7 +1784,7 @@ namespace Window { } } // End of wavelength loop - } // SystemSpectralPropertiesAtPhi() + } // SystemSpectralPropertiesAtPhi() //************************************************************************ @@ -4508,7 +4508,7 @@ namespace Window { dens = rhomix; } // End of check if single or multiple gases in gap - } // WindowGasPropertiesAtTemp() + } // WindowGasPropertiesAtTemp() //******************************************************************************** @@ -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 @@ -7775,7 +7775,7 @@ namespace Window { p(15) = max(0.0001, 1.0 - p(13) - BlindIRreflBack); } // End of IR properties calculation - } // BlindOpticsDiffuse() + } // BlindOpticsDiffuse() //********************************************************************************************** @@ -8010,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 0c39204751c..99ed3d75cc9 100644 --- a/src/EnergyPlus/WindowManager.hh +++ b/src/EnergyPlus/WindowManager.hh @@ -488,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