45 lines
1.4 KiB
Python
45 lines
1.4 KiB
Python
"""
|
|
Miscellaneous
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
Copyright © 2022 Project Author Peter Yefi peteryefi@gmail.com
|
|
"""
|
|
from typing import List
|
|
from pathlib import Path
|
|
import numpy as np
|
|
|
|
|
|
hp_models = {
|
|
'air_source': ['012', '015', '018', '023', '030', '033', '037', '044', '047', '057', '070', '087', '097', '102',
|
|
'120', '130', '140'],
|
|
'water_to_water': ['ClimateMaster 156 kW', 'ClimateMaster 256 kW', 'ClimateMaster 335 kW']
|
|
}
|
|
|
|
|
|
def validate_hp_model(hp_type: str, model: str) -> bool:
|
|
"""
|
|
Validates the HP model parameter provided by users
|
|
for running insel simulation
|
|
:param hp_type: the type of heat pump: air source or
|
|
water to water
|
|
:param model: the model of heat pump
|
|
:return: bool
|
|
"""
|
|
if 'air' in hp_type.lower():
|
|
if model in hp_models['air_source']:
|
|
return True
|
|
elif 'water' in hp_type.lower():
|
|
if model in hp_models['water_to_water']:
|
|
return True
|
|
return False
|
|
|
|
|
|
def expand_energy_demand(hourly_energy_demand: List[float]):
|
|
"""
|
|
Replicates each value in the list 11 times and persist the values to a file
|
|
:param hourly_energy_demand: a list of hourly energy demand data
|
|
"""
|
|
energy_demand = Path(Path(__file__).parent.parent / "data/energy_demand.txt")
|
|
with open(energy_demand, 'w') as demand_file:
|
|
repeated_demand_values = np.repeat(hourly_energy_demand, 12).tolist()
|
|
for demand in repeated_demand_values:
|
|
demand_file.write("%.6f\n" % demand) |