Skip to content
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

fcas_semi_scheduled may be empty #7

Closed
andrewhn opened this issue Feb 7, 2022 · 2 comments
Closed

fcas_semi_scheduled may be empty #7

andrewhn opened this issue Feb 7, 2022 · 2 comments

Comments

@andrewhn
Copy link

andrewhn commented Feb 7, 2022

Hi,

Great library, thanks for writing it and making it accessible to everyone.

I think there may be an issue in running earlier years that don't feature semi scheduled gens offering FCAS.

To reproduce what I think is the error, you can run the example code in README and substitute references to 2019 with 2015. I get an error in units._scaling_for_uigf which seems to arise because the fcas_semi_scheduled data frame is empty.

My workaround was to add a check for whether the data frame was empty:

    if not fcas_semi_scheduled.empty:
        # Scale high break points.
        fcas_semi_scheduled['HIGHBREAKPOINT'] = \
            fcas_semi_scheduled.apply(lambda x: get_new_high_break_point(x['UIGF'], x['HIGHBREAKPOINT'],
                                                                         x['ENABLEMENTMAX']),
                                      axis=1)

        # Adjust ENABLEMENTMAX.
        fcas_semi_scheduled['ENABLEMENTMAX'] = \
            np.where(fcas_semi_scheduled['ENABLEMENTMAX'] > fcas_semi_scheduled['UIGF'],
                     fcas_semi_scheduled['UIGF'], fcas_semi_scheduled['ENABLEMENTMAX'])

        fcas_semi_scheduled.drop(['UIGF'], axis=1)

        # Combined bids back together.
        BIDPEROFFER_D = pd.concat([energy_bids, fcas_not_semi_scheduled, fcas_semi_scheduled])
    else:
        # Combined bids back together.
        BIDPEROFFER_D = pd.concat([energy_bids, fcas_not_semi_scheduled])

The tests I have done so far are very close to what NEMDE produces so all seem to be working.

Happy to look at it more and submit a PR if helpful.

@nick-gorman
Copy link
Member

Hi @andrewhn

No worries, glad your finding it interesting.

Thanks for pointing out this problem, investigating, and suggesting a fix.

Interesting that it's never come up as an issue before, I would have thought there'd be times in 2019 when no semi scheduled units were bidding into FCAS.

If you want to investigate further and submit a PR that would be really appreciated, otherwise I will try and look at it after addressing #6

Cheers,
Nick

@nick-gorman
Copy link
Member

@andrewhn this should be fixed in the latest release, update with pip, see notes here: https://github.com/UNSW-CEEM/nempy/releases/tag/v1.1.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants