AttributeError: 'PVSystem' object has no attribute 'racking_model'

118 views Asked by At

While using pvlib/feedinlib for my Master thesis, I am running into an error that I cannot seem to figure out, which is the following:

AttributeError: 'PVSystem' object has no attribute 'racking_model'

I have added my full code at the bottom of this post (mostly copied from several examples). After reading the pvlib documentation, I believe 'racking_model' should be one of the attributes/parameters of PVSystem and should even have a default value. I tried everything I can think of and even took a look at the source code, which where the issue seems to 'occur', but did not get any further.

What I have figured out is that the code is working fine up until the point where the irradiation in the considered coordinate is plotted. The problem seems to be in the part where the feedin is calculated (without this not errors occur).

Does anyone know where this error might be coming from? Any help would be greatly appreciated!

    from feedinlib import era5
    import cdsapi
    import matplotlib.pyplot as plt
    import pvlib
    from feedinlib import Photovoltaic
    from feedinlib import get_power_plant_data
    from shapely.geometry import Point
    from pvlib import pvsystem


    # get modules
    module_df = get_power_plant_data(dataset='SandiaMod')
    # print the first four modules
    module_df.iloc[:, 1:5]

    # get inverter data
    inverter_df = get_power_plant_data(dataset='cecinverter')
    # print the first four inverters
    inverter_df.iloc[:, 1:5]

    system_data = {
        'module_name': 'Advent_Solar_Ventura_210___2008_',  # module name as in database
        'inverter_name': 'ABB__MICRO_0_25_I_OUTD_US_208__208V_',  # inverter name as in database
        'azimuth': 180,
        'tilt': 30,
        'albedo': 0.2,
        }
    pv_system = Photovoltaic(**system_data) #pvsystem.PVSystem(surface_tilt=30,surface_azimuth=90) 


    latitude = 52.4
    longitude = 13.5
    #location = Point(longitude,latitude)

    # set start and end date (end date will be included
    # in the time period for which data is downloaded)
    start_date, end_date = '2015-01-01', '2015-02-01'
    # set variable set to download
    variable = 'pvlib'

    era5_netcdf_filename = 'ERA5_weather_data.nc'

    area = [longitude, latitude] #location of production

    pvlib_df = era5.weather_df_from_era5(
        era5_netcdf_filename='ERA5_weather_data.nc',
        lib='pvlib', area=area)

    #matplotlib inline
    pvlib_df.loc[:, ['dhi', 'ghi']].plot(title='Irradiance')
    plt.xlabel('Time')
    plt.ylabel('Irradiance in $W/m^2$');


    feedin = pv_system.feedin(
        weather=pvlib_df,
        location=(latitude, longitude))


    #matplotlib inline
    feedin.plot(title='PV feed-in')
    plt.xlabel('Time')
    plt.ylabel('Power in W');
1

There are 1 answers

0
Amir P On

This is apparently due to a bug in pvlib.

In older versions, PVSystem object has the racking_model attribute, while in 0.10.3 this attribute is moved to system.arrays[i].mount.racking_model

As it seems from the main branch of pvlib Github, this bug is going to be resolved with the next release. (compare v0.10.3 with main)

You may be able to skip this problem by passing temperature_model_parameters to pvlib.pvsystem.Array object.This way pvlib.modelchain.infer_temperature_model will not be called.