Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

19 Commits

Repository files navigation

Tariffs

This library provides a Python toolkit for analysing tariffs for electricity, gas and other utility services.

Use cases include:

  • assessing the bill savings associated with energy efficiency, solar or load management
  • assessing the benefits of tariff switching

Supported tariff components include:

  • flat charges
  • block / rate band charges
  • seasonal charges
  • time-of-use charges
  • demand / peak / capacity charges
  • scheduled / real-time charges
  • feed-in-tariffs / supply payments

Installation

At this stage it is best to install the package directly from the repo until a production-ready version is released.

pip install git+https://www.github.com/ecologic/tariffs

Quickstart

Firstly define your tariff as a JSON data structure e.g. for a very simple block tariff you could apply the tariff below:

{"charges": [{"rate_bands": [{"limit": 100,"rate": 0.1},{"rate": 0.02}]}]}

Next create a CSV file with the time-stamped load data as shown.

datetime,consumption
01/01/2018 00:00,0.1
01/01/2018 00:30,0.2
..etc

Next import the CSV as as a Pandas DataFrame, making sure to parse the datetime field appropriately:

importpandasimportdatetimeparser=lambdat: datetime.datetime.strptime(t, '%d/%m/%Y %H:%M')
withopen('meter_data.csv') asf:
meter_data=pandas.read_csv(f, index_col='datetime', parse_dates=True, infer_datetime_format=True,
date_parser=parser)

Next construct the Tariff as an Odin Resource and apply it to the load data as shown.

fromodin.codecsimportjson_codecfromtariffsimportTariffwithopen('tariff.json') asf:
tariff=json_codec.loads(f, Tariff)
bill=tariff.apply(meter_data)

To-do

  • Add support for Green Button and other serialised consumption data formats
  • Add support for ratchet tariffs

This is an early beta and we'll add documentation later but for now you can review the tests for examples of common tariff structures and their application.

Pull requests welcome.

About

Tariff toolkit for Python including tariff definition, validation, and cost calculation

Resources

Stars

4 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages