|
| 1 | +""" |
| 2 | +HSU Soiling Model Example |
| 3 | +========================= |
| 4 | +
|
| 5 | +Example of soiling using the HSU model. |
| 6 | +""" |
| 7 | + |
| 8 | +# %% |
| 9 | +# This example shows basic usage of pvlib's HSU Soiling model [1]_ with |
| 10 | +# :py:func:`pvlib.soiling.hsu`. |
| 11 | +# |
| 12 | +# References |
| 13 | +# ----------- |
| 14 | +# .. [1] M. Coello and L. Boyle, "Simple Model For Predicting Time Series |
| 15 | +# Soiling of Photovoltaic Panels," in IEEE Journal of Photovoltaics. |
| 16 | +# doi: 10.1109/JPHOTOV.2019.2919628 |
| 17 | +# |
| 18 | +# This example recreates figure 3A in [1]_ for the Fixed Settling |
| 19 | +# Velocity case. |
| 20 | +# Rainfall data comes from Imperial County, CA TMY3 file |
| 21 | +# PM2.5 and PM10 data come from the EPA. First, let's read in the |
| 22 | +# weather data and run the HSU soiling model: |
| 23 | + |
| 24 | +import pathlib |
| 25 | +from matplotlib import pyplot as plt |
| 26 | +from pvlib import soiling |
| 27 | +import pvlib |
| 28 | +import pandas as pd |
| 29 | + |
| 30 | +# get full path to the data directory |
| 31 | +DATA_DIR = pathlib.Path(pvlib.__file__).parent / 'data' |
| 32 | + |
| 33 | +# read rainfall, PM2.5, and PM10 data from file |
| 34 | +imperial_county = pd.read_csv(DATA_DIR / 'soiling_hsu_example_inputs.csv', |
| 35 | + index_col=0, parse_dates=True) |
| 36 | +rainfall = imperial_county['rain'] |
| 37 | +depo_veloc = {'2_5': 0.0009, '10': 0.004} # default values from [1] (m/s) |
| 38 | +rain_accum_period = pd.Timedelta('1h') # default |
| 39 | +cleaning_threshold = 0.5 |
| 40 | +tilt = 30 |
| 41 | +pm2_5 = imperial_county['PM2_5'].values |
| 42 | +pm10 = imperial_county['PM10'].values |
| 43 | +# run the hsu soiling model |
| 44 | +soiling_ratio = soiling.hsu(rainfall, cleaning_threshold, tilt, pm2_5, pm10, |
| 45 | + depo_veloc=depo_veloc, |
| 46 | + rain_accum_period=rain_accum_period) |
| 47 | + |
| 48 | +# %% |
| 49 | +# And now we'll plot the modeled daily soiling ratios and compare |
| 50 | +# with Coello and Boyle Fig 3A: |
| 51 | + |
| 52 | +daily_soiling_ratio = soiling_ratio.resample('d').mean() |
| 53 | +fig, ax1 = plt.subplots(figsize=(8, 2)) |
| 54 | +ax1.plot(daily_soiling_ratio.index, daily_soiling_ratio, marker='.', |
| 55 | + c='r', label='hsu function output') |
| 56 | +ax1.set_ylabel('Daily Soiling Ratio') |
| 57 | +ax1.set_ylim(0.79, 1.01) |
| 58 | +ax1.set_title('Imperial County TMY') |
| 59 | +ax1.legend(loc='center left') |
| 60 | + |
| 61 | +daily_rain = rainfall.resample('d').sum() |
| 62 | +ax2 = ax1.twinx() |
| 63 | +ax2.plot(daily_rain.index, daily_rain, marker='.', |
| 64 | + c='c', label='daily rainfall') |
| 65 | +ax2.set_ylabel('Daily Rain (mm)') |
| 66 | +ax2.set_ylim(-10, 210) |
| 67 | +ax2.legend(loc='center right') |
| 68 | +fig.tight_layout() |
| 69 | +fig.show() |
| 70 | + |
| 71 | +# %% |
| 72 | +# Here is the original figure from [1]_ for comparison: |
| 73 | +# |
| 74 | +# .. image:: ../_images/Coello_Boyle_2019_Fig3.png |
| 75 | +# :alt: Figure 3A from the paper showing a simulated soiling signal. |
| 76 | +# |
| 77 | +# Note that this figure shows additional timeseries not calculated here: |
| 78 | +# modeled soiling ratio using the 2015 PRISM rainfall dataset (orange) |
| 79 | +# and measured soiling ratio (dashed green). |
0 commit comments