From e15c4ad62451ea537770b8a0fc23407d5687de7f Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Tue, 9 May 2023 10:35:00 -0700 Subject: [PATCH 1/8] Change output_dir to relative path. --- HPXMLtoOpenStudio/measure.rb | 5 ++++- HPXMLtoOpenStudio/measure.xml | 18 +++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/HPXMLtoOpenStudio/measure.rb b/HPXMLtoOpenStudio/measure.rb index 0309ca0f55..13cf833031 100644 --- a/HPXMLtoOpenStudio/measure.rb +++ b/HPXMLtoOpenStudio/measure.rb @@ -97,9 +97,12 @@ def run(model, runner, user_arguments) fail "'#{hpxml_path}' does not exist or is not an .xml file." end - unless (Pathname.new output_dir).absolute? + output_dir = Pathname.new output_dir + unless output_dir.absolute? output_dir = File.expand_path(output_dir) end + cwd = Pathname.new(Dir.getwd) + output_dir = output_dir.relative_path_from(cwd) if building_id.is_initialized building_id = building_id.get diff --git a/HPXMLtoOpenStudio/measure.xml b/HPXMLtoOpenStudio/measure.xml index c7da85e0c0..c047455890 100644 --- a/HPXMLtoOpenStudio/measure.xml +++ b/HPXMLtoOpenStudio/measure.xml @@ -3,8 +3,8 @@ 3.0 hpxm_lto_openstudio b1543b30-9465-45ff-ba04-1d1f85e763bc - 4816c10b-5a41-436e-a355-cfd8edd5b044 - 20230502T201104Z + 52036917-c102-4842-b540-85b22f2bb77d + 20230509T173437Z D8922A73 HPXMLtoOpenStudio HPXML to OpenStudio Translator @@ -565,6 +565,12 @@ test F1FEF43F + + hpxml_defaults.rb + rb + resource + A466A879 + OpenStudio @@ -574,13 +580,7 @@ measure.rb rb script - 1E7FB5AF - - - hpxml_defaults.rb - rb - resource - A466A879 + BC5D87DC From 77ceaf8414a87a2a5a5d71706b03cc032d373dfa Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Tue, 9 May 2023 12:53:35 -0700 Subject: [PATCH 2/8] Move abs to rel path conv to schedules resource file. --- HPXMLtoOpenStudio/measure.rb | 5 +---- HPXMLtoOpenStudio/measure.xml | 18 +++++++++--------- HPXMLtoOpenStudio/resources/schedules.rb | 7 ++++++- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/HPXMLtoOpenStudio/measure.rb b/HPXMLtoOpenStudio/measure.rb index 13cf833031..0309ca0f55 100644 --- a/HPXMLtoOpenStudio/measure.rb +++ b/HPXMLtoOpenStudio/measure.rb @@ -97,12 +97,9 @@ def run(model, runner, user_arguments) fail "'#{hpxml_path}' does not exist or is not an .xml file." end - output_dir = Pathname.new output_dir - unless output_dir.absolute? + unless (Pathname.new output_dir).absolute? output_dir = File.expand_path(output_dir) end - cwd = Pathname.new(Dir.getwd) - output_dir = output_dir.relative_path_from(cwd) if building_id.is_initialized building_id = building_id.get diff --git a/HPXMLtoOpenStudio/measure.xml b/HPXMLtoOpenStudio/measure.xml index c047455890..1fac517e69 100644 --- a/HPXMLtoOpenStudio/measure.xml +++ b/HPXMLtoOpenStudio/measure.xml @@ -3,8 +3,8 @@ 3.0 hpxm_lto_openstudio b1543b30-9465-45ff-ba04-1d1f85e763bc - 52036917-c102-4842-b540-85b22f2bb77d - 20230509T173437Z + 997dce93-f5a5-4db3-a368-dbe9249ddb8f + 20230509T195314Z D8922A73 HPXMLtoOpenStudio HPXML to OpenStudio Translator @@ -493,12 +493,6 @@ test 414F4C13 - - schedules.rb - rb - resource - B922A51B - hvac.rb rb @@ -571,6 +565,12 @@ resource A466A879 + + schedules.rb + rb + resource + 80726D4F + OpenStudio @@ -580,7 +580,7 @@ measure.rb rb script - BC5D87DC + 1E7FB5AF diff --git a/HPXMLtoOpenStudio/resources/schedules.rb b/HPXMLtoOpenStudio/resources/schedules.rb index c2def94b0d..ce7e8dca0b 100644 --- a/HPXMLtoOpenStudio/resources/schedules.rb +++ b/HPXMLtoOpenStudio/resources/schedules.rb @@ -1384,7 +1384,12 @@ def initialize(runner: nil, @tmp_schedules = Marshal.load(Marshal.dump(@schedules)) set_unavailable_periods(unavailable_periods) convert_setpoints + + output_path = Pathname.new output_path + cwd = Pathname.new(Dir.getwd) + output_path = output_path.relative_path_from(cwd) @output_schedules_path = output_path + export() end @@ -1506,7 +1511,7 @@ def create_schedule_file(col_name:, schedule_length = @schedules[col_name].length min_per_item = 60.0 / (schedule_length / num_hrs_in_year) - schedule_file = OpenStudio::Model::ScheduleFile.new(@model, @output_schedules_path) + schedule_file = OpenStudio::Model::ScheduleFile.new(@model, "#{@output_schedules_path}") schedule_file.setName(col_name) schedule_file.setColumnNumber(col_index + 1) schedule_file.setRowstoSkipatTop(rows_to_skip) From a2732cc32c8727dfba437dad82b2555c96b5ec79 Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Tue, 9 May 2023 14:56:51 -0700 Subject: [PATCH 3/8] This works with the os changes, but we are changing cwd. --- HPXMLtoOpenStudio/measure.xml | 16 ++++++++-------- HPXMLtoOpenStudio/resources/schedules.rb | 10 ++++------ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/HPXMLtoOpenStudio/measure.xml b/HPXMLtoOpenStudio/measure.xml index 1fac517e69..c48b199996 100644 --- a/HPXMLtoOpenStudio/measure.xml +++ b/HPXMLtoOpenStudio/measure.xml @@ -3,8 +3,8 @@ 3.0 hpxm_lto_openstudio b1543b30-9465-45ff-ba04-1d1f85e763bc - 997dce93-f5a5-4db3-a368-dbe9249ddb8f - 20230509T195314Z + e581b98e-edcd-41c3-a6b9-a7dc603028c1 + 20230509T215629Z D8922A73 HPXMLtoOpenStudio HPXML to OpenStudio Translator @@ -565,12 +565,6 @@ resource A466A879 - - schedules.rb - rb - resource - 80726D4F - OpenStudio @@ -582,5 +576,11 @@ script 1E7FB5AF + + schedules.rb + rb + resource + 49FED427 + diff --git a/HPXMLtoOpenStudio/resources/schedules.rb b/HPXMLtoOpenStudio/resources/schedules.rb index ce7e8dca0b..ac2f6c09f8 100644 --- a/HPXMLtoOpenStudio/resources/schedules.rb +++ b/HPXMLtoOpenStudio/resources/schedules.rb @@ -1384,12 +1384,7 @@ def initialize(runner: nil, @tmp_schedules = Marshal.load(Marshal.dump(@schedules)) set_unavailable_periods(unavailable_periods) convert_setpoints - - output_path = Pathname.new output_path - cwd = Pathname.new(Dir.getwd) - output_path = output_path.relative_path_from(cwd) @output_schedules_path = output_path - export() end @@ -1511,7 +1506,10 @@ def create_schedule_file(col_name:, schedule_length = @schedules[col_name].length min_per_item = 60.0 / (schedule_length / num_hrs_in_year) - schedule_file = OpenStudio::Model::ScheduleFile.new(@model, "#{@output_schedules_path}") + # cwd = Dir.getwd + Dir.chdir(File.dirname(@output_schedules_path)) + schedule_file = OpenStudio::Model::ScheduleFile.new(@model, File.basename(@output_schedules_path)) + # Dir.chdir(cwd) # if we change it back, you get 'FT Warning: Cannot find file ""' in run.log schedule_file.setName(col_name) schedule_file.setColumnNumber(col_index + 1) schedule_file.setRowstoSkipatTop(rows_to_skip) From 355d8ed87c119d042886b9684a6d72a8ee1cdf20 Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Thu, 26 Oct 2023 13:15:38 -0700 Subject: [PATCH 4/8] Add run folder to workflow json file paths so external file can find it. --- HPXMLtoOpenStudio/measure.xml | 6 +++--- HPXMLtoOpenStudio/resources/schedules.rb | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/HPXMLtoOpenStudio/measure.xml b/HPXMLtoOpenStudio/measure.xml index c307a35ffe..11bf5952cb 100644 --- a/HPXMLtoOpenStudio/measure.xml +++ b/HPXMLtoOpenStudio/measure.xml @@ -3,8 +3,8 @@ 3.1 hpxm_lto_openstudio b1543b30-9465-45ff-ba04-1d1f85e763bc - 4396cdb6-89c7-4187-be7b-0192bbdd477c - 2023-10-26T18:29:48Z + 960d469f-95ac-4ef2-8852-907bd00d882f + 2023-10-26T20:15:01Z D8922A73 HPXMLtoOpenStudio HPXML to OpenStudio Translator @@ -436,7 +436,7 @@ schedules.rb rb resource - 028E64ED + 5B16B814 simcontrols.rb diff --git a/HPXMLtoOpenStudio/resources/schedules.rb b/HPXMLtoOpenStudio/resources/schedules.rb index 25b68d8558..648edd16cd 100644 --- a/HPXMLtoOpenStudio/resources/schedules.rb +++ b/HPXMLtoOpenStudio/resources/schedules.rb @@ -1515,10 +1515,12 @@ def create_schedule_file(col_name:, schedule_length = @schedules[col_name].length min_per_item = 60.0 / (schedule_length / num_hrs_in_year) - # cwd = Dir.getwd - Dir.chdir(File.dirname(@output_schedules_path)) + file_path = File.dirname(@output_schedules_path) + workflow_json = @model.workflowJSON + file_paths = workflow_json.filePaths.map(&:to_s) + workflow_json.addFilePath(file_path) unless file_paths.include?(file_path) + schedule_file = OpenStudio::Model::ScheduleFile.new(@model, File.basename(@output_schedules_path)) - # Dir.chdir(cwd) # if we change it back, you get 'FT Warning: Cannot find file ""' in run.log schedule_file.setName(col_name) schedule_file.setColumnNumber(col_index + 1) schedule_file.setRowstoSkipatTop(rows_to_skip) From b7c93e44f4513bee345f75b6f75102eb7f7d5389 Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Fri, 27 Oct 2023 09:11:07 -0700 Subject: [PATCH 5/8] Confirm new schedulefile setter does what we want. --- HPXMLtoOpenStudio/measure.xml | 6 +++--- HPXMLtoOpenStudio/resources/schedules.rb | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/HPXMLtoOpenStudio/measure.xml b/HPXMLtoOpenStudio/measure.xml index 11bf5952cb..363cda3299 100644 --- a/HPXMLtoOpenStudio/measure.xml +++ b/HPXMLtoOpenStudio/measure.xml @@ -3,8 +3,8 @@ 3.1 hpxm_lto_openstudio b1543b30-9465-45ff-ba04-1d1f85e763bc - 960d469f-95ac-4ef2-8852-907bd00d882f - 2023-10-26T20:15:01Z + 4f260276-3c41-48a6-a2c2-a0441c1f8a68 + 2023-10-27T16:09:45Z D8922A73 HPXMLtoOpenStudio HPXML to OpenStudio Translator @@ -436,7 +436,7 @@ schedules.rb rb resource - 5B16B814 + F5F70C88 simcontrols.rb diff --git a/HPXMLtoOpenStudio/resources/schedules.rb b/HPXMLtoOpenStudio/resources/schedules.rb index 648edd16cd..674a698c0d 100644 --- a/HPXMLtoOpenStudio/resources/schedules.rb +++ b/HPXMLtoOpenStudio/resources/schedules.rb @@ -1526,6 +1526,7 @@ def create_schedule_file(col_name:, schedule_file.setRowstoSkipatTop(rows_to_skip) schedule_file.setNumberofHoursofData(num_hrs_in_year.to_i) schedule_file.setMinutesperItem(min_per_item.to_i) + schedule_file.setTranslateFileName(true) Schedule.set_schedule_type_limits(@model, schedule_file, schedule_type_limits_name) From c861f372f9de67bcb75752f8114bfc5b135ab53c Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Thu, 2 Nov 2023 07:24:28 -0700 Subject: [PATCH 6/8] Update schedule file relative path setter name. --- HPXMLtoOpenStudio/measure.xml | 6 +++--- HPXMLtoOpenStudio/resources/schedules.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/HPXMLtoOpenStudio/measure.xml b/HPXMLtoOpenStudio/measure.xml index a2d219ba7c..27d673fd77 100644 --- a/HPXMLtoOpenStudio/measure.xml +++ b/HPXMLtoOpenStudio/measure.xml @@ -3,8 +3,8 @@ 3.1 hpxm_lto_openstudio b1543b30-9465-45ff-ba04-1d1f85e763bc - aa62fa4e-49bc-4555-8d0b-2d7007040444 - 2023-11-02T14:23:03Z + ed951b24-481d-4ea0-a38a-05aa7624024b + 2023-11-02T14:24:03Z D8922A73 HPXMLtoOpenStudio HPXML to OpenStudio Translator @@ -466,7 +466,7 @@ schedules.rb rb resource - F41A2C4E + 62152E07 simcontrols.rb diff --git a/HPXMLtoOpenStudio/resources/schedules.rb b/HPXMLtoOpenStudio/resources/schedules.rb index 85c3c73e58..6ec3bfa1de 100644 --- a/HPXMLtoOpenStudio/resources/schedules.rb +++ b/HPXMLtoOpenStudio/resources/schedules.rb @@ -1496,7 +1496,7 @@ def create_schedule_file(model, col_name:, rows_to_skip: 1, schedule_file.setRowstoSkipatTop(rows_to_skip) schedule_file.setNumberofHoursofData(num_hrs_in_year.to_i) schedule_file.setMinutesperItem(min_per_item.to_i) - schedule_file.setTranslateFileName(true) + schedule_file.setTranslateFileWithRelativePath(true) Schedule.set_schedule_type_limits(model, schedule_file, schedule_type_limits_name) From 516ab9046a826e3ccb2f64a58e1628be946b6512 Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Tue, 7 Nov 2023 19:31:06 -0700 Subject: [PATCH 7/8] Get config ready to point to develop. --- .github/workflows/config.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index 72222884ea..d4f0e77dc4 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -11,7 +11,7 @@ jobs: run-unit-tests: runs-on: ubuntu-latest container: - image: docker://nrel/openstudio:3.7.0-rc1 + image: docker://nrel/openstudio:develop steps: - uses: actions/checkout@v3 with: @@ -63,7 +63,7 @@ jobs: run-workflow1-tests: runs-on: ubuntu-latest container: - image: docker://nrel/openstudio:3.7.0-rc1 + image: docker://nrel/openstudio:develop steps: - uses: actions/checkout@v3 with: @@ -86,7 +86,7 @@ jobs: run-workflow2-tests: runs-on: ubuntu-latest container: - image: docker://nrel/openstudio:3.7.0-rc1 + image: docker://nrel/openstudio:develop steps: - uses: actions/checkout@v3 with: @@ -115,8 +115,8 @@ jobs: - name: Install software and run test shell: pwsh run: | - $env:OS_VERSION="3.7.0-rc1" - $env:OS_SHA="211bb633b0" + $env:OS_VERSION="3.7.0-rc2" + $env:OS_SHA="c0cbe73b51" Invoke-WebRequest -OutFile Windows.tar.gz -URI "https://github.com/NREL/OpenStudio/releases/download/v${env:OS_VERSION}/OpenStudio-${env:OS_VERSION}+${env:OS_SHA}-Windows.tar.gz" tar -xzf Windows.tar.gz & .\OpenStudio-${env:OS_VERSION}+${env:OS_SHA}-Windows\bin\openstudio.exe workflow\run_simulation.rb -x workflow\sample_files\base.xml --hourly ALL --add-component-loads --add-stochastic-schedules From e36131b931f9e402abb7fbef8857d43330670c67 Mon Sep 17 00:00:00 2001 From: Scott Horowitz Date: Mon, 27 Nov 2023 09:50:25 -0700 Subject: [PATCH 8/8] Update xml --- HPXMLtoOpenStudio/measure.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/HPXMLtoOpenStudio/measure.xml b/HPXMLtoOpenStudio/measure.xml index 899a56c78a..44b489b833 100644 --- a/HPXMLtoOpenStudio/measure.xml +++ b/HPXMLtoOpenStudio/measure.xml @@ -3,8 +3,8 @@ 3.1 hpxm_lto_openstudio b1543b30-9465-45ff-ba04-1d1f85e763bc - ff727cab-96e5-480f-a9a7-78c64755662f - 2023-11-15T00:52:51Z + 6d2dc12a-bac9-4979-a4db-a4172c12a591 + 2023-11-27T16:49:25Z D8922A73 HPXMLtoOpenStudio HPXML to OpenStudio Translator @@ -472,7 +472,7 @@ schedules.rb rb resource - D4095878 + 62152E07 simcontrols.rb