From 01ff8ddcf3b69371b90efb72f791790379fc10f5 Mon Sep 17 00:00:00 2001 From: atiya Date: Thu, 18 Nov 2021 16:55:49 -0500 Subject: [PATCH] LCA materials XML --- .../building_demand/material.py | 205 +++++++++++++++++- city_model_structure/material.py | 6 +- data/life_cycle_assessment/lca_data.xml | 22 +- imports/life_cycle_assessment/lca_material.py | 11 +- 4 files changed, 220 insertions(+), 24 deletions(-) diff --git a/city_model_structure/building_demand/material.py b/city_model_structure/building_demand/material.py index 2e847597..fa5033d3 100644 --- a/city_model_structure/building_demand/material.py +++ b/city_model_structure/building_demand/material.py @@ -12,16 +12,60 @@ class Material: """ Material class """ - def __init__(self): - self._name = None + 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 self._conductivity = None self._specific_heat = None - self._density = None + self._density = density + self._density_unit = density_unit self._solar_absorptance = None self._thermal_absorptance = None self._visible_absorptance = None self._no_mass = False self._thermal_resistance = None + 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) @property def name(self): @@ -84,12 +128,29 @@ class Material: @density.setter def density(self, value): """ - Set material density in kg/m3 + Set material density :param value: float """ if value is not None: self._density = float(value) + @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) + @property def solar_absorptance(self) -> Union[None, float]: """ @@ -174,3 +235,139 @@ class Material: """ if value is not None: self._thermal_resistance = float(value) + + @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) diff --git a/city_model_structure/material.py b/city_model_structure/material.py index 5523cf14..80f65b71 100644 --- a/city_model_structure/material.py +++ b/city_model_structure/material.py @@ -9,11 +9,11 @@ class Material: LCA Material class """ - def __init__(self, material_name, material_id, type, density, density_unit, embodied_carbon, embodied_carbon_unit, recycling_ratio, + 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._material_name = material_name - self._material_id = material_id self._type = type + self._material_id = material_id + self._material_name = material_name self._density = density self._density_unit = density_unit self._embodied_carbon = embodied_carbon diff --git a/data/life_cycle_assessment/lca_data.xml b/data/life_cycle_assessment/lca_data.xml index 8d5b2dda..29bb356d 100644 --- a/data/life_cycle_assessment/lca_data.xml +++ b/data/life_cycle_assessment/lca_data.xml @@ -429,7 +429,7 @@ 0.4 .... - + 1.43 1070 0 @@ -438,7 +438,7 @@ 1 .... - + 1.43 240 0 @@ -447,7 +447,7 @@ 1 .... - + 1.43 430 0 @@ -456,7 +456,7 @@ 1 .... - + 1.43 340 0 @@ -465,7 +465,7 @@ 1 .... - + 1.2 440 0.8 @@ -474,7 +474,7 @@ 0.2 .... - + 2.1 1410 0.8 @@ -483,7 +483,7 @@ 0.2 .... - + 1.43 250 0 @@ -492,7 +492,7 @@ 1 .... - + 1.44 1480 0.8 @@ -501,7 +501,7 @@ 0.2 .... - + 1.44 2220 0.8 @@ -510,7 +510,7 @@ 0.2 .... - + 1.27 3960 0.8 @@ -519,7 +519,7 @@ 0.2 .... - + 1.15 760 0.8 diff --git a/imports/life_cycle_assessment/lca_material.py b/imports/life_cycle_assessment/lca_material.py index cce8e94e..027dfcf6 100644 --- a/imports/life_cycle_assessment/lca_material.py +++ b/imports/life_cycle_assessment/lca_material.py @@ -5,7 +5,7 @@ Copyright © 2020 Project Author Atiya """ import xmltodict from pathlib import Path -from city_model_structure.material import Material +from city_model_structure.building_demand.material import Material class LcaMaterial: def __init__(self, city, base_path): @@ -25,11 +25,10 @@ class LcaMaterial: # vehicle['fuel_consumption_rate']['@unit'], vehicle['carbon_emission_factor']['#text'], # vehicle['carbon_emission_factor']['@unit'])) for material in self._lca["library"]["building_materials"]['material']: - material_name = "material" - self._city.materials.append(Material(material['@type'], material['@id'], material['@name'], material['density']['#text'], material['density']['@unit'], - material['embodied_carbon']['#text'], material['embodied_carbon']['@unit'], material['recycling_ratio'], - material['onsite_recycling_ratio'], material['company_recycling_ratio'], material['landfilling_ratio'], - material['cost']['#text'], material['cost']['@unit'])) + self._city.materials.append(Material(material['@type'], material['@id'], material['@name'], material['density']['#text'], + material['density']['@unit'], material['embodied_carbon']['#text'], material['embodied_carbon']['@unit'], + material['recycling_ratio'], material['onsite_recycling_ratio'], material['company_recycling_ratio'], + material['landfilling_ratio'], material['cost']['#text'], material['cost']['@unit'])) # for concrete in self._lca["library"]["building_materials"]['concretes']['concrete']: # material_name = "concrete" # self._city.materials.append(Material(material_name, concrete['@id'], material['@type'], concrete['density']['#text'], concrete['density']['@unit'],