wip vertical panel sim

This commit is contained in:
Lucas Tan 2025-04-11 21:58:24 +01:00
parent 2504b4e5fc
commit a88449175c

View File

@ -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