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

Revision history [back]

Hourly changes in simulation conditions using EMS using .csv values

I have been trying to bring in hourly changes in simulation conditions that take values from a .csv file and convert them to the values take by the EMS sensor. This I am trying to implement on 2 aspects: 1. The construction (in order to change the aspects of SHGC and Visible Transmittance values of a Simple Glazing unit), for which I'm creating 7 states which are defined in the code and trying to choose the appropriate construction based on the corresponding value in .csv file. 2. The LPD of artificial lighting by choosing the appropriate value for the hour from the .csv file.

The end-result that I'm trying to acheve is similar to the question asked in https://unmethours.com/question/47169/how-to-add-variable-envelope-properties-in-energyplus-through-ems/ , but I faced difficulty in implementing it which is why I have posted as a separate question. Kindly help me out. The input .csv files that I want to use are attached here

I'm attaching the code that I had tried, but it doesn't seem to be working. Since I'm a beginner in Measure Writing, I have tried to combine snippets from the following codes:

  1. M13Example13SurfaceConstructionActuatorForThermochromaticWindow: https://github.com/NREL/OpenStudio-EMS-Measures/blob/master/Measures/m_13_example_13_surface_construction_actuator_for_thermochromatic_window/measure.rb
  2. Set Lighting Loads by LPD: https://bcl.nrel.gov/node/84704
  3. Replace Exterior Window Constructions with a Different Construction from the Model: https://bcl.nrel.gov/node/84690
  4. Add Interval Schedule From File: https://bcl.nrel.gov/node/84422

My Code:

# load dependencies
require 'csv'

# start the measure
class DynamicWindowGlazing < OpenStudio::Measure::ModelMeasure

  # display name
  def name
    return "Dynamic Window Glazing"
  end

  # description
  def description
    return "This measure adds an EMS object and a schedule object from a file of interval data"
  end

  # modeler description
  def modeler_description
    return "This measure simulates a dynamic glazing by adding an EnergyPlus object, Energy Management System and a ScheduleInterval object from a user-specified .csv file. The measure supports hourly and 15 min interval data for leap and non-leap years.  The .csv file must contain only schedule values in the first column with 8760, 8784, 35040, or 35136 rows specified. See the example .csv files in the tests directory of this measure."
  end

  # define the arguments that the user will input
  def arguments(model)
    args = OpenStudio::Measure::OSArgumentVector.new

    # make an argument for removing existing
    remove_existing_schedule_intervals = OpenStudio::Ruleset::OSArgument::makeBoolArgument('remove_existing_schedule_intervals', true)
    remove_existing_schedule_intervals.setDisplayName('Remove existing ScheduleInterval objects?')
    remove_existing_schedule_intervals.setDefaultValue(false)
    args << remove_existing_schedule_intervals

    # 1) Choice List of a FixedWindow subsurface to apply a thermochromic window construction to 
    fixed_window_subsurface_handles = OpenStudio::StringVector.new
    fixed_window_subsurface_display_names = OpenStudio::StringVector.new
    subsurface_array = []

    # put all model subsurfaces and names into arrays
    model.getSurfaces.each do |surface|
      surface.subSurfaces.each do |sub_surface|
        subsurface_array << sub_surface
      end
    end

    subsurface_array.each do |subsurface|
      if subsurface.subSurfaceType == "FixedWindow"
        fixed_window_subsurface_handles << subsurface.handle.to_s
        fixed_window_subsurface_display_names << subsurface.name.to_s
      end
    end

    # make a choice argument for a subsurface of type FixedWindow
    fixed_window_subsurface = OpenStudio::Ruleset::OSArgument.makeChoiceArgument('fixed_window_subsurface', fixed_window_subsurface_handles, fixed_window_subsurface_display_names, true)
    fixed_window_subsurface.setDisplayName('Choose a Fixed Window Subsurface to Replace with an EMS generated Electrochromic window construction.')
    fixed_window_subsurface.setDefaultValue('Perimeter_ZN_1_wall_south_Window_1')
    args << fixed_window_subsurface 

    # make an argument for schedule name for Construction Schedule
    schedule_name_1 = OpenStudio::Ruleset::OSArgument::makeStringArgument('Construction Schedule', true)
    schedule_name_1.setDisplayName('Construction Schedule:')
    schedule_name_1.setDefaultValue('Construction Schedule From File')
    args << schedule_name_1

    # make an argument for file path for Construction values
    file_path_1 = OpenStudio::Ruleset::OSArgument.makeStringArgument('file_path_1', true)
    file_path_1.setDisplayName('Enter the path to the file that contains schedule values (follow template in test folder of this measure):')
    file_path_1.setDescription("Example: 'C:\\Projects\\values.csv'")
    args << file_path_1

    # make an argument for schedule name for Artificial Lighting Schedule Schedule
    schedule_name_2 = OpenStudio::Ruleset::OSArgument::makeStringArgument('Artificial Lighting Schedule', true)
    schedule_name_2.setDisplayName('Artificial Lighting Schedule:')
    schedule_name_2.setDefaultValue('Artificial Lighting Schedule From File')
    args << schedule_name_2

    # make an argument for file path for Artificial Lighting values
    file_path_2 = OpenStudio::Ruleset::OSArgument.makeStringArgument('file_path_2', true)
    file_path_2.setDisplayName('Enter the path to the file that contains schedule values (follow template in test folder of this measure):')
    file_path_2.setDescription("Example: 'C:\\Projects\\values.csv'")
    args << file_path_2   

    ## requirements for artificial lights
    # make a choice argument for model objects
    space_type_handles = OpenStudio::StringVector.new
    space_type_display_names = OpenStudio::StringVector.new

    # putting model object and names into hash
    space_type_args = model.getSpaceTypes
    space_type_args_hash = {}
    space_type_args.each do |space_type_arg|
      space_type_args_hash[space_type_arg.name.to_s] = space_type_arg
    end

    # looping through sorted hash of model objects
    space_type_args_hash.sort.map do |key, value|
      # only include if space type is used in the model
      if !value.spaces.empty?
        space_type_handles << value.handle.to_s
        space_type_display_names << key
      end
    end

    # add building to string vector with space type
    building = model.getBuilding
    space_type_handles << building.handle.to_s
    space_type_display_names << '*Entire Building*'

    # make a choice argument for space type or entire building
    space_type = OpenStudio::Measure::OSArgument.makeChoiceArgument('space_type', space_type_handles, space_type_display_names, true)
    space_type.setDisplayName('Apply the Measure to a Specific Space Type or to the Entire Model')
    space_type.setDefaultValue('*Entire Building*') # if no space type is chosen this will run on the entire building
    args << space_type

    # add in argument to add lights to all spaces that are included in building floor area even if original space didn't have lights
    add_instance_all_spaces = OpenStudio::Measure::OSArgument.makeBoolArgument('add_instance_all_spaces', true)
    add_instance_all_spaces.setDisplayName('Add lights to all spaces included in floor area, including spaces that did not originally include lights')
    add_instance_all_spaces.setDefaultValue(false)
    args << add_instance_all_spaces

    return args
  end

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

    construction_array = []
    ems_window_construction_array = []


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

    # assign the user inputs to variables for schedules
    remove_existing_schedule_intervals = runner.getBoolArgumentValue('remove_existing_schedule_intervals', user_arguments)
    schedule_name_1 = runner.getStringArgumentValue('schedule_name_1', user_arguments)
    file_path_1 = runner.getStringArgumentValue('file_path_1', user_arguments)
    schedule_name_2 = runner.getStringArgumentValue('schedule_name_2', user_arguments)
    file_path_2 = runner.getStringArgumentValue('file_path_2', user_arguments)

    # assign the user inputs to variables for artificial lights
    object = runner.getOptionalWorkspaceObjectChoiceValue('space_type', user_arguments, model)
    add_instance_all_spaces = runner.getBoolArgumentValue('add_instance_all_spaces', user_arguments)

    # check the space_type for reasonableness and see if measure should run on space type or on the entire building
    apply_to_building = false
    space_type = nil
    if object.empty?
      handle = runner.getStringArgumentValue('space_type', user_arguments)
      if handle.empty?
        runner.registerError('No SpaceType was chosen.')
      else
        runner.registerError("The selected space type with handle '#{handle}' was not found in the model. It may have been removed by another measure.")
      end
      return false
    else
      if !object.get.to_SpaceType.empty?
        space_type = object.get.to_SpaceType.get
      elsif !object.get.to_Building.empty?
        apply_to_building = true
        # space_type = model.getSpaceTypes
      else
        runner.registerError('Script Error - argument not showing up as space type or building.')
        return false
      end
    end

    # get existing schedules
    schedule_intervals = model.getScheduleIntervals

    # report initial condition
    runner.registerInitialCondition("number of ScheduleInterval objects = #{schedule_intervals.size}")

    # remove existing schedules
    schedule_intervals.each(&:remove) if remove_existing_schedule_intervals

    # check schedule name for reasonableness
    if schedule_name == ''
      runner.registerError('Schedule name is blank. Input a schedule name.')
      return false
    end

    # check file path for reasonableness
    if file_path.empty?
      runner.registerError('Empty file path was entered.')
      return false
    end

    # strip out the potential leading and trailing quotes
    file_path.gsub!('"', '')

    # check if file exists
    if !File.exist? file_path
      runner.registerError("The file at path #{file_path} doesn't exist.")
      return false
    end  

    # read in csv values
    csv_values = CSV.read(file_path,{headers: false, converters: :float})
    num_rows = csv_values.length

    # create values for the timeseries
    schedule_values = OpenStudio::Vector.new(num_rows, 0.0)
    csv_values.each_with_index do |csv_value,i|
      schedule_values[i] = csv_value[0]
    end

    # infer interval
    interval = []
    if (num_rows == 8760) || (num_rows == 8784) #h ourly data
      interval = OpenStudio::Time.new(0, 1, 0)
    elsif (num_rows == 35_040) || (num_rows == 35_136) # 15 min interval data
      interval = OpenStudio::Time.new(0, 0, 15)
    else
      runner.registerError('This measure does not support non-hourly or non-15 min interval data.  Cast your values as 15-min or hourly interval data.  See the values template.')
      return false
    end

    ##beginning of window construction change

    shgc=[0.1,0.2,0.3,0.4,0.5,0.6,0.7]
    tvis=[0.1,0.2,0.3,0.4,0.5,0.6,0.7]

    (0..7).each do |j|
        # create construction and material and link them together
        construction = OpenStudio::Model::Construction.new(model)
        material = OpenStudio::Model::SimpleGlazing.new(model)

        # add material to constructions
        construction.insertLayer(0,material)

        # set material properties
        material.setUFactor(2.56)
        material.setSolarHeatGainCoefficient(shgc[j])
        material.setVisibleTransmittance(tvis[j])
        construction = [SimpleGlazing]
        construction_array << construction

        ems_window_construction = OpenStudio::Model::Construction.new(const)
        ems_window_construction.setName("Construction #{[j]}")
        runner.registerInfo("Created a new Construction named #{ems_window_construction.name} representing an electrochromatic window construction.")
        ems_window_construction_array << ems_window_construction
    end

    # check the user argument of the fixed window subsurface for reasonableness
    if fixed_window_subsurface.empty?
      handle = runner.getStringArgumentValue('fixed_window_subsurface', user_arguments)
      if handle.empty?
        runner.registerError('No fixed window subsurface was chosen.')
      else
        runner.registerError("The selected fixed window subsurface with handle '#{handle}' was not found in the model. It may have been removed by another measure.")
      end
      return false
    else
      if !fixed_window_subsurface.get.to_SubSurface.empty?
        fixed_window_subsurface = fixed_window_subsurface.get.to_SubSurface.get
      else
        runner.registerError('Script Error - argument not showing up as construction.')
        return false
      end
    end

    # creating an output variable for Schedule Value for Window Construction
    output_var_1 = "Schedule Value for Window Construction"
    output_var_construction = OpenStudio::Model::OutputVariable.new(output_var_1, model)

    # create a sensor to sense the Schedule Value for Window Tvis
    construction_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, output_var_construction)
    construction_sensor_name = "Construction Sensor"
    construction_sensor.setName(construction_sensor_name)

    # creating an output variable for Schedule Value for Artificial Lighting
    output_var_2 = "Schedule Value for Artificial Lighting"
    output_var_art_light = OpenStudio::Model::OutputVariable.new(output_var_2, model)

    # create a sensor to sense the Schedule Value for Artificial Lighting
    art_light_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, output_var_art_light)
    art_light_sensor_name = "Artificial Lighting Sensor"
    art_light_sensor.setName(art_light_sensor_name)

    # Create a new EMS Actuator Object representing the construction state of the EMS generated electrochromatic window 
    ems_win_construct_actuator = OpenStudio::Model::EnergyManagementSystemActuator.new(fixed_window_subsurface, "Surface", "Construction State")
    ems_win_construct_actuator.setName("Window_Construction_Set")
    runner.registerInfo("An EMS Actuator object named '#{ems_win_construct_actuator.name}' representing construction state of the EMS generated electrochromatic window was added to the model.") 


    # Create 7 EnergyManagementSystem:ConstructionIndexVariable objects for each unique electrochromatic construction
    ems_window_construction_array.each do |ems_window_construction|
        ems_constr_index_var = OpenStudio::Model::EnergyManagementSystemConstructionIndexVariable.new(model, ems_window_construction )   
        ems_constr_index_var.setName("#{ems_window_construction.name}")
        runner.registerInfo("An EMS SystemConstructionIndexVariable object named '#{ems_constr_index_var.name}' representing the the EMS construction state of the electrochromatic window was added to the model.") 
    end

    # Create new EnergyManagementSystem:Program object for assigning different window constructions by dynamically evaluating the exterior surface temp of the fixed window subsurface 
    ems_apply_electrochromatic_constructions_prgm = OpenStudio::Model::EnergyManagementSystemProgram.new(model)
    ems_apply_electrochromatic_constructions_prgm.setName("#{fixed_window_subsurface.name}_Control")
    ems_apply_electrochromatic_constructions_prgm.addLine("IF #{construction_sensor.name} == 1")
    ems_apply_electrochromatic_constructions_prgm.addLine("SET #{ems_win_construct_actuator.name} = 'Construction 1'")
    ems_apply_electrochromatic_constructions_prgm.addLine("ELSEIF #{construction_sensor.name} == 2")
    ems_apply_electrochromatic_constructions_prgm.addLine("SET #{ems_win_construct_actuator.name} = 'Construction 2'")
    ems_apply_electrochromatic_constructions_prgm.addLine("ELSEIF #{construction_sensor.name} == 3")
    ems_apply_electrochromatic_constructions_prgm.addLine("SET #{ems_win_construct_actuator.name} = 'Construction 3'")
    ems_apply_electrochromatic_constructions_prgm.addLine("ELSEIF #{construction_sensor.name} == 4")
    ems_apply_electrochromatic_constructions_prgm.addLine("SET #{ems_win_construct_actuator.name} = 'Construction 4'")
    ems_apply_electrochromatic_constructions_prgm.addLine("ELSEIF #{construction_sensor.name} == 5")
    ems_apply_electrochromatic_constructions_prgm.addLine("SET #{ems_win_construct_actuator.name} = 'Construction 5'")
    ems_apply_electrochromatic_constructions_prgm.addLine("ELSEIF #{construction_sensor.name} == 6")
    ems_apply_electrochromatic_constructions_prgm.addLine("SET #{ems_win_construct_actuator.name} = 'Construction 6'")
    ems_apply_electrochromatic_constructions_prgm.addLine("ELSEIF #{construction_sensor.name} == 7")
    ems_apply_electrochromatic_constructions_prgm.addLine("SET #{ems_win_construct_actuator.name} = 'Construction 7'")
    ems_apply_electrochromatic_constructions_prgm.addLine("ENDIF")
    runner.registerInfo("An EMS Program Object named '#{ems_apply_electrochromatic_constructions_prgm.name}' for dynamically assigning different window constructions based on the exterior surface temp was added to the model.") 

    # loop through construction sets used in the model
    default_construction_sets = model.getDefaultConstructionSets
    default_construction_sets.each do |default_construction_set|
      if default_construction_set.directUseCount > 0
        default_sub_surface_const_set = default_construction_set.defaultExteriorSubSurfaceConstructions
        if !default_sub_surface_const_set.empty?
          starting_construction = default_sub_surface_const_set.get.fixedWindowConstruction

          # creating new default construction set
          new_default_construction_set = default_construction_set.clone(model)
          new_default_construction_set = new_default_construction_set.to_DefaultConstructionSet.get

          # create new sub_surface set
          new_default_sub_surface_const_set = default_sub_surface_const_set.get.clone(model)
          new_default_sub_surface_const_set = new_default_sub_surface_const_set.to_DefaultSubSurfaceConstructions.get

          # assign selected construction sub_surface set
          new_default_sub_surface_const_set.setFixedWindowConstruction(construction)

          # assign selected construction sub_surface set
          new_default_sub_surface_const_set.setOperableWindowConstruction(construction)

          # link new subset to new set
          new_default_construction_set.setDefaultExteriorSubSurfaceConstructions(new_default_sub_surface_const_set)
        end
      end
    end

    # Create a new EnergyManagementSystem:ProgramCallingManager object configured to call the EMS programs
    ems_prgm_calling_mngr = OpenStudio::Model::EnergyManagementSystemProgramCallingManager.new(model)
    ems_prgm_calling_mngr.setName("My Electrochromic window emulator")
    ems_prgm_calling_mngr.setCallingPoint("BeginTimestepBeforePredictor")
    ems_prgm_calling_mngr.addProgram(ems_apply_electrochromatic_constructions_prgm)
    runner.registerInfo("EMS Program Calling Manager object named '#{ems_prgm_calling_mngr.name}' added to call EMS program for dynamically applying a electrochromatic window.") 

    lighting_power_reduction_percent = runner.getDoubleArgumentValue('lighting_power_reduction_percent', user_arguments)

    # create unique object for OutputEnergyManagementSystems and configure to allow EMS reporting
    outputEMS = model.getOutputEnergyManagementSystem
    outputEMS.setInternalVariableAvailabilityDictionaryReporting("internal_variable_availability_dictionary_reporting")
    outputEMS.setEMSRuntimeLanguageDebugOutputLevel("ems_runtime_language_debug_output_level")
    outputEMS.setActuatorAvailabilityDictionaryReporting("actuator_availability_dictionary_reporting")
    runner.registerInfo("EMS OutputEnergyManagementSystem object configured per user arguments.") 

    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 of window construction change

    ##preliminary settings for artificial lighting setup

    # make a hash of old defs and new lights and luminaire defs
    cloned_lights_defs = {}
    cloned_luminaire_defs = {}

    # loop through space types
    space_types.each do |space_type|
        next if space_type.spaces.size <= 0
        space_type_lights = space_type.lights

        space_type_lights.each do |space_type_light|
            # clone def if it has not already been cloned
            exist_def = space_type_light.lightsDefinition
            if cloned_lights_defs.any? { |k, v| k.to_s == exist_def.name.to_s }
                new_def = cloned_lights_defs[exist_def.name.to_s]
            else
                # clone rename and add to hash
                new_def = exist_def.clone(model)
                new_def_name = new_def.setName("#{exist_def.name} - #{lighting_power_reduction_percent} percent reduction")
                cloned_lights_defs[exist_def.name.to_s] = new_def
                new_def = new_def.to_LightsDefinition.get
            end
        end
    end

      # link instance with clone and rename
      updated_instance = space_type_light.setLightsDefinition(new_def.to_LightsDefinition.get)
      updated_instance_name = space_type_light.setName("#{space_type_light.name} #{lighting_power_reduction_percent} percent reduction")


    space_type_luminaires = space_type.luminaires

    space_type_luminaires.each do |space_type_luminaire|
        # clone def if it has not already been cloned
        exist_def = space_type_luminaire.luminaireDefinition
        if cloned_luminaire_defs.any? { |k, v| k.to_s == exist_def.name }
            new_def = cloned_luminaire_defs[exist_def.name]
        else
            # clone rename and add to hash
            new_def = exist_def.clone(model)
            new_def_name = new_def.setName("#{new_def.name} - #{lighting_power_reduction_percent} percent reduction")
            cloned_luminaire_defs[exist_def.name] = new_def
            new_def = new_def.to_LightsDefinition.get
        end

      # link instance with clone and rename
      updated_instance = space_type_light.setLightsDefinition(new_def.to_LightsDefinition.get)
      updated_instance_name = space_type_light.setName("#{space_type_light.name} #{lighting_power_reduction_percent} percent reduction")
    end

    # getting spaces in the model
    spaces = model.getSpaces

    # get space types in model
    if apply_to_building
        spaces = model.getSpaces
    else
        if !space_type.spaces.empty?
        spaces = space_type.spaces # only run on a single space type
        end
    end

    spaces.each do |space|
        space_lights = space.lights
        space_lights.each do |space_light|
            # clone def if it has not already been cloned
            exist_def = space_light.lightsDefinition
            if cloned_lights_defs.any? { |k, v| k.to_s == exist_def.name.to_s }
                new_def = cloned_lights_defs[exist_def.name.to_s]
            else
                # clone rename and add to hash
                new_def = exist_def.clone(model)
                new_def_name = new_def.setName("#{new_def.name} - #{lighting_power_reduction_percent} percent reduction")
                cloned_lights_defs[exist_def.name.to_s] = new_def
                new_def = new_def.to_LightsDefinition.get
            end
        end
        # link instance with clone and rename
        updated_instance = space_light.setLightsDefinition(new_def.to_LightsDefinition.get)
        updated_instance_name = space_light.setName("#{space_light.name} #{lighting_power_reduction_percent} percent reduction")
    end

    space_luminaires = space.luminaires
    space_luminaires.each do |space_luminaire|
        # clone def if it has not already been cloned
        exist_def = space_luminaire.luminaireDefinition
        if cloned_luminaire_defs.any? { |k, v| k.to_s == exist_def.name }
            new_def = cloned_luminaire_defs[exist_def.name]
            else
                # clone rename and add to hash
                new_def = exist_def.clone(model)
                new_def_name = new_def.setName("#{new_def.name} - #{lighting_power_reduction_percent} percent reduction")
                cloned_luminaire_defs[exist_def.name] = new_def
                new_def = new_def.to_LightsDefinition.get
            end
            # link instance with clone and rename
            updated_instance = space_light.setLightsDefinition(new_def)
            updated_instance_name = space_light.setName("#{space_light.name} - #{lighting_power_reduction_percent} percent reduction")

        end


        ##beginning of artificial lighting change

        art_light_states=[5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80]

        (0..16).each do |j|
            # create a new LightsDefinition and new Lights object to use with setLightingPowerPerFloorArea
            template_light_def = OpenStudio::Model::LightsDefinition.new(model)

            ems_art_light = OpenStudio::Model::LightsDefinition.new(light)
            ems_art_light.setName("Light #{art_light_states[j]}")
            runner.registerInfo("Created a new Artificial Light named #{ems_art_light.name} representing an electrochromatic window construction.")
            ems_art_light_array << ems_art_light
        end  

        # creating an output variable for Schedule Value for Artificial Lighting
        output_var_2 = "Schedule Value for Artificial Lighting"
        output_var_art_light = OpenStudio::Model::OutputVariable.new(output_var_2, model)

        # create a sensor to sense the Schedule Value for Artificial Lighting
        art_light_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, output_var_art_light)
        art_light_sensor_name = "Artificial Lighting Sensor"
        art_light_sensor.setName(art_light_sensor_name)

        # Create a new EMS Actuator Object representing the artificial lighting state of the EMS generated artificial light 
        ems_art_light_actuator = OpenStudio::Model::EnergyManagementSystemActuator.new(lightsDefinition, "Light", "Lighting State")
        ems_art_light_actuator.setName("Artificial_Lighting_Set")
        runner.registerInfo("An EMS Actuator object named '#{ems_art_light_actuator.name}' representing lighting state of the EMS generated electrochromatic window was added to the model.") 


        # Create 7 EnergyManagementSystem:ConstructionIndexVariable objects for each unique electrochromatic construction
        ems_art_light_array.each do |ems_art_light|
            ems_art_light_index_var = OpenStudio::Model::EnergyManagementSystemLightIndexVariable.new(model, ems_art_light )   
            ems_art_light_index_var.setName("#{ems_art_light.name}")
            runner.registerInfo("An EMS SystemLightIndexVariable object named '#{ems_art_light_index_var.name}' representing the the EMS construction state of the artificial light was added to the model.") 
        end

        # Create new EnergyManagementSystem:Program object for assigning different window constructions by dynamically evaluating the exterior surface temp of the fixed window subsurface 
        ems_apply_art_light_prgm = OpenStudio::Model::EnergyManagementSystemProgram.new(model)
        ems_apply_art_light_prgm.setName("#{fixed_window_subsurface.name}_Control")
        ems_apply_art_light_prgm.addLine("IF #{art_light_sensor.name} == 10")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 10")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 15")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 15")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 20")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 20")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 25")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 25")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 30")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 30")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 35")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 35")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 40")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 40")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 45")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 45")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 50")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 50")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 55")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 55")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 60")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 60")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 65")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 65")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 70")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 70")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 75")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 75")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 80")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 80")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 85")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 85")
        ems_apply_art_light_prgm.addLine("ENDIF")
        runner.registerInfo("An EMS Program Object named '#{ems_apply_art_light_prgm.name}' for dynamically assigning different artificial lighting based on the values in the uploaded file was added to the model.") 

        # Create a new EnergyManagementSystem:ProgramCallingManager object configured to call the EMS programs
        ems_prgm_calling_mngr_2 = OpenStudio::Model::EnergyManagementSystemProgramCallingManager.new(model)
        ems_prgm_calling_mngr_2.setName("My Artificial Lighting emulator")
        ems_prgm_calling_mngr_2.setCallingPoint("BeginTimestepBeforePredictor")
        ems_prgm_calling_mngr_2.addProgram(ems_apply_art_light_prgm)
        runner.registerInfo("EMS Program Calling Manager object named '#{ems_prgm_calling_mngr_2.name}' added to call EMS program for dynamically applying a electrochromatic window.") 

        lighting_power_reduction_percent = runner.getDoubleArgumentValue('lighting_power_reduction_percent', user_arguments)

        # create unique object for OutputEnergyManagementSystems and configure to allow EMS reporting
        outputEMS = model.getOutputEnergyManagementSystem
        outputEMS.setInternalVariableAvailabilityDictionaryReporting("internal_variable_availability_dictionary_reporting")
        outputEMS.setEMSRuntimeLanguageDebugOutputLevel("ems_runtime_language_debug_output_level")
        outputEMS.setActuatorAvailabilityDictionaryReporting("actuator_availability_dictionary_reporting")
        runner.registerInfo("EMS OutputEnergyManagementSystem object configured per user arguments.") 

        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 of window construction change

        # make a schedule
        startDate = OpenStudio::Date.new(OpenStudio::MonthOfYear.new(1), 1)
        timeseries = OpenStudio::TimeSeries.new(startDate, interval, schedule_values)
        schedule = OpenStudio::Model::ScheduleInterval::fromTimeSeries(timeseries, model)
        if schedule.empty?
          runner.registerError("Unable to make schedule from file at '#{file_path}'")
          return false
        end
        schedule = schedule.get
        schedule.setName(schedule_name)

        # reporting final condition of model
        runner.registerFinalCondition("Added schedule #{schedule_name} to the model.")

        return true
      end
    end
    # this allows the measure to be use by the application
    DynamicWindowGlazing.new.registerWithApplication

Error Message

Standard Output: [openstudio.measure.OSRunner] No value found for argument 'schedule_name_1'. [12:02:02.564909 ERROR] No value found for argument 'schedule_name_1'. [12:02:02.565728 ERROR] C:\OS\src\measure\OSRunner.cpp@753 : No value found for argument 'schedule_name_1'. C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:in getStringArgumentValue' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:inrun' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:515:in apply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run' :/openstudio_cli.rb:963:inexecute' :/openstudio_cli.rb:753:in execute' :/openstudio_cli.rb:1747:in' eval:175:in eval' eval:175:inrequire_embedded_absolute' eval:160:in block in require_embedded' eval:154:ineach' eval:154:in require_embedded' eval:113:inrequire' eval:3:in ' [12:02:02.569900 ERROR] :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with message Runner error :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with C:\OS\src\measure\OSRunner.cpp@753 : No value found for argument 'schedule_name_1'., C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:ingetStringArgumentValue' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:in run' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:515:inapply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:in block in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:ineach_index' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:inperform' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:in step' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:inrun' :/openstudio_cli.rb:963:in execute' :/openstudio_cli.rb:753:inexecute' :/openstudio_cli.rb:1747:in ' eval:175:ineval' eval:175:in require_embedded_absolute' eval:160:inblock in require_embedded' eval:154:in each' eval:154:inrequire_embedded' eval:113:in require' eval:3:in' in :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:543:in rescue in apply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:503:inapply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:in block in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:ineach_index' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:inperform' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:in step' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:inrun' :/openstudio_cli.rb:963:in execute' :/openstudio_cli.rb:753:inexecute' :/openstudio_cli.rb:1747:in ' eval:175:ineval' eval:175:in require_embedded_absolute' eval:160:inblock in require_embedded' eval:154:in each' eval:154:inrequire_embedded' eval:113:in require' eval:3:in' [12:02:02.570632 ERROR] Found error in state 'os_measures' with message [":/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with message Runner error :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with C:\OS\src\measure\OSRunner.cpp@753 : No value found for argument 'schedule_name_1'., C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:in getStringArgumentValue'\nC:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:inrun'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:515:in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run'\n:/openstudio_cli.rb:963:inexecute'\n:/openstudio_cli.rb:753:in execute'\n:/openstudio_cli.rb:1747:in'\neval:175:in eval'\neval:175:inrequire_embedded_absolute'\neval:160:in block in require_embedded'\neval:154:ineach'\neval:154:in require_embedded'\neval:113:inrequire'\neval:3:in ' in :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:543:inrescue in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:503:in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run'\n:/openstudio_cli.rb:963:inexecute'\n:/openstudio_cli.rb:753:in execute'\n:/openstudio_cli.rb:1747:in'\neval:175:in eval'\neval:175:inrequire_embedded_absolute'\neval:160:in block in require_embedded'\neval:154:ineach'\neval:154:in require_embedded'\neval:113:inrequire'\neval:3:in '::/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:652:inrescue in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:310:in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run'\n:/openstudio_cli.rb:963:inexecute'\n:/openstudio_cli.rb:753:in execute'\n:/openstudio_cli.rb:1747:in'\neval:175:in eval'\neval:175:inrequire_embedded_absolute'\neval:160:in block in require_embedded'\neval:154:ineach'\neval:154:in require_embedded'\neval:113:inrequire'\neval:3:in `'"]}

Standard Error:

run.log: [12:02:02.564909 ERROR] No value found for argument 'schedule_name_1'. [12:02:02.565728 ERROR] C:\OS\src\measure\OSRunner.cpp@753 : No value found for argument 'schedule_name_1'. C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:in getStringArgumentValue' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:inrun' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:515:in apply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run' :/openstudio_cli.rb:963:inexecute' :/openstudio_cli.rb:753:in execute' :/openstudio_cli.rb:1747:in' eval:175:in eval' eval:175:inrequire_embedded_absolute' eval:160:in block in require_embedded' eval:154:ineach' eval:154:in require_embedded' eval:113:inrequire' eval:3:in ' [12:02:02.569900 ERROR] :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with message Runner error :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with C:\OS\src\measure\OSRunner.cpp@753 : No value found for argument 'schedule_name_1'., C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:ingetStringArgumentValue' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:in run' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:515:inapply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:in block in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:ineach_index' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:inperform' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:in step' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:inrun' :/openstudio_cli.rb:963:in execute' :/openstudio_cli.rb:753:inexecute' :/openstudio_cli.rb:1747:in ' eval:175:ineval' eval:175:in require_embedded_absolute' eval:160:inblock in require_embedded' eval:154:in each' eval:154:inrequire_embedded' eval:113:in require' eval:3:in' in :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:543:in rescue in apply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:503:inapply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:in block in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:ineach_index' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:inperform' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:in step' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:inrun' :/openstudio_cli.rb:963:in execute' :/openstudio_cli.rb:753:inexecute' :/openstudio_cli.rb:1747:in ' eval:175:ineval' eval:175:in require_embedded_absolute' eval:160:inblock in require_embedded' eval:154:in each' eval:154:inrequire_embedded' eval:113:in require' eval:3:in' [12:02:02.570632 ERROR] Found error in state 'os_measures' with message [":/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with message Runner error :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with C:\OS\src\measure\OSRunner.cpp@753 : No value found for argument 'schedule_name_1'., C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:in getStringArgumentValue'\nC:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:inrun'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:515:in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run'\n:/openstudio_cli.rb:963:inexecute'\n:/openstudio_cli.rb:753:in execute'\n:/openstudio_cli.rb:1747:in'\neval:175:in eval'\neval:175:inrequire_embedded_absolute'\neval:160:in block in require_embedded'\neval:154:ineach'\neval:154:in require_embedded'\neval:113:inrequire'\neval:3:in ' in :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:543:inrescue in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:503:in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run'\n:/openstudio_cli.rb:963:inexecute'\n:/openstudio_cli.rb:753:in execute'\n:/openstudio_cli.rb:1747:in'\neval:175:in eval'\neval:175:inrequire_embedded_absolute'\neval:160:in block in require_embedded'\neval:154:ineach'\neval:154:in require_embedded'\neval:113:inrequire'\neval:3:in '::/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:652:inrescue in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:310:in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run'\n:/openstudio_cli.rb:963:inexecute'\n:/openstudio_cli.rb:753:in execute'\n:/openstudio_cli.rb:1747:in'\neval:175:in eval'\neval:175:inrequire_embedded_absolute'\neval:160:in block in require_embedded'\neval:154:ineach'\neval:154:in require_embedded'\neval:113:inrequire'\neval:3:in `'"]}

Hourly changes in simulation conditions using EMS using .csv values

I have been trying to bring in hourly changes in simulation conditions that take values from a .csv file and convert them to the values take by the EMS sensor. This I am trying to implement on 2 aspects: 1. The construction (in order to change the aspects of SHGC and Visible Transmittance values of a Simple Glazing unit), for which I'm creating 7 states which are defined in the code and trying to choose the appropriate construction based on the corresponding value in .csv file. 2. The LPD of artificial lighting by choosing the appropriate value for the hour from the .csv file.

The end-result that I'm trying to acheve is similar to the question asked in https://unmethours.com/question/47169/how-to-add-variable-envelope-properties-in-energyplus-through-ems/ , but I faced difficulty in implementing it which is why I have posted as a separate question. Kindly help me out. The input .csv files that I want to use are attached here

I'm attaching the code that I had tried, but it doesn't seem to be working. Since I'm a beginner in Measure Writing, I have tried to combine snippets from the following codes:

  1. M13Example13SurfaceConstructionActuatorForThermochromaticWindow: https://github.com/NREL/OpenStudio-EMS-Measures/blob/master/Measures/m_13_example_13_surface_construction_actuator_for_thermochromatic_window/measure.rb
  2. Set Lighting Loads by LPD: https://bcl.nrel.gov/node/84704
  3. Replace Exterior Window Constructions with a Different Construction from the Model: https://bcl.nrel.gov/node/84690
  4. Add Interval Schedule From File: https://bcl.nrel.gov/node/84422

My Code:

# load dependencies
require 'csv'

# start the measure
class DynamicWindowGlazing < OpenStudio::Measure::ModelMeasure

  # display name
  def name
    return "Dynamic Window Glazing"
  end

  # description
  def description
    return "This measure adds an EMS object and a schedule object from a file of interval data"
  end

  # modeler description
  def modeler_description
    return "This measure simulates a dynamic glazing by adding an EnergyPlus object, Energy Management System and a ScheduleInterval object from a user-specified .csv file. The measure supports hourly and 15 min interval data for leap and non-leap years.  The .csv file must contain only schedule values in the first column with 8760, 8784, 35040, or 35136 rows specified. See the example .csv files in the tests directory of this measure."
  end

  # define the arguments that the user will input
  def arguments(model)
    args = OpenStudio::Measure::OSArgumentVector.new

    # make an argument for removing existing
    remove_existing_schedule_intervals = OpenStudio::Ruleset::OSArgument::makeBoolArgument('remove_existing_schedule_intervals', true)
    remove_existing_schedule_intervals.setDisplayName('Remove existing ScheduleInterval objects?')
    remove_existing_schedule_intervals.setDefaultValue(false)
    args << remove_existing_schedule_intervals

    # 1) Choice List of a FixedWindow subsurface to apply a thermochromic window construction to 
    fixed_window_subsurface_handles = OpenStudio::StringVector.new
    fixed_window_subsurface_display_names = OpenStudio::StringVector.new
    subsurface_array = []

    # put all model subsurfaces and names into arrays
    model.getSurfaces.each do |surface|
      surface.subSurfaces.each do |sub_surface|
        subsurface_array << sub_surface
      end
    end

    subsurface_array.each do |subsurface|
      if subsurface.subSurfaceType == "FixedWindow"
        fixed_window_subsurface_handles << subsurface.handle.to_s
        fixed_window_subsurface_display_names << subsurface.name.to_s
      end
    end

    # make a choice argument for a subsurface of type FixedWindow
    fixed_window_subsurface = OpenStudio::Ruleset::OSArgument.makeChoiceArgument('fixed_window_subsurface', fixed_window_subsurface_handles, fixed_window_subsurface_display_names, true)
    fixed_window_subsurface.setDisplayName('Choose a Fixed Window Subsurface to Replace with an EMS generated Electrochromic window construction.')
    fixed_window_subsurface.setDefaultValue('Perimeter_ZN_1_wall_south_Window_1')
    args << fixed_window_subsurface 

    # make an argument for schedule name for Construction Schedule
    schedule_name_1 = OpenStudio::Ruleset::OSArgument::makeStringArgument('Construction Schedule', true)
    schedule_name_1.setDisplayName('Construction Schedule:')
    schedule_name_1.setDefaultValue('Construction Schedule From File')
    args << schedule_name_1

    # make an argument for file path for Construction values
    file_path_1 = OpenStudio::Ruleset::OSArgument.makeStringArgument('file_path_1', true)
    file_path_1.setDisplayName('Enter the path to the file that contains schedule values (follow template in test folder of this measure):')
    file_path_1.setDescription("Example: 'C:\\Projects\\values.csv'")
    args << file_path_1

    # make an argument for schedule name for Artificial Lighting Schedule Schedule
    schedule_name_2 = OpenStudio::Ruleset::OSArgument::makeStringArgument('Artificial Lighting Schedule', true)
    schedule_name_2.setDisplayName('Artificial Lighting Schedule:')
    schedule_name_2.setDefaultValue('Artificial Lighting Schedule From File')
    args << schedule_name_2

    # make an argument for file path for Artificial Lighting values
    file_path_2 = OpenStudio::Ruleset::OSArgument.makeStringArgument('file_path_2', true)
    file_path_2.setDisplayName('Enter the path to the file that contains schedule values (follow template in test folder of this measure):')
    file_path_2.setDescription("Example: 'C:\\Projects\\values.csv'")
    args << file_path_2   

    ## requirements for artificial lights
    # make a choice argument for model objects
    space_type_handles = OpenStudio::StringVector.new
    space_type_display_names = OpenStudio::StringVector.new

    # putting model object and names into hash
    space_type_args = model.getSpaceTypes
    space_type_args_hash = {}
    space_type_args.each do |space_type_arg|
      space_type_args_hash[space_type_arg.name.to_s] = space_type_arg
    end

    # looping through sorted hash of model objects
    space_type_args_hash.sort.map do |key, value|
      # only include if space type is used in the model
      if !value.spaces.empty?
        space_type_handles << value.handle.to_s
        space_type_display_names << key
      end
    end

    # add building to string vector with space type
    building = model.getBuilding
    space_type_handles << building.handle.to_s
    space_type_display_names << '*Entire Building*'

    # make a choice argument for space type or entire building
    space_type = OpenStudio::Measure::OSArgument.makeChoiceArgument('space_type', space_type_handles, space_type_display_names, true)
    space_type.setDisplayName('Apply the Measure to a Specific Space Type or to the Entire Model')
    space_type.setDefaultValue('*Entire Building*') # if no space type is chosen this will run on the entire building
    args << space_type

    # add in argument to add lights to all spaces that are included in building floor area even if original space didn't have lights
    add_instance_all_spaces = OpenStudio::Measure::OSArgument.makeBoolArgument('add_instance_all_spaces', true)
    add_instance_all_spaces.setDisplayName('Add lights to all spaces included in floor area, including spaces that did not originally include lights')
    add_instance_all_spaces.setDefaultValue(false)
    args << add_instance_all_spaces

    return args
  end

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

    construction_array = []
    ems_window_construction_array = []


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

    # assign the user inputs to variables for schedules
    remove_existing_schedule_intervals = runner.getBoolArgumentValue('remove_existing_schedule_intervals', user_arguments)
    schedule_name_1 = runner.getStringArgumentValue('schedule_name_1', user_arguments)
    file_path_1 = runner.getStringArgumentValue('file_path_1', user_arguments)
    schedule_name_2 = runner.getStringArgumentValue('schedule_name_2', user_arguments)
    file_path_2 = runner.getStringArgumentValue('file_path_2', user_arguments)

    # assign the user inputs to variables for artificial lights
    object = runner.getOptionalWorkspaceObjectChoiceValue('space_type', user_arguments, model)
    add_instance_all_spaces = runner.getBoolArgumentValue('add_instance_all_spaces', user_arguments)

    # check the space_type for reasonableness and see if measure should run on space type or on the entire building
    apply_to_building = false
    space_type = nil
    if object.empty?
      handle = runner.getStringArgumentValue('space_type', user_arguments)
      if handle.empty?
        runner.registerError('No SpaceType was chosen.')
      else
        runner.registerError("The selected space type with handle '#{handle}' was not found in the model. It may have been removed by another measure.")
      end
      return false
    else
      if !object.get.to_SpaceType.empty?
        space_type = object.get.to_SpaceType.get
      elsif !object.get.to_Building.empty?
        apply_to_building = true
        # space_type = model.getSpaceTypes
      else
        runner.registerError('Script Error - argument not showing up as space type or building.')
        return false
      end
    end

    # get existing schedules
    schedule_intervals = model.getScheduleIntervals

    # report initial condition
    runner.registerInitialCondition("number of ScheduleInterval objects = #{schedule_intervals.size}")

    # remove existing schedules
    schedule_intervals.each(&:remove) if remove_existing_schedule_intervals

    # check schedule name for reasonableness
    if schedule_name == ''
      runner.registerError('Schedule name is blank. Input a schedule name.')
      return false
    end

    # check file path for reasonableness
    if file_path.empty?
      runner.registerError('Empty file path was entered.')
      return false
    end

    # strip out the potential leading and trailing quotes
    file_path.gsub!('"', '')

    # check if file exists
    if !File.exist? file_path
      runner.registerError("The file at path #{file_path} doesn't exist.")
      return false
    end  

    # read in csv values
    csv_values = CSV.read(file_path,{headers: false, converters: :float})
    num_rows = csv_values.length

    # create values for the timeseries
    schedule_values = OpenStudio::Vector.new(num_rows, 0.0)
    csv_values.each_with_index do |csv_value,i|
      schedule_values[i] = csv_value[0]
    end

    # infer interval
    interval = []
    if (num_rows == 8760) || (num_rows == 8784) #h ourly data
      interval = OpenStudio::Time.new(0, 1, 0)
    elsif (num_rows == 35_040) || (num_rows == 35_136) # 15 min interval data
      interval = OpenStudio::Time.new(0, 0, 15)
    else
      runner.registerError('This measure does not support non-hourly or non-15 min interval data.  Cast your values as 15-min or hourly interval data.  See the values template.')
      return false
    end

    ##beginning of window construction change

    shgc=[0.1,0.2,0.3,0.4,0.5,0.6,0.7]
    tvis=[0.1,0.2,0.3,0.4,0.5,0.6,0.7]

    (0..7).each do |j|
        # create construction and material and link them together
        construction = OpenStudio::Model::Construction.new(model)
        material = OpenStudio::Model::SimpleGlazing.new(model)

        # add material to constructions
        construction.insertLayer(0,material)

        # set material properties
        material.setUFactor(2.56)
        material.setSolarHeatGainCoefficient(shgc[j])
        material.setVisibleTransmittance(tvis[j])
        construction = [SimpleGlazing]
        construction_array << construction

        ems_window_construction = OpenStudio::Model::Construction.new(const)
        ems_window_construction.setName("Construction #{[j]}")
        runner.registerInfo("Created a new Construction named #{ems_window_construction.name} representing an electrochromatic window construction.")
        ems_window_construction_array << ems_window_construction
    end

    # check the user argument of the fixed window subsurface for reasonableness
    if fixed_window_subsurface.empty?
      handle = runner.getStringArgumentValue('fixed_window_subsurface', user_arguments)
      if handle.empty?
        runner.registerError('No fixed window subsurface was chosen.')
      else
        runner.registerError("The selected fixed window subsurface with handle '#{handle}' was not found in the model. It may have been removed by another measure.")
      end
      return false
    else
      if !fixed_window_subsurface.get.to_SubSurface.empty?
        fixed_window_subsurface = fixed_window_subsurface.get.to_SubSurface.get
      else
        runner.registerError('Script Error - argument not showing up as construction.')
        return false
      end
    end

    # creating an output variable for Schedule Value for Window Construction
    output_var_1 = "Schedule Value for Window Construction"
    output_var_construction = OpenStudio::Model::OutputVariable.new(output_var_1, model)

    # create a sensor to sense the Schedule Value for Window Tvis
    construction_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, output_var_construction)
    construction_sensor_name = "Construction Sensor"
    construction_sensor.setName(construction_sensor_name)

    # creating an output variable for Schedule Value for Artificial Lighting
    output_var_2 = "Schedule Value for Artificial Lighting"
    output_var_art_light = OpenStudio::Model::OutputVariable.new(output_var_2, model)

    # create a sensor to sense the Schedule Value for Artificial Lighting
    art_light_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, output_var_art_light)
    art_light_sensor_name = "Artificial Lighting Sensor"
    art_light_sensor.setName(art_light_sensor_name)

    # Create a new EMS Actuator Object representing the construction state of the EMS generated electrochromatic window 
    ems_win_construct_actuator = OpenStudio::Model::EnergyManagementSystemActuator.new(fixed_window_subsurface, "Surface", "Construction State")
    ems_win_construct_actuator.setName("Window_Construction_Set")
    runner.registerInfo("An EMS Actuator object named '#{ems_win_construct_actuator.name}' representing construction state of the EMS generated electrochromatic window was added to the model.") 


    # Create 7 EnergyManagementSystem:ConstructionIndexVariable objects for each unique electrochromatic construction
    ems_window_construction_array.each do |ems_window_construction|
        ems_constr_index_var = OpenStudio::Model::EnergyManagementSystemConstructionIndexVariable.new(model, ems_window_construction )   
        ems_constr_index_var.setName("#{ems_window_construction.name}")
        runner.registerInfo("An EMS SystemConstructionIndexVariable object named '#{ems_constr_index_var.name}' representing the the EMS construction state of the electrochromatic window was added to the model.") 
    end

    # Create new EnergyManagementSystem:Program object for assigning different window constructions by dynamically evaluating the exterior surface temp of the fixed window subsurface 
    ems_apply_electrochromatic_constructions_prgm = OpenStudio::Model::EnergyManagementSystemProgram.new(model)
    ems_apply_electrochromatic_constructions_prgm.setName("#{fixed_window_subsurface.name}_Control")
    ems_apply_electrochromatic_constructions_prgm.addLine("IF #{construction_sensor.name} == 1")
    ems_apply_electrochromatic_constructions_prgm.addLine("SET #{ems_win_construct_actuator.name} = 'Construction 1'")
    ems_apply_electrochromatic_constructions_prgm.addLine("ELSEIF #{construction_sensor.name} == 2")
    ems_apply_electrochromatic_constructions_prgm.addLine("SET #{ems_win_construct_actuator.name} = 'Construction 2'")
    ems_apply_electrochromatic_constructions_prgm.addLine("ELSEIF #{construction_sensor.name} == 3")
    ems_apply_electrochromatic_constructions_prgm.addLine("SET #{ems_win_construct_actuator.name} = 'Construction 3'")
    ems_apply_electrochromatic_constructions_prgm.addLine("ELSEIF #{construction_sensor.name} == 4")
    ems_apply_electrochromatic_constructions_prgm.addLine("SET #{ems_win_construct_actuator.name} = 'Construction 4'")
    ems_apply_electrochromatic_constructions_prgm.addLine("ELSEIF #{construction_sensor.name} == 5")
    ems_apply_electrochromatic_constructions_prgm.addLine("SET #{ems_win_construct_actuator.name} = 'Construction 5'")
    ems_apply_electrochromatic_constructions_prgm.addLine("ELSEIF #{construction_sensor.name} == 6")
    ems_apply_electrochromatic_constructions_prgm.addLine("SET #{ems_win_construct_actuator.name} = 'Construction 6'")
    ems_apply_electrochromatic_constructions_prgm.addLine("ELSEIF #{construction_sensor.name} == 7")
    ems_apply_electrochromatic_constructions_prgm.addLine("SET #{ems_win_construct_actuator.name} = 'Construction 7'")
    ems_apply_electrochromatic_constructions_prgm.addLine("ENDIF")
    runner.registerInfo("An EMS Program Object named '#{ems_apply_electrochromatic_constructions_prgm.name}' for dynamically assigning different window constructions based on the exterior surface temp was added to the model.") 

    # loop through construction sets used in the model
    default_construction_sets = model.getDefaultConstructionSets
    default_construction_sets.each do |default_construction_set|
      if default_construction_set.directUseCount > 0
        default_sub_surface_const_set = default_construction_set.defaultExteriorSubSurfaceConstructions
        if !default_sub_surface_const_set.empty?
          starting_construction = default_sub_surface_const_set.get.fixedWindowConstruction

          # creating new default construction set
          new_default_construction_set = default_construction_set.clone(model)
          new_default_construction_set = new_default_construction_set.to_DefaultConstructionSet.get

          # create new sub_surface set
          new_default_sub_surface_const_set = default_sub_surface_const_set.get.clone(model)
          new_default_sub_surface_const_set = new_default_sub_surface_const_set.to_DefaultSubSurfaceConstructions.get

          # assign selected construction sub_surface set
          new_default_sub_surface_const_set.setFixedWindowConstruction(construction)

          # assign selected construction sub_surface set
          new_default_sub_surface_const_set.setOperableWindowConstruction(construction)

          # link new subset to new set
          new_default_construction_set.setDefaultExteriorSubSurfaceConstructions(new_default_sub_surface_const_set)
        end
      end
    end

    # Create a new EnergyManagementSystem:ProgramCallingManager object configured to call the EMS programs
    ems_prgm_calling_mngr = OpenStudio::Model::EnergyManagementSystemProgramCallingManager.new(model)
    ems_prgm_calling_mngr.setName("My Electrochromic window emulator")
    ems_prgm_calling_mngr.setCallingPoint("BeginTimestepBeforePredictor")
    ems_prgm_calling_mngr.addProgram(ems_apply_electrochromatic_constructions_prgm)
    runner.registerInfo("EMS Program Calling Manager object named '#{ems_prgm_calling_mngr.name}' added to call EMS program for dynamically applying a electrochromatic window.") 

    lighting_power_reduction_percent = runner.getDoubleArgumentValue('lighting_power_reduction_percent', user_arguments)

    # create unique object for OutputEnergyManagementSystems and configure to allow EMS reporting
    outputEMS = model.getOutputEnergyManagementSystem
    outputEMS.setInternalVariableAvailabilityDictionaryReporting("internal_variable_availability_dictionary_reporting")
    outputEMS.setEMSRuntimeLanguageDebugOutputLevel("ems_runtime_language_debug_output_level")
    outputEMS.setActuatorAvailabilityDictionaryReporting("actuator_availability_dictionary_reporting")
    runner.registerInfo("EMS OutputEnergyManagementSystem object configured per user arguments.") 

    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 of window construction change

    ##preliminary settings for artificial lighting setup

    # make a hash of old defs and new lights and luminaire defs
    cloned_lights_defs = {}
    cloned_luminaire_defs = {}

    # loop through space types
    space_types.each do |space_type|
        next if space_type.spaces.size <= 0
        space_type_lights = space_type.lights

        space_type_lights.each do |space_type_light|
            # clone def if it has not already been cloned
            exist_def = space_type_light.lightsDefinition
            if cloned_lights_defs.any? { |k, v| k.to_s == exist_def.name.to_s }
                new_def = cloned_lights_defs[exist_def.name.to_s]
            else
                # clone rename and add to hash
                new_def = exist_def.clone(model)
                new_def_name = new_def.setName("#{exist_def.name} - #{lighting_power_reduction_percent} percent reduction")
                cloned_lights_defs[exist_def.name.to_s] = new_def
                new_def = new_def.to_LightsDefinition.get
            end
        end
    end

      # link instance with clone and rename
      updated_instance = space_type_light.setLightsDefinition(new_def.to_LightsDefinition.get)
      updated_instance_name = space_type_light.setName("#{space_type_light.name} #{lighting_power_reduction_percent} percent reduction")


    space_type_luminaires = space_type.luminaires

    space_type_luminaires.each do |space_type_luminaire|
        # clone def if it has not already been cloned
        exist_def = space_type_luminaire.luminaireDefinition
        if cloned_luminaire_defs.any? { |k, v| k.to_s == exist_def.name }
            new_def = cloned_luminaire_defs[exist_def.name]
        else
            # clone rename and add to hash
            new_def = exist_def.clone(model)
            new_def_name = new_def.setName("#{new_def.name} - #{lighting_power_reduction_percent} percent reduction")
            cloned_luminaire_defs[exist_def.name] = new_def
            new_def = new_def.to_LightsDefinition.get
        end

      # link instance with clone and rename
      updated_instance = space_type_light.setLightsDefinition(new_def.to_LightsDefinition.get)
      updated_instance_name = space_type_light.setName("#{space_type_light.name} #{lighting_power_reduction_percent} percent reduction")
    end

    # getting spaces in the model
    spaces = model.getSpaces

    # get space types in model
    if apply_to_building
        spaces = model.getSpaces
    else
        if !space_type.spaces.empty?
        spaces = space_type.spaces # only run on a single space type
        end
    end

    spaces.each do |space|
        space_lights = space.lights
        space_lights.each do |space_light|
            # clone def if it has not already been cloned
            exist_def = space_light.lightsDefinition
            if cloned_lights_defs.any? { |k, v| k.to_s == exist_def.name.to_s }
                new_def = cloned_lights_defs[exist_def.name.to_s]
            else
                # clone rename and add to hash
                new_def = exist_def.clone(model)
                new_def_name = new_def.setName("#{new_def.name} - #{lighting_power_reduction_percent} percent reduction")
                cloned_lights_defs[exist_def.name.to_s] = new_def
                new_def = new_def.to_LightsDefinition.get
            end
        end
        # link instance with clone and rename
        updated_instance = space_light.setLightsDefinition(new_def.to_LightsDefinition.get)
        updated_instance_name = space_light.setName("#{space_light.name} #{lighting_power_reduction_percent} percent reduction")
    end

    space_luminaires = space.luminaires
    space_luminaires.each do |space_luminaire|
        # clone def if it has not already been cloned
        exist_def = space_luminaire.luminaireDefinition
        if cloned_luminaire_defs.any? { |k, v| k.to_s == exist_def.name }
            new_def = cloned_luminaire_defs[exist_def.name]
            else
                # clone rename and add to hash
                new_def = exist_def.clone(model)
                new_def_name = new_def.setName("#{new_def.name} - #{lighting_power_reduction_percent} percent reduction")
                cloned_luminaire_defs[exist_def.name] = new_def
                new_def = new_def.to_LightsDefinition.get
            end
            # link instance with clone and rename
            updated_instance = space_light.setLightsDefinition(new_def)
            updated_instance_name = space_light.setName("#{space_light.name} - #{lighting_power_reduction_percent} percent reduction")

        end


        ##beginning of artificial lighting change

        art_light_states=[5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80]

        (0..16).each do |j|
            # create a new LightsDefinition and new Lights object to use with setLightingPowerPerFloorArea
            template_light_def = OpenStudio::Model::LightsDefinition.new(model)

            ems_art_light = OpenStudio::Model::LightsDefinition.new(light)
            ems_art_light.setName("Light #{art_light_states[j]}")
            runner.registerInfo("Created a new Artificial Light named #{ems_art_light.name} representing an electrochromatic window construction.")
            ems_art_light_array << ems_art_light
        end  

        # creating an output variable for Schedule Value for Artificial Lighting
        output_var_2 = "Schedule Value for Artificial Lighting"
        output_var_art_light = OpenStudio::Model::OutputVariable.new(output_var_2, model)

        # create a sensor to sense the Schedule Value for Artificial Lighting
        art_light_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, output_var_art_light)
        art_light_sensor_name = "Artificial Lighting Sensor"
        art_light_sensor.setName(art_light_sensor_name)

        # Create a new EMS Actuator Object representing the artificial lighting state of the EMS generated artificial light 
        ems_art_light_actuator = OpenStudio::Model::EnergyManagementSystemActuator.new(lightsDefinition, "Light", "Lighting State")
        ems_art_light_actuator.setName("Artificial_Lighting_Set")
        runner.registerInfo("An EMS Actuator object named '#{ems_art_light_actuator.name}' representing lighting state of the EMS generated electrochromatic window was added to the model.") 


        # Create 7 EnergyManagementSystem:ConstructionIndexVariable objects for each unique electrochromatic construction
        ems_art_light_array.each do |ems_art_light|
            ems_art_light_index_var = OpenStudio::Model::EnergyManagementSystemLightIndexVariable.new(model, ems_art_light )   
            ems_art_light_index_var.setName("#{ems_art_light.name}")
            runner.registerInfo("An EMS SystemLightIndexVariable object named '#{ems_art_light_index_var.name}' representing the the EMS construction state of the artificial light was added to the model.") 
        end

        # Create new EnergyManagementSystem:Program object for assigning different window constructions by dynamically evaluating the exterior surface temp of the fixed window subsurface 
        ems_apply_art_light_prgm = OpenStudio::Model::EnergyManagementSystemProgram.new(model)
        ems_apply_art_light_prgm.setName("#{fixed_window_subsurface.name}_Control")
        ems_apply_art_light_prgm.addLine("IF #{art_light_sensor.name} == 10")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 10")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 15")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 15")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 20")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 20")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 25")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 25")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 30")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 30")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 35")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 35")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 40")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 40")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 45")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 45")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 50")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 50")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 55")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 55")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 60")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 60")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 65")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 65")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 70")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 70")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 75")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 75")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 80")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 80")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 85")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 85")
        ems_apply_art_light_prgm.addLine("ENDIF")
        runner.registerInfo("An EMS Program Object named '#{ems_apply_art_light_prgm.name}' for dynamically assigning different artificial lighting based on the values in the uploaded file was added to the model.") 

        # Create a new EnergyManagementSystem:ProgramCallingManager object configured to call the EMS programs
        ems_prgm_calling_mngr_2 = OpenStudio::Model::EnergyManagementSystemProgramCallingManager.new(model)
        ems_prgm_calling_mngr_2.setName("My Artificial Lighting emulator")
        ems_prgm_calling_mngr_2.setCallingPoint("BeginTimestepBeforePredictor")
        ems_prgm_calling_mngr_2.addProgram(ems_apply_art_light_prgm)
        runner.registerInfo("EMS Program Calling Manager object named '#{ems_prgm_calling_mngr_2.name}' added to call EMS program for dynamically applying a electrochromatic window.") 

        lighting_power_reduction_percent = runner.getDoubleArgumentValue('lighting_power_reduction_percent', user_arguments)

        # create unique object for OutputEnergyManagementSystems and configure to allow EMS reporting
        outputEMS = model.getOutputEnergyManagementSystem
        outputEMS.setInternalVariableAvailabilityDictionaryReporting("internal_variable_availability_dictionary_reporting")
        outputEMS.setEMSRuntimeLanguageDebugOutputLevel("ems_runtime_language_debug_output_level")
        outputEMS.setActuatorAvailabilityDictionaryReporting("actuator_availability_dictionary_reporting")
        runner.registerInfo("EMS OutputEnergyManagementSystem object configured per user arguments.") 

        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 of window construction change

        # make a schedule
        startDate = OpenStudio::Date.new(OpenStudio::MonthOfYear.new(1), 1)
        timeseries = OpenStudio::TimeSeries.new(startDate, interval, schedule_values)
        schedule = OpenStudio::Model::ScheduleInterval::fromTimeSeries(timeseries, model)
        if schedule.empty?
          runner.registerError("Unable to make schedule from file at '#{file_path}'")
          return false
        end
        schedule = schedule.get
        schedule.setName(schedule_name)

        # reporting final condition of model
        runner.registerFinalCondition("Added schedule #{schedule_name} to the model.")

        return true
      end
    end
    # this allows the measure to be use by the application
    DynamicWindowGlazing.new.registerWithApplication

Error Message

Standard Output: [openstudio.measure.OSRunner] No value found for argument 'schedule_name_1'. [12:02:02.564909 ERROR] No value found for argument 'schedule_name_1'. [12:02:02.565728 ERROR] C:\OS\src\measure\OSRunner.cpp@753 : No value found for argument 'schedule_name_1'. C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:in getStringArgumentValue' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:inrun' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:515:in apply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run' :/openstudio_cli.rb:963:inexecute' :/openstudio_cli.rb:753:in execute' :/openstudio_cli.rb:1747:in' eval:175:in eval' eval:175:inrequire_embedded_absolute' eval:160:in block in require_embedded' eval:154:ineach' eval:154:in require_embedded' eval:113:inrequire' eval:3:in ' [12:02:02.569900 ERROR] :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with message Runner error :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with C:\OS\src\measure\OSRunner.cpp@753 : No value found for argument 'schedule_name_1'., C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:ingetStringArgumentValue' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:in run' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:515:inapply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:in block in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:ineach_index' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:inperform' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:in step' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:inrun' :/openstudio_cli.rb:963:in execute' :/openstudio_cli.rb:753:inexecute' :/openstudio_cli.rb:1747:in ' eval:175:ineval' eval:175:in require_embedded_absolute' eval:160:inblock in require_embedded' eval:154:in each' eval:154:inrequire_embedded' eval:113:in require' eval:3:in' in :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:543:in rescue in apply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:503:inapply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:in block in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:ineach_index' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:inperform' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:in step' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:inrun' :/openstudio_cli.rb:963:in execute' :/openstudio_cli.rb:753:inexecute' :/openstudio_cli.rb:1747:in ' eval:175:ineval' eval:175:in require_embedded_absolute' eval:160:inblock in require_embedded' eval:154:in each' eval:154:inrequire_embedded' eval:113:in require' eval:3:in' [12:02:02.570632 ERROR] Found error in state 'os_measures' with message [":/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with message Runner error :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with C:\OS\src\measure\OSRunner.cpp@753 : No value found for argument 'schedule_name_1'., C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:in getStringArgumentValue'\nC:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:inrun'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:515:in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run'\n:/openstudio_cli.rb:963:inexecute'\n:/openstudio_cli.rb:753:in execute'\n:/openstudio_cli.rb:1747:in'\neval:175:in eval'\neval:175:inrequire_embedded_absolute'\neval:160:in block in require_embedded'\neval:154:ineach'\neval:154:in require_embedded'\neval:113:inrequire'\neval:3:in ' in :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:543:inrescue in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:503:in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run'\n:/openstudio_cli.rb:963:inexecute'\n:/openstudio_cli.rb:753:in execute'\n:/openstudio_cli.rb:1747:in'\neval:175:in eval'\neval:175:inrequire_embedded_absolute'\neval:160:in block in require_embedded'\neval:154:ineach'\neval:154:in require_embedded'\neval:113:inrequire'\neval:3:in '::/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:652:inrescue in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:310:in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run'\n:/openstudio_cli.rb:963:inexecute'\n:/openstudio_cli.rb:753:in execute'\n:/openstudio_cli.rb:1747:in'\neval:175:in eval'\neval:175:inrequire_embedded_absolute'\neval:160:in block in require_embedded'\neval:154:ineach'\neval:154:in require_embedded'\neval:113:inrequire'\neval:3:in `'"]}

Standard Error:

run.log: [12:02:02.564909 ERROR] No value found for argument 'schedule_name_1'. [12:02:02.565728 ERROR] C:\OS\src\measure\OSRunner.cpp@753 : No value found for argument 'schedule_name_1'. C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:in getStringArgumentValue' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:inrun' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:515:in apply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run' :/openstudio_cli.rb:963:inexecute' :/openstudio_cli.rb:753:in execute' :/openstudio_cli.rb:1747:in' eval:175:in eval' eval:175:inrequire_embedded_absolute' eval:160:in block in require_embedded' eval:154:ineach' eval:154:in require_embedded' eval:113:inrequire' eval:3:in ' [12:02:02.569900 ERROR] :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with message Runner error :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with C:\OS\src\measure\OSRunner.cpp@753 : No value found for argument 'schedule_name_1'., C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:ingetStringArgumentValue' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:in run' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:515:inapply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:in block in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:ineach_index' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:inperform' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:in step' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:inrun' :/openstudio_cli.rb:963:in execute' :/openstudio_cli.rb:753:inexecute' :/openstudio_cli.rb:1747:in ' eval:175:ineval' eval:175:in require_embedded_absolute' eval:160:inblock in require_embedded' eval:154:in each' eval:154:inrequire_embedded' eval:113:in require' eval:3:in' in :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:543:in rescue in apply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:503:inapply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:in block in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:ineach_index' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:inperform' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:in step' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:inrun' :/openstudio_cli.rb:963:in execute' :/openstudio_cli.rb:753:inexecute' :/openstudio_cli.rb:1747:in ' eval:175:ineval' eval:175:in require_embedded_absolute' eval:160:inblock in require_embedded' eval:154:in each' eval:154:inrequire_embedded' eval:113:in require' eval:3:in' [12:02:02.570632 ERROR] Found error in state 'os_measures' with message [":/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with message Runner error :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with C:\OS\src\measure\OSRunner.cpp@753 : No value found for argument 'schedule_name_1'., C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:in getStringArgumentValue'\nC:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:inrun'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:515:in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run'\n:/openstudio_cli.rb:963:inexecute'\n:/openstudio_cli.rb:753:in execute'\n:/openstudio_cli.rb:1747:in'\neval:175:in eval'\neval:175:inrequire_embedded_absolute'\neval:160:in block in require_embedded'\neval:154:ineach'\neval:154:in require_embedded'\neval:113:inrequire'\neval:3:in ' in :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:543:inrescue in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:503:in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run'\n:/openstudio_cli.rb:963:inexecute'\n:/openstudio_cli.rb:753:in execute'\n:/openstudio_cli.rb:1747:in'\neval:175:in eval'\neval:175:inrequire_embedded_absolute'\neval:160:in block in require_embedded'\neval:154:ineach'\neval:154:in require_embedded'\neval:113:inrequire'\neval:3:in '::/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:652:inrescue in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:310:in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run'\n:/openstudio_cli.rb:963:inexecute'\n:/openstudio_cli.rb:753:in execute'\n:/openstudio_cli.rb:1747:in'\neval:175:in eval'\neval:175:inrequire_embedded_absolute'\neval:160:in block in require_embedded'\neval:154:ineach'\neval:154:in require_embedded'\neval:113:inrequire'\neval:3:in `'"]} `'"]}

Hourly changes in simulation conditions using EMS using .csv values

I have been trying to bring in hourly changes in simulation conditions that take values from a .csv file and convert them to the values take by the EMS sensor. This I am trying to implement on 2 aspects: 1. The construction (in order to change the aspects of SHGC and Visible Transmittance values of a Simple Glazing unit), for which I'm creating 7 states which are defined in the code and trying to choose the appropriate construction based on the corresponding value in .csv file. 2. The LPD of artificial lighting by choosing the appropriate value for the hour from the .csv file.

The end-result that I'm trying to acheve is similar to the question asked in https://unmethours.com/question/47169/how-to-add-variable-envelope-properties-in-energyplus-through-ems/ , but I faced difficulty in implementing it which is why I have posted as a separate question. Kindly help me out. The input .csv files that I want to use are attached here

I'm attaching the code that I had tried, but it doesn't seem to be working. Since I'm a beginner in Measure Writing, I have tried to combine snippets from the following codes:

  1. M13Example13SurfaceConstructionActuatorForThermochromaticWindow: https://github.com/NREL/OpenStudio-EMS-Measures/blob/master/Measures/m_13_example_13_surface_construction_actuator_for_thermochromatic_window/measure.rb
  2. Set Lighting Loads by LPD: https://bcl.nrel.gov/node/84704
  3. Replace Exterior Window Constructions with a Different Construction from the Model: https://bcl.nrel.gov/node/84690
  4. Add Interval Schedule From File: https://bcl.nrel.gov/node/84422

My Code:

# load dependencies
require 'csv'

# start the measure
class DynamicWindowGlazing < OpenStudio::Measure::ModelMeasure

  # display name
  def name
    return "Dynamic Window Glazing"
  end

  # description
  def description
    return "This measure adds an EMS object and a schedule object from a file of interval data"
  end

  # modeler description
  def modeler_description
    return "This measure simulates a dynamic glazing by adding an EnergyPlus object, Energy Management System and a ScheduleInterval object from a user-specified .csv file. The measure supports hourly and 15 min interval data for leap and non-leap years.  The .csv file must contain only schedule values in the first column with 8760, 8784, 35040, or 35136 rows specified. See the example .csv files in the tests directory of this measure."
  end

  # define the arguments that the user will input
  def arguments(model)
    args = OpenStudio::Measure::OSArgumentVector.new

    # make an argument for removing existing
    remove_existing_schedule_intervals = OpenStudio::Ruleset::OSArgument::makeBoolArgument('remove_existing_schedule_intervals', true)
    remove_existing_schedule_intervals.setDisplayName('Remove existing ScheduleInterval objects?')
    remove_existing_schedule_intervals.setDefaultValue(false)
    args << remove_existing_schedule_intervals

    # 1) Choice List of a FixedWindow subsurface to apply a thermochromic window construction to 
    fixed_window_subsurface_handles = OpenStudio::StringVector.new
    fixed_window_subsurface_display_names = OpenStudio::StringVector.new
    subsurface_array = []

    # put all model subsurfaces and names into arrays
    model.getSurfaces.each do |surface|
      surface.subSurfaces.each do |sub_surface|
        subsurface_array << sub_surface
      end
    end

    subsurface_array.each do |subsurface|
      if subsurface.subSurfaceType == "FixedWindow"
        fixed_window_subsurface_handles << subsurface.handle.to_s
        fixed_window_subsurface_display_names << subsurface.name.to_s
      end
    end

    # make a choice argument for a subsurface of type FixedWindow
    fixed_window_subsurface = OpenStudio::Ruleset::OSArgument.makeChoiceArgument('fixed_window_subsurface', fixed_window_subsurface_handles, fixed_window_subsurface_display_names, true)
    fixed_window_subsurface.setDisplayName('Choose a Fixed Window Subsurface to Replace with an EMS generated Electrochromic window construction.')
    fixed_window_subsurface.setDefaultValue('Perimeter_ZN_1_wall_south_Window_1')
    args << fixed_window_subsurface 

    # make an argument for schedule name for Construction Schedule
    schedule_name_1 = OpenStudio::Ruleset::OSArgument::makeStringArgument('Construction Schedule', true)
    schedule_name_1.setDisplayName('Construction Schedule:')
    schedule_name_1.setDefaultValue('Construction Schedule From File')
    args << schedule_name_1

    # make an argument for file path for Construction values
    file_path_1 = OpenStudio::Ruleset::OSArgument.makeStringArgument('file_path_1', true)
    file_path_1.setDisplayName('Enter the path to the file that contains schedule values (follow template in test folder of this measure):')
    file_path_1.setDescription("Example: 'C:\\Projects\\values.csv'")
    args << file_path_1

    # make an argument for schedule name for Artificial Lighting Schedule Schedule
    schedule_name_2 = OpenStudio::Ruleset::OSArgument::makeStringArgument('Artificial Lighting Schedule', true)
    schedule_name_2.setDisplayName('Artificial Lighting Schedule:')
    schedule_name_2.setDefaultValue('Artificial Lighting Schedule From File')
    args << schedule_name_2

    # make an argument for file path for Artificial Lighting values
    file_path_2 = OpenStudio::Ruleset::OSArgument.makeStringArgument('file_path_2', true)
    file_path_2.setDisplayName('Enter the path to the file that contains schedule values (follow template in test folder of this measure):')
    file_path_2.setDescription("Example: 'C:\\Projects\\values.csv'")
    args << file_path_2   

    ## requirements for artificial lights
    # make a choice argument for model objects
    space_type_handles = OpenStudio::StringVector.new
    space_type_display_names = OpenStudio::StringVector.new

    # putting model object and names into hash
    space_type_args = model.getSpaceTypes
    space_type_args_hash = {}
    space_type_args.each do |space_type_arg|
      space_type_args_hash[space_type_arg.name.to_s] = space_type_arg
    end

    # looping through sorted hash of model objects
    space_type_args_hash.sort.map do |key, value|
      # only include if space type Code is used in the model
      if !value.spaces.empty?
        space_type_handles << value.handle.to_s
        space_type_display_names << key
      end
    end

    # add building to string vector with space type
    building = model.getBuilding
    space_type_handles << building.handle.to_s
    space_type_display_names << '*Entire Building*'

    # make a choice argument for space type or entire building
    space_type = OpenStudio::Measure::OSArgument.makeChoiceArgument('space_type', space_type_handles, space_type_display_names, true)
    space_type.setDisplayName('Apply the Measure to a Specific Space Type or to the Entire Model')
    space_type.setDefaultValue('*Entire Building*') # if no space type is chosen this will run on the entire building
    args << space_type

    # add in argument to add lights to all spaces that are included in building floor area even if original space didn't have lights
    add_instance_all_spaces = OpenStudio::Measure::OSArgument.makeBoolArgument('add_instance_all_spaces', true)
    add_instance_all_spaces.setDisplayName('Add lights to all spaces included in floor area, including spaces that did not originally include lights')
    add_instance_all_spaces.setDefaultValue(false)
    args << add_instance_all_spaces

    return args
  end

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

    construction_array = []
    ems_window_construction_array = []


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

    # assign the user inputs to variables for schedules
    remove_existing_schedule_intervals = runner.getBoolArgumentValue('remove_existing_schedule_intervals', user_arguments)
    schedule_name_1 = runner.getStringArgumentValue('schedule_name_1', user_arguments)
    file_path_1 = runner.getStringArgumentValue('file_path_1', user_arguments)
    schedule_name_2 = runner.getStringArgumentValue('schedule_name_2', user_arguments)
    file_path_2 = runner.getStringArgumentValue('file_path_2', user_arguments)

    # assign the user inputs to variables for artificial lights
    object = runner.getOptionalWorkspaceObjectChoiceValue('space_type', user_arguments, model)
    add_instance_all_spaces = runner.getBoolArgumentValue('add_instance_all_spaces', user_arguments)

    # check the space_type for reasonableness and see if measure should run on space type or on the entire building
    apply_to_building = false
    space_type = nil
    if object.empty?
      handle = runner.getStringArgumentValue('space_type', user_arguments)
      if handle.empty?
        runner.registerError('No SpaceType was chosen.')
      else
        runner.registerError("The selected space type with handle '#{handle}' was not found in the model. It may have been removed by another measure.")
      end
      return false
    else
      if !object.get.to_SpaceType.empty?
        space_type = object.get.to_SpaceType.get
      elsif !object.get.to_Building.empty?
        apply_to_building = true
        # space_type = model.getSpaceTypes
      else
        runner.registerError('Script Error - argument not showing up as space type or building.')
        return false
      end
    end

    # get existing schedules
    schedule_intervals = model.getScheduleIntervals

    # report initial condition
    runner.registerInitialCondition("number of ScheduleInterval objects = #{schedule_intervals.size}")

    # remove existing schedules
    schedule_intervals.each(&:remove) if remove_existing_schedule_intervals

    # check schedule name for reasonableness
    if schedule_name == ''
      runner.registerError('Schedule name is blank. Input a schedule name.')
      return false
    end

    # check file path for reasonableness
    if file_path.empty?
      runner.registerError('Empty file path was entered.')
      return false
    end

    # strip out the potential leading and trailing quotes
    file_path.gsub!('"', '')

    # check if file exists
    if !File.exist? file_path
      runner.registerError("The file at path #{file_path} doesn't exist.")
      return false
    end  

    # read in csv values
    csv_values = CSV.read(file_path,{headers: false, converters: :float})
    num_rows = csv_values.length

    # create values for the timeseries
    schedule_values = OpenStudio::Vector.new(num_rows, 0.0)
    csv_values.each_with_index do |csv_value,i|
      schedule_values[i] = csv_value[0]
    end

    # infer interval
    interval = []
    if (num_rows == 8760) || (num_rows == 8784) #h ourly data
      interval = OpenStudio::Time.new(0, 1, 0)
    elsif (num_rows == 35_040) || (num_rows == 35_136) # 15 min interval data
      interval = OpenStudio::Time.new(0, 0, 15)
    else
      runner.registerError('This measure does not support non-hourly or non-15 min interval data.  Cast your values as 15-min or hourly interval data.  See the values template.')
      return false
    end

    ##beginning of window construction change

    shgc=[0.1,0.2,0.3,0.4,0.5,0.6,0.7]
    tvis=[0.1,0.2,0.3,0.4,0.5,0.6,0.7]

    (0..7).each do |j|
        # create construction and material and link them together
        construction = OpenStudio::Model::Construction.new(model)
        material = OpenStudio::Model::SimpleGlazing.new(model)

        # add material to constructions
        construction.insertLayer(0,material)

        # set material properties
        material.setUFactor(2.56)
        material.setSolarHeatGainCoefficient(shgc[j])
        material.setVisibleTransmittance(tvis[j])
        construction = [SimpleGlazing]
        construction_array << construction

        ems_window_construction = OpenStudio::Model::Construction.new(const)
        ems_window_construction.setName("Construction #{[j]}")
        runner.registerInfo("Created a new Construction named #{ems_window_construction.name} representing an electrochromatic window construction.")
        ems_window_construction_array << ems_window_construction
    end

    # check the user argument of the fixed window subsurface for reasonableness
    if fixed_window_subsurface.empty?
      handle = runner.getStringArgumentValue('fixed_window_subsurface', user_arguments)
      if handle.empty?
        runner.registerError('No fixed window subsurface was chosen.')
      else
        runner.registerError("The selected fixed window subsurface with handle '#{handle}' was not found in the model. It may have been removed by another measure.")
      end
      return false
    else
      if !fixed_window_subsurface.get.to_SubSurface.empty?
        fixed_window_subsurface = fixed_window_subsurface.get.to_SubSurface.get
      else
        runner.registerError('Script Error - argument not showing up as construction.')
        return false
      end
    end

    # creating an output variable for Schedule Value for Window Construction
    output_var_1 = "Schedule Value for Window Construction"
    output_var_construction = OpenStudio::Model::OutputVariable.new(output_var_1, model)

    # create a sensor to sense the Schedule Value for Window Tvis
    construction_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, output_var_construction)
    construction_sensor_name = "Construction Sensor"
    construction_sensor.setName(construction_sensor_name)

    # creating an output variable for Schedule Value for Artificial Lighting
    output_var_2 = "Schedule Value for Artificial Lighting"
    output_var_art_light = OpenStudio::Model::OutputVariable.new(output_var_2, model)

    # create a sensor to sense the Schedule Value for Artificial Lighting
    art_light_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, output_var_art_light)
    art_light_sensor_name = "Artificial Lighting Sensor"
    art_light_sensor.setName(art_light_sensor_name)

    # Create a new EMS Actuator Object representing the construction state of the EMS generated electrochromatic window 
    ems_win_construct_actuator = OpenStudio::Model::EnergyManagementSystemActuator.new(fixed_window_subsurface, "Surface", "Construction State")
    ems_win_construct_actuator.setName("Window_Construction_Set")
    runner.registerInfo("An EMS Actuator object named '#{ems_win_construct_actuator.name}' representing construction state of the EMS generated electrochromatic window was added to the model.") 


    # Create 7 EnergyManagementSystem:ConstructionIndexVariable objects for each unique electrochromatic construction
    ems_window_construction_array.each do |ems_window_construction|
        ems_constr_index_var = OpenStudio::Model::EnergyManagementSystemConstructionIndexVariable.new(model, ems_window_construction )   
        ems_constr_index_var.setName("#{ems_window_construction.name}")
        runner.registerInfo("An EMS SystemConstructionIndexVariable object named '#{ems_constr_index_var.name}' representing the the EMS construction state of the electrochromatic window was added to the model.") 
    end

    # Create new EnergyManagementSystem:Program object for assigning different window constructions by dynamically evaluating the exterior surface temp of the fixed window subsurface 
    ems_apply_electrochromatic_constructions_prgm = OpenStudio::Model::EnergyManagementSystemProgram.new(model)
    ems_apply_electrochromatic_constructions_prgm.setName("#{fixed_window_subsurface.name}_Control")
    ems_apply_electrochromatic_constructions_prgm.addLine("IF #{construction_sensor.name} == 1")
    ems_apply_electrochromatic_constructions_prgm.addLine("SET #{ems_win_construct_actuator.name} = 'Construction 1'")
    ems_apply_electrochromatic_constructions_prgm.addLine("ELSEIF #{construction_sensor.name} == 2")
    ems_apply_electrochromatic_constructions_prgm.addLine("SET #{ems_win_construct_actuator.name} = 'Construction 2'")
    ems_apply_electrochromatic_constructions_prgm.addLine("ELSEIF #{construction_sensor.name} == 3")
    ems_apply_electrochromatic_constructions_prgm.addLine("SET #{ems_win_construct_actuator.name} = 'Construction 3'")
    ems_apply_electrochromatic_constructions_prgm.addLine("ELSEIF #{construction_sensor.name} == 4")
    ems_apply_electrochromatic_constructions_prgm.addLine("SET #{ems_win_construct_actuator.name} = 'Construction 4'")
    ems_apply_electrochromatic_constructions_prgm.addLine("ELSEIF #{construction_sensor.name} == 5")
    ems_apply_electrochromatic_constructions_prgm.addLine("SET #{ems_win_construct_actuator.name} = 'Construction 5'")
    ems_apply_electrochromatic_constructions_prgm.addLine("ELSEIF #{construction_sensor.name} == 6")
    ems_apply_electrochromatic_constructions_prgm.addLine("SET #{ems_win_construct_actuator.name} = 'Construction 6'")
    ems_apply_electrochromatic_constructions_prgm.addLine("ELSEIF #{construction_sensor.name} == 7")
    ems_apply_electrochromatic_constructions_prgm.addLine("SET #{ems_win_construct_actuator.name} = 'Construction 7'")
    ems_apply_electrochromatic_constructions_prgm.addLine("ENDIF")
    runner.registerInfo("An EMS Program Object named '#{ems_apply_electrochromatic_constructions_prgm.name}' for dynamically assigning different window constructions based on the exterior surface temp was added to the model.") 

    # loop through construction sets used in the model
    default_construction_sets = model.getDefaultConstructionSets
    default_construction_sets.each do |default_construction_set|
      if default_construction_set.directUseCount > 0
        default_sub_surface_const_set = default_construction_set.defaultExteriorSubSurfaceConstructions
        if !default_sub_surface_const_set.empty?
          starting_construction = default_sub_surface_const_set.get.fixedWindowConstruction

          # creating new default construction set
          new_default_construction_set = default_construction_set.clone(model)
          new_default_construction_set = new_default_construction_set.to_DefaultConstructionSet.get

          # create new sub_surface set
          new_default_sub_surface_const_set = default_sub_surface_const_set.get.clone(model)
          new_default_sub_surface_const_set = new_default_sub_surface_const_set.to_DefaultSubSurfaceConstructions.get

          # assign selected construction sub_surface set
          new_default_sub_surface_const_set.setFixedWindowConstruction(construction)

          # assign selected construction sub_surface set
          new_default_sub_surface_const_set.setOperableWindowConstruction(construction)

          # link new subset to new set
          new_default_construction_set.setDefaultExteriorSubSurfaceConstructions(new_default_sub_surface_const_set)
        end
      end
    end

    # Create a new EnergyManagementSystem:ProgramCallingManager object configured to call the EMS programs
    ems_prgm_calling_mngr = OpenStudio::Model::EnergyManagementSystemProgramCallingManager.new(model)
    ems_prgm_calling_mngr.setName("My Electrochromic window emulator")
    ems_prgm_calling_mngr.setCallingPoint("BeginTimestepBeforePredictor")
    ems_prgm_calling_mngr.addProgram(ems_apply_electrochromatic_constructions_prgm)
    runner.registerInfo("EMS Program Calling Manager object named '#{ems_prgm_calling_mngr.name}' added to call EMS program for dynamically applying a electrochromatic window.") 

    lighting_power_reduction_percent = runner.getDoubleArgumentValue('lighting_power_reduction_percent', user_arguments)

    # create unique object for OutputEnergyManagementSystems and configure to allow EMS reporting
    outputEMS = model.getOutputEnergyManagementSystem
    outputEMS.setInternalVariableAvailabilityDictionaryReporting("internal_variable_availability_dictionary_reporting")
    outputEMS.setEMSRuntimeLanguageDebugOutputLevel("ems_runtime_language_debug_output_level")
    outputEMS.setActuatorAvailabilityDictionaryReporting("actuator_availability_dictionary_reporting")
    runner.registerInfo("EMS OutputEnergyManagementSystem object configured per user arguments.") 

    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 of window construction change

    ##preliminary settings for artificial lighting setup

    # make a hash of old defs and new lights and luminaire defs
    cloned_lights_defs = {}
    cloned_luminaire_defs = {}

    # loop through space types
    space_types.each do |space_type|
        next if space_type.spaces.size <= 0
        space_type_lights = space_type.lights

        space_type_lights.each do |space_type_light|
            # clone def if it has not already been cloned
            exist_def = space_type_light.lightsDefinition
            if cloned_lights_defs.any? { |k, v| k.to_s == exist_def.name.to_s }
                new_def = cloned_lights_defs[exist_def.name.to_s]
            else
                # clone rename and add to hash
                new_def = exist_def.clone(model)
                new_def_name = new_def.setName("#{exist_def.name} - #{lighting_power_reduction_percent} percent reduction")
                cloned_lights_defs[exist_def.name.to_s] = new_def
                new_def = new_def.to_LightsDefinition.get
            end
        end
    end

      # link instance with clone and rename
      updated_instance = space_type_light.setLightsDefinition(new_def.to_LightsDefinition.get)
      updated_instance_name = space_type_light.setName("#{space_type_light.name} #{lighting_power_reduction_percent} percent reduction")


    space_type_luminaires = space_type.luminaires

    space_type_luminaires.each do |space_type_luminaire|
        # clone def if it has not already been cloned
        exist_def = space_type_luminaire.luminaireDefinition
        if cloned_luminaire_defs.any? { |k, v| k.to_s == exist_def.name }
            new_def = cloned_luminaire_defs[exist_def.name]
        else
            # clone rename and add to hash
            new_def = exist_def.clone(model)
            new_def_name = new_def.setName("#{new_def.name} - #{lighting_power_reduction_percent} percent reduction")
            cloned_luminaire_defs[exist_def.name] = new_def
            new_def = new_def.to_LightsDefinition.get
        end

      # link instance with clone and rename
      updated_instance = space_type_light.setLightsDefinition(new_def.to_LightsDefinition.get)
      updated_instance_name = space_type_light.setName("#{space_type_light.name} #{lighting_power_reduction_percent} percent reduction")
    end

    # getting spaces in the model
    spaces = model.getSpaces

    # get space types in model
    if apply_to_building
        spaces = model.getSpaces
    else
        if !space_type.spaces.empty?
        spaces = space_type.spaces # only run on a single space type
        end
    end

    spaces.each do |space|
        space_lights = space.lights
        space_lights.each do |space_light|
            # clone def if it has not already been cloned
            exist_def = space_light.lightsDefinition
            if cloned_lights_defs.any? { |k, v| k.to_s == exist_def.name.to_s }
                new_def = cloned_lights_defs[exist_def.name.to_s]
            else
                # clone rename and add to hash
                new_def = exist_def.clone(model)
                new_def_name = new_def.setName("#{new_def.name} - #{lighting_power_reduction_percent} percent reduction")
                cloned_lights_defs[exist_def.name.to_s] = new_def
                new_def = new_def.to_LightsDefinition.get
            end
        end
        # link instance with clone and rename
        updated_instance = space_light.setLightsDefinition(new_def.to_LightsDefinition.get)
        updated_instance_name = space_light.setName("#{space_light.name} #{lighting_power_reduction_percent} percent reduction")
    end

    space_luminaires = space.luminaires
    space_luminaires.each do |space_luminaire|
        # clone def if it has not already been cloned
        exist_def = space_luminaire.luminaireDefinition
        if cloned_luminaire_defs.any? { |k, v| k.to_s == exist_def.name }
            new_def = cloned_luminaire_defs[exist_def.name]
            else
                # clone rename and add to hash
                new_def = exist_def.clone(model)
                new_def_name = new_def.setName("#{new_def.name} - #{lighting_power_reduction_percent} percent reduction")
                cloned_luminaire_defs[exist_def.name] = new_def
                new_def = new_def.to_LightsDefinition.get
            end
            # link instance with clone and rename
            updated_instance = space_light.setLightsDefinition(new_def)
            updated_instance_name = space_light.setName("#{space_light.name} - #{lighting_power_reduction_percent} percent reduction")

        end


        ##beginning of artificial lighting change

        art_light_states=[5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80]

        (0..16).each do |j|
            # create a new LightsDefinition and new Lights object to use with setLightingPowerPerFloorArea
            template_light_def = OpenStudio::Model::LightsDefinition.new(model)

            ems_art_light = OpenStudio::Model::LightsDefinition.new(light)
            ems_art_light.setName("Light #{art_light_states[j]}")
            runner.registerInfo("Created a new Artificial Light named #{ems_art_light.name} representing an electrochromatic window construction.")
            ems_art_light_array << ems_art_light
        end  

        # creating an output variable for Schedule Value for Artificial Lighting
        output_var_2 = "Schedule Value for Artificial Lighting"
        output_var_art_light = OpenStudio::Model::OutputVariable.new(output_var_2, model)

        # create a sensor to sense the Schedule Value for Artificial Lighting
        art_light_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, output_var_art_light)
        art_light_sensor_name = "Artificial Lighting Sensor"
        art_light_sensor.setName(art_light_sensor_name)

        # Create a new EMS Actuator Object representing the artificial lighting state of the EMS generated artificial light 
        ems_art_light_actuator = OpenStudio::Model::EnergyManagementSystemActuator.new(lightsDefinition, "Light", "Lighting State")
        ems_art_light_actuator.setName("Artificial_Lighting_Set")
        runner.registerInfo("An EMS Actuator object named '#{ems_art_light_actuator.name}' representing lighting state of the EMS generated electrochromatic window was added to the model.") 


        # Create 7 EnergyManagementSystem:ConstructionIndexVariable objects for each unique electrochromatic construction
        ems_art_light_array.each do |ems_art_light|
            ems_art_light_index_var = OpenStudio::Model::EnergyManagementSystemLightIndexVariable.new(model, ems_art_light )   
            ems_art_light_index_var.setName("#{ems_art_light.name}")
            runner.registerInfo("An EMS SystemLightIndexVariable object named '#{ems_art_light_index_var.name}' representing the the EMS construction state of the artificial light was added to the model.") 
        end

        # Create new EnergyManagementSystem:Program object for assigning different window constructions by dynamically evaluating the exterior surface temp of the fixed window subsurface 
        ems_apply_art_light_prgm = OpenStudio::Model::EnergyManagementSystemProgram.new(model)
        ems_apply_art_light_prgm.setName("#{fixed_window_subsurface.name}_Control")
        ems_apply_art_light_prgm.addLine("IF #{art_light_sensor.name} == 10")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 10")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 15")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 15")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 20")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 20")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 25")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 25")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 30")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 30")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 35")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 35")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 40")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 40")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 45")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 45")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 50")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 50")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 55")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 55")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 60")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 60")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 65")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 65")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 70")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 70")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 75")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 75")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 80")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 80")
        ems_apply_art_light_prgm.addLine("ELSEIF #{art_light_sensor.name} == 85")
        ems_apply_art_light_prgm.addLine("SET #{ems_art_light_actuator.name} = 85")
        ems_apply_art_light_prgm.addLine("ENDIF")
        runner.registerInfo("An EMS Program Object named '#{ems_apply_art_light_prgm.name}' for dynamically assigning different artificial lighting based on the values in the uploaded file was added to the model.") 

        # Create a new EnergyManagementSystem:ProgramCallingManager object configured to call the EMS programs
        ems_prgm_calling_mngr_2 = OpenStudio::Model::EnergyManagementSystemProgramCallingManager.new(model)
        ems_prgm_calling_mngr_2.setName("My Artificial Lighting emulator")
        ems_prgm_calling_mngr_2.setCallingPoint("BeginTimestepBeforePredictor")
        ems_prgm_calling_mngr_2.addProgram(ems_apply_art_light_prgm)
        runner.registerInfo("EMS Program Calling Manager object named '#{ems_prgm_calling_mngr_2.name}' added to call EMS program for dynamically applying a electrochromatic window.") 

        lighting_power_reduction_percent = runner.getDoubleArgumentValue('lighting_power_reduction_percent', user_arguments)

        # create unique object for OutputEnergyManagementSystems and configure to allow EMS reporting
        outputEMS = model.getOutputEnergyManagementSystem
        outputEMS.setInternalVariableAvailabilityDictionaryReporting("internal_variable_availability_dictionary_reporting")
        outputEMS.setEMSRuntimeLanguageDebugOutputLevel("ems_runtime_language_debug_output_level")
        outputEMS.setActuatorAvailabilityDictionaryReporting("actuator_availability_dictionary_reporting")
        runner.registerInfo("EMS OutputEnergyManagementSystem object configured per user arguments.") 

        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 of window construction change

        # make a schedule
        startDate = OpenStudio::Date.new(OpenStudio::MonthOfYear.new(1), 1)
        timeseries = OpenStudio::TimeSeries.new(startDate, interval, schedule_values)
        schedule = OpenStudio::Model::ScheduleInterval::fromTimeSeries(timeseries, model)
        if schedule.empty?
          runner.registerError("Unable to make schedule from file at '#{file_path}'")
          return false
        end
        schedule = schedule.get
        schedule.setName(schedule_name)

        # reporting final condition of model
        runner.registerFinalCondition("Added schedule #{schedule_name} to the model.")

        return true
      end
    end
    # this allows the measure to be use by the application
    DynamicWindowGlazing.new.registerWithApplication
available here

Error Message

Standard Output: [openstudio.measure.OSRunner] No value found for argument 'schedule_name_1'. [12:02:02.564909 [16:24:03.525129 ERROR] No value found for argument 'schedule_name_1'. [12:02:02.565728 ERROR] C:\OS\src\measure\OSRunner.cpp@753 : No value found for argument 'schedule_name_1'. C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:in getStringArgumentValue' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:inuninitialized constant DynamicWindowGlazing::SimpleGlazing eval:355:in const_missing' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:264:inblock in run' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:252:in each' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:252:inrun' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:515:in apply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run' :/openstudio_cli.rb:963:inexecute' :/openstudio_cli.rb:753:in execute' :/openstudio_cli.rb:1747:in' eval:175:in eval' eval:175:inrequire_embedded_absolute' eval:160:in block in require_embedded' eval:154:ineach' eval:154:in require_embedded' eval:113:inrequire' eval:3:in ' [12:02:02.569900 [16:24:03.527430 ERROR] :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with message Runner error :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with C:\OS\src\measure\OSRunner.cpp@753 : No value found for argument 'schedule_name_1'., C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:ingetStringArgumentValue' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:in uninitialized constant DynamicWindowGlazing::SimpleGlazing, eval:355:inconst_missing' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:264:in block in run' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:252:ineach' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:252:in run' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:515:inapply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:in block in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:ineach_index' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:inperform' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:in step' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:inrun' :/openstudio_cli.rb:963:in execute' :/openstudio_cli.rb:753:inexecute' :/openstudio_cli.rb:1747:in ' eval:175:ineval' eval:175:in require_embedded_absolute' eval:160:inblock in require_embedded' eval:154:in each' eval:154:inrequire_embedded' eval:113:in require' eval:3:in' in :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:543:in rescue in apply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:503:inapply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:in block in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:ineach_index' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:inperform' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:in step' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:inrun' :/openstudio_cli.rb:963:in execute' :/openstudio_cli.rb:753:inexecute' :/openstudio_cli.rb:1747:in ' eval:175:ineval' eval:175:in require_embedded_absolute' eval:160:inblock in require_embedded' eval:154:in each' eval:154:inrequire_embedded' eval:113:in require' eval:3:in' [12:02:02.570632 [16:24:03.528322 ERROR] Found error in state 'os_measures' with message [":/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with message Runner error :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with C:\OS\src\measure\OSRunner.cpp@753 : No value found for argument 'schedule_name_1'., C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:in getStringArgumentValue'\nC:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:inuninitialized constant DynamicWindowGlazing::SimpleGlazing, eval:355:in const_missing'\nC:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:264:inblock in run'\nC:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:252:in each'\nC:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:252:inrun'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:515:in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run'\n:/openstudio_cli.rb:963:inexecute'\n:/openstudio_cli.rb:753:in execute'\n:/openstudio_cli.rb:1747:in'\neval:175:in eval'\neval:175:inrequire_embedded_absolute'\neval:160:in block in require_embedded'\neval:154:ineach'\neval:154:in require_embedded'\neval:113:inrequire'\neval:3:in ' in :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:543:inrescue in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:503:in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run'\n:/openstudio_cli.rb:963:inexecute'\n:/openstudio_cli.rb:753:in execute'\n:/openstudio_cli.rb:1747:in'\neval:175:in eval'\neval:175:inrequire_embedded_absolute'\neval:160:in block in require_embedded'\neval:154:ineach'\neval:154:in require_embedded'\neval:113:inrequire'\neval:3:in '::/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:652:inrescue in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:310:in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run'\n:/openstudio_cli.rb:963:inexecute'\n:/openstudio_cli.rb:753:in execute'\n:/openstudio_cli.rb:1747:in'\neval:175:in eval'\neval:175:inrequire_embedded_absolute'\neval:160:in block in require_embedded'\neval:154:ineach'\neval:154:in require_embedded'\neval:113:inrequire'\neval:3:in `'"]}

Standard Error:

run.log: [12:02:02.564909 [16:24:03.525129 ERROR] No value found for argument 'schedule_name_1'. [12:02:02.565728 ERROR] C:\OS\src\measure\OSRunner.cpp@753 : No value found for argument 'schedule_name_1'. C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:in getStringArgumentValue' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:inuninitialized constant DynamicWindowGlazing::SimpleGlazing eval:355:in const_missing' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:264:inblock in run' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:252:in each' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:252:inrun' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:515:in apply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run' :/openstudio_cli.rb:963:inexecute' :/openstudio_cli.rb:753:in execute' :/openstudio_cli.rb:1747:in' eval:175:in eval' eval:175:inrequire_embedded_absolute' eval:160:in block in require_embedded' eval:154:ineach' eval:154:in require_embedded' eval:113:inrequire' eval:3:in ' [12:02:02.569900 [16:24:03.527430 ERROR] :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with message Runner error :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with C:\OS\src\measure\OSRunner.cpp@753 : No value found for argument 'schedule_name_1'., C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:ingetStringArgumentValue' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:in uninitialized constant DynamicWindowGlazing::SimpleGlazing, eval:355:inconst_missing' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:264:in block in run' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:252:ineach' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:252:in run' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:515:inapply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:in block in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:ineach_index' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:inperform' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:in step' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:inrun' :/openstudio_cli.rb:963:in execute' :/openstudio_cli.rb:753:inexecute' :/openstudio_cli.rb:1747:in ' eval:175:ineval' eval:175:in require_embedded_absolute' eval:160:inblock in require_embedded' eval:154:in each' eval:154:inrequire_embedded' eval:113:in require' eval:3:in' in :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:543:in rescue in apply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:503:inapply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:in block in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:ineach_index' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:inperform' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:in step' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:inrun' :/openstudio_cli.rb:963:in execute' :/openstudio_cli.rb:753:inexecute' :/openstudio_cli.rb:1747:in ' eval:175:ineval' eval:175:in require_embedded_absolute' eval:160:inblock in require_embedded' eval:154:in each' eval:154:inrequire_embedded' eval:113:in require' eval:3:in' [12:02:02.570632 [16:24:03.528322 ERROR] Found error in state 'os_measures' with message [":/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with message Runner error :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with C:\OS\src\measure\OSRunner.cpp@753 : No value found for argument 'schedule_name_1'., C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:in getStringArgumentValue'\nC:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:137:inuninitialized constant DynamicWindowGlazing::SimpleGlazing, eval:355:in const_missing'\nC:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:264:inblock in run'\nC:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:252:in each'\nC:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:252:inrun'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:515:in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run'\n:/openstudio_cli.rb:963:inexecute'\n:/openstudio_cli.rb:753:in execute'\n:/openstudio_cli.rb:1747:in'\neval:175:in eval'\neval:175:inrequire_embedded_absolute'\neval:160:in block in require_embedded'\neval:154:ineach'\neval:154:in require_embedded'\neval:113:inrequire'\neval:3:in ' in :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:543:inrescue in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:503:in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run'\n:/openstudio_cli.rb:963:inexecute'\n:/openstudio_cli.rb:753:in execute'\n:/openstudio_cli.rb:1747:in'\neval:175:in eval'\neval:175:inrequire_embedded_absolute'\neval:160:in block in require_embedded'\neval:154:ineach'\neval:154:in require_embedded'\neval:113:inrequire'\neval:3:in '::/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:652:inrescue in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:310:in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run'\n:/openstudio_cli.rb:963:inexecute'\n:/openstudio_cli.rb:753:in execute'\n:/openstudio_cli.rb:1747:in'\neval:175:in eval'\neval:175:inrequire_embedded_absolute'\neval:160:in block in require_embedded'\neval:154:ineach'\neval:154:in require_embedded'\neval:113:inrequire'\neval:3:in `'"]}

Hourly changes in simulation conditions using EMS using .csv values

I have been trying to bring in hourly changes in simulation conditions that take values from a .csv file and convert them to the values take by the EMS sensor. This I am trying to implement on 2 aspects: 1. The construction (in order to change the aspects of SHGC and Visible Transmittance values of a Simple Glazing unit), for which I'm creating 7 states which are defined in the code and trying to choose the appropriate construction based on the corresponding value in .csv file. 2. The LPD of artificial lighting by choosing the appropriate value for the hour from the .csv file.

The end-result that I'm trying to acheve is similar to the question asked in https://unmethours.com/question/47169/how-to-add-variable-envelope-properties-in-energyplus-through-ems/ , but I faced difficulty in implementing it which is why I have posted as a separate question. Kindly help me out. The input .csv files that I want to use are attached here

I'm attaching the code that I had tried, but it doesn't seem to be working. Since I'm a beginner in Measure Writing, I have tried to combine snippets from the following codes:

  1. M13Example13SurfaceConstructionActuatorForThermochromaticWindow: https://github.com/NREL/OpenStudio-EMS-Measures/blob/master/Measures/m_13_example_13_surface_construction_actuator_for_thermochromatic_window/measure.rb
  2. Set Lighting Loads by LPD: https://bcl.nrel.gov/node/84704
  3. Replace Exterior Window Constructions with a Different Construction from the Model: https://bcl.nrel.gov/node/84690
  4. Add Interval Schedule From File: https://bcl.nrel.gov/node/84422

My Code is available here

Error Message

Standard Output: [16:24:03.525129 ERROR] uninitialized constant DynamicWindowGlazing::SimpleGlazing eval:355:in const_missing' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:264:inblock in run' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:252:in each' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:252:inrun' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:515:in apply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run' :/openstudio_cli.rb:963:inexecute' :/openstudio_cli.rb:753:in execute' :/openstudio_cli.rb:1747:in' eval:175:in eval' eval:175:inrequire_embedded_absolute' eval:160:in block in require_embedded' eval:154:ineach' eval:154:in require_embedded' eval:113:inrequire' eval:3:in ' [16:24:03.527430 ERROR] :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with message Runner error :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with uninitialized constant DynamicWindowGlazing::SimpleGlazing, eval:355:inconst_missing' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:264:in block in run' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:252:ineach' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:252:in run' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:515:inapply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:in block in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:ineach_index' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:inperform' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:in step' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:inrun' :/openstudio_cli.rb:963:in execute' :/openstudio_cli.rb:753:inexecute' :/openstudio_cli.rb:1747:in ' eval:175:ineval' eval:175:in require_embedded_absolute' eval:160:inblock in require_embedded' eval:154:in each' eval:154:inrequire_embedded' eval:113:in require' eval:3:in' in :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:543:in rescue in apply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:503:inapply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:in block in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:ineach_index' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:inperform' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:in step' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:inrun' :/openstudio_cli.rb:963:in execute' :/openstudio_cli.rb:753:inexecute' :/openstudio_cli.rb:1747:in ' eval:175:ineval' eval:175:in require_embedded_absolute' eval:160:inblock in require_embedded' eval:154:in each' eval:154:inrequire_embedded' eval:113:in require' eval:3:in' [16:24:03.528322 ERROR] Found error in state 'os_measures' with message [":/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with message Runner error :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with uninitialized constant DynamicWindowGlazing::SimpleGlazing, eval:355:in const_missing'\nC:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:264:inblock in run'\nC:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:252:in each'\nC:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:252:inrun'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:515:in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run'\n:/openstudio_cli.rb:963:inexecute'\n:/openstudio_cli.rb:753:in execute'\n:/openstudio_cli.rb:1747:in'\neval:175:in eval'\neval:175:inrequire_embedded_absolute'\neval:160:in block in require_embedded'\neval:154:ineach'\neval:154:in require_embedded'\neval:113:inrequire'\neval:3:in ' in :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:543:inrescue in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:503:in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run'\n:/openstudio_cli.rb:963:inexecute'\n:/openstudio_cli.rb:753:in execute'\n:/openstudio_cli.rb:1747:in'\neval:175:in eval'\neval:175:inrequire_embedded_absolute'\neval:160:in block in require_embedded'\neval:154:ineach'\neval:154:in require_embedded'\neval:113:inrequire'\neval:3:in '::/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:652:inrescue in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:310:in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run'\n:/openstudio_cli.rb:963:inexecute'\n:/openstudio_cli.rb:753:in execute'\n:/openstudio_cli.rb:1747:in'\neval:175:in eval'\neval:175:inrequire_embedded_absolute'\neval:160:in block in require_embedded'\neval:154:ineach'\neval:154:in require_embedded'\neval:113:inrequire'\neval:3:in `'"]}

Standard Error:

run.log: [16:24:03.525129 ERROR] uninitialized constant DynamicWindowGlazing::SimpleGlazing eval:355:in const_missing' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:264:inblock in run' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:252:in each' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:252:inrun' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:515:in apply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run' :/openstudio_cli.rb:963:inexecute' :/openstudio_cli.rb:753:in execute' :/openstudio_cli.rb:1747:in' eval:175:in eval' eval:175:inrequire_embedded_absolute' eval:160:in block in require_embedded' eval:154:ineach' eval:154:in require_embedded' eval:113:inrequire' eval:3:in ' [16:24:03.527430 ERROR] :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with message Runner error :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with uninitialized constant DynamicWindowGlazing::SimpleGlazing, eval:355:inconst_missing' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:264:in block in run' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:252:ineach' C:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:252:in run' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:515:inapply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:in block in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:ineach_index' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:inperform' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:in step' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:inrun' :/openstudio_cli.rb:963:in execute' :/openstudio_cli.rb:753:inexecute' :/openstudio_cli.rb:1747:in ' eval:175:ineval' eval:175:in require_embedded_absolute' eval:160:inblock in require_embedded' eval:154:in each' eval:154:inrequire_embedded' eval:113:in require' eval:3:in' in :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:543:in rescue in apply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:503:inapply_measure' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:in block in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:ineach_index' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in apply_measures' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:inperform' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:in step' :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:inrun' :/openstudio_cli.rb:963:in execute' :/openstudio_cli.rb:753:inexecute' :/openstudio_cli.rb:1747:in ' eval:175:ineval' eval:175:in require_embedded_absolute' eval:160:inblock in require_embedded' eval:154:in each' eval:154:inrequire_embedded' eval:113:in require' eval:3:in' [16:24:03.528322 ERROR] Found error in state 'os_measures' with message [":/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with message Runner error :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb failed with uninitialized constant DynamicWindowGlazing::SimpleGlazing, eval:355:in const_missing'\nC:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:264:inblock in run'\nC:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:252:in each'\nC:/Users/nycta/OpenStudio/Measures/dynamic_window_glazing/measure.rb:252:inrun'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:515:in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run'\n:/openstudio_cli.rb:963:inexecute'\n:/openstudio_cli.rb:753:in execute'\n:/openstudio_cli.rb:1747:in'\neval:175:in eval'\neval:175:inrequire_embedded_absolute'\neval:160:in block in require_embedded'\neval:154:ineach'\neval:154:in require_embedded'\neval:113:inrequire'\neval:3:in ' in :/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:543:inrescue in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:503:in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run'\n:/openstudio_cli.rb:963:inexecute'\n:/openstudio_cli.rb:753:in execute'\n:/openstudio_cli.rb:1747:in'\neval:175:in eval'\neval:175:inrequire_embedded_absolute'\neval:160:in block in require_embedded'\neval:154:ineach'\neval:154:in require_embedded'\neval:113:inrequire'\neval:3:in '::/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:652:inrescue in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:310:in apply_measure'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:114:inblock in apply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:in each_index'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/util/measure.rb:67:inapply_measures'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/jobs/run_os_measures.rb:70:in perform'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:292:instep'\n:/ruby/2.5.0/gems/openstudio-workflow-2.1.0/lib/openstudio/workflow/run.rb:234:in run'\n:/openstudio_cli.rb:963:inexecute'\n:/openstudio_cli.rb:753:in execute'\n:/openstudio_cli.rb:1747:in'\neval:175:in eval'\neval:175:inrequire_embedded_absolute'\neval:160:in block in require_embedded'\neval:154:ineach'\neval:154:in require_embedded'\neval:113:inrequire'\neval:3:in `'"]}