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

Convert window shading flag to enum class #8435

Merged
merged 44 commits into from
Feb 23, 2021
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
bb83a27
first commit
xuanluo113 Dec 10, 2020
d33eb73
fix a bug
xuanluo113 Dec 10, 2020
4815c24
Merge branch 'develop' of https://github.com/NREL/EnergyPlus into sha…
xuanluo113 Dec 10, 2020
79aa3d8
fix another
xuanluo113 Dec 10, 2020
8664ca3
fix more
xuanluo113 Dec 11, 2020
b013ad5
Merge branch 'develop' of https://github.com/NREL/EnergyPlus into sha…
xuanluo113 Dec 11, 2020
f455c3e
fix more
xuanluo113 Dec 12, 2020
1959173
ems fix
xuanluo113 Dec 19, 2020
f9748ed
merge
xuanluo113 Dec 19, 2020
4dcba6e
fix ems type in unit test
xuanluo113 Dec 19, 2020
0ea1c27
merge
xuanluo113 Jan 11, 2021
f645e08
Merge branch 'develop' of https://github.com/NREL/EnergyPlus into sha…
xuanluo113 Jan 12, 2021
91e0628
bug fixing
xuanluo113 Jan 13, 2021
bc631d8
fix
xuanluo113 Jan 15, 2021
89feb91
Merge branch 'develop' of https://github.com/NREL/EnergyPlus into sha…
xuanluo113 Jan 15, 2021
88347f6
remove shaded
xuanluo113 Jan 15, 2021
6aabfc7
fix index
xuanluo113 Jan 18, 2021
cdf9ff7
macros
xuanluo113 Jan 19, 2021
daf5a74
more macros
xuanluo113 Jan 19, 2021
6bcbe09
window control type
xuanluo113 Jan 20, 2021
ad7df70
Merge branch 'develop' of https://github.com/NREL/EnergyPlus into sha…
xuanluo113 Jan 20, 2021
6cc1bf4
naming
xuanluo113 Jan 24, 2021
e7af4ec
replace first part
xuanluo113 Jan 24, 2021
1cff5a5
window control type enum
xuanluo113 Jan 26, 2021
d58aed0
remove attributes
xuanluo113 Jan 26, 2021
af671a5
address comments
xuanluo113 Jan 26, 2021
5bfefa3
temporary fix
xuanluo113 Jan 28, 2021
45edddf
EMS value
xuanluo113 Jan 29, 2021
726654f
Merge branch 'develop' of https://github.com/NREL/EnergyPlus into sha…
xuanluo113 Jan 29, 2021
e99c7fe
EMS value
xuanluo113 Jan 29, 2021
6bb6ae4
fix glare control logic
xuanluo113 Jan 30, 2021
f9582dc
bug fix
xuanluo113 Jan 30, 2021
3fe9ff2
Merge branch 'develop' of https://github.com/NREL/EnergyPlus into sha…
xuanluo113 Feb 2, 2021
9e876f9
merge
xuanluo113 Feb 3, 2021
6679ba5
Merge branch 'develop' of https://github.com/NREL/EnergyPlus into sha…
xuanluo113 Feb 4, 2021
0107de2
Merge remote-tracking branch 'upstream/develop' into shading-flag
Myoldmopar Feb 6, 2021
e652b59
Merge remote-tracking branch 'upstream/develop' into shading-flag
Myoldmopar Feb 6, 2021
5491529
Merge branch 'shading-flag' of https://github.com/energy-plus/EnergyP…
xuanluo113 Feb 9, 2021
d389e71
address comments
xuanluo113 Feb 9, 2021
b777b7d
unit test
xuanluo113 Feb 10, 2021
f3bce29
Merge branch 'develop' of https://github.com/NREL/EnergyPlus into sha…
xuanluo113 Feb 10, 2021
6be6636
Merge branch 'develop' of https://github.com/NREL/EnergyPlus into sha…
xuanluo113 Feb 15, 2021
b723cb7
Merge branch 'develop' of https://github.com/NREL/EnergyPlus into sha…
xuanluo113 Feb 20, 2021
0f5b941
Merge branch 'develop' of https://github.com/NREL/EnergyPlus into sha…
xuanluo113 Feb 22, 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
7 changes: 3 additions & 4 deletions src/EnergyPlus/ChilledCeilingPanelSimple.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1696,8 +1696,7 @@ namespace CoolingPanelSimple {
using DataHeatBalance::HConvIn;
using DataHeatBalance::Zone;
using DataHeatBalSurface::TempSurfInTmp;
using DataSurfaces::IntBlindOn;
using DataSurfaces::IntShadeOn;
using DataSurfaces::WinShadingType;
using DataSurfaces::Surface;
using DataSurfaces::SurfWinShadingFlag;
using DataSurfaces::SurfWinFrameArea;
Expand Down Expand Up @@ -1727,7 +1726,7 @@ namespace CoolingPanelSimple {

if (ThisSurf.Class == DataSurfaces::SurfaceClass::Window) {

if (SurfWinShadingFlag(SurfNum) == IntShadeOn || SurfWinShadingFlag(SurfNum) == IntBlindOn) {
if (ANY_INTERIOR_SHADE_BLIND(SurfWinShadingFlag(SurfNum))) {
// The area is the shade or blind area = the sum of the glazing area and the divider area (which is zero if no divider)
Area += DataSurfaces::SurfWinDividerArea(SurfNum);
}
Expand All @@ -1737,7 +1736,7 @@ namespace CoolingPanelSimple {
SumHATsurf += HConvIn(SurfNum) * SurfWinFrameArea(SurfNum) * (1.0 + SurfWinProjCorrFrIn(SurfNum)) * SurfWinFrameTempSurfIn(SurfNum);
}

if (SurfWinDividerArea(SurfNum) > 0.0 && SurfWinShadingFlag(SurfNum) != IntShadeOn && SurfWinShadingFlag(SurfNum) != IntBlindOn) {
if (SurfWinDividerArea(SurfNum) > 0.0 && !ANY_INTERIOR_SHADE_BLIND(SurfWinShadingFlag(SurfNum))) {
// Window divider contribution (only from shade or blind for window with divider and interior shade or blind)
SumHATsurf +=
HConvIn(SurfNum) * SurfWinDividerArea(SurfNum) * (1.0 + 2.0 * SurfWinProjCorrDivIn(SurfNum)) * SurfWinDividerTempSurfIn(SurfNum);
Expand Down
4 changes: 2 additions & 2 deletions src/EnergyPlus/ConvectionCoefficients.cc
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ namespace ConvectionCoefficients {

if (!Surface(SurfNum).ExtWind) {
SurfWindSpeed = 0.0; // No wind exposure
} else if (Surface(SurfNum).Class == SurfaceClass::Window && SurfWinShadingFlag(SurfNum) == ExtShadeOn) {
} else if (Surface(SurfNum).Class == SurfaceClass::Window && SurfWinShadingFlag(SurfNum) == WinShadingType::ExtShade) {
SurfWindSpeed = 0.0; // Assume zero wind speed at outside glass surface of window with exterior shade
} else {
SurfWindSpeed = Surface(SurfNum).WindSpeed;
Expand Down Expand Up @@ -4709,7 +4709,7 @@ namespace ConvectionCoefficients {

if (!Surface(SurfNum).ExtWind) {
SurfWindSpeed = 0.0; // No wind exposure
} else if (Surface(SurfNum).Class == SurfaceClass::Window && SurfWinShadingFlag(SurfNum) == ExtShadeOn) {
} else if (Surface(SurfNum).Class == SurfaceClass::Window && SurfWinShadingFlag(SurfNum) == WinShadingType::ExtShade) {
SurfWindSpeed = 0.0; // Assume zero wind speed at outside glass surface of window with exterior shade
} else {
SurfWindSpeed = Surface(SurfNum).WindSpeed;
Expand Down
58 changes: 4 additions & 54 deletions src/EnergyPlus/DataSurfaces.cc
Original file line number Diff line number Diff line change
Expand Up @@ -237,57 +237,6 @@ namespace DataSurfaces {
int const InConvWinLoc_WindowBelowThis(4); // this is a wall with window below it
int const InConvWinLoc_LargePartOfExteriorWall(5); // this is a big window taking up most of wall

// Parameters for window shade status
int const NoShade(-1);
int const ShadeOff(0);
int const IntShadeOn(1); // Interior shade on
int const SwitchableGlazing(2);
int const ExtShadeOn(3); // Exterior shade on
int const ExtScreenOn(4); // Exterior screen on
int const IntBlindOn(6); // Interior blind on
int const ExtBlindOn(7); // Exterior blind on
int const BGShadeOn(8); // Between-glass shade on
int const BGBlindOn(9); // Between-glass blind on
int const IntShadeConditionallyOff(10);
int const GlassConditionallyLightened(20);
int const ExtShadeConditionallyOff(30);
int const IntBlindConditionallyOff(60);
int const ExtBlindConditionallyOff(70);

// WindowShadingControl Shading Types
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, it appears that Shading Types have been mixed in/consolidated with the Shade Status types. I'm not sure that's a good plan. While similar, WSC_ST_InteriorShade had a different meaning from IntShadeOn. I'll see how this plays out in the sections of code that use(d) these two sets of values.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mjwitte Please see this thread for the explanation. You are right. Mixing the types and status was not an optimal design decision in the first place (I only reassured this when I was 80% done with this branch). But changing this may require some redesign of the logic and a lot more refactoring. It's more like a refactoring rather than a 10x effort. I think this could happen later.

int const WSC_ST_NoShade(0);
int const WSC_ST_InteriorShade(1);
int const WSC_ST_SwitchableGlazing(2);
int const WSC_ST_ExteriorShade(3);
int const WSC_ST_InteriorBlind(4);
int const WSC_ST_ExteriorBlind(5);
int const WSC_ST_BetweenGlassShade(6);
int const WSC_ST_BetweenGlassBlind(7);
int const WSC_ST_ExteriorScreen(8);

// WindowShadingControl Control Types
int const WSCT_AlwaysOn(1); // AlwaysOn
int const WSCT_AlwaysOff(2); // AlwaysOff
int const WSCT_OnIfScheduled(3); // OnIfScheduleAllows
int const WSCT_HiSolar(4); // OnIfHighSolarOnWindow
int const WSCT_HiHorzSolar(5); // OnIfHighHorizontalSolar
int const WSCT_HiOutAirTemp(6); // OnIfHighOutsideAirTemp
int const WSCT_HiZoneAirTemp(7); // OnIfHighZoneAirTemp
int const WSCT_HiZoneCooling(8); // OnIfHighZoneCooling
int const WSCT_HiGlare(9); // OnIfHighGlare
int const WSCT_MeetDaylIlumSetp(10); // MeetDaylightIlluminanceSetpoint
int const WSCT_OnNightLoOutTemp_OffDay(11); // OnNightIfLowOutsideTemp/OffDay
int const WSCT_OnNightLoInTemp_OffDay(12); // OnNightIfLowInsideTemp/OffDay
int const WSCT_OnNightIfHeating_OffDay(13); // OnNightIfHeating/OffDay
int const WSCT_OnNightLoOutTemp_OnDayCooling(14); // OnNightIfLowOutsideTemp/OnDayIfCooling
int const WSCT_OnNightIfHeating_OnDayCooling(15); // OnNightIfHeating/OnDayIfCooling
int const WSCT_OffNight_OnDay_HiSolarWindow(16); // OffNight/OnDayIfCoolingAndHighSolarOnWindow
int const WSCT_OnNight_OnDay_HiSolarWindow(17); // OnNight/OnDayIfCoolingAndHighSolarOnWindow
int const WSCT_OnHiOutTemp_HiSolarWindow(18); // OnIfHighOutsideAirTempAndHighSolarOnWindow
int const WSCT_OnHiOutTemp_HiHorzSolar(19); // OnIfHighOutsideAirTempAndHighHorizontalSolar
int const WSCT_OnHiZoneTemp_HiSolarWindow(20); // OnIfHighZoneAirTempAndHighSolarOnWindow
int const WSCT_OnHiZoneTemp_HiHorzSolar(21); // OnIfHighZoneAirTempAndHighHorizontalSolar

// WindowShadingControl Slat Angle Control for Blinds
int const WSC_SAC_FixedSlatAngle(1);
int const WSC_SAC_ScheduledSlatAngle(2);
Expand Down Expand Up @@ -511,13 +460,13 @@ namespace DataSurfaces {
Array1D<Real64> SurfWinProfileAngHor; // Horizontal beam solar profile angle (degrees)
Array1D<Real64> SurfWinProfileAngVert; // Vertical beam solar profile angle (degrees)

Array1D<int> SurfWinShadingFlag; // -1: window has no shading device
Array1D<WinShadingType> SurfWinShadingFlag; // -1: window has no shading device
Array1D<bool> SurfWinShadingFlagEMSOn; // EMS control flag, true if EMS is controlling ShadingFlag with ShadingFlagEMSValue
Array1D<int> SurfWinShadingFlagEMSValue; // EMS control value for Shading Flag
Array1D<Real64> SurfWinShadingFlagEMSValue; // EMS control value for Shading Flag
Array1D<int> SurfWinStormWinFlag; // -1: Storm window not applicable; 0: Window has storm window but it is off 1: Window has storm window and it is on
Array1D<int> SurfWinStormWinFlagPrevDay; // Previous time step value of StormWinFlag
Array1D<Real64> SurfWinFracTimeShadingDeviceOn; // For a single time step, = 0.0 if no shading device or shading device is off = 1.0 if shading device is on; For time intervals longer than a time step, = fraction of time that shading device is on.
Array1D<int> SurfWinExtIntShadePrevTS; // 1 if exterior or interior blind or shade in place previous time step;0 otherwise
Array1D<WinShadingType> SurfWinExtIntShadePrevTS; // 1 if exterior or interior blind or shade in place previous time step;0 otherwise
Array1D<bool> SurfWinHasShadeOrBlindLayer; // mark as true if the window construction has a shade or a blind layer
Array1D<bool> SurfWinSurfDayLightInit; // surface has been initialized for following 5 arrays
Array1D<int> SurfWinDaylFacPoint; // Pointer to daylight factors for the window
Expand Down Expand Up @@ -608,6 +557,7 @@ namespace DataSurfaces {
bool AnyHeatBalanceInsideSourceTerm(false); // True if any SurfaceProperty:HeatBalanceSourceTerm inside face used
bool AnyHeatBalanceOutsideSourceTerm(false); // True if any SurfaceProperty:HeatBalanceSourceTerm outside face used


// SUBROUTINE SPECIFICATIONS FOR MODULE DataSurfaces:

// Object Data
Expand Down
Loading