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):
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]:

View File

@ -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,

View File

@ -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

View File

@ -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

View File

@ -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