Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storm window refactoring #8674

Merged
merged 22 commits into from
Apr 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
163a0f6
first commit
xuanluo113 Mar 25, 2021
4c7aa04
Merge branch 'develop' of https://github.com/NREL/EnergyPlus into sto…
xuanluo113 Mar 25, 2021
44c94f9
merge
xuanluo113 Mar 27, 2021
22f6feb
Merge branch 'develop' of https://github.com/NREL/EnergyPlus into sto…
xuanluo113 Mar 27, 2021
9251598
Merge branch 'develop' of https://github.com/NREL/EnergyPlus into sto…
xuanluo113 Mar 30, 2021
5c2d907
fix unit test
xuanluo113 Mar 30, 2021
73b32ee
Merge branch 'develop' of https://github.com/NREL/EnergyPlus into sto…
xuanluo113 Mar 30, 2021
9566745
merge
xuanluo113 Mar 31, 2021
469382e
fix merge
xuanluo113 Mar 31, 2021
6334396
fix merge issue
xuanluo113 Apr 1, 2021
e231610
Merge branch 'develop' of https://github.com/NREL/EnergyPlus into sto…
xuanluo113 Apr 8, 2021
320f855
address comments
xuanluo113 Apr 9, 2021
7c9e20c
Merge branch 'develop' of https://github.com/NREL/EnergyPlus into sto…
xuanluo113 Apr 9, 2021
e511c3c
modified a comment
xuanluo113 Apr 9, 2021
d5da8dd
remove an unused variable
xuanluo113 Apr 9, 2021
592fc22
Merge remote-tracking branch 'remotes/NRELEnergyPlus/develop' into st…
mjwitte Apr 10, 2021
cf2d46a
fix an initialization performance issue
xuanluo113 Apr 13, 2021
20aeb71
Merge branch 'develop' of https://github.com/NREL/EnergyPlus into sto…
xuanluo113 Apr 13, 2021
852f095
fix ems
xuanluo113 Apr 13, 2021
abd259f
Merge branch 'develop' of https://github.com/NREL/EnergyPlus into sto…
xuanluo113 Apr 13, 2021
80defad
Merge branch 'develop' of https://github.com/NREL/EnergyPlus into sto…
xuanluo113 Apr 14, 2021
133624f
dependency on reset construction
xuanluo113 Apr 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/EnergyPlus/DataSurfaces.hh
Original file line number Diff line number Diff line change
Expand Up @@ -678,8 +678,6 @@ namespace DataSurfaces {
int activeShadedConstruction; // The currently active shaded construction (windows only)
std::vector<int> shadedConstructionList; // List of shaded constructions that correspond with window shading controls (windows only - same
// indexes as windowShadingControlList)
int StormWinConstruction; // Construction with storm window (windows only)
int activeStormWinShadedConstruction; // The currently active shaded construction with storm window (windows only)
std::vector<int> shadedStormWinConstructionList; // List of shaded constructions with storm window that correspond with window shading
// controls (windows only - same indexes as windowShadingControlList)
int FrameDivider; // Pointer to frame and divider information (windows only)
Expand Down Expand Up @@ -775,9 +773,8 @@ namespace DataSurfaces {
Centroid(0.0, 0.0, 0.0), lcsx(0.0, 0.0, 0.0), lcsy(0.0, 0.0, 0.0), lcsz(0.0, 0.0, 0.0), NewellAreaVector(0.0, 0.0, 0.0),
NewellSurfaceNormalVector(0.0, 0.0, 0.0), OutNormVec(3, 0.0), SinAzim(0.0), CosAzim(0.0), SinTilt(0.0), CosTilt(0.0), IsConvex(true),
IsDegenerate(false), VerticesProcessed(false), XShift(0.0), YShift(0.0), shapeCat(ShapeCat::Unknown), plane(0.0, 0.0, 0.0, 0.0),
activeWindowShadingControl(0), HasShadeControl(false), activeShadedConstruction(0), StormWinConstruction(0),
activeStormWinShadedConstruction(0), FrameDivider(0), Multiplier(1.0), Shelf(0), TAirRef(ZoneMeanAirTemp), OutDryBulbTemp(0.0),
OutDryBulbTempEMSOverrideOn(false), OutDryBulbTempEMSOverrideValue(0.0), OutWetBulbTemp(0.0), OutWetBulbTempEMSOverrideOn(false),
activeWindowShadingControl(0), HasShadeControl(false), activeShadedConstruction(0), FrameDivider(0), Multiplier(1.0), Shelf(0), TAirRef(ZoneMeanAirTemp),
OutDryBulbTemp(0.0), OutDryBulbTempEMSOverrideOn(false), OutDryBulbTempEMSOverrideValue(0.0), OutWetBulbTemp(0.0), OutWetBulbTempEMSOverrideOn(false),
OutWetBulbTempEMSOverrideValue(0.0), WindSpeed(0.0), WindSpeedEMSOverrideOn(false), WindSpeedEMSOverrideValue(0.0),
ViewFactorGroundEMSOverrideOn(false), ViewFactorGroundEMSOverrideValue(0.0),

Expand Down Expand Up @@ -1584,6 +1581,9 @@ struct SurfacesData : BaseGlobalStruct
Array1D<Real64> SurfWinSpecTemp; // The specification temperature of the TC layer glass Added for W6 integration June 2010
Array1D<Real64> SurfWinWindowModelType; // if set to WindowBSDFModel, then uses BSDF methods
Array1D<Real64> SurfWinTDDPipeNum; // Tubular daylighting device pipe number for TDD domes and diffusers
Array1D<int> SurfWinStormWinConstr; // Construction with storm window (windows only)
Array1D<int> SurfActiveConstruction; // The currently active construction with or without storm window
Array1D<int> SurfWinActiveShadedConstruction; // The currently active shaded construction with or without storm window (windows only)

bool AnyHeatBalanceInsideSourceTerm = false; // True if any SurfaceProperty:HeatBalanceSourceTerm inside face used
bool AnyHeatBalanceOutsideSourceTerm = false; // True if any SurfaceProperty:HeatBalanceSourceTerm outside face used
Expand Down Expand Up @@ -1852,6 +1852,9 @@ struct SurfacesData : BaseGlobalStruct
this->SurfWinSpecTemp.deallocate();
this->SurfWinWindowModelType.deallocate();
this->SurfWinTDDPipeNum.deallocate();
this->SurfWinStormWinConstr.deallocate();
this->SurfActiveConstruction.deallocate();
this->SurfWinActiveShadedConstruction.deallocate();
this->AnyHeatBalanceInsideSourceTerm = false;
this->AnyHeatBalanceOutsideSourceTerm = false;
this->Surface.deallocate();
Expand Down
1 change: 1 addition & 0 deletions src/EnergyPlus/DaylightingDevices.cc
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,7 @@ namespace DaylightingDevices {
state.dataSurface->Surface(SurfNum).BaseSurf = SurfNum;
state.dataSurface->Surface(SurfNum).HeatTransSurf = true;
state.dataSurface->Surface(SurfNum).Construction = ConstrNum; // Kludge to allow shading surface to be a heat transfer surface
state.dataSurface->SurfActiveConstruction(SurfNum) = ConstrNum;
state.dataConstruction->Construct(ConstrNum).IsUsed = true;
}
}
Expand Down
47 changes: 15 additions & 32 deletions src/EnergyPlus/DaylightingManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1737,8 +1737,7 @@ void FigureDayltgCoeffsAtPointsSetupForWindow(
ExtWinType = DataDaylighting::iExtWinType::AdjZoneExtWin;
}

IConst = state.dataSurface->Surface(IWin).Construction;
if (state.dataSurface->SurfWinStormWinFlag(IWin) == 1) IConst = state.dataSurface->Surface(IWin).StormWinConstruction;
IConst = state.dataSurface->SurfActiveConstruction(IWin);

// For thermochromic windows, the daylight and glare factors are calculated for a base window cosntruction
// at base TC layer temperature. During each time step calculations at DayltgInteriorIllum,
Expand Down Expand Up @@ -3105,7 +3104,6 @@ Real64 CalcObstrMultiplier(EnergyPlusData &state,
}
AltSteps_last = AltSteps;
}

// Tuned Precompute Theta trig table
if (AzimSteps != AzimSteps_last) {
for (int ITheta = 1; ITheta <= 2 * AzimSteps; ++ITheta) {
Expand Down Expand Up @@ -3274,7 +3272,6 @@ void FigureDayltgCoeffsAtPointsForSunPosition(
auto &HitPtIntWinDisk = state.dataDaylightingManager->HitPtIntWinDisk; // Intersection point on an interior window for ray from ref pt to sun (m)
Real64 Alfa; // Intermediate variables
bool hitObs; // True iff obstruction is hit
int ObsConstrNum; // Construction number of obstruction
Real64 ObsVisRefl; // Visible reflectance of obstruction
Real64 SkyReflVisLum; // Reflected sky luminance at hit point divided by

Expand All @@ -3291,7 +3288,6 @@ void FigureDayltgCoeffsAtPointsForSunPosition(
Real64 SpecReflectance; // Specular reflectance of a reflecting surface
Real64 TVisRefl; // Bare window vis trans for reflected beam
// (times light well efficiency, if appropriate)
int ConstrNumRefl; // Window construction number for a specularly reflecting shading surf
Real64 PHSUNrefl; // Altitude angle of reflected sun (radians)
Real64 THSUNrefl; // Azimuth anggle of reflected sun (radians)

Expand Down Expand Up @@ -3382,16 +3378,14 @@ void FigureDayltgCoeffsAtPointsForSunPosition(

// Sky solar reflected from nearest obstruction

ObsConstrNum = state.dataSurface->Surface(NearestHitSurfNum).Construction;
int const ObsConstrNum = state.dataSurface->SurfActiveConstruction(NearestHitSurfNum);
if (ObsConstrNum > 0) {
// Exterior building surface is nearest hit
if (!state.dataConstruction->Construct(ObsConstrNum).TypeIsWindow) {
// Obstruction is not a window, i.e., is an opaque surface
ObsVisRefl = 1.0 - state.dataMaterial->Material(state.dataConstruction->Construct(ObsConstrNum).LayerPoint(1)).AbsorpVisible;
} else {
// Obstruction is a window; assume it is bare
if (state.dataSurface->SurfWinStormWinFlag(NearestHitSurfNum) == 1)
ObsConstrNum = state.dataSurface->Surface(NearestHitSurfNum).StormWinConstruction;
ObsVisRefl = state.dataConstruction->Construct(ObsConstrNum).ReflectVisDiffFront;
}
} else {
Expand Down Expand Up @@ -3801,9 +3795,7 @@ void FigureDayltgCoeffsAtPointsForSunPosition(
SpecReflectance = 0.0;
CosIncAngRefl = std::abs(dot(RAYCOS, ReflNorm));
if (state.dataSurface->Surface(ReflSurfNum).Class == SurfaceClass::Window) {
ConstrNumRefl = state.dataSurface->Surface(ReflSurfNum).Construction;
if (state.dataSurface->SurfWinStormWinFlag(ReflSurfNum) == 1)
ConstrNumRefl = state.dataSurface->Surface(ReflSurfNum).StormWinConstruction;
int const ConstrNumRefl = state.dataSurface->SurfActiveConstruction(ReflSurfNum);
SpecReflectance =
POLYF(std::abs(CosIncAngRefl), state.dataConstruction->Construct(ConstrNumRefl).ReflSolBeamFrontCoef);
}
Expand Down Expand Up @@ -6189,8 +6181,6 @@ void DayltgInteriorIllum(EnergyPlusData &state, int &ZoneNum) // Zone number
int ISWFLG; // Switchable glazing flag: =1 if one or more windows in a zone
// has switchable glazing that adjusts visible transmittance to just meet
// daylighting setpoint; =0 otherwise.
int IConst; // Window construction pointer
int IConstShaded; // Pointer to shaded window construction
int ICtrl; // Window shading control pointer
Array1D<Real64> TVIS1(state.dataDaylightingData->ZoneDaylight(ZoneNum)
.ShadeDeployOrderExtWins.size()); // Visible transmittance at normal incidence of unswitched glazing
Expand Down Expand Up @@ -6277,7 +6267,7 @@ void DayltgInteriorIllum(EnergyPlusData &state, int &ZoneNum) // Zone number
// Added TH 6/29/2009 for thermochromic windows
VTRatio = 1.0;
if (NREFPT > 0) {
IConst = state.dataSurface->Surface(IWin).Construction;
int const IConst = state.dataSurface->Surface(IWin).Construction;
if (state.dataConstruction->Construct(IConst).TCFlag == 1) {
// For thermochromic windows, daylight and glare factors are always calculated
// based on the master construction. They need to be adjusted by the VTRatio, including:
Expand Down Expand Up @@ -6728,14 +6718,13 @@ void DayltgInteriorIllum(EnergyPlusData &state, int &ZoneNum) // Zone number
continue;
}

IConst = state.dataSurface->Surface(IWin).Construction;
if (state.dataSurface->SurfWinStormWinFlag(IWin) == 1) IConst = state.dataSurface->Surface(IWin).StormWinConstruction;
int const IConst = state.dataSurface->SurfActiveConstruction(IWin);
// Vis trans at normal incidence of unswitched glass
TVIS1(igroup) =
POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * state.dataSurface->SurfWinGlazedFrac(IWin);

// Vis trans at normal incidence of fully switched glass
IConstShaded = state.dataSurface->Surface(IWin).activeShadedConstruction;
int const IConstShaded = state.dataSurface->Surface(IWin).activeShadedConstruction;
TVIS2(igroup) =
POLYF(1.0, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * state.dataSurface->SurfWinGlazedFrac(IWin);

Expand Down Expand Up @@ -6919,13 +6908,13 @@ void DayltgInteriorIllum(EnergyPlusData &state, int &ZoneNum) // Zone number
tmpBackLumFromWinAtRefPt(loop, 2, IL);
}

IConst = state.dataSurface->Surface(IWin).Construction;
int const IConst = state.dataSurface->SurfActiveConstruction(IWin);
// Vis trans at normal incidence of unswitched glass
TVIS1(igroup) =
POLYF(1.0, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * state.dataSurface->SurfWinGlazedFrac(IWin);

// Vis trans at normal incidence of fully switched glass
IConstShaded = state.dataSurface->Surface(IWin).activeShadedConstruction;
int const IConstShaded = state.dataSurface->Surface(IWin).activeShadedConstruction;
TVIS2(igroup) =
POLYF(1.0, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) * state.dataSurface->SurfWinGlazedFrac(IWin);
}
Expand Down Expand Up @@ -7616,7 +7605,6 @@ void DayltgInterReflectedIllum(EnergyPlusData &state,
Real64 PhWin; // Altitude, azimuth angle of window normal (radians)
Real64 ThWin;
Real64 ACosTanTan; // ACOS(-TAN(Ph)*TAN(PhWin))
int IConst; // Construction pointer
Real64 DA; // CPH*DTH*DPH
Real64 COSB; // Cosine of angle of incidence of light from sky or ground
Real64 TVISBR; // Transmittance of window without shading at COSB
Expand All @@ -7628,7 +7616,6 @@ void DayltgInterReflectedIllum(EnergyPlusData &state,
// unused REAL(r64) :: HitPointLumFrOvercSky ! Luminance of obstruction from overcast sky (cd/m2)
// unused REAL(r64) :: HitPointLumFrSun ! Luminance of obstruction from sun (cd/m2)
int ICtrl; // Window control pointer
int IConstShaded; // Pointer to shaded construction for a window
int JSH; // Shading index: JSH=1 is bare window, JSH=2 is shaded window
Real64 COSBSun; // Cosine of angle of incidence of direct sun on window
Real64 TVISBSun; // Window's visible transmittance at COSBSun
Expand Down Expand Up @@ -7681,7 +7668,6 @@ void DayltgInterReflectedIllum(EnergyPlusData &state,
Real64 HorDis; // Distance between ground hit point and proj'n of window center onto ground (m)
int ObsSurfNum; // Obstruction surface number
bool hitObs; // True iff obstruction is hit
int ObsConstrNum; // Construction number of obstruction
Real64 ObsVisRefl; // Visible reflectance of obstruction
Real64 SkyReflVisLum; // Reflected sky luminance at hit point divided by unobstructed sky
// diffuse horizontal illuminance [(cd/m2)/lux]
Expand Down Expand Up @@ -7734,8 +7720,7 @@ void DayltgInterReflectedIllum(EnergyPlusData &state,
FLCWSK = 0.0;
FLCWSU = 0.0;

IConst = state.dataSurface->Surface(IWin).Construction;
if (state.dataSurface->SurfWinStormWinFlag(IWin) == 1) IConst = state.dataSurface->Surface(IWin).StormWinConstruction;
int const IConst = state.dataSurface->SurfActiveConstruction(IWin);
BlindOn = false;
ShadeOn = false;
ScreenOn = false;
Expand Down Expand Up @@ -7877,7 +7862,6 @@ void DayltgInterReflectedIllum(EnergyPlusData &state,
ZSU = (state.dataDaylightingManager->GILSU(IHR) * state.dataEnvrn->GndReflectanceForDayltg / DataGlobalConstants::Pi) * COSB * DA *
ObTransM(IPH, ITH) * SunObstructionMult;
}

// BEAM SOLAR AND SKY SOLAR REFLECTED FROM NEAREST OBSTRUCTION

if (state.dataSurface->CalcSolRefl && ObTransM(IPH, ITH) < 1.0) {
Expand All @@ -7892,7 +7876,7 @@ void DayltgInterReflectedIllum(EnergyPlusData &state,
ZSU += ZSUObsRefl;

// Sky solar reflected from nearest obstruction.
ObsConstrNum = state.dataSurface->Surface(NearestHitSurfNum).Construction;
int const ObsConstrNum = state.dataSurface->Surface(NearestHitSurfNum).Construction;
if (ObsConstrNum > 0) {
// Exterior building surface is nearest hit
if (!state.dataConstruction->Construct(ObsConstrNum).TypeIsWindow) {
Expand All @@ -7901,8 +7885,6 @@ void DayltgInterReflectedIllum(EnergyPlusData &state,
1.0 - state.dataMaterial->Material(state.dataConstruction->Construct(ObsConstrNum).LayerPoint(1)).AbsorpVisible;
} else {
// Obstruction is a window; assume it is bare
if (state.dataSurface->SurfWinStormWinFlag(NearestHitSurfNum) == 1)
ObsConstrNum = state.dataSurface->Surface(NearestHitSurfNum).StormWinConstruction;
ObsVisRefl = state.dataConstruction->Construct(ObsConstrNum).ReflectVisDiffFront;
}
} else {
Expand Down Expand Up @@ -7974,7 +7956,6 @@ void DayltgInterReflectedIllum(EnergyPlusData &state,
}

} else { // Bare window

// Transmittance of bare window for this sky/ground element
TVISBR = POLYF(COSB, state.dataConstruction->Construct(IConst).TransVisBeamCoef) * state.dataSurface->SurfWinGlazedFrac(IWin) *
state.dataSurface->SurfWinLightWellEff(IWin);
Expand Down Expand Up @@ -8072,9 +8053,7 @@ void DayltgInterReflectedIllum(EnergyPlusData &state,
// between the screen's cylinders goes either up or down depending on the altitude angle of the
// element from which the light came.

IConstShaded = state.dataSurface->Surface(IWin).activeShadedConstruction;
if (state.dataSurface->SurfWinStormWinFlag(IWin) == 1)
IConstShaded = state.dataSurface->Surface(IWin).activeStormWinShadedConstruction;
int IConstShaded = state.dataSurface->SurfWinActiveShadedConstruction(IWin);
if (state.dataSurface->SurfWinSolarDiffusing(IWin)) IConstShaded = state.dataSurface->Surface(IWin).Construction;

// Transmittance of window including shade, screen or blind
Expand Down Expand Up @@ -8319,6 +8298,8 @@ void DayltgInterReflectedIllum(EnergyPlusData &state,
TransMult(1) = state.dataHeatBal->SurfaceScreens(state.dataSurface->SurfWinScreenNumber(IWin)).BmBmTransVis *
state.dataSurface->SurfWinGlazedFrac(IWin) * state.dataSurface->SurfWinLightWellEff(IWin);
} else {
int IConstShaded = state.dataSurface->SurfWinActiveShadedConstruction(IWin);
if (state.dataSurface->SurfWinSolarDiffusing(IWin)) IConstShaded = state.dataSurface->Surface(IWin).Construction;
TransMult(1) = POLYF(COSBSun, state.dataConstruction->Construct(IConstShaded).TransVisBeamCoef) *
state.dataSurface->SurfWinGlazedFrac(IWin) * state.dataSurface->SurfWinLightWellEff(IWin);
}
Expand Down Expand Up @@ -8428,6 +8409,8 @@ void DayltgInterReflectedIllum(EnergyPlusData &state,
if (!state.dataSurface->SurfWinMovableSlats(IWin) && JB > 1) break;

if (ShadeOn || state.dataSurface->SurfWinSolarDiffusing(IWin)) { // Shade on or diffusing glass
int IConstShaded = state.dataSurface->SurfWinActiveShadedConstruction(IWin);
if (state.dataSurface->SurfWinSolarDiffusing(IWin)) IConstShaded = state.dataSurface->Surface(IWin).Construction;
TransMult(1) = state.dataConstruction->Construct(IConstShaded).TransDiffVis * state.dataSurface->SurfWinGlazedFrac(IWin) *
state.dataSurface->SurfWinLightWellEff(IWin);

Expand Down
Loading