NREL / openstudio-common-measures-gem

Other
8 stars 15 forks source link

ChangeBuildingLocation Error: Comparison of String with 0 failed #55

Closed juliobetta closed 3 years ago

juliobetta commented 3 years ago

https://github.com/NREL/openstudio-common-measures-gem/blob/35c59628af39507f0048873f103dbeac385b0936/lib/measures/ChangeBuildingLocation/measure.rb#L199

out.json.zip

I'm getting this error for the argument set_year. Even though I'm passing in as a number (see output file attached).

Is this something that a simple .to_i does the job or is this internal to the OpenStudio lib?

Thanks,

DavidGoldwasser commented 3 years ago

@juliobetta I see the issue here. You are setting "use_upstream_args" to true because you need to pull values from registerValues o that measure. The method we have for that adds value as a string and doesn't check for bool, integer, or double. I see I already add work arounds for specific arguments like zipcode and number_of_stories_above_grade. I can add a quick fix in a few minutes and I'll post a link to branch for that. Once testing is done I can merge into develop tomorrow. If you want to quickly fix it on your end in place here is the code I'll extend. Year should be to_i since it is an integer instead of double. I believe it worked before because this change was on the project specific copy of your measure but not on the one we developed on, so that change got overwritten. Thanks for pointing it out. https://github.com/NREL/openstudio-common-measures-gem/blob/35c59628af39507f0048873f103dbeac385b0936/lib/measures/ChangeBuildingLocation/measure.rb#L118-L125

I'll also extend the gem that contains that method for our next major release to support doubles integers, and ideally bools without any special code in the measures. https://github.com/NREL/openstudio-extension-gem/blob/develop/lib/openstudio/extension/core/os_lib_helper_methods.rb#L253

DavidGoldwasser commented 3 years ago

@juliobetta Sorry I missed your pull request before I made a new branch. Thanks you for doing that!

juliobetta commented 3 years ago

hah, no worries! thank YOU @DavidGoldwasser