Skip to content

Conversation

@mjwitte
Copy link
Contributor

@mjwitte mjwitte commented Jan 22, 2025

Pull request overview

** Warning ** GetSurfaceData: CAUTION -- Interspace surfaces are usually in different spaces
** ~~~ ** Surface=G SIWALL N1A, Space=FLOOR 1 G N1 APARTMENT, Zone=G N1 APARTMENT
** ~~~ ** Surface=iz-G SIWALL N1A, Space=FLOOR 1 G N1 APARTMENT, Zone=G CORRIDOR
  • Fix this to assign the correct Space to the new surface, but this will only work if the other side Zone has only one Space. If it has multiples spaces, then issue a fatal error.
  • For BuildingSurface:Detailed, Wall:Detailed, RoofCeiling:Detailed, and Floor:Detailed add "Space" as a choice for Outside Boundary Condition, so the user can specify the adjacent Space name.
  • For Wall:Interzone, Ceiling:Interzone, and Floor:Interzone enforce the single-space requirement.
  • For Window:Interzone, Door:Interzone, and GlazedDoor:Interzone, fix the code to use the same Space as the base surface.

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 the Defect Includes code to repair a defect in EnergyPlus label Jan 22, 2025
@mjwitte
Copy link
Contributor Author

mjwitte commented Jan 22, 2025

Need to test that this works for cases where the surface is adjacent to the same zone/space, such as a middle floor that's multiplied.

@mjwitte mjwitte changed the title Add Space as outside boundary condition choice Fix space assignment for zone outside boundary condition and add space option Jan 22, 2025
@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit 28d0b99

Regression Summary
  • Audit: 10
  • DXF: 3
  • EIO: 10
  • ERR: 6
  • SHD: 10
  • ESO Big Diffs: 9
  • MTR Big Diffs: 1
  • MTD: 3
  • SSZ Big Diffs: 2
  • ZSZ Big Diffs: 4
  • Table Big Diffs: 8
  • Table String Diffs: 8
  • BND: 1
  • ESO Small Diffs: 1

@mjwitte mjwitte added the IDDChange Code changes impact the IDD file (cannot be merged after IO freeze) label Jan 31, 2025
@mjwitte mjwitte added this to the EnergyPlus 25.1 IO Freeze milestone Jan 31, 2025
@mjwitte
Copy link
Contributor Author

mjwitte commented Jan 31, 2025

One of the new unit tests fails with develop:

Note: Google Test filter = *SurfaceGeometry_ZoneOutsideBC*
[==========] Running 2 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 2 tests from EnergyPlusFixture
[ RUN      ] EnergyPlusFixture.SurfaceGeometry_ZoneOutsideBC_SpacesNotInput
[       OK ] EnergyPlusFixture.SurfaceGeometry_ZoneOutsideBC_SpacesNotInput (11426 ms)
[ RUN      ] EnergyPlusFixture.SurfaceGeometry_ZoneOutsideBC_SpacesInput
C:\MJWGit\EnergyPlus\tst\EnergyPlus\unit\Fixtures\EnergyPlusFixture.cc(211): error: Expected equality of these values:
  expected_string
    Which is: ""
  stream_str
    Which is: "   ** Warning ** GetSurfaceData: CAUTION -- Interspace surfaces are occurring in the same space(s).\n   **   ~~~   ** ...use Output:Diagnostics,DisplayExtraWarnings; to show more details on individual occurrences.\n   ** Warning ** CalculateZoneVolume: 2 zones are not fully enclosed. For more details use:  Output:Diagnostics,DisplayExtrawarnings; \n"
With diff:
@@ -1,1 +1,3 @@
-""
+   ** Warning ** GetSurfaceData: CAUTION -- Interspace surfaces are occurring in the same space(s).
+   **   ~~~   ** ...use Output:Diagnostics,DisplayExtraWarnings; to show more details on individual occurrences.
+   ** Warning ** CalculateZoneVolume: 2 zones are not fully enclosed. For more details use:  Output:Diagnostics,DisplayExtrawarnings; \n

C:\MJWGit\EnergyPlus\tst\EnergyPlus\unit\SurfaceGeometry.unit.cc(15173): error: Value of: compare_err_stream("")
  Actual: false
Expected: true
C:\MJWGit\EnergyPlus\tst\EnergyPlus\unit\SurfaceGeometry.unit.cc(15184): error: Expected equality of these values:
  state->dataHeatBal->space(1).surfaces.size()
    Which is: 9
  7
C:\MJWGit\EnergyPlus\tst\EnergyPlus\unit\SurfaceGeometry.unit.cc(15185): error: Expected equality of these values:
  state->dataHeatBal->space(2).surfaces.size()
    Which is: 5
  7
C:\MJWGit\EnergyPlus\tst\EnergyPlus\unit\SurfaceGeometry.unit.cc(15204): error: Expected equality of these values:
  izIntWall.spaceNum
    Which is: 1
  2
C:\MJWGit\EnergyPlus\tst\EnergyPlus\unit\SurfaceGeometry.unit.cc(15217): error: Expected equality of these values:
  izIntDoor.spaceNum
    Which is: 1
  2
[  FAILED  ] EnergyPlusFixture.SurfaceGeometry_ZoneOutsideBC_SpacesInput (4696 ms)
[----------] 2 tests from EnergyPlusFixture (16126 ms total)

[----------] Global test environment tear-down
[==========] 2 tests from 1 test suite ran. (16128 ms total)
[  PASSED  ] 1 test.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] EnergyPlusFixture.SurfaceGeometry_ZoneOutsideBC_SpacesInput

 1 FAILED TEST

@mjwitte mjwitte marked this pull request as ready for review January 31, 2025 19:25
@mjwitte
Copy link
Contributor Author

mjwitte commented Feb 4, 2025

Results for the defect files.

240824_Zone_Base EEM
(same with develop and this branch, surfaces not assigned to spaces, Zone outside boundary condition used for some surfaces)
image

240824_Base EEM
(surfaces assigned to spaces, Zone outside boundary condition used for some surfaces)

With develop
image

errors

   ** Warning ** GetSurfaceData: CAUTION -- Interspace surfaces are usually in different spaces
   **   ~~~   ** Surface=G SIWALL N1A, Space=FLOOR 1 G N1 APARTMENT, Zone=G N1 APARTMENT
   **   ~~~   ** Surface=iz-G SIWALL N1A, Space=FLOOR 1 G N1 APARTMENT, Zone=G CORRIDOR
   ** Warning ** GetSurfaceData: CAUTION -- Interspace surfaces are usually in different spaces
   **   ~~~   ** Surface=G EIWALL N1A, Space=FLOOR 1 G N1 APARTMENT, Zone=G N1 APARTMENT
   **   ~~~   ** Surface=iz-G EIWALL N1A, Space=FLOOR 1 G N1 APARTMENT, Zone=G N2 APARTMENT
etc

Interzone surfaces show in different zones but in the same space
image

With this branch
Energy results match the "zone" version.
image

Surface errors are gone.
And interzone surfaces are in different spaces.
image
image

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 walkthru

\key Adiabatic
\key Surface
\key Zone
\key Space
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 outside boundary condition choice for the Detailed surface types.

int constexpr UnenteredAdjacentZoneSurface = -998; // allows users to enter one zone surface ("Zone")
// referencing another in adjacent zone
int constexpr UnreconciledZoneSurface = -999; // interim value between entering surfaces ("Surface") and reconciling
int constexpr unenteredAdjacentSpaceSurface = -997; // allows users to enter one zone surface ("Space")
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 flag variable for Space outside BC.

Copy link
Member

Choose a reason for hiding this comment

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

Seems ripe for an enum instead of hardcoded values, but there may be a reason that isn't ideal here. Either way this doesn't have to hold up for it.

Comment on lines +113 to +115
int constexpr unenteredAdjacentZoneSurface = -998; // allows users to enter one zone surface ("Zone")
// referencing another in adjacent zone
int constexpr unreconciledZoneSurface = -999; // interim value between entering surfaces ("Surface") and reconciling
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Somewhat gratuitous name changes to lower case to help reveal where these flags get used.

for (int SurfNum = 1; SurfNum <= FirstTotalSurfaces; ++SurfNum) {
auto &surfTemp = state.dataSurfaceGeometry->SurfaceTmp(SurfNum);
if (surfTemp.ExtBoundCond != UnenteredAdjacentZoneSurface) continue;
if ((surfTemp.ExtBoundCond != unenteredAdjacentZoneSurface) && (surfTemp.ExtBoundCond != unenteredAdjacentSpaceSurface)) continue;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For both the zone and space BC, need to add the new companion surface.

++CurNewSurf;
// Debug write(outputfiledebug,*) ' adding surface=',curnewsurf
state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf) = state.dataSurfaceGeometry->SurfaceTmp(SurfNum);
auto &newSurf = state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Lots of diffs here just due to the new shortcut for newSurf.

Comment on lines +1215 to +1218
newSurf.spaceNum = Found;
int zoneNum = state.dataHeatBal->space(Found).zoneNum;
newSurf.Zone = zoneNum;
newSurf.ZoneName = state.dataHeatBal->Zone(zoneNum).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.

For space BC, set spaceNum here and locate the zone for that space.
The remaining changes in this function are just from the newSurf shortcut.

Copy link
Member

Choose a reason for hiding this comment

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

newSurf shortcut is a worthwhile cleanup for sure.

This is a message to anyone, not just you. If you want to do these renaming changes, but they are going to cause lots of code diffs, feel free to fix them all up quickly in their own branch, and we can get it merged quickly so you can then make your targeted changes in a more compact PR.

In this case, it's not even close to worth doing that, it's just a few dozen extra lines changed. So just noting it.

Copy link
Member

Choose a reason for hiding this comment

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

And it would actually be nice if you could add a pattern match on GitHub's UI to ignore some changes. You can already ignore whitespace-only changes, so the capability is somewhat in place. If you could just say "ignore any changes that are purely from "state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf)" to "newSurf", that would be incredible.

FWIW I think they are using the --ignore-all-space or whatever argument with Git Diff. There are other diff arguments that could be leveraged (-G along with --pickaxe-regex). OK I'm done I'm done.

Comment on lines +2716 to 2720
} else if (thisSurf.ExtBoundCond != unreconciledZoneSurface) {
anySurfacesWithoutSpace(thisSurf.Zone) = true;
} else if (thisSurf.Name.substr(0, 3) != "iz-") {
// Only trigger a new space if the spaceless surface is not an autogenerated interzone surface
anySurfacesWithoutSpace(thisSurf.Zone) = true;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Without breaking other situations where a surface has no space assigned, set the appropriate flags so that an autogenerated surface with the Zone BC gets assigned to an appropriate space.

Copy link
Member

Choose a reason for hiding this comment

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

So you don't need an else block anymore at all?

Comment on lines 2759 to +2774
thisSurf.spaceNum = lastSpaceForZone;
if ((thisSurf.ExtBoundCond == unreconciledZoneSurface) && (thisSurf.Name.substr(0, 3) == "iz-")) {
if (state.dataHeatBal->Zone(thisSurf.Zone).numSpaces > 1) {
// Only trigger warning if the spaceless surface is an autogenerated interzone surface
ShowWarningError(state,
format("{}Surface=\"{}\" has Outside Boundary Condition=Zone, but Zone=\"{}\" has more than 1 Space.",
RoutineName,
thisSurf.Name.substr(3),
thisSurf.ZoneName));
ShowContinueError(state,
format("Auto-generated surface=\"{}\" will be assigned to Space=\"{}\"",
thisSurf.Name,
state.dataHeatBal->space(thisSurf.spaceNum).Name));
ShowContinueError(state, "Use Outside Boundary Condition = Space to specify the exact Space for the outside boundary.");
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

After all of the spaces have been set up, every surface is already assigned to a zone, but some or all surfaces may not be assigned to a space yet. The existing logic assigns the last space in the zone. That logic remains the same here.

But if the surface was autogenerated using the Zone BC, but the other side zone has more than one space, a warning is issued, because the desired space is ambiguous.

Copy link
Member

Choose a reason for hiding this comment

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

I think I'm tracking this. And seems reasonable to assume that and emit a warning.

Comment on lines +3881 to +3882
if (Found == 0) {
ShowSevereError(state,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Severe error is space BC is specified, but the other side space name is not found.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, reasonable.

EXPECT_FALSE(thisSG->SurfaceTmp(8).HeatTransSurf);
EXPECT_TRUE(thisSG->SurfaceTmp(8).ExtSolar);
}
TEST_F(EnergyPlusFixture, SurfaceGeometry_ZoneOutsideBC_SpacesNotInput)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

3 new unit test to exercise various combinations of zone and space BC.

Copy link
Member

Choose a reason for hiding this comment

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

Excellence.

@mjwitte
Copy link
Contributor Author

mjwitte commented Feb 5, 2025

Need to test that this works for cases where the surface is adjacent to the same zone/space, such as a middle floor that's multiplied. (comment from tech call on Jan 22)

  • Tested with modified version of MultiStory.idf where all of the adiabatic surfaces in the Middle floor zones were set to use the Zone boundary condition using the same zone that contains the surface. This changes the results from the base file due to more surfaces in the model, but the result is the same for both develop and this branch. This also introduces this warning:
   ** Warning ** GetSurfaceData: CAUTION -- Interspace surfaces are occurring in the same space(s).
   **   ~~~   ** ...use Output:Diagnostics,DisplayExtraWarnings; to show more details on individual occurrences.
  • Then added a space for Mid Center Space and assigned all surfaces to Mid Center Space, keeping the outside BC as Zone, and again with outside BC as Space (Mid Center Space). No change in results. So I think this is working as expected.

TestMiddleFloorSameZoneSpace.zip

Copy link
Member

@Myoldmopar Myoldmopar left a comment

Choose a reason for hiding this comment

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

Minor comments, but this looks great. I'll look locally regarding my comment about the now-deleted else. I'm assuming you have the logic in place there, and it just caught me off guard in review. Anyway, I'll test locally and confirm things.

int constexpr UnenteredAdjacentZoneSurface = -998; // allows users to enter one zone surface ("Zone")
// referencing another in adjacent zone
int constexpr UnreconciledZoneSurface = -999; // interim value between entering surfaces ("Surface") and reconciling
int constexpr unenteredAdjacentSpaceSurface = -997; // allows users to enter one zone surface ("Space")
Copy link
Member

Choose a reason for hiding this comment

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

Seems ripe for an enum instead of hardcoded values, but there may be a reason that isn't ideal here. Either way this doesn't have to hold up for it.

Comment on lines +1215 to +1218
newSurf.spaceNum = Found;
int zoneNum = state.dataHeatBal->space(Found).zoneNum;
newSurf.Zone = zoneNum;
newSurf.ZoneName = state.dataHeatBal->Zone(zoneNum).Name;
Copy link
Member

Choose a reason for hiding this comment

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

newSurf shortcut is a worthwhile cleanup for sure.

This is a message to anyone, not just you. If you want to do these renaming changes, but they are going to cause lots of code diffs, feel free to fix them all up quickly in their own branch, and we can get it merged quickly so you can then make your targeted changes in a more compact PR.

In this case, it's not even close to worth doing that, it's just a few dozen extra lines changed. So just noting it.

Comment on lines +1215 to +1218
newSurf.spaceNum = Found;
int zoneNum = state.dataHeatBal->space(Found).zoneNum;
newSurf.Zone = zoneNum;
newSurf.ZoneName = state.dataHeatBal->Zone(zoneNum).Name;
Copy link
Member

Choose a reason for hiding this comment

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

And it would actually be nice if you could add a pattern match on GitHub's UI to ignore some changes. You can already ignore whitespace-only changes, so the capability is somewhat in place. If you could just say "ignore any changes that are purely from "state.dataSurfaceGeometry->SurfaceTmp(CurNewSurf)" to "newSurf", that would be incredible.

FWIW I think they are using the --ignore-all-space or whatever argument with Git Diff. There are other diff arguments that could be leveraged (-G along with --pickaxe-regex). OK I'm done I'm done.

Comment on lines +2716 to 2720
} else if (thisSurf.ExtBoundCond != unreconciledZoneSurface) {
anySurfacesWithoutSpace(thisSurf.Zone) = true;
} else if (thisSurf.Name.substr(0, 3) != "iz-") {
// Only trigger a new space if the spaceless surface is not an autogenerated interzone surface
anySurfacesWithoutSpace(thisSurf.Zone) = true;
Copy link
Member

Choose a reason for hiding this comment

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

So you don't need an else block anymore at all?

Comment on lines 2759 to +2774
thisSurf.spaceNum = lastSpaceForZone;
if ((thisSurf.ExtBoundCond == unreconciledZoneSurface) && (thisSurf.Name.substr(0, 3) == "iz-")) {
if (state.dataHeatBal->Zone(thisSurf.Zone).numSpaces > 1) {
// Only trigger warning if the spaceless surface is an autogenerated interzone surface
ShowWarningError(state,
format("{}Surface=\"{}\" has Outside Boundary Condition=Zone, but Zone=\"{}\" has more than 1 Space.",
RoutineName,
thisSurf.Name.substr(3),
thisSurf.ZoneName));
ShowContinueError(state,
format("Auto-generated surface=\"{}\" will be assigned to Space=\"{}\"",
thisSurf.Name,
state.dataHeatBal->space(thisSurf.spaceNum).Name));
ShowContinueError(state, "Use Outside Boundary Condition = Space to specify the exact Space for the outside boundary.");
}
}
Copy link
Member

Choose a reason for hiding this comment

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

I think I'm tracking this. And seems reasonable to assume that and emit a warning.

surfTemp.ExtBoundCond = DataSurfaces::ExternalEnvironment;
} else if (Util::SameString(s_ipsc->cAlphaArgs(ArgPointer), "Adiabatic")) {
surfTemp.ExtBoundCond = UnreconciledZoneSurface;
surfTemp.ExtBoundCond = unreconciledZoneSurface;
Copy link
Member

Choose a reason for hiding this comment

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

I will say this would look real nice as an enum instead...

tempSurface.exteriorBoundaryCondition = BC::UnreconciledZoneSurface;

Comment on lines +3881 to +3882
if (Found == 0) {
ShowSevereError(state,
Copy link
Member

Choose a reason for hiding this comment

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

Yes, reasonable.

EXPECT_FALSE(thisSG->SurfaceTmp(8).HeatTransSurf);
EXPECT_TRUE(thisSG->SurfaceTmp(8).ExtSolar);
}
TEST_F(EnergyPlusFixture, SurfaceGeometry_ZoneOutsideBC_SpacesNotInput)
Copy link
Member

Choose a reason for hiding this comment

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

Excellence.

@Myoldmopar
Copy link
Member

Yeah this looks good to go. Merging. Thanks @mjwitte !

@Myoldmopar Myoldmopar merged commit 6fe081f into develop Feb 6, 2025
9 checks passed
@Myoldmopar Myoldmopar deleted the 10697SurfaceBoundary branch February 6, 2025 15:29
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 IDDChange Code changes impact the IDD file (cannot be merged after IO freeze)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Surface with Outside Boundary Condition=Zone does not work correctly if surface is assigned to a Space

5 participants