Skip to content

Fan:SystemModel with discrete speed flow fractions crashes when speeds >= 2 #10846

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

Merged
merged 3 commits into from
Feb 6, 2025

Conversation

rraustad
Copy link
Contributor

@rraustad rraustad commented Dec 5, 2024

Pull request overview

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

@rraustad rraustad added the Defect Includes code to repair a defect in EnergyPlus label Dec 5, 2024
for (int i = 1; i <= vrfTU.NumOfSpeedCooling; ++i) {
vrfTU.CoolMassFlowRate[i] = fanSystem->massFlowAtSpeed[i - 1];
}
}
Copy link
Contributor Author

@rraustad rraustad Dec 5, 2024

Choose a reason for hiding this comment

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

Crashes in these places in VRF GetInput because massFlowAtSpeed is allocated in the fan's set_size function and that has not been called yet.

Copy link
Member

Choose a reason for hiding this comment

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

👍

}
}
}
}
Copy link
Contributor Author

@rraustad rraustad Dec 5, 2024

Choose a reason for hiding this comment

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

So moved these initializations to Init where the code waits for the fan to size before setting up air flow variables.

EXPECT_NEAR(state->dataHVACVarRefFlow->VRFTU[0].CycRatio, 0.713204045, 0.00001); // was 0.713222413
}

TEST_F(EnergyPlusFixture, VRF_MultispeedFan_Test_HardSized)
Copy link
Contributor Author

@rraustad rraustad Dec 5, 2024

Choose a reason for hiding this comment

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

New unit test with hard-sized inputs for airflow, capacity and SHR that are duplicate of results from above unit test. These answers are a little different then when using autosize.

@rraustad rraustad changed the title Fan:SystemModel with discrete speed flow fractions crashes for speeds > 2 Fan:SystemModel with discrete speed flow fractions crashes when speeds >= 2 Dec 5, 2024
Copy link

github-actions bot commented Dec 5, 2024

⚠️ Regressions detected on macos-14 for commit 0fa62eb

Regression Summary
  • EIO: 1
  • ERR: 1
  • ESO Big Diffs: 1
  • MTR Small Diffs: 1
  • Table Big Diffs: 1
  • Table String Diffs: 1

@rraustad
Copy link
Contributor Author

rraustad commented Dec 5, 2024

A clue to the diffs on Mac CI for VRFMultispeedFan. TU2 fan is the only multispeed fan of the 5 TUs in this example file. No Cooling SA Flow Rate changed while No Heating SA Flow Rate did not. @Myoldmopar why is Mac CI picking up diffs while the other CIs do not?

- Component Sizing Information, ZoneHVAC:TerminalUnit:VariableRefrigerantFlow, TU2, Design Size No Cooling Supply Air Flow Rate [m3/s], 0.21531
+ Component Sizing Information, ZoneHVAC:TerminalUnit:VariableRefrigerantFlow, TU2, Design Size No Cooling Supply Air Flow Rate [m3/s], 0.00000
  Component Sizing Information, ZoneHVAC:TerminalUnit:VariableRefrigerantFlow, TU2, Design Size No Heating Supply Air Flow Rate [m3/s], 0.21531

@mjwitte
Copy link
Contributor

mjwitte commented Dec 5, 2024

A clue to the diffs on Mac CI for VRFMultispeedFan. TU2 fan is the only multispeed fan of the 5 TUs in this example file. No Cooling SA Flow Rate changed while No Heating SA Flow Rate did not. @Myoldmopar why is Mac CI picking up diffs while the other CIs do not?

Mac is the only one running regressions now.

@@ -7728,7 +7741,7 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum)
} else {
auto *fanSystem = dynamic_cast<Fans::FanSystem *>(state.dataFans->fans(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex));
assert(fanSystem != nullptr);
if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[i] == 0.0) {
if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[i] == 0.0 && !fanSystem->massFlowAtSpeed.empty()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just in case the fan has not yet been sized.

Copy link
Member

Choose a reason for hiding this comment

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

Interesting. Is that something that actually could happen for a normal IDF run? Or is this just to proof it against missing inits in unit tests?

Copy link
Contributor Author

@rraustad rraustad Feb 6, 2025

Choose a reason for hiding this comment

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

This was a normal idf run. The massFlowAtSpeed array is not allocated until Fan::set_size is called. Which may not have been called yet at this point in VRF sizing.

@nrel-bot-2
Copy link

@rraustad it has been 15 days since this pull request was last updated.

@nrel-bot-2
Copy link

@rraustad it has been 7 days since this pull request was last updated.

1 similar comment
@nrel-bot-2
Copy link

@rraustad it has been 7 days since this pull request was last updated.

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 fine as is. I'm curious about the empty checks, but they aren't causing trouble. I'll give this a quick check.

@@ -7728,7 +7741,7 @@ void SizeVRF(EnergyPlusData &state, int const VRFTUNum)
} else {
auto *fanSystem = dynamic_cast<Fans::FanSystem *>(state.dataFans->fans(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).FanIndex));
assert(fanSystem != nullptr);
if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[i] == 0.0) {
if (state.dataHVACVarRefFlow->VRFTU(VRFTUNum).CoolMassFlowRate[i] == 0.0 && !fanSystem->massFlowAtSpeed.empty()) {
Copy link
Member

Choose a reason for hiding this comment

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

Interesting. Is that something that actually could happen for a normal IDF run? Or is this just to proof it against missing inits in unit tests?

for (int i = 1; i <= vrfTU.NumOfSpeedCooling; ++i) {
vrfTU.CoolMassFlowRate[i] = fanSystem->massFlowAtSpeed[i - 1];
}
}
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

Good to go, thanks @rraustad !

@Myoldmopar Myoldmopar merged commit 28140c5 into develop Feb 6, 2025
9 checks passed
@Myoldmopar Myoldmopar deleted the 10845-VRF-crash-with-discrete-system-fan branch February 6, 2025 14:25
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.

EnergyPlus Crashes with Fan:SystemModel with Discrete speeds
5 participants