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

Daylighting output revisions and other cleanup related to Enclosures vs Zones #9102

Merged
merged 27 commits into from
Jan 4, 2022

Conversation

mjwitte
Copy link
Contributor

@mjwitte mjwitte commented Sep 27, 2021

Pull request overview

  • Move various daylighting outputs to be by enclosure or daylighting control object rather than by zone. This introduces changes in eio output headers and row order.
  • Remove glare calculations and associated arrays for map points. Glare calculations were being performed for every map point, but the glare results are never used.
  • Fixes Duplicate daylighting reference points in DXF output #9084
  • Convert optional arguments in daylighting functions into int const with defaults.
  • Move chunks of daylighting code out of HeatBalanceSurfaceManager::InitSurfaceHeatBalance into new functions in DaylightingManager.
  • Add missing daylighting eio sections to Output Details and Examples doc.

Diffs

 999
-WEST ZONE:DayRefPt:1
+WEST ZONE:DayRefPt:WEST ZONE_DAYLREFPT1
   0
 CIRCLE
   8
@@ -1503,22 +1503,6 @@
         0.90000
  40
         0.20000
-999
-WEST ZONE:DEDayRefPt:1
-  0
-CIRCLE

  • eio diffs reflect 2 things related to daylighting outputs
    • Changing zone names to daylighting control and/or enclosure name
    • Changes in row order (previously the order was by zone, now it's by daylighting control or enclosure)
    • Added missing "Sky Type" in the Sky Daylight Factors header.
  • dfs diffs are a change in order
  • table diffs
    • Changes in row order and/or subtable titles in the Initialization Summary (same changes as the eio output)
    • Changes in row order in the Lighting Summary Daylighting subtable.

ToDo List

Pull Request Author

Add to this list or remove from it as applicable. This is a simple templated set of guidelines.

  • Title of PR should be user-synopsis style (clearly understandable in a standalone changelog context)
  • Label the PR with at least one of: Defect, Refactoring, NewFeature, Performance, and/or DoNoPublish
  • Pull requests that impact EnergyPlus code must also include unit tests to cover enhancement or defect repair
  • Author should provide a "walkthrough" of relevant code changes using a GitHub code review comment process
  • If any diffs are expected, author must demonstrate they are justified using plots and descriptions
  • If changes fix a defect, the fix should be demonstrated in plots and descriptions
  • If any defect files are updated to a more recent version, upload new versions here or on DevSupport
  • If IDD requires transition, transition source, rules, ExpandObjects, and IDFs must be updated, and add IDDChange label
  • If structural output changes, add to output rules file and add OutputChange label
  • If adding/removing any LaTeX docs or figures, update that document's CMakeLists file dependencies

Reviewer

This will not be exhaustively relevant to every PR.

  • Perform a Code Review on GitHub
  • If branch is behind develop, merge develop and build locally to check for side effects of the merge
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified
  • Check that performance is not impacted (CI Linux results include performance check)
  • Run Unit Test(s) locally
  • Check any new function arguments for performance impacts
  • Verify IDF naming conventions and styles, memos and notes and defaults
  • If new idf included, locally check the err file and other outputs

@mjwitte mjwitte added NewFeature Includes code to add a new feature to EnergyPlus Performance Includes code changes that are directed at improving the runtime performance of EnergyPlus OutputChange Code changes output in such a way that it cannot be merged after IO freeze Defect Includes code to repair a defect in EnergyPlus and removed NewFeature Includes code to add a new feature to EnergyPlus labels Sep 27, 2021
@mjwitte mjwitte changed the title Daylighting output by enclosure and other daylighting cleanup Daylighting output revisions and other cleanup Sep 27, 2021
DataDaylighting::SkyType::ClearTurbid,
DataDaylighting::SkyType::Intermediate,
DataDaylighting::SkyType::Overcast}) {
std::string skyTypeString;
Copy link
Collaborator

@amirroth amirroth Sep 28, 2021

Choose a reason for hiding this comment

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

constexpr std::array<std::string_view>

curRefPt.indexToFracAndIllum = refPtNum; // back reference to the index to the ZoneDaylight structure arrays related to reference points
if (state.dataSurface->DaylRefWorldCoordSystem) {
// transform only by appendix G rotation
daylCntrl.DaylRefPtAbsCoord(1, refPtNum) = curRefPt.x * CosBldgRotAppGonly - curRefPt.y * SinBldgRotAppGonly;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This bad girl looks like it should be an Array1D<Vector3> rather than Array2D.

for (int daylightCtrlNum = 1; daylightCtrlNum <= state.dataDaylightingData->totDaylightingControls; ++daylightCtrlNum) {
auto &thisDaylightControl = state.dataDaylightingData->daylightControl(daylightCtrlNum);
auto curcolorno = ColorNo::DaylSensor1;
std::string refPtType;
Copy link
Collaborator

Choose a reason for hiding this comment

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

constexpr std::array<std::string_view>

@mjwitte mjwitte changed the title Daylighting output revisions and other cleanup Daylighting output revisions and other cleanup related to Spaces vs Zones Oct 14, 2021
@mjwitte mjwitte changed the title Daylighting output revisions and other cleanup related to Spaces vs Zones Daylighting output revisions and other cleanup related to Enclosures vs Zones Oct 14, 2021
@mjwitte mjwitte marked this pull request as ready for review November 18, 2021 14:40
Copy link
Contributor Author

@mjwitte mjwitte left a comment

Choose a reason for hiding this comment

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

Code walkthrough.
Note that several earlier comments from @amirroth have been logged in #9152.

@@ -247,17 +247,11 @@ namespace DataDaylighting {
Array2D<Real64> MapRefPtAbsCoord; // X,Y,Z coordinates of all illuminance map reference points
// in absolute coordinate system (m)
// Points 1 and 2 are the control reference points
Array1D_bool MapRefPtInBounds; // True when coordinates are in bounds of zone coordinates
Array1D<Real64> DaylIllumAtMapPt; // Daylight illuminance at illuminance map points (lux)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Delete unused glare arrays in MapCalcData. More below.

static constexpr std::string_view Format_700(
"! <Sky Daylight Factors>, MonthAndDay, Zone Name, Window Name, Reference Point, Daylight Factor\n");
"! <Sky Daylight Factors>, Sky Type, MonthAndDay, Daylighting Control Name, Enclosure Name, "
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add missing Sky Type in header.

print(state.files.eio, Format_700);
for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Remove outer loop by zone.

print(dfs,
"{}\n",
"Hour,Reference Point,Daylight Factor for Clear Sky,Daylight Factor for Clear Turbid Sky,"
"Daylight Factor for Intermediate Sky,Daylight Factor for Overcast Sky");
state.dataDaylightingManager->CreateDFSReportFile = false;
}

// TODO MJW: For now preserve order by zone
for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Remove outer loop by zone.

Comment on lines -1292 to +1287
// TODO MJW: remove all of the glare calcs for map points
// but these are arguments to some of the functions that are shared with regular reference points, so initalize here.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Remove as much as possible related to glare calculations in the map functions.

Comment on lines -446 to -447
// TODO MJW: Keep zone loop for now to maintain order
for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Remove yet another zone loop (YAZL).

Copy link
Member

Choose a reason for hiding this comment

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

Yay!

Comment on lines -1098 to +1100
DXFDaylightingReferencePoints(state, dxffile, false);
DXFDaylightingReferencePoints(state, dxffile, true);
DXFDaylightingReferencePoints(state, dxffile);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the same thing again in DXFOutLines.

Comment on lines -881 to +885
DXFDaylightingReferencePoints(state, dxffile, false);
DXFDaylightingReferencePoints(state, dxffile);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just call this once and handle the different reference point types within the function.

@@ -1256,8 +1257,7 @@ void DXFOutWireFrame(EnergyPlusData &state, std::string const &ColorScheme)
}
}

DXFDaylightingReferencePoints(state, dxffile, false);
DXFDaylightingReferencePoints(state, dxffile, true);
DXFDaylightingReferencePoints(state, dxffile);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

And again in DXFOutWireFrame.

@@ -3028,3 +3034,299 @@ TEST_F(EnergyPlusFixture, DaylightingManager_ReportIllumMap)
EXPECT_EQ(expectedResultName, state->dataDaylightingData->IllumMap(1).Name);
EXPECT_EQ(expectedResultPtsHeader, state->dataDaylightingData->IllumMap(MapNum).pointsHeader);
}
TEST_F(EnergyPlusFixture, DaylightingManager_DayltgIlluminanceMap)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

New unit test for map values.

@nrel-bot-3
Copy link

@mjwitte @Myoldmopar it has been 28 days since this pull request was last updated.

@Myoldmopar
Copy link
Member

This is all around a really great cleanup. I pulled in develop, and resolved a couple dozen conflicts. They were pretty easy to resolve, just taking the functional changes from this branch and integrating the enum changes from develop. All tests pass, so I'm going to push the branch back up here to get fresh CI results. I'm happy with this going in assuming CI is happy. If anyone wants anything else added here, speak up!

@@ -177,9 +174,7 @@ namespace DaylightingManager {
bool const Triangle,
Real64 &TVISIntWin, // Visible transmittance of int win at COSBIntWin for light from ext win
Real64 &TVISIntWinDisk, // Visible transmittance of int win at COSBIntWin for sun
Optional_int_const MapNum = _,
// Optional< Real64 > MapWindowSolidAngAtRefPt = _, //Inactive
Optional<Real64> MapWindowSolidAngAtRefPtWtd = _);
Copy link
Member

Choose a reason for hiding this comment

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

All these Optionals going away is a great move.

@@ -157,7 +155,6 @@ using namespace DataSurfaces;
// Use statements for access to subroutines in other modules
using namespace ScheduleManager;
using namespace SolarShading;
using namespace DaylightingManager;
Copy link
Member

Choose a reason for hiding this comment

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

Any using namespace going away makes me happy too. Even though this is in the cc file and not a header, I bet @lefticus would still agree.

@@ -651,25 +456,8 @@ void InitSurfaceHeatBalance(EnergyPlusData &state)
if (state.dataHeatBalSurfMgr->InitSurfaceHeatBalancefirstTime) DisplayString(state, "Initializing Solar Heat Gains");

InitSolarHeatGains(state);
if (state.dataEnvrn->SunIsUp && (state.dataEnvrn->BeamSolarRad + state.dataEnvrn->GndSolarRad + state.dataEnvrn->DifSolarRad > 0.0)) {
Copy link
Member

Choose a reason for hiding this comment

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

This is a really nice cleanup in the HBSM.

Comment on lines -446 to -447
// TODO MJW: Keep zone loop for now to maintain order
for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
Copy link
Member

Choose a reason for hiding this comment

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

Yay!

@Myoldmopar
Copy link
Member

CI looks similar to how it did before, builds and tests fine locally, checked the updated documentation and everything seems in order there. Merging this in, thanks @mjwitte!

@Myoldmopar Myoldmopar merged commit 36adab7 into develop Jan 4, 2022
@Myoldmopar Myoldmopar deleted the space-followup branch January 4, 2022 14:43
yujiex pushed a commit that referenced this pull request Jan 27, 2022
Daylighting output revisions and other cleanup related to Enclosures vs Zones
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Defect Includes code to repair a defect in EnergyPlus OutputChange Code changes output in such a way that it cannot be merged after IO freeze Performance Includes code changes that are directed at improving the runtime performance of EnergyPlus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicate daylighting reference points in DXF output
8 participants