Fixed issue with coefficient computation
This commit is contained in:
parent
f6de5b6f96
commit
ebe5439f02
|
@ -86,7 +86,7 @@ class XlsxHeatPumpParameters:
|
||||||
self._city.add_city_object(energy_system)
|
self._city.add_city_object(energy_system)
|
||||||
return self._city
|
return self._city
|
||||||
|
|
||||||
def _extract_heat_pump_data(self, heat_pump_capacity_data) -> [List, List]:
|
def _extract_heat_pump_data(self, heat_pump_capacity_data: Dict) -> [List, List]:
|
||||||
"""
|
"""
|
||||||
Fetches a list of metric based data for heat pump for various temperature,
|
Fetches a list of metric based data for heat pump for various temperature,
|
||||||
eg. cooling capacity data for 12 capacity heat pump
|
eg. cooling capacity data for 12 capacity heat pump
|
||||||
|
@ -102,7 +102,7 @@ class XlsxHeatPumpParameters:
|
||||||
compressor_power_data.append(metric_data[1])
|
compressor_power_data.append(metric_data[1])
|
||||||
return [cooling_heating_capacity_data, compressor_power_data]
|
return [cooling_heating_capacity_data, compressor_power_data]
|
||||||
|
|
||||||
def _compute_coefficients(self, heat_pump_data, data_type="heat") -> List[float]:
|
def _compute_coefficients(self, heat_pump_data: List, data_type="heat") -> List[float]:
|
||||||
"""
|
"""
|
||||||
Compute heat output and electrical demand coefficients
|
Compute heat output and electrical demand coefficients
|
||||||
from heating and cooling performance data
|
from heating and cooling performance data
|
||||||
|
@ -111,10 +111,15 @@ class XlsxHeatPumpParameters:
|
||||||
or heating performance data
|
or heating performance data
|
||||||
:return: Tuple[Dict, Dict]
|
:return: Tuple[Dict, Dict]
|
||||||
"""
|
"""
|
||||||
out_temp = [25, 30, 32, 35, 40, 45] * 6
|
# Determine the recurrence of temperature values. 6 repetitions for
|
||||||
|
# cooling performance and 5 repetition for heating performance
|
||||||
|
temp_multiplier = 5 if data_type == "heat" else 6
|
||||||
|
out_temp = [25, 30, 32, 35, 40, 45] * temp_multiplier
|
||||||
|
|
||||||
heat_x_values = np.repeat([-5, 0, 7, 10, 15], 6)
|
heat_x_values = np.repeat([-5, 0, 7, 10, 15], 6)
|
||||||
cool_x_values = np.repeat([6, 7, 8, 9, 10, 11], 6)
|
cool_x_values = np.repeat([6, 7, 8, 9, 10, 11], 6)
|
||||||
x_values = heat_x_values if data_type == "heat" else cool_x_values
|
x_values = heat_x_values if data_type == "heat" else cool_x_values
|
||||||
|
x_values = x_values.tolist()
|
||||||
# convert list of lists to one list
|
# convert list of lists to one list
|
||||||
heat_pump_data = list(itertools.chain.from_iterable(heat_pump_data))
|
heat_pump_data = list(itertools.chain.from_iterable(heat_pump_data))
|
||||||
|
|
||||||
|
@ -122,7 +127,7 @@ class XlsxHeatPumpParameters:
|
||||||
popt, _ = curve_fit(self._objective_function, [x_values, out_temp], heat_pump_data)
|
popt, _ = curve_fit(self._objective_function, [x_values, out_temp], heat_pump_data)
|
||||||
return popt.tolist()
|
return popt.tolist()
|
||||||
|
|
||||||
def _objective_function(self, xdata, a1, a2, a3, a4, a5, a6) -> float:
|
def _objective_function(self, xdata: List, a1: float, a2: float, a3: float, a4: float, a5: float, a6: float) -> float:
|
||||||
"""
|
"""
|
||||||
Objective function for computing coefficients
|
Objective function for computing coefficients
|
||||||
:param xdata:
|
:param xdata:
|
||||||
|
|
|
@ -19,7 +19,7 @@ class EnergySystemsFactory:
|
||||||
self._city = city
|
self._city = city
|
||||||
self._base_path = base_path
|
self._base_path = base_path
|
||||||
|
|
||||||
def _xlsx_heat_pump(self):
|
def _xlsx_heat_pump_parameters(self):
|
||||||
"""
|
"""
|
||||||
Enrich the city by using xlsx heat pump information
|
Enrich the city by using xlsx heat pump information
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user