2021-12-15 04:25:56 -05:00
|
|
|
"""
|
|
|
|
Test EnergySystemsFactory and various heatpump models
|
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
2022-04-08 09:35:33 -04:00
|
|
|
Copyright © 2022 Concordia CERC group
|
|
|
|
Project Coder Peter Yefi peteryefi@gmail.com
|
2021-12-15 04:25:56 -05:00
|
|
|
"""
|
|
|
|
from unittest import TestCase
|
|
|
|
from imports.geometry_factory import GeometryFactory
|
|
|
|
from imports.energy_systems_factory import EnergySystemsFactory
|
|
|
|
from city_model_structure.energy_systems.water_to_water_hp import WaterToWaterHP
|
2022-01-29 09:43:57 -05:00
|
|
|
from exports.energy_systems_factory import EnergySystemsExportFactory
|
|
|
|
import pandas as pd
|
2021-12-15 04:25:56 -05:00
|
|
|
|
|
|
|
import os
|
|
|
|
|
2022-08-16 13:48:43 -04:00
|
|
|
# User defined paramenters
|
|
|
|
user_input = {
|
|
|
|
'StartYear': 2020,
|
|
|
|
'EndYear': 2021,
|
|
|
|
'MaximumHPEnergyInput': 8000,
|
|
|
|
'HoursOfStorageAtMaxDemand': 1,
|
|
|
|
'BuildingSuppTemp': 40,
|
|
|
|
'TemperatureDifference': 15,
|
|
|
|
'FuelLHV': 47100,
|
|
|
|
'FuelPrice': 0.12,
|
|
|
|
'FuelEF': 1887,
|
|
|
|
'FuelDensity': 0.717,
|
|
|
|
'HPSupTemp': 60
|
|
|
|
}
|
|
|
|
|
2021-12-15 04:25:56 -05:00
|
|
|
|
|
|
|
class TestEnergySystemsFactory(TestCase):
|
|
|
|
"""
|
2022-01-29 09:43:57 -05:00
|
|
|
TestEnergySystemsFactory for Water to Water HP
|
2021-12-15 04:25:56 -05:00
|
|
|
"""
|
|
|
|
|
|
|
|
def setUp(self) -> None:
|
|
|
|
"""
|
|
|
|
Test setup
|
|
|
|
:return: None
|
|
|
|
"""
|
|
|
|
city_file = "../unittests/tests_data/C40_Final.gml"
|
2022-01-29 09:43:57 -05:00
|
|
|
self._output_path = "../unittests/tests_data/w2w_user_output.csv"
|
2022-11-21 13:53:58 -05:00
|
|
|
self._city = GeometryFactory('citygml', path=city_file).city
|
2021-12-15 04:25:56 -05:00
|
|
|
EnergySystemsFactory('water to water hp', self._city).enrich()
|
|
|
|
|
2022-01-29 09:43:57 -05:00
|
|
|
def test_water_to_water_heat_pump_import(self):
|
2021-12-15 04:25:56 -05:00
|
|
|
self.assertIsNotNone(self._city.energy_systems, 'City has energy systems')
|
|
|
|
self.assertIsInstance(self._city.energy_systems[0].water_to_water_hp, WaterToWaterHP)
|
|
|
|
self.assertEqual(self._city.energy_systems[0].water_to_water_hp.model, 'ClimateMaster 156 kW')
|
|
|
|
self.assertEqual(self._city.energy_systems[2].water_to_water_hp.model, 'ClimateMaster 335 kW')
|
|
|
|
|
2022-01-29 09:43:57 -05:00
|
|
|
def test_water_to_water_heat_pump_export(self):
|
|
|
|
# User defined paramenters
|
|
|
|
user_input = {
|
|
|
|
'StartYear': 2020,
|
|
|
|
'EndYear': 2021,
|
|
|
|
'MaximumHPEnergyInput': 8000,
|
|
|
|
'HoursOfStorageAtMaxDemand': 1,
|
|
|
|
'BuildingSuppTemp': 40,
|
|
|
|
'TemperatureDifference': 15,
|
|
|
|
'FuelLHV': 47100,
|
|
|
|
'FuelPrice': 0.12,
|
|
|
|
'FuelEF': 1887,
|
|
|
|
'FuelDensity': 0.717,
|
2022-11-23 10:53:09 -05:00
|
|
|
'HPSupTemp': 60,
|
|
|
|
'b1': 10,
|
|
|
|
'b2': 10,
|
|
|
|
'b3': 10,
|
|
|
|
'b4': 10,
|
|
|
|
'b5': 10,
|
|
|
|
'b6': 10,
|
|
|
|
'b7': 10,
|
|
|
|
'b8': 10,
|
|
|
|
'b9': 10,
|
|
|
|
'b10': 10,
|
|
|
|
'b11': 10
|
2022-01-29 09:43:57 -05:00
|
|
|
}
|
|
|
|
|
2022-08-16 13:48:43 -04:00
|
|
|
EnergySystemsExportFactory(city=self._city, user_input=user_input, hp_model='ClimateMaster 256 kW',
|
|
|
|
output_path=self._output_path, sim_type=1).export('water')
|
2022-01-29 09:43:57 -05:00
|
|
|
df = pd.read_csv(self._output_path)
|
2022-08-16 13:48:43 -04:00
|
|
|
self.assertEqual(df.shape, (13, 3))
|
|
|
|
self.assertEqual(df.iloc[0, 1], 1031544.62)
|
2022-01-29 09:43:57 -05:00
|
|
|
|
2021-12-15 04:25:56 -05:00
|
|
|
def tearDown(self) -> None:
|
|
|
|
try:
|
|
|
|
os.remove(self._output_path)
|
|
|
|
except OSError:
|
|
|
|
pass
|