Code Monkey home page Code Monkey logo

tariffs's Introduction

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:

import pandas
import datetime

parser = lambda t: datetime.datetime.strptime(t, '%d/%m/%Y %H:%M')

with open('meter_data.csv') as f:
    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.

from odin.codecs import json_codec
from tariffs import Tariff

with open('tariff.json') as f:
    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.

tariffs's People

Contributors

johnmckibbin avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.