NREL / openstudio-standards

Other
83 stars 58 forks source link

Cloning of construction types doesn't happen #246

Open jmarrec opened 7 years ago

jmarrec commented 7 years ago

https://github.com/NREL/openstudio-standards/blob/master/openstudio-standards/lib/openstudio-standards/standards/Standards.Model.rb#L3419

It doesn't clone it.

If you take a construction set from the OS Library, for eg 90.1-2010 MidriseApartment, the same construction is applied to the ground contract walls, ceiling and floors (and ExteriorFloor) After applying model.apply_prm_construction_types('90.1-2013'), it just changed the existing one with the latest in the loop (GroundContactWall is last added, #L3500), and not cloning happened

 OS:StandardsInformation:Construction,
   {f84c35d2-f1ea-430e-86a5-40f829e6bf82}, !- Handle
   {ca0b8402-a973-458c-a138-eacbdf3dea5d}, !- Construction Name
-  ExteriorFloor,                          !- Intended Surface Type
-  ,                                       !- Standards Construction Type
+  GroundContactWall,                      !- Intended Surface Type
+  Mass,                                   !- Standards Construction Type
mdahlhausen commented 2 months ago

Going through old bugs and making notes:

This method deals with assigned standard constructions to surfaces in the PRM. Seems like a fix for PNNL @weilixu @lymereJ .

The method model_apply_prm_construction_types sets standards information for constructions, in case they were not set before. The method model_apply_standard_constructions goes through each construction for a list of types and assigns the standard values to it. The issue is that some constructions apply to multiple kinds of surfaces in the model. In this case, the same construction will get edited, and ultimately end up with the values for the last surface type / construction type pair in the loop, regardless if it is appropriate for all surface types. At the extreme, imagine a model with the same construction for all surfaces. In that case, the method will set construction properties for that construction to the last surface type / construction pair, which will impact all surfaces in the model.

The fix is to clone existing constructions to create a new standards construction for each surface type / construction type pair, and then apply it to those constructions.

It would also be nice to use the 90.1-2019 PRM methods as the defaultmodel_apply_prm_construction_types and model_apply_standard_constructions, adding extra arguments if necessary.