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

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

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.

edit retag close merge delete

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.

( 2016-11-30 11:06:41 -0600 )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)

( 2016-11-30 11:37:11 -0600 )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.

( 2016-11-30 11:58:45 -0600 )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

( 2016-11-30 12:19:54 -0600 )edit

Sort by » oldest newest most voted

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).

more