Parameter estimation failed

157 views
Skip to first unread message

Marvin Valentin

unread,
Dec 25, 2022, 9:36:14 PM12/25/22
to pvlib-python
Hello.

I tried to follow the tutorial on pvlib python 11: Fitting of spec sheet based model  but it gives me this feedback at the consul 

RuntimeError Traceback (most recent call last) ~\AppData\Local\Temp\ipykernel_18276\2164393158.py in <module> 32 temp_cell = pvlib.temperature.faiman(poa_data["poa_global"], poa_data["temp_air"], poa_data["wind_speed"]) 33 ---> 34 I_L_ref, I_o_ref, R_s, R_sh_ref, a_ref, Adjust = pvlib.ivtools.sdm.fit_cec_sam( 35 celltype = celltype, 36 v_mp = v_mp, ~\anaconda3\lib\site-packages\pvlib\ivtools\sdm.py in fit_cec_sam(celltype, v_mp, i_mp, v_oc, i_sc, alpha_sc, beta_voc, gamma_pmp, cells_in_series, temp_ref) 111 'Adj']]) 112 else: --> 113 raise RuntimeError('Parameter estimation failed') 114 115 RuntimeError: Parameter estimation failed

Thanks,
marvin


cwh...@sandia.gov

unread,
Dec 26, 2022, 3:30:57 PM12/26/22
to pvlib-python
Marvin,

Can you post the python code here? Happy to take a look at it.

Cheers,

Cliff

Marvin Valentin

unread,
Dec 26, 2022, 7:29:38 PM12/26/22
to pvlib-python
Thank you so much for the reply. Here is the code.

regards,
marvin

celltype = 'monoSi'
pdc0 = 400
v_mp = 44.1
i_mp = 9.08
v_oc =53.4
i_sc = 9.60
alpha_sc = 0.0005*i_sc
beta_voc = -0.0029*v_oc
gamma_pdc = 0.37
cells_in_series = 6*27
temp_ref = 25

location = Location(latitude=16.82574780563572,longitude=120.80143883656852,
                    tz = 'Asia/Manila', altitude = 3, name = 'Valentin')
surface_tilt=45
surface_azimuth=180
start = '2020-07-01 00:00'
end = '2020 -07-07 23:00'
poa_data_2020 = pd.read_csv('poa_data_2020_io.csv', index_col = 0)
poa_data_2020.index = pd.date_range(start = "2020-01-01 00:00", periods = len(poa_data_2020.index),
                                   freq = "h")
#print(location)
#print(poa_data_2020.head())
poa_data = poa_data_2020[start:end]
solarpos = location.get_solarposition(times = pd.date_range(start = start , end = end, freq = "h"))
aoi = pvlib.irradiance.aoi(surface_tilt, surface_azimuth, solarpos.apparent_zenith, solarpos.azimuth)
iam = pvlib.iam.ashrae(aoi)
effective_irradiance = poa_data['poa_direct']*iam + poa_data["poa_diffuse"]
#effect of temperature

temp_cell = pvlib.temperature.faiman(poa_data["poa_global"], poa_data["temp_air"], poa_data["wind_speed"])
I_L_ref, I_o_ref, R_s, R_sh_ref, a_ref, Adjust = pvlib.ivtools.sdm.fit_cec_sam(
    celltype = celltype,
    v_mp = v_mp,
    i_mp = i_mp,
    v_oc = v_oc,
    i_sc = i_sc,
    alpha_sc = alpha_sc,
    beta_voc = beta_voc,
    gamma_pmp = gamma_pdc,
    cells_in_series = cells_in_series,
    temp_ref = temp_ref)
cec_params = pvlib.pvsystem.calcparams_cec(effective_irradiance,
                              temp_cell,
                              alpha_sc,
                              a_ref,
                              I_L_ref,
                              I_o_ref,
                              R_sh_ref,
                              R_s,
                              Adjust)
#maximum power point
mpp = pvlib.pvsystem.max_power_point(*cec_params,
                                     method = "newton")
print(mpp)
mpp.plot(figsize = (16,9))
plt.show()
system = PVSystem(modules_per_string = 5, strings_per_inverter = 1)
dc_scaled = system.scale_voltage_current_power(mpp)
dc_scaled.plot(figsize = (16,9))
plt.show()
#AC output
#dc output of the module
#result_dc = pvlib.pvsystem.pvwatts_dc(effective_irradiance, temp_cell, pdc0, gamma_pdc = gamma_pdc, temp_ref = 25)
#result_dc.plot(figsize=(16,9))
#plt.title("DC Power")
#plt.show()

cwh...@sandia.gov

unread,
Dec 28, 2022, 11:06:21 AM12/28/22
to pvlib-python
Hi Marvin,

This appears to be a CSI (was Canadian Solar) half-cut module with 162 cells. I can reproduce that error message, and my other simple tricks didn't help (estimate per-cell by dividing voltage and voltage-related quantities by cells_in_series, estimate as if the module had full cells). The issue appears to be with the initial conditions which are behind the SAM code. I also tried pvlib.ivtools.sdm.fit_desoto and get a similar failure.

It's not clear exactly what causes the convergence to fail for this particular set of module parameters. I think it will take some research to improve the parameter fitting methods.

In the meantime, perhaps you could use the pvwatts model, which is simpler but only gives power.

Sorry I couldn't be of more help,

Cliff

Jalil Abdul

unread,
Dec 29, 2022, 2:02:25 AM12/29/22
to pvlib-python
I think this value must be minus:
gamma_pdc = 0.37

Marvin Valentin

unread,
Dec 29, 2022, 2:23:45 AM12/29/22
to Jalil Abdul, pvlib-python

--
You received this message because you are subscribed to the Google Groups "pvlib-python" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pvlib-python...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pvlib-python/0993526d-52f6-4122-a998-e9f3e99c4eeen%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages