Compare commits
4 Commits
feature/di
...
main
Author | SHA1 | Date | |
---|---|---|---|
7bd7b680b3 | |||
|
765784135d | ||
08e7f68adf | |||
|
464abea93a |
@ -10,7 +10,6 @@ import copy
|
|||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
import hub.exports.building_energy.idf_helper as idf_cte
|
import hub.exports.building_energy.idf_helper as idf_cte
|
||||||
import hub.helpers.constants as cte
|
import hub.helpers.constants as cte
|
||||||
@ -48,7 +47,6 @@ class CercIdf(IdfBase):
|
|||||||
_thermostat_added_to_idf = {}
|
_thermostat_added_to_idf = {}
|
||||||
|
|
||||||
def __init__(self, city, output_path, idf_file_path, idd_file_path, epw_file_path, target_buildings=None):
|
def __init__(self, city, output_path, idf_file_path, idd_file_path, epw_file_path, target_buildings=None):
|
||||||
self._start = datetime.now()
|
|
||||||
super().__init__(city, output_path, idf_file_path, idd_file_path, epw_file_path, target_buildings)
|
super().__init__(city, output_path, idf_file_path, idd_file_path, epw_file_path, target_buildings)
|
||||||
self._add_surfaces = IdfSurfaces.add
|
self._add_surfaces = IdfSurfaces.add
|
||||||
self._add_file_schedule = IdfFileSchedule.add
|
self._add_file_schedule = IdfFileSchedule.add
|
||||||
@ -233,7 +231,6 @@ class CercIdf(IdfBase):
|
|||||||
# Merge files
|
# Merge files
|
||||||
self._merge_files()
|
self._merge_files()
|
||||||
self._add_outputs()
|
self._add_outputs()
|
||||||
print(f'{len(self._city.buildings)} buildings export completed in: {datetime.now() - self._start}')
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _energy_plus(self):
|
def _energy_plus(self):
|
||||||
@ -248,5 +245,4 @@ class CercIdf(IdfBase):
|
|||||||
'--readvars',
|
'--readvars',
|
||||||
'--output-prefix', f'{self._city.name}_',
|
'--output-prefix', f'{self._city.name}_',
|
||||||
self._output_file_path]
|
self._output_file_path]
|
||||||
print(cmd)
|
|
||||||
subprocess.run(cmd, cwd=self._output_path)
|
subprocess.run(cmd, cwd=self._output_path)
|
||||||
|
@ -8,10 +8,12 @@ Code contributors: Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concord
|
|||||||
"""
|
"""
|
||||||
import copy
|
import copy
|
||||||
import datetime
|
import datetime
|
||||||
import glob
|
import shutil
|
||||||
import os
|
import subprocess
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from geomeppy import IDF
|
from geomeppy import IDF
|
||||||
|
|
||||||
import hub.helpers.constants as cte
|
import hub.helpers.constants as cte
|
||||||
from hub.city_model_structure.attributes.schedule import Schedule
|
from hub.city_model_structure.attributes.schedule import Schedule
|
||||||
from hub.city_model_structure.building_demand.thermal_zone import ThermalZone
|
from hub.city_model_structure.building_demand.thermal_zone import ThermalZone
|
||||||
@ -529,6 +531,7 @@ class Idf:
|
|||||||
self._remove_sizing_periods()
|
self._remove_sizing_periods()
|
||||||
self._rename_building(self._city.name)
|
self._rename_building(self._city.name)
|
||||||
self._lod = self._city.level_of_detail.geometry
|
self._lod = self._city.level_of_detail.geometry
|
||||||
|
is_target = False
|
||||||
for building in self._city.buildings:
|
for building in self._city.buildings:
|
||||||
is_target = building.name in self._target_buildings or building.name in self._adjacent_buildings
|
is_target = building.name in self._target_buildings or building.name in self._adjacent_buildings
|
||||||
for internal_zone in building.internal_zones:
|
for internal_zone in building.internal_zones:
|
||||||
@ -656,12 +659,20 @@ class Idf:
|
|||||||
self._add_surfaces(building, building.name)
|
self._add_surfaces(building, building.name)
|
||||||
return self._idf
|
return self._idf
|
||||||
|
|
||||||
|
@property
|
||||||
|
def _energy_plus(self):
|
||||||
|
return shutil.which('energyplus')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""
|
cmd = [self._energy_plus,
|
||||||
Start the energy plus simulation
|
'--weather', self._epw_file_path,
|
||||||
"""
|
'--output-directory', self._output_path,
|
||||||
self._idf.run(expandobjects=False, readvars=True, output_directory=self._output_path,
|
'--idd', self._idd_file_path,
|
||||||
output_prefix=f'{self._city.name}_')
|
'--expandobjects',
|
||||||
|
'--readvars',
|
||||||
|
'--output-prefix', f'{self._city.name}_',
|
||||||
|
self._idf_file_path]
|
||||||
|
subprocess.run(cmd, cwd=self._output_path)
|
||||||
|
|
||||||
def _add_block(self, building):
|
def _add_block(self, building):
|
||||||
_points = self._matrix_to_2d_list(building.foot_print.coordinates)
|
_points = self._matrix_to_2d_list(building.foot_print.coordinates)
|
||||||
|
@ -20,7 +20,7 @@ class EnergyPlus:
|
|||||||
header_parts = header.split(':')
|
header_parts = header.split(':')
|
||||||
building_name = header_parts[0]
|
building_name = header_parts[0]
|
||||||
variable = ':'.join(header_parts[1:]).strip() # concat the rest and ensure that : it's reintroduced just in case
|
variable = ':'.join(header_parts[1:]).strip() # concat the rest and ensure that : it's reintroduced just in case
|
||||||
if variable is '':
|
if variable == '':
|
||||||
continue
|
continue
|
||||||
if building_name not in self._summary_variables:
|
if building_name not in self._summary_variables:
|
||||||
self._building_energy_demands[variable] = [] # initialize the list of variables
|
self._building_energy_demands[variable] = [] # initialize the list of variables
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
"""
|
"""
|
||||||
Hub version number
|
Hub version number
|
||||||
"""
|
"""
|
||||||
__version__ = '0.3.0.3'
|
__version__ = '0.3.0.5'
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
xmltodict
|
xmltodict
|
||||||
numpy==1.26.4
|
numpy
|
||||||
trimesh[all]
|
trimesh[all]
|
||||||
pyproj
|
pyproj
|
||||||
pandas
|
pandas
|
||||||
|
1
setup.py
1
setup.py
@ -59,6 +59,7 @@ setup(
|
|||||||
'hub.exports',
|
'hub.exports',
|
||||||
'hub.exports.building_energy',
|
'hub.exports.building_energy',
|
||||||
'hub.exports.building_energy.idf_files',
|
'hub.exports.building_energy.idf_files',
|
||||||
|
'hub.exports.building_energy.idf_helper',
|
||||||
'hub.exports.building_energy.insel',
|
'hub.exports.building_energy.insel',
|
||||||
'hub.exports.energy_systems',
|
'hub.exports.energy_systems',
|
||||||
'hub.exports.formats',
|
'hub.exports.formats',
|
||||||
|
@ -144,7 +144,8 @@ class TestExports(TestCase):
|
|||||||
UsageFactory('nrcan', city).enrich()
|
UsageFactory('nrcan', city).enrich()
|
||||||
WeatherFactory('epw', city).enrich()
|
WeatherFactory('epw', city).enrich()
|
||||||
try:
|
try:
|
||||||
idf = EnergyBuildingsExportsFactory('idf', city, self._output_path).export()
|
_idf = EnergyBuildingsExportsFactory('idf', city, self._output_path).export()
|
||||||
|
_idf.run()
|
||||||
except Exception:
|
except Exception:
|
||||||
self.fail("Idf ExportsFactory raised ExceptionType unexpectedly!")
|
self.fail("Idf ExportsFactory raised ExceptionType unexpectedly!")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user