Merge pull request 'Bug correction in persistence' (#53) from correct_layer_name into main

Reviewed-on: https://nextgenerations-cities.encs.concordia.ca/gitea/CERC/hub/pulls/53
This commit is contained in:
Guille Gutierrez 2023-10-31 06:38:45 -04:00
commit 42de9cea97
5 changed files with 13 additions and 15 deletions

View File

@ -16,7 +16,7 @@ class Layer:
def __init__(self): def __init__(self):
self._thickness = None self._thickness = None
self._id = None self._id = None
self._name = None self._material_name = None
self._conductivity = None self._conductivity = None
self._specific_heat = None self._specific_heat = None
self._density = None self._density = None
@ -54,22 +54,20 @@ class Layer:
self._thickness = float(value) self._thickness = float(value)
@property @property
def name(self): def material_name(self):
""" """
Get material name Get material name
:return: str :return: str
""" """
# todo: this should be named material_name instead return self._material_name
return self._name
@name.setter @material_name.setter
def name(self, value): def material_name(self, value):
""" """
Set material name Set material name
:param value: string :param value: string
""" """
# todo: this should be named material_name instead self._material_name = str(value)
self._name = str(value)
@property @property
def conductivity(self) -> Union[None, float]: def conductivity(self) -> Union[None, float]:

View File

@ -148,20 +148,20 @@ class Idf:
def _add_material(self, layer): def _add_material(self, layer):
for material in self._idf.idfobjects[self._MATERIAL]: for material in self._idf.idfobjects[self._MATERIAL]:
if material.Name == layer.name: if material.Name == layer.material_name:
return return
for material in self._idf.idfobjects[self._MATERIAL_NOMASS]: for material in self._idf.idfobjects[self._MATERIAL_NOMASS]:
if material.Name == layer.name: if material.Name == layer.material_name:
return return
if layer.no_mass: if layer.no_mass:
self._idf.newidfobject(self._MATERIAL_NOMASS, self._idf.newidfobject(self._MATERIAL_NOMASS,
Name=layer.name, Name=layer.material_name,
Roughness=self._ROUGHNESS, Roughness=self._ROUGHNESS,
Thermal_Resistance=layer.thermal_resistance Thermal_Resistance=layer.thermal_resistance
) )
else: else:
self._idf.newidfobject(self._MATERIAL, self._idf.newidfobject(self._MATERIAL,
Name=layer.name, Name=layer.material_name,
Roughness=self._ROUGHNESS, Roughness=self._ROUGHNESS,
Thickness=layer.thickness, Thickness=layer.thickness,
Conductivity=layer.conductivity, Conductivity=layer.conductivity,

View File

@ -84,7 +84,7 @@ class EilatPhysicsParameters:
layer.thickness = layer_archetype.thickness layer.thickness = layer_archetype.thickness
total_thickness += layer_archetype.thickness total_thickness += layer_archetype.thickness
archetype_material = layer_archetype.material archetype_material = layer_archetype.material
layer.name = archetype_material.name layer.material_name = archetype_material.name
layer.no_mass = archetype_material.no_mass layer.no_mass = archetype_material.no_mass
if archetype_material.no_mass: if archetype_material.no_mass:
layer.thermal_resistance = archetype_material.thermal_resistance layer.thermal_resistance = archetype_material.thermal_resistance

View File

@ -82,7 +82,7 @@ class NrcanPhysicsParameters:
layer = Layer() layer = Layer()
layer.thickness = layer_archetype.thickness layer.thickness = layer_archetype.thickness
archetype_material = layer_archetype.material archetype_material = layer_archetype.material
layer.name = archetype_material.name layer.material_name = archetype_material.name
layer.no_mass = archetype_material.no_mass layer.no_mass = archetype_material.no_mass
if archetype_material.no_mass: if archetype_material.no_mass:
layer.thermal_resistance = archetype_material.thermal_resistance layer.thermal_resistance = archetype_material.thermal_resistance

View File

@ -85,7 +85,7 @@ class NrelPhysicsParameters:
layer = Layer() layer = Layer()
layer.thickness = layer_archetype.thickness layer.thickness = layer_archetype.thickness
archetype_material = layer_archetype.material archetype_material = layer_archetype.material
layer.name = archetype_material.name layer.material_name = archetype_material.name
layer.no_mass = archetype_material.no_mass layer.no_mass = archetype_material.no_mass
if archetype_material.no_mass: if archetype_material.no_mass:
layer.thermal_resistance = archetype_material.thermal_resistance layer.thermal_resistance = archetype_material.thermal_resistance