Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question

Revision history [back]

How to find OSM file location from a measure?

I'm writing a measure to write CSV files to the OSM file folder and wondering if there's a way to find the location of the OSM file? Since OS uses the C:\Users\<UserName>\AppData\Local\Temp folder during a sim, using the location of the measure.rb file returns the Temp folder instead of the location of the actual OSM file. For example, a new reporting measure uses the code below to read/write to the measure folder.

html_in_path = "#{File.dirname(__FILE__)}/resources/report.html.in"

How to find OSM file location from a measure?

I'm writing a measure to write CSV files to the OSM file folder and wondering if there's a way to find the location of the OSM file? Since OS uses the C:\Users\<UserName>\AppData\Local\Temp folder during a sim, using the location of the measure.rb file returns the Temp folder instead of the location of the actual OSM file. For example, a new reporting measure uses the code below to read/write to the measure folder.

html_in_path = "#{File.dirname(__FILE__)}/resources/report.html.in"

I'm using the following syntax to move up folders where __FILE__ is the measure.rb file. However, when I use puts to write the path it shows the Temp folder path.

html_root_dir = "#{File.expand_path("../../../", __FILE__)}"

How to find OSM file location from a measure?

I'm writing a measure to write CSV files to the OSM file folder and wondering if there's a way to find the location of the OSM file? Since OS uses the C:\Users\<UserName>\AppData\Local\Temp folder during a sim, using the location of the measure.rb file returns the Temp folder instead of the location of the actual OSM file. For example, a new reporting measure uses the code below to read/write to the measure folder.

html_in_path = "#{File.dirname(__FILE__)}/resources/report.html.in"

I'm using the following syntax to move up folders where __FILE__ FILE is the measure.rb file. However, when I use puts to write the path it shows the Temp folder path.

html_root_dir = "#{File.expand_path("../../../", __FILE__)}"

How to find OSM file location from a measure?

I'm writing a measure to write CSV files to the OSM file folder and wondering if there's a way to find the location of the OSM file? Since OS uses the C:\Users\<UserName>\AppData\Local\Temp folder during a sim, using the location of the measure.rb file returns the Temp folder instead of the location of the actual OSM file. For example, a new reporting measure uses the code below to read/write to the measure folder.

html_in_path = "#{File.dirname(__FILE__)}/resources/report.html.in"

I'm using the following syntax to move up folders where FILE is the measure.rb file. However, when I use puts to write the path is written out it shows the Temp folder path.

html_root_dir = "#{File.expand_path("../../../", __FILE__)}"
puts html_root_dir

How to find OSM file location from a measure?

I'm writing a measure to write CSV files to the OSM file folder and wondering if there's a way to find the location of the OSM file? Since OS uses the C:\Users\<UserName>\AppData\Local\Temp folder during a sim, using the location of the measure.rb file returns the Temp folder instead of the location of the actual OSM file. For example, a new reporting measure uses the code below to read/write to the measure folder.

html_in_path = "#{File.dirname(__FILE__)}/resources/report.html.in"

I'm using the following syntax to move up folders where FILE is the measure.rb file. However, when the path is written out it shows the Temp folder path.

html_root_dir = "#{File.expand_path("../../../", __FILE__)}"
puts html_root_dir

HTML ROOT DIR = C:/USERS/MATT/APPDATA/LOCAL/TEMP/OPENSTUDIO.A17988/RESOURCES/RUN

How to find OSM file location from a measure?

I'm writing a measure to write CSV files to the OSM file folder and wondering if there's a way to find the location of the OSM file? Since OS uses the C:\Users\<UserName>\AppData\Local\Temp folder during a sim, using the location of the measure.rb file returns the Temp folder instead of the location of the actual OSM file. For example, a new reporting measure uses the code below to read/write to the measure folder.

html_in_path = "#{File.dirname(__FILE__)}/resources/report.html.in"

I'm using the following syntax to move up folders where FILE is to write to a higher level of the measure.rb file. directory. However, when the path is written out it shows the Temp folder path.

html_root_dir = "#{File.expand_path("../../../", __FILE__)}"
puts html_root_dir

HTML ROOT DIR = C:/USERS/MATT/APPDATA/LOCAL/TEMP/OPENSTUDIO.A17988/RESOURCES/RUN

The main block of Ruby code from the measure will function as intended if executed from a terminal outside of a simulation.

How to find OSM file location from a measure?

I'm writing a measure to write CSV files to the OSM file folder and wondering if there's a way to find the location of the OSM file? Since OS uses the C:\Users\<UserName>\AppData\Local\Temp folder during a sim, using the location of the measure.rb file returns the Temp folder instead of the location of the actual OSM file. For example, a new reporting measure uses the code below to read/write to the measure folder.

html_in_path = "#{File.dirname(__FILE__)}/resources/report.html.in"

I'm using the following syntax to move up folders to write to a higher level of the directory. However, when the path is written out it shows the Temp folder path.

html_root_dir = "#{File.expand_path("../../../", __FILE__)}"
puts html_root_dir

HTML ROOT DIR = C:/USERS/MATT/APPDATA/LOCAL/TEMP/OPENSTUDIO.A17988/RESOURCES/RUN

The main block of Ruby code from the measure will function as intended if executed from a terminal outside of a simulation.

How to find OSM file location from a measure?

I'm writing a measure to write CSV files to the OSM file folder and wondering if there's a way to find the location of the OSM file? Since OS uses the C:\Users\<UserName>\AppData\Local\Temp folder during a sim, using the location of the measure.rb file returns the Temp folder instead of the location of the actual OSM file. For example, a new reporting measure uses the code below to read/write to the measure folder.

html_in_path = "#{File.dirname(__FILE__)}/resources/report.html.in"

I'm using the following syntax to move up folders to write to a higher level of the directory. However, when the path is written out it shows the Temp folder path.

html_root_dir = "#{File.expand_path("../../../", __FILE__)}"
puts html_root_dir

HTML ROOT DIR = C:/USERS/MATT/APPDATA/LOCAL/TEMP/OPENSTUDIO.A17988/RESOURCES/RUN

The main block of Ruby code from the measure will function as intended if executed from a terminal outside of a simulation.