From 255f9f861a76a37bb9819ff7d21e5a82d8b9b583 Mon Sep 17 00:00:00 2001 From: guille Date: Tue, 31 Oct 2023 11:37:23 +0100 Subject: [PATCH] Bug correction in persistence --- hub/city_model_structure/building_demand/layer.py | 14 ++++++-------- hub/exports/building_energy/idf.py | 8 ++++---- .../construction/eilat_physics_parameters.py | 2 +- .../construction/nrcan_physics_parameters.py | 2 +- .../construction/nrel_physics_parameters.py | 2 +- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/hub/city_model_structure/building_demand/layer.py b/hub/city_model_structure/building_demand/layer.py index 0becf6af..eca4f1be 100644 --- a/hub/city_model_structure/building_demand/layer.py +++ b/hub/city_model_structure/building_demand/layer.py @@ -16,7 +16,7 @@ class Layer: def __init__(self): self._thickness = None self._id = None - self._name = None + self._material_name = None self._conductivity = None self._specific_heat = None self._density = None @@ -54,22 +54,20 @@ class Layer: self._thickness = float(value) @property - def name(self): + def material_name(self): """ Get material name :return: str """ - # todo: this should be named material_name instead - return self._name + return self._material_name - @name.setter - def name(self, value): + @material_name.setter + def material_name(self, value): """ Set material name :param value: string """ - # todo: this should be named material_name instead - self._name = str(value) + self._material_name = str(value) @property def conductivity(self) -> Union[None, float]: diff --git a/hub/exports/building_energy/idf.py b/hub/exports/building_energy/idf.py index 50f97849..6d9e6fbb 100644 --- a/hub/exports/building_energy/idf.py +++ b/hub/exports/building_energy/idf.py @@ -148,20 +148,20 @@ class Idf: def _add_material(self, layer): for material in self._idf.idfobjects[self._MATERIAL]: - if material.Name == layer.name: + if material.Name == layer.material_name: return for material in self._idf.idfobjects[self._MATERIAL_NOMASS]: - if material.Name == layer.name: + if material.Name == layer.material_name: return if layer.no_mass: self._idf.newidfobject(self._MATERIAL_NOMASS, - Name=layer.name, + Name=layer.material_name, Roughness=self._ROUGHNESS, Thermal_Resistance=layer.thermal_resistance ) else: self._idf.newidfobject(self._MATERIAL, - Name=layer.name, + Name=layer.material_name, Roughness=self._ROUGHNESS, Thickness=layer.thickness, Conductivity=layer.conductivity, diff --git a/hub/imports/construction/eilat_physics_parameters.py b/hub/imports/construction/eilat_physics_parameters.py index c09db490..57feba0d 100644 --- a/hub/imports/construction/eilat_physics_parameters.py +++ b/hub/imports/construction/eilat_physics_parameters.py @@ -84,7 +84,7 @@ class EilatPhysicsParameters: layer.thickness = layer_archetype.thickness total_thickness += layer_archetype.thickness archetype_material = layer_archetype.material - layer.name = archetype_material.name + layer.material_name = archetype_material.name layer.no_mass = archetype_material.no_mass if archetype_material.no_mass: layer.thermal_resistance = archetype_material.thermal_resistance diff --git a/hub/imports/construction/nrcan_physics_parameters.py b/hub/imports/construction/nrcan_physics_parameters.py index 8caede23..87a91d80 100644 --- a/hub/imports/construction/nrcan_physics_parameters.py +++ b/hub/imports/construction/nrcan_physics_parameters.py @@ -82,7 +82,7 @@ class NrcanPhysicsParameters: layer = Layer() layer.thickness = layer_archetype.thickness archetype_material = layer_archetype.material - layer.name = archetype_material.name + layer.material_name = archetype_material.name layer.no_mass = archetype_material.no_mass if archetype_material.no_mass: layer.thermal_resistance = archetype_material.thermal_resistance diff --git a/hub/imports/construction/nrel_physics_parameters.py b/hub/imports/construction/nrel_physics_parameters.py index 6f61102a..679e66cb 100644 --- a/hub/imports/construction/nrel_physics_parameters.py +++ b/hub/imports/construction/nrel_physics_parameters.py @@ -85,7 +85,7 @@ class NrelPhysicsParameters: layer = Layer() layer.thickness = layer_archetype.thickness archetype_material = layer_archetype.material - layer.name = archetype_material.name + layer.material_name = archetype_material.name layer.no_mass = archetype_material.no_mass if archetype_material.no_mass: layer.thermal_resistance = archetype_material.thermal_resistance