Skip to content

Commit

Permalink
Be helpful and search additional locations (and be backwards compatible)
Browse files Browse the repository at this point in the history
  • Loading branch information
shorowit committed Oct 4, 2023
1 parent 055b52a commit 5acc163
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
12 changes: 9 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>81513a63-699a-474a-bbe3-1ecc64e6577d</version_id>
<version_modified>2023-10-03T19:37:23Z</version_modified>
<version_id>eadc1a1d-2fe5-4a63-82ef-e6b3b5365c8b</version_id>
<version_modified>2023-10-04T22:06:18Z</version_modified>
<xml_checksum>D8922A73</xml_checksum>
<class_name>HPXMLtoOpenStudio</class_name>
<display_name>HPXML to OpenStudio Translator</display_name>
Expand Down Expand Up @@ -292,7 +292,7 @@
<filename>location.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>BF564292</checksum>
<checksum>84B055B2</checksum>
</file>
<file>
<filename>materials.rb</filename>
Expand Down Expand Up @@ -480,6 +480,12 @@
<usage_type>resource</usage_type>
<checksum>CFCD83CD</checksum>
</file>
<file>
<filename>in.schedules.csv</filename>
<filetype>csv</filetype>
<usage_type>test</usage_type>
<checksum>6244F711</checksum>
</file>
<file>
<filename>test_airflow.rb</filename>
<filetype>rb</filetype>
Expand Down
10 changes: 9 additions & 1 deletion HPXMLtoOpenStudio/resources/location.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,21 @@ def self.get_epw_path(hpxml, hpxml_path)
abs_epw_path = File.absolute_path(File.join(File.dirname(hpxml_path), epw_filepath))
end
if not File.exist? abs_epw_path
# Check for weather path relative to this file
# Check for weather path relative to the HPXML file
for level_deep in 1..3
level = (['..'] * level_deep).join('/')
abs_epw_path = File.absolute_path(File.join(File.dirname(hpxml_path), level, 'weather', epw_filepath))
break if File.exist? abs_epw_path
end
end
if not File.exist? abs_epw_path
# Check for weather path relative to this file
for level_deep in 1..3
level = (['..'] * level_deep).join('/')
abs_epw_path = File.absolute_path(File.join(File.dirname(__FILE__), level, 'weather', epw_filepath))
break if File.exist? abs_epw_path
end
end
if not File.exist? abs_epw_path
fail "'#{epw_filepath}' could not be found."
end
Expand Down

0 comments on commit 5acc163

Please sign in to comment.