hub/exports/energy_systems_factory.py

41 lines
1.2 KiB
Python
Raw Normal View History

2021-10-29 11:28:10 -04:00
"""
EnergySystemsFactory exports energy systems into several formats
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Peter Yefi peteryefi@gmail.com
"""
from pathlib import Path
from exports.energy_systems.heat_pump_export import HeatPumpExport
class EnergySystemsExportFactory:
2021-10-29 11:28:10 -04:00
"""
Exports factory class for energy systems
"""
2021-11-12 05:16:22 -05:00
def __init__(self, city, user_input, hp_model, output_path, data_type='heat', base_path=None):
2021-10-29 11:28:10 -04:00
self._city = city
if base_path is None:
base_path = base_path = Path(Path(__file__).parent.parent / 'data/energy_systems')
self._base_path = base_path
self._user_input = user_input
self._hp_model = hp_model
self._data_type = data_type
2021-11-12 05:16:22 -05:00
self._output_path = output_path
2021-10-29 11:28:10 -04:00
2021-11-12 05:16:22 -05:00
def _export_heat_pump(self):
2021-10-29 11:28:10 -04:00
"""
Exports heat pump performance data as coefficients
of some objective function
:return: None
"""
2021-11-12 05:16:22 -05:00
HeatPumpExport(self._base_path, self._city, self._output_path)\
.run_insel(self._user_input, self._hp_model, self._data_type)
def export(self):
"""
Export the city given to the class using the given export type handler
:return: None
"""
return getattr(self, '_export_heat_pump', lambda: None)()