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

How do I modify Openstudio Model object parameters not found in SDK?

asked 2016-11-30 10:52:35 -0500

jugonzal07's avatar

updated 2017-08-05 07:40:10 -0500

Hi all,

Throughout my OpenStudio development I have been finding I run into cases where I know an OS object has a parameter but I'm not finding a way to modify it when I look through the SDK. To give an example, SolarCollector:FlatePlate:Water has a parameter for its area. However, if I go to the SDK and look at SolarCollector:FlatePlate:Water's functions (and through the inherited functions), there doesn't appear to be one to modify its area.

In cases like these, is there an easy way to go in and modify the actual raw string representing the OS object? I figure there must be a way to output the OS object as a string, modify it, and cast it back to an OS object. Other examples of when I've had trouble with this is when trying to find outlet node of a water heater mixed object to use as the Stream 2 Source Node on a tempering valve.

Any advice?

edit retag flag offensive close merge delete

Comments

1

Is area an input for SolarCollector:FlatPlate:Water? Does it not derive its area from the associated surface? More generally, if you open the OSM file in a text editor and can see the parameter you are trying to assign that doesn't have a method for altering it, then you can call the setString(index, string) where index is the index of the parameter for the object and string is the string you want to pass in.

pflaumingo's avatar pflaumingo  ( 2016-11-30 11:06:41 -0500 )edit

Thanks so much for the reply! I didn't think it did either until I was receiving warnings that my solar collector's area did not match my surface's area. Opening up OS I looked and saw this. Thankfully it seems like OS defaults to the area of the surface anyhow, but it was something that bugged me.

That setString parameter seems to be what I'm looking for! I didn't know it existed. As a quick follow up, is there a getString(index) function as well? I wonder what other useful functions I didn't know existed are out there (eg: get<os:object>s returns an array)

jugonzal07's avatar jugonzal07  ( 2016-11-30 11:37:11 -0500 )edit
1

That is the SolarCollectorPerformance:FlatPlate object, which is different from the object you mention above in that it takes a reference area as seen in the documentation, but as it states, it still uses the surfaces area for calculation.

Yes, there is a getString method! I typically use the C# bindings and have found the intellisense in Visual Studio helps discover methods that aren't all that obvious.

pflaumingo's avatar pflaumingo  ( 2016-11-30 11:58:45 -0500 )edit

Oh look at that, you're totally right. I was wondering why they kept being defaulted to 2.9646 m2. Maybe I'll do some more digging if need be to see why it's not matching my surface area. Anyhow, lots of help here. Thanks, pflaumingo

jugonzal07's avatar jugonzal07  ( 2016-11-30 12:19:54 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2016-12-01 10:03:46 -0500

jugonzal07's avatar

Per @pflaumingo's recommendation, you can generally grab and set values in an OpenStudio object using the getString(index) and setString(index, string) functions where index is the index of the parameter for the object you're interested in.

E.g. let's say I wanted the handle for the inlet port of the following Node object:

OS:Node,
  {9e27287a-144b-4341-9ff2-f6d7bcc4c37f}, !- Handle
  Node 8,                                 !- Name
  {f2293c91-c542-4f27-8bd9-fff7fc4967b2}, !- Inlet Port <----THIS ONE
  {969fbfbf-fd2a-4397-afec-6d19fc376ed8}; !- Outlet Port

Let's say I grabbed the node and named the object my_node, you'd want to do my_node.getString(2) as the inlet port is the 2nd parameter (remember the indexing starts at 0).

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

2 followers

Stats

Asked: 2016-11-30 10:52:35 -0500

Seen: 275 times

Last updated: Dec 01 '16