Coder Social home page Coder Social logo

lbnl-eta / elecprice Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 935 KB

This project aims to provide a tool for calculating a customer's electricity bill based on a specific utility tariff. An example is given for various California utility tariffs, retrieved from the OpenEI API.

License: Other

Python 100.00%

elecprice's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

blumps47

elecprice's Issues

Code clean up

  • - clean up code
  • - update to python 3
  • - add unit tests
  • - add documentation

[openei_tariff_analyzer.py] Entry not found due to API query LIMIT of 500

The OpenEI Tariff Analyzer python script can be used as an interface to access the OpenEI database.
https://github.com/LBNL-ETA/elecprice/blob/2b78ea809c7f3f95c7fbe115fe9ed03fba2dcde8/electricitycostcalculator/openei_tariff/openei_tariff_analyzer.py
By providing arguments such as utility_id, sector and tariff_rate_of_interest, corresponding entries from the database can be queried.

Expected behaviour:
Requesting tariff_rate_of_interest with the value Time of Use, General Service, Demand Metered, Option D: GS-2 TOU D, Three Phase (Under 2 kV) should return 8 entries, including the newest one with startdate=2020-06-01T08:00:00.000Z and label= 5ed6bcba5457a3a405dd15aa as found in https://apps.openei.org/USURDB/rate/view/5ed6bcba5457a3a405dd15aa.

Actual behaviour:
The result JSON file contains only one entry with startdate=2015-02-28T09:00:00.000Z and label=5c9114ea5457a37e5307bc77.

Error cause:
Due to client side filtering and no option to filter on server side, the crappy OpenEI API filters only by utility_id, sector, returning the first 500 entries. Then on the client side, the tariff_rate_of_interest is filtered from those 500 entries. Unfortunately, the actual tariff_rate_of_interest of interest is within the following 138 entries and thus is never received at the client.

Minimal example:

from electricitycostcalculator.electricity_rate_manager.rate_manager import ElectricityRateManager
from electricitycostcalculator.openei_tariff.openei_tariff_analyzer import *

tariff_openei_apidata = OpenEI_tariff(utility_id='17609',
                                      sector='Commercial',
                                      tariff_rate_of_interest='Time of Use, General Service, Demand Metered, Option D: GS-2 TOU D, Three Phase (Under 2 kV)',
                                      distrib_level_of_interest=None,
                                   # it is at the secondary level, so not specified in the name
                                      phasewing=None,
                                   # the word 'Poly' is to be excluded, because the names may omit this info ..
                                      tou=True,
                                      option_exclusion=['Poly'])  # Need to reject the option X and W

tariff_openei_apidata.call_api(store_as_json=False)
entry_count = len(tariff_openei_apidata.data_openei)
print(entry_count)
for entry in tariff_openei_apidata.data_openei:
    print(entry['label'])

Output:

1
5c9114ea5457a37e5307bc77

Update package's name

Since the main class of the package has changed from "CostCalculator" to "ElectricityRateManager", the package's name should also be updated.
Ideally, it should be as short as possible. So far, one has to type this to install the package:

pip install electricitycostcalculor

I suggest the following:

  1. elecrate -> pip install elecrate
  2. pricelec -> pip install pricelec
  3. electariff -> pip install electariff

Let me know what you think and feel free to suggest other names.

error in fix charge charges

Noted by @bfgerke:

Some of the OpenEI JSON files report fixed charges as $/month, and others report them as $/day. But the calculator seems to ignore the stated units and assume everything is reported in $/month.

For instance, a tariff might have entries like

{
...
fixedchargefirstmeter:0.91565
fixedchargeunits:"$/day"
...
}

In this case, the code returns monthly fixed charges that are around $0.91, when they should be closer to $27.

TODO: Need to look at fixedchargeunits in the json.

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.