-
Notifications
You must be signed in to change notification settings - Fork 460
#11054 - Part 2 - Crash with schedule with missing day types #11173
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
Conversation
…ike defect file
…gDaySchedule-0.0" and AddWeekSchedule initializes dayScheds to this missing day type
…in the daySchedules vector
| auto *missingDaySchedule = AddDaySchedule(state, "MissingDaySchedule-0.0"); | ||
| assert(missingDaySchedule->Num == SchedNum_AlwaysOff); | ||
| missingDaySchedule->isUsed = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
InitConstantScheduleData: Add a missingDaySchedule at index 0 in dataSched->daySchedules
| // Fill the dayScheds with the Missing Day Schedule (Always Off) | ||
| for (int iDayType = 1; iDayType < (int)DayType::Num; ++iDayType) { | ||
| weekSched->dayScheds[iDayType] = s_sched->daySchedules[SchedNum_AlwaysOff]; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AddWeekSchedule initializes the dayScheds to that missing schedule (except the "Unused" day type...)
| // When InitConstantScheduleData is called, TimeStepsInHour is 0, so we ensure 24 | ||
| daySched->tsVals.assign(Constant::iHoursInDay * max(1, s_glob->TimeStepsInHour), 0.0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps I should have kept resize only, but the assign is clearer and initializes.
| // When InitConstantScheduleData is called, TimeStepsInHour is 0, so we delay it here | ||
| static_cast<DaySchedule *>(s_sched->daySchedules[SchedNum_AlwaysOff])->tsVals.assign(Constant::iHoursInDay * s_glob->TimeStepsInHour, 0.0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In ProcessScheduleInput, I reassign the DaySchedule to the right size now that we know the TimeStepsInHour.
| if (daySched == nullptr) { | ||
| // We already warned in ProcessScheduleInput that there were missing days: Missing day types will have 0.0 as Schedule Values | ||
| return 0.0; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
daySched checking for nullptr is no longer needed.
| " Fraction, !- Name", | ||
| " 0, !- Lower Limit Value", | ||
| " 1, !- Upper Limit Value", | ||
| " Continuous, !- Numeric Type", | ||
| " percent; !- Unit Type", | ||
|
|
||
| "Schedule:Compact,", | ||
| " WindowVentSched, !- Name", | ||
| " Any Number, !- Schedule Type Limits Name", | ||
| " Fraction, !- Schedule Type Limits Name", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mod the previous test to add that ScheduleTypeLimits validation which makes it crash before fix in setMinMaxVals like the new defect file does
| Sched::DaySchedule const *const missingDaySchedule = state->dataSched->daySchedules[Sched::SchedNum_AlwaysOff]; | ||
| EXPECT_EQ(0, missingDaySchedule->minVal); | ||
| EXPECT_EQ(0, missingDaySchedule->maxVal); | ||
| EXPECT_EQ(4 * 24, missingDaySchedule->tsVals.size()); | ||
| for (auto v : missingDaySchedule->tsVals) { | ||
| EXPECT_EQ(0.0, v); | ||
| } | ||
|
|
||
| EXPECT_EQ(0, weekSched->minVal); | ||
| EXPECT_EQ(1, weekSched->maxVal); | ||
|
|
||
| EXPECT_EQ(missingDaySchedule, weekSched->dayScheds[(int)Sched::DayType::Sunday]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We check that the missingDaySchedule in question is properly all zeroes with the right size.
The weekSched min/maxVal are ok.
And the Missing day types all point to that missingDaySchedule
|
|
Alternate defect file Ticket 16879.idf runs successfully after fixing the coil UA issues (Sizing:Plant with 70C and 6.222C). 11054 defect file in-v25.1 runs to completion with: |
|
New entry in eio file for missing day schedule: |
rraustad
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Defect files run correctly with associated warnings reported to err file.
|
Looks good to me, I'll do a quick check locally. |
Pull request overview
ScheduleTypeLimits, and will fail insetMinMaxValsDescription of the purpose of this PR
The approach taken here is to:
InitConstantScheduleDataadds aDaySchedule"MissingDaySchedule-0.0" at index 0 inSched::daySchedules.AddWeekScheduleinitializesWeekSchedule::daySchedsto this missing day typeDaySchedulepointer in theWeekSchedule::daySchedsUnusedweirdnessEnergyPlus/src/EnergyPlus/ScheduleManager.hh
Line 75 in acf7908
Defect file segfaults without fix, works with fix,
eplusout.errcorrectly references the missing day typesPull Request Author
Reviewer