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

Getting model path from runner object in OpenStudio

asked 2016-08-26 10:27:32 -0500

dani71's avatar

The runner object (openstudio::ruleset::OSRunner) has the lastOpenStudioPath attribute that can be set by:


It is posible read the last OpenStudio model from the runner as:

model = runner.lastOpenStudioModel

You can also read the path of the weather file used:

weatherPath = runner.lastEpwFilePath

Then ¿is it posible to get the the last OpenStudio model path?

I've tried with:modelPath = runner.lastOpenStudioModelPath but is not working.


edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2016-08-29 04:49:39 -0500

pachiburke's avatar

The openstudio::model::ruleset::OSRunner class has a private m_lastOpenStudioModelPath member, but it is not exposed in the public API as are the other relevant paths.

The model path can be useful to keep track from where the models originate so it can be displayed in reports and any other user script artifacts.

A new API addition would have a signature like this in OSRunner.hpp:

  /** Returns a path to the last OpenStudioModel if available. */
boost::optional<openstudio::path> lastOpenStudioModelPath() const;

and an implementation like this (in OSRunner.cpp):

boost::optional<openstudio::path> OSRunner::lastOpenStudioModelPath() const
  return m_lastOpenStudioModelPath;
edit flag offensive delete link more


You could suggest this as a new feature on the OpenStudio uservoice site. Or file it as an issue.

__AmirRoth__'s avatar __AmirRoth__  ( 2016-08-29 11:43:32 -0500 )edit

I've added issue #2346 to keep track of this feature request.

pachiburke's avatar pachiburke  ( 2016-08-30 02:20:59 -0500 )edit

answered 2016-08-26 10:54:39 -0500

I'm not sure of an easy way to get the path, but once you get the model you could save a copy of it to anywhere you want. In many instances, the intermediate models between measures may be in memory, or written to a temporary location.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Training Workshops


Question Tools

1 follower


Asked: 2016-08-26 10:27:32 -0500

Seen: 219 times

Last updated: Aug 26 '16