Код: Выделить всё
Pac0 = 330*1000
Pnt = 20
sandia_params = pvlib.inverter.fit_sandia(ac_power,
dc_power,
dc_voltage,
dc_voltage_level,
Pac0, Pnt)
dc_voltage — это массив из 18 элементов int64.
dc_voltage_level — список из 18 строк. со значениями, которые либо 'Vmin', 'Vnom' или 'Vmax', как указано в документации.
В в частности, dc_voltage_level — это
Код: Выделить всё
['Vmax', 'Vmax', 'Vmax', 'Vmax', 'Vmax', 'Vmax',
'Vnom', 'Vnom', 'Vnom', 'Vnom','Vnom', 'Vnom',
'Vmin', 'Vmin', 'Vmin', 'Vmin', 'Vmin', 'Vmin']
Код: Выделить всё
d:\michele\documents modello-fisico\ plant
simulation\inverter_data.py:67: RuntimeWarning: invalid value
encountered in divide
ac_power_array / eff_array)
Traceback (most recent call last):
File D:\Michele\Documentsmodello-fisico\venv\lib\site-
packages\spyder_kernels\customize\utils.py:209 in
exec_encapsulate_locals
exec_fun(compile(code_ast, filename, "exec"), globals, None)
File d:\michele\documents\modello-fisico\gaibanella plant
simulation\inverter_data.py:103
sandia_params = pvlib.inverter.fit_sandia(ac_power,
File D:\Michele\Documents\modello-fisico\venv\lib\site-
packages\pvlib\inverter.py:530 in fit_sandia
c, b, a = polyfit(x, y, 2)
File D:\Michele\Documents\modello-fisico\venv\lib\site-
packages\numpy\polynomial\polynomial.py:1467 in polyfit
return pu._fit(polyvander, x, y, deg, rcond, full, w)
File D:\Michele\Documents\modello-fisico\venv\lib\site-
packages\numpy\polynomial\polyutils.py:599 in _fit
raise TypeError("expected 1D vector for x")
TypeError: expected 1D vector for x
Код: Выделить всё
for d in voltage_levels:
x = dc_power[dc_voltage_level == d]
y = ac_power[dc_voltage_level == d]
# [2] STEP 3B
print('x.shape returns:')
print(x.shape)
# fit a quadratic to (DC power, AC power)
c, b, a = polyfit(x, y, 2)
Функция polyfit импортируется с помощью
Код: Выделить всё
from numpy.polynomial.polynomial import polyfit # different than np.polyfit
Я не совсем уверен, является ли это неправильным использованием этой функции с моей стороны или, возможно, ошибкой. Любая помощь будет оценена по достоинству.
Подробнее здесь: https://stackoverflow.com/questions/792 ... -when-call