Skip to content

singlediode is slow #408

Closed
Closed
@mikofski

Description

@mikofski

The single diode is taking milliseconds on my mac os x i5, and the i_mp, v_mp, and p_mp are very slightly off from the correct values.

There is another method from "Computer simulation of the effects of electrical mismatches in photovoltaic cell interconnection circuits" JW Bishop, Solar Cell (1988)

When I implement this method, the results are more accurate and about 15x to 30x faster!. Also, the pmp is higher, and cross-checking using pvs_imp = i_from_v(vmp) and vmp = v_from_i(imp) shows that the faster method is actually more accurate and still consistent with the old method.

Here are results from test_way_faster.py that compares values using assertions and also measures speed in just one loop:

In [1]: %run pvlib/test/test_way_faster.py
DEBUG:__main__:single diode elapsed time = 0.108363[s]
DEBUG:__main__:way faster elapsed time = 0.000411[s]
DEBUG:__main__:spr_e20_327 speedup = 263.657             <-- first one is much slower :(
DEBUG:__main__:single diode elapsed time = 0.007208[s]
DEBUG:__main__:way faster elapsed time = 0.000314[s]
DEBUG:__main__:fs_495 speedup = 22.9554
In [2]: %run pvlib/test/test_way_faster.py
DEBUG:__main__:single diode elapsed time = 0.00827[s]
DEBUG:__main__:way faster elapsed time = 0.000384[s]
DEBUG:__main__:spr_e20_327 speedup = 21.5365
DEBUG:__main__:single diode elapsed time = 0.008368[s]
DEBUG:__main__:way faster elapsed time = 0.000252[s]
DEBUG:__main__:fs_495 speedup = 33.2063
In [3]: %run pvlib/test/test_way_faster.py
DEBUG:__main__:single diode elapsed time = 0.006553[s]
DEBUG:__main__:way faster elapsed time = 0.000386[s]
DEBUG:__main__:spr_e20_327 speedup = 16.9767
DEBUG:__main__:single diode elapsed time = 0.00638[s]
DEBUG:__main__:way faster elapsed time = 0.000386[s]
DEBUG:__main__:fs_495 speedup = 16.5285
In [4]: %run pvlib/test/test_way_faster.py
DEBUG:__main__:single diode elapsed time = 0.006512[s]
DEBUG:__main__:way faster elapsed time = 0.000348[s]
DEBUG:__main__:spr_e20_327 speedup = 18.7126
DEBUG:__main__:single diode elapsed time = 0.010524[s]
DEBUG:__main__:way faster elapsed time = 0.000345[s]
DEBUG:__main__:fs_495 speedup = 30.5043
In [5]: %run pvlib/test/test_way_faster.py
DEBUG:__main__:single diode elapsed time = 0.00794[s]
DEBUG:__main__:way faster elapsed time = 0.0003[s]
DEBUG:__main__:spr_e20_327 speedup = 26.4667
DEBUG:__main__:single diode elapsed time = 0.007225[s]
DEBUG:__main__:way faster elapsed time = 0.000256[s]
DEBUG:__main__:fs_495 speedup = 28.2227

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions