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

Revision history [back]

Your model has a default construction set, but it is referenced by the spaces, not from the building object. So when the code looks for default_construction_set.sources it is not finding any source that can cast to_Building.

If you don't want to change the osm, you can extend that code as implied by the comment #add SpaceType, BuildingSotry, and Space if statements, like:

    space_source = construction_set_source.to_Space
    if not space_source.empty?
      space_source = space_source.get
      space_source.setDefaultConstructionSet(new_default_construction_set)
      next
    end

Your model has a default construction set, but it is referenced by the spaces, not from the building object. So when the code looks for default_construction_set.sources it is not finding any source source that can cast to_Building.

If you don't want to change the osm, you can extend that code as implied by the comment #add SpaceType, BuildingSotry, and Space if statements, like:

    space_source = construction_set_source.to_Space
    if not space_source.empty?
      space_source = space_source.get
      space_source.setDefaultConstructionSet(new_default_construction_set)
      next
    end

Your model has a default construction set, but it is referenced by the spaces, not from the building object. So when the code looks for default_construction_set.sources it is not finding any source that can cast to_Building.

If you don't want to change the osm, you can extend that code as implied by the comment #add SpaceType, BuildingSotry, BuildingStory, and Space if statements, like:

    space_source = construction_set_source.to_Space
    if not space_source.empty?
      space_source = space_source.get
      space_source.setDefaultConstructionSet(new_default_construction_set)
      next
    end