NREL / OpenStudio

OpenStudio is a cross-platform collection of software tools to support whole building energy modeling using EnergyPlus and advanced daylight analysis using Radiance.
https://www.openstudio.net/
Other
496 stars 190 forks source link

OpenStudio fails to write SpaceType into the IDF if it has the same name as the Building object #5226

Open chriswmackey opened 3 months ago

chriswmackey commented 3 months ago

Issue overview

The title basically says it all. This is quite possibly the strangest and most subtle bug that I have found in OpenStudio. It seems like the type of thing that you only discover when you have a community of thousands of people using the software. I'm very thankful this user in our community helped us find it since I never would have found something like this on my own.

Granted, I also recognize that naming the Building and the SpaceType the same thing is probably not the best practice. But I'm also 90% sure that you would agree with me that it is a bug.

Current Behavior

Here is a minimal sample OSM that recreates the issue: https://drive.google.com/file/d/19s7PgStDRpLMk3Q7Qn1opbQQccpk4tJd/view?usp=sharing

You can see that there is one SpaceType in the file called "housing" which has the same name as the Building object. In its current state, you will find that the OSM does not translate the Space Type to IDF. However, if you change either the SpaceType name or the Building name, everything will translate correctly.

Expected Behavior

I would expect the Space Type to be translated to the IDF regardless of what it is named. It took me quite a while to realize that the problem was with the name.

Environment

Both the user who reported the issue and I were on Windows but I think this bug probably also affects the Mac/Linux side.

Context

I implemented a workaround for this in Ladybug Tools for now so it's not urgent for us: https://github.com/ladybug-tools/honeybee-energy/commit/e5d46df4d40d9ecf5f96bbc047247f5e547e6ece

But I imagine that you would want to get this fixed for the sake of other developers