Measures/m_9_example_9_demand_management/measure.rb
# define the arguments that the user will input
define the arguments that the user will input
define the arguments that the user will input
def arguments(model)
    args = OpenStudio::Measure::OSArgumentVector.new
	verbose_info_statements = OpenStudio::Ruleset::OSArgument::makeBoolArgument("verbose_info_statements", false)
	verbose_info_statements.setDisplayName("Check to allow measure to generate verbose runner.registerInfo statements.")
	verbose_info_statements.setDefaultValue(false)
	args << verbose_info_statements
    sch_handles = OpenStudio::StringVector.new
    sch_display_names = OpenStudio::StringVector.new
    sch_hash = {}
    model.getSchedules.each do |sch|
      sch_hash[sch.name.to_s] = sch
    end
    sch_hash.sort.map do |sch_name, sch|
      if not sch.scheduleTypeLimits.empty?
        unitType = sch.scheduleTypeLimits.get.unitType
        if unitType == "Dimensionless"
          sch_handles << sch.handle.to_s
          sch_display_names << sch_name
        end
      end
    end
    lighting_sch = OpenStudio::Ruleset::OSArgument::makeChoiceArgument("lighting_sch", sch_handles, sch_display_names, true)
    lighting_sch.setDisplayName("Choose a Schedule attached to Lighting Definitons which will be altered to meet demand reduction targets. Lighting demand will be reduced for datacenter thermal zones if this schedule is attached to them.")
    args << lighting_sch    
    sch_handles2 = OpenStudio::StringVector.new
    sch_display_names2 = OpenStudio::StringVector.new
    sch_hash2 = {}
    model.getSchedules.each do |sch_2|
      sch_hash2[sch_2.name.to_s] = sch_2
    end
    sch_hash2.sort.map do |sch_name_2, sch_2|
      if not sch_2.scheduleTypeLimits.empty?
        unitType = sch_2.scheduleTypeLimits.get.unitType
        if unitType == "Temperature"
          sch_handles2 << sch_2.handle.to_s
          sch_display_names2 << sch_name_2
        end
      end
    end
    clg_tstat_sch = OpenStudio::Ruleset::OSArgument::makeChoiceArgument("clg_tstat_sch", sch_handles2, sch_display_names2, true)
    clg_tstat_sch.setDisplayName("Choose a Temp Schedule representing the Clg T-Stat Sch to be reduced to meet demand reduction targets. The chosen schedule should not serve datacenter areas, as they are not effected by demand response actions.")
    args << clg_tstat_sch    
    relative_demand_reduction_target = OpenStudio::Ruleset::OSArgument::makeDoubleArgument("relative_demand_reduction_target",true)
    relative_demand_reduction_target.setDisplayName("Relative Demand Reduction Target")
    relative_demand_reduction_target.setDescription("% of Whole Building Demand Reduction expected (Min 0 - Max 0.35).")
    relative_demand_reduction_target.setDefaultValue(0.15)
    relative_demand_reduction_target.setMinValue(0.0)
    relative_demand_reduction_target.setMaxValue(0.35)
    args << relative_demand_reduction_target
    int_var_avail_dict_rep_chs = OpenStudio::StringVector.new
    int_var_avail_dict_rep_chs << 'None'
    int_var_avail_dict_rep_chs << 'NotByUniqueKeyNames'
    int_var_avail_dict_rep_chs << 'Verbose'
    internal_variable_availability_dictionary_reporting = OpenStudio::Measure::OSArgument.makeChoiceArgument('internal_variable_availability_dictionary_reporting', int_var_avail_dict_rep_chs, true)
    internal_variable_availability_dictionary_reporting.setDisplayName('Level of output reporting related to the EMS internal variables that are available.')
    internal_variable_availability_dictionary_reporting.setDefaultValue('None')
    args << internal_variable_availability_dictionary_reporting
    ems_runtime_language_debug_level_chs = OpenStudio::StringVector.new
    ems_runtime_language_debug_level_chs << 'None'
    ems_runtime_language_debug_level_chs << 'ErrorsOnly'
    ems_runtime_language_debug_level_chs << 'Verbose'
    ems_runtime_language_debug_output_level = OpenStudio::Measure::OSArgument.makeChoiceArgument('ems_runtime_language_debug_output_level', ems_runtime_language_debug_level_chs, true)
    ems_runtime_language_debug_output_level.setDisplayName('Level of output reporting related to the execution of EnergyPlus Runtime Language, written to .edd file.')
    ems_runtime_language_debug_output_level.setDefaultValue('None')
    args << ems_runtime_language_debug_output_level
    actuator_avail_dict_rep_chs = OpenStudio::StringVector.new
    actuator_avail_dict_rep_chs << 'None'
    actuator_avail_dict_rep_chs << 'NotByUniqueKeyNames'
    actuator_avail_dict_rep_chs << 'Verbose'
    actuator_availability_dictionary_reporting = OpenStudio::Measure::OSArgument.makeChoiceArgument('actuator_availability_dictionary_reporting', actuator_avail_dict_rep_chs, true)
    actuator_availability_dictionary_reporting.setDisplayName('Level of output reporting related to the EMS actuators that are available.')
    actuator_availability_dictionary_reporting.setDefaultValue('None')
    args << actuator_availability_dictionary_reporting
    return args
  end
def arguments ( model ) args = OpenStudio :: Measure :: OSArgumentVector . new verbose_info_statements = OpenStudio :: Ruleset :: OSArgument :: makeBoolArgument ( "verbose_info_statements" , false ) verbose_info_statements . setDisplayName ( "Check to allow measure to generate verbose runner.registerInfo statements." ) verbose_info_statements . setDefaultValue ( false ) args << verbose_info_statements sch_handles = OpenStudio :: StringVector . new sch_display_names = OpenStudio :: StringVector . new sch_hash = { } model . getSchedules . each do | sch | sch_hash [ sch . name . to_s ] = sch end sch_hash . sort . map do | sch_name , sch | if not sch . scheduleTypeLimits . empty? unitType = sch . scheduleTypeLimits . get . unitType if unitType == "Dimensionless" sch_handles << sch . handle . to_s sch_display_names << sch_name end end end lighting_sch = OpenStudio :: Ruleset :: OSArgument :: makeChoiceArgument ( "lighting_sch" , sch_handles , sch_display_names , true ) lighting_sch . setDisplayName ( "Choose a Schedule attached to Lighting Definitons which will be altered to meet demand reduction targets. Lighting demand will be reduced for datacenter thermal zones if this schedule is attached to them." ) args << lighting_sch sch_handles2 = OpenStudio :: StringVector . new sch_display_names2 = OpenStudio :: StringVector . new sch_hash2 = { } model . getSchedules . each do | sch_2 | sch_hash2 [ sch_2 . name . to_s ] = sch_2 end sch_hash2 . sort . map do | sch_name_2 , sch_2 | if not sch_2 . scheduleTypeLimits . empty? unitType = sch_2 . scheduleTypeLimits . get . unitType if unitType == "Temperature" sch_handles2 << sch_2 . handle . to_s sch_display_names2 << sch_name_2 end end end clg_tstat_sch = OpenStudio :: Ruleset :: OSArgument :: makeChoiceArgument ( "clg_tstat_sch" , sch_handles2 , sch_display_names2 , true ) clg_tstat_sch . setDisplayName ( "Choose a Temp Schedule representing the Clg T-Stat Sch to be reduced to meet demand reduction targets. The chosen schedule should not serve datacenter areas, as they are not effected by demand response actions." ) args << clg_tstat_sch relative_demand_reduction_target = OpenStudio :: Ruleset :: OSArgument :: makeDoubleArgument ( "relative_demand_reduction_target" , true ) relative_demand_reduction_target . setDisplayName ( "Relative Demand Reduction Target" ) relative_demand_reduction_target . setDescription ( "% of Whole Building Demand Reduction expected (Min 0 - Max 0.35)." ) relative_demand_reduction_target . setDefaultValue ( 0.15 ) relative_demand_reduction_target . setMinValue ( 0.0 ) relative_demand_reduction_target . setMaxValue ( 0.35 ) args << relative_demand_reduction_target int_var_avail_dict_rep_chs = OpenStudio :: StringVector . new int_var_avail_dict_rep_chs << 'None' int_var_avail_dict_rep_chs << 'NotByUniqueKeyNames' int_var_avail_dict_rep_chs << 'Verbose' internal_variable_availability_dictionary_reporting = OpenStudio :: Measure :: OSArgument . makeChoiceArgument ( 'internal_variable_availability_dictionary_reporting' , int_var_avail_dict_rep_chs , true ) internal_variable_availability_dictionary_reporting . setDisplayName ( 'Level of output reporting related to the EMS internal variables that are available.' ) internal_variable_availability_dictionary_reporting . setDefaultValue ( 'None' ) args << internal_variable_availability_dictionary_reporting ems_runtime_language_debug_level_chs = OpenStudio :: StringVector . new ems_runtime_language_debug_level_chs << 'None' ems_runtime_language_debug_level_chs << 'ErrorsOnly' ems_runtime_language_debug_level_chs << 'Verbose' ems_runtime_language_debug_output_level = OpenStudio :: Measure :: OSArgument . makeChoiceArgument ( 'ems_runtime_language_debug_output_level' , ems_runtime_language_debug_level_chs , true ) ems_runtime_language_debug_output_level . setDisplayName ( 'Level of output reporting related to the execution of EnergyPlus Runtime Language, written to .edd file.' ) ems_runtime_language_debug_output_level . setDefaultValue ( 'None' ) args << ems_runtime_language_debug_output_level actuator_avail_dict_rep_chs = OpenStudio :: StringVector . new actuator_avail_dict_rep_chs << 'None' actuator_avail_dict_rep_chs << 'NotByUniqueKeyNames' actuator_avail_dict_rep_chs << 'Verbose' actuator_availability_dictionary_reporting = OpenStudio :: Measure :: OSArgument . makeChoiceArgument ( 'actuator_availability_dictionary_reporting' , actuator_avail_dict_rep_chs , true ) actuator_availability_dictionary_reporting . setDisplayName ( 'Level of output reporting related to the EMS actuators that are available.' ) actuator_availability_dictionary_reporting . setDefaultValue ( 'None' ) args << actuator_availability_dictionary_reporting return args end
define the arguments that the user will input
define the arguments that the user will input
# Add a check box for specifying verbose info statements # Argument #1 - choice list of lighting schedules to modify use to reduce the power demand #putting schedule names into hash #looping through sorted hash of schedules #puts "#{sch.name}, #{unitType}" # Make a Choice Argument for the Fractional Lighting Schedule to be used for to apply demand reduction reductions to # Argument #2 - choice list of T-stat schedules to modify the cooling setpiont use to reduce the power demand #putting schedule names into hash #looping through sorted hash of schedules # Make a Choice Argument for the Cooling T=stat Schedule to be used for to apply demand reduction reductions to # Make a double precision argument for the relative electrical demand reduction target  # Make a choice argument for setting EMS InternalVariableAvailabilityDictionaryReporting value # Make a choice argument for setting EMSRuntimeLanguageDebugOutputLevel value # Make a choice argument for setting EMS ActuatorAvailabilityDictionaryReportingvalue
model
<not_specific>