Run simulation error | undefined method `empty?' for nil:NilClass

Issue #39 new
Aaron Boranian created an issue

When clicking on “Apply” or “Run” buttons in Run Simulation dialog that sets up an EnergyPlus simulation for the attached IDF (EnergyPlus v9.6), the following error occurs:

ERROR:
NoMethodError
undefined method `empty?' for nil:NilClass

BACKTRACE:
C:/Users/Aaron Boranian/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/euclid/lib/legacy_openstudio/lib/dialogs/RunSimulationInterface.rb:173:in report'
C:/Users/Aaron Boranian/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/euclid/lib/legacy_openstudio/lib/dialogs/Dialogs.rb:120:in report'
C:/Users/Aaron Boranian/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/euclid/lib/legacy_openstudio/lib/dialogs/Dialogs.rb:329:in on_apply'
C:/Users/Aaron Boranian/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/euclid/lib/legacy_openstudio/lib/dialogs/Dialogs.rb:310:in block in add_callbacks'
SketchUp:1:in `call'

CONFIGURATION:
Euclid 0.9.4.4
SketchUp 17.2.2555 64-bit
Ruby 2.2.4 x64-mingw32

This happens even if no simulation options are turned on.

Starting from Lines 157-173 of RunSimulationInterface.rb:

      # Configure the RUN PERIOD object
      objects = Plugin.model_manager.input_file.find_objects_by_class_name("RunPeriod")
      if (objects.empty?)
        run_period = InputObject.new("RunPeriod")
        Plugin.model_manager.input_file.add_object(run_period)
      else
        run_period = objects.to_a.first
      end

      run_period.fields[1] = @hash['RUN_PERIOD_NAME'] # name of RunPeriod cannot be left blank as of EnergyPlus v9.2
      run_period.fields[2] = @hash['START_MONTH']
      run_period.fields[3] = @hash['START_DATE']
      run_period.fields[4] = @hash['START_YEAR']
      run_period.fields[5] = @hash['END_MONTH']
      run_period.fields[6] = @hash['END_DATE']
      run_period.fields[7] = @hash['END_YEAR']
      run_period.fields[8] = @hash['START_DAY']

So, trying to set run_period.fields[8] = @hash['START_DAY'] is causing the error message.

Comments (0)

  1. Log in to comment