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

Revision history [back]

click to hide/show revision 1
initial version

Issue running OSM through Ruby

Hi all,

I'm working on a script that will grab all osm files in a directory and simulate them. I took some pointers from an example file called RunAllOSMs.rb but hit a snag. Mostly I'm finding it difficult to understand what exactly goes on throughout certain parts of that script. Below you'll find my attempt at modifying RunAllOSMs.rb to fit my needs:

Link to RunAllOSMs.rb

Relevant snippet from ruby script:

#simulate all osms
puts "\nBeginning simulations..."

#set OS paths
output_os_path = OpenStudio::Path.new(output_dir)
weather_os_path = OpenStudio::system_complete(OpenStudio::Path.new(weather_file_dir))

#Create run manager
runManagerDBPath = output_os_path / OpenStudio::Path.new("RunManager.db")
puts "Creating RunManager database at " + runManagerDBPath.to_s + "."
OpenStudio::remove(runManagerDBPath) if (OpenStudio::exists(runManagerDBPath))
runManager = OpenStudio::Runmanager::RunManager.new(runManagerDBPath,true)

# find energyplus
ep_path = OpenStudio::Path.new('C:\EnergyPlusV8-5-0')
tools = OpenStudio::Runmanager::ConfigOptions::makeTools(ep_path.parent_path(),
                                                         OpenStudio::Path.new,
                                                         OpenStudio::Path.new,
                                                         OpenStudio::Path.new,
                                                         OpenStudio::Path.new)

#Loop through each osm in output directory and simulate them
Dir[output_dir + "/*.osm"].each do |osm_file|

  #Add osm to queue
  relative_file_path = OpenStudio::relativePath(OpenStudio::Path.new(osm_file),output_os_path)
  puts "Queuing simulation job for " + osm_file.to_s + "."

  osm_path = output_os_path/relative_file_path

  #create workflow
  workflow = OpenStudio::Runmanager::Workflow.new("modeltoidf->energyplus->openstudiopostprocess")
  workflow.setInputFiles(osm_path, weather_os_path)
  workflow.add(tools)

  # create and queue job
  jobDirectory = osm_path.parent_path() / OpenStudio::Path.new(osm_path.stem()) / OpenStudio::Path.new("/")
  puts "Job directory will be '" + jobDirectory.to_s + "'."
  job = workflow.create(jobDirectory)
  runManager.enqueue(job, true)
end

Here is the error I receive when running my script:

[utilities.idf.Workspace] <1> URL Found in IDF: file:files/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw but no source could be located.

This epw file is in the directory specified under weather_file_dir, so I'm confused as to why this happens. The line that causes this print out is the following:

job = workflow.create(jobDirectory)

From what I can tell, the directories are being assigned correctly, so I'm guessing it maybe due to my understanding of what happens with my workflow object? Do I have to somehow tell it to create that files directory and populate it with the epw file beforehand? Any advice would be greatly appreciated. I haven't had much success understanding the documentation.

Thanks!

Issue running OSM through Ruby

Hi all,

I'm working on a script that will grab all osm files in a directory and simulate them. I took some pointers from an example file called RunAllOSMs.rb but hit a snag. Mostly I'm finding it difficult to understand what exactly goes on throughout certain parts of that script. Below you'll find my attempt at modifying RunAllOSMs.rb to fit my needs:

Link to RunAllOSMs.rb

Relevant snippet from ruby script:

#simulate all osms
puts "\nBeginning simulations..."

#set OS paths
output_os_path = OpenStudio::Path.new(output_dir)
weather_os_path = OpenStudio::system_complete(OpenStudio::Path.new(weather_file_dir))

#Create run manager
runManagerDBPath = output_os_path / OpenStudio::Path.new("RunManager.db")
puts "Creating RunManager database at " + runManagerDBPath.to_s + "."
OpenStudio::remove(runManagerDBPath) if (OpenStudio::exists(runManagerDBPath))
runManager = OpenStudio::Runmanager::RunManager.new(runManagerDBPath,true)

# find energyplus
ep_path = OpenStudio::Path.new('C:\EnergyPlusV8-5-0')
tools = OpenStudio::Runmanager::ConfigOptions::makeTools(ep_path.parent_path(),
                                                         OpenStudio::Path.new,
                                                         OpenStudio::Path.new,
                                                         OpenStudio::Path.new,
                                                         OpenStudio::Path.new)

#Loop through each osm in output directory and simulate them
Dir[output_dir + "/*.osm"].each do |osm_file|

  #Add osm to queue
  relative_file_path = OpenStudio::relativePath(OpenStudio::Path.new(osm_file),output_os_path)
  puts "Queuing simulation job for " + osm_file.to_s + "."

  osm_path = output_os_path/relative_file_path

  #create workflow
  workflow = OpenStudio::Runmanager::Workflow.new("modeltoidf->energyplus->openstudiopostprocess")
  workflow.setInputFiles(osm_path, weather_os_path)
  workflow.add(tools)

  # create and queue job
  jobDirectory = osm_path.parent_path() / OpenStudio::Path.new(osm_path.stem()) / OpenStudio::Path.new("/")
  puts "Job directory will be '" + jobDirectory.to_s + "'."
  job = workflow.create(jobDirectory)
  runManager.enqueue(job, true)
end

Here is the error I receive when running my script:

[utilities.idf.Workspace] <1> URL Found in IDF: file:files/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw but no source could be located.

This epw file is in the directory specified under weather_file_dir, so I'm confused as to why this happens. The line that causes this print out is the following:

job = workflow.create(jobDirectory)

From what I can tell, the directories are being assigned correctly, so I'm guessing it maybe due to my understanding of what happens with my workflow object? Do I have to somehow tell it to create that files directory and populate it with the epw file beforehand? Any advice would be greatly appreciated. I haven't had much success understanding the documentation.

Thanks!

~Update~ I noticed something in the job directory for the osms APPEARS to find the epw file. I noticed a file called "in.epw" file is placed into the EnergyPlus-0 directory that matches the epw file associated with the osm. Does this have to do with the constructor parameter I'm using for workflow? I.e. this line:

workflow = OpenStudio::Runmanager::Workflow.new("modeltoidf->energyplus->openstudiopostprocess")

Anyhow, still stumped why i'm receiving the above error.

Issue running OSM through Ruby

Hi all,

I'm working on a script that will grab all osm files in a directory and simulate them. I took some pointers from an example file called RunAllOSMs.rb but hit a snag. Mostly I'm finding it difficult to understand what exactly goes on throughout certain parts of that script. Below you'll find my attempt at modifying RunAllOSMs.rb to fit my needs:

Link to RunAllOSMs.rb

Relevant snippet from ruby script:

#simulate all osms
puts "\nBeginning simulations..."

#set OS paths
output_os_path = OpenStudio::Path.new(output_dir)
weather_os_path = OpenStudio::system_complete(OpenStudio::Path.new(weather_file_dir))

#Create run manager
runManagerDBPath = output_os_path / OpenStudio::Path.new("RunManager.db")
puts "Creating RunManager database at " + runManagerDBPath.to_s + "."
OpenStudio::remove(runManagerDBPath) if (OpenStudio::exists(runManagerDBPath))
runManager = OpenStudio::Runmanager::RunManager.new(runManagerDBPath,true)

# find energyplus
ep_path = OpenStudio::Path.new('C:\EnergyPlusV8-5-0')
tools = OpenStudio::Runmanager::ConfigOptions::makeTools(ep_path.parent_path(),
                                                         OpenStudio::Path.new,
                                                         OpenStudio::Path.new,
                                                         OpenStudio::Path.new,
                                                         OpenStudio::Path.new)

#Loop through each osm in output directory and simulate them
Dir[output_dir + "/*.osm"].each do |osm_file|

  #Add osm to queue
  relative_file_path = OpenStudio::relativePath(OpenStudio::Path.new(osm_file),output_os_path)
  puts "Queuing simulation job for " + osm_file.to_s + "."

  osm_path = output_os_path/relative_file_path

  #create workflow
  workflow = OpenStudio::Runmanager::Workflow.new("modeltoidf->energyplus->openstudiopostprocess")
  workflow.setInputFiles(osm_path, weather_os_path)
  workflow.add(tools)

  # create and queue job
  jobDirectory = osm_path.parent_path() / OpenStudio::Path.new(osm_path.stem()) / OpenStudio::Path.new("/")
  puts "Job directory will be '" + jobDirectory.to_s + "'."
  job = workflow.create(jobDirectory)
  runManager.enqueue(job, true)
end

Here is the error I receive when running my script:

[utilities.idf.Workspace] <1> URL Found in IDF: file:files/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw but no source could be located.

This epw file is in the directory specified under weather_file_dir, so I'm confused as to why this happens. The line that causes this print out is the following:

job = workflow.create(jobDirectory)

From what I can tell, the directories are being assigned correctly, so I'm guessing it maybe due to my understanding of what happens with my workflow object? Do I have to somehow tell it to create that files directory and populate it with the epw file beforehand? Any advice would be greatly appreciated. I haven't had much success understanding the documentation.

Thanks!

~Update~ I noticed something in the job directory for the simulated osms APPEARS to find the epw file. I noticed a file called "in.epw" file is placed into the EnergyPlus-0 directory that matches the epw file associated with the osm. Does this have to do with the constructor parameter I'm using for workflow? I.e. this line:

workflow = OpenStudio::Runmanager::Workflow.new("modeltoidf->energyplus->openstudiopostprocess")

Anyhow, still stumped why i'm receiving the above error.

Issue running OSM through RubyRuby - cannot find epw file

Hi all,

I'm working on a script that will grab all osm files in a directory and simulate them. I took some pointers from an example file called RunAllOSMs.rb but hit a snag. Mostly I'm finding it difficult to understand what exactly goes on throughout certain parts of that script. Below you'll find my attempt at modifying RunAllOSMs.rb to fit my needs:

Link to RunAllOSMs.rb

Relevant snippet from my ruby script:

#simulate all osms
puts "\nBeginning simulations..."

#set OS paths
output_os_path = OpenStudio::Path.new(output_dir)
weather_os_path = OpenStudio::system_complete(OpenStudio::Path.new(weather_file_dir))

#Create run manager
runManagerDBPath = output_os_path / OpenStudio::Path.new("RunManager.db")
puts "Creating RunManager database at " + runManagerDBPath.to_s + "."
OpenStudio::remove(runManagerDBPath) if (OpenStudio::exists(runManagerDBPath))
runManager = OpenStudio::Runmanager::RunManager.new(runManagerDBPath,true)

# find energyplus
ep_path = OpenStudio::Path.new('C:\EnergyPlusV8-5-0')
tools = OpenStudio::Runmanager::ConfigOptions::makeTools(ep_path.parent_path(),
                                                         OpenStudio::Path.new,
                                                         OpenStudio::Path.new,
                                                         OpenStudio::Path.new,
                                                         OpenStudio::Path.new)

#Loop through each osm in output directory and simulate them
Dir[output_dir + "/*.osm"].each do |osm_file|

  #Add osm to queue
  relative_file_path = OpenStudio::relativePath(OpenStudio::Path.new(osm_file),output_os_path)
  puts "Queuing simulation job for " + osm_file.to_s + "."

  osm_path = output_os_path/relative_file_path

  #create workflow
  workflow = OpenStudio::Runmanager::Workflow.new("modeltoidf->energyplus->openstudiopostprocess")
  workflow.setInputFiles(osm_path, weather_os_path)
  workflow.add(tools)

  # create and queue job
  jobDirectory = osm_path.parent_path() / OpenStudio::Path.new(osm_path.stem()) / OpenStudio::Path.new("/")
  puts "Job directory will be '" + jobDirectory.to_s + "'."
  job = workflow.create(jobDirectory)
  runManager.enqueue(job, true)
end

Here is the error I receive when running my script:

[utilities.idf.Workspace] <1> URL Found in IDF: file:files/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw but no source could be located.

This epw file is in the directory specified under weather_file_dir, so I'm confused as to why this happens. The line that causes this print out is the following:

job = workflow.create(jobDirectory)

From what I can tell, the directories are being assigned correctly, so I'm guessing it maybe due to my understanding of what happens with my workflow object? Do I have to somehow tell it to create that files directory and populate it with the epw file beforehand? Any advice would be greatly appreciated. I haven't had much success understanding the documentation.

Thanks!

~Update~ I noticed the job directory for the simulated osms APPEARS to find the epw file. I noticed a file called "in.epw" file is placed into the EnergyPlus-0 directory that matches the epw file associated with the osm. Does this have to do with the constructor parameter I'm using for workflow? I.e. this line:

workflow = OpenStudio::Runmanager::Workflow.new("modeltoidf->energyplus->openstudiopostprocess")

Anyhow, still stumped why i'm receiving the above error.

Issue running OSM through Ruby - cannot find epw fileRuby

Hi all,

I'm working on a script that will grab all osm files in a directory and simulate them. I took some pointers from an example file called RunAllOSMs.rb but hit a snag. Mostly I'm finding it difficult to understand what exactly goes on throughout certain parts of that script. Below you'll find my attempt at modifying RunAllOSMs.rb to fit my needs:

Link to RunAllOSMs.rb

Relevant snippet from my ruby script:

#simulate all osms
puts "\nBeginning simulations..."

#set OS paths
output_os_path = OpenStudio::Path.new(output_dir)
weather_os_path = OpenStudio::system_complete(OpenStudio::Path.new(weather_file_dir))

#Create run manager
runManagerDBPath = output_os_path / OpenStudio::Path.new("RunManager.db")
puts "Creating RunManager database at " + runManagerDBPath.to_s + "."
OpenStudio::remove(runManagerDBPath) if (OpenStudio::exists(runManagerDBPath))
runManager = OpenStudio::Runmanager::RunManager.new(runManagerDBPath,true)

# find energyplus
ep_path = OpenStudio::Path.new('C:\EnergyPlusV8-5-0')
tools = OpenStudio::Runmanager::ConfigOptions::makeTools(ep_path.parent_path(),
                                                         OpenStudio::Path.new,
                                                         OpenStudio::Path.new,
                                                         OpenStudio::Path.new,
                                                         OpenStudio::Path.new)

#Loop through each osm in output directory and simulate them
Dir[output_dir + "/*.osm"].each do |osm_file|

  #Add osm to queue
  relative_file_path = OpenStudio::relativePath(OpenStudio::Path.new(osm_file),output_os_path)
  puts "Queuing simulation job for " + osm_file.to_s + "."

  osm_path = output_os_path/relative_file_path

  #create workflow
  workflow = OpenStudio::Runmanager::Workflow.new("modeltoidf->energyplus->openstudiopostprocess")
  workflow.setInputFiles(osm_path, weather_os_path)
  workflow.add(tools)

  # create and queue job
  jobDirectory = osm_path.parent_path() / OpenStudio::Path.new(osm_path.stem()) / OpenStudio::Path.new("/")
  puts "Job directory will be '" + jobDirectory.to_s + "'."
  job = workflow.create(jobDirectory)
  runManager.enqueue(job, true)
end

Here is the error I receive when running my script:

[utilities.idf.Workspace] <1> URL Found in IDF: file:files/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw but no source could be located.

This epw file is in the directory specified under weather_file_dir, so I'm confused as to why this happens. The line that causes this print out is the following:

job = workflow.create(jobDirectory)

From what I can tell, the directories are being assigned correctly, so I'm guessing it maybe due to my understanding of what happens with my workflow object? Do I have to somehow tell it to create that files directory and populate it with the epw file beforehand? Any advice would be greatly appreciated. I haven't had much success understanding the documentation.

Thanks!

~Update~ I noticed the job directory for the simulated osms APPEARS to find the epw file. I noticed a file called "in.epw" file is placed into the EnergyPlus-0 directory that matches the epw file associated with the osm. Does this have to do with the constructor parameter I'm using for workflow? I.e. this line:

workflow = OpenStudio::Runmanager::Workflow.new("modeltoidf->energyplus->openstudiopostprocess")

The job types used in the parameter passed to the constructor I copied from the RunAllOSMs.rb file and they seem to match what I'm looking for. Anyhow, still stumped why i'm receiving the above error.

Issue running OSM through RubyRuby - cannot find epw file

Hi all,

I'm working on a script that will grab all osm files in a directory and simulate them. I took some pointers from an example file called RunAllOSMs.rb but hit a snag. Mostly I'm finding it difficult to understand what exactly goes on throughout certain parts of that script. Below you'll find my attempt at modifying RunAllOSMs.rb to fit my needs:

Link to RunAllOSMs.rb

Relevant snippet from my ruby script:

#simulate all osms
puts "\nBeginning simulations..."

#set OS paths
output_os_path = OpenStudio::Path.new(output_dir)
weather_os_path = OpenStudio::system_complete(OpenStudio::Path.new(weather_file_dir))

#Create run manager
runManagerDBPath = output_os_path / OpenStudio::Path.new("RunManager.db")
puts "Creating RunManager database at " + runManagerDBPath.to_s + "."
OpenStudio::remove(runManagerDBPath) if (OpenStudio::exists(runManagerDBPath))
runManager = OpenStudio::Runmanager::RunManager.new(runManagerDBPath,true)

# find energyplus
ep_path = OpenStudio::Path.new('C:\EnergyPlusV8-5-0')
tools = OpenStudio::Runmanager::ConfigOptions::makeTools(ep_path.parent_path(),
                                                         OpenStudio::Path.new,
                                                         OpenStudio::Path.new,
                                                         OpenStudio::Path.new,
                                                         OpenStudio::Path.new)

#Loop through each osm in output directory and simulate them
Dir[output_dir + "/*.osm"].each do |osm_file|

  #Add osm to queue
  relative_file_path = OpenStudio::relativePath(OpenStudio::Path.new(osm_file),output_os_path)
  puts "Queuing simulation job for " + osm_file.to_s + "."

  osm_path = output_os_path/relative_file_path

  #create workflow
  workflow = OpenStudio::Runmanager::Workflow.new("modeltoidf->energyplus->openstudiopostprocess")
  workflow.setInputFiles(osm_path, weather_os_path)
  workflow.add(tools)

  # create and queue job
  jobDirectory = osm_path.parent_path() / OpenStudio::Path.new(osm_path.stem()) / OpenStudio::Path.new("/")
  puts "Job directory will be '" + jobDirectory.to_s + "'."
  job = workflow.create(jobDirectory)
  runManager.enqueue(job, true)
end

Here is the error I receive when running my script:

[utilities.idf.Workspace] <1> URL Found in IDF: file:files/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw but no source could be located.

This epw file is in the directory specified under weather_file_dir, so I'm confused as to why this happens. The line that causes this print out is the following:

job = workflow.create(jobDirectory)

From what I can tell, the directories are being assigned correctly, so I'm guessing it maybe due to my understanding of what happens with my workflow object? Do I have to somehow tell it to create that files directory and populate it with the epw file beforehand? Any advice would be greatly appreciated. I haven't had much success understanding the documentation.

Thanks!

~Update~ I noticed the job directory for the simulated osms APPEARS to find the epw file. I noticed a file called "in.epw" file is placed into the EnergyPlus-0 ModelToIdf/EnergyPlus-0 directory that matches the epw file associated with the osm. Does this have to do with the constructor parameter I'm using for workflow? I.e. this line:

workflow = OpenStudio::Runmanager::Workflow.new("modeltoidf->energyplus->openstudiopostprocess")

The job types used in the parameter passed to the constructor I copied from the RunAllOSMs.rb file and they seem to match what I'm looking for. Anyhow, still stumped why i'm receiving the above error.

Issue running OSM through Ruby - cannot find epw fileRuby

Hi all,

I'm working on a script that will grab all osm files in a directory and simulate them. I took some pointers from an example file called RunAllOSMs.rb but hit a snag. Mostly I'm finding it difficult to understand what exactly goes on throughout certain parts of that script. Below you'll find my attempt at modifying RunAllOSMs.rb to fit my needs:

Link to RunAllOSMs.rb

Relevant snippet from my ruby script:

#simulate all osms
puts "\nBeginning simulations..."

#set OS paths
output_os_path = OpenStudio::Path.new(output_dir)
weather_os_path = OpenStudio::system_complete(OpenStudio::Path.new(weather_file_dir))

#Create run manager
runManagerDBPath = output_os_path / OpenStudio::Path.new("RunManager.db")
puts "Creating RunManager database at " + runManagerDBPath.to_s + "."
OpenStudio::remove(runManagerDBPath) if (OpenStudio::exists(runManagerDBPath))
runManager = OpenStudio::Runmanager::RunManager.new(runManagerDBPath,true)

# find energyplus
ep_path = OpenStudio::Path.new('C:\EnergyPlusV8-5-0')
tools = OpenStudio::Runmanager::ConfigOptions::makeTools(ep_path.parent_path(),
                                                         OpenStudio::Path.new,
                                                         OpenStudio::Path.new,
                                                         OpenStudio::Path.new,
                                                         OpenStudio::Path.new)

#Loop through each osm in output directory and simulate them
Dir[output_dir + "/*.osm"].each do |osm_file|

  #Add osm to queue
  relative_file_path = OpenStudio::relativePath(OpenStudio::Path.new(osm_file),output_os_path)
  puts "Queuing simulation job for " + osm_file.to_s + "."

  osm_path = output_os_path/relative_file_path

  #create workflow
  workflow = OpenStudio::Runmanager::Workflow.new("modeltoidf->energyplus->openstudiopostprocess")
  workflow.setInputFiles(osm_path, weather_os_path)
  workflow.add(tools)

  # create and queue job
  jobDirectory = osm_path.parent_path() / OpenStudio::Path.new(osm_path.stem()) / OpenStudio::Path.new("/")
  puts "Job directory will be '" + jobDirectory.to_s + "'."
  job = workflow.create(jobDirectory)
  runManager.enqueue(job, true)
end

Here is the error I receive when running my script:

[utilities.idf.Workspace] <1> URL Found in IDF: file:files/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw but no source could be located.

This epw file is in the directory specified under weather_file_dir, so I'm confused as to why this happens. The line that causes this print out is the following:

job = workflow.create(jobDirectory)

From what I can tell, the directories are being assigned correctly, so I'm guessing it maybe due to my understanding of what happens with my workflow object? Do I have to somehow tell it to create that files directory and populate it with the epw file beforehand? Any advice would be greatly appreciated. I haven't had much success understanding the documentation.

Thanks!

~Update~ I noticed the job directory for the simulated osms APPEARS to find the epw file. I noticed a file called "in.epw" file is placed into the ModelToIdf/EnergyPlus-0 directory that matches the epw file associated with the osm. Does this have to do with the constructor parameter I'm using for workflow? I.e. this line:

workflow = OpenStudio::Runmanager::Workflow.new("modeltoidf->energyplus->openstudiopostprocess")

The job types used in the parameter passed to the constructor I copied from the RunAllOSMs.rb file and they seem to match what I'm looking for. Anyhow, still stumped why i'm receiving the above error.

Issue running OSM through RubyRuby - cannot find epw file

Hi all,

I'm working on a script that will grab all osm files in a directory and simulate them. I took some pointers from an example file called RunAllOSMs.rb but hit a snag. Mostly I'm finding it difficult to understand what exactly goes on throughout certain parts of that script. Below you'll find my attempt at modifying RunAllOSMs.rb to fit my needs:

Link to RunAllOSMs.rb

Relevant snippet from my ruby script:

#simulate all osms
puts "\nBeginning simulations..."

#set OS paths
output_os_path = OpenStudio::Path.new(output_dir)
weather_os_path = OpenStudio::system_complete(OpenStudio::Path.new(weather_file_dir))

#Create run manager
runManagerDBPath = output_os_path / OpenStudio::Path.new("RunManager.db")
puts "Creating RunManager database at " + runManagerDBPath.to_s + "."
OpenStudio::remove(runManagerDBPath) if (OpenStudio::exists(runManagerDBPath))
runManager = OpenStudio::Runmanager::RunManager.new(runManagerDBPath,true)

# find energyplus
ep_path = OpenStudio::Path.new('C:\EnergyPlusV8-5-0')
tools = OpenStudio::Runmanager::ConfigOptions::makeTools(ep_path.parent_path(),
                                                         OpenStudio::Path.new,
                                                         OpenStudio::Path.new,
                                                         OpenStudio::Path.new,
                                                         OpenStudio::Path.new)

#Loop through each osm in output directory and simulate them
Dir[output_dir + "/*.osm"].each do |osm_file|

  #Add osm to queue
  relative_file_path = OpenStudio::relativePath(OpenStudio::Path.new(osm_file),output_os_path)
  puts "Queuing simulation job for " + osm_file.to_s + "."

  osm_path = output_os_path/relative_file_path

  #create workflow
  workflow = OpenStudio::Runmanager::Workflow.new("modeltoidf->energyplus->openstudiopostprocess")
  workflow.setInputFiles(osm_path, weather_os_path)
  workflow.add(tools)

  # create and queue job
  jobDirectory = osm_path.parent_path() / OpenStudio::Path.new(osm_path.stem()) / OpenStudio::Path.new("/")
  puts "Job directory will be '" + jobDirectory.to_s + "'."
  job = workflow.create(jobDirectory)
  runManager.enqueue(job, true)
end

Here is the error I receive when running my script:

[utilities.idf.Workspace] <1> URL Found in IDF: file:files/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw but no source could be located.

This epw file is in the directory specified under weather_file_dir, so I'm confused as to why this happens. The line that causes this print out is the following:

job = workflow.create(jobDirectory)

From what I can tell, the directories are being assigned correctly, so I'm guessing it maybe due to my understanding of what happens with my workflow object? Do I have to somehow tell it to create that files directory and populate it with the epw file beforehand? Any advice would be greatly appreciated. I haven't had much success understanding the documentation.

Thanks!

~Update~ I noticed the job directory for the simulated osms APPEARS to find the epw file. I noticed a file called "in.epw" is placed into the ModelToIdf/EnergyPlus-0 directory that matches the epw file associated with the osm. Does this have to do with the constructor parameter I'm using for workflow? I.e. this line:

workflow = OpenStudio::Runmanager::Workflow.new("modeltoidf->energyplus->openstudiopostprocess")

The job types used in the parameter passed to the constructor I copied from the RunAllOSMs.rb file and they seem to match what I'm looking for. Anyhow, still stumped why i'm receiving the above error.

RESOLUTION: ep_path needs to be set directly to the Energy+.idd file, not just the E+ directory:

ep_path = OpenStudio::Path.new('C:/EnergyPlusV8-5-0/#Energy+.idd')

Though not shown in the above code, weather_dir was pointed to the directory, not the epw file:

weather_file_dir = 'C:/EnergyPlusV8-5-0/WeatherData/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw'

Issue running OSM through Ruby - cannot find epw file

Hi all,

I'm working on a script that will grab all osm files in a directory and simulate them. I took some pointers from an example file called RunAllOSMs.rb but hit a snag. Mostly I'm finding it difficult to understand what exactly goes on throughout certain parts of that script. Below you'll find my attempt at modifying RunAllOSMs.rb to fit my needs:

Link to RunAllOSMs.rb

Relevant snippet from my ruby script:

#simulate all osms
puts "\nBeginning simulations..."

#set OS paths
output_os_path = OpenStudio::Path.new(output_dir)
weather_os_path = OpenStudio::system_complete(OpenStudio::Path.new(weather_file_dir))

#Create run manager
runManagerDBPath = output_os_path / OpenStudio::Path.new("RunManager.db")
puts "Creating RunManager database at " + runManagerDBPath.to_s + "."
OpenStudio::remove(runManagerDBPath) if (OpenStudio::exists(runManagerDBPath))
runManager = OpenStudio::Runmanager::RunManager.new(runManagerDBPath,true)

# find energyplus
ep_path = OpenStudio::Path.new('C:\EnergyPlusV8-5-0')
tools = OpenStudio::Runmanager::ConfigOptions::makeTools(ep_path.parent_path(),
                                                         OpenStudio::Path.new,
                                                         OpenStudio::Path.new,
                                                         OpenStudio::Path.new,
                                                         OpenStudio::Path.new)

#Loop through each osm in output directory and simulate them
Dir[output_dir + "/*.osm"].each do |osm_file|

  #Add osm to queue
  relative_file_path = OpenStudio::relativePath(OpenStudio::Path.new(osm_file),output_os_path)
  puts "Queuing simulation job for " + osm_file.to_s + "."

  osm_path = output_os_path/relative_file_path

  #create workflow
  workflow = OpenStudio::Runmanager::Workflow.new("modeltoidf->energyplus->openstudiopostprocess")
  workflow.setInputFiles(osm_path, weather_os_path)
  workflow.add(tools)

  # create and queue job
  jobDirectory = osm_path.parent_path() / OpenStudio::Path.new(osm_path.stem()) / OpenStudio::Path.new("/")
  puts "Job directory will be '" + jobDirectory.to_s + "'."
  job = workflow.create(jobDirectory)
  runManager.enqueue(job, true)
end

Here is the error I receive when running my script:

[utilities.idf.Workspace] <1> URL Found in IDF: file:files/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw but no source could be located.

This epw file is in the directory specified under weather_file_dir, so I'm confused as to why this happens. The line that causes this print out is the following:

job = workflow.create(jobDirectory)

From what I can tell, the directories are being assigned correctly, so I'm guessing it maybe due to my understanding of what happens with my workflow object? Do I have to somehow tell it to create that files directory and populate it with the epw file beforehand? Any advice would be greatly appreciated. I haven't had much success understanding the documentation.

Thanks!

~Update~ I noticed the job directory for the simulated osms APPEARS to find the epw file. I noticed a file called "in.epw" is placed into the ModelToIdf/EnergyPlus-0 directory that matches the epw file associated with the osm. Does this have to do with the constructor parameter I'm using for workflow? I.e. this line:

workflow = OpenStudio::Runmanager::Workflow.new("modeltoidf->energyplus->openstudiopostprocess")

The job types used in the parameter passed to the constructor I copied from the RunAllOSMs.rb file and they seem to match what I'm looking for. Anyhow, still stumped why i'm receiving the above error.

RESOLUTION: ep_path needs to be set directly to the Energy+.idd file, not just the E+ directory:

ep_path = OpenStudio::Path.new('C:/EnergyPlusV8-5-0/#Energy+.idd')

Though not shown in the above code, weather_dir was pointed to the directory, not the epw file:

weather_file_dir = 'C:/EnergyPlusV8-5-0/WeatherData/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw'