This page was generated from docs/examples/reporting_conditions.ipynb. Interactive online version: Binder badge

Reporting Conditions and Predicted Capacities

[1]:
import pandas as pd
import matplotlib as plt
from captest import capdata as pvc

First we load the NREL data used for testing and set the translation dictionary.

[2]:
meas = pvc.CapData('meas')
[3]:
meas.load_data(path='../../tests/data/', fname='nrel_data.csv', source='AlsoEnergy')
[4]:
meas.column_groups
[4]:
{'temp--': ['Deck Dry Bulb Temp [deg C]'],
 'index--': ['index'],
 'irr-ghi-': ['Global CMP22 (vent/cor) [W/m^2]'],
 'wind--': ['Avg Wind Speed @ 19ft [m/s]'],
 'irr-poa-': ['POA 40-South CMP11 [W/m^2]']}
[5]:
meas.set_regression_cols(poa='irr-poa-', w_vel='wind--', t_amb='temp--', power='')
[6]:
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

[7]:
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

[8]:
meas.rc
[8]:
poa t_amb w_vel
0 562.822 5.554151 1.358792
[9]:
meas.rc = None
[10]:
meas.rep_cond(inplace=False)
[10]:
poa t_amb w_vel
0 562.822 5.554151 1.358792
[11]:
print(meas.rc)
None

Irradiance Balance Method

The irr_bal option replaces the aggregation methods specified with the func agrument with the irrRC_balanced function. This function is intended to implement a strict interpratation 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. The irrRC_balanced function iterates to a solution for the reporting irradiance by calculating the irradiance that has 10 datpoints in the filtered dataset above it, then filtering for a percentage of points around that irradiance, calculating what percentile the reporting irradiance is in

[12]:
meas.reset_filter()
[13]:
meas.filter_irr(500, 900)

The plot below shows a visualization of the irrRC_balanced calculations. The teal dots in a vertical column along the left side of the figure are all the irradiance measurements in the dataset. Each red dot is an irradiance reporting condition and the colored vertical lines are the extent of the percent band around the reportin irradiance. The reportign irradiance is decreased for each loop until 40% of the irradiance points are above the reporting irradiance.

[14]:
rep_irr = pvc.irr_rc_balanced(meas.data_filtered, 0.8, 1.2, irr_col=meas._CapData__get_poa_col(), plot=True)
../_images/examples_reporting_conditions_19_0.png
[15]:
rep_irr[0]
[15]:
804.565
[16]:
meas.data_filtered.shape[0]
[16]:
1290
[17]:
rep_irr[1].shape[0]
[17]:
837
[18]:
meas.rep_cond(irr_bal=True, percent_filter=20)
Reporting conditions saved to rc attribute.
       poa     t_amb     w_vel
0  804.565  5.554001  1.372956
[19]:
meas.rc
[19]:
poa t_amb w_vel
0 804.565 5.554001 1.372956

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.

[20]:
pvsyst = pvc.CapData('pvsyst')
[21]:
pvsyst.load_data(load_pvsyst=True)
Skipped file: example_meas_data.csv
Skipped file: nrel_data.csv
Read: pvsyst_example_HourlyRes_2.CSV
[22]:
pvsyst.column_groups
[22]:
{'pvsyt_losses--': ['IL Pmax', 'IL Pmin', 'IL Vmax', 'IL Vmin'],
 'temp-mod-': ['TArray'],
 'index--': ['index'],
 '-inv-': ['EOutInv'],
 'temp-amb-': ['TAmb'],
 'real_pwr--': ['E_Grid'],
 'irr-ghi-': ['GlobHor'],
 'wind--': ['WindVel'],
 'shade--': ['FShdBm'],
 'irr-poa-': ['GlobInc']}
[23]:
pvsyst.set_regression_cols(power='real_pwr--', poa='irr-poa-', t_amb='temp-amb-', w_vel='wind--')
[24]:
pvsyst.df_flt = pvc.wrap_year_end(pvsyst.data_filtered,
                                  pd.Timestamp(year=1989, month=12, day=15),
                                  pd.Timestamp(year=1990, month=1, day=15))
[25]:
pvsyst.df_flt.head(2)
[25]:
GlobInc GlobHor TAmb TArray WindVel FShdBm IL Pmin IL Vmin IL Pmax IL Vmax EOutInv E_Grid index
date
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
[26]:
pvsyst.df_flt.tail(2)
[26]:
GlobInc GlobHor TAmb TArray WindVel FShdBm IL Pmin IL Vmin IL Pmax IL Vmax EOutInv E_Grid index
date
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
[27]:
pvsyst.filter_irr(200, 900)
[28]:
pvsyst.filter_pvsyst()
[29]:
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.

[30]:
pvsyst.reset_filter()
[31]:
print(pvsyst.data_filtered.index[0])
print(pvsyst.data_filtered.index[-1])
1990-01-01 00:00:00
1990-12-31 23:00:00
[32]:
pvsyst.filter_irr(500, 900)
[33]:
pvsyst.rep_cond(freq='MS')
Reporting conditions saved to rc attribute.
               poa      t_amb     w_vel
date
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.rc
[34]:
poa t_amb w_vel
date
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.

[35]:
ib_rcs = pvsyst.rep_cond(freq='MS', irr_bal=True, percent_filter=20, inplace=False)
ib_rcs
/home/docs/checkouts/readthedocs.org/user_builds/pvcaptest/envs/latest/lib/python3.7/site-packages/captest/capdata.py:3166: FutureWarning: Timestamp.freq is deprecated and will be removed in a future version
  freq = list(df_grpd.groups.keys())[0].freq
[35]:
poa t_amb w_vel
1990-01-01 817.33 14.579037 6.158065
1990-02-01 798.94 18.386000 5.088000
1990-03-01 805.65 21.583333 4.974242
1990-04-01 760.33 25.587838 4.625676
1990-05-01 850.38 28.603774 3.975472
1990-06-01 785.11 31.540385 3.961538
1990-07-01 801.16 32.698148 3.723148
1990-08-01 814.93 32.432692 4.125962
1990-09-01 837.88 29.247297 3.929730
1990-10-01 796.30 25.443636 3.738182
1990-11-01 777.55 20.618182 4.198182
1990-12-01 808.93 17.918506 4.070370
[36]:
(ib_rcs - pvsyst.rc)['poa']
[36]:
1990-01-01     52.51
1990-02-01     57.72
1990-03-01     59.15
1990-04-01     22.54
1990-05-01    139.19
1990-06-01     23.69
1990-07-01     44.74
1990-08-01     33.61
1990-09-01     88.25
1990-10-01     43.40
1990-11-01     60.70
1990-12-01     85.39
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.

[37]:
pvsyst.rc
[37]:
poa t_amb w_vel
date
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
[38]:
pvsyst.tolerance = '+/- 7'
[39]:
pvsyst.predict_capacities()
/home/docs/checkouts/readthedocs.org/user_builds/pvcaptest/envs/latest/lib/python3.7/site-packages/captest/capdata.py:514: FutureWarning: Timestamp.freq is deprecated and will be removed in a future version
  freq = list(grps.groups.keys())[0].freq
[39]:
poa t_amb w_vel PredCap poa-param I(poa * poa) I(poa * t_amb) I(poa * w_vel) guaranteedCap pt_qty
date
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