Skip to content

make some methods private in pvsystem #67

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

Merged
merged 1 commit into from
Jun 21, 2015
Merged
Changes from all commits
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
26 changes: 8 additions & 18 deletions pvlib/pvsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -922,12 +922,12 @@ def singlediode(module, IL, I0, Rs, Rsh, nNsVth, **kwargs):
DFOut['I0'] = I0
DFOut['IL'] = IL

__, Voc_return = golden_sect_DataFrame(DFOut, 0, module.V_oc_ref*1.6,
Voc_optfcn)
__, Voc_return = _golden_sect_DataFrame(DFOut, 0, module.V_oc_ref*1.6,
_Voc_optfcn)
Voc = Voc_return.copy()

Pmp, Vmax = golden_sect_DataFrame(DFOut, 0, module.V_oc_ref*1.14,
pwr_optfcn)
Pmp, Vmax = _golden_sect_DataFrame(DFOut, 0, module.V_oc_ref*1.14,
_pwr_optfcn)
Imax = I_from_V(Rsh=Rsh, Rs=Rs, nNsVth=nNsVth, V=Vmax, I0=I0, IL=IL)
# Invert the Power-Current curve. Find the current where the inverted power
# is minimized. This is Imax. Start the optimization at Voc/2
Expand Down Expand Up @@ -963,14 +963,11 @@ def singlediode(module, IL, I0, Rs, Rsh, nNsVth, **kwargs):

# Created April,2014
# Author: Rob Andrews, Calama Consulting
# These may become private methods in 0.2

def golden_sect_DataFrame(df, VL, VH, func):
def _golden_sect_DataFrame(df, VL, VH, func):
'''
Vectorized golden section search for finding MPPT
from a dataframe timeseries.

Do not expect this function to remain in the public API.

Parameters
----------
Expand Down Expand Up @@ -1031,27 +1028,22 @@ def golden_sect_DataFrame(df, VL, VH, func):
if iterations >50:
raise Exception("EXCEPTION:iterations exeeded maximum (50)")


return func(df,'V1') , df['V1']


def pwr_optfcn(df, loc):
def _pwr_optfcn(df, loc):
'''
Function to find power from I_from_V.

Do not expect this function to remain in the public API.
'''

I = I_from_V(Rsh=df['Rsh'], Rs=df['Rs'], nNsVth=df['nNsVth'], V=df[loc],
I0=df['I0'], IL=df['IL'])
return I*df[loc]


def Voc_optfcn(df, loc):
def _Voc_optfcn(df, loc):
'''
Function to find V_oc from I_from_V.

Do not expect this function to remain in the public API.
'''
I = -abs(I_from_V(Rsh=df['Rsh'], Rs=df['Rs'], nNsVth=df['nNsVth'],
V=df[loc], I0=df['I0'], IL=df['IL']))
Expand All @@ -1064,13 +1056,11 @@ def I_from_V(Rsh, Rs, nNsVth, V, I0, IL):
uses Lambert W implemented in wapr_vec.m
Rsh, nVth, V, I0, IL can all be DataFrames
Rs can be a DataFrame, but should be a scalar.

Do not expect this function to remain in the public API.
'''
try:
from scipy.special import lambertw
except ImportError:
raise ImportError('The I_from_V function requires scipy')
raise ImportError('This function requires scipy')

argW = (Rs*I0*Rsh * np.exp(Rsh*(Rs*(IL+I0)+V) /
(nNsVth*(Rs+Rsh))) / (nNsVth*(Rs + Rsh)) )
Expand Down