Correct error in meb (temporary workaround)

This commit is contained in:
Guille Gutierrez 2023-08-22 10:25:40 -04:00
parent 30908eda6d
commit 491b976fd9

View File

@ -4,7 +4,7 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project Coder Guillermo.GutierrezMorote@concordia.ca
"""
import logging
from pathlib import Path
import csv
@ -43,6 +43,9 @@ class InselMonthlyEnergyBalance:
domestic_hot_water_demand = []
lighting_demand = []
appliances_demand = []
# todo: REFACTOR after retrofit project, this is a hack for the pickle files
try:
if building.internal_zones[0].thermal_zones_from_internal_zones is None:
domestic_hot_water_demand = [0] * 12
lighting_demand = [0] * 12
@ -90,6 +93,11 @@ class InselMonthlyEnergyBalance:
)
total_dhw_demand += total_day * cte.WEEK_DAYS_A_MONTH[day_type][month] * demand
domestic_hot_water_demand.append(total_dhw_demand * area)
except AttributeError:
domestic_hot_water_demand = [0] * 12
lighting_demand = [0] * 12
appliances_demand = [0] * 12
logging.warning('Building internal zone raised an error, most likely the building has missing archetypes')
building.domestic_hot_water_heat_demand[cte.MONTH] = domestic_hot_water_demand
building.domestic_hot_water_heat_demand[cte.YEAR] = [sum(domestic_hot_water_demand)]