system_assignation/city_model_structure/building_demand/material.py

374 lines
8.3 KiB
Python
Raw Normal View History

2020-10-28 13:42:58 -04:00
"""
Material module
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
2021-09-14 13:46:48 -04:00
import ast
from typing import Union
2020-10-28 13:42:58 -04:00
class Material:
"""
Material class
"""
2021-11-18 16:55:49 -05:00
def __init__(self, type, material_id, material_name, density, density_unit, embodied_carbon, embodied_carbon_unit, recycling_ratio,
onsite_recycling_ratio, company_recycling_ratio, landfilling_ratio, cost, cost_unit):
self._type = type
self._id = material_id
self._name = material_name
2020-10-28 13:42:58 -04:00
self._conductivity = None
self._specific_heat = None
2021-11-18 16:55:49 -05:00
self._density = density
self._density_unit = density_unit
2020-10-28 13:42:58 -04:00
self._solar_absorptance = None
self._thermal_absorptance = None
self._visible_absorptance = None
self._no_mass = False
self._thermal_resistance = None
2021-11-18 16:55:49 -05:00
self._embodied_carbon = embodied_carbon
self._embodied_carbon_unit = embodied_carbon_unit
self._recycling_ratio = recycling_ratio
self._onsite_recycling_ratio = onsite_recycling_ratio
self._company_recycling_ratio = company_recycling_ratio
self._landfilling_ratio = landfilling_ratio
self._cost = cost
self._cost_unit = cost_unit
@property
def type(self):
"""
Get material type
:return: str
"""
return self._type
@type.setter
def type(self, value):
"""
Set material type
:param value: string
"""
self._type = str(value)
@property
def id(self):
"""
Get material id
:return: int
"""
return self._id
@id.setter
def id(self, value):
"""
Set material id
:param value: int
"""
self._id = int(value)
2020-10-28 13:42:58 -04:00
@property
def name(self):
"""
Get material name
:return: str
"""
return self._name
@name.setter
def name(self, value):
"""
Set material name
:param value: string
"""
2021-09-13 15:14:54 -04:00
self._name = str(value)
2020-10-28 13:42:58 -04:00
@property
2021-09-14 13:46:48 -04:00
def conductivity(self) -> Union[None, float]:
2020-10-28 13:42:58 -04:00
"""
Get material conductivity in W/mK
2021-09-14 13:46:48 -04:00
:return: None or float
2020-10-28 13:42:58 -04:00
"""
return self._conductivity
@conductivity.setter
def conductivity(self, value):
"""
Set material conductivity in W/mK
:param value: float
"""
2021-09-14 13:46:48 -04:00
if value is not None:
self._conductivity = float(value)
2020-10-28 13:42:58 -04:00
@property
2021-09-14 13:46:48 -04:00
def specific_heat(self) -> Union[None, float]:
2020-10-28 13:42:58 -04:00
"""
Get material conductivity in J/kgK
2021-09-14 13:46:48 -04:00
:return: None or float
2020-10-28 13:42:58 -04:00
"""
return self._specific_heat
@specific_heat.setter
def specific_heat(self, value):
"""
Get material conductivity in J/kgK
:param value: float
"""
2021-09-14 13:46:48 -04:00
if value is not None:
self._specific_heat = float(value)
2020-10-28 13:42:58 -04:00
@property
2021-09-14 13:46:48 -04:00
def density(self) -> Union[None, float]:
2020-10-28 13:42:58 -04:00
"""
Get material density in kg/m3
2021-09-14 13:46:48 -04:00
:return: None or float
2020-10-28 13:42:58 -04:00
"""
return self._density
@density.setter
def density(self, value):
"""
2021-11-18 16:55:49 -05:00
Set material density
2020-10-28 13:42:58 -04:00
:param value: float
"""
2021-09-14 13:46:48 -04:00
if value is not None:
self._density = float(value)
2020-10-28 13:42:58 -04:00
2021-11-18 16:55:49 -05:00
@property
def density_unit(self) -> Union[None, str]:
"""
Get material density unit
:return: None or string
"""
return self._density_unit
@density_unit.setter
def density_unit(self, value):
"""
Set material density unit
:param value: string
"""
if value is not None:
self._density_unit = str(value)
2020-10-28 13:42:58 -04:00
@property
2021-09-14 13:46:48 -04:00
def solar_absorptance(self) -> Union[None, float]:
2020-10-28 13:42:58 -04:00
"""
Get material solar absorptance
2021-09-14 13:46:48 -04:00
:return: None or float
2020-10-28 13:42:58 -04:00
"""
return self._solar_absorptance
@solar_absorptance.setter
def solar_absorptance(self, value):
"""
Set material solar absorptance
:param value: float
"""
2021-09-14 13:46:48 -04:00
if value is not None:
self._solar_absorptance = float(value)
2020-10-28 13:42:58 -04:00
@property
2021-09-14 13:46:48 -04:00
def thermal_absorptance(self) -> Union[None, float]:
2020-10-28 13:42:58 -04:00
"""
Get material thermal absorptance
2021-09-14 13:46:48 -04:00
:return: None or float
2020-10-28 13:42:58 -04:00
"""
return self._thermal_absorptance
@thermal_absorptance.setter
def thermal_absorptance(self, value):
"""
Set material thermal absorptance
:param value: float
"""
2021-09-14 13:46:48 -04:00
if value is not None:
self._thermal_absorptance = float(value)
2020-10-28 13:42:58 -04:00
@property
2021-09-14 13:46:48 -04:00
def visible_absorptance(self) -> Union[None, float]:
2020-10-28 13:42:58 -04:00
"""
Get material visible absorptance
2021-09-14 13:46:48 -04:00
:return: None or float
2020-10-28 13:42:58 -04:00
"""
return self._visible_absorptance
@visible_absorptance.setter
def visible_absorptance(self, value):
"""
Set material visible absorptance
:param value: float
"""
2021-09-14 13:46:48 -04:00
if value is not None:
self._visible_absorptance = float(value)
2020-10-28 13:42:58 -04:00
@property
2021-09-14 13:46:48 -04:00
def no_mass(self) -> Union[None, bool]:
2020-10-28 13:42:58 -04:00
"""
Get material no mass flag
2021-09-14 13:46:48 -04:00
:return: None or Boolean
2020-10-28 13:42:58 -04:00
"""
return self._no_mass
@no_mass.setter
def no_mass(self, value):
"""
Set material no mass flag
:param value: Boolean
"""
2021-09-14 13:46:48 -04:00
if value is not None:
self._no_mass = value
2020-10-28 13:42:58 -04:00
@property
2021-09-14 13:46:48 -04:00
def thermal_resistance(self) -> Union[None, float]:
2020-10-28 13:42:58 -04:00
"""
Get material thermal resistance in m2K/W
2021-09-14 13:46:48 -04:00
:return: None or float
2020-10-28 13:42:58 -04:00
"""
return self._thermal_resistance
@thermal_resistance.setter
def thermal_resistance(self, value):
"""
Set material thermal resistance in m2K/W
:param value: float
"""
2021-09-14 13:46:48 -04:00
if value is not None:
self._thermal_resistance = float(value)
2021-11-18 16:55:49 -05:00
@property
def embodied_carbon(self) -> Union[None, float]:
"""
Get material embodied carbon
:return: None or float
"""
return self._embodied_carbon
@embodied_carbon.setter
def embodied_carbon(self, value):
"""
Set material embodied carbon
:param value: float
"""
if value is not None:
self._embodied_carbon = float(value)
@property
def embodied_carbon_unit(self) -> Union[None, str]:
"""
Get material embodied carbon unit
:return: None or string
"""
return self._embodied_carbon
@embodied_carbon_unit.setter
def embodied_carbon_unit(self, value):
"""
Set material embodied carbon unit
:param value: string
"""
if value is not None:
self._embodied_carbon_unit = str(value)
@property
def recycling_ratio(self) -> Union[None, float]:
"""
Get material recycling ratio
:return: None or float
"""
return self._recycling_ratio
@recycling_ratio.setter
def recycling_ratio(self, value):
"""
Set material recycling ratio
:param value: float
"""
if value is not None:
self._recycling_ratio = float(value)
@property
def onsite_recycling_ratio(self) -> Union[None, float]:
"""
Get material onsite recycling ratio
:return: None or float
"""
return self._onsite_recycling_ratio
@onsite_recycling_ratio.setter
def onsite_recycling_ratio(self, value):
"""
Set material onsite recycling ratio
:param value: float
"""
if value is not None:
self._onsite_recycling_ratio = float(value)
@property
def company_recycling_ratio(self) -> Union[None, float]:
"""
Get material company recycling ratio
:return: None or float
"""
return self._company_recycling_ratio
@company_recycling_ratio.setter
def company_recycling_ratio(self, value):
"""
Set material company recycling ratio
:param value: float
"""
if value is not None:
self._company_recycling_ratio = float(value)
@property
def landfilling_ratio(self) -> Union[None, float]:
"""
Get material landfilling ratio
:return: None or float
"""
return self._landfilling_ratio
@landfilling_ratio.setter
def landfilling_ratio(self, value):
"""
Set material landfilling ratio
:param value: float
"""
if value is not None:
self._landfilling_ratio = float(value)
@property
def cost(self) -> Union[None, float]:
"""
Get material cost
:return: None or float
"""
return self._cost
@cost.setter
def cost(self, value):
"""
Set material cost
:param value: float
"""
if value is not None:
self._cost = float(value)
@property
def cost_unit(self) -> Union[None, str]:
"""
Get material cost unit
:return: None or string
"""
return self._cost_unit
@cost_unit.setter
def cost_unit(self, value):
"""
Set material cost unit
:param value: string
"""
if value is not None:
self._cost_unit = float(value)