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

OS argument in SDK

asked 2016-01-29 09:53:56 -0500

ngkhanh's avatar

updated 2016-01-29 09:59:22 -0500

From OP SDK i got this class : static OSArgument makeBoolArgument (const std::string &name, bool required=true, bool modelDependent=false)

1/ I have question about modelDependent. Which case we often use this attribute ? and How to use ?

2/ Have anyway to set value of argument without shown selection optional:

if k == 0
  schedule_add = OpenStudio::Ruleset::OSArgument::makeBoolArgument('@add_sched',false)
  schedule_add.setDisplayName("Check if you want to create new and use as default supply auto fan schedule")
  schedule_add.setDefaultValue(false)
  args << schedule_add
else
  schedule_add = OpenStudio::Ruleset::OSArgument::makeBoolArgument('@add_sched',false)
  schedule_add.setDisplayName("Don't check because schedule has been created")
  schedule_add.setValue(false)
  args << schedule_add
end

In my case, don't want to show check box if k differ than 0 - hardsize as false.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2016-02-01 09:13:30 -0500

  1. modelDependent is an indication internally that we can pre-populate measure.xml with argument values without having to dynamically generate values for a specific use case. The most common example is a choice list that have hard coded values of "North, South, East, and West" Those are not modelDependant. If you instead you have a choice list that has you loop through all spaces in the model, that is modelDepedant. Either approach is valid,we just have to dynamically calculate values for xml in the second option.
  2. Having a measure where values change from one model to another is fine, but having a measure where the number of arguments that exist change from one model to the next can be problematic for a parametric analysis. If you are just using it internally or with apply measures now then it may be fine. You can't have an argument there and not show it, but there are a few options. One option is to make it a choice list instead of a bool and and for some models just offer "false" instead of "true,false" It will show as an argument but the user won't be able to change it. You can also use an optional argument. Another option is to completely skip the argument in the argument section, it will require some extra code in the run section to either not attempt to get the argument using the same logic, or to gracefully handle having it there or missing.
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

Careers

Question Tools

1 follower

Stats

Asked: 2016-01-29 09:53:56 -0500

Seen: 161 times

Last updated: Feb 01 '16