Skip to content

Commit

Permalink
Merge pull request #1380 from NREL/schedule-file-rel-path
Browse files Browse the repository at this point in the history
Schedule:File relative paths
  • Loading branch information
shorowit committed Nov 27, 2023
2 parents 1478dc4 + e36131b commit 5b26ce2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 3 additions & 3 deletions HPXMLtoOpenStudio/measure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<schema_version>3.1</schema_version>
<name>hpxm_lto_openstudio</name>
<uid>b1543b30-9465-45ff-ba04-1d1f85e763bc</uid>
<version_id>ff727cab-96e5-480f-a9a7-78c64755662f</version_id>
<version_modified>2023-11-15T00:52:51Z</version_modified>
<version_id>6d2dc12a-bac9-4979-a4db-a4172c12a591</version_id>
<version_modified>2023-11-27T16:49:25Z</version_modified>
<xml_checksum>D8922A73</xml_checksum>
<class_name>HPXMLtoOpenStudio</class_name>
<display_name>HPXML to OpenStudio Translator</display_name>
Expand Down Expand Up @@ -472,7 +472,7 @@
<filename>schedules.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>D4095878</checksum>
<checksum>62152E07</checksum>
</file>
<file>
<filename>simcontrols.rb</filename>
Expand Down
8 changes: 7 additions & 1 deletion HPXMLtoOpenStudio/resources/schedules.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1485,12 +1485,18 @@ def create_schedule_file(model, col_name:, rows_to_skip: 1,
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)
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))
schedule_file.setName(col_name)
schedule_file.setColumnNumber(col_index + 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.setTranslateFileWithRelativePath(true)

Schedule.set_schedule_type_limits(model, schedule_file, schedule_type_limits_name)

Expand Down

0 comments on commit 5b26ce2

Please sign in to comment.