Using PVLIB to simulate a system with shading losses

1.3k views Asked by At

I am following the basic examples found here to simulate a simple system's energy generation in 15 minute intervals.

I would like to know, however, how can I introduce losses in the system following the same basic example. That is, with the following code:

import pandas as pd
import matplotlib.pyplot as plt
import pvlib
from pvlib.pvsystem import PVSystem
from pvlib.location import Location
from pvlib.modelchain import basic_chain, ModelChain

#%%
naive_times = pd.DatetimeIndex(start='01-30-2017', end='08-02-2017', freq='15min')
coordinates = [(52, 4, 'Amsterdam', 10, 'Etc/GMT-1')]

sandia_modules = pvlib.pvsystem.retrieve_sam('SandiaMod')
sapm_inverters = pvlib.pvsystem.retrieve_sam('cecinverter')

module = sandia_modules['Hanwha_HSL60P6_PA_4_250T__2013_']
inverter = sapm_inverters['ABB__PVI_10_0_I_OUTD_x_US_208_y_208V__CEC_2011_']

temp_air = 20
wind_speed = 0

system = PVSystem(surface_tilt = 13, surface_azimuth = 270, module_parameters = module, modules_per_string = 20, strings_per_inverter = 2, inverter_parameters = inverter)
for latitude, longitude, name, altitude, timezone in coordinates:
    location = Location(latitude, longitude, name=name, altitude=altitude, tz=timezone)
    mc = ModelChain(system, location, orientation_strategy=None)
    mc.run_model(naive_times.tz_localize(timezone))
    ac = mc.ac
    energy = ac*0.001*0.25

    plt.figure()
    energy.plot()

I get Energy Values from Simulation

What I would like to have is a similar thing as this, obtained from real measurements:

Real measurements

In detail,

Real measurements in detail

As you can see, a lot of losses from shading, DC losses, etc.

My question now is how to proceed from my code sample and achieve a plot similar to the ones in images 2 and 3?

Thanks in advance!

1

There are 1 answers

1
j4- On

Your question is about dc losses and shading, but the biggest difference between your current ModelChain and the real system is the weather, particularly the irradiance, since two days in a row are not identical, which is due to changing cloud cover, rather than static losses.

The example on readthedocs: https://pvlib-python.readthedocs.io/en/latest/modelchain.html includes applying weather data at step 4. Further on in Demystifying ModelChain Internals, it defines weather. Unfortunately, it does not work with POA (plane of array) irradiance, which is the most common type measured on-site. However, ghi and dhi can be estimated from POA, but apparently there are no functions implemented.

weather : None or DataFrame, default None
    If None, assumes air temperature is 20 C, wind speed is 0
    m/s and irradiation calculated from clear sky data. Column
    names must be 'wind_speed', 'temp_air', 'dni', 'ghi', 'dhi'.
    Do not pass incomplete irradiation data. Use method
    :py:meth:`~pvlib.modelchain.ModelChain.complete_irradiance`
    instead.

The readthedoc page does provide some information about adding different kinds of DC losses, mostly through specific physical models (aoi or spectral). Unfortunately, shading is complex, depending on the system and its surroundings, and no one has created a shading loss module.