setting to 0 values when the building cannot be calculated
This commit is contained in:
parent
d3bd6e782c
commit
59aa2b9494
|
@ -9,6 +9,7 @@ import pandas as pd
|
||||||
import sys
|
import sys
|
||||||
import csv
|
import csv
|
||||||
from insel.insel import Insel
|
from insel.insel import Insel
|
||||||
|
from hub.hub_logger import logger
|
||||||
|
|
||||||
|
|
||||||
class MonthlyDemandCalculation(Insel):
|
class MonthlyDemandCalculation(Insel):
|
||||||
|
@ -22,8 +23,14 @@ class MonthlyDemandCalculation(Insel):
|
||||||
file_name = building.name + '.out'
|
file_name = building.name + '.out'
|
||||||
full_path_out = Path(self._path / file_name).resolve()
|
full_path_out = Path(self._path / file_name).resolve()
|
||||||
full_path_out.parent.mkdir(parents=True, exist_ok=True)
|
full_path_out.parent.mkdir(parents=True, exist_ok=True)
|
||||||
try:
|
if Path(full_path_out).is_file():
|
||||||
building.heating['month'], building.cooling['month'] = self._demand(full_path_out)
|
building.heating['month'], building.cooling['month'] = self._demand(full_path_out)
|
||||||
|
else:
|
||||||
|
building.heating['month'] = pd.DataFrame([0] * 12, columns=['INSEL'])
|
||||||
|
building.cooling['month'] = pd.DataFrame([0] * 12, columns=['INSEL'])
|
||||||
|
logger.error(f'Building {building.name} could not be processed. Heating and cooling set to 0\n')
|
||||||
|
sys.stderr.write(f'Building {building.name} could not be processed. Heating and cooling set to 0\n')
|
||||||
|
|
||||||
heating_year = 0
|
heating_year = 0
|
||||||
for value in building.heating['month']['INSEL']:
|
for value in building.heating['month']['INSEL']:
|
||||||
if value == 'NaN':
|
if value == 'NaN':
|
||||||
|
@ -40,11 +47,6 @@ class MonthlyDemandCalculation(Insel):
|
||||||
yearly_cooling = pd.DataFrame([cooling_year], columns=['INSEL'])
|
yearly_cooling = pd.DataFrame([cooling_year], columns=['INSEL'])
|
||||||
building.cooling['year'] = yearly_cooling
|
building.cooling['year'] = yearly_cooling
|
||||||
|
|
||||||
except ValueError:
|
|
||||||
print(sys.exc_info()[1])
|
|
||||||
print('Building ' + building.name + ' could not be processed')
|
|
||||||
continue
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _demand(insel_outputs_path):
|
def _demand(insel_outputs_path):
|
||||||
heating = []
|
heating = []
|
||||||
|
|
|
@ -26,7 +26,6 @@ _DAYS_A_MONTH = {cte.MONDAY: [5, 4, 4, 5, 4, 4, 5, 4, 4, 5, 4, 5],
|
||||||
class MonthlyEnergyBalance:
|
class MonthlyEnergyBalance:
|
||||||
def __init__(self, city, path, attic_heated_case, basement_heated_case, weather_format):
|
def __init__(self, city, path, attic_heated_case, basement_heated_case, weather_format):
|
||||||
self._city = city
|
self._city = city
|
||||||
print(path)
|
|
||||||
self._path = path
|
self._path = path
|
||||||
self._weather_format = weather_format
|
self._weather_format = weather_format
|
||||||
for building in self._city.buildings:
|
for building in self._city.buildings:
|
||||||
|
@ -113,6 +112,10 @@ class MonthlyEnergyBalance:
|
||||||
for building in self._city.buildings:
|
for building in self._city.buildings:
|
||||||
lighting_demand = []
|
lighting_demand = []
|
||||||
appliances_demand = []
|
appliances_demand = []
|
||||||
|
if building.internal_zones[0].thermal_zones is None:
|
||||||
|
lighting_demand = [0] * 12
|
||||||
|
appliances_demand = [0] * 12
|
||||||
|
else:
|
||||||
thermal_zone = building.internal_zones[0].thermal_zones[0]
|
thermal_zone = building.internal_zones[0].thermal_zones[0]
|
||||||
area = thermal_zone.total_floor_area
|
area = thermal_zone.total_floor_area
|
||||||
|
|
||||||
|
|
4
tmp/.gitignore
vendored
4
tmp/.gitignore
vendored
|
@ -1,4 +0,0 @@
|
||||||
# Ignore everything in this directory
|
|
||||||
*
|
|
||||||
# Except this file
|
|
||||||
!.gitignore
|
|
Loading…
Reference in New Issue
Block a user