Skip to content

Commit da22506

Browse files
mikofskicwhansekandersolar
committed
add Kimber soiling model (pvlib#860)
* add Kimber soiling model * remove spaces, thx stickler * typos: aa = a, rest = reset * move soiling to losses * add test for kimber soiling model * also add a gallery example draft * add kimber to api.rst * use pd.to_datetime for plt * start to add manwash test using datetime * add test for manual wash * add test data for manual wash * try to fix example plot using to_pydatetime * please fix kimber gallery example * Fix indent on references * add test for no rain, max soil * reuse rainfall events * combine zero soil assignments * fix typos in Kimber soiling model * correct Adrianne spelling * add table of soiling rates from figure 3 from Kimber paper * fix reference indents in docstring * update what's new w/ kimber model * fix table malformed table in losses * fix long line in docstring * Apply suggestions from code review * change `rainfall_timeseries` input arg to just `rainfall` * clarification of rainfall input, put units in brackets at end of definition * change `threshold` input arg to `cleaning_threashold` * change `soiling_rate` input arg to `soiling_loss_rate` and clarify definition as energy loss putting units [unitless] in brackets at the end of the definition * remove suggestion regarding grace period to the Notes section * fix formatting of return, there is no name, only return type * improve notes section to add that grace period may also vary by region and to use energy loss rate instead of soiling since it's not a mass rate Co-Authored-By: Cliff Hansen <[email protected]> * update rainfall and threshold args in kimber * to match docstring improvement suggested in code review * wrap long lines * be more consistent with HSU docstring * change soiling_rate to soiling_loss_rate * combine panels cleaned today with grace-period, since it includes today * add a 1-liner for `soiling_kimber` in the sphinx docs * also fix missing "for" in note Co-Authored-By: Kevin Anderson <[email protected]> * separate tests for Kimber * remove extra whitespace * delete trailing whitespace in kimber test * vectorize kimber soiling * use a rolling window and rain_accum_period to get more accurate rain coverage overnite instead of only discrete days from midnite to midnite * add rain_accum_period to allow deviation from kimber model, recommends only 24h but why not be flexible? * add istmy=False to fix last hour of tmy to be monotonically increasing * add another test for initial condition * fix example input arg cleaning_threshold * fix trailing whitespace in kimber * Kimber needs pandas-0.22 Co-authored-by: Cliff Hansen <[email protected]> Co-authored-by: Kevin Anderson <[email protected]>
1 parent b92efee commit da22506

File tree

7 files changed

+17822
-2
lines changed

7 files changed

+17822
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
"""
2+
Kimber Soiling Model
3+
====================
4+
5+
Examples of soiling using the Kimber model [1]_.
6+
7+
References
8+
----------
9+
.. [1] "The Effect of Soiling on Large Grid-Connected Photovoltaic Systems
10+
in California and the Southwest Region of the United States," Adrianne
11+
Kimber, et al., IEEE 4th World Conference on Photovoltaic Energy
12+
Conference, 2006, :doi:`10.1109/WCPEC.2006.279690`
13+
"""
14+
15+
# %%
16+
# This example shows basic usage of pvlib's Kimber Soiling model with
17+
# :py:meth:`pvlib.losses.soiling_kimber`.
18+
#
19+
# The Kimber Soiling model assumes that soiling builds up at a constant rate
20+
# until cleaned either manually or by rain. The rain must reach a threshold to
21+
# clean the panels. When rains exceeds the threshold, it's assumed the earth is
22+
# damp for a grace period before it begins to soil again. There is a maximum
23+
# soiling build up that cannot be exceeded even if there's no rain or
24+
# manual cleaning.
25+
#
26+
# Threshold
27+
# ---------
28+
# The example shown here demonstrates how the threshold affects soiling.
29+
# Because soiling depends on rainfall, loading weather data is always the first
30+
# step.
31+
32+
from datetime import datetime
33+
from matplotlib import pyplot as plt
34+
from pvlib.iotools import read_tmy3
35+
from pvlib.losses import soiling_kimber
36+
from pvlib.tests.conftest import DATA_DIR
37+
38+
# get TMY3 data with rain
39+
greensboro = read_tmy3(DATA_DIR / '723170TYA.CSV', coerce_year=1990)
40+
# NOTE: can't use Sand Point, AK b/c Lprecipdepth is -9900, ie: missing
41+
greensboro_rain = greensboro[0].Lprecipdepth
42+
# calculate soiling with no wash dates
43+
THRESHOLD = 25.0
44+
soiling_no_wash = soiling_kimber(
45+
greensboro_rain, cleaning_threshold=THRESHOLD, istmy=True)
46+
soiling_no_wash.name = 'soiling'
47+
# daily rain totals
48+
daily_rain = greensboro_rain.iloc[:-1].resample('D').sum()
49+
plt.plot(
50+
daily_rain.index.to_pydatetime(), daily_rain.values/25.4,
51+
soiling_no_wash.index.to_pydatetime(), soiling_no_wash.values*100.0)
52+
plt.hlines(
53+
THRESHOLD/25.4, xmin=datetime(1990, 1, 1), xmax=datetime(1990, 12, 31),
54+
linestyles='--')
55+
plt.grid()
56+
plt.title(
57+
f'Kimber Soiling Model, dashed line shows threshold ({THRESHOLD}[mm])')
58+
plt.xlabel('timestamp')
59+
plt.ylabel('soiling build-up fraction [%] and daily rainfall [inches]')
60+
plt.legend(['daily rainfall [in]', 'soiling [%]'])
61+
plt.tight_layout()
62+
63+
plt.show()

docs/sphinx/source/api.rst

+1
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ Losses
315315
:toctree: generated/
316316

317317
losses.soiling_hsu
318+
losses.soiling_kimber
318319

319320

320321
Other

docs/sphinx/source/whatsnew/v0.7.2.rst

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Enhancements
1313
* TMY3 dataframe returned by :py:func:`~pvlib.iotools.read_tmy3` now contains
1414
the original ``Date (MM/DD/YYYY)`` and ``Time (HH:MM)`` columns that the
1515
indices were parsed from (:pull:`866`)
16+
* Add Kimber soiling model :py:func:`pvlib.losses.soiling_kimber` (:pull:`860`)
1617

1718
Bug fixes
1819
~~~~~~~~~

0 commit comments

Comments
 (0)