Measures/m_5_example_5_computed_schedule/measure.rb
# define what happens when the measure is run
define what happens when the measure is run
define what happens when the measure is run
def run(model, runner, user_arguments)
    super(model, runner, user_arguments)
    if !runner.validateUserArguments(arguments(model), user_arguments)
      return false
    end
    verbose_info_statements = runner.getBoolArgumentValue("verbose_info_statements",user_arguments)
    zones = runner.getOptionalWorkspaceObjectChoiceValue('zones', user_arguments, model) 
    internal_variable_availability_dictionary_reporting = runner.getStringArgumentValue('internal_variable_availability_dictionary_reporting', user_arguments)
    ems_runtime_language_debug_output_level = runner.getStringArgumentValue('ems_runtime_language_debug_output_level', user_arguments)
    actuator_availability_dictionary_reporting = runner.getStringArgumentValue('actuator_availability_dictionary_reporting', user_arguments)
    runner.registerInitialCondition("Measure began with #{model.getEnergyManagementSystemSensors.count} EMS sensors, #{model.getEnergyManagementSystemActuators.count} EMS Actuators, #{model.getEnergyManagementSystemPrograms.count} EMS Programs, #{model.getEnergyManagementSystemSubroutines.count} EMS Subroutines, #{model.getEnergyManagementSystemProgramCallingManagers.count} EMS Program Calling Manager objects")
    apply_to_all_zones = false
    selected_zone = nil
    if zones.empty?
      handle = runner.getStringArgumentValue('zones', user_arguments)
      if handle.empty?
        runner.registerError('No thermal zone was chosen.')
        return false
      else
        runner.registerError("The selected thermal zone with handle '#{handle}' was not found in the model. It may have been removed by another measure.")
        return false
      end
    else
      if !zones.get.to_ThermalZone.empty?
        selected_zone = zones.get.to_ThermalZone.get
      elsif !zones.get.to_Building.empty?
        apply_to_all_zones = true
      else
        runner.registerError('Script Error - argument not showing up as thermal zone.')
        return false
      end
    end
    selected_zones = []
    if apply_to_all_zones == true
       model.getThermalZones.each do |each_zone|
         if each_zone.thermostatSetpointDualSetpoint.is_initialized
           tstat = each_zone.thermostatSetpointDualSetpoint.get
           if tstat.heatingSetpointTemperatureSchedule.is_initialized || tstat.coolingSetpointTemperatureSchedule.is_initialized
             selected_zones << each_zone
           end
         end  
       end  
    else
      selected_zones << selected_zone
    end
    constant_clg_setpt = 24 
    constant_htg_setpt = 21 
    constant_htg_setpt_sch = OpenStudio::Model::ScheduleConstant.new(model)
    constant_htg_setpt_sch.setName("HTGSETP_SCH")
    constant_htg_setpt_sch.setValue(constant_htg_setpt)
    if verbose_info_statements == true
      runner.registerInfo("Created new Schedule:Constant object representing constant a heating temp of #{OpenStudio.convert(constant_htg_setpt,"C","F")} deg F.") 
    end
    constant_clg_setpt_sch = OpenStudio::Model::ScheduleConstant.new(model)
    constant_clg_setpt_sch.setName("CLGSETP_SCH")
    constant_clg_setpt_sch.setValue(constant_clg_setpt)
    if verbose_info_statements == true
      runner.registerInfo("Created new Schedule:Constant object representing constant a cooling temp of #{OpenStudio.convert(constant_clg_setpt,"C","F")} deg F.") 
    end
    selected_zones.each do |zone|
      tstat_dual_setpt = zone.thermostatSetpointDualSetpoint
      if tstat_dual_setpt.is_initialized
        tstat_dual_setpt = tstat_dual_setpt.get
        exg_htg_temp_sch = tstat_dual_setpt.heatingSetpointTemperatureSchedule
        if exg_htg_temp_sch.is_initialized
          exg_htg_temp_sch = exg_htg_temp_sch.get
          exg_htg_temp_sch_name = exg_htg_temp_sch.name
          tstat_dual_setpt.setHeatingSchedule(constant_htg_setpt_sch)
          if verbose_info_statements == true
            runner.registerInfo("For Dual Setpoint T-stat serving the zone named #{zone.name}, replaced htg setpoint schedule named #{exg_htg_temp_sch_name} with new schedule named #{constant_htg_setpt_sch.name}.") 
          end
        end
        exg_clg_temp_sch = tstat_dual_setpt.coolingSetpointTemperatureSchedule
        if exg_clg_temp_sch.is_initialized
          exg_clg_temp_sch = exg_clg_temp_sch.get
          exg_clg_temp_sch_name = exg_clg_temp_sch.name
          tstat_dual_setpt.setCoolingSchedule(constant_clg_setpt_sch)
          if verbose_info_statements == true
            runner.registerInfo("For Dual Setpoint T-stat serving zone named #{zone.name}, replaced clg setpoint schedule named #{exg_clg_temp_sch_name} with new schedule named #{constant_clg_setpt_sch.name}.") 
          end
        end
      else
        runner.RegisterError("This measure was written to modify the schedules of an existing Dual Setpoint Thermostat schedule. the zone named #{zone.name} does not have this type of thermostat object. Please correct and re-run.")
        retun false
      end      
    end 
    ems_htg_sch_actuator = OpenStudio::Model::EnergyManagementSystemActuator.new(constant_htg_setpt_sch,"Schedule:Constant","Schedule Value")
    ems_htg_sch_actuator.setName("myHTGSETP_SCH")
    if verbose_info_statements == true
      runner.registerInfo("EMS Actuator object named '#{ems_htg_sch_actuator.name}' representing the htg t-stat schedule named #{constant_htg_setpt_sch.name} added to the model.") 
    end
    ems_clg_sch_actuator = OpenStudio::Model::EnergyManagementSystemActuator.new(constant_clg_setpt_sch,"Schedule:Constant","Schedule Value")
    ems_clg_sch_actuator.setName("myCLGSETP_SCH")
    if verbose_info_statements == true
      runner.registerInfo("EMS Actuator object named '#{ems_clg_sch_actuator.name}' representing the clg t-stat schedule named #{constant_clg_setpt_sch.name} added to the model.") 
    end
    ems_clg_setpoint_prg = OpenStudio::Model::EnergyManagementSystemProgram.new(model)
    ems_clg_setpoint_prg.setName("MyComputedCoolingSetpointProg")
    ems_clg_setpoint_prg.addLine("IF (DayOfWeek == 1)")
    ems_clg_setpoint_prg.addLine("SET #{ems_clg_sch_actuator.name} = 30.0")
    ems_clg_setpoint_prg.addLine("ELSEIF (Holiday == 3.0) && (DayOfMonth == 21) && (Month == 1)") 
    ems_clg_setpoint_prg.addLine("SET #{ems_clg_sch_actuator.name} = 30.0")
    ems_clg_setpoint_prg.addLine("ELSEIF HOUR < 6")
    ems_clg_setpoint_prg.addLine("SET #{ems_clg_sch_actuator.name} = 30.0")
    ems_clg_setpoint_prg.addLine("ELSEIF (Hour >= 6) && (Hour < 22) && (DayOfWeek >= 2) && (DayOfWeek <= 6)")
    ems_clg_setpoint_prg.addLine("SET #{ems_clg_sch_actuator.name} = 24.0")
    ems_clg_setpoint_prg.addLine("ELSEIF (Hour >= 6) && (hour < 18) && (DayOfWeek == 7)") 
    ems_clg_setpoint_prg.addLine("SET #{ems_clg_sch_actuator.name} = 24.0")
    ems_clg_setpoint_prg.addLine("ELSEIF (Hour >= 6) && (hour >= 18) && (DayOfWeek == 7)")
    ems_clg_setpoint_prg.addLine("SET #{ems_clg_sch_actuator.name} = 30.0")
    ems_clg_setpoint_prg.addLine("ELSEIF (Hour >= 22)")
    ems_clg_setpoint_prg.addLine("SET #{ems_clg_sch_actuator.name} = 30.0")
    ems_clg_setpoint_prg.addLine("ENDIF") 
    if verbose_info_statements == true
      runner.registerInfo("EMS Program object named '#{ems_clg_setpoint_prg.name}' added to modify the clg setpoint of qualifed zones based on EMS logic.")
    end
    ems_htg_setpoint_prg = OpenStudio::Model::EnergyManagementSystemProgram.new(model)
    ems_htg_setpoint_prg.setName("MyComputedHeatingSetpointProg")
    ems_htg_setpoint_prg.addLine("SET locHour = Hour")      
    ems_htg_setpoint_prg.addLine("SET locDay = DayOfWeek")  
    ems_htg_setpoint_prg.addLine("SET locHol = Holiday")    
    ems_htg_setpoint_prg.addLine("IF (DayOfWeek == 1)")
    ems_htg_setpoint_prg.addLine("SET #{ems_htg_sch_actuator.name} = 15.6")
    ems_htg_setpoint_prg.addLine("ELSEIF (Holiday == 3.0) && (DayOfYear == 21)")    
    ems_htg_setpoint_prg.addLine("SET #{ems_htg_sch_actuator.name} = 21.0")
    ems_htg_setpoint_prg.addLine("ELSEIF HOUR < 5")
    ems_htg_setpoint_prg.addLine("SET #{ems_htg_sch_actuator.name} = 15.6")
    ems_htg_setpoint_prg.addLine("ELSEIF (Hour >= 5) && (Hour < 19) && (DayOfWeek >= 2) && (DayOfWeek <= 6)")
    ems_htg_setpoint_prg.addLine("SET #{ems_htg_sch_actuator.name} = 21.0")
    ems_htg_setpoint_prg.addLine("ELSEIF (Hour >= 6) && (hour < 17) && (DayOfWeek == 7)")
    ems_htg_setpoint_prg.addLine("SET #{ems_htg_sch_actuator.name} = 21.0")
    ems_htg_setpoint_prg.addLine("ELSEIF (Hour >= 6) && (hour <= 17) && (DayOfWeek == 7)")
    ems_htg_setpoint_prg.addLine("SET #{ems_htg_sch_actuator.name} = 15.6")
    ems_htg_setpoint_prg.addLine("ELSEIF (Hour >= 19)")
    ems_htg_setpoint_prg.addLine("SET #{ems_htg_sch_actuator.name} = 15.6")
    ems_htg_setpoint_prg.addLine("ENDIF")
    if verbose_info_statements == true
      runner.registerInfo("EMS Program object named '#{ems_htg_setpoint_prg.name}' added to modify the htg setpoint of qualified zone based on EMS logic.")
    end
    ems_prgm_calling_mngr = OpenStudio::Model::EnergyManagementSystemProgramCallingManager.new(model)
    ems_prgm_calling_mngr.setName("My Setpoint Schedule Calculator Example")
    ems_prgm_calling_mngr.setCallingPoint("BeginTimestepBeforePredictor")
    ems_prgm_calling_mngr.addProgram(ems_clg_setpoint_prg)
    ems_prgm_calling_mngr.addProgram(ems_htg_setpoint_prg)
    runner.registerInfo("EMS Program Calling Manager object named '#{ems_prgm_calling_mngr.name}' added to call #{ems_clg_setpoint_prg.name} and #{ems_htg_setpoint_prg.name} EMS programs.") 
    output_EMS = model.getOutputEnergyManagementSystem
    output_EMS.setInternalVariableAvailabilityDictionaryReporting('internal_variable_availability_dictionary_reporting')
    output_EMS.setEMSRuntimeLanguageDebugOutputLevel('ems_runtime_language_debug_output_level')
    output_EMS.setActuatorAvailabilityDictionaryReporting('actuator_availability_dictionary_reporting')
    htg_schedule_output_variable = OpenStudio::Model::OutputVariable.new('Schedule Value', model)
    htg_schedule_output_variable.setReportingFrequency('timestep')
    sch_name = constant_htg_setpt_sch.name.to_s
    htg_schedule_output_variable.setKeyValue(sch_name)
    htg_schedule_output_variable.setVariableName('Schedule Value')
    if verbose_info_statements == true
      runner.registerInfo("A new E+ output variable object named '#{htg_schedule_output_variable.name}' was added to the .rdd file generated by model.") 
    end
    clg_schedule_output_variable = OpenStudio::Model::OutputVariable.new('Schedule Value', model)
    clg_schedule_output_variable.setReportingFrequency('timestep')
    sch_name =  constant_clg_setpt_sch.name.to_s
    clg_schedule_output_variable.setKeyValue(sch_name)
    clg_schedule_output_variable.setVariableName('Schedule Value')
    if verbose_info_statements == true
      runner.registerInfo("A new E+ output variable object named '#{clg_schedule_output_variable.name}' was added to the .rdd file generated by model.") 
    end
    runner.registerFinalCondition("Measure finished with #{model.getEnergyManagementSystemSensors.count} EMS sensors, #{model.getEnergyManagementSystemActuators.count} EMS Actuators, #{model.getEnergyManagementSystemPrograms.count} EMS Programs, #{model.getEnergyManagementSystemSubroutines.count} EMS Subroutines, #{model.getEnergyManagementSystemProgramCallingManagers.count} EMS Program Calling Manager objects")
  end
def run ( model , runner , user_arguments ) super ( model , runner , user_arguments ) if ! runner . validateUserArguments ( arguments ( model ) , user_arguments ) return false end verbose_info_statements = runner . getBoolArgumentValue ( "verbose_info_statements" , user_arguments ) zones = runner . getOptionalWorkspaceObjectChoiceValue ( 'zones' , user_arguments , model ) internal_variable_availability_dictionary_reporting = runner . getStringArgumentValue ( 'internal_variable_availability_dictionary_reporting' , user_arguments ) ems_runtime_language_debug_output_level = runner . getStringArgumentValue ( 'ems_runtime_language_debug_output_level' , user_arguments ) actuator_availability_dictionary_reporting = runner . getStringArgumentValue ( 'actuator_availability_dictionary_reporting' , user_arguments ) runner . registerInitialCondition ( "Measure began with #{model.getEnergyManagementSystemSensors.count} EMS sensors, #{model.getEnergyManagementSystemActuators.count} EMS Actuators, #{model.getEnergyManagementSystemPrograms.count} EMS Programs, #{model.getEnergyManagementSystemSubroutines.count} EMS Subroutines, #{model.getEnergyManagementSystemProgramCallingManagers.count} EMS Program Calling Manager objects" ) apply_to_all_zones = false selected_zone = nil if zones . empty? handle = runner . getStringArgumentValue ( 'zones' , user_arguments ) if handle . empty? runner . registerError ( 'No thermal zone was chosen.' ) return false else runner . registerError ( "The selected thermal zone with handle '#{handle}' was not found in the model. It may have been removed by another measure." ) return false end else if ! zones . get . to_ThermalZone . empty? selected_zone = zones . get . to_ThermalZone . get elsif ! zones . get . to_Building . empty? apply_to_all_zones = true else runner . registerError ( 'Script Error - argument not showing up as thermal zone.' ) return false end end selected_zones = [ ] if apply_to_all_zones == true model . getThermalZones . each do | each_zone | if each_zone . thermostatSetpointDualSetpoint . is_initialized tstat = each_zone . thermostatSetpointDualSetpoint . get if tstat . heatingSetpointTemperatureSchedule . is_initialized || tstat . coolingSetpointTemperatureSchedule . is_initialized selected_zones << each_zone end end end else selected_zones << selected_zone end constant_clg_setpt = 24 constant_htg_setpt = 21 constant_htg_setpt_sch = OpenStudio :: Model :: ScheduleConstant . new ( model ) constant_htg_setpt_sch . setName ( "HTGSETP_SCH" ) constant_htg_setpt_sch . setValue ( constant_htg_setpt ) if verbose_info_statements == true runner . registerInfo ( "Created new Schedule:Constant object representing constant a heating temp of #{OpenStudio.convert(constant_htg_setpt,"C","F")} deg F." ) end constant_clg_setpt_sch = OpenStudio :: Model :: ScheduleConstant . new ( model ) constant_clg_setpt_sch . setName ( "CLGSETP_SCH" ) constant_clg_setpt_sch . setValue ( constant_clg_setpt ) if verbose_info_statements == true runner . registerInfo ( "Created new Schedule:Constant object representing constant a cooling temp of #{OpenStudio.convert(constant_clg_setpt,"C","F")} deg F." ) end selected_zones . each do | zone | tstat_dual_setpt = zone . thermostatSetpointDualSetpoint if tstat_dual_setpt . is_initialized tstat_dual_setpt = tstat_dual_setpt . get exg_htg_temp_sch = tstat_dual_setpt . heatingSetpointTemperatureSchedule if exg_htg_temp_sch . is_initialized exg_htg_temp_sch = exg_htg_temp_sch . get exg_htg_temp_sch_name = exg_htg_temp_sch . name tstat_dual_setpt . setHeatingSchedule ( constant_htg_setpt_sch ) if verbose_info_statements == true runner . registerInfo ( "For Dual Setpoint T-stat serving the zone named #{zone.name}, replaced htg setpoint schedule named #{exg_htg_temp_sch_name} with new schedule named #{constant_htg_setpt_sch.name}." ) end end exg_clg_temp_sch = tstat_dual_setpt . coolingSetpointTemperatureSchedule if exg_clg_temp_sch . is_initialized exg_clg_temp_sch = exg_clg_temp_sch . get exg_clg_temp_sch_name = exg_clg_temp_sch . name tstat_dual_setpt . setCoolingSchedule ( constant_clg_setpt_sch ) if verbose_info_statements == true runner . registerInfo ( "For Dual Setpoint T-stat serving zone named #{zone.name}, replaced clg setpoint schedule named #{exg_clg_temp_sch_name} with new schedule named #{constant_clg_setpt_sch.name}." ) end end else runner . RegisterError ( "This measure was written to modify the schedules of an existing Dual Setpoint Thermostat schedule. the zone named #{zone.name} does not have this type of thermostat object. Please correct and re-run." ) retun false end end ems_htg_sch_actuator = OpenStudio :: Model :: EnergyManagementSystemActuator . new ( constant_htg_setpt_sch , "Schedule:Constant" , "Schedule Value" ) ems_htg_sch_actuator . setName ( "myHTGSETP_SCH" ) if verbose_info_statements == true runner . registerInfo ( "EMS Actuator object named '#{ems_htg_sch_actuator.name}' representing the htg t-stat schedule named #{constant_htg_setpt_sch.name} added to the model." ) end ems_clg_sch_actuator = OpenStudio :: Model :: EnergyManagementSystemActuator . new ( constant_clg_setpt_sch , "Schedule:Constant" , "Schedule Value" ) ems_clg_sch_actuator . setName ( "myCLGSETP_SCH" ) if verbose_info_statements == true runner . registerInfo ( "EMS Actuator object named '#{ems_clg_sch_actuator.name}' representing the clg t-stat schedule named #{constant_clg_setpt_sch.name} added to the model." ) end ems_clg_setpoint_prg = OpenStudio :: Model :: EnergyManagementSystemProgram . new ( model ) ems_clg_setpoint_prg . setName ( "MyComputedCoolingSetpointProg" ) ems_clg_setpoint_prg . addLine ( "IF (DayOfWeek == 1)" ) ems_clg_setpoint_prg . addLine ( "SET #{ems_clg_sch_actuator.name} = 30.0" ) ems_clg_setpoint_prg . addLine ( "ELSEIF (Holiday == 3.0) && (DayOfMonth == 21) && (Month == 1)" ) ems_clg_setpoint_prg . addLine ( "SET #{ems_clg_sch_actuator.name} = 30.0" ) ems_clg_setpoint_prg . addLine ( "ELSEIF HOUR < 6" ) ems_clg_setpoint_prg . addLine ( "SET #{ems_clg_sch_actuator.name} = 30.0" ) ems_clg_setpoint_prg . addLine ( "ELSEIF (Hour >= 6) && (Hour < 22) && (DayOfWeek >= 2) && (DayOfWeek <= 6)" ) ems_clg_setpoint_prg . addLine ( "SET #{ems_clg_sch_actuator.name} = 24.0" ) ems_clg_setpoint_prg . addLine ( "ELSEIF (Hour >= 6) && (hour < 18) && (DayOfWeek == 7)" ) ems_clg_setpoint_prg . addLine ( "SET #{ems_clg_sch_actuator.name} = 24.0" ) ems_clg_setpoint_prg . addLine ( "ELSEIF (Hour >= 6) && (hour >= 18) && (DayOfWeek == 7)" ) ems_clg_setpoint_prg . addLine ( "SET #{ems_clg_sch_actuator.name} = 30.0" ) ems_clg_setpoint_prg . addLine ( "ELSEIF (Hour >= 22)" ) ems_clg_setpoint_prg . addLine ( "SET #{ems_clg_sch_actuator.name} = 30.0" ) ems_clg_setpoint_prg . addLine ( "ENDIF" ) if verbose_info_statements == true runner . registerInfo ( "EMS Program object named '#{ems_clg_setpoint_prg.name}' added to modify the clg setpoint of qualifed zones based on EMS logic." ) end ems_htg_setpoint_prg = OpenStudio :: Model :: EnergyManagementSystemProgram . new ( model ) ems_htg_setpoint_prg . setName ( "MyComputedHeatingSetpointProg" ) ems_htg_setpoint_prg . addLine ( "SET locHour = Hour" ) ems_htg_setpoint_prg . addLine ( "SET locDay = DayOfWeek" ) ems_htg_setpoint_prg . addLine ( "SET locHol = Holiday" ) ems_htg_setpoint_prg . addLine ( "IF (DayOfWeek == 1)" ) ems_htg_setpoint_prg . addLine ( "SET #{ems_htg_sch_actuator.name} = 15.6" ) ems_htg_setpoint_prg . addLine ( "ELSEIF (Holiday == 3.0) && (DayOfYear == 21)" ) ems_htg_setpoint_prg . addLine ( "SET #{ems_htg_sch_actuator.name} = 21.0" ) ems_htg_setpoint_prg . addLine ( "ELSEIF HOUR < 5" ) ems_htg_setpoint_prg . addLine ( "SET #{ems_htg_sch_actuator.name} = 15.6" ) ems_htg_setpoint_prg . addLine ( "ELSEIF (Hour >= 5) && (Hour < 19) && (DayOfWeek >= 2) && (DayOfWeek <= 6)" ) ems_htg_setpoint_prg . addLine ( "SET #{ems_htg_sch_actuator.name} = 21.0" ) ems_htg_setpoint_prg . addLine ( "ELSEIF (Hour >= 6) && (hour < 17) && (DayOfWeek == 7)" ) ems_htg_setpoint_prg . addLine ( "SET #{ems_htg_sch_actuator.name} = 21.0" ) ems_htg_setpoint_prg . addLine ( "ELSEIF (Hour >= 6) && (hour <= 17) && (DayOfWeek == 7)" ) ems_htg_setpoint_prg . addLine ( "SET #{ems_htg_sch_actuator.name} = 15.6" ) ems_htg_setpoint_prg . addLine ( "ELSEIF (Hour >= 19)" ) ems_htg_setpoint_prg . addLine ( "SET #{ems_htg_sch_actuator.name} = 15.6" ) ems_htg_setpoint_prg . addLine ( "ENDIF" ) if verbose_info_statements == true runner . registerInfo ( "EMS Program object named '#{ems_htg_setpoint_prg.name}' added to modify the htg setpoint of qualified zone based on EMS logic." ) end ems_prgm_calling_mngr = OpenStudio :: Model :: EnergyManagementSystemProgramCallingManager . new ( model ) ems_prgm_calling_mngr . setName ( "My Setpoint Schedule Calculator Example" ) ems_prgm_calling_mngr . setCallingPoint ( "BeginTimestepBeforePredictor" ) ems_prgm_calling_mngr . addProgram ( ems_clg_setpoint_prg ) ems_prgm_calling_mngr . addProgram ( ems_htg_setpoint_prg ) runner . registerInfo ( "EMS Program Calling Manager object named '#{ems_prgm_calling_mngr.name}' added to call #{ems_clg_setpoint_prg.name} and #{ems_htg_setpoint_prg.name} EMS programs." ) output_EMS = model . getOutputEnergyManagementSystem output_EMS . setInternalVariableAvailabilityDictionaryReporting ( 'internal_variable_availability_dictionary_reporting' ) output_EMS . setEMSRuntimeLanguageDebugOutputLevel ( 'ems_runtime_language_debug_output_level' ) output_EMS . setActuatorAvailabilityDictionaryReporting ( 'actuator_availability_dictionary_reporting' ) htg_schedule_output_variable = OpenStudio :: Model :: OutputVariable . new ( 'Schedule Value' , model ) htg_schedule_output_variable . setReportingFrequency ( 'timestep' ) sch_name = constant_htg_setpt_sch . name . to_s htg_schedule_output_variable . setKeyValue ( sch_name ) htg_schedule_output_variable . setVariableName ( 'Schedule Value' ) if verbose_info_statements == true runner . registerInfo ( "A new E+ output variable object named '#{htg_schedule_output_variable.name}' was added to the .rdd file generated by model." ) end clg_schedule_output_variable = OpenStudio :: Model :: OutputVariable . new ( 'Schedule Value' , model ) clg_schedule_output_variable . setReportingFrequency ( 'timestep' ) sch_name = constant_clg_setpt_sch . name . to_s clg_schedule_output_variable . setKeyValue ( sch_name ) clg_schedule_output_variable . setVariableName ( 'Schedule Value' ) if verbose_info_statements == true runner . registerInfo ( "A new E+ output variable object named '#{clg_schedule_output_variable.name}' was added to the .rdd file generated by model." ) end runner . registerFinalCondition ( "Measure finished with #{model.getEnergyManagementSystemSensors.count} EMS sensors, #{model.getEnergyManagementSystemActuators.count} EMS Actuators, #{model.getEnergyManagementSystemPrograms.count} EMS Programs, #{model.getEnergyManagementSystemSubroutines.count} EMS Subroutines, #{model.getEnergyManagementSystemProgramCallingManagers.count} EMS Program Calling Manager objects" ) end
define what happens when the measure is run
define what happens when the measure is run
# use the built-in error checking # assign the user inputs to variables # model is passed in because of argument type # check the zone selection for existence in model # define selected zones, depending on user input, add selected zones to an array # Deg C, from EMS Application Guide # Deg C, from EMS Application Guide # create ScheduleConstant object for heating schedule  # create ScheduleConstant object for cooling schedule  #loop through selected conditioned zone(s), find dual setpoint T-stat, and assign new htg and clg T-stat schedules  # get existing zone heating t-stat schedule - an OpenStudio resource object # replace existing heating T-stat schedule with constant temp schedule so that the existing schedule object (a resource   # object potentially referenced elsewhere in the osm file) is not tampered with. # get existing zone cooling t-stat schedule         # replace existing cooling T-stat schedule with constant temp schedule so that the existing schedule object (a resource   # object potentially referenced elsewhere in the osm file) is not tampered with. # end loop through selected_zones # Create EMS Actuator Objects # Create new EnergyManagementSystem:Program object for computing cooling setpoint and modfying the clg schedule # Winter Design Day # Create new EnergyManagementSystem:Program object for computing heating setpoint # Echo out for debug # Echo out for debug # Echo out for debug # Winter Design Day # create new EnergyManagementSystem:ProgramCallingManager object and configure to call htg and clg setpoint EMS programs # create OutputEnergyManagementSystem object (a 'unique' object) and configure to allow EMS reporting # create output variables for reporting on EMS actuated objects
model
<not_specific>
runner
<not_specific>
user_arguments
<not_specific>