Skip to content

Conversation

@RKStrand
Copy link
Contributor

@RKStrand RKStrand commented Aug 22, 2025

Pull request overview

Description of the purpose of this PR

For situations where a user specified AirflowNetwork:Multizone:Surface objects with CEN15251 (or ASH55) venting controls but the AirflowNetwork:Multizone:Zone object used some other venting control, no link was made to the correct people statement. As a result, no venting was ever done for this situation which was incorrect. Now, the code links up the proper zone and then links up to the correct People statement and venting occurs as specified by the user via a new subroutine which handles both ASH55 and CEN15251 for both the :Surface and :Zone objects. Two IDFs were included with the defect. One did not work because it met the condition shown above. The second had the :Zone object set to CEN15251 which then did allow venting. There were clear differences in the outputs. After the fix, both files produce exactly the same results as expected and these match the results of the second input file with :Zone set to CEN15251. No differences were noted in the ci results as anticipated. A minor documentation edit and a unit test are included.

Pull Request Author

  • 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

  • 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

The code for AFN was not setting the zone number properly for surfaces within the AFN.  Code existed for zone input to do this and link to a people statement for ASHRAE55 and CEN15251 adaptive modeling.  The correction included getting all zone and surfaces to use the same (new) subroutine, simplifying the code within the main get routine and relegating the details of linking surfaces, zones, and people statements to the new subroutine.
Slight update to the new subroutine plus the addition of a unit test and a small clarification for the IO Reference section on AFN.
@RKStrand RKStrand added this to the EnergyPlus 25.2 milestone Aug 22, 2025
@RKStrand RKStrand requested review from Myoldmopar and mjwitte August 22, 2025 23:47
@RKStrand RKStrand self-assigned this Aug 22, 2025
@RKStrand RKStrand added the Defect Includes code to repair a defect in EnergyPlus label Aug 22, 2025
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.

This works as-is, but the new function could be much simpler, I think.

" requires a people object with respective model calculations.");
}
int mzZoneDataPtr;
Solver::get_people_index(MultizoneZoneData(i).CEN15251PeopleInd, mzZoneDataPtr, VentControlType::CEN15251, false, i, ErrorsFound);
Copy link
Contributor

Choose a reason for hiding this comment

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

This works, but I'm puzzled why there are some many function parameters. I would expect this to be an int function:

MultizoneZoneData(i).CEN15251PeopleInd = Solver::get_people_index( MultizoneZoneData(i).ZoneNum, VentControlType::CEN15251, ErrorsFound);

case VentControlType::ASH55:
case VentControlType::CEN15251:
case VentControlType::CEN15251: {
int peopleIndex;
Copy link
Contributor

Choose a reason for hiding this comment

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

int mzPtr = MultizoneSurfaceData(i).ZonePtr
MultizoneZoneData(mzPtr).CEN15251PeopleInd =  Solver::get_people_index(mzPtr , VentControlType::CEN15251, ErrorsFound);

With a similar block for case VentControlType::ASH55

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see your point. There is a lot more complication than seems warranted. The zone pointer should be available already so sending that should avoid having to have the first block of code. I have often avoided setting one of the passed variables to a function like this one and made those general subroutines, but I guess there is nothing wrong with making this a function and still setting the error flag that is passed. I'll implement those changes and then mark this for re-review when I'm done. Thanks!

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 have reworked this so that it's a function and the function is much simpler/leaner. Just made the commit of code that still does what it needs to do. Also modified the unit test accordingly. Hopefully this addresses your concern.

Simplified solution by making the subroutine a function and narrowing down what the function does.
One more simplification/correction.
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.

@RKStrand All good. Thanks! Merging.

@mjwitte mjwitte merged commit 862c9e4 into develop Aug 29, 2025
9 checks passed
@mjwitte mjwitte deleted the 11027AFNSurfaceLevelASHRAE55AndCEN15251Adaptive branch August 29, 2025 16: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.

AFN Ventilation Control Modes ASHRAE55Adaptive and CEN15251Adaptive only work when specified at the zone level

5 participants