diff --git a/BuildResidentialHPXML/measure.rb b/BuildResidentialHPXML/measure.rb index afadeaa83f..eab5f6c599 100644 --- a/BuildResidentialHPXML/measure.rb +++ b/BuildResidentialHPXML/measure.rb @@ -3648,14 +3648,14 @@ def run(model, runner, user_arguments) # Create HPXML file hpxml_path = args[:hpxml_path] unless (Pathname.new hpxml_path).absolute? - hpxml_path = File.expand_path(hpxml_path) + hpxml_path = File.join(runner.workflow.absoluteRootDir.to_s, hpxml_path) end # Existing HPXML File if not args[:existing_hpxml_path].nil? existing_hpxml_path = args[:existing_hpxml_path] unless (Pathname.new existing_hpxml_path).absolute? - existing_hpxml_path = File.expand_path(existing_hpxml_path) + existing_hpxml_path = File.join(runner.workflow.absoluteRootDir.to_s, existing_hpxml_path) end end diff --git a/BuildResidentialScheduleFile/measure.rb b/BuildResidentialScheduleFile/measure.rb index ce9af20b8a..0b45c3163d 100644 --- a/BuildResidentialScheduleFile/measure.rb +++ b/BuildResidentialScheduleFile/measure.rb @@ -104,7 +104,7 @@ def run(model, runner, user_arguments) hpxml_path = args[:hpxml_path] unless (Pathname.new hpxml_path).absolute? - hpxml_path = File.expand_path(hpxml_path) + hpxml_path = File.join(runner.workflow.absoluteRootDir.to_s, hpxml_path) end unless File.exist?(hpxml_path) && hpxml_path.downcase.end_with?('.xml') fail "'#{hpxml_path}' does not exist or is not an .xml file." @@ -112,7 +112,7 @@ def run(model, runner, user_arguments) hpxml_output_path = args[:hpxml_output_path] unless (Pathname.new hpxml_output_path).absolute? - hpxml_output_path = File.expand_path(hpxml_output_path) + hpxml_output_path = File.join(runner.workflow.absoluteRootDir.to_s, hpxml_output_path) end args[:hpxml_output_path] = hpxml_output_path diff --git a/HPXMLtoOpenStudio/measure.rb b/HPXMLtoOpenStudio/measure.rb index bc8e2b4ef8..4ecf4c44a5 100644 --- a/HPXMLtoOpenStudio/measure.rb +++ b/HPXMLtoOpenStudio/measure.rb @@ -112,7 +112,7 @@ def run(model, runner, user_arguments) Model.reset(runner, model) args = runner.getArgumentValues(arguments(model), user_arguments) - set_file_paths(args) + set_file_paths(runner, args) begin hpxml = create_hpxml_object(runner, args) @@ -177,16 +177,16 @@ def run(model, runner, user_arguments) # # @param args [Hash] Map of :argument_name => value # @return [nil] - def set_file_paths(args) + def set_file_paths(runner, args) if not (Pathname.new args[:hpxml_path]).absolute? - args[:hpxml_path] = File.expand_path(args[:hpxml_path]) + args[:hpxml_path] = File.join(runner.workflow.absoluteRootDir.to_s, args[:hpxml_path]) end if not File.exist?(args[:hpxml_path]) && args[:hpxml_path].downcase.end_with?('.xml') fail "'#{args[:hpxml_path]}' does not exist or is not an .xml file." end if not (Pathname.new args[:output_dir]).absolute? - args[:output_dir] = File.expand_path(args[:output_dir]) + args[:output_dir] = File.join(runner.workflow.absoluteRootDir.to_s, args[:output_dir]) end if File.extname(args[:annual_output_file_name]).length == 0 diff --git a/HPXMLtoOpenStudio/resources/meta_measure.rb b/HPXMLtoOpenStudio/resources/meta_measure.rb index 88609eb9f8..841f31d7dc 100644 --- a/HPXMLtoOpenStudio/resources/meta_measure.rb +++ b/HPXMLtoOpenStudio/resources/meta_measure.rb @@ -189,7 +189,7 @@ def apply_measures(measures_dir, measures, runner, model, show_measure_calls = t if not osw_out.nil? # Create a workflow based on the measures we're going to call. Convenient for debugging. workflowJSON = OpenStudio::WorkflowJSON.new - workflowJSON.setOswPath(File.expand_path("../#{osw_out}")) + workflowJSON.setOswPath(File.join(runner.workflow.absoluteRootDir.to_s, osw_out)) workflowJSON.addMeasurePath('measures') workflowJSON.addMeasurePath('resources/hpxml-measures') steps = OpenStudio::WorkflowStepVector.new diff --git a/workflow/template-build-and-run-hpxml-with-stochastic-occupancy.osw b/workflow/template-build-and-run-hpxml-with-stochastic-occupancy.osw index ef48e709fb..c761a59e35 100644 --- a/workflow/template-build-and-run-hpxml-with-stochastic-occupancy.osw +++ b/workflow/template-build-and-run-hpxml-with-stochastic-occupancy.osw @@ -52,7 +52,7 @@ "heating_system_heating_capacity": 36000.0, "heating_system_heating_efficiency": 0.92, "heating_system_type": "Furnace", - "hpxml_path": "../built.xml", + "hpxml_path": "run/built.xml", "hvac_control_cooling_weekday_setpoint": "78", "hvac_control_cooling_weekend_setpoint": "78", "hvac_control_heating_weekday_setpoint": "68", @@ -82,16 +82,16 @@ }, { "arguments": { - "hpxml_path": "../built.xml", + "hpxml_path": "run/built.xml", "output_csv_path": "stochastic.csv", - "hpxml_output_path": "../built-stochastic-schedules.xml" + "hpxml_output_path": "run/built-stochastic-schedules.xml" }, "measure_dir_name": "BuildResidentialScheduleFile" }, { "arguments": { - "hpxml_path": "../built-stochastic-schedules.xml", - "output_dir": "..", + "hpxml_path": "run/built-stochastic-schedules.xml", + "output_dir": "run", "debug": false, "add_component_loads": false, "skip_validation": false diff --git a/workflow/template-run-hpxml-with-stochastic-occupancy-subset.osw b/workflow/template-run-hpxml-with-stochastic-occupancy-subset.osw index 1552e18dc2..d3337cc5fd 100644 --- a/workflow/template-run-hpxml-with-stochastic-occupancy-subset.osw +++ b/workflow/template-run-hpxml-with-stochastic-occupancy-subset.osw @@ -6,17 +6,17 @@ "steps": [ { "arguments": { - "hpxml_path": "../../sample_files/base.xml", + "hpxml_path": "sample_files/base.xml", "output_csv_path": "stochastic.csv", - "hpxml_output_path": "../built-stochastic-schedules.xml", + "hpxml_output_path": "run/built-stochastic-schedules.xml", "schedules_column_names": "cooking_range, dishwasher, hot_water_dishwasher, clothes_washer, hot_water_clothes_washer, clothes_dryer, hot_water_fixtures" }, "measure_dir_name": "BuildResidentialScheduleFile" }, { "arguments": { - "hpxml_path": "../built-stochastic-schedules.xml", - "output_dir": "..", + "hpxml_path": "run/built-stochastic-schedules.xml", + "output_dir": "run", "debug": false, "add_component_loads": false, "skip_validation": false diff --git a/workflow/template-run-hpxml-with-stochastic-occupancy.osw b/workflow/template-run-hpxml-with-stochastic-occupancy.osw index 8a0dff1170..b1386a8b9f 100644 --- a/workflow/template-run-hpxml-with-stochastic-occupancy.osw +++ b/workflow/template-run-hpxml-with-stochastic-occupancy.osw @@ -6,16 +6,16 @@ "steps": [ { "arguments": { - "hpxml_path": "../../sample_files/base.xml", + "hpxml_path": "sample_files/base.xml", "output_csv_path": "stochastic.csv", - "hpxml_output_path": "../built-stochastic-schedules.xml" + "hpxml_output_path": "run/built-stochastic-schedules.xml" }, "measure_dir_name": "BuildResidentialScheduleFile" }, { "arguments": { - "hpxml_path": "../built-stochastic-schedules.xml", - "output_dir": "..", + "hpxml_path": "run/built-stochastic-schedules.xml", + "output_dir": "run", "debug": false, "add_component_loads": false, "skip_validation": false diff --git a/workflow/template-run-hpxml.osw b/workflow/template-run-hpxml.osw index ca67d06488..672006faab 100644 --- a/workflow/template-run-hpxml.osw +++ b/workflow/template-run-hpxml.osw @@ -6,8 +6,8 @@ "steps": [ { "arguments": { - "hpxml_path": "../../sample_files/base.xml", - "output_dir": "..", + "hpxml_path": "sample_files/base.xml", + "output_dir": "run", "debug": false, "add_component_loads": false, "skip_validation": false,