0

我正在使用 PVLib 对光伏系统进行建模。我对编码和 Python 很陌生,这是我第一次使用 PVLib,所以我遇到了一些困难也就不足为奇了。

具体来说,我使用http://pvlib-python.readthedocs.io/en/latest/index.html上的大量 readthedocs 示例创建了以下代码

import pandas as pd
import numpy as np
from numpy import isnan
import datetime
import pytz

# pvlib imports
import pvlib
from pvlib.forecast import GFS, NAM, NDFD, HRRR, RAP
from pvlib.pvsystem import PVSystem, retrieve_sam
from pvlib.modelchain import ModelChain

# set location (Royal Greenwich Observatory, London, UK)
latitude, longitude, tz = 51.4769, 0.0005, 'Europe/London'

# specify time range.
start = pd.Timestamp(datetime.date.today(), tz=tz)
end = start + pd.Timedelta(days=5)
periods = 8 # number of periods that the GFS model and/or the model chain allows us to forecast power output.

# specify what irradiance variables we want
irrad_vars = ['ghi', 'dni', 'dhi']

# Use Global Forecast System model. The GFS is the US model that provides forecasts for the entire globe.
fx_model = GFS() # note: gives output in 3-hourly intervals

# retrieve data in processed format (convert temps from Kelvin to Celsius, combine elements of wind speed, complete irradiance data)
# Returns pandas.DataFrame object
fx_data = fx_model.get_processed_data(latitude, longitude, start, end)

# load module and inverter specifications
sandia_modules = pvlib.pvsystem.retrieve_sam('SandiaMod')
cec_inverters = pvlib.pvsystem.retrieve_sam('cecinverter')

module = sandia_modules['SolarWorld_Sunmodule_250_Poly__2013_'] 
inverter = cec_inverters['ABB__PVI_3_0_OUTD_S_US_Z_M_A__240_V__240V__CEC_2014_'] 

# model a fixed system in the UK. 10 strings of 250W panels, with 40 panels per string. Gives a nominal 100kW array
system = PVSystem(module_parameters=module, inverter_parameters=inverter, modules_per_string=40, strings_per_inverter=10)

# use a ModelChain object to calculate modelling intermediates
mc = ModelChain(system, fx_model.location, orientation_strategy='south_at_latitude_tilt')

# extract relevant data for model chain
mc.run_model(fx_data.index, weather=fx_data)

# OTHER CODE AFTER THIS TO DO SOMETHING WITH THE DATA

在控制台中使用了大量 print() 语句进行调试后,我可以在最后一行看到

mc.run_model(fx_data.index....

我收到以下错误:

/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/pvlib/pvsystem.py:1317: 
RuntimeWarning: divide by zero encountered in log
  module['Voco'] + module['Cells_in_Series']*delta*np.log(Ee) +
/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages/pvlib/pvsystem.py:1323: 
RuntimeWarning: divide by zero encountered in log
  module['C3']*module['Cells_in_Series']*((delta*np.log(Ee)) ** 2) +

结果,当我继续查看 ac_power 输出时,我得到了看起来像错误的数据(每小时预测不是 NaN = 3000 W)。

我非常感谢您提供的任何帮助,因为我不知道是什么原因造成的。也许我错误地指定了系统?

谢谢,马特

4

1 回答 1

1

我认为您看到的警告可以忽略。少数 pvlib 算法由于夜间 0 值等原因而发出警告。

我认为您对非 NaN 值的问题与警告无关。研究其他建模结果(存储为 mc 属性 - 请参阅文档和源代码),看看您是否可以追踪问题的根源。

于 2017-11-30T18:58:10.683 回答