Skip to content

Commit

Permalink
window control type
Browse files Browse the repository at this point in the history
  • Loading branch information
xuanluo113 committed Jan 20, 2021
1 parent daf5a74 commit 6bcbe09
Show file tree
Hide file tree
Showing 11 changed files with 125 additions and 164 deletions.
11 changes: 0 additions & 11 deletions src/EnergyPlus/DataSurfaces.cc
Original file line number Diff line number Diff line change
Expand Up @@ -237,17 +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

// WindowShadingControl Shading Types
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
Expand Down
21 changes: 5 additions & 16 deletions src/EnergyPlus/DataSurfaces.hh
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,16 @@ namespace DataSurfaces {
};

enum class WinShadingFlag : int {
NoShade = 10,
ShadeOff = 0,
NoShade = 0,
IntShadeOn = 1,
SwitchableGlazing = 2,
ExtShadeOn = 3,
ExtScreenOn = 4,
IntBlindOn = 6,
ExtBlindOn = 7,
BGShadeOn = 8,
BGBlindOn = 9
BGBlindOn = 9,
ShadeOff = 10
};

This comment has been minimized.

Copy link
@amirroth

amirroth Jan 20, 2021

Collaborator

I think ShadingType is a better name for this enum than WinShadingFlag. Also, I don't think you want On/Off on the names of the enums because those are now associated with the variables rather than with the enumerated values. Meaning, there will be one variable whose meaning will be "exists" and another whose meaning will be "active".

This comment has been minimized.

Copy link
@xuanluo113

xuanluo113 Jan 20, 2021

Author Contributor

I agree.


// Parameters to indicate exterior boundary conditions for use with
Expand Down Expand Up @@ -266,17 +266,6 @@ namespace DataSurfaces {
extern int const InConvWinLoc_WindowBelowThis; // this is a wall with window below it
extern int const InConvWinLoc_LargePartOfExteriorWall; // this is a big window taking up most of wall

// WindowShadingControl Shading Types
extern int const WSC_ST_NoShade;
extern int const WSC_ST_InteriorShade;
extern int const WSC_ST_SwitchableGlazing;
extern int const WSC_ST_ExteriorShade;
extern int const WSC_ST_InteriorBlind;
extern int const WSC_ST_ExteriorBlind;
extern int const WSC_ST_BetweenGlassShade;
extern int const WSC_ST_BetweenGlassBlind;
extern int const WSC_ST_ExteriorScreen;

// WindowShadingControl Control Types
extern int const WSCT_AlwaysOn; // AlwaysOn
extern int const WSCT_AlwaysOff; // AlwaysOff
Expand Down Expand Up @@ -1113,7 +1102,7 @@ namespace DataSurfaces {
std::string Name; // User supplied name of this set of shading control data
int ZoneIndex; // number of the zone referenced
int SequenceNumber; // Shading control sequence number
int ShadingType; // Shading type (InteriorShade, SwitchableGlazing,
WinShadingFlag ShadingType; // Shading type (InteriorShade, SwitchableGlazing,
// CHARACTER(len=32) :: ShadingType = ' ' ! Shading type (InteriorShade, SwitchableGlazing,
// ExteriorShade,InteriorBlind,ExteriorBlind,BetweenGlassShade,
// BetweenGlassBlind, or ExteriorScreen)
Expand Down Expand Up @@ -1199,7 +1188,7 @@ namespace DataSurfaces {

// Default Constructor
WindowShadingControlData()
: ZoneIndex(0), SequenceNumber(0), ShadingType(WSC_ST_NoShade), getInputShadedConstruction(0), ShadingDevice(0), ShadingControlType(0),
: ZoneIndex(0), SequenceNumber(0), ShadingType(WinShadingFlag::NoShade), getInputShadedConstruction(0), ShadingDevice(0), ShadingControlType(0),
Schedule(0), SetPoint(0.0), SetPoint2(0.0), ShadingControlIsScheduled(false), GlareControlIsActive(false), SlatAngleSchedule(0),
SlatAngleControlForBlinds(0), DaylightControlIndex(0), MultiSurfaceCtrlIsGroup(false), FenestrationCount(0)
{
Expand Down
59 changes: 30 additions & 29 deletions src/EnergyPlus/DaylightingManager.cc

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/EnergyPlus/DaylightingManager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ namespace DaylightingManager {
int &LSHCAL, // Interior shade calculation flag: 0=not yet calculated, 1=already calculated
int &InShelfSurf, // Inside daylighting shelf surface number
int &ICtrl, // Window control counter
int &ShType, // Window shading type
DataSurfaces::WinShadingFlag &ShType, // Window shading type
int &BlNum, // Window blind number
Vector3<Real64> &WNORM2, // Unit vector normal to window
DataDaylighting::iExtWinType &ExtWinType, // Exterior window type (InZoneExtWin, AdjZoneExtWin, NotInOrAdjZoneExtWin)
Expand Down Expand Up @@ -257,7 +257,7 @@ namespace DaylightingManager {
Real64 const TVISB, // Visible transmittance of window for COSB angle of incidence (times light well efficiency, if appropriate)
Real64 const DOMEGA, // Solid angle subtended by window element wrt reference point (steradians)
int const ICtrl, // Window control counter
int const ShType, // Window shading type
DataSurfaces::WinShadingFlag const ShType, // Window shading type
int const BlNum, // Window blind number
Real64 const THRAY, // Azimuth of ray from reference point to window element (radians)
Vector3<Real64> const &WNORM2, // Unit vector normal to window
Expand Down
7 changes: 3 additions & 4 deletions src/EnergyPlus/EMSManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1862,8 +1862,7 @@ namespace EMSManager {
using DataSurfaces::Surface;
using DataSurfaces::TotSurfaces;
using DataSurfaces::WindowShadingControl;
using DataSurfaces::WSC_ST_SwitchableGlazing;
using DataSurfaces::WSC_ST_ExteriorScreen;
using DataSurfaces::WinShadingFlag;

// Locals
// SUBROUTINE ARGUMENT DEFINITIONS:
Expand Down Expand Up @@ -1902,15 +1901,15 @@ namespace EMSManager {
DataSurfaces::SurfWinSlatAngThisTSDegEMSon(loopSurfNum),
DataSurfaces::SurfWinSlatAngThisTSDegEMSValue(loopSurfNum));
}
} else if (WindowShadingControl(Surface(loopSurfNum).activeWindowShadingControl).ShadingType == WSC_ST_ExteriorScreen) {
} else if (WindowShadingControl(Surface(loopSurfNum).activeWindowShadingControl).ShadingType == WinShadingFlag::ExtScreenOn) {
SetupEMSActuator(state, "Window Shading Control",
Surface(loopSurfNum).Name,
"Control Status",
"[ShadeStatus]",
DataSurfaces::SurfWinShadingFlagEMSOn(loopSurfNum),
(int &)DataSurfaces::SurfWinShadingFlagEMSValue(loopSurfNum));
} else {
if (WindowShadingControl(Surface(loopSurfNum).activeWindowShadingControl).ShadingType != WSC_ST_SwitchableGlazing) {
if (WindowShadingControl(Surface(loopSurfNum).activeWindowShadingControl).ShadingType != WinShadingFlag::SwitchableGlazing) {
ShowSevereError(state, "Missing shade or blind layer in window construction name = '" +
state.dataConstruction->Construct(Surface(loopSurfNum).activeShadedConstruction).Name + "', surface name = '" +
Surface(loopSurfNum).Name + "'.");
Expand Down
18 changes: 9 additions & 9 deletions src/EnergyPlus/HeatBalanceSurfaceManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1052,23 +1052,23 @@ namespace HeatBalanceSurfaceManager {
PreDefTableEntry(state, state.dataOutRptPredefined->pdchWscName, surfName, WindowShadingControl(curWSC).Name);
{
auto const SELECT_CASE_var1(WindowShadingControl(curWSC).ShadingType);
if (SELECT_CASE_var1 == WSC_ST_NoShade) {
if (SELECT_CASE_var1 == WinShadingFlag::NoShade) {
PreDefTableEntry(state, state.dataOutRptPredefined->pdchWscShading, surfName, "No Shade");
} else if (SELECT_CASE_var1 == WSC_ST_InteriorShade) {
} else if (SELECT_CASE_var1 == WinShadingFlag::IntShadeOn) {
PreDefTableEntry(state, state.dataOutRptPredefined->pdchWscShading, surfName, "Interior Shade");
} else if (SELECT_CASE_var1 == WSC_ST_SwitchableGlazing) {
} else if (SELECT_CASE_var1 == WinShadingFlag::SwitchableGlazing) {
PreDefTableEntry(state, state.dataOutRptPredefined->pdchWscShading, surfName, "Switchable Glazing");
} else if (SELECT_CASE_var1 == WSC_ST_ExteriorShade) {
} else if (SELECT_CASE_var1 == WinShadingFlag::ExtShadeOn) {
PreDefTableEntry(state, state.dataOutRptPredefined->pdchWscShading, surfName, "Exterior Shade");
} else if (SELECT_CASE_var1 == WSC_ST_InteriorBlind) {
} else if (SELECT_CASE_var1 == WinShadingFlag::IntBlindOn) {
PreDefTableEntry(state, state.dataOutRptPredefined->pdchWscShading, surfName, "Interior Blind");
} else if (SELECT_CASE_var1 == WSC_ST_ExteriorBlind) {
} else if (SELECT_CASE_var1 == WinShadingFlag::ExtBlindOn) {
PreDefTableEntry(state, state.dataOutRptPredefined->pdchWscShading, surfName, "Exterior Blind");
} else if (SELECT_CASE_var1 == WSC_ST_BetweenGlassShade) {
} else if (SELECT_CASE_var1 == WinShadingFlag::BGShadeOn) {
PreDefTableEntry(state, state.dataOutRptPredefined->pdchWscShading, surfName, "Between Glass Shade");
} else if (SELECT_CASE_var1 == WSC_ST_BetweenGlassBlind) {
} else if (SELECT_CASE_var1 == WinShadingFlag::BGBlindOn) {
PreDefTableEntry(state, state.dataOutRptPredefined->pdchWscShading, surfName, "Between Glass Blind");
} else if (SELECT_CASE_var1 == WSC_ST_ExteriorScreen) {
} else if (SELECT_CASE_var1 == WinShadingFlag::ExtScreenOn) {
PreDefTableEntry(state, state.dataOutRptPredefined->pdchWscShading, surfName, "Exterior Screen");
}
}
Expand Down
47 changes: 17 additions & 30 deletions src/EnergyPlus/SolarShading.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1347,7 +1347,7 @@ namespace SolarShading {
// Added TH 5/26/2009 for switchable windows to report switching factor (tinted level)
// CurrentModuleObject='Switchable Windows'
if (Surface(SurfLoop).HasShadeControl) {
if (WindowShadingControl(Surface(SurfLoop).activeWindowShadingControl).ShadingType == WSC_ST_SwitchableGlazing) {
if (WindowShadingControl(Surface(SurfLoop).activeWindowShadingControl).ShadingType == WinShadingFlag::SwitchableGlazing) {
// IF (SurfaceWindow(SurfLoop)%ShadingFlag == WinShadingFlag::SwitchableGlazing) THEN !ShadingFlag is not set to WinShadingFlag::SwitchableGlazing yet!
SetupOutputVariable(state, "Surface Window Switchable Glazing Switching Factor",
OutputProcessor::Unit::None,
Expand Down Expand Up @@ -8740,35 +8740,19 @@ namespace SolarShading {
}
int IShadingCtrl = Surface(ISurf).activeWindowShadingControl;

int ShadingType = WindowShadingControl(IShadingCtrl).ShadingType; // Type of shading (interior shade, interior blind, etc.)
SurfWinShadingFlag(ISurf) = WinShadingFlag::ShadeOff; // Initialize shading flag to off
// int ShadingType = WindowShadingControl(IShadingCtrl).ShadingType; // Type of shading (interior shade, interior blind, etc.)


int IZone = Surface(ISurf).Zone;
// Setpoint for shading
Real64 SetPoint = WindowShadingControl(IShadingCtrl).SetPoint; // Control setpoint
Real64 SetPoint2 = WindowShadingControl(IShadingCtrl).SetPoint2; // Second control setpoint

WinShadingFlag ShType; // Type of shading (interior shade, interior blind, etc.)

// ShType = NoShade ! =-1 (see DataHeatBalance)
// ShType = ShadeOff ! =0
WinShadingFlag ShType;
// 1 = interior shade is on,
// 2 = glass is switched to dark state,
// 3 = exterior shade is on,
// 4 = exterior screen is on,
// 6 = interior blind is on,
// 7 = exterior blind is on,
// 8 = between-glass shade is on,
// 9 = between-glass blind is on.
// CHARACTER(len=32) :: ShadingType ! Type of shading (interior shade, interior blind, etc.)
if (ShadingType == WSC_ST_InteriorShade) ShType = WinShadingFlag::IntShadeOn; // =1
if (ShadingType == WSC_ST_SwitchableGlazing) ShType = WinShadingFlag::SwitchableGlazing; // =2
if (ShadingType == WSC_ST_ExteriorShade) ShType = WinShadingFlag::ExtShadeOn; // =3
if (ShadingType == WSC_ST_ExteriorScreen) ShType = WinShadingFlag::ExtScreenOn; // =4
if (ShadingType == WSC_ST_InteriorBlind) ShType = WinShadingFlag::IntBlindOn; // =6
if (ShadingType == WSC_ST_ExteriorBlind) ShType = WinShadingFlag::ExtBlindOn; // =7
if (ShadingType == WSC_ST_BetweenGlassShade) ShType = WinShadingFlag::BGShadeOn; // =8
if (ShadingType == WSC_ST_BetweenGlassBlind) ShType = WinShadingFlag::BGBlindOn; // =9
if (IS_SHADED(WindowShadingControl(IShadingCtrl).ShadingType)) {
ShType = WindowShadingControl(IShadingCtrl).ShadingType;
}

bool SchedAllowsControl = true; // True if control schedule is not specified or is specified and schedule value = 1
int SchedulePtr = WindowShadingControl(IShadingCtrl).Schedule;
Expand Down Expand Up @@ -8796,6 +8780,7 @@ namespace SolarShading {
// Determine whether to deploy shading depending on type of control

SurfWinGlareControlIsActive(ISurf) = false;
SurfWinShadingFlag(ISurf) = WinShadingFlag::ShadeOff; // Initialize shading flag to off

auto const SELECT_CASE_var(WindowShadingControl(IShadingCtrl).ShadingControlType);

Expand All @@ -8806,7 +8791,9 @@ namespace SolarShading {
SurfWinShadingFlag(ISurf) = WinShadingFlag::ShadeOff;

} else if (SELECT_CASE_var == WSCT_OnIfScheduled) { // 'ONIFSCHEDULEALLOWS'
if (SchedAllowsControl) SurfWinShadingFlag(ISurf) = ShType;
if (SchedAllowsControl) {
SurfWinShadingFlag(ISurf) = ShType;
}

} else if (SELECT_CASE_var == WSCT_HiSolar) {
// 'ONIFHIGHSOLARONWINDOW' ! Direct plus diffuse solar intensity on window
Expand Down Expand Up @@ -10516,18 +10503,18 @@ namespace SolarShading {
Real64 AbsorpEff = 0.0; // Effective absorptance of isolated shade layer (fraction of
// of incident radiation remaining after reflected portion is
// removed that is absorbed
if (WindowShadingControl(WinShadeCtrlNum).ShadingType == WSC_ST_InteriorShade ||
WindowShadingControl(WinShadeCtrlNum).ShadingType == WSC_ST_ExteriorShade ||
WindowShadingControl(WinShadeCtrlNum).ShadingType == WSC_ST_BetweenGlassShade) {
if (WindowShadingControl(WinShadeCtrlNum).ShadingType == WinShadingFlag::IntShadeOn ||
WindowShadingControl(WinShadeCtrlNum).ShadingType == WinShadingFlag::ExtShadeOn ||
WindowShadingControl(WinShadeCtrlNum).ShadingType == WinShadingFlag::BGShadeOn) {
int ConstrNumSh = Surface(SurfNum).activeShadedConstruction; // Window construction number with shade
int TotLay = state.dataConstruction->Construct(ConstrNumSh).TotLayers; // Total layers in a construction


if (WindowShadingControl(WinShadeCtrlNum).ShadingType == WSC_ST_InteriorShade) {
if (WindowShadingControl(WinShadeCtrlNum).ShadingType == WinShadingFlag::IntShadeOn) {
MatNumSh = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(TotLay); // Interior shade
} else if (WindowShadingControl(WinShadeCtrlNum).ShadingType == WSC_ST_ExteriorShade) {
} else if (WindowShadingControl(WinShadeCtrlNum).ShadingType == WinShadingFlag::ExtShadeOn) {
MatNumSh = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(1); // Exterior shade
} else if (WindowShadingControl(WinShadeCtrlNum).ShadingType == WSC_ST_BetweenGlassShade) {
} else if (WindowShadingControl(WinShadeCtrlNum).ShadingType == WinShadingFlag::BGShadeOn) {
if (state.dataConstruction->Construct(ConstrNumSh).TotGlassLayers == 2) {
// Double pane with between-glass shade
MatNumSh = state.dataConstruction->Construct(ConstrNumSh).LayerPoint(3);
Expand Down
Loading

0 comments on commit 6bcbe09

Please sign in to comment.