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

Fix User-input Floor Area for Zone and Space #9308

Merged
merged 12 commits into from
Mar 17, 2022
Merged

Conversation

mjwitte
Copy link
Contributor

@mjwitte mjwitte commented Mar 2, 2022

Pull request overview

  • Fixes Zone entered Floor Area not used in calculations #9302

  • Before this fix:

    • If Zone Floor Area was input, the reported Zone Floor Area was correct, but the Space Floor Areas (which default to the sum of floor surface areas) remained unchanged. Since Space Floor Area is used for all internal gains entered per floor area, this caused the internal gain levels to be incorrect.
    • If Space Floor Area was input, the reported Space Floor Area was correct, but the Zone Floor Area remained unchanged. Any calculation based on Zone Floor Area (such as default zone volume) was incorrect.
  • After this fix:

    • The calculated Space Floor Area is the sum of floor surface areas in the Space.
    • If there is a user-input Space Floor Area, this is used as the Space Floor Area and a warning is issued if it differs significantly from the calculated area.
    • The calculated Zone Floor Area is now the sum of the Space Floor Areas.
    • If there is a user-input Zone Floor Area, this is used as the Zone Floor Area, a warning is issued if it differs significantly from the calculated area, and the Space Floor Area(s) are adjusted proportionally to match.

Diffs

5ZoneEndUses is modified in this branch, Space1-1 floor area reduced from 99 to 90, Space2-2 floor area changed slightly (to match input volume/ceiling height).
Prior to this fix, the nominal levels for People and Lighting. Space1-1 has people/area, 2 lights and 2 electric equipment objects (one/area and one fixed level). With the change in floor area, the nominal level for the 3 gains that are entered per area should change, and the others should not. Without this fix, none of them changed. Now they do which then results in big diffs in eso and mtr. These table screenshots have the original 5ZoneEndUses on the left (run with develop), and the new one with this branch on the right.
image

Defect file fixed

The defect file has Zone objects with user-input floor areas and no Space objects, so Spaces are all default one-to-one with zones. Before this fix, the zone and space floor areas did not agree. Now they do. Develop is on the left, this branch on the right.
image image
image image

ToDo

  • Unit test
  • Add zone floor area inputs to an example file, 5ZoneEndUses
  • Fix the code for floor area
  • Fix total gains per area row in Zone and/or Space Summary (they don't agree)
    new issue posted Space Summary Totals for People area per person do not match the Zone Summary #9317 fix separately to avoid excess diffs here
  • Add some doc changes to Zone and Space Floor Area fields.
  • Check on Ceiling Height and Volume - there is no Space input for ceiling height or volume and it's not used at the Space level (yet)

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 Mar 2, 2022
@mjwitte mjwitte added this to the EnergyPlus 22.1 milestone Mar 2, 2022
@mjwitte
Copy link
Contributor Author

mjwitte commented Mar 3, 2022

New unit test fails in multiple places, as expected.

Changing the Space1-1 Zone Floor Area by 10% only results in small diffs for 5ZoneEndUses.

regression.5ZoneEndUsesDevice id: x86_64-MacOS-10.15-clang-11.0.0Comparing `/Users/commbldg/ci/clone_baseline/build/testfiles/5ZoneEndUses` with `/Users/commbldg/ci/clone_branch/build/testfiles/5ZoneEndUses`
[decent_ci:test_result:message] EIO diffs.
[decent_ci:test_result:message] ERR diffs.
[decent_ci:test_result:message] ESO small diffs.
[decent_ci:test_result:message] MTR small diffs.
[decent_ci:test_result:message] ZSZ small diffs.
[decent_ci:test_result:message] Table big diffs.

eio diffs show that floor areas changed in Space1-1 and Space2-2, but the number of occupants did not.

 ! <Zone Internal Gains Nominal>,Zone Name, Floor Area {m2},# Occupants,Area per Occupant {m2/person},Occupant per Area {person/m2},Interior Lighting {W/m2},Electric Load {W/m2},Gas Load {W/m2},Other Load {W/m2},Hot Water Eq {W/m2},Steam Equipment {W/m2},Sum Loads per Area {W/m2},Outdoor Controlled Baseboard Heat
- Zone Internal Gains Nominal, SPACE1-1,99.16,11.0,9.009,0.111,20.815,14.683,0.000,0.000,0.000,0.000,35.498,No
+ Zone Internal Gains Nominal, SPACE1-1,90.00,11.0,8.177,0.122,22.933,16.177,0.000,0.000,0.000,0.000,39.110,No
- Zone Internal Gains Nominal, SPACE2-1,42.74,5.0,8.547,0.117,32.011,34.070,23.400,0.000,7.020,0.000,96.502,No
+ Zone Internal Gains Nominal, SPACE2-1,42.37,5.0,8.474,0.118,32.288,34.365,23.602,0.000,7.081,0.000,97.335,No

Next step is to add the floor area fixes.

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.

Walkthru. This is ready for review.

@@ -2389,10 +2388,9 @@ namespace SurfaceGeometry {
for (int SurfNum = state.dataHeatBal->Zone(ZoneNum).HTSurfaceFirst; SurfNum <= state.dataHeatBal->Zone(ZoneNum).HTSurfaceLast;
++SurfNum) {
if (state.dataSurface->Surface(SurfNum).Class == SurfaceClass::Floor) {
state.dataHeatBal->Zone(ZoneNum).FloorArea += state.dataSurface->Surface(SurfNum).Area;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Zone floor area is now the sum of space floor areas, done later.

state.dataHeatBal->Zone(ZoneNum).HasFloor = true;
int spaceNum = state.dataSurface->Surface(SurfNum).spaceNum;
state.dataHeatBal->space(spaceNum).floorArea += state.dataSurface->Surface(SurfNum).Area;
state.dataHeatBal->space(spaceNum).calcFloorArea += state.dataSurface->Surface(SurfNum).Area;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Set the space calculated floor area as the sum of the floor surfaces in the space.

Copy link
Contributor

Choose a reason for hiding this comment

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

Off topic but I wonder what would happen if user entered calcFloorArea != user entered CeilingArea

Copy link
Contributor

Choose a reason for hiding this comment

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

I pulled this branch and reviewed there since this view is hard to follow. I don't see anything that stands out as a problem. Why are the space.calcFloorAreas summed (above) and the ZONE.CeilingArea summed (below). What if the ceiling is split by space? I would have thought the floor and ceiling calculations would be similar wrt space and zone.

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess a ceiling split by space would just be 2 ceiling surfaces in the zone so they would get summed correctly. But then that would hold true for the floor as well. Since the issue was with respect to floor area this is probably a moot point (space floor area vs zone ceiling area).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rraustad Good questions. The main focus here was getting the internal gain levels correct, since they can be specified per floor area. At the moment, state.dataHeatBal->space only has fields related to floor area, nothing yet for ceiling height, ceiling area, or volume. That's future work.

for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) {
state.dataHeatBal->space(spaceNum).calcFloorArea = state.dataHeatBal->space(spaceNum).floorArea;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

space(spaceNum).calcFloorArea has been set earlier now. The rest of this section doesn't change. User input for space floor area is used if >zero.

Comment on lines +2442 to +2443
for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) {
// Calculate zone floor area as sum of space floor areas
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now, after the space floor areas have been set (either as the sum of floor areas or the user-input space floor area), the zone calcFloorArea is the sum of the space floor areas (this is new and fixes part of the problem).

}
if (state.dataHeatBal->Zone(ZoneNum).UserEnteredFloorArea != DataGlobalConstants::AutoCalculate) {
// Check entered vs calculated
if (state.dataHeatBal->Zone(ZoneNum).UserEnteredFloorArea > 0.0) { // User entered zone floor area,
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 starts the block if the user entered a zone floor area > 0

state.dataHeatBal->Zone(ZoneNum).FloorArea = state.dataHeatBal->Zone(ZoneNum).UserEnteredFloorArea;
state.dataHeatBal->Zone(ZoneNum).HasFloor = true;

// Adjust space floor areas to match zone floor area
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If there is a user-input for zone floor area, always adjust the space floor areas proportionately to match.
As I read this, maybe this should be skipped if the zone floor area value already matches the sum of the space floor areas or within some threshold?

@@ -856,7 +856,8 @@
1, !- Type
1, !- Multiplier
2.438400269, !- Ceiling Height {m}
239.247360229; !- Volume {m3}
239.247360229, !- Volume {m3}
90.0; !- Floor Area {m2}
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 a couple of zone floor area overrides to a test suite file (since there weren't any before).

Copy link
Contributor

Choose a reason for hiding this comment

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

And a warning now shows up in 5ZoneEndUses since calculated floor area is 98.1.

@@ -8554,3 +8554,192 @@ TEST_F(EnergyPlusFixture, Use_Gross_Roof_Area_for_Averge_Height_with_Window)
EXPECT_NEAR(state->dataHeatBal->Zone(1).CeilingHeight, ceilingHeight_expected, 1e-6);
EXPECT_NE(state->dataHeatBal->Zone(1).CeilingHeight, ceilingHeight_old);
}
TEST_F(EnergyPlusFixture, SurfaceGeometry_ZoneAndSpaceAreas)
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 to cover some combinations of space and/or zone floor area inputs.

@mjwitte mjwitte requested a review from Myoldmopar March 4, 2022 20:06
@mitchute
Copy link
Collaborator

@mjwitte I'm reviewing this now. It looks like there's now one file with a merge conflict that needs to be resolved, and it's probably good to get another CI run anyway. I think it can likely go in shortly after that if nothing else pops up.

I'm happy to fix that conflict if needed, just let me know.

Copy link
Collaborator

@mitchute mitchute left a comment

Choose a reason for hiding this comment

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

Thanks for the nice detailed explanation of the issue at the top of this PR. That was super helpful.

I have one minor comment about the docs, but I've run the unit tests, and they all pass. I also ran regressions 5ZoneEndUses and I see the updated areas and new warning in the err file.

This is ready from my perspective unless you decide to do something with the docs. But regardless, this can go in right away.

@@ -27,7 +27,9 @@ \subsubsection{Inputs}\label{space-inputs-048}

\paragraph{Field: Floor Area}\label{space-field-floor-area}

Space floor area is used in many places within EnergyPlus. EnergyPlus automatically calculates the space floor area (\SI{}{\area}) from the space geometry given by the surfaces that belong to the space. If this field is 0.0, negative or \textbf{autocalculate} (the default), then the calculated space floor area will be used in subsequent calculations. If this field is positive, then it will be used as the space floor area. If this number differs significantly from the calculated space floor area a warning message will be issued.
Space floor area is used in many places within EnergyPlus. EnergyPlus automatically calculates the space floor area (\SI{}{\area}) as the total area of surfaces with Surface Type = Floor. If this field is 0.0, negative or \textbf{autocalculate} (the default), then the calculated space floor area will be used in subsequent calculations. If this field is positive, then it will be used as the space floor area. If this number differs significantly from the calculated space floor area a warning message will be issued.
Copy link
Collaborator

Choose a reason for hiding this comment

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

What does "significantly" mean in this context? Should there be a percent value or some other quantifiable metric listed here, or maybe note that DisplayExtraWarnings can be used to show the issues?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I modified this and then got carried away changing the warning messages. They now read:

   ** Warning ** GetSurfaceData: Entered Zone Floor Area(s) differ more than 5% from the sum of the Space Floor Area(s).
   **   ~~~   ** ...use Output:Diagnostics,DisplayExtraWarnings; to show more details on individual zones.

   ** Warning ** GetSurfaceData: Entered Floor Area for Zone="SPACE1-1" is 10.2% different from the sum of the Space Floor Area(s).
   **   ~~~   ** Entered Zone Floor Area=90.00, Sum of Space Floor Area(s)=99.16
   **   ~~~   ** Entered Zone Floor Area will be used and Space Floor Area(s) will be adjusted proportionately.

   ** Warning ** GetSurfaceData: Entered Space Floor Area(s) differ more than 5% from calculated Space Floor Area(s).
   **   ~~~   ** ...use Output:Diagnostics,DisplayExtraWarnings; to show more details on individual Spaces.

   ** Warning ** GetSurfaceData: Entered Floor Area for Space="SPACE 1" is 24.0% different from the calculated Floor Area.
   **   ~~~   ** Entered Space Floor Area=80.00, Calculated Space Floor Area=99.16, entered Floor Area will be used.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks, @mjwitte. Those are perfect. I think this is ready once CI settles down.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Grrr. The doc change needs attention. I didn't escape the percent signs. Didn't know I needed to.

EXPECT_EQ(state->dataHeatBal->space(2).Name, "SPACE 1B");
EXPECT_NEAR(state->dataHeatBal->space(2).userEnteredFloorArea, DataGlobalConstants::AutoCalculate, 0.001);
EXPECT_NEAR(state->dataHeatBal->space(2).calcFloorArea, 2.0, 0.001);
EXPECT_NEAR(state->dataHeatBal->space(2).floorArea, 20.0, 0.001);
Copy link
Contributor

Choose a reason for hiding this comment

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

These space areas are proportional to the user entered zone floor area of 30.

EXPECT_NEAR(state->dataHeatBal->Zone(1).CalcFloorArea, 3.0, 0.001);
EXPECT_NEAR(state->dataHeatBal->Zone(1).FloorArea, 30.0, 0.001);
Real64 zone1Area = state->dataHeatBal->space(1).floorArea + state->dataHeatBal->space(2).floorArea;
EXPECT_NEAR(state->dataHeatBal->Zone(1).FloorArea, zone1Area, 0.001);
Copy link
Contributor

Choose a reason for hiding this comment

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

space and zone areas match

EXPECT_EQ(state->dataHeatBal->space(3).Name, "SPACE 3");
EXPECT_NEAR(state->dataHeatBal->space(3).userEnteredFloorArea, 5.0, 0.001);
EXPECT_NEAR(state->dataHeatBal->space(3).calcFloorArea, 1.0, 0.001);
EXPECT_NEAR(state->dataHeatBal->space(3).floorArea, 5.0, 0.001);
Copy link
Contributor

Choose a reason for hiding this comment

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

Zone 3 reversed which floor area was blank compared to zone 1 and areas still match

EXPECT_EQ(state->dataHeatBal->space(4).Name, "ZONE 2");
EXPECT_NEAR(state->dataHeatBal->space(4).userEnteredFloorArea, DataGlobalConstants::AutoCalculate, 0.001);
EXPECT_NEAR(state->dataHeatBal->space(4).calcFloorArea, 1.0, 0.001);
EXPECT_NEAR(state->dataHeatBal->space(4).floorArea, 20.0, 0.001);
Copy link
Contributor

Choose a reason for hiding this comment

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

And if space is not entered for a zone, areas still match.

Copy link
Contributor

@rraustad rraustad left a comment

Choose a reason for hiding this comment

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

Looks ready to merge.

@mitchute
Copy link
Collaborator

Github is partially down, which is likely causing our NREL CI machines to be down. I merged develop into this branch locally and reran tests. Everything looks consistent with previous CI results. I'll take a chance and merge this now before CI has caught up. We can address any uncaught issues later if something pops up.

@mitchute mitchute merged commit 32ed589 into develop Mar 17, 2022
@mitchute mitchute deleted the fix9302ZoneFloorArea branch March 17, 2022 15:44
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Zone entered Floor Area not used in calculations
8 participants