I need to create a code to model the W flow of sunlight that goes through the windows of a house based on the angle of the sun. I have a dataframe called 'new_df' with irradiance values 'irradiance366' for the year 2020. I want to use pvlib but I keep getting this error (the title) message no matter what value I put in 'surface_tilt'. Here is the part of my code :
location = pvlib.location.Location(45.384714, -71.911770, altitude=300, name=None)
times = pd.date_range(start='2020-01-01', end='2020-12-31', freq='1h')
angles = location.get_solarposition(times)
new_df = new_df.truncate(before=angles.index[0], after=angles.index[-1])
surface_sud = 10 # mètres carrés
surface_est = 5 # mètres carrés
surface_ouest = 5 # mètres carrés
puissance_sud = pvlib.irradiance.get_total_irradiance(surface_sud, angles['zenith'], angles['azimuth'],new_df['irradiance366'], surface_tilt=0, surface_azimuth=180)['poa_global']
puissance_est = pvlib.irradiance.get_total_irradiance(surface_est, angles['zenith'], angles['azimuth'],new_df['irradiance366'], surface_tilt=90, surface_azimuth=90)['poa_global']
puissance_ouest = pvlib.irradiance.get_total_irradiance(surface_ouest, angles['zenith'], angles['azimuth'],new_df['irradiance366'], surface_tilt=90, surface_azimuth=270)['poa_global']
puissance_totale = puissance_sud + puissance_est + puissance_ouest
I tried to change values of surface_tilt and i also tried to remove this part of the code.
The input parameters for the pvlib.irradiance.get_total_irradiance function looks like this:
Now you can pass in the inputs by their positions (the first parameter is the tilt). For example like this:
Alternatively, you can specify the parameters by using their names (in this case the order of the parameter doesn't matter):
In your code example above you do a mix of both. This would be ok as long as you don't specify a parameter by both it's position and using its keyword. For example, here the surface tilt is specified twice:
This matches the error message that you received "TypeError: get_total_irradiance() got multiple values for argument 'surface_tilt'"