-
Notifications
You must be signed in to change notification settings - Fork 1.1k
add Kimber soiling model #860
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
Changes from 3 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
1f204ce
add Kimber soiling model
mikofski d9e8c99
remove spaces, thx stickler
mikofski 1b0b74e
typos: aa = a, rest = reset
mikofski ed5c444
move soiling to losses
mikofski 14ef35c
Merge branch 'master' into kimber_soil
mikofski c6c26ac
Merge branch 'master' into kimber_soil
mikofski 671ff00
add test for kimber soiling model
mikofski 55bd7c5
add kimber to api.rst
mikofski 8988864
add test for manual wash
mikofski a1372a6
please fix kimber gallery example
mikofski e174dba
Fix indent on references
mikofski f01d52f
add test for no rain, max soil
mikofski 04eb758
fix typos in Kimber soiling model
mikofski ec26d8f
update what's new w/ kimber model
mikofski ba16b2b
Apply suggestions from code review
mikofski 7c86399
update rainfall and threshold args in kimber
mikofski 0d9ed77
change soiling_rate to soiling_loss_rate
mikofski 4736027
add a 1-liner for `soiling_kimber` in the sphinx docs
mikofski e5d7a93
separate tests for Kimber
mikofski c7b1c0e
delete trailing whitespace in kimber test
mikofski e68cff3
vectorize kimber soiling
mikofski 6acf512
fix trailing whitespace in kimber
mikofski 75d6df6
Kimber needs pandas-0.22
mikofski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Soiling models | ||
""" | ||
|
||
import datetime | ||
import pandas as pd | ||
|
||
|
||
def soiling_kimber(rainfall_timeseries, threshold=6, soiling_rate=0.0015, | ||
grace_period=14, max_soiling=0.3, manual_wash_dates=None, | ||
initial_soiling=0): | ||
""" | ||
Kimber soiling model [1]_ assumes soiling builds-up at a daily rate unless | ||
the daily rainfall is greater than a threshold. The model also assumes that | ||
if daily rainfall has exceeded the threshold within a grace period, then | ||
the ground is too damp to cause soiling build-up. The model also assumes | ||
there is a maximum soiling build-up. Scheduled manual washes and rain | ||
events are assumed to reset soiling to zero. | ||
|
||
Parameters | ||
---------- | ||
rainfall_timeseries : pandas.Series | ||
a timeseries of rainfall in millimeters | ||
threshold : float, default 6 | ||
the amount of rain in millimeters [mm] required to clean the panels | ||
soiling_rate: float, default 0.0015 | ||
daily soiling rate, enter as fraction, not percent, default is 0.15% | ||
grace_period : int, default 14 | ||
The number of days after a rainfall event when it's assumed the ground | ||
is damp, and so it's assumed there is no soiling. Change to smaller | ||
value for dry climate, default is 14-days | ||
max_soiling : float, default 0.3 | ||
maximum soiling, soiling will build-up until this value, enter as | ||
fraction, not percent, default is 30% | ||
manual_wash_dates : sequence or None, default None | ||
A list or tuple of Python ``datetime.date`` when the panels were | ||
manually cleaned. Note there is no grace period after a manual | ||
cleaning, so soiling begins to build-up immediately after a manual | ||
cleaning | ||
initial_soiling : float, default 0 | ||
the initial fraction of soiling on the panels at time zero in the input | ||
|
||
Returns | ||
------- | ||
soiling : timeseries | ||
soiling build-up fraction | ||
|
||
References | ||
---------- | ||
.. [1] "The Effect of Soiling on Large Grid-Connected Photovoltaic Systems | ||
in California and the Southwest Region of the United States," Addriane | ||
Kimber, et al., IEEE 4th World Conference on Photovoltaic Energy | ||
Conference, 2006, :doi:`10.1109/WCPEC.2006.279690` | ||
""" | ||
# convert grace_period to timedelata | ||
grace_period = datetime.timedelta(days=grace_period) | ||
|
||
# manual wash dates | ||
if manual_wash_dates is None: | ||
manual_wash_dates = [] | ||
|
||
# resample rainfall as days by summing intermediate times | ||
rainfall = rainfall_timeseries.resample("D").sum() | ||
|
||
# set indices to the end of the day | ||
rainfall.index = rainfall.index + datetime.timedelta(hours=23) | ||
|
||
# soiling | ||
soiling = pd.Series(float('NaN'), index=rainfall_timeseries.index) | ||
|
||
# set 1st timestep to initial soiling | ||
soiling.iloc[0] = initial_soiling | ||
|
||
# rainfall events that clean the panels | ||
rain_events = rainfall > threshold | ||
|
||
# loop over days | ||
for today in rainfall.index: | ||
|
||
# did rain exceed threshold? | ||
rain_exceed_thresh = rainfall[today] > threshold | ||
|
||
# if yes, then set soiling to zero | ||
if rain_exceed_thresh: | ||
soiling[today] = 0 | ||
initial_soiling = 0 | ||
continue | ||
|
||
# start day of grace period | ||
start_day = today - grace_period | ||
|
||
# rainfall event during grace period? | ||
rain_in_grace_period = any(rain_events[start_day:today]) | ||
|
||
# if rain exceeded threshold during grace period, | ||
# assume ground is still damp, so no or v. low soiling | ||
if rain_in_grace_period: | ||
soiling[today] = 0 | ||
initial_soiling = 0 | ||
continue | ||
|
||
# is this a manual wash date? | ||
if today.date() in manual_wash_dates: | ||
soiling[today] = 0 | ||
initial_soiling = 0 | ||
continue | ||
|
||
# so, it didn't rain enough to clean, it hasn't rained enough recently, | ||
# and we didn't manually clean panels, so soil them by adding daily | ||
# soiling rate to soiling from previous day | ||
total_soil = initial_soiling + soiling_rate | ||
|
||
# check if soiling has reached the maximum | ||
soiling[today] = ( | ||
max_soiling if (total_soil >= max_soiling) else total_soil) | ||
|
||
initial_soiling = soiling[today] # reset initial soiling | ||
|
||
return soiling.interpolate() |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.