9 unstable releases (4 breaking)

0.5.2 Mar 12, 2024
0.5.1 Nov 16, 2023
0.5.0 Jul 11, 2023
0.4.0 Jun 7, 2023
0.1.0 Mar 28, 2023

#508 in Date and time

Download history 85/week @ 2024-02-19 9/week @ 2024-02-26 197/week @ 2024-03-11 2/week @ 2024-03-18 160/week @ 2024-04-01

359 downloads per month
Used in ocpi-tariffs-cli

MIT/Apache

81KB
1.5K SLoC

OCPI tariffs

crates-io docs-rs unsafe-forbidden github-actions github-activity

This project provides software for doing calculations with OCPI tariffs. Specifically for the OCPI 2.2.1 and OCPI 2.1.1 version.

You can test the tariff tool online.

OCPI is a protocol owned and maintained by the EV Roaming foundation.

Goals

  • Provide a reference OCPI tariff implementation

    Given a certain CDR and a certain tariff it's able to calculate the different (sub)totals.

    The software provides as output a breakdown of how these (sub)totals were calculated.

  • Provide an extensive set of test-cases to ensure correctness.

  • Collect feedback from the community

    We aim to have as many parties as possible agree that this reference implementation is a correct interpretation of the OCPI specification and intentions. We aim for close cooperation with the EV Roaming Foundation.

    We welcome community contributions to this project. We aim to make it easy for people, familiar with OCPI, to provide new test cases.

  • Provide the software as open source software so others can freely use and test it.

    Both a command line tool and a Rust library are provided.

  • Expose the software functionality online to make it even easier for people to do calculations with the tariff software.

  • Support OCPI 3 tariffs soon after OCPI 3 is finalized.

Non-goals

  • Provide software which communicates tariffs using the OCPI protocol between EV roaming parties.

  • Produce human consumable receipts which specify the different cost components that led to the calculated total price.

Tariff structure overview

classDiagram
    class Tariff {
        TariffElement elements
    }
    class TariffElement {
        PriceComponent price_components
        TariffRestriction restrictions
    }
    class PriceComponent {
        TarifDimensionType type
        Number price
        Number vat
        int step_size
    }
    class TariffRestriction {
        DayOfWeek day_of_week
        ...
    }
    Tariff "1" --o "1.." TariffElement
    TariffElement "1" --o "1.." PriceComponent
    TariffElement "1" --o "0..1" TariffRestriction

Contributing

We welcome community contributions to this project.

Please read our Contributor Terms before you make any contributions.

Any contribution intentionally submitted for inclusion, shall comply with the Rust standard licensing model (MIT OR Apache 2.0) and therefore be dual licensed as described below, without any additional terms or conditions:

License

This contribution is dual licensed under EITHER OF

at your option.

For clarity, "your" refers to TandemDrive or any other licensee/user of the contribution.

Dependencies

~2.5–4MB
~70K SLoC