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

Running Openstudio measure tests in the command line with Ruby

asked 2015-02-23 08:17:09 -0500

dpud12's avatar

updated 2015-02-23 08:24:32 -0500

I am attempting to run the test file AssignSpaceTypeToBuilding_Test from the command line to make sure that Ruby and Openstudio are working properly on my machine. My end goal is to automate running several measures from the command line. However, whenever I run even the first line of test file code:

require 'openstudio'

The following cryptic error appears in the the command window:

DL is deprecated, please use Fiddle C:/Ruby200/lib/ruby/2.0.0/rubygems/coreext/kernelrequire.rb:44:in 'require': 1 93: %1 is not a valid Win32 application - C:/Program Files/OpenStudio 1.6.0/Ruby/openstudio/openstudioutilitiescore.so (Load Error)

I followed all of the installation instructions as described here: nrel.github.io/OpenStudio-user-documentation/gettingstarted/gettingstarted/

Any idea what the problem could be? I am at a loss as I have tried both the 64 and 32 bit versions of Ruby and neither work. I am currently running: OpenStudio 1.6.0 Ruby 2.0.0-p594

Any help would be greatly appreciated!

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2015-02-23 09:42:07 -0500

I think the problem is with your Ruby version. Here's the response I got from @macumber when I emailed about this error:

this is likely due to the change of Ruby 2.0 version we had to make to match SketchUp’s version in 2015. You will now need the 64 bit MinGW version of Ruby 2.0. Also you have to use 32 bit version of Ruby to work with 32 bit version of OpenStudio and similar for 64 bit. Here is the version of Ruby that I am using with OS 1.6.0 (x64):

C:\Users\dmacumbe>ruby -v ruby 2.0.0p594 (2014-10-27) [x64-mingw32]

edit flag offensive delete link more

Comments

Our updated measure testing documentation shows what the measure test code should like. Here is a link specifically to the MiniTest code.

Also, here is a link to the previous post that Eric mentioned.

David Goldwasser's avatar David Goldwasser  ( 2015-02-23 09:52:15 -0500 )edit

@Eric Ringold and @David Goldwasser, thank you both for your insights. Eric, it was indeed a version problem, runs great with Ruby 2.0.0-p594-x64. However, there was one additional bug. When I entered the code from the install site line for line (Step 3 in the Optional - Install Ruby portion), I got the error:

...openstudio.rb:1:in '(main)': undefined method 'ruby' for main:Object (NoMethodError)

dpud12's avatar dpud12  ( 2015-02-23 11:00:12 -0500 )edit

I solved this error by changing the suggested line of code in Step 3 from:

ruby require 'C:\Program Files\OpenStudio 1.6.0\Ruby\openstudio.rb'

to

require 'C:\Program Files\OpenStudio 1.6.0\Ruby\openstudio.rb'

Was I wrong in assuming that the text 'ruby' should be included in the code? It works perfectly without it now but I want to understand my error/why this text is listed on the site.

dpud12's avatar dpud12  ( 2015-02-23 11:04:12 -0500 )edit

I think the leading ruby is an error in the installation instructions.

ericringold's avatar ericringold  ( 2015-02-23 11:47:04 -0500 )edit

Thanks @Eric Ringold, just fixed that page.

David Goldwasser's avatar David Goldwasser  ( 2015-02-23 12:51:40 -0500 )edit

Your Answer

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

Add Answer

Careers

Question Tools

1 follower

Stats

Asked: 2015-02-23 08:17:09 -0500

Seen: 382 times

Last updated: Feb 23 '15