Frequently Asked Question

OCPP protocol in SCADA
Last Updated 9 months ago

OCPP stands for Open Charge Point Protocol. It is a standardized communication protocol used in the electric vehicle charging infrastructure industry. OCPP provides a common language for communication between charging stations and central management systems or charging network operators.

This feature is implemented in the Typhoon HIL Control Center 2023.3 and is available to use in the SCADA application as a Python library. The library is open source and can be accessed from https://github.com/mobilityhouse/ocpp.

A wrapper python script was developed in order to make it easier for users to start using it. The python code in attached in this article and is detailed explained below. In this, it is simulated a central system with OCPP Server side, to control and test chargers also running with OCPP protocol.

The provided Python code sets up an OCPP (Open Charge Point Protocol) server using websockets to communicate with electric vehicle (EV) charging stations. The server receives messages from connected charge points, processes them, and responds accordingly. Below is a breakdown of the main components and functionalities of the code:

  1. Importing required modules: The code imports various modules necessary for its functionality, such as signal, asyncio, queue, logging, websockets, and several classes and enums from the ocpp package.
  2. Global Variables: The code defines several global variables, including ocpp_info, sendCommand, loop, ocppCommandQueue, ocppResponseQueue, and charge_point_vendor, charge_point_model.
  3. Custom Charge Point Class: The code defines a custom charge point class called MyChargePoint, which inherits from ChargePoint class provided by the ocpp package. This class implements various OCPP actions like BootNotification, Heartbeat, StatusNotification, Authorize, DataTransfer, MeterValues, StartTransaction, and StopTransaction. Each method within this class is decorated with the @on(Action.ActionName) decorator to specify the action it handles.
  4. Helper Functions: The code defines several helper functions like get_connected_charge_points, get_charge_points_status, call_get_device_configuration, wait_get_device_configuration, etc. These functions handle various tasks like getting connected charge points, getting charge point status, calling OCPP commands, and waiting for their responses.
  5. Websocket Server Setup: The main function sets up a websocket server to listen for incoming connections from charge points. When a new charge point connects or an existing charge point reconnects, the on_connect coroutine is called.
  6. Server Loop: The server handles multiple charge points concurrently using asyncio. Each charge point runs in its own coroutine (cp_start), and the main server loop awaits connections from new charge points while managing the send/receive commands using the sendCommands coroutine.
  7. main Function: The main function sets up the websocket server on IP address 0.0.0.0 and port 5000. It also registers signal handlers for graceful shutdown.

In the SCADA panel, the main macro widget called occp tests execute the main loop asynchronously, making it the entry point of the program.

Overall, this code serves as an OCPP server capable of communicating with multiple electric vehicle charging stations concurrently and handling various OCPP actions initiated by these stations.


Please Wait!

Please wait... it will take a second!