Iterating through OpenStudio Objects to get their "Types" and "Attributes"

asked 2022-11-17 10:53:43 -0600

updated 2022-11-17 16:37:52 -0600

Hi All,

For context this is being done using Python. I'm trying to see if there's a built-in method where I can load an existing OpenStudio model, use specific_object = osm.getObject(an_object_handle).get() to isolate a specific object (where osm is the whole model), and then pick apart and inspect what's in the object. If I use print(specific_object) I get a nice human-readable block of text. However I can't seem to figure out how to iterate through these fields beyond just specific_object.name().

I'd like to iteratively return if possible the type of object (Space, Thermal Zone, Construction, etc.), and its attributes. Like in the case of a space, returning Space Type Name, Default Construction Set Name, Default Schedule Set Name, etc.

I put types and attributes in quotes in the title because I think the nomenclature in OpenStudio is a little different which might be part of my problem.

I really appreciate any suggestions you all might have. I think if all else fails I could use str(specific_object) to get that human-readable output and then parse through that with other python tools. I just wasn't sure if there was a built-in way. My end goal for this project is to generate some reporting for myself about the model so I don't necessarily need to hang onto the OpenStudio objects themselves nor am I necessarily trying to change them. However, it would be nice to know what options I have should I want to later.

Thanks!

edit retag flag offensive close merge delete