PrincetonUniversity / PGscen

MIT License
7 stars 5 forks source link

[BUG] Some simulated power outputs are way above rated plant capacity? #1

Closed dshen109 closed 2 years ago

dshen109 commented 2 years ago

Firstly, thanks for the work on this synthetic data generator! I am using v0.2.0-rc.4 and generated wind data over 1000 scenarios for 2018-01-25. I am looking at plant Hidalgo II and some of the hours have outputs as high as 175 (MW?), which seems far above the rated capacity of 100 MW

Here is a histogram of the 100 largest hourly power outputs (open in light mode to see the axes) pgscen-hidalgo

And here is the code I used to load it

import datetime as dt
import os

import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import seaborn as sns

def load_pgscen_wind(fpath, date):
    """Load a PGScen wind prediction file as a multiindex DataFrame.

    :param str fpath:
    :param str date: YYYYMMDD
    """
    frame = pd.read_csv(fpath)
    type_index = frame[['Type', 'Index']]
    frame.drop(columns=['Type', 'Index'], inplace=True)
    periods = frame.shape[1]
    year = int(date[0:4])
    month = int(date[4:6])
    day = int(date[6:])
    date = dt.datetime(year, month, day)
    times = pd.date_range(start=date, end=date + dt.timedelta(hours=23),
                          periods=periods)
    frame.columns = times

    type_index = np.tile(type_index, periods).reshape((-1, 2))
    # reset to zero indexing
    type_index[:, 1] -= 1
    stacked = frame.stack().to_frame()
    stacked.index = stacked.index.droplevel(0)
    stacked[['Type', 'Index']] = type_index
    stacked.set_index(['Type', 'Index'], append=True, inplace=True)
    stacked.index.names = ['Timestamp', 'Type', 'Index']
    stacked.columns = ['power']
    return stacked

wind = load_pgscen_wind('./20180125/wind/Hidalgo_II_Wind.csv')
unstacked.nlargest(100, columns='power')['power'].hist(bins=100)
plt.xlabel('power')
plt.ylabel('instances')
michal-g commented 2 years ago

We forgot to add capacity constraints in our engine to wind scenarios (like we already did for solar and load-solar scenarios). Please see the latest commit and release for a fix to this bug, and don't hesitate to submit more issues if you see anything that doesn't look right!

Also note that the NREL meta data that comes with this package has the Hidalgo II plant rated at a capacity of 51 MW, which is consistent with the latest EIA-860 report, so the output scenario values for this plant should now be capped at 51.