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

data type error in Ruby

asked 2017-02-13 14:58:27 -0500

dalin_si gravatar image

updated 2017-08-05 07:36:00 -0500

Hi, i want to modify the COP of CoilCoolingDXSingleSpeed according to a csv file:

arr_of_arrs ='C:\Users\sdl06\Documents\essence-144\144assumption\PTAC_Efficiency.csv')

coils.each do |coil|
   arr_of_arrs.each do |arr|

However, I got error like that:

TypeError: Expected argument 1 of type boost::optional< double >, but got String "3.98"
        in SWIG method 'setRatedCOP'

I know that is data type error, but I don't know how to transfer Float to Double. Any suggestion? Thanks!

edit retag flag offensive close merge delete



Well arr[1].to_f should convert the value to a float but SWIG thinks it is being pass a string, so that is odd. I would try:

puts "#{arr[1].to_f}, #{arr[1].to_f.class}"

If the argument is a float and SWIG rejects it then I would try:


We have standardized away from methods taking OptionalDouble values as input but these still remain in the older APIs.

macumber gravatar imagemacumber ( 2017-02-13 15:17:58 -0500 )edit

This is a known issue for CoilCoolingDXSingleSpeed.

Eric Ringold gravatar imageEric Ringold ( 2017-02-13 15:37:04 -0500 )edit

@macumber Thx! I figured out

dalin_si gravatar imagedalin_si ( 2017-02-13 15:39:30 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-02-13 15:38:28 -0500

dalin_si gravatar image

Ok, now I figured out

only one adding one line:

cop =[1].to_f)

to transfer Float to OpenStudio::OptionalDouble


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


Question Tools

1 follower


Asked: 2017-02-13 14:58:27 -0500

Seen: 51 times

Last updated: Feb 13 '17