8000 WIP: Speed up singlediode._lambertw by cwhanse · Pull Request #1661 · pvlib/pvlib-python · GitHub
[go: up one dir, main page]

Skip to content

WIP: Speed up singlediode._lambertw #1661

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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
10000 Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix stuff
  • Loading branch information
cwhanse committed Feb 14, 2023
commit 60988858642d6eecbc1f0a404dcff0af8f976c6f
25 changes: 11 additions & 14 deletions benchmarks/benchmarks/singlediode.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@
# from numpy.random import Generator, MT19937
from pvlib import singlediode as _singlediode

seed = 11471

rng = RandomState(seed)
base_params = (1., 5.e-9, 0.5, 2000., 72 * 1.1 * 0.025)
nsamples = 10000


def b88(params):
# for a fair comparison, need to also compute isc, voc, i_x and i_xx
Expand All @@ -27,15 +21,18 @@ def b88(params):

class SingleDiode:

def setup(self, base_params, nsamples):
self.il = 9. * rng.rand(nsamples) + 1. # 1.- 10. A
self.io = 10**(-9 + 3. * rng.rand(nsamples)) # 1e-9 to 1e-6 A
self.rs = 5. * rng.rand(nsamples) + 0.05 # 0.05 to 5.05 Ohm
self.rsh = 10**(2 + 2 * rng.rand(nsamples)) # 100 to 10000 Ohm
self.n = 1 + 0.7 * rng.rand(nsamples) # 1.0 to 1.7
def setup(self):
seed = 11471
rng = RandomState(seed)
nsamples = 10000
il = 9. * rng.rand(nsamples) + 1. # 1.- 10. A
io = 10**(-9 + 3. * rng.rand(nsamples)) # 1e-9 to 1e-6 A
rs = 5. * rng.rand(nsamples) + 0.05 # 0.05 to 5.05 Ohm
rsh = 10**(2 + 2 * rng.rand(nsamples)) # 100 to 10000 Ohm
n = 1 + 0.7 * rng.rand(nsamples) # 1.0 to 1.7
# 72 cells in series, roughly 25C Tcell
self.nNsVth = 72 * self.n * 0.025
self.params = (self.il, self.io, self.rs, self.rsh, self.nNsVth)
nNsVth = 72 * n * 0.025
self.params = (il, io, rs, rsh, nNsVth)

def time_bishop88(self):
b88(*self.params)
Expand Down
5 changes: 2 additions & 3 deletions docs/sphinx/source/user_guide/singlediode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ where

pvlib-python supports two ways to solve the single diode equation:

1. Lamberts W function
1. Using the Lambert W function
2. Bishop's algorithm

The :func:`pvlib.pvsystem.singlediode` function allows the user to choose the
4AE7 method using the ``method`` keyword.
The :func:`pvlib.pvsystem.singlediode` function's ``method`` keyword allows the user to choose the solution method.

Lambert W-Function
------------------
Expand Down
0