Coder Social home page Coder Social logo

libocpp's Introduction

C++ implementation of OCPP

Github Actions

This is a C++ library implementation of OCPP for version 1.6 and 2.0.1 (see OCPP protocols at OCA website).

It enables charging stations to communicate with cloud backends for remote control, monitoring and billing of charging processes.

Libocpp can be used for the communication of one charging station and multiple EVSE using a single websocket connection.

Libocpp provides a complete implementation of OCPP 1.6. The implementation of OCPP 2.0.1 is currently under development.

Get Involved

See the COMMUNITY.md and CONTRIBUTING.md of the EVerest project to get involved.

Table of contents

OCPP 1.6 Support

The following tables show the current support for the listed OCPP 1.6 feature profiles / functional blocks and application notes.

All documentation and the issue tracking can be found in our main repository here: https://github.com/EVerest/

Feature Profile Support OCPP 1.6

Feature Profile Supported
Core ✔️ yes
Firmware Management ✔️ yes
Local Auth List Management ✔️ yes
Reservation ✔️ yes
Smart Charging ✔️ yes
Remote Trigger ✔️ yes
Whitepapers & Application Notes Supported
OCPP 1.6 Security Whitepaper (3rd edition) ✔️ yes
Using ISO 15118 Plug & Charge with OCPP 1.6 ✔️ yes
OCPP & California Pricing Requirements

Support for OCPP 2.0.1

The development of OCPP2.0.1 is in progress. Current implementation status.

Feature Profile Support OCPP 2.0.1

Feature Profile Supported
Core ✔️ yes
Advanced Security WIP
Local Auth List Management
Smart Charging WIP
Advanced Device Management
Advanced User Interface
Reservation
ISO 15118 support WIP
Whitepapers & Application Notes Supported
OCPP & California Pricing Requirements

CSMS Compatibility

CSMS Compatibility OCPP 1.6

The EVerest implementation of OCPP 1.6 has been tested against the OCPP Compliance Test Tool (OCTT and OCTT2) during the implementation.

The following table shows CSMS with which this library was tested. If you provide a CSMS that is not yet listed here, feel free to contact us!

  • chargecloud
  • chargeIQ
  • Chargetic
  • Compleo
  • Current
  • Daimler Truck
  • ev.energy
  • eDRV
  • Fastned
  • Open Charging Cloud (GraphDefined)
  • Electrip Global
  • EnergyStacks
  • EV-Meter
  • Fraunhofer IAO (ubstack CHARGE)
  • Green Motion
  • gridundco
  • ihomer (Infuse CPMS)
  • iLumen
  • JibeCompany (CharlieV CMS and Chargebroker proxy)
  • MSI
  • PUMP (PUMP Connect)
  • Scoptvision (Scopt Powerconnect)
  • Siemens
  • SteVe
  • Syntech
  • Trialog
  • ubitricity
  • Weev Energy

CSMS Compatibility OCPP 2.0.1

The current, ongoing implementation of OCPP 2.0.1 has been tested against a few CSMS and is continuously tested against OCTT2.

Additionally, the implementation has been tested against those CSMS:

Integration with EVerest

This library is automatically integrated as the OCPP and OCPP201 module within everest-core - the complete software stack for your charging station. It is recommended to use EVerest together with this OCPP implementation.

Run OCPP1.6 with EVerest

If you run libocpp with OCPP1.6 with EVerest, the build process of everest-core will take care of installing all necessary dependencies for you.

Run OCPP2.0.1 with EVerest

If you run libocpp with OCPP1.6 with EVerest, the build process of everest-core will take care of installing all necessary dependencies for you. This includes the initialization of the device model database using the config.json file.

Integrate this library with your Charging Station Implementation for OCPP1.6

OCPP is a protocol that affects, controls and monitors many areas of a charging station's operation.

If you want to integrate this library with your charging station implementation, you have to register a couple of callbacks and integrate event handlers. This is necessary for the library to interact with your charging station according to the requirements of OCPP.

Libocpp needs registered callbacks in order to execute control commands defined within OCPP (e.g Reset.req or RemoteStartTransaction.req)

The implementation must call event handlers of libocpp so that the library can track the state of the charging station and trigger OCPP messages accordingly (e.g. MeterValues.req , StatusNotification.req)

Your reference within libocpp to interact is a single instance to the class ChargePoint for OCPP 1.6 or to the class ChargePoint for OCPP 2.0.1.

Overview of the required callbacks and events and what libocpp expects to happen

The following section will give you a high level overview of how to integrate libocpp with your application. Please use the Doxygen Documentation as an additional source for the ChargePoint API.

In EVerest the OCPP module leverages several other modules to perform tasks that relate to authorization, reservations, charging session handling and system tasks like rebooting or firmware updates.

  • Auth orchestrates authorization, utilizing different token providers like RFID reads and token validators. Libocpp mainly acts as a token validator, but in the case of RemoteStartTransactions it acts as a token provider as well
  • EvseManager manages the charging session and charging state machine by communicating with a "board support package", a driver for the charging hardware that abstracts away the control pilot, relay control, power meters, etc. The EvseManager also handles reservations.
  • System handles firmware updates, log uploads and resets

The following sections explain the steps you can follow to implement their functionality on your own and integrate the libocpp directly into your charging station software without relying on EVerest. However, in most cases it's much easier to write an EVerest driver using the everest-core/interfaces/board_support_AC.yaml interface.

ChargePoint() constructor

The main entrypoint for libocpp for OCPP1.6 is the ocpp::v16::ChargePoint constructor. This is defined in libocpp/include/ocpp/v16/charge_point.hpp and takes the following parameters:

  • config: a std::string that contains the libocpp 1.6 config. There are example configs that work with a SteVe installation running in Docker, for example: config-docker.json

  • share_path: a std::filesystem path containing the path to the OCPP modules folder, for example pointing to /usr/share/everest/modules/OCPP. This path contains the following files and directories and is installed by the libocpp install target:

    .
    ├── config-docker.json
    ├── config-docker-tls.json
    ├── config.json
    ├── init.sql
    ├── logging.ini
    └── profile_schemas
        ├── Config.json
        ├── Core.json
        ├── FirmwareManagement.json
        ├── Internal.json
        ├── LocalAuthListManagement.json
        ├── PnC.json
        ├── Reservation.json
        ├── Security.json
        ├── SmartCharging.json
        └── Custom.json

    Here you can find:

    • the aforementioned config files

    • a logging.ini that is needed to initialize logging with Everest::Logging::init(path_to_logging_ini, "name_of_binary")

    • a init.sql file which contains the database schema used by libocpp for its sqlite database

    • and a profile_schemas directory. This contains json schema files that are used to validate the libocpp config. The schemas are split up according to the OCPP1.6 feature profiles like Core, FirmwareManagement and so on. Additionally there is a schema for "Internal" configuration options (for example the ChargePointId, or CentralSystemURI). A "PnC" schema for the ISO 15118 Plug & Charge with OCPP 1.6 Application note, a "Security" schema for the OCPP 1.6 Security Whitepaper (3rd edition) and an exemplary "Custom" schema are provided as well. The Custom.json could be modified to be able to add custom configuration keys. Finally there's a Config.json schema that ties everything together

  • user_config_path: this points to a "user config", which we call a configuration file that's merged with the config that's provided in the "config" parameter. Here you can add, remove and overwrite settings without modifying the config passed in the first parameter directly. This is also used by libocpp to persistently modify config entries that are changed by the CSMS that should persist across restarts.

  • database_path: this points to the location of the sqlite database that libocpp uses to keep track of connector availability, the authorization cache and auth list, charging profiles and transaction data

  • sql_init_path: this points to the aforementioned init.sql file which contains the database schema used by libocpp for its sqlite database

  • message_log_path: this points to the directory in which libocpp can put OCPP communication logfiles for debugging purposes. This behavior can be controlled by the "LogMessages" (set to true by default) and "LogMessagesFormat" (set to ["log", "html", "session_logging"] by default, "console" and "console_detailed" are also available) configuration keys in the "Internal" section of the config file. Please note that this is intended for debugging purposes only as it logs all communication, including authentication messages.

  • evse_security: this is a pointer to an implementation of the evse_security interface. This allows you to include your custom implementation of the security related operations according to this interface. If you set this value to nullptr, the internal implementation of the security related operations of libocpp will be used. In this case you need to specify the parameter security_configuration

  • security_configuration: this parameter should only be set in case the evse_security parameter is nullptr. It specifies the file paths that are required to set up the internal evse_security implementation. Note that you need to specify bundle files for the CA certificates and directories for the certificates and keys

    The directory layout expected is as follows

    .
    ├── ca
    │   ├── csms
    │   │   └── CSMS_ROOT_CA.pem
    │   ├── cso
    │   │   ├── CPO_CERT_CHAIN.pem
    │   │   ├── CPO_SUB_CA1_LEAF.der
    │   │   ├── CPO_SUB_CA1.pem
    │   │   ├── CPO_SUB_CA2_LEAF.der
    │   │   └── CPO_SUB_CA2.pem
    │   ├── mf
    │   │   └── MF_ROOT_CA.pem
    │   ├── mo
    │   │   ├── INTERMEDIATE_MO_CA_CERTS.pem
    │   │   ├── MO_ROOT_CA.der
    │   │   ├── MO_ROOT_CA.pem
    │   │   ├── MO_SUB_CA1.der
    │   │   ├── MO_SUB_CA1.pem
    │   │   ├── MO_SUB_CA2.der
    │   │   └── MO_SUB_CA2.pem
    │   └── v2g
    │       ├── V2G_ROOT_CA.der
    │       └── V2G_ROOT_CA.pem
    ├── client
    │   ├── csms
    │   │   ├── CPO_CERT_CHAIN.pem
    │   │   ├── CPO_SUB_CA1.key
    │   │   ├── CPO_SUB_CA2.key
    │   │   ├── SECC_LEAF.der
    │   │   ├── SECC_LEAF.key
    │   │   └── SECC_LEAF.pem
    │   ├── cso
    │   │   ├── CPO_CERT_CHAIN.pem
    │   │   ├── CPO_SUB_CA1.key
    │   │   ├── CPO_SUB_CA2.key
    │   │   ├── SECC_LEAF.der
    │   │   ├── SECC_LEAF.key
    │   │   └── SECC_LEAF.pem
    │   └── v2g
    │       └── V2G_ROOT_CA.key

registering callbacks

You can (and in many cases MUST) register a number of callbacks so libocpp can interact with the charger. In EVerest most of this functionality is orchestrated by the "EvseManager" module, but you can also register your own callbacks interacting directly with your chargers software. Following is a list of callbacks that you must register and a few words about their purpose.

TODO: in a future version of libocpp the callbacks will be organised in a struct with optional members emphasizing the required and optional callbacks.

Some general notes: the "connector" parameter of some of the callbacks refers to the connector number as understood in the OCPP 1.6 specification, "0" means the whole charging station, the connectors with EVSEs used for charging cars start at "1".

  • register_pause_charging_callback

    this callback is used by libocpp to request pausing of charging, the "connector" parameter tells you which connector/EVSE has to pause charging

  • register_resume_charging_callback

    this callback is used by libocpp the request resuming of charging, the "connector" parameter tells you which connector/EVSE can resume charging

  • register_stop_transaction_callback

    in EVerest this calls the EvseManagers stop_transaction command which "Stops transactions and cancels charging externally, charging can only be resumed by replugging car. EVSE will also stop transaction automatically e.g. on disconnect, so this only needs to be called if the transaction should end before." this will then signal the following events:

    • ChargingFinished
    • TransactionFinished
  • register_unlock_connector_callback

    can be used by libocpp to force unlock a connector

  • register_reserve_now_callback

    libocpp can use this to reserve a connector, reservation handling is outsourced to a reservation manager in EVerest that implements the reservation interface (everest-core/interfaces/reservation.yaml)

  • register_upload_diagnostics_callback

    uses a function (in EVerest provided by the System module) to upload the requested diagnostics file

  • register_upload_logs_callback

    uses a function (in EVerest provided by the System module) to upload the requested log file

  • register_update_firmware_callback

    uses a function (in EVerest provided by the System module) to perform a firmware update

  • register_signed_update_firmware_callback

    uses a function (in EVerest provided by the System module) to perform a signed firmware update

  • register_provide_token_callback

    this callback is used in a remote start transaction to provide a token (prevalidated or not) to the authorization system

  • register_set_connection_timeout_callback

    used by libocpp to set the authorization or plug in connection timeout in the authorization system based on the "ConnectionTimeout" configuration key

  • register_disable_evse_callback

    used to disable the EVSE (ChangeAvailability.req)

  • register_enable_evse_callback

    used to enable the EVSE (ChangeAvailability.req)

  • register_cancel_reservation_callback

    used to cancel a reservation in the reservation manager (CancelReservation.req)

  • register_signal_set_charging_profiles_callback

    used to signal that new charging schedule(s) have been set, you can then use get_all_composite_charging_schedules(duration_s) to get the new valid charging schedules

  • register_is_reset_allowed_callback

    used to inquire (in EVerest from the System module) if a reset is allowed

  • register_reset_callback

    used to perform a reset of the requested type

  • register_connection_state_changed_callback

    used to inform about the connection state to the CSMS (connected = true, disconnected = false)

  • register_configuration_key_changed_callback used to react on a changed configuration key. This callback is called when the specified configuration key has been changed by the CSMS

Functions that need to be triggered from the outside after new information is availble (on_... functions in the charge point API)

  • on_log_status_notification(int32_t request_id, std::string log_status)

    can be used to notify libocpp of a log status notification

  • on_firmware_update_status_notification(int32_t request_id, std::string firmware_update_status)

    can be used to notify libocpp of a firmware update status notification

  • on_meter_values(int32_t connector, const Powermeter& powermeter)

    provides a Powermeter struct to libocpp (for sending meter values during charging sessions or periodically)

  • on_max_current_offered(int32_t connector, int32_t max_current)

    the maximum current offered to the EV on this connector (in ampere)

The following functions are triggered depending on different so called "Session Events" from the EvseManager

each of these functions will have a small note what the Session Event was and what it triggers in libocpp

  • on_enabled(int32_t connector)

    Notifies libocpp that the connector is functional and operational

  • on_disabled(int32_t connector)

    Notifies libocpp that the connector is disabled

  • on_transaction_started

    Notifies libocpp that a transaction at the given connector has started, this means that authorization is available and the car is plugged in.

    Some of its parameters:

    session_id is an internal session_id originating in the EvseManager to keep track of the transaction, this is NOT to be mistaken for the transactionId from the StartTransactionResponse in OCPP!

    id_token is the token with which the transaction was authenticated

    meter_start contains the meter value in Wh for the connector at start of the transaction

    timestamp at the start of the transaction

  • on_transaction_stopped

    Notifies libocpp that the transaction on the given connector with the given reason has been stopped.

    Some of its parameters:

    timestamp at the end of the transaction

    energy_wh_import contains the meter value in Wh for the connector at end of the transaction

  • on_suspend_charging_ev

    Notifies libocpp that the EV has paused charging

  • on_suspend_charging_evse

    Notifies libocpp that the EVSE has paused charging

  • on_resume_charging

    Notifies libocpp that charging has resumed

  • on_session_started

    this is mostly used for logging and changing the connector state

  • on_session_stopped

    this is mostly used for logging and changing the connector state

  • on_error

    Notify libocpp of an error

  • on_reservation_start

    Notifies libocpp that a reservation has started

  • on_reservation_end

    Notifies libocpp that a reservation has ended

Authorization

In EVerest authorization is handled by the Auth module and various auth token providers and validators. The OCPP module acts as both a token provider (for pre validated tokens in RemoteStartTransactions) and a token validator (using the authorize requests, or plug & charge) To use libocpp as a auth token validator (e.g. before starting a transaction) you can call the "authorize_id_token" function of the ChargePoint object

Integrate this library with your Charging Station Implementation for OCPP2.0.1

TODO

Register event callbacks and on_handlers

Initialize the database

  • Use provided sql database or implement your own storage drive

Install libocpp

For Debian GNU/Linux 11 you will need the following dependencies:

  sudo apt install build-essential cmake python3-pip libboost-all-dev libsqlite3-dev libssl-dev

OpenSSL version 3.0 or above is required.

Clone this repository.

  git clone https://github.com/EVerest/libocpp

In the libocpp folder create a folder named build and cd into it. Execute cmake and then make install:

  mkdir build && cd build
  cmake ..
  make install

Quickstart for OCPP 1.6

Libocpp provides a small standalone OCPP1.6 client that you can control using command line.

Install the dependencies and libocpp as described in Install libocpp.

Make sure you modify the following config entries in the config.json file according to the CSMS you want to connect to before executing make install.

{
  "Internal": {
    "ChargePointId": "",
    "CentralSystemURI": ""
  }
}

Change into libocpp/build and execute cmake and then make install:

  cd build
  cmake -DLIBOCPP16_BUILD_EXAMPLES=ON -DCMAKE_INSTALL_PREFIX=./dist ..
  make -j$(nproc) install

Use the following command to start the charge point. Replace the config with config-docker.json if you want to test with the SteVe CSMS running in a docker container.

  ./dist/bin/charge_point \
    --maindir ./dist \
    --conf config.json

Type help to see a list of possible commands.

Building the doxygen documentation

  cmake -S . -B build
  cmake --build build --target doxygen-ocpp

You will find the generated doxygen documentation at: build/dist/docs/html/index.html

The main reference for the integration of libocpp for OCPP1.6 is the ocpp::v16::ChargePoint class defined in libocpp/include/ocpp/v16/charge_point.hpp .

Unit testing

GTest is required for building the test cases target. To build the target and run the tests you can reference the script .ci/build-kit/install_and_test.sh. The script allows the GitHub Actions runner to execute.

Local testing:

mkdir build
cmake -B build -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX="./dist"
cd build
make -j$(nproc) install

Run any required tests from build/tests.

Building with FetchContent instead of EDM

In doc/build-with-fetchcontent you can find an example how to build libocpp with FetchContent instead of EDM.

Support for TPM keys

In order to use the TPM keys, it is mandatory to use the default libwebsocket implementation.

Support for websocket++

The old websocket++ implementation has been deprecated. For enabling websocket++ support use the following cmake option:

  cmake .. -DLIBOCPP_ENABLE_DEPRECATED_WEBSOCKETPP=ON

Support for iface

In order to connect through a custom network iface, a custom internal config variable 'IFace' can be used.

"Internal": {        
    "IFace" : "enp43s0"
}

libocpp's People

Contributors

a-w50 avatar afronut avatar ahzf avatar andistorm avatar assemblyjohn avatar bwf0dghpyxmk avatar caller avatar chgoodchild avatar christopher-davis-afs avatar corneliusclaussen avatar couryrr-afs avatar dominik-k avatar drmrd avatar folkengine avatar gberardi-pillar avatar hikinggrass avatar james-ctc avatar jannejy avatar klemmpnx avatar krealyt avatar maaikez avatar marcemmers avatar mennodegraaf avatar movhdi avatar pietfried avatar rinzevdwalalfen avatar robertdeleeuw avatar slitovchuk avatar snsubramanya avatar valentin-dimov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libocpp's Issues

Use Case K16: Optimized charging with scheduling to the CSMS

Functional Requirements

  • K16.FR.01: Precondition CSMS sends a new SetChargingProfileRequest. Charging Station SHALL respond with a SetChargingProfileResponse with status = Accepted.

  • K16.FR.02: Precondition K16.FR.01. Charging Station SHALL initiate schedule renegotiation with EV. Note: In ISO 15118 this is done by replying with EVSENotification=ReNegotiation to a CurrentDemandReq (for DC) or ChargingStatusReq (for AC) message.

  • K16.FR.03: Precondition K16.FR.02. Charging Station SHALL provide the ChargingSchedule data to the EV. Note: In ISO 15118 this is done in the ChargeParameterDiscoverRes message

  • K16.FR.04: Precondition EV returns a charging profile. Charging Station SHALL verify that provided charging profile is within boundaries of the ChargingSchedule from CSMS. Note: In ISO 15118 EV may provide this as part of the PowerDeliveryReq message.

  • K16.FR.05: Precondition K16.FR.04. Charging Station SHALL send the EV charging profile in a NotifyEVChargingScheduleRequest message to CSMS.

  • K16.FR.06: Precondition K16.FR.05 AND EV charging profile is within limits of CSMS ChargingSchedule. CSMS responds with NotifyEVChargingScheduleResponse with status Accepted to Charging Station. Note: Already checked by Charging Station, but CSMS does its own check.

  • K16.FR.07: Precondition K16.FR.05 AND EV charging profile is NOT within limits of CSMS ChargingSchedule.
    CSMS responds with NotifyEVChargingScheduleResponse with status Rejected to Charging Station.

  • K16.FR.08: Precondition K16.FR.07. CSMS starts new renegotiation as per use case K16.

  • K16.FR.09: Precondition When the Charging Station receives charging needs from the EV. The Charging Station SHOULD NOT send a NotifyEVChargingNeedsRequest to the CSMS. Note: CSMS initiated the renegotiation and has just sent a new charging profile, based on the initial charging needs from EV, energy already consumed by EV and whatever information has caused CSMS to update the charging profile. In ISO 15118 charging needs are sent via ChargeParameter-DiscoveryReq.

  • K16.FR.10: Precondition K16.FR.04. The Charging Station SHOULD take the schedule from the NotifyEVChargingScheduleRequest into account when calculating the actual Composite schedule.

  • K16.FR.11: Precondition K16.FR.02 AND current or power in new charging schedule is lower than actual current or power. The Charging Station SHALL request EV to lower current or power to a value matching the new charging schedule at the first possible opportunity. Note: In ISO 15118 this can be communicated in CurrentDemandRes (for DC) or ChargingStatusRes (for AC).

  • K16.FR.12: Precondition K16.FR.09 AND Charging Station sends a NotifyEVChargingNeedsRequest. The CSMS SHALL send a SetChargingProfileRequest. This situation is not desirable, because charging profile will likely be the same as in K16.FR.01, but this is added for robustness when Charging Station is not adhering to K16.FR.09.

  • K16.FR.13: Precondition EV does not return a charging profile. Charging Station IS RECOMMENDED to return an EV charging profile as a chargingSchedule in a NotifyEVChargingScheduleRequest message to CSMS that matches the schedule that was selected by the EV (i.e. chargingSchedule.id = SAScheduleTupleId) In ISO 15118-2 the EV charging profile and the selected schedule are returned as ChargingProfile and SAScheduleTupleId in PowerDeliveryReq.

Use Case K17: Renegotiating a Charging Schedule

  • K17.FR.01: Precondition EV triggers a renegotiation and sends new charging needs The Charging Station SHALL send a NotifyEVChargingNeedsRequest to the CSMS.
  • K17.FR.02: Precondition K17.FR.01. In response to a NotifyEVChargingNeedsRequest the CSMS SHALL send a NotifyEVChargingNeedsResponse.
  • K17.FR.03: Precondition K17.FR.02. If the CSMS is able to provide a charging schedule, it SHALL indicate this by setting the status field in the NotifyEVChargingNeedsResponse to 'Accepted'.
  • K17.FR.04: Precondition K17.FR.02. If the CSMS is not able to provide a charging schedule, it SHALL indicate this by setting the status field in the NotifyEVChargingNeedsResponse to 'Rejected'.
  • K17.FR.05: Precondition K17.FR.02 If the CSMS is able to provide a charging schedule; but needs processing time, it SHALL indicate this by setting the status field in the NotifyEVChargingNeedsResponse to 'Processing'.
  • K17.FR.06: A NotifyEVChargingNeedsRequest SHALL contain either ACChargingParameters or DCChargingParameters.
  • K17.FR.07: Precondition K17.FR.03 or K17.FR.05. The CSMS SHALL send a SetChargingProfileRequest with chargingProfilePurpose = TxProfile and at most three chargingSchedule and optional salesTariff elements, that each contain no more periods than specified by maxScheduleTuples in NotifyEVChargingNeedsRequest and by device model variable SmartChargingCtrlr.PeriodsPerSchedule.
  • K17.FR.08: Precondition K17.FR.01. The CSMS SHOULD send a SetChargingProfileRequest to the Charging Station within 60 seconds. Note: This is to satisfy the ISO 15118 ChargeParameterDiscoveryReq timeout.
  • K17.FR.09: Precondition K17.FR.07 AND EV returns a charging profile. Charging Station SHALL verify that provided charging profile is within boundaries of the ChargingSchedule from CSMS. Note: In ISO 15118 EV can sent its charging profile as part of PowerDeliveryReq.
  • K17.FR.10: Precondition K17.FR.09. Charging Station SHALL send the EV charging profile in a NotifyEVChargingScheduleRequest message to CSMS.
  • K17.FR.11: Precondition K17.FR.10 AND EV charging profile is within limits of CSMS ChargingSchedule. CSMS responds with NotifyEVChargingScheduleResponse with status Accepted to Charging Station. Note: Already checked by Charging Station, but CSMS does its own check.
  • K17.FR.12: Precondition K17.FR.10 AND EV charging profile is NOT within limits of CSMS ChargingSchedule. CSMS responds with NotifyEVChargingScheduleResponse with status Rejected to Charging Station.
  • K17.FR.13: Precondition K17.FR.12. CSMS starts new renegotiation as per use case K16.
  • K17.FR.14: Precondition K17.FR.11. The Charging Station SHOULD take the schedule from the NotifyEVChargingScheduleRequest into account when calculating the actual Composite schedule.
  • K17.FR.15: Precondition K17.FR.01 AND Charging Station is offline. The Charging Station SHALL use the TxDefaultProfile (if present) and generate a charging schedule within the limits of its composite schedule.
  • K17.FR.16: Precondition K17.FR.07 EV does not return a charging profile. Charging Station IS RECOMMENDED to return an EV charging profile as a chargingSchedule in a NotifyEVChargingScheduleRequest message to CSMS that matches the schedule that was selected by the EV (i.e. chargingSchedule.id = SAScheduleTupleId). Note: In ISO 15118-2 the EV charging profile and the selected schedule are returned as ChargingProfile and SAScheduleTupleId in PowerDeliveryReq.

Smart Charging Functional Block: Adhere to OCPP 2.0.1 Generic Requirements

From OCPP 2.0.1: Part 2, §3, Table 10 (condensed):

  • FR.01: The sender of a <message>Request SHALL wait for a <message>Response or a timeout, before sending another request message.
  • FR.02: When the Charging Station receives a valid OCPP request message according to the JSON schemas / RPC Framework AND the other system is not causing a security violation, the Charging Station SHALL respond with a RPC Framework: CALLRESULT.
    • If the Charging Station/CSMS needs to provide additional information, this can be done in the statusInfo element of the response message.
  • FR.03: When the Charging Station/CSMS receives an invalid OCPP message according to the JSON schemas / RPC Framework OR the other system causes a security violation, the Charging Station/CSMS SHALL respond with a RPC Framework: CALLERROR.
  • FR.04: When the CSMS did not accept the BootNotificationRequest from the Charging Station AND the Charging Station sends a message other than BootNotificationRequest, the CSMS SHALL respond with a RPC Framework: CALLERROR: SecurityError.
  • FR.05: There are a few messages that do not provide their result in the response message, but send one or more messages that contain the result. When one of the following messages is received; GetReport, GetBaseReport, GetMonitoringReport, GetDisplayMessages, CustomerInformation, GetChargingProfiles, GetLog, UpdateFirmware, PublishFirmware, TriggerMessage(<message>), the Charging Station SHALL acknowledge the requests in the list below with a response message first, before sending the follow-up message shown after the arrow (→):
    • GetReportNotifyReport
    • GetBaseReportNotifyReport
    • GetMonitoringReportNotifyMonitoringReport
    • GetDisplayMessagesNotifyDisplayMessage
    • CustomerInformationNotifyCustomerInformation
    • GetChargingProfilesReportChargingProfiles
    • GetLogLogStatusNotification
    • UpdateFirmwareFirmwareStatusNotification
    • PublishFirmwarePublishFirmwareStatusNotification
    • TriggerMessage(<message>)<requested message>
    • Note: The CSMS needs to know that a request was accepted, so that it can expect result messages.

Use Case K15: Charging with load leveling based on High Level Communication

Functional Requirements

  • K15.FR.01: When the Charging Station receives charging needs from the EV The Charging Station SHALL send a
    NotifyEVChargingNeedsRequest to the CSMS.

  • K15.FR.02: Precondition - K15.FR.01 In response to a NotifyEVChargingNeedsRequest the CSMS SHALL send a NotifyEVChargingNeedsResponse.

  • K15.FR.03: Precondition - K15.FR.02 If the CSMS is able to provide a charging schedule, it SHALL indicate this by setting the status field in the NotifyEVChargingNeedsResponse to 'Accepted'.

  • K15.FR.04: Precondition - K15.FR.02 If the CSMS is not able to provide a charging schedule, it SHALL indicate this by setting the status field in the NotifyEVChargingNeedsResponse to 'Rejected'.

  • K15.FR.05 K15.FR.02 If the CSMS is able to provide a charging schedule; but needs processing time, it SHAL indicate this by setting the status field in the NotifyEVChargingNeedsResponse to 'Processing'. Note: The Charging Station does not have to wait for the SetChargingProfileRequest. CSMS will send it later and trigger a renegotiation as per use case K16.

  • K15.FR.06 A NotifyEVChargingNeedsRequest SHALL contain either ACChargingParameters or DCChargingParameters.

  • K15.FR.07: Precondition - K15.FR.03 or K15.FR.05 The CSMS SHALL send a SetChargingProfileRequest with
    chargingProfilePurpose = TxProfile and a transactionId and at most three chargingSchedule and optional salesTariff elements, that each contain no more periods than specified by maxScheduleTuples in NotifyEVChargingNeedsRequest and by device model variable Smart ChargingCtrlr.PeriodsPerSchedule. Note: The Charging Station will calculate the composite schedule(s) for the EVSE (taking into account a ChargingStationMaxProfile or ChargingStationExternalConstraints if present) and will convert that to the SAScheduleList format for ISO 15118

  • K15.FR.08: Precondition- K15.FR.01 The CSMS SHOULD send a SetChargingProfileRequest to the Charging Station within 60 seconds. Note: This is to satisfy the ISO 15118 ChargeParameterDiscoveryReq timeout.

  • K15.FR.09: Precondition - K15.FR.07 AND EV returns a charging profile. Charging Station SHALL verify that provided charging profile is within boundaries of the ChargingSchedule from CSMS. In ISO 15118 EV can sent its charging profile as part of PowerDeliveryReq.

  • K15.FR.10: Precondition K15.FR.09 Charging Station SHALL send the EV charging profile in a NotifyEVChargingScheduleRequest message to CSMS.

  • K15.FR.11: Precondition K15.FR.10 AND EV charging profile is within limits of CSMS. ChargingSchedule CSMS responds with NotifyEVChargingScheduleResponse with status Accepted to Charging Station. Note: Already checked by Charging Station, but CSMS does its own check.

  • K15.FR.12: Precondition K15.FR.10 AND EV charging profile is NOT within limits of CSMS ChargingSchedule CSMS responds with NotifyEVChargingScheduleResponse with status Rejected to Charging Station.

  • K15.FR.13: Precondition K15.FR.12 CSMS starts new renegotiation as per use case K16.

  • K15.FR.14: Precondition K15.FR.11 The Charging Station SHOULD take the schedule from the NotifyEVChargingScheduleRequest into account when calculating the actual Composite schedule.

  • K15.FR.15: Precondition K15.FR.03 AND Charging Station is offline. The Charging Station SHALL use the TxDefaultProfile (if present) and generate a charging schedule within the limits of its composite schedule.

  • K15.FR.16: Precondition K15.FR.07 It is RECOMMENDED to configure the Charging Station, such that a TransactionEvent with idToken has been sent prior to the NotifyEVChargingNeedsRequest Message, so that CSMS can take the user into account when creating a charging schedule.

  • K15.FR.17: Precondition When Charging Station receives a SetChargingProfileRequest immediately after the transaction has tarted and before it has sent the NotifyEVChargingNeedsRequest to CSMS. The Charging Station SHOULD respond with SetChargingProfileResponse with status = Rejected and a statusInfo with reasonCode= InvalidMessageSequence. CSMS sent profile too early. It does not harm if CS accepts the charging profile instead of rejecting it, as long as it sends a charging profile again when it receives the NotifyEVChargingNeedsRequest.

  • K15.FR.18: Precondition K15.FR.03 OR K15.FR.05. CSMS IS RECOMMENDED to use only one chargingSchedule in a SetChargingProfileRequest. This ensures that there is no doubt about which schedule the EV will follow, even when no NotifyEVChargingScheduleRequest is received.

  • K15.FR.19: Precondition K15.FR.07 AND EV does not return a charging profile Charging Station IS RECOMMENDED to return an EV charging profile as a chargingSchedule in a NotifyEVChargingScheduleRequest message to CSMS that matches the schedule that was selected by the EV (i.e. chargingSchedule.id = SAScheduleTupleId) In ISO 15118-2 the EV charging profile and the selected schedule are returned as ChargingProfile and SAScheduleTupleId in PowerDeliveryReq.

Use Case K11: Set / Update External Charging Limit With Ongoing Transaction

Scenario

  1. External control system sends charging limit/schedule to Charging Station.

  2. Optional: Charging Station calculates new charging schedule.

  3. Charging Station adjusts the charging speed of the ongoing transaction(s).

  4. If the charging limit changed by more than: LimitChangeSignificance, the Charging Station sends a NotifyChargingLimitRequest message to CSMS with optionally the set charging limit/schedule.

  5. The CSMS responds with NotifyChargingLimitResponse to the Charging Station.

  6. If the charging rate changes by more than: LimitChangeSignificance, the Charging Station sends a TransactionEventRequest message to inform the CSMS.

  7. The CSMS responds with TransactionEventResponse to the Charging Station.

Functional Requirements

  • K11.FR.01: When an external charging limit/schedule is received during an ongoing transaction, the Charging Station SHALL NOT charge the ongoing transaction faster than this given limit/schedule.

  • K11.FR.02: When K11.FR.01 AND Charging limit changed by more than: LimitChangeSignificance, The Charging Station SHALL inform the CSMS of the new charging limit/schedule imposed by the external system by sending a NotifyChargingLimitRequest.

  • K11.FR.03: When K11.FR.02 AND EnableNotifyCharging LimitWithSchedules is true, The NotifyChargingLimitRequest SHALL contain the charging limits/schedules as set by the external system.

  • K11.FR.04: When K11.FR.01 AND Charging rate changed by more than: LimitChangeSignificance, the Charging Station SHALL send a TransactionEventRequest message to the CSMS with trigger = ChargingRateChanged

  • K11.FR.05: When K11.FR.02, the Charging Station SHALL NOT set the 'chargingLimitSource' to CSO in the 'NotifyChargingLimitRequest'.

  • K11.FR.06: When an external charging limit/schedule is received, the Charging Station SHALL use purpose ChargingStationExternalConstraints when reporting about this limit (e.g. in a ReportChargingProfilesRequest).

    • It is RECOMMENDED to use negative values for the id of a ChargingStationExternalConstraints profile, to minimize the risk of a clash with an id that CSMS might use for a (future) charging profile.

Use Case L03: Publish Firmware file on Local Controller

Not really a charging station use case. As soon as we start implementing a satelite style architecture, where the satelites also talk OCPP directly via the central node, we should implement this for optimizing updating the firmware in the satelites.

Use Case K09: Get Charging Profiles

Scenario

  1. The CSMS asks the Charging Station for the installed charging profiles by sending a
    GetChargingProfilesRequest message.
  2. The Charging Station responds, indicating if it can report Charging Schedules by sending a
    GetChargingProfilesResponse message.
  3. Charging Station sends a number of ReportChargingProfilesRequest messages to CSMS.
  4. The CSMS acknowledges reception of the reports by sending a
    ReportChargingProfilesResponse to the Charging Station for every
    ReportChargingProfilesRequest.

Functional Requirements

  • K09.FR.01: When requestId is set in the GetChargingProfilesRequest, the Charging Station SHALL set the requestId in every ReportChargingProfilesRequest that is sent as a result of this GetChargingProfilesRequest.
  • K09.FR.02: When the charging profiles are reported in more than one ReportChargingProfilesRequest, the Charging Station SHALL set the tbc flag to true for all ReportChargingProfilesRequest messages except the last.
  • K09.FR.04: If evseId is set to a value greater than 0 in the GetChargingProfilesRequest, the Charging Station SHALL report the installed charging profiles for the specified EVSE that match all fields in chargingProfile.
  • K09.FR.05: If evseId is set to 0 in GetChargingProfilesRequest, the Charging Station SHALL only report charging profiles installed on the Charging Station itself (the grid connection) that match all fields in chargingProfile.
    • EVSE #0 can have a ChargingStation MaxProfile, ChargingStation ExternalConstraints or a TxDefaultProfile. Note, that a TxDefaultProfile is not applied to EVSE #0 but to all individual EVSEs (see K01.FR.14).
  • K09.FR.06: If evseId is NOT set in the GetChargingProfilesRequest, the Charging Station SHALL report all installed charging profiles that match all fields in chargingProfile.
  • Table 175, No. 7: When the Charging Station has no charging profiles that match the parameters in the GetChargingProfilesRequest the Charging Station SHALL respond with: NoProfiles.

Switch networkconnectionprofile with 2 profiles and priority set to 2 only.

I created two networkconnectionprofiles, but the setting 'networkconfigurationpriority' is set to 2 only. When networkconnectionprofile 2 can not connect, the application crashes:

(websocket_plain:252)  [info    ] [libocpp]  Closing plain websocket.
(websocket_plain:259)  [error   ] [libocpp]  Error initiating close of plain websocket: invalid state
(charge_point.cp:719)  [warning ] [libocpp]  Closed websocket of NetworkConfigurationPriority: 1 which is configurationSlot: 2
(charge_point.cp:822)  [info    ] [libocpp]  Switching to next network configuration priority
terminate called after throwing an instance of 'std::out_of_range'
what():  vector::_M_range_check: __n (which is 1) >= this->size() (which is 1)
[email protected]: Main process exited, code=killed, status=6/ABRT
[email protected]: Failed with result 'signal'.

Use case B08: Get custom report

To give the CSMS the ability to request a report of all Components and Variables limited to those
that match ComponentCriteria and/or the list of ComponentVariables.

Use Case L04: Unpublish Firmware file on Local Controller

Not really a charging station use case. As soon as we start implementing a satelite style architecture, where the satelites also talk OCPP directly via the central node, we should implement this for optimizing updating the firmware in the satelites.

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.