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

#7711 - Fix crash when using both WaterHeat:HeatPump:PumpedCondenser and WaterHeater:HeatPump:WrappedCondenser #7717

Merged
merged 8 commits into from
Feb 12, 2020

Conversation

jmarrec
Copy link
Contributor

@jmarrec jmarrec commented Jan 27, 2020

Pull request overview

While in the process of fixing it:

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 IDD requires transition, transition source, rules, ExpandObjects, and IDFs must be updated, and add IDDChange label
  • If any defect files are updated to a more recent version, upload new versions here or on DevSupport
  • 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

…re both HPWH:Pumped and HPWH:Wrapped in the same container, but when querying for Wrapped we need the index as (HPWaterHeaterNum - NumPumpedCondenser)
@jmarrec jmarrec added Defect Includes code to repair a defect in EnergyPlus NotIDDChange Code does not impact IDD (can be merged after IO freeze) labels Jan 27, 2020
@jmarrec jmarrec added this to the EnergyPlus 9.3.0 milestone Jan 27, 2020
@jmarrec jmarrec self-assigned this Jan 27, 2020
Copy link
Contributor Author

@jmarrec jmarrec left a comment

Choose a reason for hiding this comment

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

Added review comments for a walkthrough of code changes

} else {
// Wrapped Condenser
DataIPShortCuts::cCurrentModuleObject = cHPWHWrappedCondenser;
HPWH.TypeNum = DataPlant::TypeOf_HeatPumpWtrHeaterWrapped;
nNumPossibleAlphaArgs = 27;
nNumPossibleNumericArgs = 10;
// Actual index of Wrapped type
HPWaterHeaterNumOfSpecificType = HPWaterHeaterNum - NumPumpedCondenser;
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 actual fix basically.

Container HPWaterHeater stores both HPWH:Pumped and HPWH:Wrapped in that order. Before fix if you had 1 HPWH:Pumped and one HPWH:Wrapped it would call getObjectItem for the wrapped one passing an index of 2, which doesn't exist in InputProcessor since there's only one object of type HPWH:WrappedCondenser, so it would crash hard.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@jmarrec thanks for the fix. Having just worked through the refactor on this file, I can attest that there are several things like this in here that need to get cleaned up.

}

int NumAlphas;
int NumNums;
int IOStat;
inputProcessor->getObjectItem(DataIPShortCuts::cCurrentModuleObject,
HPWaterHeaterNum,
HPWaterHeaterNumOfSpecificType,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Has to be an index specific to the type of object you want to get.


ASSERT_TRUE(process_idf(idf_objects));

EXPECT_TRUE(WaterThermalTanks::GetWaterThermalTankInput());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Before fix it crashes here.

Crash on WaterThermalTanks.cc:11674

energyplus_tests: /home/julien/Software/Others/EnergyPlus/third_party/ObjexxFCL/src/ObjexxFCL/Array1.hh:1172: T& ObjexxFCL::Array1< <template-parameter-1-1> >::operator()(int) [with T = EnergyPlus::WaterThermalTanks::HeatPumpWaterHeaterData]: Assertion `contains( i )' failed.
@jmarrec
Copy link
Contributor Author

jmarrec commented Jan 28, 2020

Merged #7722 (fixes #7720) in this one as it's more convenient to review.

@mitchute
Copy link
Collaborator

I verified that the unit tests pass locally. Assuming CI comes back clean, this can merge.

@mitchute
Copy link
Collaborator

CI is happy. Merging.

@mitchute mitchute merged commit 10696ef into develop Feb 12, 2020
@mitchute mitchute deleted the 7711_WaterThermalTanks_Crash branch February 12, 2020 02:18
jmarrec added a commit to NREL/OpenStudio-resources that referenced this pull request Feb 13, 2020
…an E+ bug (fixed, but not in 9.2.0, so reenable after new E+ release 9.2.0+)

cf NREL/EnergyPlus#7717
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 NotIDDChange Code does not impact IDD (can be merged after IO freeze)
Projects
None yet
7 participants