Skip to content

Conversation

@jmarrec
Copy link
Contributor

@jmarrec jmarrec commented Aug 26, 2025

Pull request overview

Description of the purpose of this PR

The approach taken here is to:

  • InitConstantScheduleData adds a DaySchedule "MissingDaySchedule-0.0" at index 0 in Sched::daySchedules.
  • AddWeekSchedule initializes WeekSchedule::dayScheds to this missing day type
  • The warning about missing day types is retained, but there will never be a null DaySchedule pointer in the WeekSchedule::dayScheds

Defect file segfaults without fix, works with fix, eplusout.err correctly references the missing day types

   ** Warning ** ProcessScheduleInput: Schedule:Compact = NUMBER OF PEOPLE
   **   ~~~   ** has missing day types in Through=12/31
   **   ~~~   ** Last "For" field=FOR: WEEKENDS
   **   ~~~   ** Missing day types= "Holiday", "SummerDesignDay", "WinterDesignDay", "CustomDay1", "CustomDay2"
   **   ~~~   ** Missing day types will have 0.0 as Schedule Values

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

@jmarrec jmarrec requested review from Myoldmopar and amirroth August 26, 2025 11:53
@jmarrec jmarrec self-assigned this Aug 26, 2025
@jmarrec jmarrec added Defect Includes code to repair a defect in EnergyPlus NotIDDChange Code does not impact IDD (can be merged after IO freeze) labels Aug 26, 2025
Comment on lines +324 to +326
auto *missingDaySchedule = AddDaySchedule(state, "MissingDaySchedule-0.0");
assert(missingDaySchedule->Num == SchedNum_AlwaysOff);
missingDaySchedule->isUsed = true;
Copy link
Contributor Author

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

Comment on lines +300 to +303
// 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];
}
Copy link
Contributor Author

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...)

Comment on lines +287 to +288
// When InitConstantScheduleData is called, TimeStepsInHour is 0, so we ensure 24
daySched->tsVals.assign(Constant::iHoursInDay * max(1, s_glob->TimeStepsInHour), 0.0);
Copy link
Contributor Author

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.

Comment on lines +1224 to +1225
// 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);
Copy link
Contributor Author

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.

Comment on lines -2382 to -2385
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;
}
Copy link
Contributor Author

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.

Comment on lines +1749 to +1757
" 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",
Copy link
Contributor Author

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

Comment on lines +1798 to +1809
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]);
Copy link
Contributor Author

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

@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit f9de11b

Regression Summary
  • EIO: 21
  • Table Big Diffs: 20

@rraustad
Copy link
Contributor

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:

** Warning ** ProcessScheduleInput: DecodeHHMMField, Invalid "until" field value is not a multiple of the minutes for each timestep: 5:05
**   ~~~   ** Other errors may result. Occurred in Day Schedule=10012_100_24_24
** Warning ** ProcessScheduleInput: Schedule:Compact = WINDOWVENTSCHED
**   ~~~   ** has missing day types in Through=12/31
**   ~~~   ** Last "For" field=FOR: MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY SATURDAY
**   ~~~   ** Missing day types= "Sunday", "Holiday", "SummerDesignDay", "WinterDesignDay", "CustomDay1", "CustomDay2"
**   ~~~   ** Missing day types will have 0.0 as Schedule Values

@rraustad
Copy link
Contributor

New entry in eio file for missing day schedule:

+DaySchedule - Timestep,MissingDaySchedule-0.0,,No,Values:,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00

Copy link
Contributor

@rraustad rraustad left a 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.

@Myoldmopar
Copy link
Member

Looks good to me, I'll do a quick check locally.

@Myoldmopar
Copy link
Member

Happy to get this fix in. Thanks @jmarrec, and @rraustad for looking it over.

@Myoldmopar Myoldmopar merged commit 85c0f61 into develop Sep 4, 2025
11 checks passed
@Myoldmopar Myoldmopar deleted the 11054_Part2 branch September 4, 2025 00:26
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 NotIDDChange Code does not impact IDD (can be merged after IO freeze)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash with schedule with missing day types

6 participants