Sorry, this content is no longer available

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

Problem using runmanager via SDK in openstudio 1.8.0

asked 9 years ago

I'm using the runmanager via the Python bindings to run OSM models. My code from OpenStudio 1.6.0 isn't working with the latest 1.8.0 bindings. When calling:

j = openstudio.runmanager.Job(
    openstudio.runmanager.JobFactory.createModelToIdfJob(
    os.path.join(osm_path, osm_name),
    output_path
    )
)

rm = openstudio.runmanager.RunManager(rm_path, True, True, False, False)
rm.enqueue(j, True)

I get the following error:

 Traceback (most recent call last):
  File "run_openstudio_models.py", line 45, in <module>
    rm.enqueue(j, True)
  File "/home/crafter/scripts/openstudio/openstudiorunmanager.py", line 3415, in enqueue
    return _openstudiorunmanager.RunManager_enqueue(self, *args)
NotImplementedError: Wrong number or type of arguments for overloaded function 'RunManager_enqueue'.
  Possible C/C++ prototypes are:
    openstudio::runmanager::RunManager::enqueue(openstudio::runmanager::Job const &,bool,openstudio::path const &)
    openstudio::runmanager::RunManager::enqueue(openstudio::runmanager::Job const &,bool)
    openstudio::runmanager::RunManager::enqueue(std::vector< openstudio::runmanager::Job,std::allocator< openstudio::runmanager::Job > > const &,bool,openstudio::path const &)
    openstudio::runmanager::RunManager::enqueue(std::vector< openstudio::runmanager::Job,std::allocator< openstudio::runmanager::Job > > const &,bool)

I appear to have the correct number of arguments, so am at a loss for what is causing the problem.

Preview: (hide)

Comments

Seems like the signature:

openstudio::runmanager::RunManager::enqueue(openstudio::runmanager::Job const &,bool)

should match what you are trying to do, @MarkAdams have you seen anything like this?

macumber's avatar macumber  ( 9 years ago )

1 Answer

Sort by » oldest newest most voted
5

answered 9 years ago

updated 9 years ago

I bet your Job object is not actually being created properly, resulting in it being None or an Optional. This would then cause the error when you go to enqueue that Job.

Looking at the header file for createModelToIdfJob(), it wants an openstudio::path as an input. I bet if you wrapped your paths in openstudio.path() then it should work as you expect.

j = openstudio.runmanager.Job(
    openstudio.runmanager.JobFactory.createModelToIdfJob(
    openstudio.path(os.path.join(osm_path, osm_name)),
    openstudio.path(output_path)
    )
)

UPDATE:

Make sure that rm_path is a path to a database file.

rm = openstudio.runmanager.RunManager('/Users/local_user/Desktop/test_run.db', True, True, False, False)

If the database file does not exist, RunManager will create one for you. I was able to reproduce your error locally on my Mac when I just used...

rm = openstudio.runmanager.RunManager('/Users/local_user/Desktop/', True, True, False, False)

When the path points to a database file, it works.

I will say that using RunManager to translate from Model to IDF is kind of overkill. You can do the same, better and faster, just using ForwardTranslator.

# Forward Translate from OSM to IDF and save()
translator = openstudio.energyplus.ForwardTranslator()
idf_string = translator.translateModel(test_model)
with open('/Users/local_user/Desktop/test_idf.idf', 'w') as idf_file:
    idf_file.write(idf_string)

Then you can run that IDF file using RunManager to createEnergyPlusJob...

rm = openstudio.runmanager.RunManager('/Users/local_user/Desktop/test_run.db', True, True, False, False)
ep_tool = openstudio.runmanager.ToolInfo('/Applications/EnergyPlus-8-3-0/energyplus') # ep path
job = openstudio.runmanager.JobFactory.createEnergyPlusJob(
  ep_tool,
  '/Applications/EnergyPlus-8-3-0/Energy+.idd', # idd path
  '/Users/local_user/Desktop/test_idf.idf', # idf path
  '/Applications/EnergyPlus-8-3-0/WeatherFiles/Chicago.epw', # epw path
  '/Users/local_user/Desktop' # output path
)
rm.enqueue(job, True)
Preview: (hide)
link

Comments

@MarkAdams interesting thought but it didn't work. I still get the same error. I'll look into the paths to make sure there isn't an error due to an incorrect or missing path.

jmcneill's avatar jmcneill  ( 9 years ago )

@jmcneill See my new update and hopefully it solves your error now.

MarkAdams's avatar MarkAdams  ( 9 years ago )

@MarkAdams I was trying to follow the Ruby examples that used the JobFactory, but had been using the ForwardTranslator in most of my work. Good to know that it's more efficient.

It was a path issue, but the path problem was to the EnergyPlus tools. I fixed that and everything is working.

jmcneill's avatar jmcneill  ( 9 years ago )

Your Answer

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

Add Answer

Training Workshops

Careers

Question Tools

2 followers

Stats

Asked: 9 years ago

Seen: 247 times

Last updated: Aug 12 '15