LCA materials XML

This commit is contained in:
atiya 2021-11-18 17:13:27 -05:00
parent e3a5d73c38
commit dff87c2390
2 changed files with 33 additions and 19 deletions

View File

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

View File

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