fix: all system simulation models are fixed

This commit is contained in:
Saeed Ranjbar 2024-07-26 17:46:42 -04:00
parent 0da942d5a6
commit 9599679c92
5 changed files with 394 additions and 208 deletions

View File

@ -28,8 +28,8 @@ residential_systems_percentage = {'system 1 gas': 100,
'system 8 gas': 0,
'system 8 electricity': 0}
residential_new_systems_percentage = {'PV+ASHP+GasBoiler+TES': 0,
'PV+4Pipe+DHW': 100,
residential_new_systems_percentage = {'PV+ASHP+GasBoiler+TES': 100,
'PV+4Pipe+DHW': 0,
'Central Heating+Unitary Cooling+Unitary DHW': 0,
'Central Heating+Unitary Cooling+Unitary DHW+PV': 0,
'PV+ASHP+ElectricBoiler+TES': 0,

View File

@ -19,6 +19,8 @@ class Archetype1:
self._hourly_dhw_demand = building.domestic_hot_water_heat_demand[cte.HOUR]
self._output_path = output_path
self._t_out = [0] + building.external_temperature[cte.HOUR]
self.results = {}
self.dt = 900
def hvac_sizing(self):
storage_factor = 3
@ -29,13 +31,26 @@ class Archetype1:
heat_pump.nominal_cooling_output = round(self._cooling_peak_load / 3600)
boiler.nominal_heat_output = round(0.5 * self._heating_peak_load / 3600)
thermal_storage.volume = round(
(self._heating_peak_load * storage_factor) / (cte.WATER_HEAT_CAPACITY * cte.WATER_DENSITY * 30))
(self._heating_peak_load * storage_factor * cte.WATTS_HOUR_TO_JULES) /
(cte.WATER_HEAT_CAPACITY * cte.WATER_DENSITY * 25))
return heat_pump, boiler, thermal_storage
def dhw_sizing(self):
storage_factor = 3
dhw_hp = self._dhw_system.generation_systems[0]
dhw_hp.nominal_heat_output = 0.7 * self._domestic_hot_water_peak_load
dhw_hp.source_temperature = self._t_out
dhw_tes = dhw_hp.energy_storage_systems[0]
dhw_tes.volume = round(
(self._domestic_hot_water_peak_load * storage_factor * 3600) / (cte.WATER_HEAT_CAPACITY * cte.WATER_DENSITY * 10))
return dhw_hp, dhw_tes
def heating_system_simulation(self):
hp, boiler, tes = self.hvac_sizing()
cop_curve_coefficients = [float(coefficient) for coefficient in hp.heat_efficiency_curve.coefficients]
demand = self._hourly_heating_demand
number_of_ts = int(cte.HOUR_TO_SECONDS / self.dt)
demand = [0] + [x for x in self._hourly_heating_demand for _ in range(number_of_ts)]
t_out = [0] + [x for x in self._t_out for _ in range(number_of_ts)]
hp.source_temperature = self._t_out
# Heating System Simulation
variable_names = ["t_sup_hp", "t_tank", "t_ret", "m_ch", "m_dis", "q_hp", "q_boiler", "hp_cop",
@ -61,7 +76,7 @@ class Archetype1:
for i in range(len(demand) - 1):
t_tank[i + 1] = (t_tank[i] +
((m_ch[i] * (t_sup_hp[i] - t_tank[i])) +
(ua * (self._t_out[i] - t_tank[i] + 5)) / cte.WATER_HEAT_CAPACITY -
(ua * (t_out[i] - t_tank[i])) / cte.WATER_HEAT_CAPACITY -
m_dis[i] * (t_tank[i] - t_ret[i])) * (dt / (cte.WATER_DENSITY * v)))
if t_tank[i + 1] < 40:
q_hp[i + 1] = hp_heating_cap
@ -77,16 +92,16 @@ class Archetype1:
t_sup_hp[i + 1] = (q_hp[i + 1] / (m_ch[i + 1] * cte.WATER_HEAT_CAPACITY)) + t_tank[i + 1]
else:
q_hp[i + 1], m_ch[i + 1], t_sup_hp[i + 1] = 0, 0, t_tank[i + 1]
t_sup_hp_fahrenheit = 1.8 * t_sup_hp[i + 1] + 32
t_out_fahrenheit = 1.8 * self._t_out[i + 1] + 32
t_tank_fahrenheit = 1.8 * t_tank[i + 1] + 32
t_out_fahrenheit = 1.8 * t_out[i + 1] + 32
if q_hp[i + 1] > 0:
hp_cop[i + 1] = (cop_curve_coefficients[0] +
cop_curve_coefficients[1] * t_sup_hp_fahrenheit +
cop_curve_coefficients[2] * t_sup_hp_fahrenheit ** 2 +
hp_cop[i + 1] = (1 / (cop_curve_coefficients[0] +
cop_curve_coefficients[1] * t_tank_fahrenheit +
cop_curve_coefficients[2] * t_tank_fahrenheit ** 2 +
cop_curve_coefficients[3] * t_out_fahrenheit +
cop_curve_coefficients[4] * t_out_fahrenheit ** 2 +
cop_curve_coefficients[5] * t_sup_hp_fahrenheit * t_out_fahrenheit)
hp_electricity[i + 1] = q_hp[i + 1] / hp_efficiency
cop_curve_coefficients[5] * t_tank_fahrenheit * t_out_fahrenheit)) * hp_efficiency
hp_electricity[i + 1] = q_hp[i + 1] / hp_cop[i + 1]
else:
hp_cop[i + 1] = 0
hp_electricity[i + 1] = 0
@ -110,101 +125,253 @@ class Archetype1:
boiler_gas[i + 1] = (q_boiler[i + 1] * dt) / cte.NATURAL_GAS_LHV
boiler_consumption[i + 1] = q_boiler[i + 1] / boiler_efficiency
heating_consumption[i + 1] = boiler_consumption[i + 1] + hp_electricity[i + 1]
data = list(zip(self._t_out, q_hp, hp_electricity, hp_cop, m_ch, t_sup_hp, t_tank, m_dis, q_boiler,
boiler_gas, t_sup_boiler, t_ret, demand))
file_name = f'heating_system_simulation_results_{self._name}.csv'
with open(self._output_path / file_name, 'w', newline='') as csvfile:
output_file = csv.writer(csvfile)
# Write header
output_file.writerow(['Outside_air_temperature', 'HP_heat_output(W)', 'HP_heating_electricity_consumption(W)',
'HP_COP', 'TES_charge_flow_rate(kg/s)', 'TES_supply_temperature(C)', 'TES_temperature(C)',
'TES_discharge_flow_rate(kg/s)', 'Boiler_heat_output(W)', 'Boiler_gas_consumption(m3)',
'Boiler_supply_temperature(C)', 'Heating_loop_return_temperature(C)', 'Heating_demand (W)'])
# Write data
output_file.writerows(data)
return heating_consumption, hp_electricity, boiler_consumption, t_sup_hp, t_sup_boiler
tes.temperature = []
hp_electricity_j = [(x * cte.WATTS_HOUR_TO_JULES) / number_of_ts for x in hp_electricity]
boiler_consumption_j = [(x * cte.WATTS_HOUR_TO_JULES) / number_of_ts for x in boiler_consumption]
hp_hourly = []
boiler_hourly = []
boiler_sum = 0
hp_sum = 0
for i in range(1, len(demand)):
hp_sum += hp_electricity_j[i]
boiler_sum += boiler_consumption_j[i]
if (i - 1) % number_of_ts == 0:
tes.temperature.append(t_tank[i])
hp_hourly.append(hp_sum)
boiler_hourly.append(boiler_sum)
hp_sum = 0
boiler_sum = 0
hp.energy_consumption[cte.HEATING] = {}
hp.energy_consumption[cte.HEATING][cte.HOUR] = hp_hourly
hp.energy_consumption[cte.HEATING][cte.MONTH] = MonthlyValues.get_total_month(
hp.energy_consumption[cte.HEATING][cte.HOUR])
hp.energy_consumption[cte.HEATING][cte.YEAR] = [
sum(hp.energy_consumption[cte.HEATING][cte.MONTH])]
boiler.energy_consumption[cte.HEATING] = {}
boiler.energy_consumption[cte.HEATING][cte.HOUR] = boiler_hourly
boiler.energy_consumption[cte.HEATING][cte.MONTH] = MonthlyValues.get_total_month(
boiler.energy_consumption[cte.HEATING][cte.HOUR])
boiler.energy_consumption[cte.HEATING][cte.YEAR] = [
sum(boiler.energy_consumption[cte.HEATING][cte.MONTH])]
self.results['Heating Demand (W)'] = demand
self.results['HP Heat Output (W)'] = q_hp
self.results['HP Source Temperature'] = t_out
self.results['HP Supply Temperature'] = t_sup_hp
self.results['HP COP'] = hp_cop
self.results['HP Electricity Consumption (W)'] = hp_electricity
self.results['Boiler Heat Output (W)'] = q_boiler
self.results['Boiler Supply Temperature'] = t_sup_boiler
self.results['Boiler Gas Consumption'] = boiler_consumption
self.results['TES Temperature'] = t_tank
self.results['TES Charging Flow Rate (kg/s)'] = m_ch
self.results['TES Discharge Flow Rate (kg/s)'] = m_dis
self.results['Heating Loop Return Temperature'] = t_ret
return hp_hourly, boiler_hourly
def cooling_system_simulation(self):
hp = self.hvac_sizing()[0]
eer_curve_coefficients = [float(coefficient) for coefficient in hp.cooling_efficiency_curve.coefficients]
cooling_efficiency = float(hp.cooling_efficiency)
demand = self._hourly_cooling_demand
number_of_ts = int(cte.HOUR_TO_SECONDS / self.dt)
demand = [0] + [x for x in self._hourly_cooling_demand for _ in range(number_of_ts)]
t_out = [0] + [x for x in self._t_out for _ in range(number_of_ts)]
hp.source_temperature = self._t_out
variable_names = ["t_sup_hp", "t_ret", "m", "q_hp", "hp_electricity", "hp_eer"]
variable_names = ["t_sup_hp", "t_ret", "m", "q_hp", "hp_electricity", "hp_cop"]
num_hours = len(demand)
variables = {name: [0] * num_hours for name in variable_names}
(t_sup_hp, t_ret, m, q_hp, hp_electricity, hp_eer) = [variables[name] for name in variable_names]
(t_sup_hp, t_ret, m, q_hp, hp_electricity, hp_cop) = [variables[name] for name in variable_names]
t_ret[0] = 13
dt = 3600
for i in range(len(demand) - 1):
if demand[i] > 0:
m[i] = self._cooling_peak_load / (cte.WATER_HEAT_CAPACITY * 5 * dt)
if t_ret[i] > 13:
q_hp[i] = hp.nominal_cooling_output
t_sup_hp[i] = t_ret[i] - q_hp[i] / (m[i] * cte.WATER_HEAT_CAPACITY)
for i in range(1, len(demand)):
if demand[i] > 0.15 * self._cooling_peak_load:
m[i] = hp.nominal_cooling_output / (cte.WATER_HEAT_CAPACITY * 5)
if t_ret[i - 1] >= 13:
if demand[i] < 0.25 * self._cooling_peak_load:
q_hp[i] = 0.25 * hp.nominal_cooling_output
elif demand[i] < 0.5 * self._cooling_peak_load:
q_hp[i] = 0.5 * hp.nominal_cooling_output
else:
q_hp[i] = hp.nominal_cooling_output
t_sup_hp[i] = t_ret[i - 1] - q_hp[i] / (m[i] * cte.WATER_HEAT_CAPACITY)
else:
q_hp[i] = 0
t_sup_hp[i] = t_ret[i]
t_ret[i + 1] = t_sup_hp[i] + demand[i] / (m[i] * cte.WATER_HEAT_CAPACITY)
t_sup_hp[i] = t_ret[i - 1]
if m[i] == 0:
t_ret[i] = t_sup_hp[i]
else:
t_ret[i] = t_sup_hp[i] + demand[i] / (m[i] * cte.WATER_HEAT_CAPACITY)
else:
m[i] = 0
q_hp[i] = 0
t_sup_hp[i] = t_ret[i]
t_ret[i + 1] = t_ret[i]
t_sup_hp[i] = t_ret[i - 1]
t_ret[i] = t_ret[i - 1]
t_sup_hp_fahrenheit = 1.8 * t_sup_hp[i] + 32
t_out_fahrenheit = 1.8 * self._t_out[i] + 32
t_out_fahrenheit = 1.8 * t_out[i] + 32
if q_hp[i] > 0:
hp_eer[i] = 1/((eer_curve_coefficients[0] +
eer_curve_coefficients[1] * t_sup_hp_fahrenheit +
eer_curve_coefficients[2] * t_sup_hp_fahrenheit ** 2 +
eer_curve_coefficients[3] * t_out_fahrenheit +
eer_curve_coefficients[4] * t_out_fahrenheit ** 2 +
eer_curve_coefficients[5] * t_sup_hp_fahrenheit * t_out_fahrenheit))
hp_cop[i] = (1 / (eer_curve_coefficients[0] +
eer_curve_coefficients[1] * t_sup_hp_fahrenheit +
eer_curve_coefficients[2] * t_sup_hp_fahrenheit ** 2 +
eer_curve_coefficients[3] * t_out_fahrenheit +
eer_curve_coefficients[4] * t_out_fahrenheit ** 2 +
eer_curve_coefficients[
5] * t_sup_hp_fahrenheit * t_out_fahrenheit)) * cooling_efficiency / 3.41
hp_electricity[i] = q_hp[i] / cooling_efficiency
else:
hp_eer[i] = 0
hp_cop[i] = 0
hp_electricity[i] = 0
hp_electricity_j = [(x * cte.WATTS_HOUR_TO_JULES) / number_of_ts for x in hp_electricity]
hp_hourly = []
hp_sum = 0
for i in range(1, len(demand)):
hp_sum += hp_electricity_j[i]
if (i - 1) % number_of_ts == 0:
hp_hourly.append(hp_sum)
hp_sum = 0
hp.energy_consumption[cte.COOLING] = {}
hp.energy_consumption[cte.COOLING][cte.HOUR] = hp_hourly
hp.energy_consumption[cte.COOLING][cte.MONTH] = MonthlyValues.get_total_month(
hp.energy_consumption[cte.COOLING][cte.HOUR])
hp.energy_consumption[cte.COOLING][cte.YEAR] = [
sum(hp.energy_consumption[cte.COOLING][cte.MONTH])]
self.results['Cooling Demand (W)'] = demand
self.results['HP Cooling Output (W)'] = q_hp
self.results['HP Cooling Supply Temperature'] = t_sup_hp
self.results['HP Cooling COP'] = hp_cop
self.results['HP Electricity Consumption'] = hp_electricity
self.results['Cooling Loop Flow Rate (kg/s)'] = m
self.results['Cooling Loop Return Temperature'] = t_ret
return hp_hourly
def dhw_system_simulation(self):
hp, tes = self.dhw_sizing()
cop_curve_coefficients = [float(coefficient) for coefficient in hp.heat_efficiency_curve.coefficients]
number_of_ts = int(cte.HOUR_TO_SECONDS / self.dt)
demand = [0] + [x for x in self._hourly_dhw_demand for _ in range(number_of_ts)]
t_out = [0] + [x for x in self._t_out for _ in range(number_of_ts)]
variable_names = ["t_sup_hp", "t_tank", "m_ch", "m_dis", "q_hp", "q_coil", "hp_cop",
"hp_electricity", "available hot water (m3)", "refill flow rate (kg/s)"]
num_hours = len(demand)
variables = {name: [0] * num_hours for name in variable_names}
(t_sup_hp, t_tank, m_ch, m_dis, m_refill, q_hp, q_coil, hp_cop, hp_electricity, v_dhw) = \
[variables[name] for name in variable_names]
t_tank[0] = 70
v_dhw[0] = tes.volume
hp_heating_cap = hp.nominal_heat_output
hp_delta_t = 8
v, h = float(tes.volume), float(tes.height)
r_tot = sum(float(layer.thickness) / float(layer.material.conductivity) for layer in
tes.layers)
u_tot = 1 / r_tot
d = math.sqrt((4 * v) / (math.pi * h))
a_side = math.pi * d * h
a_top = math.pi * d ** 2 / 4
ua = u_tot * (2 * a_top + a_side)
freshwater_temperature = 18
for i in range(len(demand) - 1):
delta_t_demand = demand[i] * (self.dt / (cte.WATER_DENSITY * cte.WATER_HEAT_CAPACITY * v))
if t_tank[i] < 62:
q_hp[i] = hp_heating_cap
delta_t_hp = q_hp[i] * (self.dt / (cte.WATER_DENSITY * cte.WATER_HEAT_CAPACITY * v))
if demand[i] > 0:
dhw_needed = (demand[i] * cte.HOUR_TO_SECONDS) / (cte.WATER_HEAT_CAPACITY * t_tank[i] * cte.WATER_DENSITY)
m_dis[i] = dhw_needed * cte.WATER_DENSITY / cte.HOUR_TO_SECONDS
m_refill[i] = m_dis[i]
delta_t_freshwater = m_refill[i] * (t_tank[i] - freshwater_temperature) * (self.dt / (v * cte.WATER_DENSITY))
if t_tank[i] < 60:
q_coil[i] = float(tes.heating_coil_capacity)
delta_t_coil = q_coil[i] * (self.dt / (cte.WATER_DENSITY * cte.WATER_HEAT_CAPACITY * v))
if q_hp[i] > 0:
m_ch[i] = q_hp[i] / (cte.WATER_HEAT_CAPACITY * hp_delta_t)
t_sup_hp[i] = (q_hp[i] / (m_ch[i] * cte.WATER_HEAT_CAPACITY)) + t_tank[i]
else:
m_ch[i] = 0
t_sup_hp[i] = t_tank[i]
t_sup_hp_fahrenheit = 1.8 * t_sup_hp[i] + 32
t_out_fahrenheit = 1.8 * t_out[i] + 32
if q_hp[i] > 0:
hp_cop[i] = (cop_curve_coefficients[0] +
cop_curve_coefficients[1] * t_out[i] +
cop_curve_coefficients[2] * t_out[i] ** 2 +
cop_curve_coefficients[3] * t_tank[i] +
cop_curve_coefficients[4] * t_tank[i] ** 2 +
cop_curve_coefficients[5] * t_tank[i] * t_out[i]) * float(hp.heat_efficiency)
hp_electricity[i] = q_hp[i] / hp_cop[i]
else:
hp_cop[i] = 0
hp_electricity[i] = 0
data = list(zip(q_hp, hp_electricity, hp_eer, m, t_sup_hp, t_ret, demand, self._t_out))
file_name = f'cooling_system_simulation_results_{self._name}.csv'
t_tank[i + 1] = t_tank[i] + (delta_t_hp - delta_t_freshwater - delta_t_demand + delta_t_coil)
tes.temperature = []
hp_electricity_j = [(x * cte.WATTS_HOUR_TO_JULES) / number_of_ts for x in hp_electricity]
heating_coil_j = [(x * cte.WATTS_HOUR_TO_JULES) / number_of_ts for x in q_coil]
hp_hourly = []
coil_hourly = []
coil_sum = 0
hp_sum = 0
for i in range(1, len(demand)):
hp_sum += hp_electricity_j[i]
coil_sum += heating_coil_j[i]
if (i - 1) % number_of_ts == 0:
tes.temperature.append(t_tank[i])
hp_hourly.append(hp_sum)
coil_hourly.append(coil_sum)
hp_sum = 0
coil_sum = 0
hp.energy_consumption[cte.DOMESTIC_HOT_WATER] = {}
hp.energy_consumption[cte.DOMESTIC_HOT_WATER][cte.HOUR] = hp_hourly
hp.energy_consumption[cte.DOMESTIC_HOT_WATER][cte.MONTH] = MonthlyValues.get_total_month(
hp.energy_consumption[cte.DOMESTIC_HOT_WATER][cte.HOUR])
hp.energy_consumption[cte.DOMESTIC_HOT_WATER][cte.YEAR] = [
sum(hp.energy_consumption[cte.DOMESTIC_HOT_WATER][cte.MONTH])]
tes.heating_coil_energy_consumption = {}
tes.heating_coil_energy_consumption[cte.HOUR] = coil_hourly
tes.heating_coil_energy_consumption[cte.MONTH] = MonthlyValues.get_total_month(
tes.heating_coil_energy_consumption[cte.HOUR])
tes.heating_coil_energy_consumption[cte.YEAR] = [
sum(tes.heating_coil_energy_consumption[cte.MONTH])]
tes.temperature = t_tank
self.results['DHW Demand (W)'] = demand
self.results['DHW HP Heat Output (W)'] = q_hp
self.results['DHW HP Electricity Consumption (W)'] = hp_electricity
self.results['DHW HP Source Temperature'] = t_out
self.results['DHW HP Supply Temperature'] = t_sup_hp
self.results['DHW HP COP'] = hp_cop
self.results['DHW TES Heating Coil Heat Output (W)'] = q_coil
self.results['DHW TES Temperature'] = t_tank
self.results['DHW TES Charging Flow Rate (kg/s)'] = m_ch
self.results['DHW Flow Rate (kg/s)'] = m_dis
self.results['DHW TES Refill Flow Rate (kg/s)'] = m_refill
self.results['Available Water in Tank (m3)'] = v_dhw
return hp_hourly, coil_hourly
def enrich_buildings(self):
hp_heating, boiler_consumption = self.heating_system_simulation()
hp_cooling = self.cooling_system_simulation()
hp_dhw, heating_coil = self.dhw_system_simulation()
heating_consumption = [hp_heating[i] + boiler_consumption[i] for i in range(len(hp_heating))]
dhw_consumption = [hp_dhw[i] + heating_coil[i] for i in range(len(hp_dhw))]
self._building.heating_consumption[cte.HOUR] = heating_consumption
self._building.heating_consumption[cte.MONTH] = (
MonthlyValues.get_total_month(self._building.heating_consumption[cte.HOUR]))
self._building.heating_consumption[cte.YEAR] = [sum(self._building.heating_consumption[cte.MONTH])]
self._building.cooling_consumption[cte.HOUR] = hp_cooling
self._building.cooling_consumption[cte.MONTH] = (
MonthlyValues.get_total_month(self._building.cooling_consumption[cte.HOUR]))
self._building.cooling_consumption[cte.YEAR] = [sum(self._building.cooling_consumption[cte.MONTH])]
self._building.domestic_hot_water_consumption[cte.HOUR] = dhw_consumption
self._building.domestic_hot_water_consumption[cte.MONTH] = (
MonthlyValues.get_total_month(self._building.domestic_hot_water_consumption[cte.HOUR]))
self._building.domestic_hot_water_consumption[cte.YEAR] = [
sum(self._building.domestic_hot_water_consumption[cte.MONTH])]
file_name = f'energy_system_simulation_results_{self._name}.csv'
with open(self._output_path / file_name, 'w', newline='') as csvfile:
output_file = csv.writer(csvfile)
# Write header
output_file.writerow(['HP_cooling_output (W)', 'HP_cooling_electricity_consumption (W)', 'HP_EER',
'Cooling_loop_flow_rate(kg/s)', 'Cooling_supply_temperature(C)',
'Cooling_loop_return_temperature(C)', 'Cooling_demand (W)', 'Outside_Air_Temperature'])
output_file.writerow(self.results.keys())
# Write data
output_file.writerows(data)
return hp_electricity, t_sup_hp
output_file.writerows(zip(*self.results.values()))
def enrich_buildings(self):
(self._building.heating_consumption[cte.HOUR], hp_electricity_heating,
boiler_consumption, t_sup_hp, t_sup_boiler) = self.heating_system_simulation()
hp_electricity_cooling, t_sup_hp_cooling = self.cooling_system_simulation()
self._building.heating_consumption[cte.MONTH] = MonthlyValues.get_total_month(
self._building.heating_consumption[cte.HOUR])
self._building.heating_consumption[cte.YEAR] = [sum(self._building.heating_consumption[cte.MONTH])]
self._hvac_system.generation_systems[0].energy_consumption[cte.HEATING] = {}
self._hvac_system.generation_systems[1].energy_consumption[cte.HEATING] = {}
self._hvac_system.generation_systems[0].energy_consumption[cte.HEATING][cte.HOUR] = hp_electricity_heating
self._hvac_system.generation_systems[0].energy_consumption[cte.HEATING][cte.MONTH] = MonthlyValues.get_total_month(
self._hvac_system.generation_systems[0].energy_consumption[cte.HEATING][cte.HOUR])
self._hvac_system.generation_systems[0].energy_consumption[cte.HEATING][cte.YEAR] = \
[sum(self._hvac_system.generation_systems[0].energy_consumption[cte.HEATING][cte.MONTH])]
self._hvac_system.generation_systems[1].energy_consumption[cte.HEATING][cte.HOUR] = boiler_consumption
self._hvac_system.generation_systems[1].energy_consumption[cte.HEATING][cte.MONTH] = MonthlyValues.get_total_month(
self._hvac_system.generation_systems[1].energy_consumption[cte.HEATING][cte.HOUR])
self._hvac_system.generation_systems[1].energy_consumption[cte.HEATING][cte.YEAR] = \
[sum(self._hvac_system.generation_systems[1].energy_consumption[cte.HEATING][cte.MONTH])]
self._hvac_system.generation_systems[0].heat_supply_temperature = t_sup_hp
self._hvac_system.generation_systems[1].heat_supply_temperature = t_sup_boiler
self._hvac_system.generation_systems[0].energy_consumption[cte.COOLING] = {}
self._hvac_system.generation_systems[0].energy_consumption[cte.COOLING][cte.HOUR] = hp_electricity_cooling
self._hvac_system.generation_systems[0].energy_consumption[cte.COOLING][cte.MONTH] = MonthlyValues.get_total_month(
self._hvac_system.generation_systems[0].energy_consumption[cte.COOLING][cte.HOUR])
self._hvac_system.generation_systems[0].energy_consumption[cte.COOLING][cte.YEAR] = \
[sum(self._hvac_system.generation_systems[0].energy_consumption[cte.COOLING][cte.MONTH])]
self._hvac_system.generation_systems[0].cooling_supply_temperature = t_sup_hp_cooling
self._dhw_system.generation_systems[0].energy_consumption[cte.DOMESTIC_HOT_WATER] = (
self._building.domestic_hot_water_consumption)

View File

@ -24,6 +24,7 @@ class Archetype13Stratified:
self._output_path = output_path
self._t_out = building.external_temperature[cte.HOUR]
self.results = {}
self.dt = 300
def hvac_sizing(self):
storage_factor = 3
@ -49,6 +50,7 @@ class Archetype13Stratified:
def heating_system_simulation_stratified(self):
hp, boiler, tes = self.hvac_sizing()
hp_efficiency = float(hp.heat_efficiency)
cop_curve_coefficients = [float(coefficient) for coefficient in hp.heat_efficiency_curve.coefficients]
demand = [0] + [x for x in self._hourly_heating_demand for _ in range(12)]
hp.source_temperature = self._t_out
@ -114,15 +116,15 @@ class Archetype13Stratified:
t_sup_hp[i + 1] = (q_hp[i + 1] / (m_ch[i + 1] * cte.WATER_HEAT_CAPACITY)) + t4[i + 1]
else:
q_hp[i + 1], m_ch[i + 1], t_sup_hp[i + 1] = 0, 0, t4[i + 1]
t_sup_hp_fahrenheit = 1.8 * t_sup_hp[i + 1] + 32
t_tank_fahrenheit = 1.8 * t4[i + 1] + 32
t_out_fahrenheit = 1.8 * t_out[i + 1] + 32
if q_hp[i + 1] > 0:
hp_cop[i + 1] = (cop_curve_coefficients[0] +
cop_curve_coefficients[1] * t_sup_hp_fahrenheit +
cop_curve_coefficients[2] * t_sup_hp_fahrenheit ** 2 +
hp_cop[i + 1] = (1 / (cop_curve_coefficients[0] +
cop_curve_coefficients[1] * t_tank_fahrenheit +
cop_curve_coefficients[2] * t_tank_fahrenheit ** 2 +
cop_curve_coefficients[3] * t_out_fahrenheit +
cop_curve_coefficients[4] * t_out_fahrenheit ** 2 +
cop_curve_coefficients[5] * t_sup_hp_fahrenheit * t_out_fahrenheit)
cop_curve_coefficients[5] * t_tank_fahrenheit * t_out_fahrenheit)) * hp_efficiency
hp_electricity[i + 1] = q_hp[i + 1] / hp_cop[i + 1]
else:
hp_cop[i + 1] = 0
@ -211,66 +213,81 @@ class Archetype13Stratified:
hp = self.hvac_sizing()[0]
eer_curve_coefficients = [float(coefficient) for coefficient in hp.cooling_efficiency_curve.coefficients]
cooling_efficiency = float(hp.cooling_efficiency)
demand = self._hourly_cooling_demand
number_of_ts = int(cte.HOUR_TO_SECONDS / self.dt)
demand = [0] + [x for x in self._hourly_cooling_demand for _ in range(number_of_ts)]
t_out = [0] + [x for x in self._t_out for _ in range(number_of_ts)]
hp.source_temperature = self._t_out
variable_names = ["t_sup_hp", "t_ret", "m", "q_hp", "hp_electricity", "hp_eer"]
variable_names = ["t_sup_hp", "t_ret", "m", "q_hp", "hp_electricity", "hp_cop"]
num_hours = len(demand)
variables = {name: [0] * num_hours for name in variable_names}
(t_sup_hp, t_ret, m, q_hp, hp_electricity, hp_eer) = [variables[name] for name in variable_names]
(t_sup_hp, t_ret, m, q_hp, hp_electricity, hp_cop) = [variables[name] for name in variable_names]
t_ret[0] = 13
dt = 3600
for i in range(len(demand) - 1):
if demand[i] > 0:
m[i] = self._cooling_peak_load / (cte.WATER_HEAT_CAPACITY * 5 * dt)
if t_ret[i] > 13:
if demand[i] < 0.25 * self._cooling_peak_load / dt:
for i in range(1, len(demand)):
if demand[i] > 0.15 * self._cooling_peak_load:
m[i] = hp.nominal_cooling_output / (cte.WATER_HEAT_CAPACITY * 5)
if t_ret[i - 1] >= 13:
if demand[i] < 0.25 * self._cooling_peak_load:
q_hp[i] = 0.25 * hp.nominal_cooling_output
elif demand[i] < 0.5 * self._cooling_peak_load / dt:
elif demand[i] < 0.5 * self._cooling_peak_load:
q_hp[i] = 0.5 * hp.nominal_cooling_output
else:
q_hp[i] = hp.nominal_cooling_output
t_sup_hp[i] = t_ret[i] - q_hp[i] / (m[i] * cte.WATER_HEAT_CAPACITY)
t_sup_hp[i] = t_ret[i - 1] - q_hp[i] / (m[i] * cte.WATER_HEAT_CAPACITY)
else:
q_hp[i] = 0
t_sup_hp[i] = t_ret[i]
t_ret[i + 1] = t_sup_hp[i] + demand[i] / (m[i] * cte.WATER_HEAT_CAPACITY)
t_sup_hp[i] = t_ret[i - 1]
if m[i] == 0:
t_ret[i] = t_sup_hp[i]
else:
t_ret[i] = t_sup_hp[i] + demand[i] / (m[i] * cte.WATER_HEAT_CAPACITY)
else:
m[i] = 0
q_hp[i] = 0
t_sup_hp[i] = t_ret[i]
t_ret[i + 1] = t_ret[i]
t_sup_hp[i] = t_ret[i - 1]
t_ret[i] = t_ret[i - 1]
t_sup_hp_fahrenheit = 1.8 * t_sup_hp[i] + 32
t_out_fahrenheit = 1.8 * self._t_out[i] + 32
t_out_fahrenheit = 1.8 * t_out[i] + 32
if q_hp[i] > 0:
hp_eer[i] = (eer_curve_coefficients[0] +
hp_cop[i] = (1 / (eer_curve_coefficients[0] +
eer_curve_coefficients[1] * t_sup_hp_fahrenheit +
eer_curve_coefficients[2] * t_sup_hp_fahrenheit ** 2 +
eer_curve_coefficients[3] * t_out_fahrenheit +
eer_curve_coefficients[4] * t_out_fahrenheit ** 2 +
eer_curve_coefficients[5] * t_sup_hp_fahrenheit * t_out_fahrenheit)
eer_curve_coefficients[5] * t_sup_hp_fahrenheit * t_out_fahrenheit)) * cooling_efficiency / 3.41
hp_electricity[i] = q_hp[i] / cooling_efficiency
else:
hp_eer[i] = 0
hp_cop[i] = 0
hp_electricity[i] = 0
hp_electricity_j = [(x * cte.WATTS_HOUR_TO_JULES) / number_of_ts for x in hp_electricity]
hp_hourly = []
hp_sum = 0
for i in range(1, len(demand)):
hp_sum += hp_electricity_j[i]
if (i - 1) % number_of_ts == 0:
hp_hourly.append(hp_sum)
hp_sum = 0
hp.energy_consumption[cte.COOLING] = {}
hp.energy_consumption[cte.COOLING][cte.HOUR] = hp_electricity
hp.energy_consumption[cte.COOLING][cte.HOUR] = hp_hourly
hp.energy_consumption[cte.COOLING][cte.MONTH] = MonthlyValues.get_total_month(
hp.energy_consumption[cte.COOLING][cte.HOUR])
hp.energy_consumption[cte.COOLING][cte.YEAR] = [
sum(hp.energy_consumption[cte.COOLING][cte.MONTH])]
# self.results['Cooling Demand (W)'] = demand
# self.results['HP Cooling Output (W)'] = q_hp
# self.results['HP Cooling Supply Temperature'] = t_sup_hp
# self.results['HP Cooling COP'] = hp_eer
# self.results['HP Electricity Consumption'] = hp_electricity
# self.results['Cooling Loop Flow Rate (kg/s)'] = m
# self.results['Cooling Loop Return Temperature'] = t_ret
return hp_electricity
self.results['Cooling Demand (W)'] = demand
self.results['HP Cooling Output (W)'] = q_hp
self.results['HP Cooling Supply Temperature'] = t_sup_hp
self.results['HP Cooling COP'] = hp_cop
self.results['HP Electricity Consumption'] = hp_electricity
self.results['Cooling Loop Flow Rate (kg/s)'] = m
self.results['Cooling Loop Return Temperature'] = t_ret
return hp_hourly
def dhw_system_simulation(self):
hp, tes = self.dhw_sizing()
cop_curve_coefficients = [float(coefficient) for coefficient in hp.heat_efficiency_curve.coefficients]
demand = self._hourly_dhw_demand
number_of_ts = int(cte.HOUR_TO_SECONDS / self.dt)
demand = [0] + [x for x in self._hourly_dhw_demand for _ in range(number_of_ts)]
t_out = [0] + [x for x in self._t_out for _ in range(number_of_ts)]
variable_names = ["t_sup_hp", "t_tank", "m_ch", "m_dis", "q_hp", "q_coil", "hp_cop",
"hp_electricity", "available hot water (m3)", "refill flow rate (kg/s)"]
num_hours = len(demand)
@ -279,7 +296,7 @@ class Archetype13Stratified:
[variables[name] for name in variable_names]
t_tank[0] = 70
v_dhw[0] = tes.volume
dt = 3600
hp_heating_cap = hp.nominal_heat_output
hp_delta_t = 8
v, h = float(tes.volume), float(tes.height)
@ -292,26 +309,18 @@ class Archetype13Stratified:
ua = u_tot * (2 * a_top + a_side)
freshwater_temperature = 18
for i in range(len(demand) - 1):
delta_t_demand = demand[i] * (dt / (cte.WATER_DENSITY * cte.WATER_HEAT_CAPACITY * v))
if t_tank[i] < 65:
delta_t_demand = demand[i] * (self.dt / (cte.WATER_DENSITY * cte.WATER_HEAT_CAPACITY * v))
if t_tank[i] < 62:
q_hp[i] = hp_heating_cap
delta_t_hp = q_hp[i] * (dt / (cte.WATER_DENSITY * cte.WATER_HEAT_CAPACITY * v))
delta_t_hp = q_hp[i] * (self.dt / (cte.WATER_DENSITY * cte.WATER_HEAT_CAPACITY * v))
if demand[i] > 0:
dhw_needed = (demand[i] * cte.HOUR_TO_SECONDS) / (cte.WATER_HEAT_CAPACITY * t_tank[i] * cte.WATER_DENSITY)
m_dis[i] = dhw_needed * cte.WATER_DENSITY / cte.HOUR_TO_SECONDS
m_refill[i] = m_dis[i]
delta_t_freshwater = m_refill[i] * (t_tank[i] - freshwater_temperature) * (dt / (v * cte.WATER_DENSITY))
diff = delta_t_freshwater + delta_t_demand - delta_t_hp
if diff > 0:
if diff > 0:
power = diff * (cte.WATER_DENSITY * cte.WATER_HEAT_CAPACITY * v) / dt
if power <= float(tes.heating_coil_capacity):
q_coil[i] = power
else:
q_coil[i] = float(tes.heating_coil_capacity)
elif t_tank[i] < 65:
q_coil[i] = float(tes.heating_coil_capacity)
delta_t_coil = q_coil[i] * (dt / (cte.WATER_DENSITY * cte.WATER_HEAT_CAPACITY * v))
delta_t_freshwater = m_refill[i] * (t_tank[i] - freshwater_temperature) * (self.dt / (v * cte.WATER_DENSITY))
if t_tank[i] < 60:
q_coil[i] = float(tes.heating_coil_capacity)
delta_t_coil = q_coil[i] * (self.dt / (cte.WATER_DENSITY * cte.WATER_HEAT_CAPACITY * v))
if q_hp[i] > 0:
m_ch[i] = q_hp[i] / (cte.WATER_HEAT_CAPACITY * hp_delta_t)
@ -320,69 +329,84 @@ class Archetype13Stratified:
m_ch[i] = 0
t_sup_hp[i] = t_tank[i]
t_sup_hp_fahrenheit = 1.8 * t_sup_hp[i] + 32
t_out_fahrenheit = 1.8 * self._t_out[i] + 32
t_out_fahrenheit = 1.8 * t_out[i] + 32
if q_hp[i] > 0:
hp_cop[i] = (cop_curve_coefficients[0] +
cop_curve_coefficients[1] * t_sup_hp_fahrenheit +
cop_curve_coefficients[2] * t_sup_hp_fahrenheit ** 2 +
cop_curve_coefficients[3] * t_out_fahrenheit +
cop_curve_coefficients[4] * t_out_fahrenheit ** 2 +
cop_curve_coefficients[5] * t_sup_hp_fahrenheit * t_out_fahrenheit)
hp_electricity[i] = q_hp[i] / 3.5
cop_curve_coefficients[1] * t_out[i] +
cop_curve_coefficients[2] * t_out[i] ** 2 +
cop_curve_coefficients[3] * t_tank[i] +
cop_curve_coefficients[4] * t_tank[i] ** 2 +
cop_curve_coefficients[5] * t_tank[i] * t_out[i]) * float(hp.heat_efficiency)
hp_electricity[i] = q_hp[i] / hp_cop[i]
else:
hp_cop[i] = 0
hp_electricity[i] = 0
t_tank[i + 1] = t_tank[i] + (delta_t_hp - delta_t_freshwater - delta_t_demand + delta_t_coil)
tes.temperature = []
hp_electricity_j = [(x * cte.WATTS_HOUR_TO_JULES) / number_of_ts for x in hp_electricity]
heating_coil_j = [(x * cte.WATTS_HOUR_TO_JULES) / number_of_ts for x in q_coil]
hp_hourly = []
coil_hourly = []
coil_sum = 0
hp_sum = 0
for i in range(1, len(demand)):
hp_sum += hp_electricity_j[i]
coil_sum += heating_coil_j[i]
if (i - 1) % number_of_ts == 0:
tes.temperature.append(t_tank[i])
hp_hourly.append(hp_sum)
coil_hourly.append(coil_sum)
hp_sum = 0
coil_sum = 0
hp.energy_consumption[cte.DOMESTIC_HOT_WATER] = {}
hp.energy_consumption[cte.DOMESTIC_HOT_WATER][cte.HOUR] = hp_electricity
hp.energy_consumption[cte.DOMESTIC_HOT_WATER][cte.HOUR] = hp_hourly
hp.energy_consumption[cte.DOMESTIC_HOT_WATER][cte.MONTH] = MonthlyValues.get_total_month(
hp.energy_consumption[cte.DOMESTIC_HOT_WATER][cte.HOUR])
hp.energy_consumption[cte.DOMESTIC_HOT_WATER][cte.YEAR] = [
sum(hp.energy_consumption[cte.DOMESTIC_HOT_WATER][cte.MONTH])]
tes.heating_coil_energy_consumption = {}
tes.heating_coil_energy_consumption[cte.HOUR] = q_coil
tes.heating_coil_energy_consumption[cte.HOUR] = coil_hourly
tes.heating_coil_energy_consumption[cte.MONTH] = MonthlyValues.get_total_month(
tes.heating_coil_energy_consumption[cte.HOUR])
tes.heating_coil_energy_consumption[cte.YEAR] = [
sum(tes.heating_coil_energy_consumption[cte.MONTH])]
tes.temperature = t_tank
# self.results['DHW Demand (W)'] = demand
# self.results['DHW HP Heat Output (W)'] = q_hp
# self.results['DHW HP Electricity Consumption (W)'] = hp_electricity
# self.results['DHW HP Source Temperature'] = self._t_out
# self.results['DHW HP Supply Temperature'] = t_sup_hp
# self.results['DHW HP COP'] = hp_cop
# self.results['DHW TES Heating Coil Heat Output (W)'] = q_coil
# self.results['DHW TES Temperature'] = t_tank
# self.results['DHW TES Charging Flow Rate (kg/s)'] = m_ch
# self.results['DHW Flow Rate (kg/s)'] = m_dis
# self.results['DHW TES Refill Flow Rate (kg/s)'] = m_refill
# self.results['Available Water in Tank (m3)'] = v_dhw
return hp_electricity, q_coil
self.results['DHW Demand (W)'] = demand
self.results['DHW HP Heat Output (W)'] = q_hp
self.results['DHW HP Electricity Consumption (W)'] = hp_electricity
self.results['DHW HP Source Temperature'] = t_out
self.results['DHW HP Supply Temperature'] = t_sup_hp
self.results['DHW HP COP'] = hp_cop
self.results['DHW TES Heating Coil Heat Output (W)'] = q_coil
self.results['DHW TES Temperature'] = t_tank
self.results['DHW TES Charging Flow Rate (kg/s)'] = m_ch
self.results['DHW Flow Rate (kg/s)'] = m_dis
self.results['DHW TES Refill Flow Rate (kg/s)'] = m_refill
self.results['Available Water in Tank (m3)'] = v_dhw
return hp_hourly, coil_hourly
def enrich_buildings(self):
hp_heating, boiler_consumption = self.heating_system_simulation_stratified()
# hp_cooling = self.cooling_system_simulation()
# hp_dhw, heating_coil = self.dhw_system_simulation()
hp_cooling = self.cooling_system_simulation()
hp_dhw, heating_coil = self.dhw_system_simulation()
heating_consumption = [hp_heating[i] + boiler_consumption[i] for i in range(len(hp_heating))]
# dhw_consumption = [hp_dhw[i] + heating_coil[i] for i in range(len(hp_dhw))]
# self._building.heating_consumption[cte.HOUR] = heating_consumption
# self._building.heating_consumption[cte.MONTH] = (
# MonthlyValues.get_total_month(self._building.heating_consumption[cte.HOUR]))
# self._building.heating_consumption[cte.YEAR] = sum(self._building.heating_consumption[cte.MONTH])
# self._building.cooling_consumption[cte.HOUR] = hp_cooling
# self._building.cooling_consumption[cte.MONTH] = (
# MonthlyValues.get_total_month(self._building.cooling_consumption[cte.HOUR]))
# self._building.cooling_consumption[cte.YEAR] = sum(self._building.cooling_consumption[cte.MONTH])
# self._building.domestic_hot_water_consumption[cte.HOUR] = dhw_consumption
# self._building.domestic_hot_water_consumption[cte.MONTH] = (
# MonthlyValues.get_total_month(self._building.domestic_hot_water_consumption[cte.HOUR]))
# self._building.domestic_hot_water_consumption[cte.YEAR] = (
# sum(self._building.domestic_hot_water_consumption[cte.MONTH]))
dhw_consumption = [hp_dhw[i] + heating_coil[i] for i in range(len(hp_dhw))]
self._building.heating_consumption[cte.HOUR] = heating_consumption
self._building.heating_consumption[cte.MONTH] = (
MonthlyValues.get_total_month(self._building.heating_consumption[cte.HOUR]))
self._building.heating_consumption[cte.YEAR] = sum(self._building.heating_consumption[cte.MONTH])
self._building.cooling_consumption[cte.HOUR] = hp_cooling
self._building.cooling_consumption[cte.MONTH] = (
MonthlyValues.get_total_month(self._building.cooling_consumption[cte.HOUR]))
self._building.cooling_consumption[cte.YEAR] = sum(self._building.cooling_consumption[cte.MONTH])
self._building.domestic_hot_water_consumption[cte.HOUR] = dhw_consumption
self._building.domestic_hot_water_consumption[cte.MONTH] = (
MonthlyValues.get_total_month(self._building.domestic_hot_water_consumption[cte.HOUR]))
self._building.domestic_hot_water_consumption[cte.YEAR] = (
sum(self._building.domestic_hot_water_consumption[cte.MONTH]))
file_name = f'energy_system_simulation_results_{self._name}.csv'
with open(self._output_path / file_name, 'w', newline='') as csvfile:
output_file = csv.writer(csvfile)

View File

@ -64,6 +64,7 @@ class Archetype14_15:
def heating_system_simulation(self):
hp, boiler, tes = self.heating_system_sizing()
hp_efficiency = float(hp.heat_efficiency)
cop_curve_coefficients = [float(coefficient) for coefficient in hp.heat_efficiency_curve.coefficients]
number_of_ts = int(cte.HOUR_TO_SECONDS / self.dt)
demand = [0] + [x for x in self._hourly_heating_demand for _ in range(number_of_ts)]
@ -111,15 +112,15 @@ class Archetype14_15:
t_sup_hp[i + 1] = (q_hp[i + 1] / (m_ch[i + 1] * cte.WATER_HEAT_CAPACITY)) + t_tank[i + 1]
else:
q_hp[i + 1], m_ch[i + 1], t_sup_hp[i + 1] = 0, 0, t_tank[i + 1]
t_sup_hp_fahrenheit = 1.8 * t_sup_hp[i + 1] + 32
t_tank_fahrenheit = 1.8 * t_tank[i + 1] + 32
t_out_fahrenheit = 1.8 * t_out[i + 1] + 32
if q_hp[i + 1] > 0:
hp_cop[i + 1] = (cop_curve_coefficients[0] +
cop_curve_coefficients[1] * t_sup_hp_fahrenheit +
cop_curve_coefficients[2] * t_sup_hp_fahrenheit ** 2 +
hp_cop[i + 1] = (1 / (cop_curve_coefficients[0] +
cop_curve_coefficients[1] * t_tank_fahrenheit +
cop_curve_coefficients[2] * t_tank_fahrenheit ** 2 +
cop_curve_coefficients[3] * t_out_fahrenheit +
cop_curve_coefficients[4] * t_out_fahrenheit ** 2 +
cop_curve_coefficients[5] * t_sup_hp_fahrenheit * t_out_fahrenheit)
cop_curve_coefficients[5] * t_tank_fahrenheit * t_out_fahrenheit)) * hp_efficiency
hp_electricity[i + 1] = q_hp[i + 1] / hp_cop[i + 1]
else:
hp_cop[i + 1] = 0
@ -189,26 +190,26 @@ class Archetype14_15:
return hp_hourly, boiler_hourly
def cooling_system_simulation(self):
hp = self.cooling_system_sizing()
hp = self.cooling_system_sizing()[0]
eer_curve_coefficients = [float(coefficient) for coefficient in hp.cooling_efficiency_curve.coefficients]
cooling_efficiency = float(hp.cooling_efficiency)
number_of_ts = int(cte.HOUR_TO_SECONDS / self.dt)
demand = [0] + [x for x in self._hourly_cooling_demand for _ in range(number_of_ts)]
t_out = [0] + [x for x in self._t_out for _ in range(number_of_ts)]
hp.source_temperature = self._t_out
variable_names = ["t_sup_hp", "t_ret", "m", "q_hp", "hp_electricity", "hp_eer"]
variable_names = ["t_sup_hp", "t_ret", "m", "q_hp", "hp_electricity", "hp_cop"]
num_hours = len(demand)
variables = {name: [0] * num_hours for name in variable_names}
(t_sup_hp, t_ret, m, q_hp, hp_electricity, hp_eer) = [variables[name] for name in variable_names]
(t_sup_hp, t_ret, m, q_hp, hp_electricity, hp_cop) = [variables[name] for name in variable_names]
t_ret[0] = 13
for i in range(1, len(demand)):
if demand[i] > 0:
m[i] = self._cooling_peak_load / (cte.WATER_HEAT_CAPACITY * 5 * cte.HOUR_TO_SECONDS)
if demand[i] > 0.15 * self._cooling_peak_load:
m[i] = hp.nominal_cooling_output / (cte.WATER_HEAT_CAPACITY * 5)
if t_ret[i - 1] >= 13:
if demand[i] < 0.25 * self._cooling_peak_load / cte.HOUR_TO_SECONDS:
if demand[i] < 0.25 * self._cooling_peak_load:
q_hp[i] = 0.25 * hp.nominal_cooling_output
elif demand[i] < 0.5 * self._cooling_peak_load / cte.HOUR_TO_SECONDS:
elif demand[i] < 0.5 * self._cooling_peak_load:
q_hp[i] = 0.5 * hp.nominal_cooling_output
else:
q_hp[i] = hp.nominal_cooling_output
@ -223,20 +224,20 @@ class Archetype14_15:
else:
m[i] = 0
q_hp[i] = 0
t_sup_hp[i] = t_ret[i -1]
t_sup_hp[i] = t_ret[i - 1]
t_ret[i] = t_ret[i - 1]
t_sup_hp_fahrenheit = 1.8 * t_sup_hp[i] + 32
t_out_fahrenheit = 1.8 * t_out[i] + 32
if q_hp[i] > 0:
hp_eer[i] = (eer_curve_coefficients[0] +
hp_cop[i] = (1 / (eer_curve_coefficients[0] +
eer_curve_coefficients[1] * t_sup_hp_fahrenheit +
eer_curve_coefficients[2] * t_sup_hp_fahrenheit ** 2 +
eer_curve_coefficients[3] * t_out_fahrenheit +
eer_curve_coefficients[4] * t_out_fahrenheit ** 2 +
eer_curve_coefficients[5] * t_sup_hp_fahrenheit * t_out_fahrenheit)
hp_electricity[i] = q_hp[i] / hp_eer[i]
eer_curve_coefficients[5] * t_sup_hp_fahrenheit * t_out_fahrenheit)) * cooling_efficiency / 3.41
hp_electricity[i] = q_hp[i] / cooling_efficiency
else:
hp_eer[i] = 0
hp_cop[i] = 0
hp_electricity[i] = 0
hp_electricity_j = [(x * cte.WATTS_HOUR_TO_JULES) / number_of_ts for x in hp_electricity]
hp_hourly = []
@ -255,7 +256,7 @@ class Archetype14_15:
self.results['Cooling Demand (W)'] = demand
self.results['HP Cooling Output (W)'] = q_hp
self.results['HP Cooling Supply Temperature'] = t_sup_hp
self.results['HP Cooling COP'] = hp_eer
self.results['HP Cooling COP'] = hp_cop
self.results['HP Electricity Consumption'] = hp_electricity
self.results['Cooling Loop Flow Rate (kg/s)'] = m
self.results['Cooling Loop Return Temperature'] = t_ret
@ -289,7 +290,7 @@ class Archetype14_15:
freshwater_temperature = 18
for i in range(len(demand) - 1):
delta_t_demand = demand[i] * (self.dt / (cte.WATER_DENSITY * cte.WATER_HEAT_CAPACITY * v))
if t_tank[i] < 65:
if t_tank[i] < 62:
q_hp[i] = hp_heating_cap
delta_t_hp = q_hp[i] * (self.dt / (cte.WATER_DENSITY * cte.WATER_HEAT_CAPACITY * v))
if demand[i] > 0:
@ -297,14 +298,8 @@ class Archetype14_15:
m_dis[i] = dhw_needed * cte.WATER_DENSITY / cte.HOUR_TO_SECONDS
m_refill[i] = m_dis[i]
delta_t_freshwater = m_refill[i] * (t_tank[i] - freshwater_temperature) * (self.dt / (v * cte.WATER_DENSITY))
diff = delta_t_freshwater + delta_t_demand - delta_t_hp
if diff > 0:
if diff > 0:
power = diff * (cte.WATER_DENSITY * cte.WATER_HEAT_CAPACITY * v) / self.dt
if power <= float(tes.heating_coil_capacity):
q_coil[i] = power
else:
q_coil[i] = float(tes.heating_coil_capacity)
if t_tank[i] < 60:
q_coil[i] = float(tes.heating_coil_capacity)
delta_t_coil = q_coil[i] * (self.dt / (cte.WATER_DENSITY * cte.WATER_HEAT_CAPACITY * v))
if q_hp[i] > 0:
@ -317,11 +312,11 @@ class Archetype14_15:
t_out_fahrenheit = 1.8 * t_out[i] + 32
if q_hp[i] > 0:
hp_cop[i] = (cop_curve_coefficients[0] +
cop_curve_coefficients[1] * t_sup_hp_fahrenheit +
cop_curve_coefficients[2] * t_sup_hp_fahrenheit ** 2 +
cop_curve_coefficients[3] * t_out_fahrenheit +
cop_curve_coefficients[4] * t_out_fahrenheit ** 2 +
cop_curve_coefficients[5] * t_sup_hp_fahrenheit * t_out_fahrenheit)
cop_curve_coefficients[1] * t_out[i] +
cop_curve_coefficients[2] * t_out[i] ** 2 +
cop_curve_coefficients[3] * t_tank[i] +
cop_curve_coefficients[4] * t_tank[i] ** 2 +
cop_curve_coefficients[5] * t_tank[i] * t_out[i]) * float(hp.heat_efficiency)
hp_electricity[i] = q_hp[i] / hp_cop[i]
else:
hp_cop[i] = 0
@ -374,6 +369,7 @@ class Archetype14_15:
return hp_hourly, coil_hourly
def enrich_buildings(self):
hp_heating, boiler_consumption = self.heating_system_simulation()
hp_cooling = self.cooling_system_simulation()

View File

@ -50,6 +50,5 @@ energy_plus_workflow(city, energy_plus_output_path)
random_assignation.call_random(city.buildings, random_assignation.residential_new_systems_percentage)
EnergySystemsFactory('montreal_future', city).enrich()
for building in city.buildings:
if building.energy_systems_archetype_name == 'PV+4Pipe+DHW':
EnergySystemsSimulationFactory('archetype13', building=building, output_path=simulation_results_path).enrich()
EnergySystemsSimulationFactory('archetype1', building=building, output_path=simulation_results_path).enrich()