NREL / OpenStudio

OpenStudio is a cross-platform collection of software tools to support whole building energy modeling using EnergyPlus and advanced daylight analysis using Radiance.
https://www.openstudio.net/
Other
484 stars 185 forks source link

`runner.getArgumentValues` does not honor argument data type #5196

Closed shorowit closed 1 month ago

shorowit commented 1 month ago

Issue overview

Very simple OSW to demonstrate the issue: test.zip

Run it w/ OpenStudio 3.8 as follows: openstudio run -m -w test.osw

image

It will print out {:double_value=>40} instead of {:double_value=>40.0}. This caused a bug in our software because we ended up doing integer division instead of float division. Since the argument is of type Double, runner.getArgumentValues should be able to return the value as a double, right?

(Also, I'm seeing that val=1 is being output when I use the run -m flag. Maybe some debug code in OS that wasn't removed?)

@joseph-robertson @jmarrec

DavidGoldwasser commented 1 month ago

I may be seeing that in one of the measures in https://github.com/NREL/openstudio-calibration-gem/pull/66

So I guess a question is putting in 3.8.0. Is this low risk and easy enough to fix today to put in release package tomorrow, or if there is a work around to bypass the issue, do we wait.

jmarrec commented 1 month ago

MCVE

arg = OpenStudio::Measure::OSArgument::makeDoubleArgument("double", true)
arg.setValue(10.0)

arg.valueAsJSON
=> 10
arg.valueAsJSON.class
=> Integer