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

Replace a construction in a construction set

asked 2022-09-26 06:58:33 -0600

updated 2022-09-26 09:31:59 -0600

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2022-09-26 10:36:26 -0600

updated 2022-09-26 10:39:38 -0600

wall_construction is still just in ref_model you need to clone it to model before you assign it. That would look something like this.

wall_construction = wall_construction.to_Construction.get
wall_construction_clone = wall_construction.clone(model).to_Construction.get
default_ext_surface_const_set.setWallConstruction(wall_construction_clone)
edit flag offensive delete link more

Comments

That makes sense. Thanks!

MapMortar's avatar MapMortar  ( 2022-09-26 10:48:32 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Training Workshops

Careers

Question Tools

1 follower

Stats

Asked: 2022-09-26 06:58:33 -0600

Seen: 128 times

Last updated: Sep 26 '22