From 084d8f129cce46d572f50ea2c7b1ad94028b94a4 Mon Sep 17 00:00:00 2001 From: amirroth Date: Mon, 5 Aug 2024 20:24:07 -0400 Subject: [PATCH 1/3] Increase blind slat angle sampling frequency to five degrees --- src/EnergyPlus/Material.hh | 2 +- src/EnergyPlus/WindowManager.cc | 36 ++++++++++++++++++--------------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/EnergyPlus/Material.hh b/src/EnergyPlus/Material.hh index 74be89e784a..e4c802f0d7f 100644 --- a/src/EnergyPlus/Material.hh +++ b/src/EnergyPlus/Material.hh @@ -61,7 +61,7 @@ namespace EnergyPlus { namespace Material { - constexpr int MaxSlatAngs(19); + constexpr int MaxSlatAngs(37); constexpr int MaxProfAngs(37); // Parameters to indicate material group type for use with the Material diff --git a/src/EnergyPlus/WindowManager.cc b/src/EnergyPlus/WindowManager.cc index 1c7d5b5a6a1..45f391f9267 100644 --- a/src/EnergyPlus/WindowManager.cc +++ b/src/EnergyPlus/WindowManager.cc @@ -5833,7 +5833,7 @@ namespace Window { DPhi = 5.0 * Constant::DegToRadians; // Integrate from -90 to 0 deg - for (int IPhi = 1; IPhi <= 18; ++IPhi) { + for (int IPhi = 1; IPhi <= (Material::MaxProfAngs / 2); ++IPhi) { Phi = -Constant::PiOvr2 + (IPhi - 0.5) * DPhi; Sum += std::cos(Phi) * DPhi * InterpProfAng(Phi, Property); SumDenom += std::cos(Phi) * DPhi; @@ -5876,7 +5876,7 @@ namespace Window { DPhi = 5.0 * Constant::DegToRadians; // Integrate from 0 to 90 deg - for (int IPhi = 19; IPhi <= 36; ++IPhi) { + for (int IPhi = (Material::MaxProfAngs / 2) + 1; IPhi <= Material::MaxProfAngs - 1; ++IPhi) { Phi = -Constant::PiOvr2 + (IPhi - 0.5) * DPhi; Sum += std::cos(Phi) * DPhi * InterpProfAng(Phi, Property); SumDenom += std::cos(Phi) * DPhi; @@ -7461,7 +7461,7 @@ namespace Window { Array1D bld_pr(15); // Slat properties Array1D st_lay(16); // Solar-optical blind/glazing system properties Real64 sun_el; // Solar profile angle (radians) - Array1D sun_el_deg(37); // Solar profile angle (deg) corresponding to sun_el values + Array1D sun_el_deg(Material::MaxProfAngs); // Solar profile angle (deg) corresponding to sun_el values Real64 bld_el; // Slat angle (elevation of slat normal vector in plane // perpendicular to window and containing the slat normal vector) (radians) int IProfAng; // Profile angle index @@ -7538,7 +7538,7 @@ namespace Window { // If blind has variable slat angle, vary slat angle from 0 to 180 deg in 10-deg steps // (for Material::MaxSlatAngs = 19). If blind has fixed slat angle, calculate properties at that angle only. - for (int IProfAng = 1; IProfAng <= 37; ++IProfAng) { + for (int IProfAng = 1; IProfAng <= Material::MaxProfAngs; ++IProfAng) { sun_el = -Constant::Pi / 2.0 + (Constant::Pi / 36.0) * (IProfAng - 1); sun_el_deg(IProfAng) = 57.2958 * sun_el; @@ -7583,14 +7583,18 @@ namespace Window { if (ISolVis == 1) { for (int ISlatAng = 1; ISlatAng <= Material::MaxSlatAngs; ++ISlatAng) { - blind.SolFrontDiffDiffTransGnd(ISlatAng) = DiffuseAverageProfAngGnd(blind.SolFrontBeamBeamTrans(ISlatAng, {1, 37})) + - DiffuseAverageProfAngGnd(blind.SolFrontBeamDiffTrans(ISlatAng, {1, 37})); - blind.SolFrontDiffDiffTransSky(ISlatAng) = DiffuseAverageProfAngSky(blind.SolFrontBeamBeamTrans(ISlatAng, {1, 37})) + - DiffuseAverageProfAngSky(blind.SolFrontBeamDiffTrans(ISlatAng, {1, 37})); - blind.SolFrontDiffAbsGnd(ISlatAng) = DiffuseAverageProfAngGnd(blind.SolFrontBeamAbs(ISlatAng, {1, 37})); - blind.SolFrontDiffAbsSky(ISlatAng) = DiffuseAverageProfAngSky(blind.SolFrontBeamAbs(ISlatAng, {1, 37})); - blind.SolFrontDiffDiffReflGnd(ISlatAng) = DiffuseAverageProfAngGnd(blind.SolFrontBeamDiffRefl(ISlatAng, {1, 37})); - blind.SolFrontDiffDiffReflSky(ISlatAng) = DiffuseAverageProfAngSky(blind.SolFrontBeamDiffRefl(ISlatAng, {1, 37})); + blind.SolFrontDiffDiffTransGnd(ISlatAng) = + DiffuseAverageProfAngGnd(blind.SolFrontBeamBeamTrans(ISlatAng, {1, Material::MaxProfAngs})) + + DiffuseAverageProfAngGnd(blind.SolFrontBeamDiffTrans(ISlatAng, {1, Material::MaxProfAngs})); + blind.SolFrontDiffDiffTransSky(ISlatAng) = + DiffuseAverageProfAngSky(blind.SolFrontBeamBeamTrans(ISlatAng, {1, Material::MaxProfAngs})) + + DiffuseAverageProfAngSky(blind.SolFrontBeamDiffTrans(ISlatAng, {1, Material::MaxProfAngs})); + blind.SolFrontDiffAbsGnd(ISlatAng) = DiffuseAverageProfAngGnd(blind.SolFrontBeamAbs(ISlatAng, {1, Material::MaxProfAngs})); + blind.SolFrontDiffAbsSky(ISlatAng) = DiffuseAverageProfAngSky(blind.SolFrontBeamAbs(ISlatAng, {1, Material::MaxProfAngs})); + blind.SolFrontDiffDiffReflGnd(ISlatAng) = + DiffuseAverageProfAngGnd(blind.SolFrontBeamDiffRefl(ISlatAng, {1, Material::MaxProfAngs})); + blind.SolFrontDiffDiffReflSky(ISlatAng) = + DiffuseAverageProfAngSky(blind.SolFrontBeamDiffRefl(ISlatAng, {1, Material::MaxProfAngs})); // TH 2/17/2010. Added. Loop only for movable slat blinds if (blind.SlatAngleType == DataWindowEquivalentLayer::AngleType::Fixed) break; @@ -8485,7 +8489,7 @@ namespace Window { // Linear interpolation. // Argument array dimensioning - PropArray.dim(Material::MaxSlatAngs, 37); + PropArray.dim(Material::MaxSlatAngs, Material::MaxProfAngs); Real64 SlatAng1 = std::clamp(SlatAng, 0.0, Constant::Pi); @@ -8505,14 +8509,14 @@ namespace Window { Real64 SlatAngRatio = (SlatAng1 - (IBeta - 1) * DeltaSlatAng) / DeltaSlatAng; // Slat angle interpolation factor Val1 = PropArray(IBeta, IAlpha); // Property values at points enclosing the given ProfAngle and SlatAngle Val2 = PropArray(min(Material::MaxSlatAngs, IBeta + 1), IAlpha); - Real64 Val3 = PropArray(IBeta, min(37, IAlpha + 1)); - Real64 Val4 = PropArray(min(Material::MaxSlatAngs, IBeta + 1), min(37, IAlpha + 1)); + Real64 Val3 = PropArray(IBeta, min(Material::MaxProfAngs, IAlpha + 1)); + Real64 Val4 = PropArray(min(Material::MaxSlatAngs, IBeta + 1), min(Material::MaxProfAngs, IAlpha + 1)); Real64 ValA = Val1 + SlatAngRatio * (Val2 - Val1); // Property values at given SlatAngle to be interpolated in profile angle Real64 ValB = Val3 + SlatAngRatio * (Val4 - Val3); return ValA + ProfAngRatio * (ValB - ValA); } else { // Fixed-angle slats: interpolate only in profile angle Val1 = PropArray(1, IAlpha); - Val2 = PropArray(1, min(37, IAlpha + 1)); + Val2 = PropArray(1, min(Material::MaxProfAngs, IAlpha + 1)); return Val1 + ProfAngRatio * (Val2 - Val1); } } // InterpProfSlatAng() From 7c8c9eb0cf0f1d1777874d11590bdafb2f91d65e Mon Sep 17 00:00:00 2001 From: amirroth Date: Tue, 6 Aug 2024 16:34:33 -0400 Subject: [PATCH 2/3] Sample blind properties at 1 degree slat angle increments --- src/EnergyPlus/Material.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EnergyPlus/Material.hh b/src/EnergyPlus/Material.hh index e4c802f0d7f..54db2988aef 100644 --- a/src/EnergyPlus/Material.hh +++ b/src/EnergyPlus/Material.hh @@ -61,7 +61,7 @@ namespace EnergyPlus { namespace Material { - constexpr int MaxSlatAngs(37); + constexpr int MaxSlatAngs(181); // 1 degree increments for slat angles (We'll see what the performance implications are) constexpr int MaxProfAngs(37); // Parameters to indicate material group type for use with the Material From 96c479ec4e8102240edbceb086ba436165b8898e Mon Sep 17 00:00:00 2001 From: Edwin Lee Date: Mon, 19 Aug 2024 09:57:05 -0500 Subject: [PATCH 3/3] Clang format --- src/EnergyPlus/WindowManager.cc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/EnergyPlus/WindowManager.cc b/src/EnergyPlus/WindowManager.cc index 45f391f9267..ba62fe8f54e 100644 --- a/src/EnergyPlus/WindowManager.cc +++ b/src/EnergyPlus/WindowManager.cc @@ -7458,11 +7458,11 @@ namespace Window { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - Array1D bld_pr(15); // Slat properties - Array1D st_lay(16); // Solar-optical blind/glazing system properties - Real64 sun_el; // Solar profile angle (radians) + Array1D bld_pr(15); // Slat properties + Array1D st_lay(16); // Solar-optical blind/glazing system properties + Real64 sun_el; // Solar profile angle (radians) Array1D sun_el_deg(Material::MaxProfAngs); // Solar profile angle (deg) corresponding to sun_el values - Real64 bld_el; // Slat angle (elevation of slat normal vector in plane + Real64 bld_el; // Slat angle (elevation of slat normal vector in plane // perpendicular to window and containing the slat normal vector) (radians) int IProfAng; // Profile angle index @@ -7584,17 +7584,17 @@ namespace Window { if (ISolVis == 1) { for (int ISlatAng = 1; ISlatAng <= Material::MaxSlatAngs; ++ISlatAng) { blind.SolFrontDiffDiffTransGnd(ISlatAng) = - DiffuseAverageProfAngGnd(blind.SolFrontBeamBeamTrans(ISlatAng, {1, Material::MaxProfAngs})) + - DiffuseAverageProfAngGnd(blind.SolFrontBeamDiffTrans(ISlatAng, {1, Material::MaxProfAngs})); + DiffuseAverageProfAngGnd(blind.SolFrontBeamBeamTrans(ISlatAng, {1, Material::MaxProfAngs})) + + DiffuseAverageProfAngGnd(blind.SolFrontBeamDiffTrans(ISlatAng, {1, Material::MaxProfAngs})); blind.SolFrontDiffDiffTransSky(ISlatAng) = - DiffuseAverageProfAngSky(blind.SolFrontBeamBeamTrans(ISlatAng, {1, Material::MaxProfAngs})) + - DiffuseAverageProfAngSky(blind.SolFrontBeamDiffTrans(ISlatAng, {1, Material::MaxProfAngs})); + DiffuseAverageProfAngSky(blind.SolFrontBeamBeamTrans(ISlatAng, {1, Material::MaxProfAngs})) + + DiffuseAverageProfAngSky(blind.SolFrontBeamDiffTrans(ISlatAng, {1, Material::MaxProfAngs})); blind.SolFrontDiffAbsGnd(ISlatAng) = DiffuseAverageProfAngGnd(blind.SolFrontBeamAbs(ISlatAng, {1, Material::MaxProfAngs})); blind.SolFrontDiffAbsSky(ISlatAng) = DiffuseAverageProfAngSky(blind.SolFrontBeamAbs(ISlatAng, {1, Material::MaxProfAngs})); blind.SolFrontDiffDiffReflGnd(ISlatAng) = - DiffuseAverageProfAngGnd(blind.SolFrontBeamDiffRefl(ISlatAng, {1, Material::MaxProfAngs})); + DiffuseAverageProfAngGnd(blind.SolFrontBeamDiffRefl(ISlatAng, {1, Material::MaxProfAngs})); blind.SolFrontDiffDiffReflSky(ISlatAng) = - DiffuseAverageProfAngSky(blind.SolFrontBeamDiffRefl(ISlatAng, {1, Material::MaxProfAngs})); + DiffuseAverageProfAngSky(blind.SolFrontBeamDiffRefl(ISlatAng, {1, Material::MaxProfAngs})); // TH 2/17/2010. Added. Loop only for movable slat blinds if (blind.SlatAngleType == DataWindowEquivalentLayer::AngleType::Fixed) break;