-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Ideal PV devices are not supported #324
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
Comments
Update: Sufficiently large values of Very small, yet strictly positive, My concern here is that sometimes parameter fitting routines return resistance values that are at/near these edge cases. |
I support these additions. Perhaps we set a threshold above which Rsh is considered as Inf. Mark can you post a set of parameters which give trouble with high Rsh?
…Sent from my iPhone
On May 10, 2017, at 7:02 PM, Mark Campanelli <[email protected]<mailto:[email protected]>> wrote:
Update: Sufficiently large values of resistance_shunt cause numerical issues as well. I'm not sure about the computational overhead to detect large Rsh issues and then possibly swap in the infinite shunt resistance approximation as appropriate.
Very small, yet strictly positive, resistance_series values seem to be better behaved in pvlib.pvsystem.singlediode(), which appears to rely heavily on pvlib.pvsystem.i_from_v(). I have not explored the "edge" behavior of pvlib.pvsystem.v_from_i(), but that is apparently called in pvlib.pvsystem.singlediode() to get Voc.
My concern here is that sometimes parameter fitting routines return resistance values that are at/near these edge cases.
-
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<#324 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AFJNL7gVnfi7t6TUEU-2fNFzLUABd_3rks5r4l4dgaJpZM4NXYRV>.
|
Solving the single diode equation is a lot easier when there is an infinite shunt resistance. I would suggest implementing a simpler solver to handle that case, if the general solver has trouble. |
In my own code I compute the explicit ideal model first (depends on
I_from_V vs. V_from_I case), then replace values at those indices that
produce a lower absolute residual for the implicitly computed model. It is
perhaps not the most efficient, but it does not require arbitrary
thresholds. I would provide benchmarking if I pursued that path for this PR.
Will: Thanks for the other issue references. Hope to review soonish.
Cliff: I think Rsh=1.e10 in the previous dataset should generate an exp
overflow in the Voc computation. However, the function seems to still
return reasonable values.
|
I haven't forgotten about this. I think I may have a new solution here that covers both the typical and edge cases cleanly, efficiently, flexibly with respect to various input dimensions, and with surprisingly little code (leveraging numpy's ufunc's). My only question is how well the new algorithm converges for devices with very high series resistance (in the current computation given voltage) and/or low shunt resistance (in the voltage computation given current). At the risk of appearing lazy here, can anyone point me to the specific unit tests around computing I-V curves? |
These are probably the most relevant: There are some other tests in |
@wholmgren Thanks for the unit test ref's. I need some guidance on how to set up my local fork to allow me to run unit tests with pytest. Currently, I use pip to do a re-install of my local fork before I can run the unit tests against any code change using |
Just to confirm: you ran |
Yeah, it looks like I missed the -e part. I will give that a try. Thanks yet again.
|
@wholmgren pvlib.pvsystem.i_from_v() indicates that it returns "current : np.array". However, test_i_from_v() takes python scalars as input arguments and returns a numpy.float64, not a numpy.ndarray. Is numpy.float64 considered a subtype of np.array? More generally, what is the difference between numpy.array and numpy.ndarray? |
The numpy array type is ndarray, not array. The array function creates ndarray objects. So, the i_from_v docstring should read "current: np.ndarray or np.float64" numpy.float64 is not a subtype of np.ndarray: >>> isinstance(np.float64(5), np.ndarray)
False |
Thanks for clarifying. These types behave a bit strange under the simplest of operations: print(type(np.array(1.)))
print(type(np.array(1.) + np.array(1.))) returns <class 'numpy.ndarray'>
<class 'numpy.float64'> |
Yeah, I've never fully understood the type or broadcasting rules for numpy scalar or scalar-like arrays. The important thing for our function is that if you put scalars in, you get a scalar-like thing out, and if you put arrays in, you get arrays out. Other pvlib functions also guarantee that if you put a Series in, you get a series out, but this one does not. |
Draft PR created: #340 |
* Add draft i_from_v_alt function with tests * Better comments and more explicit typing * Use transform from shunt resistance to shunt conductance * Add v_from_i_alt() with initial tests and use np.where * Use test fixtures * Add @requires_scipy to test fixtures * More current_sum_at_diode_node() tests and using fixture * Naming, documentation, and formatting * Deprecate replaced functions and flake8 * Add release documentation and flake8 again * Replace deprecated function usages and update test_singlediode_series_ivcurve * Conform to existing API * Run flake8 * Implement some code quality suggestions * Remove extraneous print statements * Better docstrings * Fix parameter ranges in docstrings * Add test that overflows lambertw arg * Add test for mixed solution types logic * Use broadcast_arrays for cleaner code * One more simplification * Better use of broadcast_arrays
One cannot define
resistance_series = 0
orresistance_shunt = numpy.inf
as "ideal" device parameters inpvlib.pvsystem.singlediode()
. See the error below for example.Is this feature valued enough for me to make a PR that adds this capability?
Input:
with output:
The text was updated successfully, but these errors were encountered: