fix: codes finalized

This commit is contained in:
Saeed Ranjbar 2024-09-10 21:07:47 -04:00
parent 7c6e693d85
commit 206b5d2c37
8 changed files with 4380 additions and 4328 deletions

Binary file not shown.

BIN
Results_all_together.xlsx Normal file

Binary file not shown.

1466
new_file_extended.csv Normal file

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@ import pandas as pd
# Load data
data = pd.read_csv('new_file.csv')
data = pd.read_csv('new_file_extended.csv')
demand = data['Q_tot_mpc'].to_list()
demand_watts = [x * 1000 for x in demand]
t_out = data['T_out'].to_list()
@ -111,7 +111,7 @@ for j in range(len(demand_watts) - control_horizon): # Adjust loop to avoid exc
hp_cop_curve_coefficients[4] * t_out_fahrenheit ** 2 +
hp_cop_curve_coefficients[5] * t_tank_fahrenheit * t_out_fahrenheit)) * hp_nominal_cop
hp_electricity[j] = q_hp[j] / hp_cop[j]
electricity_cost[j] = hp_electricity[j] * p_electricity[j]
electricity_cost[j] = hp_electricity[j] * p_electricity[j] / 4000
# Update storage discharge and tank temperature for next step
if storage_output[0] > 0.5 * max(demand_window):
@ -129,6 +129,7 @@ output["demand"] = demand_watts
output["q_hp"] = q_hp
output["hp_cop"] = hp_cop
output["hp_electricity_consumption"] = hp_electricity
output["electricity_cost"] = electricity_cost
output["m_ch"] = m_ch
output["m_dis"] = m_dis
output["t_sup_hp"] = t_sup_hp

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -31,11 +31,11 @@ for i in range(len(demand) - 1):
q_hp[i + 1] = hp_cap
m_ch[i + 1] = q_hp[i + 1] / (cp * hp_delta_t)
t_sup_hp[i + 1] = (q_hp[i + 1] / (m_ch[i + 1] * cp)) + t_tank[i + 1]
elif 40 <= t_tank[i + 1] < 55 and q_hp[i] == 0:
elif 40 <= t_tank[i + 1] < 50 and q_hp[i] == 0:
q_hp[i + 1] = 0
m_ch[i + 1] = 0
t_sup_hp[i + 1] = t_tank[i + 1]
elif 40 <= t_tank[i + 1] < 55 and q_hp[i] > 0:
elif 40 <= t_tank[i + 1] < 50 and q_hp[i] > 0:
q_hp[i + 1] = hp_cap
m_ch[i + 1] = q_hp[i + 1] / (cp * hp_delta_t)
t_sup_hp[i + 1] = (q_hp[i + 1] / (m_ch[i + 1] * cp)) + t_tank[i + 1]
@ -51,7 +51,7 @@ for i in range(len(demand) - 1):
hp_cop_curve_coefficients[4] * t_out_fahrenheit ** 2 +
hp_cop_curve_coefficients[5] * t_tank_fahrenheit * t_out_fahrenheit)) * hp_nominal_efficiency
hp_electricity[i + 1] = q_hp[i + 1] / hp_cop[i + 1]
electricity_cost[i + 1] = hp_electricity[i + 1] * p_electricity[i + 1]
electricity_cost[i + 1] = hp_electricity[i + 1] * p_electricity[i + 1] / 4000
else:
hp_cop[i + 1] = 0
hp_electricity[i + 1] = 0
@ -74,6 +74,7 @@ output["demand"] = [x * 1000 for x in demand][1:]
output["q_hp"] = q_hp[1:]
output["hp_cop"] = hp_cop[1:]
output["hp_electricity_consumption"] = hp_electricity[1:]
output["electricity_cost"] = electricity_cost[1:]
output["m_ch"] = m_ch[1:]
output["m_dis"] = m_dis[1:]
output["t_sup_hp"] = t_sup_hp[1:]