lib/measures/from_honeybee_model/measure.rb in honeybee-openstudio-2.35.0 vs lib/measures/from_honeybee_model/measure.rb in honeybee-openstudio-2.35.1
- old
+ new
@@ -35,10 +35,11 @@
require 'to_openstudio'
require 'fileutils'
require 'pathname'
require 'json'
+require 'open3'
# start the measure
class FromHoneybeeModel < OpenStudio::Measure::ModelMeasure
# human readable name
def name
@@ -131,10 +132,15 @@
f.write(hvac_spec.to_json)
end
model.save(osm_path, true)
# call the Ironbug console to add the HVAC to the OSM
ironbug_exe = '"' + $ironbug_exe + '"'
- system(ironbug_exe + ' "' + osm_path + '" "' + hvac_json_path + '"')
+ ib_cmd = ironbug_exe + ' "' + osm_path + '" "' + hvac_json_path + '"'
+ stdout, stderr, status = Open3.capture3(ib_cmd)
+ if status.exitstatus != 0
+ runner.registerError('Failed to apply IronBug HVAC:' + stderr)
+ return false
+ end
# load the new model
translator = OpenStudio::OSVersion::VersionTranslator.new
o_model = translator.loadModel(osm_path)
if o_model.empty?
runner.registerError("Could not load Ironbug model from '" + osm_path.to_s + "'.")