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

Revision history [back]

Replace a construction in a construction set

I am struggling to replace a construction in a construction set generated via openstudio-standard with a construction extracted from a reference model. I have based my code on this measure, but no success so far.

This is my attempt. First I get my wall construction from an existing model

wall_construction = ref_model.getConstructionByName(wall_construction_name).get

(The construction exists)

then i create a standard object and get its construction construction set with

bldg_def_const_set = standard.model_add_construction_set(model, climate_zone, building_type, nil, false)

Finally, I try to replace the construction for walls with

if bldg_def_const_set.is_initialized    
  # This is the overall construction set
  bldg_def_const_set = bldg_def_const_set.get
  # This is the exterior surfaces default construction set
  default_ext_surface_const_set = bldg_def_const_set.defaultExteriorSurfaceConstructions.get
  # And now we can assign the wall
  default_ext_surface_const_set.setWallConstruction(wall_construction.to_Construction.get) # Tried also with to_ConstructionBase as in the measure. 

  puts "SAP construction replaced the default construction!"
  building.setDefaultConstructionSet(bldg_def_const_set)
  puts "Success!"
else
  puts "Could not create default construction set for the building."
end

There is no error, but the new construction is not there.

I cannot understand what I am missing. Any idea?

Replace a construction in a construction set

I am struggling to replace a construction in a construction set generated via openstudio-standard with a construction extracted from a reference model. I have based my code on this measure, but no success so far.

This is my attempt. First I get my wall construction from an existing model

wall_construction = ref_model.getConstructionByName(wall_construction_name).get

(The construction exists)

then i create a standard standard object and get its construction construction set with

bldg_def_const_set = standard.model_add_construction_set(model, climate_zone, building_type, nil, false)

Finally, I try to replace the construction for walls with

if bldg_def_const_set.is_initialized    
  # This is the overall construction set
  bldg_def_const_set = bldg_def_const_set.get
  # This is the exterior surfaces default construction set
  default_ext_surface_const_set = bldg_def_const_set.defaultExteriorSurfaceConstructions.get
  # And now we can assign the wall
  default_ext_surface_const_set.setWallConstruction(wall_construction.to_Construction.get) # Tried also with to_ConstructionBase as in the measure. 

  puts "SAP construction replaced the default construction!"
  building.setDefaultConstructionSet(bldg_def_const_set)
  puts "Success!"
else
  puts "Could not create default construction set for the building."
end

There is no error, but the new construction is not there.

I cannot understand what I am missing. Any idea? idea?

Replace a construction in a construction set

I am struggling to replace a construction in a construction set generated via openstudio-standard with a construction extracted from a reference model. I have based my code on this measure, but no success so far.

This is my attempt. First I get my wall construction from an existing model

wall_construction = ref_model.getConstructionByName(wall_construction_name).get

(The construction exists)

then i create a standard object and get its construction construction set with

bldg_def_const_set = standard.model_add_construction_set(model, climate_zone, building_type, nil, false)

Finally, I try to replace the construction for walls with

if bldg_def_const_set.is_initialized    
  # This is the overall construction set
  bldg_def_const_set = bldg_def_const_set.get
  # This is the exterior surfaces default construction set
  default_ext_surface_const_set = bldg_def_const_set.defaultExteriorSurfaceConstructions.get
  # And now we can assign the wall
  default_ext_surface_const_set.setWallConstruction(wall_construction.to_Construction.get) # Tried also with to_ConstructionBase as in the measure. 

  puts "SAP construction replaced the default construction!"
  building.setDefaultConstructionSet(bldg_def_const_set)
  puts "Success!"
else
  puts "Could not create default construction set for the building."
end

There is no error, but the new construction is not there.

I cannot understand what I am missing. Any idea?

Replace a construction in a construction set

I am struggling to replace a construction in a construction set generated via openstudio-standard with a construction extracted from a reference model. I have based my code on this measure, but no success so far.

This is my attempt. First I get my wall construction from an existing model

wall_construction = ref_model.getConstructionByName(wall_construction_name).get

(The construction exists)

then i create a standard object and get its construction set with

bldg_def_const_set = standard.model_add_construction_set(model, climate_zone, building_type, nil, false)

Finally, I try to replace the construction for walls with

if bldg_def_const_set.is_initialized    
  # This is the overall construction set
  bldg_def_const_set = bldg_def_const_set.get
  # This is the exterior surfaces default construction set
  default_ext_surface_const_set = bldg_def_const_set.defaultExteriorSurfaceConstructions.get
  # And now we can assign the wall
  default_ext_surface_const_set.setWallConstruction(wall_construction.to_Construction.get) # Tried also with to_ConstructionBase as in the measure. 

  puts "SAP construction replaced the default construction!"
  building.setDefaultConstructionSet(bldg_def_const_set)
  puts "Success!"
else
  puts "Could not create default construction set for the building."
end

There is no error, but the new construction is not there.

I cannot understand what I am missing. Any idea?