From dff87c23906cd9e800ec024e366ca3f1c25225d0 Mon Sep 17 00:00:00 2001 From: atiya Date: Thu, 18 Nov 2021 17:13:27 -0500 Subject: [PATCH] LCA materials XML --- .../building_demand/material.py | 28 +++++++++---------- imports/life_cycle_assessment/lca_material.py | 24 +++++++++++++--- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/city_model_structure/building_demand/material.py b/city_model_structure/building_demand/material.py index 3cd22965..6915fbd3 100644 --- a/city_model_structure/building_demand/material.py +++ b/city_model_structure/building_demand/material.py @@ -12,29 +12,27 @@ class Material: """ Material class """ - def __init__(self, type=None, material_id=None, material_name=None, density=None, density_unit=None, - embodied_carbon=None, embodied_carbon_unit=None, recycling_ratio=None, onsite_recycling_ratio=None, - company_recycling_ratio=None, landfilling_ratio=None, cost=None, cost_unit=None): + def __init__(self): self._type = type - self._id = material_id - self._name = material_name + self._id = None + self._name = None self._conductivity = None self._specific_heat = None - self._density = density - self._density_unit = density_unit + self._density = None + self._density_unit = None 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 + self._embodied_carbon = None + self._embodied_carbon_unit = None + self._recycling_ratio = None + self._onsite_recycling_ratio = None + self._company_recycling_ratio = None + self._landfilling_ratio = None + self._cost = None + self._cost_unit = None @property def type(self): diff --git a/imports/life_cycle_assessment/lca_material.py b/imports/life_cycle_assessment/lca_material.py index 027dfcf6..bd2ea846 100644 --- a/imports/life_cycle_assessment/lca_material.py +++ b/imports/life_cycle_assessment/lca_material.py @@ -25,10 +25,26 @@ 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']: - 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'])) + _material = Material() + _material.type = material['@type'] + _material.id = material['@id'] + _material.name = material['@name'] + _material.density=material['density']['#text'] + _material.density_unit=material['density']['@unit'] + _material.embodied_carbon=material['embodied_carbon']['#text'] + _material.embodied_carbon_unit=material['embodied_carbon']['@unit'] + _material.recycling_ratio=material['recycling_ratio'] + _material.onsite_recycling_ratio=material['onsite_recycling_ratio'] + _material.company_recycling_ratio=material['company_recycling_ratio'] + _material.landfilling_ratio=material['landfilling_ratio'] + _material.cost=material['cost']['#text'] + _material._cost_unit=material['cost']['@unit'] + + self._city.materials.append(_material) + # self._city.materials.append(Material(type=material['@type'], material_id=material['@id'], material_name=material['@name'], density=material['density']['#text'], + # density_unit=material['density']['@unit'], embodied_carbon=material['embodied_carbon']['#text'], embodied_carbon_unit=material['embodied_carbon']['@unit'], + # recycling_ratio=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'],