From a88449175cf8cd634b1fe6d33a405e2c323fae02 Mon Sep 17 00:00:00 2001 From: Lucas Tan Date: Fri, 11 Apr 2025 21:58:24 +0100 Subject: [PATCH] wip vertical panel sim --- Utilities/Shading.py | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/Utilities/Shading.py b/Utilities/Shading.py index d16f2f1..3aee959 100644 --- a/Utilities/Shading.py +++ b/Utilities/Shading.py @@ -7,7 +7,6 @@ import matplotlib.pyplot as pl import pvlib from pvfactors.geometry import OrderedPVArray from pvfactors.engine import PVEngine -import matplotlib.animation as animation from Utilities.Processes import calculate_no_of_panels, calculate_required_system_size @@ -32,8 +31,8 @@ def define_grid_layout(c, panel_tilt): # calculate pitch pitch = c["array"]["spacing"] # calculate minimum pitch if we don't want panel overlap at all - min_pitch = c["panel"]["dimensions"]["length"] * math.cos( - panel_tilt / 180 * math.pi + min_pitch = np.round( + c["panel"]["dimensions"]["length"] * math.cos(panel_tilt / 180 * math.pi), 1 ) if pitch < min_pitch: logger.warning( @@ -203,41 +202,29 @@ def calculate_energy_production(c, orientation): pvarray = engine.run_full_mode(fn_build_report=lambda pvarray: pvarray) - f, ax = pl.subplots(figsize=(10, 3)) - - def update(frame): - ax.clear() - pvarray.plot_at_idx(frame, ax, with_surface_index=True) - ax.set_title(inputs.index[frame]) - return ax - - ani = animation.FuncAnimation( - f, update, frames=len(inputs.index), interval=100, repeat=True - ) - pl.show() gamma_pdc = c["panel"]["temperature_coefficient"] temp_cell = c["panel"]["nominal_operating_cell_temperature"] p_row = no_of_panels_in_row * c["panel"]["peak_power"] p_middle_rows = (no_of_panels - 2 * no_of_panels_in_row) * c["panel"]["peak_power"] - pdc_first_row = pvlib.pvsystem.pvwatts_dc( + pdc_first_row_front = pvlib.pvsystem.pvwatts_dc( pdc0=p_row, gamma_pdc=gamma_pdc, temp_cell=temp_cell, - g_poa_effective=POA_data.at[0], + g_poa_effective=pvarray.ts_pvrows[0].front.get_param_weighted("qinc"), ) - pdc_last_row = pvlib.pvsystem.pvwatts_dc( + pdc_last_row_front = pvlib.pvsystem.pvwatts_dc( pdc0=p_row, gamma_pdc=gamma_pdc, temp_cell=temp_cell, - g_poa_effective=POA_data.at[2], + g_poa_effective=pvarray.ts_pvrows[2].front.get_param_weighted("qinc"), ) - pdc_middle_rows = pvlib.pvsystem.pvwatts_dc( + pdc_middle_rows_front = pvlib.pvsystem.pvwatts_dc( pdc0=p_middle_rows, gamma_pdc=gamma_pdc, temp_cell=temp_cell, - g_poa_effective=POA_data.at[1], + g_poa_effective=pvarray.ts_pvrows[1].front.get_param_weighted("qinc"), ) - pdc = pdc_first_row + pdc_last_row + pdc_middle_rows + pdc_front = pdc_first_row_front + pdc_last_row_front + pdc_middle_rows_front total_hourly_energy = pdc * 15 / 60 / 1e3 # convert to kWh