Add type to constructions to avoid collisions in constructions names

This commit is contained in:
Guille Gutierrez 2024-07-16 07:24:22 +02:00
parent 998df80b63
commit abc3fc48dd

View File

@ -321,7 +321,7 @@ class Idf:
if construction.Name == vegetation_name:
return
else:
if construction.Name == thermal_boundary.construction_name:
if construction.Name == f'{thermal_boundary.construction_name} {thermal_boundary.parent_surface.type}':
return
if thermal_boundary.layers is None:
for material in self._idf.idfobjects[self._MATERIAL]:
@ -340,7 +340,8 @@ class Idf:
for i in range(0, len(layers) - 1):
_kwargs[f'Layer_{i + 2}'] = layers[i].material_name
else:
_kwargs = {'Name': thermal_boundary.construction_name, 'Outside_Layer': layers[0].material_name}
_kwargs = {'Name': f'{thermal_boundary.construction_name} {thermal_boundary.parent_surface.type}',
'Outside_Layer': layers[0].material_name}
for i in range(1, len(layers) - 1):
_kwargs[f'Layer_{i + 1}'] = layers[i].material_name
self._idf.newidfobject(self._CONSTRUCTION, **_kwargs)
@ -717,7 +718,7 @@ class Idf:
if boundary.parent_surface.vegetation is not None:
construction_name = f'{boundary.construction_name}_{boundary.parent_surface.vegetation.name}'
else:
construction_name = boundary.construction_name
construction_name = f'{boundary.construction_name} {boundary.parent_surface.type}'
_kwargs['Construction_Name'] = construction_name
surface = self._idf.newidfobject(self._SURFACE, **_kwargs)