Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
h_sol=solarRad_wall_tiled,
t_black_sky=t_black_sky)
t_air, q_air_hc = calc.simulate()
T_air_mean = hourly_average(data=t_air-273.15, times_per_hour=times_per_hour)
T_air_1 = T_air_mean[0:24]
T_air_10 = T_air_mean[216:240]
T_air_60 = T_air_mean[1416:1440]
ref_file = 'case08_res.csv'
ref_path = os.path.join(this_path, 'inputs', ref_file)
# Load reference results
(T_air_ref_1, T_air_ref_10, T_air_ref_60) = vdic.load_res(ref_path)
T_air_ref_1 = T_air_ref_1[:, 0]
T_air_ref_10 = T_air_ref_10[:, 0]
T_air_ref_60 = T_air_ref_60[:, 0]
if plot_res:
plot_result(T_air_1, T_air_ref_1, "Results day 1", "temperature")
plot_result(T_air_10, T_air_ref_10, "Results day 10", "temperature")
plot_result(T_air_60, T_air_ref_60, "Results day 60", "temperature")
max_dev_1 = np.max(np.abs(T_air_1 - T_air_ref_1))
max_dev_10 = np.max(np.abs(T_air_10 - T_air_ref_10))
max_dev_60 = np.max(np.abs(T_air_60 - T_air_ref_60))
print("Max. deviation day 1: " + str(max_dev_1))
print("Max. deviation day 10: " + str(max_dev_10))
print("Max. deviation day 60: " + str(max_dev_60))
# Compute averaged results
Q_hc_mean = np.array(
[np.mean(Q_hc[i * times_per_hour:(i + 1) * times_per_hour]) for i in
range(24 * 60)])
Q_hc_1 = Q_hc_mean[0:24]
Q_hc_10 = Q_hc_mean[216:240]
Q_hc_60 = Q_hc_mean[1416:1440]
this_path = os.path.dirname(os.path.abspath(__file__))
ref_file = 'case06_res.csv'
ref_path = os.path.join(this_path, 'inputs', ref_file)
# Load reference results
(Q_hc_ref_1, Q_hc_ref_10, Q_hc_ref_60) = vdic.load_res(ref_path)
Q_hc_ref_1 = -Q_hc_ref_1[:, 0]
Q_hc_ref_10 = -Q_hc_ref_10[:, 0]
Q_hc_ref_60 = -Q_hc_ref_60[:, 0]
# Plot comparisons
def plot_result(res, ref, title="Results day 1"):
import matplotlib.pyplot as plt
plt.figure()
ax_top = plt.subplot(211)
plt.plot(ref, label="Reference", color="black", linestyle="--")
plt.plot(res, label="Simulation", color="blue", linestyle="-")
plt.legend()
plt.ylabel("Heat load in W")
h_sol=solarRad_wall_tiled,
t_black_sky=t_black_sky)
t_air, q_air_hc = calc.simulate()
T_air_mean = hourly_average(data=t_air-273.15, times_per_hour=times_per_hour)
T_air_1 = T_air_mean[0:24]
T_air_10 = T_air_mean[216:240]
T_air_60 = T_air_mean[1416:1440]
ref_file = 'case09_res.csv'
ref_path = os.path.join(this_path, 'inputs', ref_file)
# Load reference results
(T_air_ref_1, T_air_ref_10, T_air_ref_60) = vdic.load_res(ref_path)
T_air_ref_1 = T_air_ref_1[:, 0]
T_air_ref_10 = T_air_ref_10[:, 0]
T_air_ref_60 = T_air_ref_60[:, 0]
if plot_res:
plot_result(T_air_1, T_air_ref_1, "Results day 1", "temperature")
plot_result(T_air_10, T_air_ref_10, "Results day 10", "temperature")
plot_result(T_air_60, T_air_ref_60, "Results day 60", "temperature")
max_dev_1 = np.max(np.abs(T_air_1 - T_air_ref_1))
max_dev_10 = np.max(np.abs(T_air_10 - T_air_ref_10))
max_dev_60 = np.max(np.abs(T_air_60 - T_air_ref_60))
print("Max. deviation day 1: " + str(max_dev_1))
print("Max. deviation day 10: " + str(max_dev_10))
print("Max. deviation day 60: " + str(max_dev_60))
calc.equal_air_temp = calc._eq_air_temp(
h_sol=solarRad_wall, t_black_sky=t_black_sky)
t_air, q_air_hc = calc.simulate()
T_air_mean = hourly_average(data=t_air-273.15, times_per_hour=times_per_hour)
T_air_1 = T_air_mean[0:24]
T_air_10 = T_air_mean[216:240]
T_air_60 = T_air_mean[1416:1440]
ref_file = 'case10_res.csv'
ref_path = os.path.join(this_path, 'inputs', ref_file)
# Load reference results
(T_air_ref_1, T_air_ref_10, T_air_ref_60) = vdic.load_res(ref_path)
T_air_ref_1 = T_air_ref_1[:, 0]
T_air_ref_10 = T_air_ref_10[:, 0]
T_air_ref_60 = T_air_ref_60[:, 0]
if plot_res:
plot_result(T_air_1, T_air_ref_1, "Results day 1", "temperature")
plot_result(T_air_10, T_air_ref_10, "Results day 10", "temperature")
plot_result(T_air_60, T_air_ref_60, "Results day 60", "temperature")
max_dev_1 = np.max(np.abs(T_air_1 - T_air_ref_1))
max_dev_10 = np.max(np.abs(T_air_10 - T_air_ref_10))
max_dev_60 = np.max(np.abs(T_air_60 - T_air_ref_60))
print("Max. deviation day 1: " + str(max_dev_1))
print("Max. deviation day 10: " + str(max_dev_10))
print("Max. deviation day 60: " + str(max_dev_60))
Q_hc_mean = hourly_average(data=q_air_hc, times_per_hour=times_per_hour)
Q_hc_1 = Q_hc_mean[0:24]
Q_hc_10 = Q_hc_mean[216:240]
Q_hc_60 = Q_hc_mean[1416:1440]
T_air_1 = T_air_mean[0:24]
T_air_10 = T_air_mean[216:240]
T_air_60 = T_air_mean[1416:1440]
this_path = os.path.dirname(os.path.abspath(__file__))
ref_file = "case11_res.csv"
ref_path = os.path.join(this_path, "inputs", ref_file)
# Load reference results
(load_res_1, load_res_10, load_res_60) = vdic.load_res(ref_path)
Q_hc_ref_1 = load_res_1[:, 1]
Q_hc_ref_10 = load_res_10[:, 1]
Q_hc_ref_60 = load_res_60[:, 1]
T_air_ref_1 = load_res_1[:, 0]
T_air_ref_10 = load_res_10[:, 0]
T_air_ref_60 = load_res_60[:, 0]
# Plot comparisons
if plot_res:
# plot_result(T_air_1, T_air_ref_1, "Results temperatures day 1", "temperature")
# plot_result(
# T_air_10, T_air_ref_10, "Results temperatures day 10", "temperature"
# )
# plot_result(
# T_air_60, T_air_ref_60, "Results temperatures day 60", "temperature"
calc.equal_air_temp = equalAirTemp
calc.solar_rad_in = solarRad_in
t_air, q_air_hc = calc.simulate()
T_air_mean = hourly_average(data=t_air - 273.15, times_per_hour=times_per_hour)
T_air_1 = T_air_mean[0:24]
T_air_10 = T_air_mean[216:240]
T_air_60 = T_air_mean[1416:1440]
ref_file = 'case05_res.csv'
ref_path = os.path.join(this_path, 'inputs', ref_file)
# Load reference results
(T_air_ref_1, T_air_ref_10, T_air_ref_60) = vdic.load_res(ref_path)
T_air_ref_1 = T_air_ref_1[:, 0]
T_air_ref_10 = T_air_ref_10[:, 0]
T_air_ref_60 = T_air_ref_60[:, 0]
if plot_res:
plot_result(T_air_1, T_air_ref_1, "Results day 1", "temperature")
plot_result(T_air_10, T_air_ref_10, "Results day 10", "temperature")
plot_result(T_air_60, T_air_ref_60, "Results day 60", "temperature")
max_dev_1 = np.max(np.abs(T_air_1 - T_air_ref_1))
max_dev_10 = np.max(np.abs(T_air_10 - T_air_ref_10))
max_dev_60 = np.max(np.abs(T_air_60 - T_air_ref_60))
print("Max. deviation day 1: " + str(max_dev_1))
print("Max. deviation day 10: " + str(max_dev_10))
print("Max. deviation day 60: " + str(max_dev_60))
# Compute averaged results
T_air_c = T_air - 273.15
T_air_mean = np.array(
[np.mean(T_air_c[i * times_per_hour:(i + 1) * times_per_hour]) for i in
range(24 * 60)])
T_air_1 = T_air_mean[0:24]
T_air_10 = T_air_mean[216:240]
T_air_60 = T_air_mean[1416:1440]
ref_file = 'case09_res.csv'
ref_path = os.path.join(this_path, 'inputs', ref_file)
# Load reference results
(T_air_ref_1, T_air_ref_10, T_air_ref_60) = vdic.load_res(ref_path)
T_air_ref_1 = T_air_ref_1[:, 0]
T_air_ref_10 = T_air_ref_10[:, 0]
T_air_ref_60 = T_air_ref_60[:, 0]
# Plot comparisons
def plot_result(res, ref, title="Results day 1"):
import matplotlib.pyplot as plt
plt.figure()
ax_top = plt.subplot(211)
plt.plot(res, label="Reference", color="black", linestyle="--")
plt.plot(ref, label="Simulation", color="blue", linestyle="-")
plt.legend()
plt.ylabel("Temperature in degC")
calc.internal_gains = q_ig
t_air, q_air_hc = calc.simulate()
T_air_mean = hourly_average(data=t_air-273.15, times_per_hour=times_per_hour)
T_air_1 = T_air_mean[0:24]
T_air_10 = T_air_mean[216:240]
T_air_60 = T_air_mean[1416:1440]
this_path = os.path.dirname(os.path.abspath(__file__))
ref_file = 'case03_res.csv'
ref_path = os.path.join(this_path, 'inputs', ref_file)
# Load reference results
(T_air_ref_1, T_air_ref_10, T_air_ref_60) = vdic.load_res(ref_path)
T_air_ref_1 = T_air_ref_1[:, 0]
T_air_ref_10 = T_air_ref_10[:, 0]
T_air_ref_60 = T_air_ref_60[:, 0]
if plot_res:
plot_result(T_air_1, T_air_ref_1, "Results day 1", "temperature")
plot_result(T_air_10, T_air_ref_10, "Results day 10", "temperature")
plot_result(T_air_60, T_air_ref_60, "Results day 60", "temperature")
max_dev_1 = np.max(np.abs(T_air_1 - T_air_ref_1))
max_dev_10 = np.max(np.abs(T_air_10 - T_air_ref_10))
max_dev_60 = np.max(np.abs(T_air_60 - T_air_ref_60))
print("Max. deviation day 1: " + str(max_dev_1))
print("Max. deviation day 10: " + str(max_dev_10))
print("Max. deviation day 60: " + str(max_dev_60))