forked from s_ranjbar/city_retrofit
Test driven partial corrections
This commit is contained in:
parent
155daa47b7
commit
a692f9c22a
|
@ -21,8 +21,8 @@ class Obj:
|
|||
with open(path, 'r') as file:
|
||||
self._scene = trimesh.exchange.load.load(file, file_type='obj', force='scene')
|
||||
self._corners = self._scene.bounds_corners
|
||||
_bound_corner_min = []
|
||||
_bound_corner_max = []
|
||||
_bound_corner_min = None
|
||||
_bound_corner_max = None
|
||||
for corner in self._corners:
|
||||
if _bound_corner_min is None:
|
||||
_bound_corner_min = corner
|
||||
|
|
|
@ -19,6 +19,6 @@ class LcaFuel:
|
|||
|
||||
with open(path) as xml:
|
||||
self._lca = xmltodict.parse(xml.read())
|
||||
for fuel in self._lca["library"]["fuels"]['fuel']:
|
||||
for fuel in self._lca["library"]["Fuels"]['fuel']:
|
||||
self._city.fuels.append(Fuel(fuel['@id'], fuel['@name'], fuel['carbon_emission_factor']['#text'],
|
||||
fuel['carbon_emission_factor']['@unit']))
|
||||
|
|
|
@ -19,7 +19,7 @@ class LcaMachine:
|
|||
|
||||
with open(path) as xml:
|
||||
self._lca = xmltodict.parse(xml.read())
|
||||
for machine in self._lca["library"]["machines"]['machine']:
|
||||
for machine in self._lca["library"]["Machines"]['machine']:
|
||||
self._city.machines.append(Machine(machine['@id'], machine['@name'], machine['work_efficiency']['#text'],
|
||||
machine['work_efficiency']['@unit'], machine['energy_consumption_rate']['#text'],
|
||||
machine['energy_consumption_rate']['@unit'], machine['carbon_emission_factor']['#text'],
|
||||
|
|
|
@ -19,7 +19,7 @@ class LcaVehicle:
|
|||
|
||||
with open(path) as xml:
|
||||
self._lca = xmltodict.parse(xml.read())
|
||||
for vehicle in self._lca["library"]["vehicles"]['vehicle']:
|
||||
for vehicle in self._lca["library"]["Vehicles"]['vehicle']:
|
||||
self._city.vehicles.append(Vehicle(vehicle['@id'], vehicle['@name'], vehicle['fuel_consumption_rate']['#text'],
|
||||
vehicle['fuel_consumption_rate']['@unit'], vehicle['carbon_emission_factor']['#text'],
|
||||
vehicle['carbon_emission_factor']['@unit']))
|
||||
|
|
|
@ -8,7 +8,7 @@ from pathlib import Path
|
|||
from imports.life_cycle_assessment.lca_fuel import LcaFuel
|
||||
from imports.life_cycle_assessment.lca_vehicle import LcaVehicle
|
||||
from imports.life_cycle_assessment.lca_machine import LcaMachine
|
||||
from imports.life_cycle_assessment.lca_material import LcaMaterial
|
||||
# from imports.life_cycle_assessment.lca_material import LcaMaterial
|
||||
|
||||
|
||||
class LifeCycleAssessment:
|
||||
|
|
|
@ -45,7 +45,7 @@ class TestExports(TestCase):
|
|||
else:
|
||||
file_path = (self._example_path / 'one_building_in_kelowna.gml').resolve()
|
||||
self._complete_city = self._get_citygml(file_path)
|
||||
ConstructionFactory('ca', self._complete_city).enrich()
|
||||
ConstructionFactory('nrel', self._complete_city).enrich()
|
||||
UsageFactory('ca', self._complete_city).enrich()
|
||||
SchedulesFactory('comnet', self._complete_city).enrich()
|
||||
cli = 'C:\\Users\\Pilar\\PycharmProjects\\monthlyenergybalance\\tests_data\\weather\\inseldb_Summerland.cli'
|
||||
|
|
|
@ -9,6 +9,7 @@ from unittest import TestCase
|
|||
from imports.geometry_factory import GeometryFactory
|
||||
from imports.usage_factory import UsageFactory
|
||||
from imports.geometry.helpers.geometry_helper import GeometryHelper
|
||||
from imports.construction_factory import ConstructionFactory
|
||||
|
||||
|
||||
class TestUsageFactory(TestCase):
|
||||
|
@ -38,7 +39,7 @@ class TestUsageFactory(TestCase):
|
|||
city = self._get_citygml(file)
|
||||
for building in city.buildings:
|
||||
building.function = GeometryHelper.pluto_to_function[building.function]
|
||||
|
||||
ConstructionFactory('nrel', city).enrich()
|
||||
UsageFactory('hft', city).enrich()
|
||||
for building in city.buildings:
|
||||
self.assertIsNot(len(building.usage_zones), 0, 'no building usage_zones defined')
|
||||
|
@ -61,7 +62,7 @@ class TestUsageFactory(TestCase):
|
|||
# case 2: CA
|
||||
file = 'one_building_in_kelowna.gml'
|
||||
city = self._get_citygml(file)
|
||||
|
||||
ConstructionFactory('nrel', city).enrich()
|
||||
UsageFactory('ca', city).enrich()
|
||||
for building in city.buildings:
|
||||
self.assertIsNot(len(building.usage_zones), 0, 'no building usage_zones defined')
|
||||
|
|
Loading…
Reference in New Issue
Block a user