Skip to content

add Mount classes #1176

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 54 commits into from
Jul 27, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
cb3c207
add Mount classes, incorporate into Array and PVSystem
kandersolar Feb 23, 2021
8a6d0e6
update pvsystem tests
kandersolar Feb 23, 2021
6d4240e
delete mounts module
kandersolar Feb 23, 2021
fc4064b
fix modelchain tests
kandersolar Feb 24, 2021
e8f1404
some modifications to SingleAxisTracker
kandersolar Feb 24, 2021
02a2b27
changes from review
kandersolar Feb 27, 2021
0be45ae
stickler
kandersolar Feb 27, 2021
9406ccd
Merge branch 'master' into mount_classes
kandersolar Mar 2, 2021
e1bdc67
use dataclasses for mounts
kandersolar Mar 7, 2021
61650e9
update tests
kandersolar Mar 7, 2021
fc47003
update docs
kandersolar Mar 7, 2021
887fd3a
whatsnew
kandersolar Mar 7, 2021
ecc4737
test mount classes
kandersolar Mar 7, 2021
cbb41e1
stickler
kandersolar Mar 7, 2021
9e663d2
more tests
kandersolar Mar 7, 2021
105edb7
another test
kandersolar Mar 7, 2021
6d32c41
fix typo
kandersolar Mar 7, 2021
4a6347e
clean up AbstractMount
kandersolar Mar 13, 2021
1e063ba
remove unnecessary use of dataclasses.field
kandersolar Mar 13, 2021
3dcf106
calculate -> get
kandersolar Mar 13, 2021
d4045a3
Merge remote-tracking branch 'upstream/master' into mount_classes
kandersolar Mar 21, 2021
b0b551f
Update pvlib/pvsystem.py
kandersolar Mar 21, 2021
515a359
stickler
kandersolar Mar 21, 2021
a874b11
test fixes
kandersolar Mar 21, 2021
17195ae
add optional surface_tilt parameter to PVSystem.fuentes_celltemp
kandersolar Mar 21, 2021
93716bb
move racking_model and module_height to the Mounts
kandersolar Mar 21, 2021
efe6b3b
fix some tests
kandersolar Mar 21, 2021
74a6be4
remove unnecessary fixture
kandersolar Mar 28, 2021
9da9eb4
Revert "remove unnecessary fixture"
kandersolar Mar 30, 2021
2320ed7
Merge remote-tracking branch 'upstream/master' into mount_classes
kandersolar May 14, 2021
6370143
update merged test
kandersolar May 14, 2021
6181e96
fix fuentes issue, sort of
kandersolar May 14, 2021
47b6884
pep8
kandersolar May 14, 2021
dbc1193
pep8
kandersolar May 14, 2021
e0eeef4
remove PVSystem.fuentes_celltemp surface_tilt parameter
kandersolar May 14, 2021
cf3fe20
placeholder fuentes surface_tilt logic
kandersolar May 14, 2021
7c18126
Merge branch 'master' into mount_classes
kandersolar May 21, 2021
86292c5
test updates
kandersolar May 21, 2021
cc5f45a
Merge remote-tracking branch 'upstream/master' into mount_classes
kandersolar Jun 17, 2021
739359e
remove unused imports
kandersolar Jun 17, 2021
59547f5
remove fuentes override complexity
kandersolar Jun 23, 2021
bed27c9
stickler
kandersolar Jun 23, 2021
1103f99
update RST pages
kandersolar Jun 23, 2021
e6504cd
Merge remote-tracking branch 'upstream/master' into mount_classes
kandersolar Jun 23, 2021
73aba9a
revert unnecessary docs change
kandersolar Jun 23, 2021
f3ff722
add link to pvsystem and modelchain pages in api listing
kandersolar Jun 29, 2021
9c0c3ff
other changes from review
kandersolar Jun 29, 2021
35da280
get module_height from mount instead of temperature_model_parameters
kandersolar Jun 29, 2021
1a43ea8
coverage for fuentes module_height parameter
kandersolar Jun 29, 2021
c1738e9
deprecate SingleAxisTracker
kandersolar Jul 21, 2021
781b133
suppress SAT deprecation warnings in tests
kandersolar Jul 21, 2021
22341ec
Apply suggestions from code review
kandersolar Jul 22, 2021
6df8408
Tracking -> Tracker
kandersolar Jul 22, 2021
506edbc
Merge branch 'mount_classes' of https://github.com/kanderso-nrel/pvli…
kandersolar Jul 22, 2021
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
4 changes: 4 additions & 0 deletions docs/sphinx/source/whatsnew/v0.9.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ Deprecations
* ``PVSystem.surface_azimuth``
* ``PVSystem.temperature_model_parameters``

* The :py:class:`pvlib.tracking.SingleAxisTracker` class is deprecated and
replaced by using :py:class:`pvlib.pvsystem.PVSystem` with the new
:py:class:`pvlib.pvsystem.SingleAxisTrackerMount` (:pull:`1176`)


Enhancements
~~~~~~~~~~~~
Expand Down
39 changes: 21 additions & 18 deletions pvlib/tests/test_modelchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,12 +734,13 @@ def test_run_model_with_weather_noct_sam_temp(sapm_dc_snl_ac_system, location,


def test_run_model_tracker(sapm_dc_snl_ac_system, location, weather, mocker):
system = SingleAxisTracker(
module_parameters=sapm_dc_snl_ac_system.arrays[0].module_parameters,
temperature_model_parameters=(
sapm_dc_snl_ac_system.arrays[0].temperature_model_parameters
),
inverter_parameters=sapm_dc_snl_ac_system.inverter_parameters)
with pytest.warns(pvlibDeprecationWarning):
system = SingleAxisTracker(
module_parameters=sapm_dc_snl_ac_system.arrays[0].module_parameters,
temperature_model_parameters=(
sapm_dc_snl_ac_system.arrays[0].temperature_model_parameters
),
inverter_parameters=sapm_dc_snl_ac_system.inverter_parameters)
mocker.spy(system, 'singleaxis')
mc = ModelChain(system, location)
mc.run_model(weather)
Expand All @@ -755,12 +756,13 @@ def test_run_model_tracker(sapm_dc_snl_ac_system, location, weather, mocker):

def test_run_model_tracker_list(
sapm_dc_snl_ac_system, location, weather, mocker):
system = SingleAxisTracker(
module_parameters=sapm_dc_snl_ac_system.arrays[0].module_parameters,
temperature_model_parameters=(
sapm_dc_snl_ac_system.arrays[0].temperature_model_parameters
),
inverter_parameters=sapm_dc_snl_ac_system.inverter_parameters)
with pytest.warns(pvlibDeprecationWarning):
system = SingleAxisTracker(
module_parameters=sapm_dc_snl_ac_system.arrays[0].module_parameters,
temperature_model_parameters=(
sapm_dc_snl_ac_system.arrays[0].temperature_model_parameters
),
inverter_parameters=sapm_dc_snl_ac_system.inverter_parameters)
mocker.spy(system, 'singleaxis')
mc = ModelChain(system, location)
mc.run_model([weather])
Expand Down Expand Up @@ -1027,12 +1029,13 @@ def test_run_model_from_poa_arrays_solar_position_weather(

def test_run_model_from_poa_tracking(sapm_dc_snl_ac_system, location,
total_irrad):
system = SingleAxisTracker(
module_parameters=sapm_dc_snl_ac_system.arrays[0].module_parameters,
temperature_model_parameters=(
sapm_dc_snl_ac_system.arrays[0].temperature_model_parameters
),
inverter_parameters=sapm_dc_snl_ac_system.inverter_parameters)
with pytest.warns(pvlibDeprecationWarning):
system = SingleAxisTracker(
module_parameters=sapm_dc_snl_ac_system.arrays[0].module_parameters,
temperature_model_parameters=(
sapm_dc_snl_ac_system.arrays[0].temperature_model_parameters
),
inverter_parameters=sapm_dc_snl_ac_system.inverter_parameters)
mc = ModelChain(system, location, aoi_model='no_loss',
spectral_model='no_loss')
ac = mc.run_model_from_poa(total_irrad).results.ac
Expand Down
48 changes: 21 additions & 27 deletions pvlib/tests/test_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import pvlib
from pvlib import tracking
from .conftest import DATA_DIR, assert_frame_equal
from pvlib._deprecation import pvlibDeprecationWarning

SINGLEAXIS_COL_ORDER = ['tracker_theta', 'aoi',
'surface_azimuth', 'surface_tilt']
Expand Down Expand Up @@ -289,22 +290,11 @@ def test_low_sun_angles():
assert_allclose(expected[k], v)


def test_SingleAxisTracker_creation():
system = tracking.SingleAxisTracker(max_angle=45,
gcr=.25,
module='blah',
inverter='blarg')

assert system.max_angle == 45
assert system.gcr == .25
assert system.arrays[0].module == 'blah'
assert system.inverter == 'blarg'


def test_SingleAxisTracker_tracking():
system = tracking.SingleAxisTracker(max_angle=90, axis_tilt=30,
axis_azimuth=180, gcr=2.0/7.0,
backtrack=True)
with pytest.warns(pvlibDeprecationWarning):
system = tracking.SingleAxisTracker(max_angle=90, axis_tilt=30,
axis_azimuth=180, gcr=2.0/7.0,
backtrack=True)

apparent_zenith = pd.Series([30])
apparent_azimuth = pd.Series([135])
Expand All @@ -324,9 +314,10 @@ def test_SingleAxisTracker_tracking():
pvsyst_solar_height = 27.315
pvsyst_axis_tilt = 20.
pvsyst_axis_azimuth = 20.
pvsyst_system = tracking.SingleAxisTracker(
max_angle=60., axis_tilt=pvsyst_axis_tilt,
axis_azimuth=180+pvsyst_axis_azimuth, backtrack=False)
with pytest.warns(pvlibDeprecationWarning):
pvsyst_system = tracking.SingleAxisTracker(
max_angle=60., axis_tilt=pvsyst_axis_tilt,
axis_azimuth=180+pvsyst_axis_azimuth, backtrack=False)
# the definition of azimuth is different from PYsyst
apparent_azimuth = pd.Series([180+pvsyst_solar_azimuth])
apparent_zenith = pd.Series([90-pvsyst_solar_height])
Expand All @@ -342,9 +333,10 @@ def test_SingleAxisTracker_tracking():

# see test_irradiance for more thorough testing
def test_get_aoi():
system = tracking.SingleAxisTracker(max_angle=90, axis_tilt=30,
axis_azimuth=180, gcr=2.0/7.0,
backtrack=True)
with pytest.warns(pvlibDeprecationWarning):
system = tracking.SingleAxisTracker(max_angle=90, axis_tilt=30,
axis_azimuth=180, gcr=2.0/7.0,
backtrack=True)
surface_tilt = np.array([30, 0])
surface_azimuth = np.array([90, 270])
solar_zenith = np.array([70, 10])
Expand All @@ -356,9 +348,10 @@ def test_get_aoi():


def test_get_irradiance():
system = tracking.SingleAxisTracker(max_angle=90, axis_tilt=30,
axis_azimuth=180, gcr=2.0/7.0,
backtrack=True)
with pytest.warns(pvlibDeprecationWarning):
system = tracking.SingleAxisTracker(max_angle=90, axis_tilt=30,
axis_azimuth=180, gcr=2.0/7.0,
backtrack=True)
times = pd.date_range(start='20160101 1200-0700',
end='20160101 1800-0700', freq='6H')
# latitude=32, longitude=-111
Expand Down Expand Up @@ -402,9 +395,10 @@ def test_get_irradiance():


def test_SingleAxisTracker___repr__():
system = tracking.SingleAxisTracker(
max_angle=45, gcr=.25, module='blah', inverter='blarg',
temperature_model_parameters={'a': -3.56})
with pytest.warns(pvlibDeprecationWarning):
system = tracking.SingleAxisTracker(
max_angle=45, gcr=.25, module='blah', inverter='blarg',
temperature_model_parameters={'a': -3.56})
expected = """SingleAxisTracker:
axis_tilt: 0
axis_azimuth: 0
Expand Down
2 changes: 2 additions & 0 deletions pvlib/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
PVSystem, Array, SingleAxisTrackerMount, _unwrap_single_value
)
from pvlib import irradiance, atmosphere
from pvlib._deprecation import deprecated


@deprecated('0.9.0', alternative='PVSystem with SingleAxisTrackingMount')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm seeing the difference with the class name has me wondering... SingleAxisTrackingMount or SingleAxisTrackerMount?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I surveyed n=2 pvlib users and both preferred SingleAxisTrackerMount. I will make the change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out it was already called SingleAxisTrackerMount and I just called it the wrong thing in the deprecation message 🤦‍♂️

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least we got some data out of it!

class SingleAxisTracker(PVSystem):
"""
A class for single-axis trackers that inherits the PV modeling methods from
Expand Down