2

Getting model path from runner object in OpenStudio

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

runner.setLastOpenStudioModelPath(OpenStudio::Path.new(modelPath))

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.

Thanks

dani71's avatar
91
dani71
asked 2016-08-26 10:27:32 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

2 Answers

3

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;
}
pachiburke's avatar
31
pachiburke
answered 2016-08-29 04:49:39 -0500
edit flag offensive 0 remove flag delete link

Comments

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
1

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

pachiburke's avatar pachiburke (2016-08-30 02:20:59 -0500) edit
add a comment see more comments
1

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.

David Goldwasser's avatar
20.4k
David Goldwasser
answered 2016-08-26 10:54:39 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments