Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
c33d65d
change location default tz to utc
wholmgren Oct 28, 2015
d965f26
a mess of pvsystem and location stuff thats not working
wholmgren Oct 28, 2015
e1ad189
add SingleAxisTracker. more brainstorming
wholmgren Oct 28, 2015
b4cc4b7
fix import error
wholmgren Nov 10, 2015
e92acdd
add get_solarposition and get_clearsky
wholmgren Nov 10, 2015
27fd18e
add get_irradiance, simple doc strings, and a few kwargs
wholmgren Nov 10, 2015
82f28ba
make solarposition.spa_python work without Location
wholmgren Nov 10, 2015
cb22f24
add doc links and n_modules kwargs
wholmgren Nov 10, 2015
ca0c6ba
add altitude
wholmgren Nov 10, 2015
2524995
get_clearsky works
wholmgren Nov 10, 2015
c5d55d3
add v0.3.0 description
wholmgren Nov 10, 2015
697e8d2
remove Location inheritance from PVSystem
wholmgren Nov 13, 2015
ff0fb3b
remove Location inheritance from SAT
wholmgren Nov 13, 2015
e2a22cf
remove Location inheritance from SAT
wholmgren Nov 13, 2015
b9d41c8
fix klucher spelling
wholmgren Nov 11, 2015
b01dc5a
add klucher to total_irrad test list
wholmgren Nov 11, 2015
0c5cf68
fix bad paper link
wholmgren Nov 13, 2015
58bb3f5
add release date
wholmgren Nov 13, 2015
2465ae1
more slow progress
wholmgren Nov 15, 2015
ddc8816
addes classes. rename modules
wholmgren Nov 15, 2015
7e108ec
add LocalizedPVSystem. improve docs a little
wholmgren Nov 15, 2015
37a36da
add stub modelchain
wholmgren Nov 16, 2015
cddf91d
make package overview doc
wholmgren Nov 16, 2015
a381049
doc improvements
wholmgren Nov 16, 2015
ed6dc81
more doc stuff
wholmgren Nov 16, 2015
1a677d6
make aoi loss models have a consistent signature
wholmgren Nov 16, 2015
515d97a
flesh out modelchain a little
wholmgren Nov 16, 2015
3b7cd9a
remove location from solarposition module. enforce localized or utc t…
wholmgren Dec 21, 2015
b2d33ff
move iam args into PVSystems self.module_parameters
wholmgren Dec 21, 2015
dc75691
get test_pvsystem working with new ineichen sig. add dummy class tests
wholmgren Dec 21, 2015
10775e2
make test_clearsky work with new sig. fails due to changes in ephem m…
wholmgren Dec 21, 2015
66b3603
make altitude a kwarg
wholmgren Dec 21, 2015
ad7c990
make test_irradiance work with new ineichen sig
wholmgren Dec 21, 2015
358accd
make test_atmosphere work with new solpos sig
wholmgren Dec 21, 2015
34b925d
merge ci/appveyor/rtdconda into pvsystem
wholmgren Jan 18, 2016
6036106
fix cs test numbers due to new solpos
wholmgren Jan 18, 2016
2d14082
add has_ephem, modify tests for min pandas compatibility
wholmgren Jan 19, 2016
125cae2
further fixes to min req and transition to all nrel_numpy defaults
wholmgren Jan 19, 2016
04f477f
pull in some @MoonRaker changes to docs conf.py
wholmgren Jan 19, 2016
aa52f5f
fix pvlib/pvlib-python#105, add poa_diffuse
wholmgren Jan 19, 2016
7120082
standardize sapm_celltemp arg names. add dict/Series input
wholmgren Jan 19, 2016
a366714
get the procedural code example working in the docs
wholmgren Jan 19, 2016
c3073f0
change rtd python to 3.5 to use dict unpacking
wholmgren Jan 19, 2016
560bf84
add recommonmark
wholmgren Jan 19, 2016
96449ba
remove recommonmark. problem was in rtd admin config
wholmgren Jan 19, 2016
eae606c
back to 2.7...
wholmgren Jan 20, 2016
3ca9fdd
fix python 2.7 issues in doc example. make plotting work
wholmgren Jan 20, 2016
e5d77d5
minor markup correction
Jan 21, 2016
7d49393
add get_absoluteairmass
wholmgren Jan 30, 2016
c541abd
add get_aoi, dni/am calcs
wholmgren Jan 30, 2016
f46ef23
run_model finally works
wholmgren Jan 30, 2016
0d5bf83
update mc part of overview
wholmgren Jan 30, 2016
7a863fc
more doc improvements
wholmgren Jan 30, 2016
2bbc618
more doc improvements
wholmgren Jan 30, 2016
0f36234
create PVSystem.localize, allow LocalizedPVSystem pvsystem and locati…
wholmgren Jan 30, 2016
67744b0
update docs with LocalizedPVSystem improvements
wholmgren Jan 30, 2016
64a8fec
fix small typos
wholmgren Jan 30, 2016
176495c
fix small typos
wholmgren Jan 30, 2016
d030bb2
try short sphinx class refs
wholmgren Jan 30, 2016
d8b9968
trying to track down model differences
wholmgren Jan 30, 2016
55fa894
fix azimuth prob in docs
wholmgren Jan 30, 2016
9901538
maybe fixed discrepancies...
wholmgren Jan 30, 2016
a2fc762
add irradiance and weather kwargs to run_model
wholmgren Jan 30, 2016
eb8a803
merge pvlib/master into pvsystem
wholmgren Jan 31, 2016
fe5d021
clean up merge cruft
wholmgren Jan 31, 2016
3f96b89
convert get_airmassabsolute to get_airmass. add a bunch of failing st…
wholmgren Jan 31, 2016
63da5e6
fix silly syntax error
wholmgren Jan 31, 2016
9d8c374
fix pd import, default am model, ValueError text
wholmgren Jan 31, 2016
8aa8d53
editing docs
wholmgren Jan 31, 2016
862e0f0
editing docs
wholmgren Jan 31, 2016
aeb02e8
fix tmy2 metadata label problem
wholmgren Jan 31, 2016
28ed812
break AIRMASS_MODELS into *_ZENITH_MODELS
wholmgren Jan 31, 2016
cf1c1f3
small clean ups
wholmgren Jan 31, 2016
3391abf
add pressure, temperature to get_solarposition. make from_tmy work
wholmgren Jan 31, 2016
c547c3c
make location tests work
wholmgren Jan 31, 2016
bcb41ae
update whatsnew. might still be missing a few things
wholmgren Jan 31, 2016
ac6f710
remove sphinx markup from see also numpy doc section
wholmgren Jan 31, 2016
49c670d
implement modelchain tests
wholmgren Feb 1, 2016
df389aa
implement PVSystem tests
wholmgren Feb 1, 2016
4bfff5a
Merge remote-tracking branch 'wholmgren/pvsystem' into origin/pvsystem
Feb 1, 2016
5fc704e
Minor changes to the documentation
Feb 1, 2016
cd0da5b
highly experimental LocalizedSingleAxisTracker
wholmgren Feb 1, 2016
911ceff
typo
dacoex Feb 1, 2016
d41053c
contributors
dacoex Feb 1, 2016
01b5ff5
added python 3
dacoex Feb 3, 2016
50da307
Merge pull request #2 from dacoex/pvsystem
wholmgren Feb 7, 2016
96a6884
add api changes to whatsnew
wholmgren Feb 7, 2016
9e5ca7c
fix small doc issues
wholmgren Feb 8, 2016
feef0b5
add tests, fix attribute error
wholmgren Feb 10, 2016
9025cfc
pin to ipython 4.0.1
wholmgren Feb 10, 2016
96e7eb3
more tests for location
wholmgren Feb 10, 2016
4c3ad9b
lots of pvsystem tests
wholmgren Feb 11, 2016
ab6063f
solarposition.get_solarposition is smart about alt pressure kwargs
wholmgren Feb 20, 2016
ee32772
add basic_chain to modelchain
wholmgren Feb 20, 2016
99aea92
merge masters pep8 changes into this branch
wholmgren Feb 20, 2016
1494117
more pep8 and doc line length
wholmgren Feb 20, 2016
0002bd0
clean up modelchain documentation
wholmgren Mar 7, 2016
23d3727
remove unused mc stuff
wholmgren Mar 7, 2016
6448172
remove removed specificchain from classes doc
wholmgren Mar 7, 2016
67d45f8
add basic_chain to package_overview
wholmgren Mar 7, 2016
31e323d
add altitude and pressure kwargs to basic_chain
wholmgren Mar 7, 2016
a17379f
pin appveyors scipy to 0.16 to avoid yet another continuum package issue
wholmgren Mar 7, 2016
5280cb9
add test for orientation prop, altitude/pressure kwargs
wholmgren Mar 7, 2016
8c9c89d
correction, appveyor scipy=0.16.0. ugh
wholmgren Mar 7, 2016
ab69f9a
run_model now returns self
wholmgren Mar 7, 2016
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
lots of pvsystem tests
  • Loading branch information
wholmgren committed Feb 11, 2016
commit 4c3ad9b30c2bc860720a53ff89e87b7e8a0fac28
20 changes: 11 additions & 9 deletions 20 pvlib/pvsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def get_irradiance(self, solar_zenith, solar_azimuth, dni, ghi, dhi,
dni_extra=None, airmass=None, model='haydavies',
**kwargs):
"""
Uses the :func:`irradiance.total_irrad` function to calculate
Uses the :py:func:`irradiance.total_irrad` function to calculate
the plane of array irradiance components on a tilted surface
defined by
``self.surface_tilt``, ``self.surface_azimuth``, and
Expand Down Expand Up @@ -211,7 +211,7 @@ def ashraeiam(self, aoi):
"""
Determine the incidence angle modifier using
``self.module_parameters['b']``, ``aoi``,
and the :func:`ashraeiam` function.
and the :py:func:`ashraeiam` function.

Parameters
----------
Expand All @@ -234,7 +234,7 @@ def physicaliam(self, aoi):
``self.module_parameters['L']``,
``self.module_parameters['n']``,
``aoi``, and the
:func:`physicaliam` function.
:py:func:`physicaliam` function.

Parameters
----------
Expand All @@ -252,7 +252,7 @@ def physicaliam(self, aoi):

def calcparams_desoto(self, poa_global, temp_cell, **kwargs):
"""
Use the :func:`calcparams_desoto` function, the input parameters
Use the :py:func:`calcparams_desoto` function, the input parameters
and ``self.module_parameters`` to calculate the module
currents and resistances.

Expand All @@ -272,14 +272,16 @@ def calcparams_desoto(self, poa_global, temp_cell, **kwargs):
See pvsystem.calcparams_desoto for details
"""
return calcparams_desoto(poa_global, temp_cell,
self.module_parameters['alpha_sc'],
self.module_parameters,
EgRef, dEgdT, **kwargs)
self.module_parameters['EgRef'],
self.module_parameters['dEgdT'], **kwargs)


def sapm(self, poa_direct, poa_diffuse,
temp_cell, airmass_absolute, aoi, **kwargs):
"""
Use the :func:`sapm` function, the input parameters,
Use the :py:func:`sapm` function, the input parameters,
and ``self.module_parameters`` to calculate
Voc, Isc, Ix, Ixx, Vmp/Imp.

Expand Down Expand Up @@ -313,7 +315,7 @@ def sapm(self, poa_direct, poa_diffuse,

# model now specified by self.racking_model
def sapm_celltemp(self, irrad, wind, temp):
"""Uses :func:`sapm_celltemp` to calculate module and cell
"""Uses :py:func:`sapm_celltemp` to calculate module and cell
temperatures based on ``self.racking_model`` and
the input parameters.

Expand All @@ -330,7 +332,7 @@ def sapm_celltemp(self, irrad, wind, temp):

def singlediode(self, photocurrent, saturation_current,
resistance_series, resistance_shunt, nNsVth):
"""Wrapper around the :func:`singlediode` function.
"""Wrapper around the :py:func:`singlediode` function.

Parameters
----------
Expand All @@ -347,7 +349,7 @@ def singlediode(self, photocurrent, saturation_current,

def i_from_v(self, resistance_shunt, resistance_series, nNsVth, voltage,
saturation_current, photocurrent):
"""Wrapper around the :func:`i_from_v` function.
"""Wrapper around the :py:func:`i_from_v` function.

Parameters
----------
Expand Down
213 changes: 190 additions & 23 deletions 213 pvlib/test/test_pvsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import datetime

import numpy as np
from numpy import nan
import pandas as pd

from nose.tools import assert_equals, assert_almost_equals
Expand Down Expand Up @@ -89,13 +90,41 @@ def test_systemdef_dict():


def test_ashraeiam():
thetas = pd.Series(np.linspace(-180,180,361))
thetas = np.linspace(-90, 90, 9)
iam = pvsystem.ashraeiam(.05, thetas)
expected = np.array([ nan, 0.9193437 , 0.97928932, 0.99588039, 1. ,
0.99588039, 0.97928932, 0.9193437 , nan])
assert np.isclose(iam, expected, equal_nan=True).all()


def test_PVSystem_ashraeiam():
module_parameters = pd.Series({'b': 0.05})
system = pvsystem.PVSystem(module='blah', inverter='blarg',
module_parameters=module_parameters)
thetas = np.linspace(-90, 90, 9)
iam = system.ashraeiam(thetas)
expected = np.array([ nan, 0.9193437 , 0.97928932, 0.99588039, 1. ,
0.99588039, 0.97928932, 0.9193437 , nan])
assert np.isclose(iam, expected, equal_nan=True).all()


def test_physicaliam():
thetas = pd.Series(np.linspace(-180,180,361))
thetas = np.linspace(-90, 90, 9)
iam = pvsystem.physicaliam(4, 0.002, 1.526, thetas)
expected = np.array([ nan, 0.8893998 , 0.98797788, 0.99926198, nan,
0.99926198, 0.98797788, 0.8893998 , nan])
assert np.isclose(iam, expected, equal_nan=True).all()


def test_PVSystem_physicaliam():
module_parameters = pd.Series({'K': 4, 'L': 0.002, 'n': 1.526})
system = pvsystem.PVSystem(module='blah', inverter='blarg',
module_parameters=module_parameters)
thetas = np.linspace(-90, 90, 9)
iam = system.physicaliam(thetas)
expected = np.array([ nan, 0.8893998 , 0.98797788, 0.99926198, nan,
0.99926198, 0.98797788, 0.8893998 , nan])
assert np.isclose(iam, expected, equal_nan=True).all()


# if this completes successfully we'll be able to do more tests below.
Expand All @@ -108,46 +137,155 @@ def test_retrieve_sam_network():

def test_sapm():
modules = sam_data['sandiamod']
module = modules.Canadian_Solar_CS5P_220M___2009_

sapm = pvsystem.sapm(module, irrad_data['dni'],
module_parameters = modules['Canadian_Solar_CS5P_220M___2009_']
times = pd.DatetimeIndex(start='2015-01-01', periods=2, freq='12H')
irrad_data = pd.DataFrame({'dni':[0,1000], 'ghi':[0,600], 'dhi':[0,100]},
index=times)
am = pd.Series([0, 2.25], index=times)
aoi = pd.Series([180, 30], index=times)

sapm = pvsystem.sapm(module_parameters, irrad_data['dni'],
irrad_data['dhi'], 25, am, aoi)

expected = pd.DataFrame(np.array(
[[ 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. ],
[ 5.74526799, 5.12194115, 59.67914031, 48.41924255,
248.00051089, 5.61787615, 3.52581308, 1.12848138]]),
columns=['i_sc', 'i_mp', 'v_oc', 'v_mp', 'p_mp', 'i_x', 'i_xx',
'effective_irradiance'],
index=times)

assert_frame_equal(sapm, expected)

sapm = pvsystem.sapm(module.to_dict(), irrad_data['dni'],
# just make sure it works with a dict input
sapm = pvsystem.sapm(module_parameters.to_dict(), irrad_data['dni'],
irrad_data['dhi'], 25, am, aoi)


def test_PVSystem_sapm():
modules = sam_data['sandiamod']
module = 'Canadian_Solar_CS5P_220M___2009_'
module_parameters = modules[module]
system = pvsystem.PVSystem(module=module,
module_parameters=module_parameters)
times = pd.DatetimeIndex(start='2015-01-01', periods=2, freq='12H')
irrad_data = pd.DataFrame({'dni':[0,1000], 'ghi':[0,600], 'dhi':[0,100]},
index=times)
am = pd.Series([0, 2.25], index=times)
aoi = pd.Series([180, 30], index=times)

sapm = system.sapm(irrad_data['dni'], irrad_data['dhi'], 25, am, aoi)

expected = pd.DataFrame(np.array(
[[ 0. , 0. , 0. , 0. ,
0. , 0. , 0. , 0. ],
[ 5.74526799, 5.12194115, 59.67914031, 48.41924255,
248.00051089, 5.61787615, 3.52581308, 1.12848138]]),
columns=['i_sc', 'i_mp', 'v_oc', 'v_mp', 'p_mp', 'i_x', 'i_xx',
'effective_irradiance'],
index=times)

assert_frame_equal(sapm, expected)


def test_calcparams_desoto():
cecmodule = sam_data['cecmod'].Example_Module
pvsystem.calcparams_desoto(irrad_data['ghi'],
temp_cell=25,
alpha_isc=cecmodule['alpha_sc'],
module_parameters=cecmodule,
EgRef=1.121,
dEgdT=-0.0002677)
module = 'Example_Module'
module_parameters = sam_data['cecmod'][module]
times = pd.DatetimeIndex(start='2015-01-01', periods=2, freq='12H')
poa_data = pd.Series([0, 800], index=times)

IL, I0, Rs, Rsh, nNsVth = pvsystem.calcparams_desoto(
poa_data,
temp_cell=25,
alpha_isc=module_parameters['alpha_sc'],
module_parameters=module_parameters,
EgRef=1.121,
dEgdT=-0.0002677)

assert_series_equal(np.round(IL, 3), pd.Series([0.0, 6.036], index=times))
assert_almost_equals(I0, 1.943e-9)
assert_almost_equals(Rs, 0.094)
assert_series_equal(np.round(Rsh, 3), pd.Series([np.inf, 19.65], index=times))
assert_almost_equals(nNsVth, 0.473)


def test_PVSystem_calcparams_desoto():
module = 'Example_Module'
module_parameters = sam_data['cecmod'][module].copy()
module_parameters['EgRef'] = 1.121
module_parameters['dEgdT'] = -0.0002677
system = pvsystem.PVSystem(module=module,
module_parameters=module_parameters)
times = pd.DatetimeIndex(start='2015-01-01', periods=2, freq='12H')
poa_data = pd.Series([0, 800], index=times)
temp_cell = 25

IL, I0, Rs, Rsh, nNsVth = system.calcparams_desoto(poa_data, temp_cell)

assert_series_equal(np.round(IL, 3), pd.Series([0.0, 6.036], index=times))
assert_almost_equals(I0, 1.943e-9)
assert_almost_equals(Rs, 0.094)
assert_series_equal(np.round(Rsh, 3), pd.Series([np.inf, 19.65], index=times))
assert_almost_equals(nNsVth, 0.473)


@incompatible_conda_linux_py3
def test_i_from_v():
output = pvsystem.i_from_v(20, .1, .5, 40, 6e-7, 7)
assert_almost_equals(-299.746389916, output, 5)


def test_singlediode_series():
cecmodule = sam_data['cecmod'].Example_Module
@incompatible_conda_linux_py3
def test_PVSystem_i_from_v():
module = 'Example_Module'
module_parameters = sam_data['cecmod'][module]
system = pvsystem.PVSystem(module=module,
module_parameters=module_parameters)
output = system.i_from_v(20, .1, .5, 40, 6e-7, 7)
assert_almost_equals(-299.746389916, output, 5)


def test_singlediode_series():
module = 'Example_Module'
module_parameters = sam_data['cecmod'][module]
times = pd.DatetimeIndex(start='2015-01-01', periods=2, freq='12H')
poa_data = pd.Series([0, 800], index=times)
IL, I0, Rs, Rsh, nNsVth = pvsystem.calcparams_desoto(
irrad_data['ghi'],
poa_data,
temp_cell=25,
alpha_isc=cecmodule['alpha_sc'],
module_parameters=cecmodule,
alpha_isc=module_parameters['alpha_sc'],
module_parameters=module_parameters,
EgRef=1.121,
dEgdT=-0.0002677)
out = pvsystem.singlediode(cecmodule, IL, I0, Rs, Rsh, nNsVth)
out = pvsystem.singlediode(module_parameters, IL, I0, Rs, Rsh, nNsVth)
assert isinstance(out, pd.DataFrame)


@incompatible_conda_linux_py3
def test_singlediode_series():
cecmodule = sam_data['cecmod'].Example_Module
out = pvsystem.singlediode(cecmodule, 7, 6e-7, .1, 20, .5)
def test_singlediode_floats():
module = 'Example_Module'
module_parameters = sam_data['cecmod'][module]
out = pvsystem.singlediode(module_parameters, 7, 6e-7, .1, 20, .5)
expected = {'i_xx': 4.2549732697234193,
'i_mp': 6.1390251797935704,
'v_oc': 8.1147298764528042,
'p_mp': 38.194165464983037,
'i_x': 6.7556075876880621,
'i_sc': 6.9646747613963198,
'v_mp': 6.221535886625464}
assert isinstance(out, dict)
for k, v in out.items():
assert_almost_equals(expected[k], v, 5)


@incompatible_conda_linux_py3
def test_PVSystem_singlediode_floats():
module = 'Example_Module'
module_parameters = sam_data['cecmod'][module]
system = pvsystem.PVSystem(module=module,
module_parameters=module_parameters)
out = system.singlediode(7, 6e-7, .1, 20, .5)
expected = {'i_xx': 4.2549732697234193,
'i_mp': 6.1390251797935704,
'v_oc': 8.1147298764528042,
Expand Down Expand Up @@ -192,7 +330,23 @@ def test_sapm_celltemp_with_index():

assert_frame_equal(expected, pvtemps)



def test_PVSystem_sapm_celltemp():
system = pvsystem.PVSystem(racking_model='roof_mount_cell_glassback')
times = pd.DatetimeIndex(start='2015-01-01', end='2015-01-02', freq='12H')
temps = pd.Series([0, 10, 5], index=times)
irrads = pd.Series([0, 500, 0], index=times)
winds = pd.Series([10, 5, 0], index=times)

pvtemps = system.sapm_celltemp(irrads, winds, temps)

expected = pd.DataFrame({'temp_cell':[0., 30.56763059, 5.],
'temp_module':[0., 30.06763059, 5.]},
index=times)

assert_frame_equal(expected, pvtemps)


def test_snlinverter():
inverters = sam_data['cecinverter']
testinv = 'ABB__MICRO_0_25_I_OUTD_US_208_208V__CEC_2014_'
Expand All @@ -204,6 +358,19 @@ def test_snlinverter():
assert_series_equal(pacs, pd.Series([-0.020000, 132.004308, 250.000000]))


def test_PVSystem_snlinverter():
inverters = sam_data['cecinverter']
testinv = 'ABB__MICRO_0_25_I_OUTD_US_208_208V__CEC_2014_'
system = pvsystem.PVSystem(inverter=testinv,
inverter_parameters=inverters[testinv])
vdcs = pd.Series(np.linspace(0,50,3))
idcs = pd.Series(np.linspace(0,11,3))
pdcs = idcs * vdcs

pacs = system.snlinverter(vdcs, pdcs)
assert_series_equal(pacs, pd.Series([-0.020000, 132.004308, 250.000000]))


def test_snlinverter_float():
inverters = sam_data['cecinverter']
testinv = 'ABB__MICRO_0_25_I_OUTD_US_208_208V__CEC_2014_'
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.