ample-tech / electric-units

For handling units of measurement in electricity grid data.
MIT License
2 stars 1 forks source link

More settlement periods #1

Open tomharvey opened 4 years ago

tomharvey commented 4 years ago

There is an implementation of a settlement period in the Australian NEM (National Energy Market) which is a 30 minute long settlement period, using the AEST timezone.

There are countless settlement periods in various markets around the globe - can you add to the list of supported regions.

To implement a new settlement period you should create a class which inherits from the BaseSettlementPeriod class, and implement 3 core methods:

  1. time_zone static method which returns the pytz timezone which the energy market operates in
  2. freq_minutes property which is the length of the settlement period, in minutes.
  3. start - these settlement periods are instantiated by a moment in time, this function should take that moment in time and return a datetime object for the start of that period.

See the NemSettlementPeriod implementation for more guide on how to create new implementations.

Pay particular attention to writing tests for your settlement period's start method, and have fun.

tonyfresko commented 4 years ago

This is something we can think about while we use this package in more practical applications. At the moment, I don't see the need for writing a custom settlement period object for each different length/time. I think that we could create a base/general SettlementPeriod object or object factory, as we can make everything depend on just the freq_minutes and timezone parameters at instantiation.