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

How to use the OpenStudio API? [closed]

asked 2015-09-23 06:35:56 -0500

gg_student's avatar

updated 2015-09-23 09:07:31 -0500

I tried to use OpenStudio by the OpenStudio.dll in VisualStudio 2013. Therefore I install Openstudio 1.8.0 with success and open Alpha1 Example in VisualStudio. Then I copy all .dlls from the OpenStudio Directory to the /bin/debug/x86 Folder and renew the OpenStudio.dll in the Project. Now, I try to start the Example and get an error: It appears that there was an error accessing the C# SWIG Bindings for OpenStudio. Error Text: HRESULT 0x8007000B

I installed SWIG already, but I don´t know, if it´s okay, because I have a 64 Win and it exist only SWIG for 32 Win. But I execute the swig.exe. What can I do to start the Programm and to use the OpenStudio API?

Thanks a lot!!!

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by gg_student
close date 2015-11-25 01:39:07.648731


It sounds like you are trying to create a C# project that uses the OpenStudio C# bindings, is that correct? As Larry mentions below, the easiest way to get started using the OpenStudio API is by writing measures in Ruby. Would that meet your needs? If you really are set on writing a C# application, you will not need to have SWIG to use the bindings (SWIG is only used when generating the bindings). My best guess is that you are missing some dlls, you need all the dlls in 'C:\Program Files\OpenStudio 1.9.0\CSharp\openstudio' and 'C:\Program Files\OpenStudio 1.9.0\bin'.

macumber's avatar macumber  ( 2015-09-23 11:44:28 -0500 )edit

Also, your build directory is '/bin/debug/x86' which indicates you are building your C# project in 32 bit mode. Try changing the project to build in 64 bit mode.

macumber's avatar macumber  ( 2015-09-23 11:45:04 -0500 )edit

Thanks for the answer. Now I copied all he dl form the both files to the /bin/x86/debug Folder. There were only four new ones. But the Error Message still exist.

Next I tried to change to 64 bit mode and copied all the dll in the debug folder and the same error occured.

I really want to use c# because i don´t know ruby and c++. Is there another way to solve this problem?

gg_student's avatar gg_student  ( 2015-09-24 05:50:19 -0500 )edit

/bin/x86/debug is where 32 bit products go, /bin/x64/debug is where 64 bit products would be. You need to copy your 64 bit dlls to that directory and run the products in there. Here are the instructions for changing your build to 64 bits.

Also, make sure to copy the project out of Program Files before building to avoid issues with file permissions.

Finally, Ruby is really not that hard to learn, especially if you already know another language like C# :-)

macumber's avatar macumber  ( 2015-09-24 09:18:28 -0500 )edit

Thanks I know the Folders and their Meaning. I changed the Project and it still doesn´t work. I tried to work with an old OpenStudio Version. In my example I choose v.1.3.5 and this one work very well. But this is already not actaully. What could be the reason?

gg_student's avatar gg_student  ( 2015-09-30 05:41:45 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2015-09-23 09:59:13 -0500

The easiest way to start using the API is via OpenStudio measures. Take a look at the guide here.

edit flag offensive delete link more


Thanks I will look at this. But I want to write an small Application and my favourite language is c#. Is there no opportunity to use ist. I thought it would be considered by OpenStudio?

gg_student's avatar gg_student  ( 2015-09-24 05:51:49 -0500 )edit

Question Tools


Asked: 2015-09-23 06:35:56 -0500

Seen: 799 times

Last updated: Sep 23 '15