|
| 1 | +import numpy as np |
| 2 | +import pandas as pd |
| 3 | + |
| 4 | +from solarforecastarbiter import datamodel |
| 5 | +from solarforecastarbiter import pvmodel |
| 6 | + |
| 7 | +from pvlib.location import Location |
| 8 | + |
| 9 | + |
| 10 | +# define metadata |
| 11 | +modeling_params = datamodel.SingleAxisModelingParameters( |
| 12 | + ac_capacity=10, dc_capacity=14, temperature_coefficient=-0.004, |
| 13 | + dc_loss_factor=0, ac_loss_factor=0, |
| 14 | + axis_tilt=0, axis_azimuth=0, ground_coverage_ratio=.4, |
| 15 | + backtrack=True, max_rotation_angle=45) |
| 16 | + |
| 17 | +metadata = datamodel.SolarPowerPlant( |
| 18 | + name='Boulder Power Plant', latitude=40., longitude=-105., |
| 19 | + elevation=1650., timezone='America/Denver', provider='Sandia', |
| 20 | + modeling_parameters=modeling_params) |
| 21 | + |
| 22 | +times = pd.date_range( |
| 23 | + start='20190801', end='20191001', freq='5min', closed='left') |
| 24 | + |
| 25 | +solpos = pvmodel.calculate_solar_position( |
| 26 | + metadata.latitude, metadata.longitude, metadata.elevation, times) |
| 27 | +cs = pvmodel.calculate_clearsky( |
| 28 | + metadata.latitude, metadata.longitude, metadata.elevation, |
| 29 | + solpos['apparent_zenith']) |
| 30 | +ac_clear = pvmodel.irradiance_to_power( |
| 31 | + modeling_params, solpos['apparent_zenith'], solpos['azimuth'], |
| 32 | + cs['ghi'], cs['dni'], cs['dhi']) |
| 33 | + |
| 34 | +ac_clear_1h = ac_clear.resample('1h').mean() |
| 35 | +ac_clear_1h = pd.DataFrame({'value': ac_clear_1h, 'quality_flag': 0}) |
| 36 | +ac_clear_1h.to_csv('boulder_clear_aug_sept.csv', index_label='timestamp') |
| 37 | + |
| 38 | +# make it cloudy, but apply clipping |
| 39 | +random = np.random.random(size=len(times)) + 0.5 |
| 40 | +random = random.clip(max=1) |
| 41 | +ac = ac_clear * random |
| 42 | + |
| 43 | +ac_1h = ac.resample('1h').mean() |
| 44 | +ac_1h = pd.DataFrame({'value': ac_1h, 'quality_flag': 0}) |
| 45 | +ac_1h.to_csv('boulder_cloudy_aug_sept.csv', index_label='timestamp') |
| 46 | + |
| 47 | +fx_demo = ac_1h['value'].shift(1) |
| 48 | +fx_demo.to_csv('boulder_fx_demo_aug_sept.csv', |
| 49 | + header=['value'], index_label='timestamp') |
| 50 | + |
| 51 | +csi = ac / ac_clear |
| 52 | +csi = csi.fillna(0) # account for divide by 0 |
| 53 | +ac_csi = csi.shift(12) * ac_clear |
| 54 | +holmgren_demo = ac_csi.resample('1h').mean() |
| 55 | +holmgren_demo.to_csv('boulder_fx_holmgren_aug_sept.csv', |
| 56 | + header=['value'], index_label='timestamp') |
0 commit comments