-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add Prilliman et al transience model to pvlib.temperature #1391
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
Changes from 3 commits
7619d04
ff2c006
95bff13
e5f83db
f92e73a
92afe49
56519e2
c384415
d92250c
985baba
01c4afc
188e3df
be1704e
5e2c6da
2197f3c
3095afb
7cecbbe
5fda720
b8d5479
0a0a1f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,9 @@ | |
| import pandas as pd | ||
| from pvlib.tools import sind | ||
| from pvlib._deprecation import warn_deprecated | ||
| from pvlib.clearsky import _get_sample_intervals | ||
| import scipy | ||
| import warnings | ||
|
|
||
|
|
||
| TEMPERATURE_MODEL_PARAMETERS = { | ||
|
|
@@ -827,22 +829,22 @@ def noct_sam(poa_global, temp_air, wind_speed, noct, module_efficiency, | |
|
|
||
| def prilliman(temp_cell, wind_speed, unit_mass=11.1, coefficients=None): | ||
| """ | ||
| Smooth out short-term model transience using the Prilliman model [1]_. | ||
| Smooth short-term cell temperature transients using the Prilliman model. | ||
|
|
||
| The Prilliman et al. model applies an exponential moving average to | ||
| the output of a steady-state cell temperature model to account for a | ||
| module's thermal inertia and smooth out the cell temperature's response | ||
| to changing weather conditions. | ||
| The Prilliman et al. model [1]_ applies a weighted moving average to | ||
wholmgren marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| the output of a steady-state cell temperature model to account for | ||
| a module's thermal inertia by smoothing the cell temperature's | ||
| response to changing weather conditions. | ||
|
|
||
| .. warning:: | ||
| This implementation requires the time series inputs to be regularly | ||
| sampled in time. Data with irregular time steps should be resampled | ||
| prior to using this function. | ||
| sampled in time with frequency less than 20 minutes. Data with | ||
| irregular time steps should be resampled prior to using this function. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| temp_cell : pandas Series | ||
| Cell temperature modeled with steady-state assumptions [C] | ||
| temp_cell : pandas Series with DatetimeIndex | ||
kandersolar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Cell temperature modeled with steady-state assumptions. [C] | ||
|
|
||
| wind_speed : pandas Series | ||
kandersolar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Wind speed, adjusted to correspond to array height [m/s] | ||
|
|
@@ -851,7 +853,7 @@ def prilliman(temp_cell, wind_speed, unit_mass=11.1, coefficients=None): | |
| Total mass of module divided by its one-sided surface area [kg/m^2] | ||
|
|
||
| coefficients : 4-element list-like, optional | ||
| Values for coefficients a_0–a_3 from [1]_ | ||
| Values for coefficients a_0 through a_3, see Eq. 9 of [1]_ | ||
|
|
||
| Returns | ||
| ------- | ||
|
|
@@ -861,7 +863,7 @@ def prilliman(temp_cell, wind_speed, unit_mass=11.1, coefficients=None): | |
| Notes | ||
| ----- | ||
| This smoothing model was developed and validated using the SAPM | ||
| model for the steady-state input. | ||
| cell temperature model for the steady-state input. | ||
|
|
||
| References | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One more suggestion: explain in Notes how |
||
| ---------- | ||
|
|
@@ -871,15 +873,17 @@ def prilliman(temp_cell, wind_speed, unit_mass=11.1, coefficients=None): | |
| :doi:`10.1109/JPHOTOV.2020.2992351` | ||
| """ | ||
|
|
||
| # TODO: check inputs to ensure regular spacing? | ||
| time_step, window = _get_sample_intervals(temp_cell.index, 20) | ||
kandersolar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| time_step = (temp_cell.index[1] - temp_cell.index[0]).total_seconds() | ||
| if time_step >= 1200: | ||
| if time_step >= 20: | ||
| warnings.warn("temperature.prilliman only applies smoothing when " | ||
| "the sampling interval is shorter than 20 minutes " | ||
| f"(input sampling interval: {time_step} minutes)") | ||
| # too coarsely sampled for smoothing to be relevant | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think a warning here would be appropriate
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe extend the message to say that the return values are the original temperature? |
||
| return temp_cell | ||
|
|
||
| window = min(int(1200 / time_step), # time series > 20 minutes | ||
| len(temp_cell)) # time series < 20 minutes | ||
| window = min(window, # time series > 20 minutes total | ||
| len(temp_cell)) # time series < 20 minutes total | ||
kandersolar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| # prefix with NaNs so that the rolling window is "full", | ||
| # even for the first actual value: | ||
|
|
@@ -900,7 +904,7 @@ def prilliman(temp_cell, wind_speed, unit_mass=11.1, coefficients=None): | |
|
|
||
| wind_speed = wind_speed.values | ||
| P = a[0] + a[1]*wind_speed + a[2]*unit_mass + a[3]*wind_speed*unit_mass | ||
| timedeltas = np.arange(window, 0, -1) * time_step | ||
| timedeltas = np.arange(window, 0, -1) * (time_step*60) # s to min | ||
kandersolar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| weights = np.exp(-P[:, np.newaxis] * timedeltas) | ||
|
|
||
kandersolar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| # set weights corresponding to the prefix values to zero; otherwise the | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.