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

Removal of Unused Fuel Factor Inputs #9581

Merged
merged 7 commits into from
Aug 4, 2022
Merged

Conversation

RKStrand
Copy link
Contributor

@RKStrand RKStrand commented Aug 2, 2022

Pull request overview

  • Fixes FuelFactors: Units of Measures and Energy per Unit Factor are never used #9493
  • Two things were corrected here. First, two input fields in the FuelFactors input syntax were never being used. These were removed requiring code, IDD, and many IDF changes. This was completed. Also a typo was noted in code for another, related input. This was also corrected and a unit test added to verify that this is working properly. No differences in output were noted in the iteration test suite.

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

This commit eliminates the two parameters that are not used in the FuelFactors input.  This includes code changes, IDD changes, IDF changes, transition updates, and one documentation change.  Still yet to do: create a unit test and add a table to the IO Ref for source to site ratios from EPA.
Unit test was added to test the fix to the indexing problem.  Also, a table of EPA data was added to the IORef.  This completes the requirements for this defect.
More files that have FuelFactors inputs that needed to be adjusted (these were in datasets).
Missed some input files in the Performance folder that had FuelFactors in it that were causing linux to have errors.  This should fix the problems.
@RKStrand RKStrand added Defect Includes code to repair a defect in EnergyPlus IDDChange Code changes impact the IDD file (cannot be merged after IO freeze) labels Aug 2, 2022
@RKStrand RKStrand added this to the EnergyPlus 22.2 IOFreeze milestone Aug 2, 2022
@RKStrand RKStrand self-assigned this Aug 2, 2022
@RKStrand RKStrand requested a review from jmarrec August 2, 2022 13:20
@@ -246,7 +246,7 @@ void GetPollutionFactorInput(EnergyPlusData &state)
}

// If Steam Conversion Efficiency defined by the User is negative or zero then a default of 25% will be assigned.
if (state.dataIPShortCut->rNumericArgs(1) > 0.0) {
if (state.dataIPShortCut->rNumericArgs(3) > 0.0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I've never looked at this module before. Sacre bleu! It has about (at least) 10X more code than it needs to. This entire logic can be implemented using loops over fuels and pollutants. Instead it has copies of the code (with one parameter changed) for each fuel and pollutant and sometimes for the cross product of each loop and pollutant. Not sure who wants to take this on, but this will probably be the most satisfying couple of hours you will spend with EnergyPlus source code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@amirroth yes, it was painful and I had similar thoughts. Probably would be very satisfying work. Can we make it a new defect? I’m willing to take a whack at it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@RKStrand, sure. Go for it!

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 seems great and ready to go. I'll pull in develop and test locally, but assuming everything is clean, this can go right in.

ErrorsFound);
}
Pollution.OtherFuel2Coef.NucHi = state.dataIPShortCut->rNumericArgs(17);
Pollution.OtherFuel2Coef.NucLo = state.dataIPShortCut->rNumericArgs(17);
Copy link
Member

Choose a reason for hiding this comment

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

Changes here seem minimal, and fine. It looks like lots of changes, but obviously it's just removing the unused field input processing.

nodiff=.false.
OutArgs(1)=InArgs(1)
OutArgs(2:CurArgs-2)=InArgs(4:CurArgs)
CurArgs = CurArgs - 2
Copy link
Member

Choose a reason for hiding this comment

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

Simple and perfect.

The second and third input parameters for the FuelFactors input syntax were eliminated because they were never used in the program. Everything else that comes after it is simply shifted forward.

Link to the Issue in GitHub: [FuelFactors: Units of Measures and Energy per Unit Factor are never used](https://github.com/NREL/EnergyPlus/issues/9493)
Copy link
Member

Choose a reason for hiding this comment

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

Great, clear, thanks!


// The get routine should rest the steam conversion efficiency to the default value of 0.25.
// Previously because of a typo, it would reset it to the input value of zero (or even a negative number).
ASSERT_NEAR(state->dataPollutionModule->Pollution.SteamConvEffic, ExpectedOutput, AllowedTolerance);
Copy link
Member

Choose a reason for hiding this comment

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

Very nice test!

@Myoldmopar
Copy link
Member

Oh right, this is the Clang format one. I'll pull in develop and clean that up, then test and push, then merge, because this is ready after that.

@Myoldmopar
Copy link
Member

Everything is super happy, and I cleaned up the clang format concerns. I'll merge this momentarily once GHA picks up the commit, but before Decent gets to it.

@Myoldmopar Myoldmopar merged commit 9d12265 into develop Aug 4, 2022
@Myoldmopar Myoldmopar deleted the 9493FuelFactorUnusedInputs branch August 4, 2022 14:50
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.

FuelFactors: Units of Measures and Energy per Unit Factor are never used
7 participants