From bc762e48440d2f65c5a7224fda29260f3426b001 Mon Sep 17 00:00:00 2001 From: Peter Yefi Date: Fri, 12 Nov 2021 10:16:22 +0000 Subject: [PATCH] Added export method to export factory --- exports/energy_systems_factory.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/exports/energy_systems_factory.py b/exports/energy_systems_factory.py index 39ff5db3..6cdf5a2e 100644 --- a/exports/energy_systems_factory.py +++ b/exports/energy_systems_factory.py @@ -13,7 +13,7 @@ class EnergySystemsExportFactory: Exports factory class for energy systems """ - def __init__(self, city, user_input, hp_model, data_type='heat', base_path=None): + def __init__(self, city, user_input, hp_model, output_path, data_type='heat', base_path=None): self._city = city if base_path is None: base_path = base_path = Path(Path(__file__).parent.parent / 'data/energy_systems') @@ -21,11 +21,20 @@ class EnergySystemsExportFactory: self._user_input = user_input self._hp_model = hp_model self._data_type = data_type + self._output_path = output_path - def export_heat_pump(self): + def _export_heat_pump(self): """ Exports heat pump performance data as coefficients of some objective function :return: None """ - HeatPumpExport(self._base_path, self._city).run_insel(self._user_input, self._hp_model, self._data_type) + 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)()