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

Revision history [back]

Line 122 of the OsLib_HVAC.rb file is:

spaceType = space.spaceType.get

Calling the spaceType method on a Space object returns an OptionalSpaceType object. If you try to get and Optional type that doesn't point to an acutal object, you will recieve the 'Optional not initialized' error. See the Measure Writing Guide section on the boost:optional type.

Based on this I would surmise you are trying to run the measure on a model that has spaces without space types assigned.

The right way to handle this case in the measure would be to check if space.spaceType.is_initializedor if not space.spaceType.empty? and then call space.spaceType.get if true, and (perhaps) skip that space if false.