-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixes #50 - generates pvcell coeffs from iec 61853 #51
Conversation
* calculate iec 61853 from sandia perfmod Signed-off-by: Mark Mikofski <mark.mikofski@sunpowercorp.com>
* need to use i_c = sympy.Function('i_c')('v_c') so that d/dVc (Ic) = dIc/dVc * change alpha-Isc in comments to alpha_Isc (underscore v dash) * copy sandia2diode-python fdidv to pvmismatch/contrib/diode/two_diode.py but no changes yet * create test_didv in diode tests and copy sym_dIdV.m from the original MATLAB Sandia2diode/+two_diode packagee Signed-off-by: Mark Mikofski <mark.mikofski@sunpowercorp.com>
* also fix indentation of PVMODULES dictionary * also add test for derivatives of didv * add logging to tests * use Vmp and Imp for Vc and Ic in fvd tests * change test_data to test_data1 and test_data2 * use Isc0, Imp0 and Vmp0 from PVMODULES in gen_coeffs * move notes on derivative derivation in tests to more meaningful location Signed-off-by: Mark Mikofski <mark.mikofski@sunpowercorp.com>
* jdidv has 2 terms and denom in 1st term is squared, oops! * was comparing rs1 in test but rs2 in expected, oops! Signed-off-by: Mark Mikofski <mark.mikofski@sunpowercorp.com>
* get rid of all those ridiculous underscores, so many underscores Signed-off-by: Mark Mikofski <mark.mikofski@sunpowercorp.com>
* the MATLAB Sandia2Diode code for d(dpdv) had an error because dpdv = didv * vc + ic, but MATLAB wasn't aware that ic = f(vc) so it was missing didv derivatives, oops! * add test for dpdv and its derivatives * add newer version of fdpdv with fix * also update some module docstrings Signed-off-by: Mark Mikofski <mark.mikofski@sunpowercorp.com>
* don't use jacobian * add residual_two_diode to gen_coeffs * add constants to diode * add other diode functions like Isat(T) cubic relation and Isc(T) with linear tempco alpha_isc and how to solve for photogen coefficient to make short circuit and photogen proportionality true (aka aph) * use diode equations in derivatives * use sympy for fjrsh * start to derive and test derivatives for shunt equation Signed-off-by: Mark Mikofski <mark.mikofski@sunpowercorp.com>
* move gen_coeff.py to gen_coeff/ and diode/ to gen_coeff/diode.py * only use hybridj solver (fsolve) for now, since lm is sucky w/o derivatives * turns out everything is sucky without derivatives * change fjrsh from rsh + 1/didv to vd(1/rsh + didv) so units are in amps just like other residuals, where vd = isc*rs therefore vd/rsh = ish * add weights parameter, default is 1.0 Signed-off-by: Mark Mikofski <mark.mikofski@sunpowercorp.com>
* fix bug, remove ee from iph, since isc is already scaled to ee * change args, use imp more intuitive order, remove ee from args * fix jacobian stacking for levenberg-marquardt problems * remove weights, and allow args and kwargs to pass to solver Signed-off-by: Mark Mikofski <mark.mikofski@sunpowercorp.com>
@bmeyers this is ready for review for like a release candidate release. Can you take a quick look and let me know if you think it's okay to merge and release as v3.1rc1? Don't worry about the ugly jacobian expressions, they were generated by sympy, but I didn't simplify them at all, takes too much time and the calculation savings is in μs. Their validity is checked in the tests, so if you're inclined you can validate the sympy expressions. I won't work any more on this for awhile, but it is good enough to use with PVMismatch the way that PVMismatch is currently implemented, IE: with 2-diode model and no irradiance modification of either Unfortunately the errors of off-STC conditions vary widely between module types. This will be resolved by switching to either CEC or PVSyst model or by adding modifiers to either Rsh, Isat2 or both. The The next time we visit this, we should look into resolving the irradiance dependence of |
@mikofski taking a look now. looks like a lot of work! |
d_m = np.atleast_1d(vd_isat_growth / (m ** 2.0 * vt)) # df w.r.t. m | ||
d_vt = np.atleast_1d(vd_isat_growth / (m * vt ** 2.0)) # df w.r.t. vt | ||
jac = np.array([d_isat, d_vd, d_m, d_vt]) # jacobian | ||
return id_, jac |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 math checks out
Mark, have we done any testing with measured 61853 data to confirm that the generated coefs are consistent with the test data?
…-Ben Bourne
SunPower Corporation
650-208-6957 (c)
510-260-8388 (o)
Sent from my mobile phone
On Mar 23, 2017, at 10:28 AM, Mark Mikofski <notifications@github.com<mailto:notifications@github.com>> wrote:
@bmeyers<https://github.com/bmeyers> this is ready for review for like a release candidate release. Can you take a quick look and let me know if you think it's okay to merge and release as v3.1rc1? Don't worry about the ugly jacobian expressions, they were generated by sympy, but I didn't simplify them at all, takes too much time and the calculation savings is in μs. Their validity is checked in the tests, so if you're inclined you can validate the sympy expressions.
I won't work any more on this for awhile, but it is good enough to use with PVMismatch the way that PVMismatch is currently implemented, IE: with 2-diode model and no irradiance modification of either Isat2 or Rsh.
Unfortunately the errors of off-STC conditions vary widely between module types. This will be resolved by switching to either CEC or PVSyst model or by adding modifiers to either Rsh, Isat2 or both.
The gen_coeff methods can be used with arrays of input if the optimizer method is set to 'lm', or input at any (irr, tc) condition using the default 'hbrj' solver. Generating coefficients over the entire IEC61853 matrix do confirm that Isat1 and Rs are constant for all (irr, tc), but Isat2 and Rsh vary with irradiance.
The next time we visit this, we should look into resolving the irradiance dependence of Isat2 and Rsh.
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub<#51 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ADfNiumpXygCRSecoFMw14p4bLCNC7Esks5roqungaJpZM4MhFDn>.
|
@BenBourne unfortunately, the generated 2-diode coefficients have two issues:
This is as good as we can get it for right now. When we have time to revisit this, and improve the models to reduce the error. For now I think this PR satisfies the need to provide PVMismatch parameters at STC for any module in the SAPM database. P-series (fit with only STC measurments)E-series (fit with only STC measurments) |
inv_delta_t = 1.0 / t0k - 1.0 / tck # [1/K] | ||
exp_tstar = np.exp(EG * QE / KB * inv_delta_t) | ||
isat_t = isat0 * tstar * exp_tstar | ||
return isat_t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar with this equation. Do you mind sending me a reference so I can get up to speed?
Excellent work, Mark! |
For cubic dependence of Isat1 see Also in tests with data for PVLife the first diode in two diode model fits this relation very close. In only one diode model doesn't fit as well |
Signed-off-by: Mark Mikofski mark.mikofski@sunpowercorp.com