Compare commits
8 Commits
56fae48277
...
e0f11b7c02
Author | SHA1 | Date | |
---|---|---|---|
e0f11b7c02 | |||
38bda1920d | |||
357e9f4a7e | |||
ea00266626 | |||
8e20e747a5 | |||
d67c5c438b | |||
00a1313235 | |||
5cc62ccabd |
@ -302,7 +302,7 @@ class Building(CityObject):
|
|||||||
Set heating demand in Wh
|
Set heating demand in Wh
|
||||||
:param value: dict{DataFrame(float)}
|
:param value: dict{DataFrame(float)}
|
||||||
"""
|
"""
|
||||||
self._heating = value
|
self._heating_demand = value
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def cooling_demand(self) -> dict:
|
def cooling_demand(self) -> dict:
|
||||||
@ -318,7 +318,7 @@ class Building(CityObject):
|
|||||||
Set cooling demand in Wh
|
Set cooling demand in Wh
|
||||||
:param value: dict{DataFrame(float)}
|
:param value: dict{DataFrame(float)}
|
||||||
"""
|
"""
|
||||||
self._cooling = value
|
self._cooling_demand = value
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def lighting_electrical_demand(self) -> dict:
|
def lighting_electrical_demand(self) -> dict:
|
||||||
@ -616,8 +616,8 @@ class Building(CityObject):
|
|||||||
for key, item in _working_hours.items():
|
for key, item in _working_hours.items():
|
||||||
saved_values = _working_hours_per_thermal_zone[key]
|
saved_values = _working_hours_per_thermal_zone[key]
|
||||||
for i, value in enumerate(item):
|
for i, value in enumerate(item):
|
||||||
if saved_values[i] == 1:
|
_working_hours[key][i] = max(_working_hours[key][i], saved_values[i])
|
||||||
value = 1
|
|
||||||
_total_hours = 0
|
_total_hours = 0
|
||||||
for key in _working_hours:
|
for key in _working_hours:
|
||||||
hours = sum(_working_hours[key])
|
hours = sum(_working_hours[key])
|
||||||
|
@ -472,11 +472,16 @@ class City:
|
|||||||
for surface in building.surfaces:
|
for surface in building.surfaces:
|
||||||
if surface.global_irradiance:
|
if surface.global_irradiance:
|
||||||
parameter_city_building_total_radiation += surface.global_irradiance[cte.YEAR].iloc[0, 0]
|
parameter_city_building_total_radiation += surface.global_irradiance[cte.YEAR].iloc[0, 0]
|
||||||
|
|
||||||
merged_city_building_total_radiation = 0
|
merged_city_building_total_radiation = 0
|
||||||
for surface in merged_city.city_object(building.name).surfaces:
|
for surface in merged_city.city_object(building.name).surfaces:
|
||||||
if surface.global_irradiance:
|
if surface.global_irradiance:
|
||||||
merged_city_building_total_radiation += surface.global_irradiance[cte.YEAR].iloc[0, 0]
|
merged_city_building_total_radiation += surface.global_irradiance[cte.YEAR].iloc[0, 0]
|
||||||
if merged_city_building_total_radiation < parameter_city_building_total_radiation:
|
|
||||||
|
if merged_city_building_total_radiation == 0:
|
||||||
|
merged_city.remove_city_object(merged_city.city_object(building.name))
|
||||||
|
merged_city.add_city_object(building)
|
||||||
|
elif merged_city_building_total_radiation > parameter_city_building_total_radiation > 0:
|
||||||
merged_city.remove_city_object(merged_city.city_object(building.name))
|
merged_city.remove_city_object(merged_city.city_object(building.name))
|
||||||
merged_city.add_city_object(building)
|
merged_city.add_city_object(building)
|
||||||
|
|
||||||
|
@ -17,13 +17,15 @@ class Weather:
|
|||||||
Weather class
|
Weather class
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# todo: this dictionary need to be completed, a data science student task?
|
|
||||||
_epw_file = {
|
_epw_file = {
|
||||||
'CA.02.5935': 'https://energyplus-weather.s3.amazonaws.com/north_and_central_america_wmo_region_4/CAN/BC/CAN_BC_Summerland.717680_CWEC/CAN_BC_Summerland.717680_CWEC.epw',
|
'CA.02.5935': 'https://energyplus-weather.s3.amazonaws.com/north_and_central_america_wmo_region_4/CAN/BC/CAN_BC_Summerland.717680_CWEC/CAN_BC_Summerland.717680_CWEC.epw',
|
||||||
'CA.10.06': 'https://energyplus-weather.s3.amazonaws.com/north_and_central_america_wmo_region_4/CAN/PQ/CAN_PQ_Montreal.Intl.AP.716270_CWEC/CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw',
|
'CA.10.06': 'https://energyplus-weather.s3.amazonaws.com/north_and_central_america_wmo_region_4/CAN/PQ/CAN_PQ_Montreal.Intl.AP.716270_CWEC/CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw',
|
||||||
|
'CA.10.14': 'https://energyplus-weather.s3.amazonaws.com/north_and_central_america_wmo_region_4/CAN/PQ/CAN_PQ_Montreal.Intl.AP.716270_CWEC/CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw',
|
||||||
|
'CA.10.16': 'https://energyplus-weather.s3.amazonaws.com/north_and_central_america_wmo_region_4/CAN/PQ/CAN_PQ_Montreal.Intl.AP.716270_CWEC/CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw',
|
||||||
'DE.01.082': 'https://energyplus-weather.s3.amazonaws.com/europe_wmo_region_6/DEU/DEU_Stuttgart.107380_IWEC/DEU_Stuttgart.107380_IWEC.epw',
|
'DE.01.082': 'https://energyplus-weather.s3.amazonaws.com/europe_wmo_region_6/DEU/DEU_Stuttgart.107380_IWEC/DEU_Stuttgart.107380_IWEC.epw',
|
||||||
'US.NY.047': 'https://energyplus-weather.s3.amazonaws.com/north_and_central_america_wmo_region_4/USA/NY/USA_NY_New.York.City-Central.Park.94728_TMY/USA_NY_New.York.City-Central.Park.94728_TMY.epw'
|
'US.NY.047': 'https://energyplus-weather.s3.amazonaws.com/north_and_central_america_wmo_region_4/USA/NY/USA_NY_New.York.City-Central.Park.94728_TMY/USA_NY_New.York.City-Central.Park.94728_TMY.epw'
|
||||||
}
|
}
|
||||||
|
# todo: this dictionary need to be completed, a data science student task?
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def sky_temperature(ambient_temperature):
|
def sky_temperature(ambient_temperature):
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
"""
|
"""
|
||||||
Hub version number
|
Hub version number
|
||||||
"""
|
"""
|
||||||
__version__ = '0.1.7.13'
|
__version__ = '0.1.7.14'
|
||||||
|
@ -10,6 +10,8 @@ import subprocess
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
|
import pandas as pd
|
||||||
|
|
||||||
from hub.city_model_structure.city import City
|
from hub.city_model_structure.city import City
|
||||||
from hub.imports.geometry_factory import GeometryFactory
|
from hub.imports.geometry_factory import GeometryFactory
|
||||||
from hub.imports.results_factory import ResultFactory
|
from hub.imports.results_factory import ResultFactory
|
||||||
@ -65,23 +67,36 @@ class TestCityMerge(TestCase):
|
|||||||
ResultFactory('sra', full_city, output_path).enrich()
|
ResultFactory('sra', full_city, output_path).enrich()
|
||||||
self.assertEqual(17, len(full_city.buildings), 'Wrong number of buildings')
|
self.assertEqual(17, len(full_city.buildings), 'Wrong number of buildings')
|
||||||
merged_city = full_city.merge(par_city)
|
merged_city = full_city.merge(par_city)
|
||||||
buildings_with_radiation = 0
|
merged_city_building_total_radiation = 0
|
||||||
for building in merged_city.buildings:
|
for building in merged_city.buildings:
|
||||||
radiation = True
|
|
||||||
for surface in building.surfaces:
|
for surface in building.surfaces:
|
||||||
if not surface.global_irradiance:
|
if surface.global_irradiance:
|
||||||
radiation = False
|
merged_city_building_total_radiation += surface.global_irradiance[cte.YEAR].iloc[0, 0]
|
||||||
if radiation:
|
self.assertEqual(447383461, merged_city_building_total_radiation)
|
||||||
buildings_with_radiation += 1
|
|
||||||
self.assertEqual(17, buildings_with_radiation, 'Some buildings have radiation')
|
|
||||||
merged_city = par_city.merge(full_city)
|
merged_city = par_city.merge(full_city)
|
||||||
buildings_with_radiation = 0
|
merged_city_building_total_radiation = 0
|
||||||
for building in merged_city.buildings:
|
for building in merged_city.buildings:
|
||||||
radiation = True
|
|
||||||
for surface in building.surfaces:
|
for surface in building.surfaces:
|
||||||
if not surface.global_irradiance:
|
if surface.global_irradiance:
|
||||||
radiation = False
|
merged_city_building_total_radiation += surface.global_irradiance[cte.YEAR].iloc[0, 0]
|
||||||
if radiation:
|
self.assertEqual(447383461, merged_city_building_total_radiation)
|
||||||
buildings_with_radiation += 1
|
|
||||||
self.assertEqual(17, buildings_with_radiation, 'Some buildings have radiation')
|
for building in par_city.buildings:
|
||||||
|
for surface in building.surfaces:
|
||||||
|
surface.global_irradiance[cte.YEAR] = pd.DataFrame([3], columns=['sra_mockup_value'])
|
||||||
|
|
||||||
|
merged_city = full_city.merge(par_city)
|
||||||
|
merged_city_building_total_radiation = 0
|
||||||
|
for building in merged_city.buildings:
|
||||||
|
for surface in building.surfaces:
|
||||||
|
if surface.global_irradiance:
|
||||||
|
merged_city_building_total_radiation += surface.global_irradiance[cte.YEAR].iloc[0, 0]
|
||||||
|
self.assertEqual(202699159, merged_city_building_total_radiation)
|
||||||
|
merged_city = par_city.merge(full_city)
|
||||||
|
merged_city_building_total_radiation = 0
|
||||||
|
for building in merged_city.buildings:
|
||||||
|
for surface in building.surfaces:
|
||||||
|
if surface.global_irradiance:
|
||||||
|
merged_city_building_total_radiation += surface.global_irradiance[cte.YEAR].iloc[0, 0]
|
||||||
|
self.assertEqual(202699159, merged_city_building_total_radiation)
|
||||||
|
|
||||||
|
@ -104,7 +104,6 @@ class TestConstructionFactory(TestCase):
|
|||||||
self.assertIsNone(building.households, 'building households is not none')
|
self.assertIsNone(building.households, 'building households is not none')
|
||||||
self.assertFalse(building.is_conditioned, 'building is conditioned')
|
self.assertFalse(building.is_conditioned, 'building is conditioned')
|
||||||
self.assertIsNotNone(building.shell, 'building shell is none')
|
self.assertIsNotNone(building.shell, 'building shell is none')
|
||||||
self.assertIsNone(building.aliases, 'building alias is not none')
|
|
||||||
|
|
||||||
def _check_thermal_zones(self, internal_zone):
|
def _check_thermal_zones(self, internal_zone):
|
||||||
for thermal_zone in internal_zone.thermal_zones:
|
for thermal_zone in internal_zone.thermal_zones:
|
||||||
|
@ -80,7 +80,7 @@ class Control:
|
|||||||
ConstructionFactory('nrcan', self._city).enrich()
|
ConstructionFactory('nrcan', self._city).enrich()
|
||||||
UsageFactory('nrcan', self._city).enrich()
|
UsageFactory('nrcan', self._city).enrich()
|
||||||
WeatherFactory('epw', self._city).enrich()
|
WeatherFactory('epw', self._city).enrich()
|
||||||
ExportsFactory('sra', self._city, output_path, weather_file=weather_file, weather_format='epw').export()
|
ExportsFactory('sra', self._city, output_path).export()
|
||||||
sra_file = str((output_path / f'{self._city.name}_sra.xml').resolve())
|
sra_file = str((output_path / f'{self._city.name}_sra.xml').resolve())
|
||||||
subprocess.run([self.sra, sra_file], stdout=subprocess.DEVNULL)
|
subprocess.run([self.sra, sra_file], stdout=subprocess.DEVNULL)
|
||||||
ResultFactory('sra', self._city, output_path).enrich()
|
ResultFactory('sra', self._city, output_path).enrich()
|
||||||
|
@ -49,7 +49,7 @@ class TestResultsImport(TestCase):
|
|||||||
self.assertIsNotNone(surface.global_irradiance)
|
self.assertIsNotNone(surface.global_irradiance)
|
||||||
|
|
||||||
def test_meb_import(self):
|
def test_meb_import(self):
|
||||||
ExportsFactory('sra', self._city, self._output_path, weather_file='CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw', weather_format='epw').export()
|
ExportsFactory('sra', self._city, self._output_path).export()
|
||||||
sra_path = (self._output_path / f'{self._city.name}_sra.xml').resolve()
|
sra_path = (self._output_path / f'{self._city.name}_sra.xml').resolve()
|
||||||
subprocess.run(['sra', str(sra_path)])
|
subprocess.run(['sra', str(sra_path)])
|
||||||
ResultFactory('sra', self._city, self._output_path).enrich()
|
ResultFactory('sra', self._city, self._output_path).enrich()
|
||||||
@ -67,7 +67,7 @@ class TestResultsImport(TestCase):
|
|||||||
|
|
||||||
def test_peak_loads(self):
|
def test_peak_loads(self):
|
||||||
# todo: this is not technically a import
|
# todo: this is not technically a import
|
||||||
ExportsFactory('sra', self._city, self._output_path, weather_file='CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw', weather_format='epw').export()
|
ExportsFactory('sra', self._city, self._output_path).export()
|
||||||
sra_path = (self._output_path / f'{self._city.name}_sra.xml').resolve()
|
sra_path = (self._output_path / f'{self._city.name}_sra.xml').resolve()
|
||||||
subprocess.run(['sra', str(sra_path)])
|
subprocess.run(['sra', str(sra_path)])
|
||||||
ResultFactory('sra', self._city, self._output_path).enrich()
|
ResultFactory('sra', self._city, self._output_path).enrich()
|
||||||
|
@ -15,11 +15,11 @@ class TestSystemsCatalog(TestCase):
|
|||||||
catalog = EnergySystemsCatalogFactory('montreal_custom').catalog
|
catalog = EnergySystemsCatalogFactory('montreal_custom').catalog
|
||||||
catalog_categories = catalog.names()
|
catalog_categories = catalog.names()
|
||||||
archetypes = catalog.names('archetypes')
|
archetypes = catalog.names('archetypes')
|
||||||
self.assertEqual(18, len(archetypes['archetypes']))
|
self.assertEqual(19, len(archetypes['archetypes']))
|
||||||
systems = catalog.names('systems')
|
systems = catalog.names('systems')
|
||||||
self.assertEqual(16, len(systems['systems']))
|
self.assertEqual(18, len(systems['systems']))
|
||||||
generation_equipments = catalog.names('generation_equipments')
|
generation_equipments = catalog.names('generation_equipments')
|
||||||
self.assertEqual(6, len(generation_equipments['generation_equipments']))
|
self.assertEqual(7, len(generation_equipments['generation_equipments']))
|
||||||
distribution_equipments = catalog.names('distribution_equipments')
|
distribution_equipments = catalog.names('distribution_equipments')
|
||||||
self.assertEqual(8, len(distribution_equipments['distribution_equipments']))
|
self.assertEqual(8, len(distribution_equipments['distribution_equipments']))
|
||||||
emission_equipments = catalog.names('emission_equipments')
|
emission_equipments = catalog.names('emission_equipments')
|
||||||
|
Loading…
Reference in New Issue
Block a user