SunPower / PVMismatch

An explicit Python PV system IV & PV curve trace calculator which can also calculate mismatch.
http://sunpower.github.io/PVMismatch/
BSD 3-Clause "New" or "Revised" License
79 stars 30 forks source link

Fix mpp temperature sensitivity #68

Closed rayhickey closed 6 years ago

rayhickey commented 6 years ago

Fixes I_mp and V_mp sensitivity to temperature caused by selecting Isys and Vsys values at the maximum Psys index. This is accomplished by linear interpolation between the points surrounding MPP. Previously: i_mp_temp_old Now: i_mp_temp_new

rayhickey commented 6 years ago

TODO:

mikofski commented 6 years ago

See #67 for more comments on this topic.

chetan201 commented 6 years ago

@rayhickey This PR can be merged when the Travis CI tests pass. Please let us know if you need any help.

mikofski commented 6 years ago

Should close #65

rayhickey commented 6 years ago

Runtime benchmarking using the following code:

import timeit
setup = """
# from pvmismatch.pvmismatch_lib
import pvsystem
from pvconstants import PVconstants
pvs = pvsystem.PVsystem(pvconst=PVconstants())
"""
code = 'pvs.setTemps(300.)'
timeit.timeit(setup=setup, stmt=code, number=100)

Baseline, 101 points, 100 runs: 1.01 s/run Baseline, 1001 points, 100 runs: 2.66 s/run Baseline, 10001 points, 10 runs: 28.73 s/run Linear interpolation, 101 points, 100 runs: 1.03 s/run Linear interpolation, 1001 points, 100 runs: 2.74 s/run Linear interpolation, 10001 points, 10 runs: 27.48 s/run

Linear interpolation has the most predictable behavior, especially with fewer points. Increasing the number of points reduces the variation additionally when interpolating, but with systems larger than one module the number of points required adds too much time. I think keeping the number of points at 101 is fine for now. imp_npts

chetan201 commented 6 years ago

@rayhickey I take it this is safe to merge now?