some refactoring
This commit is contained in:
parent
4ce9f99e4d
commit
8b66e20e9a
|
@ -558,6 +558,7 @@ class Idf:
|
||||||
self._add_lighting(thermal_zone, building.name)
|
self._add_lighting(thermal_zone, building.name)
|
||||||
self._add_appliances(thermal_zone, building.name)
|
self._add_appliances(thermal_zone, building.name)
|
||||||
self._add_dhw(thermal_zone, building.name)
|
self._add_dhw(thermal_zone, building.name)
|
||||||
|
# todo: @Guille: if export_type is not surfaces, we don't differentiate between shadows and buildings?
|
||||||
if self._export_type == "Surfaces":
|
if self._export_type == "Surfaces":
|
||||||
if building.name in self._target_buildings or building.name in self._adjacent_buildings:
|
if building.name in self._target_buildings or building.name in self._adjacent_buildings:
|
||||||
if building.thermal_zones_from_internal_zones is not None:
|
if building.thermal_zones_from_internal_zones is not None:
|
||||||
|
|
|
@ -12,7 +12,7 @@ import csv
|
||||||
import hub.helpers.constants as cte
|
import hub.helpers.constants as cte
|
||||||
|
|
||||||
|
|
||||||
class EnergyPlusWorkflow:
|
class EnergyPlusSingleBuilding:
|
||||||
def __init__(self, city, base_path):
|
def __init__(self, city, base_path):
|
||||||
self._city = city
|
self._city = city
|
||||||
self._base_path = base_path
|
self._base_path = base_path
|
||||||
|
@ -59,7 +59,7 @@ class EnergyPlusWorkflow:
|
||||||
total_cooling_demand += float(line[cooling_index])
|
total_cooling_demand += float(line[cooling_index])
|
||||||
building_energy_demands['Cooling (J)'].append(total_cooling_demand)
|
building_energy_demands['Cooling (J)'].append(total_cooling_demand)
|
||||||
for dhw_index in dhw_column_index:
|
for dhw_index in dhw_column_index:
|
||||||
total_dhw_demand += float(line[dhw_index]) * 3600
|
total_dhw_demand += float(line[dhw_index]) * cte.WATTS_HOUR_TO_JULES
|
||||||
building_energy_demands['DHW (J)'].append(total_dhw_demand)
|
building_energy_demands['DHW (J)'].append(total_dhw_demand)
|
||||||
for appliance_index in appliance_column_index:
|
for appliance_index in appliance_column_index:
|
||||||
total_appliance_demand += float(line[appliance_index])
|
total_appliance_demand += float(line[appliance_index])
|
||||||
|
@ -85,8 +85,6 @@ class EnergyPlusWorkflow:
|
||||||
building.domestic_hot_water_heat_demand[cte.HOUR] = building_energy_demands['DHW (J)']
|
building.domestic_hot_water_heat_demand[cte.HOUR] = building_energy_demands['DHW (J)']
|
||||||
building.appliances_electrical_demand[cte.HOUR] = building_energy_demands['Appliances (J)']
|
building.appliances_electrical_demand[cte.HOUR] = building_energy_demands['Appliances (J)']
|
||||||
building.lighting_electrical_demand[cte.HOUR] = building_energy_demands['Lighting (J)']
|
building.lighting_electrical_demand[cte.HOUR] = building_energy_demands['Lighting (J)']
|
||||||
# todo: @Saeed, this a list of ONE value with the total energy of the year, exactly the same as cte.YEAR.
|
|
||||||
# You have to use the method to add hourly values from helpers/monthly_values
|
|
||||||
building.heating_demand[cte.MONTH] = MonthlyValues.get_total_month(building.heating_demand[cte.HOUR])
|
building.heating_demand[cte.MONTH] = MonthlyValues.get_total_month(building.heating_demand[cte.HOUR])
|
||||||
building.cooling_demand[cte.MONTH] = MonthlyValues.get_total_month(building.cooling_demand[cte.HOUR])
|
building.cooling_demand[cte.MONTH] = MonthlyValues.get_total_month(building.cooling_demand[cte.HOUR])
|
||||||
building.domestic_hot_water_heat_demand[cte.MONTH] = (
|
building.domestic_hot_water_heat_demand[cte.MONTH] = (
|
|
@ -10,7 +10,7 @@ from pathlib import Path
|
||||||
from hub.helpers.utils import validate_import_export_type
|
from hub.helpers.utils import validate_import_export_type
|
||||||
from hub.imports.results.insel_monthly_energry_balance import InselMonthlyEnergyBalance
|
from hub.imports.results.insel_monthly_energry_balance import InselMonthlyEnergyBalance
|
||||||
from hub.imports.results.simplified_radiosity_algorithm import SimplifiedRadiosityAlgorithm
|
from hub.imports.results.simplified_radiosity_algorithm import SimplifiedRadiosityAlgorithm
|
||||||
from hub.imports.results.energy_plus_workflow import EnergyPlusWorkflow
|
from hub.imports.results.energy_plus_single_building import EnergyPlusSingleBuilding
|
||||||
|
|
||||||
class ResultFactory:
|
class ResultFactory:
|
||||||
"""
|
"""
|
||||||
|
@ -46,11 +46,11 @@ class ResultFactory:
|
||||||
"""
|
"""
|
||||||
InselMonthlyEnergyBalance(self._city, self._base_path).enrich()
|
InselMonthlyEnergyBalance(self._city, self._base_path).enrich()
|
||||||
|
|
||||||
def _energy_plus_workflow(self):
|
def _energy_plus_single_building(self):
|
||||||
"""
|
"""
|
||||||
Enrich the city with energy plus results
|
Enrich the city with energy plus results
|
||||||
"""
|
"""
|
||||||
EnergyPlusWorkflow(self._city, self._base_path).enrich()
|
EnergyPlusSingleBuilding(self._city, self._base_path).enrich()
|
||||||
|
|
||||||
def enrich(self):
|
def enrich(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -94,7 +94,7 @@ class TestResultsImport(TestCase):
|
||||||
self.assertIsNotNone(building.cooling_peak_load)
|
self.assertIsNotNone(building.cooling_peak_load)
|
||||||
|
|
||||||
def test_energy_plus_results_import(self):
|
def test_energy_plus_results_import(self):
|
||||||
ResultFactory('energy_plus_workflow', self._city, self._example_path).enrich()
|
ResultFactory('energy_plus_single_building', self._city, self._example_path).enrich()
|
||||||
for building in self._city.buildings:
|
for building in self._city.buildings:
|
||||||
csv_output_name = f'{building.name}_out.csv'
|
csv_output_name = f'{building.name}_out.csv'
|
||||||
csv_output_path = (self._example_path / csv_output_name).resolve()
|
csv_output_path = (self._example_path / csv_output_name).resolve()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user