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

Revision history [back]

click to hide/show revision 1
initial version

Why is OptionalBuilding empty & uninitalized for my osm model?

I am attempting to use the ReplaceExteriorWindowConstruction measure, while it is creating a new construction set with the new window it is not actually setting this new construction set as the default construction set and hence the windows are not being replaced in the model.

This is because on the lines 295 to 308 of the measure.

      #link new subset to new set
      new_default_construction_set.setDefaultExteriorSubSurfaceConstructions(new_default_sub_surface_const_set)

      #swap all uses of the old construction set for the new
      construction_set_sources = default_construction_set.sources
      construction_set_sources.each do |construction_set_source|
        building_source = construction_set_source.to_Building
        if not building_source.empty?
          building_source = building_source.get
          building_source.setDefaultConstructionSet(new_default_construction_set)
          next
        end
        #add SpaceType, BuildingStory, and Space if statements

      end #end of construction_set_sources.each do

The variable building source which is an instance of the class OpenStudio::Model::OptionalBuilding is not initalized in my model so it is empty hence the part of the code in the if statement which actually changes the default constructions is never run.

So my question is, why is my model not initalized what is going wrong in the code here? You can find my osm model (osm1.osm) and a copy of the measure and tests for the measure here.

Any help is greatly appreciated.

Why is OptionalBuilding empty & uninitalized for my osm model?

I am attempting to use the ReplaceExteriorWindowConstruction measure, while it is creating a new construction set with the new window it is not actually setting this new construction set as the default construction set and hence the windows are not being replaced in the model.

This is because on the lines 295 to 308 of the measure.measure - the lines of code seen below.

      #link new subset to new set
      new_default_construction_set.setDefaultExteriorSubSurfaceConstructions(new_default_sub_surface_const_set)

      #swap all uses of the old construction set for the new
      construction_set_sources = default_construction_set.sources
      construction_set_sources.each do |construction_set_source|
        building_source = construction_set_source.to_Building
        if not building_source.empty?
          building_source = building_source.get
          building_source.setDefaultConstructionSet(new_default_construction_set)
          next
        end
        #add SpaceType, BuildingStory, and Space if statements

      end #end of construction_set_sources.each do

The variable building source which is an instance of the class OpenStudio::Model::OptionalBuilding is not initalized in my model so it is empty hence the part of the code in the if statement which actually changes the default constructions is never run.

So my question is, why is my model not initalized what is going wrong in the code here? You can find my osm model (osm1.osm) and a copy of the measure and tests for the measure here.

Any help is greatly appreciated.

Why is OptionalBuilding empty & uninitalized for my osm model?

I am attempting to use the ReplaceExteriorWindowConstruction measure, while it is creating a new construction set with the new window it is not actually setting this new construction set as the default construction set and hence the windows are not being replaced in the model.

This is because on the lines 295 to 308 of the measure - the lines of code seen below.

      #link new subset to new set
      new_default_construction_set.setDefaultExteriorSubSurfaceConstructions(new_default_sub_surface_const_set)

      #swap all uses of the old construction set for the new
      construction_set_sources = default_construction_set.sources
      construction_set_sources.each do |construction_set_source|
        building_source = construction_set_source.to_Building
        if not building_source.empty?
          building_source = building_source.get
          building_source.setDefaultConstructionSet(new_default_construction_set)
          next
        end
        #add SpaceType, BuildingStory, and Space if statements

      end #end of construction_set_sources.each do

The variable building source which is an instance of the class OpenStudio::Model::OptionalBuilding is not initalized in my model so it is empty hence empty. Hence the part of the code in the if statement which actually changes the default constructions is never run.

So my question is, why is my model not initalized what is going wrong in the code here? You can find my osm model (osm1.osm) and a copy of the measure and tests for the measure here.

Any help is greatly appreciated.