Hello all,
I am very inexperienced to pvlib and currently working on a project where I have to simulate a pv system with singleaxis tracker, however I would like to perform the analysis considering another algortithm, different from SPA-NREL, which are the 5 solar position methods proposed by Grena.
According to an article proposed by the author, the codes are available in C++, then for the period that I want to evaluate (feb-2021 to dec-2021) I obtained the hourly angles for azimuth and zenith, as example for GRENA1 attached.
With this CSV file, I wrote the code below. First I read the csv file, then I include the angles in the function tracking.singleaxis to obtain orientation. I am not having any errors, however I am not getting any valid results.
With this I am trying to simulate a single axis system with 24 modules and 1 inverter as indicated. Is there anyone who might have a look in the code and help me identify what I am doing wrong?
Thank you all,
-----------------------------------------------
import pvlib
import pandas as pd
from pvlib import location
from pvlib import tracking
from pvlib.bifacial.pvfactors import pvfactors_timeseries
from pvlib import temperature
from pvlib import pvsystem
import matplotlib.pyplot as plt
from pvlib.temperature import TEMPERATURE_MODEL_PARAMETERS
import warnings
# define location
lat, lon = -21.995585, -46.784271
tz = 'America/Sao_Paulo'
site_location = location.Location(lat, lon, tz=tz, name='São J')
altitude = 767
tmy = pd.read_csv("pvlib_soufer_fevtodez.csv", index_col=0)
tmy.index = pd.to_datetime(tmy.index)
# define temp models
temperature_parameters = TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_glass']
# read calculated angles and orientation in accordance with Grena position
angulos = pd.read_csv('C:/Users/nadine.figueiredo/.spyder-py3/angulosgren1.csv')
gcr = 0.35
max_phi = 60
orientation = tracking.singleaxis(angulos['apparent_zenith'],
angulos['apparent_azimuth'],
max_angle=max_phi,
backtrack=False,
gcr=gcr
)
#procedural modeling - POA
pressure=pvlib.atmosphere.alt2pres(altitude)
dni_extra = pvlib.irradiance.get_extra_radiation(tmy.index)
airmass = pvlib.atmosphere.get_relative_airmass(angulos['apparent_zenith'])
am_abs = pvlib.atmosphere.get_absolute_airmass(airmass, pressure)
aoi = pvlib.irradiance.aoi(
orientation['surface_tilt'],
orientation['surface_azimuth'],
angulos["apparent_zenith"],
angulos["apparent_azimuth"],
)
total_irradiance = pvlib.irradiance.get_total_irradiance(
orientation['surface_tilt'],
orientation['surface_azimuth'],
angulos['apparent_zenith'],
angulos['apparent_azimuth'],
tmy['dni'],
tmy['ghi'],
tmy['dhi'],
dni_extra=dni_extra,
model='haydavies')
cell_temperature = pvlib.temperature.sapm_cell(
total_irradiance['poa_global'],
tmy["temp_air"],
tmy["wind_speed"],
**temperature_parameters,)
# system
sandia_modules = pvlib.pvsystem.retrieve_sam('SandiaMod')
cec_inverters = pvlib.pvsystem.retrieve_sam('CECInverter')
module = sandia_modules['Canadian_Solar_CS5P_220M___2009_']
inverter = cec_inverters['Fronius_USA__Fronius_Primo_3_8_1_208_240__240V_']
modules_per_string= 24
strings_per_inverter= 1
system = {'module': modules_per_string*module, 'inverter': inverter}
effective_irradiance = pvlib.pvsystem.sapm_effective_irradiance(
total_irradiance['poa_direct'],
total_irradiance['poa_diffuse'],
am_abs,
aoi,
module,)
dc = pvlib.pvsystem.sapm(effective_irradiance, cell_temperature, module)
ac = pvlib.inverter.sandia(dc['v_mp'], dc['p_mp'], inverter)
annual_energy = ac.sum()