modified year of construction in tests to be able to run ConstructionFactory with nrel
This commit is contained in:
parent
88c0e9fa5f
commit
74dfa69aea
|
@ -8,7 +8,7 @@ Code contributors: Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concord
|
|||
import sys
|
||||
|
||||
from imports.construction.nrel_physics_interface import NrelPhysicsInterface
|
||||
from catalog_factories.construction.nrel_catalog import NrelCatalog
|
||||
from catalog_factories.construction_catalog_factory import ConstructionCatalogFactory
|
||||
from city_model_structure.building_demand.layer import Layer
|
||||
from city_model_structure.building_demand.material import Material
|
||||
from imports.construction.helpers.construction_helper import ConstructionHelper
|
||||
|
@ -61,8 +61,10 @@ class UsPhysicsParameters(NrelPhysicsInterface):
|
|||
for thermal_zone in internal_zone.thermal_zones:
|
||||
self._calculate_view_factors(thermal_zone)
|
||||
|
||||
def _search_archetype(self, function, year_of_construction, climate_zone):
|
||||
nrel_archetypes = NrelCatalog(self._path).entries('archetypes')
|
||||
@staticmethod
|
||||
def _search_archetype(function, year_of_construction, climate_zone):
|
||||
nrel_catalog = ConstructionCatalogFactory('nrel').catalog
|
||||
nrel_archetypes = nrel_catalog.entries('archetypes')
|
||||
for building_archetype in nrel_archetypes:
|
||||
construction_period_limits = building_archetype.construction_period.split(' - ')
|
||||
if construction_period_limits[1] == 'PRESENT':
|
||||
|
|
|
@ -7,7 +7,6 @@ Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
|||
from pathlib import Path
|
||||
from unittest import TestCase
|
||||
|
||||
import helpers.constants as cte
|
||||
from imports.geometry_factory import GeometryFactory
|
||||
from imports.construction_factory import ConstructionFactory
|
||||
from imports.geometry.helpers.geometry_helper import GeometryHelper
|
||||
|
@ -125,6 +124,7 @@ class TestConstructionFactory(TestCase):
|
|||
def _check_thermal_openings(self, thermal_boundary):
|
||||
for thermal_opening in thermal_boundary.thermal_openings:
|
||||
self.assertIsNotNone(thermal_opening.id, 'thermal opening id is not none')
|
||||
self.assertIsNotNone(thermal_opening.construction_name, 'thermal opening construction is not none')
|
||||
self.assertIsNotNone(thermal_opening.area, 'thermal opening area is not none')
|
||||
self.assertRaises(Exception, lambda: thermal_opening.openable_ratio,
|
||||
'thermal_opening openable_ratio is not raising an exception')
|
||||
|
@ -182,22 +182,10 @@ class TestConstructionFactory(TestCase):
|
|||
for thermal_zone in internal_zone.thermal_zones:
|
||||
self._check_thermal_boundaries(thermal_zone)
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
if thermal_boundary.type is not cte.GROUND:
|
||||
self.assertIsNotNone(thermal_boundary.outside_thermal_absorptance, 'outside_thermal_absorptance is none')
|
||||
self.assertIsNotNone(thermal_boundary.outside_visible_absorptance, 'outside_visible_absorptance is none')
|
||||
else:
|
||||
self.assertIsNone(thermal_boundary.outside_thermal_absorptance, 'outside_thermal_absorptance is not none')
|
||||
self.assertIsNone(thermal_boundary.outside_visible_absorptance, 'outside_visible_absorptance is not none')
|
||||
self.assertIsNotNone(thermal_boundary.outside_thermal_absorptance, 'outside_thermal_absorptance is none')
|
||||
self.assertIsNotNone(thermal_boundary.outside_visible_absorptance, 'outside_visible_absorptance is none')
|
||||
self.assertIsNotNone(thermal_boundary.layers, 'layers is none')
|
||||
|
||||
self._check_thermal_openings(thermal_boundary)
|
||||
for thermal_opening in thermal_boundary.thermal_openings:
|
||||
self.assertIsNotNone(thermal_opening.conductivity, 'thermal_opening conductivity is none')
|
||||
self.assertIsNotNone(thermal_opening.thickness, 'thermal opening thickness is none')
|
||||
self.assertIsNotNone(thermal_opening.front_side_solar_transmittance_at_normal_incidence,
|
||||
'thermal opening front_side_solar_transmittance_at_normal_incidence is none')
|
||||
self.assertIsNotNone(thermal_opening.back_side_solar_transmittance_at_normal_incidence,
|
||||
'thermal opening back_side_solar_transmittance_at_normal_incidence is none')
|
||||
|
||||
@staticmethod
|
||||
def _internal_function(function_format, original_function):
|
||||
|
|
|
@ -8,7 +8,6 @@ from pathlib import Path
|
|||
from unittest import TestCase
|
||||
from imports.geometry_factory import GeometryFactory
|
||||
from imports.usage_factory import UsageFactory
|
||||
from imports.schedules_factory import SchedulesFactory
|
||||
from imports.construction_factory import ConstructionFactory
|
||||
from exports.exports_factory import ExportsFactory
|
||||
|
||||
|
@ -29,10 +28,10 @@ class TestBuildings(TestCase):
|
|||
city_file = "../unittests/tests_data/C40_Final.gml"
|
||||
output_path = Path('../unittests/tests_outputs/').resolve()
|
||||
city = GeometryFactory('citygml', city_file).city
|
||||
for building in city.buildings:
|
||||
building.year_of_construction = 2006
|
||||
ConstructionFactory('nrel', city).enrich()
|
||||
UsageFactory('comnet', city).enrich()
|
||||
# UsageFactory('ca', city).enrich()
|
||||
# SchedulesFactory('doe_idf', city).enrich()
|
||||
ExportsFactory('idf', city, output_path).export()
|
||||
|
||||
self.assertEqual(10, len(city.buildings))
|
||||
|
|
|
@ -96,6 +96,8 @@ class TestGeometryFactory(TestCase):
|
|||
for usage_key in _usage_keys:
|
||||
# construction factory called first
|
||||
city = self._get_citygml(file)
|
||||
for building in city.buildings:
|
||||
building.year_of_construction = 2006
|
||||
self.assertTrue(len(city.buildings) > 0)
|
||||
self._prepare_case_construction_first(city, 'hft', construction_key, usage_key)
|
||||
self._check_result(city)
|
||||
|
@ -106,6 +108,8 @@ class TestGeometryFactory(TestCase):
|
|||
self._check_extra_thermal_zone(thermal_zone)
|
||||
# usage factory called first
|
||||
city = self._get_citygml(file)
|
||||
for building in city.buildings:
|
||||
building.year_of_construction = 2006
|
||||
self.assertTrue(len(city.buildings) > 0)
|
||||
self._prepare_case_usage_first(city, 'hft', construction_key, usage_key)
|
||||
self._check_result(city)
|
||||
|
@ -122,6 +126,8 @@ class TestGeometryFactory(TestCase):
|
|||
for usage_key in _usage_keys:
|
||||
# construction factory called first
|
||||
city = self._get_citygml(file)
|
||||
for building in city.buildings:
|
||||
building.year_of_construction = 2006
|
||||
self.assertTrue(len(city.buildings) > 0)
|
||||
self._prepare_case_construction_first(city, 'pluto', construction_key, usage_key)
|
||||
self._check_result(city)
|
||||
|
@ -132,6 +138,8 @@ class TestGeometryFactory(TestCase):
|
|||
self._check_extra_thermal_zone(thermal_zone)
|
||||
# usage factory called first
|
||||
city = self._get_citygml(file)
|
||||
for building in city.buildings:
|
||||
building.year_of_construction = 2006
|
||||
self.assertTrue(len(city.buildings) > 0)
|
||||
self._prepare_case_usage_first(city, 'pluto', construction_key, usage_key)
|
||||
self._check_result(city)
|
||||
|
|
|
@ -48,6 +48,7 @@ class TestExports(TestCase):
|
|||
self._complete_city = self._get_citygml(file_path)
|
||||
for building in self._complete_city.buildings:
|
||||
building.function = GeometryHelper().libs_function_from_hft(building.function)
|
||||
building.year_of_construction = 2006
|
||||
ConstructionFactory('nrel', self._complete_city).enrich()
|
||||
UsageFactory('ca', self._complete_city).enrich()
|
||||
cli = 'C:\\Users\\Pilar\\PycharmProjects\\monthlyenergybalance\\tests_data\\weather\\inseldb_Summerland.cli'
|
||||
|
|
|
@ -29,6 +29,8 @@ class TestSchedulesFactory(TestCase):
|
|||
def _get_citygml(self, file):
|
||||
file_path = (self._example_path / file).resolve()
|
||||
_city = GeometryFactory('citygml', file_path).city
|
||||
for building in _city.buildings:
|
||||
building.year_of_construction = 2006
|
||||
ConstructionFactory('nrel', _city).enrich()
|
||||
self.assertIsNotNone(_city, 'city is none')
|
||||
for building in _city.buildings:
|
||||
|
|
Loading…
Reference in New Issue
Block a user