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 Zone Mixing with Spaces and Space Part 4 Followup #10669

Merged
merged 31 commits into from
Sep 10, 2024

Conversation

mjwitte
Copy link
Contributor

@mjwitte mjwitte commented Aug 20, 2024

Pull request overview

  • Fixes ZoneCrossMixing and ZoneMixing vector error when source is a zone and space heat balance is active #10670 plus extended unit test.
  • Partially address Space for Infiltration Ventilation and Mixing followup comments #9587 (some parts would be I/O changes so they have to wait).
    • Remove CalcFloorArea from zone and space structs, it's only used locally in GetSurfaceData.
    • Consolidate AirflowSpec enums.
  • Unit tests for zone and space sizing.
  • Engineering Ref additions for zone and space sizing.
  • Add support for SpaceHVAC:ZoneEquipmentMixer/Splitter sizing option PerimeterLength. Previously it generated a fatal error message, because space perimeter length was not an available property.
  • Use actual space volume in calcOAFlowRate (instead of floor area ratio of zone volume).
  • Extend zone equipment enums to cover all types of low temp radiant and heat pump water heaters.
  • Fix space NonAirSystemResponse and latent during sizing.

Diffs

There are some minor diffs in space sizing results (eio and table) for 5ZoneAirCooledWithSpaceHeatBalance and 5ZoneAirCooledWithSpacesHVAC.

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 the DoNotPublish Includes changes that shouldn't be reported in the changelog label Aug 20, 2024
HeatBalanceAirManager::GetSimpleAirModelInputs(*state, ErrorsFound);
compare_err_stream("", true);
EXPECT_FALSE(ErrorsFound);
SimulationManager::ManageSimulation(*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.

Extended this unit test to do an actual simulation so that it tests #10670

Running the revised unit test with develop gives a vector error:

image

Because fromSpaceIndex=0 here:

image

Copy link
Member

Choose a reason for hiding this comment

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

Great!

@mjwitte mjwitte changed the title Space Part 4 Followup Space Part 4 Followup and Fix Zone Mixing with Spaces Aug 29, 2024
@mjwitte mjwitte added Defect Includes code to repair a defect in EnergyPlus and removed DoNotPublish Includes changes that shouldn't be reported in the changelog labels Aug 29, 2024
@mjwitte mjwitte changed the title Space Part 4 Followup and Fix Zone Mixing with Spaces Fix Zone Mixing with Spaces and Space Part 4 Followup Aug 30, 2024
@mjwitte mjwitte marked this pull request as ready for review September 4, 2024 18:17
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. There are still some more space-related ToDo items lurking in the code, but this has enough in it for now. Another followup PR( or two will follow, whether they make it in v24.2 or after.

@@ -458,6 +458,7 @@ namespace DataHeatBalance {
Real64 Volume = Constant::AutoCalculate; // Volume entered by user [m3] or calculated
Real64 ExtGrossWallArea = 0.0; // Exterior Wall Area for Zone (Gross)
Real64 ExteriorTotalSurfArea = 0.0; // Total surface area of all exterior surfaces for Zone
Real64 extPerimeter = 0.0; // Total exposed perimeter (sum of width of exterior walls)
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 exterior perimeter to use for space equipment sizing.

@@ -472,7 +473,6 @@ namespace DataHeatBalance {
int spaceTypeNum = 0; // Points to spaceType for this space
EPVector<std::string> tags; // Optional tags for reporting
EPVector<int> surfaces; // Pointers to surfaces in this space
Real64 calcFloorArea = 0.0; // Calculated floor area used for this 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.

Remove calcFloorArea from state. It's only used in one function, so it's local there now.

Copy link
Member

Choose a reason for hiding this comment

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

Always love to see this type of removal! Makes me want to do a little scripting and sniff out all state variables that are only used in one or two locations and get them outta there.

nomTotOccupants = state.dataHeatBal->space(spaceNum).TotOccupants;
auto &thisSpace = state.dataHeatBal->space(spaceNum);
floorArea = thisSpace.FloorArea;
volume = thisSpace.Volume;
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 volume is known, so use it directly now.

Copy link
Member

Choose a reason for hiding this comment

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

Excellent. There have been API requests around zone volume, I will try to keep in mind that space volume could go along with it. Anyway, that's for another day.

Comment on lines -129 to +135
"ZONEHVAC:LOWTEMPERATURERADIANT:VARIABLEFLOW", // LowTempRadiant
"ZONEHVAC:LOWTEMPERATURERADIANT:CONSTANTFLOW", // LowTempRadiantConstFlow
"ZONEHVAC:LOWTEMPERATURERADIANT:VARIABLEFLOW", // LowTempRadiantVarFlow
"ZONEHVAC:LOWTEMPERATURERADIANT:ELECTRIC", // LowTempRadiantElectric
"FAN:ZONEEXHAUST", // ExhaustFan
"HEATEXCHANGER:AIRTOAIR:FLATPLATE", // HeatExchanger
"WATERHEATER:HEATPUMP:PUMPEDCONDENSER", // HeatPumpWaterHeater
"WATERHEATER:HEATPUMP:PUMPEDCONDENSER", // HeatPumpWaterHeaterPumpedCondenser
"WATERHEATER:HEATPUMP:WRAPPEDCONDENSER", // HeatPumpWaterHeaterWrappedCondenser
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 string arrays and its enum were missing a few flavors of equipment which led to some awkward input processing elsewhere to squash them into a single enum for later use in simulation case blocks.

thisZoneEquipList.EquipTypeName(ZoneEquipTypeNum) == "ZONEHVAC:LOWTEMPERATURERADIANT:ELECTRIC") {
thisZoneEquipList.EquipType(ZoneEquipTypeNum) = ZoneEquipType::LowTemperatureRadiant;
} else if (thisZoneEquipList.EquipTypeName(ZoneEquipTypeNum) == "WATERHEATER:HEATPUMP:WRAPPEDCONDENSER") {
thisZoneEquipList.EquipType(ZoneEquipTypeNum) = DataZoneEquipment::ZoneEquipType::HeatPumpWaterHeater;
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 isn't needed anymore.

Copy link
Member

Choose a reason for hiding this comment

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

Nice!

@@ -558,3 +559,3733 @@ TEST_F(EnergyPlusFixture, SizingManager_OverrideAvgWindowInSizing)
EXPECT_EQ(state->dataGlobal->NumOfTimeStepInHour, 1);
EXPECT_EQ(state->dataSize->NumTimeStepsInAvg, 1);
}
TEST_F(EnergyPlusFixture, SizingManager_ZoneSizing_Coincident_1x)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

8 new zone/space sizing unit tests to test coincident vs noncoincident and multipliers. They're very similar, but I couldn't figure out a way to reset everything and use the same idf snippet and make a few small changes then re-rerun sizing.

EXPECT_EQ("N/A", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClDesDay, "ZONE 1"));
EXPECT_EQ("16:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClPkTime, "ZONE 1"));
}
TEST_F(EnergyPlusFixture, SizingManager_ZoneSizing_Coincident_NonAir_1x_NoLatent)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Expect the same sizing results for the case of a non-air system (e.g. baseboard with no air terminals). I learned that zone sizing uses the zone inlet node(s) from ZoneHVAC:EquipmentConnections to carry info for sizing, so if there aren't any, it uses other variables to pass the load.

OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClDesDay, "ZONE 1"));
EXPECT_EQ("7/21 16:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClPkTime, "ZONE 1"));
}
TEST_F(EnergyPlusFixture, SizingManager_ZoneSizing_Coincident_NonAir_10x_NoLatent)
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 make sure non-air works correctly with a multiplier.

OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClDesDay, "ZONE 1"));
EXPECT_EQ("7/21 16:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClPkTime, "ZONE 1"));
}
TEST_F(EnergyPlusFixture, SizingManager_ZoneSizing_Coincident_NonAir_10x_NoLatent_NoSpaceHB)
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 with space heat balance off.

OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClDesDay, "ZONE 1"));
EXPECT_EQ("7/21 16:00:00", OutputReportPredefined::RetrievePreDefTableEntry(*state, state->dataOutRptPredefined->pdchZnClPkTime, "ZONE 1"));
}
TEST_F(EnergyPlusFixture, SizingManager_ZoneSizing_Coincident_NonAir_10x_Latent_SpaceHB)
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 finally, add a big latent load to one space to get a different cooling sizing result.

Copy link

github-actions bot commented Sep 4, 2024

⚠️ Regressions detected on macos-14 for commit 22c37ed

Regression Summary
  • EIO: 2
  • Table Big Diffs: 1
  • Table Small Diffs: 1

Copy link

github-actions bot commented Sep 5, 2024

⚠️ Regressions detected on macos-14 for commit 932caf4

Regression Summary
  • EIO: 2
  • Table Big Diffs: 1
  • Table Small Diffs: 1

Copy link

github-actions bot commented Sep 6, 2024

⚠️ Regressions detected on macos-14 for commit e979e37

Regression Summary
  • EIO: 2
  • Table Big Diffs: 1
  • Table Small Diffs: 1

@mjwitte mjwitte added this to the EnergyPlus 24.2 milestone Sep 7, 2024
Copy link

github-actions bot commented Sep 7, 2024

⚠️ Regressions detected on macos-14 for commit 389ae1c

Regression Summary
  • EIO: 2
  • Table Big Diffs: 1
  • Table Small Diffs: 1

@mjwitte
Copy link
Contributor Author

mjwitte commented Sep 8, 2024

@Myoldmopar This is really ready for review now, unit tests are passing on all platforms.

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.

This looks awesome. Some really, really great refactors along with the actual fixes. I'll double check it, but no red flags here.

@@ -472,7 +473,6 @@ namespace DataHeatBalance {
int spaceTypeNum = 0; // Points to spaceType for this space
EPVector<std::string> tags; // Optional tags for reporting
EPVector<int> surfaces; // Pointers to surfaces in this space
Real64 calcFloorArea = 0.0; // Calculated floor area used for this space
Copy link
Member

Choose a reason for hiding this comment

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

Always love to see this type of removal! Makes me want to do a little scripting and sniff out all state variables that are only used in one or two locations and get them outta there.

nomTotOccupants = state.dataHeatBal->space(spaceNum).TotOccupants;
auto &thisSpace = state.dataHeatBal->space(spaceNum);
floorArea = thisSpace.FloorArea;
volume = thisSpace.Volume;
Copy link
Member

Choose a reason for hiding this comment

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

Excellent. There have been API requests around zone volume, I will try to keep in mind that space volume could go along with it. Anyway, that's for another day.

thisZoneEquipList.EquipTypeName(ZoneEquipTypeNum) == "ZONEHVAC:LOWTEMPERATURERADIANT:ELECTRIC") {
thisZoneEquipList.EquipType(ZoneEquipTypeNum) = ZoneEquipType::LowTemperatureRadiant;
} else if (thisZoneEquipList.EquipTypeName(ZoneEquipTypeNum) == "WATERHEATER:HEATPUMP:WRAPPEDCONDENSER") {
thisZoneEquipList.EquipType(ZoneEquipTypeNum) = DataZoneEquipment::ZoneEquipType::HeatPumpWaterHeater;
Copy link
Member

Choose a reason for hiding this comment

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

Nice!

Comment on lines +2166 to +2168
// Timestep at max
zoneCFS.TimeStepNumAtHeatMax =
1 + std::distance(zoneCFS.HeatLoadSeq.begin(), std::max_element(zoneCFS.HeatLoadSeq.begin(), zoneCFS.HeatLoadSeq.end()));
Copy link
Member

Choose a reason for hiding this comment

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

Now that is a good use of standard library.

HeatBalanceAirManager::GetSimpleAirModelInputs(*state, ErrorsFound);
compare_err_stream("", true);
EXPECT_FALSE(ErrorsFound);
SimulationManager::ManageSimulation(*state);
Copy link
Member

Choose a reason for hiding this comment

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

Great!

Copy link

⚠️ Regressions detected on macos-14 for commit 6b11335

Regression Summary
  • EIO: 2
  • Table Big Diffs: 1
  • Table Small Diffs: 1

@Myoldmopar
Copy link
Member

CI still the same, and everything is happy with develop pulled in. Thanks @mjwitte, dropping this in now.

@Myoldmopar Myoldmopar merged commit 0414064 into develop Sep 10, 2024
6 of 10 checks passed
@Myoldmopar Myoldmopar deleted the SpacePart4Followup branch September 10, 2024 13:22
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.

ZoneCrossMixing and ZoneMixing vector error when source is a zone and space heat balance is active
8 participants