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 HVAC radiant heat gain with CondFD #10310

Merged
merged 12 commits into from
Jan 5, 2024
Merged

Conversation

mjwitte
Copy link
Contributor

@mjwitte mjwitte commented Nov 30, 2023

Pull request overview

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 Nov 30, 2023
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.

@@ -89,6 +89,15 @@ namespace DataHeatBalFanSys {
int DualPMVErrIndex = 0; // Dual PMV setpoint error index
};

struct SurfQRadFromHVACData
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 struct to hold the old Array1Ds for SurfQHTRadSys, SurfQHWBaseboard, etc.

Copy link
Member

Choose a reason for hiding this comment

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

:) :) :)

Comment on lines -701 to -702
bool anySurfacesWithoutSpace = false; // True if any surfaces in a zone do not have a space assigned in input
bool anySurfacesWithSpace = false; // True if any surfaces in a zone have a space assigned in input
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unrelated to the main defect, but moved these out of state.

Copy link
Member

Choose a reason for hiding this comment

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

👍

Comment on lines +1452 to +1454
std::vector<int> allInsideSourceSurfaceList; // List of all surfaces with SurfaceProperty:HeatBalanceSourceTerm for inside face
std::vector<int> allOutsideSourceSurfaceList; // List of all surfaces with SurfaceProperty:HeatBalanceSourceTerm for outside face
std::vector<int> allGetsRadiantHeatSurfaceList; // List of all surfaces that receive radiant HVAC output
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 surface lists for special cases.

@@ -409,6 +409,7 @@ namespace ElectricBaseboardRadiator {
}
if (elecBaseboard.SurfacePtr(SurfNum) != 0) {
state.dataSurface->surfIntConv(elecBaseboard.SurfacePtr(SurfNum)).getsRadiantHeat = true;
state.dataSurface->allGetsRadiantHeatSurfaceList.emplace_back(elecBaseboard.SurfacePtr(SurfNum));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Example of building the allGetsRadiantHeatSurfaceList vector.

Comment on lines -908 to +912
state.dataHeatBalFanSys->SurfQElecBaseboard = 0.0;
for (auto &elecBaseboard : state.dataElectBaseboardRad->ElecBaseboard) {
for (int radSurfNum = 1; radSurfNum <= elecBaseboard.TotSurfToDistrib; ++radSurfNum) {
int surfNum = elecBaseboard.SurfacePtr(radSurfNum);
state.dataHeatBalFanSys->surfQRadFromHVAC(surfNum).ElecBaseboard = 0.0;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Instead of zeroing this for all surfaces, only need to touch the surfaces that actually receive radiant heat from electric baseboards. Similar changes for the other four equipment types (chilled panel, HW baseboard, Steam baseboard, high temp radiant).

@@ -7571,11 +7568,12 @@ void CalcHeatBalanceInsideSurf(EnergyPlusData &state,
state.dataHeatBalSurfMgr->calcHeatBalInsideSurEnvrnFlag = true;
}

sumSurfQdotRadHVAC(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.

This is the main fix for the defect. A new function to gather all of the radiant impacts on the pertinent surfaces. One call here no matter the surface type or the heat transfer algorithm.

Copy link
Member

Choose a reason for hiding this comment

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

👍

EnergyPlus::ScheduleManager::GetCurrentScheduleValue(state, state.dataSurface->Surface(SurfNum).InsideHeatSourceTermSchedule);
}
}
for (int surfNum : state.dataSurface->allInsideSourceSurfaceList) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Streamline inside source.

Comment on lines -7800 to -7801
if (state.dataHeatBalSurf->AnyRadiantSystems(SurfNum))
state.dataHeatBalSurf->SurfQdotRadHVACInPerArea(SurfNum) = GetSurfQdotRadHVACInPerArea(state, SurfNum);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Replaced with new call to sumSurfQdotRadHVAC, here and several other places.

return state.dataHeatBalFanSys->SurfQHTRadSys(SurfNum) + state.dataHeatBalFanSys->SurfQHWBaseboard(SurfNum) +
state.dataHeatBalFanSys->SurfQSteamBaseboard(SurfNum) + state.dataHeatBalFanSys->SurfQElecBaseboard(SurfNum) +
state.dataHeatBalFanSys->SurfQCoolingPanel(SurfNum);
for (int surfNum : state.dataSurface->allGetsRadiantHeatSurfaceList) {
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 function sumSurfQdotRadHVAC sums radiant fluxes only for pertinent surfaces.

Comment on lines +2854 to +2855
EPVector<bool> anySurfacesWithSpace; // True if any surfaces in a zone do not have a space assigned in input
EPVector<bool> anySurfacesWithoutSpace; // True if any surfaces in a zone have a space assigned in input
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved from state. Not related to the defect.

Copy link
Member

Choose a reason for hiding this comment

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

❤️

@mjwitte mjwitte marked this pull request as ready for review December 15, 2023 22:22
@mjwitte
Copy link
Contributor Author

mjwitte commented Dec 15, 2023

Defect file results, before, Surface Inside Face System Radiation Heat Gain Rate is always zero.

image

And with this branch, now there are values.
image

@Myoldmopar Myoldmopar self-assigned this Dec 20, 2023
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 is wonderful. Quite a few small cleanups to go along with the actual defect fix. I am getting a little blurry about all the different lists of surfaces, but I understand it is helping the code move in the right direction. I would be happy to brainstorm where these should go in the future to avoid the list becoming excessive, but I am not complaining about where it is at.

I'll go ahead and confirm CI, and build/test locally, and see if this can go in.

@@ -89,6 +89,15 @@ namespace DataHeatBalFanSys {
int DualPMVErrIndex = 0; // Dual PMV setpoint error index
};

struct SurfQRadFromHVACData
Copy link
Member

Choose a reason for hiding this comment

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

:) :) :)

Comment on lines -701 to -702
bool anySurfacesWithoutSpace = false; // True if any surfaces in a zone do not have a space assigned in input
bool anySurfacesWithSpace = false; // True if any surfaces in a zone have a space assigned in input
Copy link
Member

Choose a reason for hiding this comment

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

👍

thisSurfQRadFromHVAC.SteamBaseboard = 0.0;
thisSurfQRadFromHVAC.ElecBaseboard = 0.0;
thisSurfQRadFromHVAC.CoolingPanel = 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 fine as is. But if this is actually zeroing out every member variable, it could be nice to include a "reset" function on the struct that zeroes out all the members there. It's not functionally different, but could future proof things. If we add more member variables to the struct in the future, having the reset function right there in the struct would make it easier to remember to initialize them. Don't sweat it now unless there are more changes needed.

@@ -7571,11 +7568,12 @@ void CalcHeatBalanceInsideSurf(EnergyPlusData &state,
state.dataHeatBalSurfMgr->calcHeatBalInsideSurEnvrnFlag = true;
}

sumSurfQdotRadHVAC(state);
Copy link
Member

Choose a reason for hiding this comment

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

👍

Comment on lines +2854 to +2855
EPVector<bool> anySurfacesWithSpace; // True if any surfaces in a zone do not have a space assigned in input
EPVector<bool> anySurfacesWithoutSpace; // True if any surfaces in a zone have a space assigned in input
Copy link
Member

Choose a reason for hiding this comment

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

❤️

@Myoldmopar
Copy link
Member

CI was totally happy here when it ran. I built and tested locally and it's happy. Let's get this merged in as well. Thanks @mjwitte !

@Myoldmopar Myoldmopar merged commit 5436820 into develop Jan 5, 2024
15 checks passed
@Myoldmopar Myoldmopar deleted the SysRadHeatGain10304 branch January 5, 2024 17:32
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.

Surface Inside Face System Radiation Heat Gain is always zero for ConductionFiniteDifference
7 participants