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

Fix: Parametric schedules error when profiles not matched #1775

Merged
merged 3 commits into from
Jul 7, 2024

Conversation

eringold
Copy link
Collaborator

@eringold eringold commented Jul 2, 2024

Pull request overview

@mdahlhausen reported that some ComStock workflows were failing with errors such as:

 "[openstudio.standards.Parametric.Schedules] In schedule_ruleset_get_parametric_inputs, schedule Mercantile_Retail BLDG_LIGHT_EndUseData Default has no hours_of_operation target index. Won't be modified",
 "[openstudio.standards.Parametric.Schedules] In schedule_ruleset_get_parametric_inputs, schedule FullServiceRestaurant Gas Equip Default has no hours_of_operation target index. Won't be modified",
 "[openstudio.standards.Parametric.Schedules] In schedule_ruleset_get_parametric_inputs, schedule RestaurantSitDown Kitchen_Exhaust_SCH Default has no hours_of_operation target index. Won't be modified",

This was due to some already-matched ScheduleRules were being removed after new ScheduleRules (matched with building hours of operation ScheduleRules) were created. This PR fixes the issue.

It also includes some minor modification to the StatFile class to catch cases (such as in ComStock) where weather .stat files do not contain undisturbed ground temperatures, and does not try to set the missing info.

Pull Request Author

  • Method changes or additions
  • Added tests for added methods
  • Resolved yard documentation errors for new code (ran bundle exec rake doc)
  • Resolved rubocop syntax errors for new code (ran bundle exec rake rubocop)
  • All new and existing tests passes

Review Checklist

This will not be exhaustively relevant to every PR.

  • Perform a code review on GitHub
  • All related changes have been implemented: method additions, changes, tests
  • Check rubocop errors
  • Check yard doc errors
  • If fixing a defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If a new feature, test the new feature and try creative ways to break it
  • CI status: all green or justified

@eringold eringold requested a review from mdahlhausen July 2, 2024 23:24
@@ -555,6 +564,8 @@ def self.schedule_ruleset_get_parametric_inputs(schedule_ruleset, space_load_ins
# skip if rules already match
if (sch_ruleset_days_used[sch_index] - day_group).empty?
OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.Parametric.Schedules', "in #{__method__}: #{schedule_ruleset.name} rule #{sch_index} already matches hours of operation rule #{hoo_index}; new rule won't be created.")
# iterate new_rule_ct anyway to keep these rules
new_rule_ct += 1 unless sch_index == -1
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Iterating this counter when rules already match an hours_of_operation rule (except when it's the default profile) means those rules won't inadvertently be removed below.

props.setFeature('param_sch_ver', '0.0.1') # this is needed to see if formulas are in sync with version of standards that processes them also used to flag schedule as parametric
props.setFeature('param_sch_floor', min_max['min'])
props.setFeature('param_sch_ceiling', min_max['max'])
end
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This just avoids the same schedule (applied to different space load instances) being 'set up' multiple times

schedule_ruleset.scheduleRules[new_rule_ct..-1].each(&:remove) unless new_rule_ct == 0
if !(new_rule_ct == 0 || new_rule_ct == schedule_ruleset.scheduleRules.size)
schedule_ruleset.scheduleRules[new_rule_ct..-1].each(&:remove)
end
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This cleans up old rules that don't match hours_of_operation rules.

if stat_file.monthly_undis_ground_temps_4p0m.empty?
return false
end

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

avoid trying to set data that doesn't exist

@mdahlhausen mdahlhausen merged commit 6b94dcf into master Jul 7, 2024
1 of 2 checks passed
@mdahlhausen mdahlhausen deleted the parametric_sch_error branch July 7, 2024 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants