I am developing a simple python code to calculate the solar radiation on a tilted surface using the function get_total_irradiance
from the pvlib
package. Here the code:
from pvlib import location
from pvlib import irradiance
import pandas as pd
from matplotlib import pyplot as plt
import pvlib
epw_file = "/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw"
epw_data = pvlib.iotools.read_epw(epw_file)
lat=epw_data[1]['latitude']
lon=epw_data[1]['longitude']
ghi=epw_data[0]['ghi'].tz_localize(None).reset_index(drop=True)
dni=epw_data[0]['dni'].tz_localize(None).reset_index(drop=True)
dhi=epw_data[0]['dhi'].tz_localize(None).reset_index(drop=True)
loc = location.Location(lat,lon)
times = pd.date_range(start='01-01-2001', end='12-31-2001 23:00', freq='1H')
sp = loc.get_solarposition(times)
solar_zenith=sp['apparent_zenith'].reset_index(drop=True)
solar_azimuth=sp['azimuth'].reset_index(drop=True)
POA_irradianceN = irradiance.get_total_irradiance(surface_tilt=90, surface_azimuth=0,
solar_zenith=solar_zenith, solar_azimuth=solar_azimuth, dni=dni, ghi=ghi, dhi=dhi)
POA_irradianceE = irradiance.get_total_irradiance(surface_tilt=90, surface_azimuth=90,
solar_zenith=solar_zenith, solar_azimuth=solar_azimuth, dni=dni, ghi=ghi, dhi=dhi)
POA_irradianceS = irradiance.get_total_irradiance(surface_tilt=90, surface_azimuth=180,
solar_zenith=solar_zenith, solar_azimuth=solar_azimuth, dni=dni, ghi=ghi, dhi=dhi)
POA_irradianceW = irradiance.get_total_irradiance(surface_tilt=90, surface_azimuth=270,
solar_zenith=solar_zenith, solar_azimuth=solar_azimuth, dni=dni, ghi=ghi, dhi=dhi)
According to the documentation, the surface_azimuth of a surface oriented to South should be 180°. However, it looks like the South corresponds to 90°. I tried with a different climate file from the US (USA_CA_San.Francisco.Intl.AP.724940_TMY3) and I get the same issue. However, when I try with climate files from Europe (for example ITA_Venezia-Tessera.161050_IGDG), everything works smoothly. Could it be related to the fact that the US files are based on TMY3? Any feedback?