pvlibsolar

PVLIB - DC Power From Irradiation - Simple Calculation


Dear pvlib users and devels.

I'm a researcher in computer science, not particularly expert in the simulation or modelling of solar panels. I'm interested in use pvlib since we are trying to simulate the works of a small solar panel used for IoT applications, in particular the panel spec are the following: 12.8% max efficiency, Vmp = 5.82V, size = 225 × 155 × 17 mm.

Before using pvlib, one of my collaborator wrote a code that compute the irradiation directly from average monthly values calculated with PVWatt. I was not really satisfied, so we are starting to use pvlib. In the old code, we have the power and current of the panel calculated as:

W = Irradiation * PanelSize(m^2) * Efficiency A = W / Vmp

The Irradiation, in Madrid, as been obtained with PVWatt, and this is what my collaborator used: DIrradiance = (2030.0,2960.0,4290.0,5110.0,5950.0,7090.0,7200.0,6340.0,4870.0,3130.0,2130.0,1700.0) I'm trying to understand if pvlib compute values similar to the ones above, as averages over a day for each month. And the curve of production in day. I wrote this to compare pvlib with our old model:

import math
import numpy as np
import datetime as dt
import matplotlib.pyplot as plt 
import pandas as pd
import pvlib
from pvlib.location import Location

def irradiance(day,m):
    DIrradiance =(2030.0,2960.0,4290.0,5110.0,5950.0,
                 7090.0,7200.0,6340.0,4870.0,3130.0,2130.0,1700.0)
    madrid = Location(40.42, -3.70, 'Europe/Madrid', 600, 'Madrid')
    times = pd.date_range(start=dt.datetime(2015,m,day,00,00), 
                      end=dt.datetime(2015,m,day,23,59), 
                      freq='60min')
    spaout = pvlib.solarposition.spa_python(times, madrid.latitude, madrid.longitude)
    spaout = spaout.assign(cosz=pd.Series(np.cos(np.deg2rad(spaout['zenith']))))
    z = np.array(spaout['cosz'])
    return z.clip(0)*(DIrradiance[m-1])

madrid = Location(40.42, -3.70, 'Europe/Madrid', 600, 'Madrid')
times = pd.date_range(start = dt.datetime(2015,8,15,00,00),
                  end = dt.datetime(2015,8,15,23,59), 
                  freq='60min')

old = irradiance(15,8)              # old model
new = madrid.get_clearsky(times)    # pvlib irradiance 
plt.plot(old,'r-')                  # compare them.
plt.plot(old/6.0,'y-')             # old seems 6 times more..I do not know why
plt.plot(new['ghi'].values,'b-')
plt.show()

The code above compute the old irradiance, using the zenit angle. and compute the ghi values using the clear_sky. I do not understand if the values in ghi must be multiplied by the cos of zenit too, or not. Anyway they are smaller by a factor of 6. What I'd like to have at the end is the power and current in output from the panel (DC) without any inverter, and we are not really interested at modelling it exactly, but at least, to have a reasonable curve. We are able to capture from the panel the ampere produced, and we want to compare the values from the measurements putting the panel on the roof top with the values calculated by pvlib.

Any help on this would be really appreachiated. Thanks


Sorry Will I do not care a lot about my previous model since I'd like to move all code to pvlib. I followed your suggestion and I'm using irradiance.total_irrad, the code now looks in this way:

madrid = Location(40.42, -3.70, 'Europe/Madrid', 600, 'Madrid')
times = pd.date_range(start=dt.datetime(2015,1,1,00,00), 
                  end=dt.datetime(2015,1,1,23,59), 
                  freq='60min')
ephem_data = pvlib.solarposition.spa_python(times, madrid.latitude, 
madrid.longitude)
irrad_data = madrid.get_clearsky(times)
AM = atmosphere.relativeairmass(ephem_data['apparent_zenith'])
total = irradiance.total_irrad(40, 180,
        ephem_data['apparent_zenith'], ephem_data['azimuth'],
        dni=irrad_data['dni'], ghi=irrad_data['ghi'],
        dhi=irrad_data['dhi'], airmass=AM,
        surface_type='urban')
poa = total['poa_global'].values

Now, I know the irradiance on POA, and I want to compute the output in Ampere: It is just

(poa*PANEL_EFFICIENCY*AREA) / VOLT_OUTPUT   ?

Solution

  • It's not clear to me how you arrived at your values for DIrradiance or what the units are, so I can't comment much the discrepancies between the values. I'm guessing that it's some kind of monthly data since there are 12 values. If so, you'd need to calculate ~hourly pvlib irradiance data and then integrate it to check for consistency.

    If your module will be tilted, you'll need to convert your ~hourly irradiance GHI, DNI, DHI values to plane of array (POA) irradiance using a transposition model. The irradiance.total_irrad function is the easiest way to do that.

    The next steps depend on the IV characteristics of your module, the rest of the circuit, and how accurate you need the model to be.