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

Correction of Generic Contaminant Handling in Some Situations #10516

Merged
merged 6 commits into from
May 28, 2024

Conversation

RKStrand
Copy link
Contributor

@RKStrand RKStrand commented May 22, 2024

Pull request overview

  • Fixes Make sure that CO2 and GenContam are handled by all components #10473
  • While development team members were working on other defects, it was noticed that there were a couple of places in the code where the generic contaminant information was not being handled properly, i.e. it wasn't being updated properly. This pull request fixes this issue and now all code should be handling generic contaminant updating properly. As part of this fix, a thorough check of the entire code was made to ensure that both CO2 and generic contaminant code was present in all locations. During that check, an unnecessary/misplaced line of code was found and eliminated as well. While no documentation fixes were need as part of this work, a new unit test was created and an existing unit test was enhanced to test this correction. No changes in the output were noted and the unit tests show that updating is being handled correctly now.

NOTE: ENHANCEMENTS MUST FOLLOW A SUBMISSION PROCESS INCLUDING A FEATURE PROPOSAL AND DESIGN DOCUMENT PRIOR TO SUBMITTING CODE

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

RKStrand added 4 commits May 17, 2024 14:38
There were a few places where GenContam was not implemented properly in the code.  After a thorough search of the code for both CO2 and GenContam, it was discovered that there were a couple of places where the code for these two entities were not similar (GenContam code that needed to be present was missing).  Also, an incorrect assignment of the simulation flag was also discovered.  This commit fixes those issues.
Addition of a new unit test and enhancement of an existing one for this fix.
To const or to constexpr, that is the question...
@RKStrand RKStrand added the Defect Includes code to repair a defect in EnergyPlus label May 22, 2024
@RKStrand RKStrand added this to the EnergyPlus 24.2 milestone May 22, 2024
@RKStrand RKStrand self-assigned this May 22, 2024
Comment on lines 1813 to 1814
sumCO2 += spaceOutletNode.CO2 * mixerSpace.fraction;
sumGenContam += spaceOutletNode.GenContam * mixerSpace.fraction;
Copy link
Contributor

Choose a reason for hiding this comment

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

Most (all?) other places that work with CO2 and GenContam have ifs like if (state.dataContaminantBalance->Contaminant.GenericContamSimulation) {. Should there be ifs here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mjwitte hmmm…that’s a good point. I will look at implementing such if checks when I get back to this next week on Tuesday.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mjwitte Ok, I've added the IF checks as per your suggestion and just now made a commit (as well as merged in develop to get everything back up to speed). Anticipating that this should come back all green as before.

Comment on lines +8340 to +8342
if (state.dataContaminantBalance->Contaminant.GenericContamSimulation) {
state.dataLoopNodes->Node(AirOutletNode).GenContam = state.dataLoopNodes->Node(AirInletNode).GenContam;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

@Myoldmopar There are ifs like this scattered throughout the code. For simple assignments like this are these ifs saving any time or are they just clutter?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree these checks aren't needed (just pass the 0). Also thinking of a safeAirNodeCopy function passing MassFlowRate, Quality, Press, MassFlowRateMin, MassFlowRateMax, MassFlowRateMinAvail and MassFlowRateMaxAvail, and CO2 and GenContam. A lot of these child update functions would reduce to:

    safeAirNodeCopy(state, outletnode, inletnode);
    state.dataLoopNodes->Node(AirOutletNode).Temp = varSpeedCoil.OutletAirDBTemp;
    state.dataLoopNodes->Node(AirOutletNode).HumRat = varSpeedCoil.OutletAirHumRat;
    state.dataLoopNodes->Node(AirOutletNode).Enthalpy = varSpeedCoil.OutletAirEnthalpy;

RKStrand added 2 commits May 28, 2024 05:56
To conform to the pattern established in other parts of the code, IF statements were needed in the setOutletConditions routine of the ZoneEquipmentMixer.  This also then required the slight modification of a unit test.  This was in response to a comment from @mjwitte.
Copy link
Contributor

@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 changes look good. Unit tests pass. CI is clean and green. Merging. Thanks @RKStrand !

@mjwitte mjwitte merged commit 9a34ab8 into develop May 28, 2024
15 checks passed
@mjwitte mjwitte deleted the 10473CorrectCO2GenContamHandling branch May 28, 2024 17:35
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.

Make sure that CO2 and GenContam are handled by all components
8 participants