Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question

Calculating total annual schedule hours using OpenStudio measure

asked 2014-12-05 12:13:25 -0500

mleach's avatar

updated 2017-08-05 13:26:53 -0500

I'm trying to figure out how to calculate total annual schedule hours for a ScheduleRuleset using an OS measure. Consider the following application. Given a total annual hot water consumption value (gal/year), and a proposed fractional schedule for usage (with any number of Rules to specify different schedules for weekdays, weekends, seasonal closure periods, etc.), calculate the peak flow rate input you should specify for the WaterUseEquipment object.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2014-12-05 12:26:48 -0500

I would calculate the total value for each of the day schedules, then use this method

to figure out which day schedule is active throughout the year. Then you can just add up all the values for the active day schedules.

edit flag offensive delete link more

answered 2014-12-05 13:02:13 -0500

Here is a method to get the annual full load hours from a ScheduleRuleset. Add this to your measure.rb file:

# Get the annual full load hours from a ScheduleRuleset
def get_annual_full_load_hrs(sch_ruleset)

  # Define the start and end date
  year_start_date ="January"),1)
  year_end_date ="December"),31)

  # Get the ordered list of all the day schedules
  # that are used by this schedule ruleset
  day_schs = sch_ruleset.getDaySchedules(year_start_date, year_end_date)

  # Get a 365-value array of which schedule is used on each day of the year,
  day_schs_used_each_day = sch_ruleset.getActiveRuleIndices(year_start_date, year_end_date)

  # Create a map that shows how many days each schedule is used
  day_sch_freq = day_schs_used_each_day.group_by { |n| n }

  # Loop through each of the schedules that is used, figure out the
  # full load hours for that day, then multiply this by the number
  # of days that day schedule applies and add this to the total.
  annual_flh = 0
  default_day_sch = sch_ruleset.defaultDaySchedule
  day_sch_freq.each do |freq|

    #puts freq.inspect

    sch_index = freq[0]
    number_of_days_sch_used = freq[1].size

    # Get the day schedule at this index
    day_sch = nil
    if sch_index == -1 # If index = -1, this day uses the default day schedule (not a rule)
      day_sch = default_day_sch
      day_sch = day_schs[sch_index]

    # Determine the full load hours for just one day
    daily_flh = 0
    day_sch.values.each do |val|
      daily_flh += val

    # Warn if the daily flh is more than 24,
    # which would indicate that this isn't a 
    # fractional schedule.
    if daily_flh > 24
      return 0

    # Multiply the daily flh by the number
    # of days this schedule is used per year
    # and add this to the overall total
    annual_flh += daily_flh * number_of_days_sch_used


  return annual_flh


Here is how you'd use it:

annual_flh = get_annual_full_load_hrs(sch_ruleset)

And once you know the annualflh, the target peak flow rate = desired annual total / annualflh

edit flag offensive delete link more


Yeah, what he said :-)

macumber's avatar macumber  ( 2014-12-05 13:29:33 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-12-05 12:13:25 -0500

Seen: 218 times

Last updated: Dec 05 '14