Introduction
Upon instantiation, the driver creates a basic Central System Server to which Charge Points can connect. Then, it is required to set up Channels for the request types to be implemented.
The OCPP protocol exchanges can basically be divided in:
- Requests from Central System → towards Charge Point
- Requests from Charge Point → towards Central System
Depending on the type of a request specified in the request.type parameter, a different Channel configuration is required.
Central System → Charge Point
This type of requests are mapped in the driver as a single read or write channel operation. As soon as a channel is read/written, the driver sends the OCPP Request to the Charge Point specified in the channel itself (if connected), and waits for a Confirmation from that Charge Point. The result of the operation is then made available in the Channel status.
Read requests
The following OCPP request types must be mapped in a READ channel. It is also required to set the request.json parameter, to be the JSON representation of the corresponding standard OCPP request message. At the end of the channel read, the value will be the Confirmation response in JSON format.
GET_CONFIGURATIONexample json:{ "key": [ "...", "..." ] }GET_DIAGNOSTICSexample json:{ "location": "/upload/path" }GET_LOCAL_LIST_VERSIONexample json:{ }(this request does not include any parameter)GET_COMPOSITE_SCHEDULEexample json:{ "connectorId": 1, "duration": 60 }
Write requests
The following OCPP request types must be mapped in a WRITE channel. At the end of the channel write, the status of the operation is mapped depending on the resulting Confirmation status.
CHANGE_AVAILABILITYSuccess if confirmation status =Accepted,ScheduledCHANGE_CONFIGURATIONSuccess if confirmation status =Accepted,RebootRequiredCLEAR_CACHESuccess if confirmation status =AcceptedDATA_TRANSFER_REQSuccess if confirmation status =AcceptedRESETSuccess if confirmation status =AcceptedREMOTE_START_TRANSACTIONSuccess if confirmation status =AcceptedREMOTE_STOP_TRANSACTIONSuccess if confirmation status =AcceptedUNLOCK_CONNECTORSuccess if confirmation status =UnlockedUPDATE_FIRMWARESuccess if confirmation arrivesSEND_LOCAL_LISTSuccess if confirmation status =AcceptedCANCEL_RESERVATIONSuccess if confirmation status =AcceptedRESERVE_NOWSuccess if confirmation status =AcceptedCLEAR_CHARGING_PROFILESuccess if confirmation status =AcceptedSET_CHARGING_PROFILESuccess if confirmation status =AcceptedTRIGGER_MESSAGESuccess if confirmation status =Accepted
Charge Point → Central System
This type of requests are handled by the driver in two different channel events.
- Reception of a request (through a listen channel)
- Sending of the Confirmation (through a channel write)
The Request from a Charge Point is first received by the channel which is configured in listen mode with one of the following request types:
AUTHORIZEBOOT_NOTIFICATIONSTART_TRANSACTIONSTOP_TRANSACTIONDATA_TRANSFER_CONFSTATUS_NOTIFICATIONHEARTBEATMETER_VALUESDIAGNOSTICS_STATUS_NOTIFICATIONFIRMWARE_STATUS_NOTIFICATION
The OCPP Request is then wrapped in a OcppDriverRequest object containing an arbitrary ID of the request just received (requestId). Example JSON:
/* OcppDriverRequest */
{
"requestId": "1c08e3ce-1273-11ed-861d-0242ac120002",
"chargePointId": "/CP1",
"requestType": "AUTHORIZE", /* as above */
"request": /* object representing the Standard OCPP Request */
}
Such object is then emitted out of the Asset. At this point, it is required to implement an external system that can process this request and generate a corresponding OCPP Confirmation. Once generated, the OCPP Confirmation must be wrapped in a OcppDriverResponse object containing the corresponding requestId:
/* OcppDriverResponse */
{
"requestId": "1c08e3ce-1273-11ed-861d-0242ac120002",
"confirmation": /* object representing the Standard OCPP Confirmation */
}
This response must be written to a channel with the corresponding request type and charge point ID (for simplicity, the listen channel and WRITE channel could even be the same).
In summary:
- The driver receives an OCPP Request from a Charge Point through a
listenchannel; - This request is wrapped in a
OcppDriverRequestobject and emitted out; - The
OcppDriverRequestshould be sent to an external system that is able to process it; - The external system produces a
OcppDriverResponse; - The
OcppDriverResponseis received from the external system, and written to the corresponding channel; - The OCPP Confirmation is sent back to the Charge Point.