Modified coefficient computation for water to water hp

This commit is contained in:
Peter Yefi 2022-03-17 10:37:47 -04:00
parent a8e44d5e30
commit 73593744b7
7 changed files with 1707 additions and 1679 deletions

View File

@ -20,7 +20,6 @@ class WaterToWaterHP(HeatPump):
self._total_cooling_capacity = None
self._power_demand = None
self._flow_rate = None
self._heat_output_coff = None # b coefficients
self._power_demand_coff = None # a coefficients
@property
@ -112,24 +111,6 @@ class WaterToWaterHP(HeatPump):
if self._flow_rate is None:
self._flow_rate = value
@property
def heat_output_coff(self) -> List[float]:
"""
Get coefficients for total cooling capacity
:return: [[float]]
"""
return self._heat_output_coff
@heat_output_coff.setter
def heat_output_coff(self, value):
"""
Set coefficients for totol cooling capacity
:param value: [[float]]
:return:
"""
if self._heat_output_coff is None:
self._heat_output_coff = value
@property
def power_demand_coff(self) -> List[float]:
"""

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -71,17 +71,6 @@ class HeatPumpExport:
Write headers to the various csv file generated by insel
:return:
"""
file_one_headers = ['Year', ' Month', ' Day', 'Hour', 'Minute', 'HP Heat Output (kW)',
'HP Electricity Consumption (kW)', 'HP COP', 'TES Charging Rate (kg/s)',
'TES Discharging Rate (kg/s)', 'TES Node 1 Temperature', 'TES Node 2 Temperature',
'TES Node 3 Temperature', 'TES Node 4 Temperature', 'TES Energy Content (J)',
'TES Energy Content (kWh)', 'TES Energy Content Variation (kWh)',
'Auxiliary Heater Fuel Flow Rate (kg/s)', 'Auxiliary Heater Energy Input (kW)',
'HP Operational Cost (CAD)', 'Auxiliary Heater Operational Cost (CAD)',
'Operational CO2 Emissions of HP (g)',
'Operational CO2 Emissions of Auxiliary Heater (g)',
'Return Temperature', 'Demand (kW)', 'Test Column']
header_data = {
self._input_data['fileOut1']: ['Year', ' Month', ' Day', 'Hour', 'Minute', 'HP Heat Output (kW)',
'HP Electricity Consumption (kW)', 'HP COP', 'TES Charging Rate (kg/s)',
@ -200,6 +189,7 @@ class HeatPumpExport:
and water to water source heat pump
:return:
"""
self._input_data["a1"] = a_coeff[0]
self._input_data["a2"] = a_coeff[1]
self._input_data["a3"] = a_coeff[2]

View File

@ -26,22 +26,19 @@ class WaterToWaterHPExport(HeatPumpExport):
water_temp = (base_path / 'heat_pumps/wt_hourly3.txt')
super().__init__(base_path, city, output_path, template_path, water_temp)
def _extract_model_coff(self, hp_model: str, data_type='heat') -> Union[Tuple[List, List], None]:
def _extract_model_coff(self, hp_model: str) -> Union[List, None]:
"""
Extracts heat pump coefficient data for a specific
model. e.g 012, 140
model. e.g ClimateMaster 156 kW, etc
:param hp_model: the model type
:param data_type: indicates whether we're extracting cooling
or heating perfarmcn coefficients
:return:
"""
for energy_system in self._city.energy_systems:
if energy_system.water_to_water_hp.model == hp_model:
return energy_system.water_to_water_hp.power_demand_coff, \
energy_system.water_to_water_hp.heat_output_coff
return energy_system.water_to_water_hp.power_demand_coff
return None
def execute_insel(self, user_input, hp_model, data_type):
def execute_insel(self, user_input, hp_model):
"""
Runs insel and produces output files
Runs insel and write the necessary files
@ -49,10 +46,7 @@ class WaterToWaterHPExport(HeatPumpExport):
values necessary to run insel
:param hp_model: a string that indicates the heat
pump model to be used e.g. 012, 015
:param data_type: a string that indicates whether
insel should run for heat or cooling performance
:return:
:return:
"""
pow_demand_coeff, heat_output_coeff = self._extract_model_coff(hp_model, data_type)
super(WaterToWaterHPExport, self)._run_insel(user_input, pow_demand_coeff, heat_output_coeff, 'w2w.insel')
pow_demand_coeff = self._extract_model_coff(hp_model)
super(WaterToWaterHPExport, self)._run_insel(user_input, pow_demand_coeff, 'w2w.insel')

View File

@ -47,7 +47,7 @@ class EnergySystemsExportFactory:
.execute_insel(self._user_input, self._hp_model, self._data_type)
elif source == 'water':
WaterToWaterHPExport(self._base_path, self._city, self._output_path, self._sim_type)\
.execute_insel(self._user_input, self._hp_model, self._data_type)
.execute_insel(self._user_input, self._hp_model)
def export(self, source='air'):
"""

View File

@ -125,24 +125,20 @@ class WaterToWaterHPParameters:
heat_pump.flow_rate = data['fr']
heat_pump.entering_water_temp = data['ewt']
heat_pump.leaving_water_temp = data['lwt']
heat_pump.power_demand_coff = self._compute_coefficients(data, data_type='power')
heat_pump.heat_output_coff = self._compute_coefficients(data)
heat_pump.power_demand_coff = self._compute_coefficients(data)
energy_system = EnergySystem(heat_pump.model, 0, [], None)
energy_system.water_to_water_hp = heat_pump
self._city.add_city_object(energy_system)
return self._city
def _compute_coefficients(self, heat_pump_data: Dict, data_type="heat_output") -> List[float]:
def _compute_coefficients(self, heat_pump_data: Dict) -> List[float]:
"""
Compute heat output and electrical demand coefficients
from heating performance data
:param heat_pump_data: a dictionary of heat pump data.
:param data_type: string to indicate whether coefficient are power demands
or heat output coefficients. Default is heat output
:return: Tuple[Dict, Dict]
"""
demand = heat_pump_data['tc'] if data_type == "heat_output" else heat_pump_data['pd']
demand = [i / j for i, j in zip(heat_pump_data['tc'], heat_pump_data['pd'])]
# Compute heat output coefficients
popt, _ = curve_fit(self._objective_function, [heat_pump_data['ewt'], heat_pump_data['lwt'], heat_pump_data['fr']],