This page was generated from /home/docs/checkouts/readthedocs.org/user_builds/pvcaptest/checkouts/v0.13.2/docs/examples/reporting_conditions.ipynb.
Interactive online version:
Reporting Conditions and Predicted Capacities
[1]:
import warnings
warnings.filterwarnings('ignore')
import pandas as pd
import matplotlib as plt
import captest as ct
First we load the NREL data used for testing and set the translation dictionary.
[2]:
meas = ct.load_data('../../tests/data/nrel_data.csv')
[3]:
meas.column_groups
[3]:
wind__:
Avg Wind Speed @ 19ft [m/s]
temp__:
Deck Dry Bulb Temp [deg C]
irr_ghi_:
Global CMP22 (vent/cor) [W/m^2]
irr_poa_:
POA 40-South CMP11 [W/m^2]
[4]:
meas.set_regression_cols(poa='irr_poa_', w_vel='wind__', t_amb='temp__', power='')
[5]:
meas.filter_irr(500, 600)
Below is an exmaple of calculating reporting conditions using all defaults, which are set based on the ASTM E2939 standard. The reporting condition method always performs calculations using the filtered dataframe stored in the df_flt attribute.
RC_irr 60% percentile
RC_temp mean
RC_wind mean
Calculates values on filtered data
inplace
[6]:
meas.rep_cond()
Reporting conditions saved to rc attribute.
poa t_amb w_vel
0 562.822 5.554151 1.358792
Use all defaults, except inplace - RC_irr 60% percentile - RC_temp mean - RC_wind mean - Calculates values on filtered data - not inplace- returns rep cond and doesn’t write to RCs
[7]:
meas.rc
[7]:
| poa | t_amb | w_vel | |
|---|---|---|---|
| 0 | 562.822 | 5.554151 | 1.358792 |
[8]:
meas.rc = None
[9]:
meas.rep_cond(inplace=False)
[9]:
| poa | t_amb | w_vel | |
|---|---|---|---|
| 0 | 562.822 | 5.554151 | 1.358792 |
[10]:
print(meas.rc)
None
Irradiance Balance Method
Setting the irr_bal key-word argument to True causes the aggregation methods specified with the func argument to be ignored and the reporting irradiance is calculated internally by creating an instance of the ReportingIrradiance class. This class is intended to implement a strict interpretation of common contract language that specifies the reporting irradiance be determined by finding the irradiance that results in a balance of points within a +/- percent range of the reporting
irradiance.
[11]:
meas.reset_filter()
[12]:
meas.filter_irr(500, 900)
[13]:
meas.rep_cond(irr_bal=True, percent_filter=20)
Reporting conditions saved to rc attribute.
poa t_amb w_vel
0 659.36 5.475107 1.419542
The instance of ReportingIrradiance created is stored in the rc_tool attribute and additional, so it can be used to access additional documentation of the reporting irradiance calculation. For example, there is a plot method, which marks the reporting irradiance selected on a linked plots showing the count of points above and below the reporting irradiance, the percent of points below the reporting irradiance, and the total points within the specifiec +/- percent band centered on the
reporting irradiance.
[14]:
meas.rc_tool.plot()
[14]:
If you have the Panel package installed you can easily obtain an interactive dashboard allowing you to adjust the reporting condition parameters. Note this dashboard will not work unless you have a live notebook.
[15]:
meas.rc_tool.dashboard()
[15]:
The save_csv method will save a copy of the following table documenting the possible options for reporting conditions to a csv file.
[16]:
meas.rc_tool.poa_flt
[16]:
| t_amb | w_vel | plus_perc | minus_perc | below_count | above_count | total_pts | perc_above | perc_below | valid | perc_below_minus_50_abs | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| poa | |||||||||||
| 500.308 | -0.507 | 0.963 | 600.3696 | 400.2464 | 1 | 317 | 318 | 99.685535 | 0.314465 | False | 49.685535 |
| 500.330 | -2.411 | 1.175 | 600.3960 | 400.2640 | 2 | 316 | 318 | 99.371069 | 0.628931 | False | 49.371069 |
| 500.382 | -2.207 | 2.113 | 600.4584 | 400.3056 | 3 | 315 | 318 | 99.056604 | 0.943396 | False | 49.056604 |
| 500.397 | 4.253 | 0.000 | 600.4764 | 400.3176 | 4 | 314 | 318 | 98.742138 | 1.257862 | False | 48.742138 |
| 500.469 | 8.400 | 1.835 | 600.5628 | 400.3752 | 5 | 313 | 318 | 98.427673 | 1.572327 | False | 48.427673 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 898.873 | 11.480 | 0.180 | 1078.6476 | 719.0984 | 613 | 5 | 618 | 0.809061 | 99.190939 | False | 49.190939 |
| 899.029 | 7.361 | 0.228 | 1078.8348 | 719.2232 | 614 | 4 | 618 | 0.647249 | 99.352751 | False | 49.352751 |
| 899.334 | 7.662 | 0.697 | 1079.2008 | 719.4672 | 615 | 3 | 618 | 0.485437 | 99.514563 | False | 49.514563 |
| 899.377 | 0.563 | 2.400 | 1079.2524 | 719.5016 | 616 | 2 | 618 | 0.323625 | 99.676375 | False | 49.676375 |
| 899.525 | 3.229 | 1.125 | 1079.4300 | 719.6200 | 617 | 1 | 618 | 0.161812 | 99.838188 | False | 49.838188 |
1290 rows × 11 columns
Reporting Conditions spanning New Year Using TMY Data
The cntg_eoy year function can be used to wrap tmy data around the beginning/end of the year to prepare for calculating reporting conditions using time periods that span the new year.
[17]:
pvsyst = ct.load_pvsyst('./data/pvsyst_example_HourlyRes_2.CSV')
[18]:
pvsyst.column_groups
[18]:
wind__:
WindVel
temp_mod_:
TArray
index__:
index
irr_poa_:
GlobInc
shade__:
FShdBm
real_pwr__:
E_Grid
temp_amb_:
T_Amb
irr_ghi_:
GlobHor
pvsyt_losses__:
IL Pmax
IL Pmin
IL Vmax
IL Vmin
_inv_:
EOutInv
[19]:
pvsyst.set_regression_cols(power='real_pwr__', poa='irr_poa_', t_amb='temp_amb_', w_vel='wind__')
[20]:
pvsyst.df_flt = ct.capdata.wrap_year_end(pvsyst.data_filtered,
pd.Timestamp(year=1989, month=12, day=15),
pd.Timestamp(year=1990, month=1, day=15))
[21]:
pvsyst.df_flt.head(2)
[21]:
| GlobInc | GlobHor | T_Amb | TArray | WindVel | FShdBm | IL Pmin | IL Vmin | IL Pmax | IL Vmax | EOutInv | E_Grid | index | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Timestamp | |||||||||||||
| 1989-12-15 00:00:00 | 0.0 | 0.0 | 19.4 | 0.0 | 2.1 | 1.0 | 0 | 0 | 0.0 | 0 | -1200 | -8868 | 12/15/1989 00 00 |
| 1989-12-15 01:00:00 | 0.0 | 0.0 | 19.4 | 0.0 | 3.6 | 1.0 | 0 | 0 | 0.0 | 0 | -1200 | -8868 | 12/15/1989 01 00 |
[22]:
pvsyst.df_flt.tail(2)
[22]:
| GlobInc | GlobHor | T_Amb | TArray | WindVel | FShdBm | IL Pmin | IL Vmin | IL Pmax | IL Vmax | EOutInv | E_Grid | index | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Timestamp | |||||||||||||
| 1990-01-14 23:00:00 | 0.0 | 0.0 | 10.6 | 0.0 | 2.1 | 1.0 | 0 | 0 | 0.0 | 0 | -1200 | -8868 | 01/14/1990 23 00 |
| 1990-01-15 00:00:00 | 0.0 | 0.0 | 11.1 | 0.0 | 3.1 | 1.0 | 0 | 0 | 0.0 | 0 | -1200 | -8868 | 01/15/1990 00 00 |
[23]:
pvsyst.filter_irr(200, 900)
[24]:
pvsyst.filter_pvsyst()
[25]:
pvsyst.rep_cond()
Reporting conditions saved to rc attribute.
poa t_amb w_vel
0 608.99 24.797326 4.313621
Reporting Conditions for Time Periods
The freq option can be used to calculate reporting conditions for groups of time like months or seasons. Any standard aggregation method can be used to calculate the reporting conditions for each group using the func or the irr_bal method options.
[26]:
pvsyst.reset_filter()
[27]:
print(pvsyst.data_filtered.index[0])
print(pvsyst.data_filtered.index[-1])
1990-01-01 00:00:00
1990-12-31 23:00:00
[28]:
pvsyst.filter_irr(500, 900)
[29]:
pvsyst.rep_cond(freq='MS')
Reporting conditions saved to rc attribute.
poa t_amb w_vel
Timestamp
1990-01-01 764.82 14.813956 5.887209
1990-02-01 741.22 17.693826 4.956790
1990-03-01 746.50 21.124444 4.805556
1990-04-01 737.79 25.413402 4.712371
1990-05-01 711.19 28.066019 4.277670
1990-06-01 761.42 31.425000 4.117969
1990-07-01 756.42 32.542000 3.858667
1990-08-01 781.32 32.113699 4.257534
1990-09-01 749.63 29.318182 3.821488
1990-10-01 752.90 25.843373 3.837349
1990-11-01 716.85 20.733735 4.413253
1990-12-01 723.54 17.101112 4.297753
[30]:
pvsyst.rc
[30]:
| poa | t_amb | w_vel | |
|---|---|---|---|
| Timestamp | |||
| 1990-01-01 | 764.82 | 14.813956 | 5.887209 |
| 1990-02-01 | 741.22 | 17.693826 | 4.956790 |
| 1990-03-01 | 746.50 | 21.124444 | 4.805556 |
| 1990-04-01 | 737.79 | 25.413402 | 4.712371 |
| 1990-05-01 | 711.19 | 28.066019 | 4.277670 |
| 1990-06-01 | 761.42 | 31.425000 | 4.117969 |
| 1990-07-01 | 756.42 | 32.542000 | 3.858667 |
| 1990-08-01 | 781.32 | 32.113699 | 4.257534 |
| 1990-09-01 | 749.63 | 29.318182 | 3.821488 |
| 1990-10-01 | 752.90 | 25.843373 | 3.837349 |
| 1990-11-01 | 716.85 | 20.733735 | 4.413253 |
| 1990-12-01 | 723.54 | 17.101112 | 4.297753 |
Using the irr_bal option to calculate reporting conditions for each month of the year results in higher reporting irradiances.
Note that the with inplace set to False the reporting conditions attribute of the CapData object, pvsyst, is not overwritten.
[31]:
ib_rcs = pvsyst.rep_cond(freq='MS', irr_bal=True, percent_filter=20, inplace=False)
ib_rcs
[31]:
| poa | t_amb | w_vel | |
|---|---|---|---|
| 1990-01-01 | 719.78 | 14.851558 | 5.957813 |
| 1990-02-01 | 698.64 | 17.632729 | 5.030909 |
| 1990-03-01 | 737.60 | 21.179730 | 4.813514 |
| 1990-04-01 | 730.85 | 25.541772 | 4.670886 |
| 1990-05-01 | 666.39 | 27.570149 | 4.443284 |
| 1990-06-01 | 673.45 | 31.213793 | 4.234483 |
| 1990-07-01 | 722.88 | 32.273043 | 3.757391 |
| 1990-08-01 | 657.70 | 31.747126 | 4.226437 |
| 1990-09-01 | 669.71 | 29.177333 | 3.736000 |
| 1990-10-01 | 712.53 | 26.157627 | 3.686441 |
| 1990-11-01 | 662.24 | 21.038596 | 4.482456 |
| 1990-12-01 | 730.97 | 17.457361 | 4.160656 |
[32]:
(ib_rcs - pvsyst.rc)['poa']
[32]:
1990-01-01 -45.04
1990-02-01 -42.58
1990-03-01 -8.90
1990-04-01 -6.94
1990-05-01 -44.80
1990-06-01 -87.97
1990-07-01 -33.54
1990-08-01 -123.62
1990-09-01 -79.92
1990-10-01 -40.37
1990-11-01 -54.61
1990-12-01 7.43
Freq: MS, Name: poa, dtype: float64
Predicted Capacities
The predict_capacities method will use reporting conditions calculated using the freq option to determine predicted and guaranteed capacities.
From the previous exercise we still have the montly reporting conditions.
[33]:
pvsyst.rc
[33]:
| poa | t_amb | w_vel | |
|---|---|---|---|
| Timestamp | |||
| 1990-01-01 | 764.82 | 14.813956 | 5.887209 |
| 1990-02-01 | 741.22 | 17.693826 | 4.956790 |
| 1990-03-01 | 746.50 | 21.124444 | 4.805556 |
| 1990-04-01 | 737.79 | 25.413402 | 4.712371 |
| 1990-05-01 | 711.19 | 28.066019 | 4.277670 |
| 1990-06-01 | 761.42 | 31.425000 | 4.117969 |
| 1990-07-01 | 756.42 | 32.542000 | 3.858667 |
| 1990-08-01 | 781.32 | 32.113699 | 4.257534 |
| 1990-09-01 | 749.63 | 29.318182 | 3.821488 |
| 1990-10-01 | 752.90 | 25.843373 | 3.837349 |
| 1990-11-01 | 716.85 | 20.733735 | 4.413253 |
| 1990-12-01 | 723.54 | 17.101112 | 4.297753 |
[34]:
pvsyst.tolerance = '+/- 7'
[35]:
pvsyst.predict_capacities()
[35]:
| poa | t_amb | w_vel | PredCap | poa-param | I(poa * poa) | I(poa * t_amb) | I(poa * w_vel) | guaranteedCap | pt_qty | |
|---|---|---|---|---|---|---|---|---|---|---|
| Timestamp | ||||||||||
| 1990-01-01 | 764.82 | 14.813956 | 5.887209 | 5.025967e+06 | 7807.403238 | -1.075023 | -28.780983 | 2.139236 | 4.674150e+06 | 65 |
| 1990-02-01 | 741.22 | 17.693826 | 4.956790 | 4.818115e+06 | 7748.590219 | -0.948200 | -30.201071 | -2.248077 | 4.480847e+06 | 55 |
| 1990-03-01 | 746.50 | 21.124444 | 4.805556 | 4.763552e+06 | 7820.035210 | -1.097561 | -29.652529 | 1.429249 | 4.430103e+06 | 74 |
| 1990-04-01 | 737.79 | 25.413402 | 4.712371 | 4.598429e+06 | 7664.245134 | -0.943006 | -29.017525 | 0.347312 | 4.276539e+06 | 78 |
| 1990-05-01 | 711.19 | 28.066019 | 4.277670 | 4.391391e+06 | 7656.854585 | -0.931599 | -28.311278 | -5.848326 | 4.083994e+06 | 67 |
| 1990-06-01 | 761.42 | 31.425000 | 4.117969 | 4.598635e+06 | 7811.953410 | -1.019029 | -31.620881 | -0.681576 | 4.276731e+06 | 107 |
| 1990-07-01 | 756.42 | 32.542000 | 3.858667 | 4.548253e+06 | 7773.130138 | -1.030143 | -29.995995 | -1.273191 | 4.229875e+06 | 125 |
| 1990-08-01 | 781.32 | 32.113699 | 4.257534 | 4.693758e+06 | 7811.482832 | -1.023041 | -31.297422 | 0.091087 | 4.365195e+06 | 117 |
| 1990-09-01 | 749.63 | 29.318182 | 3.821488 | 4.592690e+06 | 7791.459642 | -1.002488 | -31.207653 | 0.417893 | 4.271202e+06 | 98 |
| 1990-10-01 | 752.90 | 25.843373 | 3.837349 | 4.697835e+06 | 7793.524488 | -0.957668 | -32.145191 | -0.547789 | 4.368987e+06 | 64 |
| 1990-11-01 | 716.85 | 20.733735 | 4.413253 | 4.615139e+06 | 7751.520728 | -0.937430 | -30.634333 | -1.422503 | 4.292079e+06 | 58 |
| 1990-12-01 | 723.54 | 17.101112 | 4.297753 | 4.736864e+06 | 7727.113070 | -0.926093 | -29.981748 | 0.572958 | 4.405283e+06 | 60 |