Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/305.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python PVLib并行组合IV曲线_Python_Pvlib - Fatal编程技术网

Python PVLib并行组合IV曲线

Python PVLib并行组合IV曲线,python,pvlib,Python,Pvlib,我正在使用PVLib来模拟由于失配效应导致的光伏功率损失 是否可以添加并联连接的模块IV曲线 类似于: def combine_series(dfs): """ Combine IV curves in series by aligning currents and summing voltages. The current range is based on the first curve's current range. &quo

我正在使用PVLib来模拟由于失配效应导致的光伏功率损失

是否可以添加并联连接的模块IV曲线

类似于:

def combine_series(dfs):
    """
    Combine IV curves in series by aligning currents and summing voltages.
    The current range is based on the first curve's current range.
    """
    df1 = dfs[0]
    imin = df1['i'].min()
    imax = df1['i'].max()
    i = np.linspace(imin, imax, 1000)
    v = 0
    for df2 in dfs:
        v_cell = interpolate(df2, i)
        v += v_cell
    return pd.DataFrame({'i': i, 'v': v})
不同的是,它应该并行组合

非常感谢你, 基里安

我想我明白了:

def interpolate_p(df, v):
"""convenience wrapper around scipy.interpolate.interp1d"""
f_interp = interp1d(df['v'], df['i'], kind='linear',
                    fill_value='extrapolate')
return f_interp(v)

def combine_parallel(dfs):
"""
Combine IV curves in parrallel by aligning voltages and summing currents.
The current range is based on the first curve's voltage range.
"""
df1 = dfs[0]
imin = df1['v'].min()
imax = df1['v'].max()
v = np.linspace(imin, imax, 1000)
i = 0
for df2 in dfs:
    v_cell = interpolate_p(df2, v)
    i += v_cell
return pd.DataFrame({'i': i, 'v': v})
我想这是成功的。请随意使用并告诉我我是否错了,或者PVLib中是否有其他函数

问候
基里安

很高兴看到你自己试一试。不过,我会重新命名其中的一些变量。它看起来有点奇怪,以增加电压和电流…真的!!!谢谢你的提示:)