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

Revision history [back]

click to hide/show revision 1
initial version

OS agrument option

Hi I made a few code for measure input :

    def arguments(model)
    args = OpenStudio::Ruleset::OSArgumentVector.new
    args = OpenStudio::Ruleset::OSArgumentVector.new
    d_auto_fan_sch = model.alwaysOffDiscreteSchedule
    d_auto_fan_sch.setName("VRF TU auto fan schedule")
    always_on = model.alwaysOnDiscreteSchedule
    # HVAC schedule choice
    chs = OpenStudio::StringVector.new
    chs << "Yes"
    chs << "No"
    sch_chs = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('Optional_sch', chs, true)
    sch_chs.setDisplayName("Does HVAC work all day ?")
    sch_chs.setDefaultValue("Yes")
    args << sch_chs
    #pick a schedule
    #sched_names = OpenStudio::Ruleset::makeChoiceArgumentOfWorkspaceObjects("HVAC Schedule Name","OS_Schedule_Ruleset".to_IddObjectType,model,true)
    all_scheds = model.getSchedules
    sched_name_vec = OpenStudio::StringVector.new
    all_scheds.each do |sched|
    sched_name_vec << sched.name.get
    end
    sched_names = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('HVAC Schedule name', sched_name_vec, true)
    sched_names.setDisplayName("Choose a HVAC schedule")
    sched_names.setDefaultValue("#{always_on.name}")
    args << sched_names
    sched_names1 = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('Supply fan Schedule name', sched_name_vec, true)
    sched_names1.setDisplayName("Choose supply fan schedule")
    sched_names1.setDefaultValue("#{d_auto_fan_sch.name}")
    args << sched_names1
    return args 
  end #end the arguments method

  #define what happens when the measure is run
  def run(model, runner, user_arguments)
    super(model, runner, user_arguments)

    #use the built-in error checking 
    if not runner.validateUserArguments(arguments(model), user_arguments)
      return false
    end
    # setup schedule 

    s_sup_fan_option = runner.getStringArgumentValue('Supply fan Schedule name',user_arguments)
    s_scheds = model.getSchedules
    s_scheds.each do |sched|
      if sched.name.get == s_sup_fan_option
      @@schd1 = sched
      end
    end  
    runner.registerInfo(" Set all VRF Terminal unit supply fan schedule as #{@@schd1.name} ")

I created temporary schedule as default schedule for supply fan schedule but they got this warning :

The default value of script argument Supply fan Schedule name (Choose supply fan schedule) Choice, Required Value: (VRF TU auto fan schedule 1) does not match that of the corresponding user argument Supply fan Schedule name (Choose supply fan schedule) Choice, Required Value: VRF TU auto fan schedule (VRF TU auto fan schedule)

each time i try to repeat this measure, they add a new schedule (VRF TU auto fan schedule 1)

How to avoid warning and unnecessary schedule ?

Note : Have any pathway for show the code as cool as in Unmethours in Notepad++ ???

OS agrument option

Hi I made a few code for measure input :

    def arguments(model)
     args = OpenStudio::Ruleset::OSArgumentVector.new
     args = OpenStudio::Ruleset::OSArgumentVector.new
     d_auto_fan_sch = model.alwaysOffDiscreteSchedule
     d_auto_fan_sch.setName("VRF TU auto fan schedule")
     always_on = model.alwaysOnDiscreteSchedule
     # HVAC schedule choice
     chs = OpenStudio::StringVector.new
     chs << "Yes"
     chs << "No"
     sch_chs = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('Optional_sch', chs, true)
     sch_chs.setDisplayName("Does HVAC work all day ?")
     sch_chs.setDefaultValue("Yes")
     args << sch_chs
     #pick a schedule
     #sched_names = OpenStudio::Ruleset::makeChoiceArgumentOfWorkspaceObjects("HVAC Schedule Name","OS_Schedule_Ruleset".to_IddObjectType,model,true)
     all_scheds = model.getSchedules
     sched_name_vec = OpenStudio::StringVector.new
     all_scheds.each do |sched|
     sched_name_vec << sched.name.get
     end
     sched_names = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('HVAC Schedule name', sched_name_vec, true)
     sched_names.setDisplayName("Choose a HVAC schedule")
     sched_names.setDefaultValue("#{always_on.name}")
     args << sched_names
     sched_names1 = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('Supply fan Schedule name', sched_name_vec, true)
     sched_names1.setDisplayName("Choose supply fan schedule")
     sched_names1.setDefaultValue("#{d_auto_fan_sch.name}")
     args << sched_names1
     return args 
  end #end the arguments method

  #define what happens when the measure is run
  def run(model, runner, user_arguments)
    super(model, runner, user_arguments)

    #use the built-in error checking 
    if not runner.validateUserArguments(arguments(model), user_arguments)
      return false
    end
    # setup schedule 

    s_sup_fan_option = runner.getStringArgumentValue('Supply fan Schedule name',user_arguments)
    s_scheds = model.getSchedules
    s_scheds.each do |sched|
      if sched.name.get == s_sup_fan_option
      @@schd1 = sched
      end
    end  
    runner.registerInfo(" Set all VRF Terminal unit supply fan schedule as #{@@schd1.name} ")

I created temporary schedule as default schedule for supply fan schedule but they got this warning :

The default value of script argument Supply fan Schedule name (Choose supply fan schedule) Choice, Required Value: (VRF TU auto fan schedule 1) does not match that of the corresponding user argument Supply fan Schedule name (Choose supply fan schedule) Choice, Required Value: VRF TU auto fan schedule (VRF TU auto fan schedule)

each time i try to repeat this measure, they add a new schedule (VRF TU auto fan schedule 1)

How to avoid warning and unnecessary schedule ?

Note : Have any pathway for show the code as cool as in Unmethours in Notepad++ ???

OS agrument option

Hi I made a few code for measure input :

    def arguments(model)
      args = OpenStudio::Ruleset::OSArgumentVector.new
      args = OpenStudio::Ruleset::OSArgumentVector.new
      d_auto_fan_sch = model.alwaysOffDiscreteSchedule
      d_auto_fan_sch.setName("VRF TU auto fan schedule")
      always_on = model.alwaysOnDiscreteSchedule
      # HVAC schedule choice
      chs = OpenStudio::StringVector.new
      chs << "Yes"
      chs << "No"
      sch_chs = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('Optional_sch', chs, true)
      sch_chs.setDisplayName("Does HVAC work all day ?")
      sch_chs.setDefaultValue("Yes")
      args << sch_chs
      #pick a schedule
      #sched_names = OpenStudio::Ruleset::makeChoiceArgumentOfWorkspaceObjects("HVAC Schedule Name","OS_Schedule_Ruleset".to_IddObjectType,model,true)
      all_scheds = model.getSchedules
      sched_name_vec = OpenStudio::StringVector.new
      all_scheds.each do |sched|
        sched_name_vec << sched.name.get
      end
      sched_names = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('HVAC Schedule name', sched_name_vec, true)
      sched_names.setDisplayName("Choose a HVAC schedule")
      sched_names.setDefaultValue("#{always_on.name}")
      args << sched_names
      sched_names1 = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('Supply fan Schedule name', sched_name_vec, true)
      sched_names1.setDisplayName("Choose supply fan schedule")
      sched_names1.setDefaultValue("#{d_auto_fan_sch.name}")
      args << sched_names1
      return args 
  end #end the arguments method

  #define what happens when the measure is run
  def run(model, runner, user_arguments)
    super(model, runner, user_arguments)

    #use the built-in error checking 
    if not runner.validateUserArguments(arguments(model), user_arguments)
      return false
    end
    # setup schedule 

    s_sup_fan_option = runner.getStringArgumentValue('Supply fan Schedule name',user_arguments)
    s_scheds = model.getSchedules
    s_scheds.each do |sched|
      if sched.name.get == s_sup_fan_option
      @@schd1 = sched
      end
    end  
    runner.registerInfo(" Set all VRF Terminal unit supply fan schedule as #{@@schd1.name} ")

I created temporary schedule as default schedule for supply fan schedule but they got this warning :

The default value of script argument Supply fan Schedule name (Choose supply fan schedule) Choice, Required Value: (VRF TU auto fan schedule 1) does not match that of the corresponding user argument Supply fan Schedule name (Choose supply fan schedule) Choice, Required Value: VRF TU auto fan schedule (VRF TU auto fan schedule)

each time i try to repeat this measure, they add a new schedule (VRF TU auto fan schedule 1)

How to avoid warning and unnecessary schedule ?

Note : Have any pathway for show the code as cool as in Unmethours in Notepad++ ???