4

OpenStudio.BCLMeasure.arguments returns an empty vector

I'm using C# bindings of OpenStudio API to load measures from file, get it's arguments, modify a number of them and run the measure.

import OpenStudio

measure = OpenStudio.BCLMeasure(OpenStudio.Path(pathToMeasureDir))

args = measure.arguments()

# modify arguments, etc...

The workflow works fine for measures with a standard measure.xml (e.g. radianceMeasure) however when I test it for a measure such as Chilled Beam with DOAS, which misses the arguments tag inside the measure.xml file, it returns an empty BCLComponentVector.

If I load the measure inside OpenStudio App it loads the arguments fine. How does the app loads the arguments? Is there another API call that I should use to get the arguments?

PS: Watch this video for the workaround.

Mostapha Roudsari's avatar
1.1k
Mostapha Roudsari
asked 2016-04-28 22:59:05 -0500
__AmirRoth__'s avatar
4.4k
__AmirRoth__
updated 2017-08-05 13:29:52 -0500
edit flag offensive 0 remove flag close merge delete

Comments

I think I have an idea why this is happening, I'll follow up when I'm in the office, but if you get a chance can you see if the bar aspect ratio measure works fine. It is under form/opaque.

David Goldwasser's avatar David Goldwasser (2016-04-29 08:17:38 -0500) edit

Bar aspect ratio also returns no arguments.

Mostapha Roudsari's avatar Mostapha Roudsari (2016-04-29 11:08:24 -0500) edit
add a comment see more comments

1 Answer

5

The saga of measure arguments is long and treacherous but I think you are ready :-)

Each measure.xml (should) contain arguments computed in Ruby using an empty seed Model (e.g. Model.new). This happens for all the measures in the My Measures directory when you press the "Sync Project Measures With Library" button in the OpenStudio Application or PAT.

When you actually drag a measure into the OpenStudio Application or PAT, measure arguments are computed with the current model or seed model. This populates drop down menus with correct names of objects in your model and other model dependent stuff. These model dependent arguments are not saved to the measure.xml.

So for your issues, make sure to update the measure.xml file for your measures using the OpenStudio Application. You will not be able to get model dependent arguments from the measure.xml (if that is what you are trying to do). However, this will be a feature in the upcoming OpenStudio Command Line Interface. It might be possible to replicate the argument getting features of the OpenStudio Application but it would require embedded a Ruby interpretter in your C# application (which I doubt is worth the effort).

macumber's avatar
12k
macumber
answered 2016-04-29 10:17:43 -0500
edit flag offensive 0 remove flag delete link

Comments

1

@Mostapha Roudsari we have many measure on BCL, including "Chilled Beam with DOAS" that were uploaded before the measure class and arguments were written to the XML. We need to update the XML's and then push updates to BCL.

David Goldwasser's avatar David Goldwasser (2016-04-29 10:44:22 -0500) edit

Thanks @macumber and @david-goldwasser - I will follow Dan's advice and report back. My challenge is that I want everything to happen from Grasshopper interface but I think I can throw a warning to user and tell them to use OpenStudio Application to generate measure.xml before going forward. I assume there is not a clean API call to "Sync Project Measures With Library" without opening the App otherwise that would be out ideal option.

Mostapha Roudsari's avatar Mostapha Roudsari (2016-04-29 11:14:14 -0500) edit

PS: I couldn't figure out how to mention david's name in a comment. :|

Mostapha Roudsari's avatar Mostapha Roudsari (2016-04-29 11:16:29 -0500) edit

@Mostapha Roudsari, just need to add the space in my name, like your's to mention. Seems like bar aspect ratio needs also to be updated like @macumber mentioned. I have also found some measures that don't update properly even when going through the app, I'll try and investigate why.

David Goldwasser's avatar David Goldwasser (2016-04-29 11:49:21 -0500) edit

The OpenStudio Command Line Interface will do a lot of what you need, we should give you a demo some time

macumber's avatar macumber (2016-04-29 12:04:07 -0500) edit
add a comment see more comments