2

Calculating total annual schedule hours using OpenStudio measure

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.

mleach's avatar
556
mleach
asked 2014-12-05 12:13:25 -0500
__AmirRoth__'s avatar
4.4k
__AmirRoth__
updated 2017-08-05 13:26:53 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

2 Answers

2

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

https://github.com/NREL/OpenStudio/bl...

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.

macumber's avatar
12k
macumber
answered 2014-12-05 12:26:48 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
2

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 = OpenStudio::Date.new(OpenStudio::MonthOfYear.new("January"),1)
  year_end_date = OpenStudio::Date.new(OpenStudio::MonthOfYear.new("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
    #exit

    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
    else
      day_sch = day_schs[sch_index]
    end

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

    # 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
    end

    # 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

  end

  return annual_flh

end

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

aparker's avatar
8.2k
aparker
answered 2014-12-05 13:02:13 -0500
edit flag offensive 0 remove flag delete link

Comments

Yeah, what he said :-)

macumber's avatar macumber (2014-12-05 13:29:33 -0500) edit
add a comment see more comments