diff --git a/exports/energy_systems/heat_pump_export.py b/exports/energy_systems/heat_pump_export.py index 59862cd1..754b578a 100644 --- a/exports/energy_systems/heat_pump_export.py +++ b/exports/energy_systems/heat_pump_export.py @@ -16,7 +16,7 @@ class HeatPumpExport: of some defined function """ - def __init__(self, base_path, city): + def __init__(self, base_path, city, output_path): self._template_path = (base_path / 'heat_pumps/template.txt') self._constants_path = (base_path / 'heat_pumps/constants.yaml') # needed to compute max demand. @@ -24,6 +24,7 @@ class HeatPumpExport: self._city = city self._input_data = None self._base_path = base_path + self._output_path = output_path def run_insel(self, user_input: Dict, hp_model: str, data_type: str) -> None: """ @@ -49,8 +50,8 @@ class HeatPumpExport: try: # run insel insel_template_handler = open(self._template_path, "r") - insel_template_handler = insel_template_handler.read() - insel_template = Template(insel_template_handler).substitute(self._input_data) + insel_template_content = insel_template_handler.read() + insel_template = Template(insel_template_content).substitute(self._input_data) # create the insel file and write the template with substituted values into it insel_file = (self._base_path / 'heat_pumps/dompark_heat_pump.insel') insel_file_handler = open(insel_file, "w") @@ -211,4 +212,5 @@ class HeatPumpExport: df = df.append(df.agg(['sum'])) s = pd.Series(["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec", "Total"]) df = df.set_index([s]) - print(df) + df.to_csv(self._output_path) +