I'm developing central system sofware for managing EV charging stations in Node.js. I am using ocpp-js library. After creating virtual charging point, i make request as
chargingPoint.heartbeat();
and after this request, virtual charge point send to draft central system. message in xml format within logs is written below.
[ChargingPoint] Creating Client for Central System Service
[2022-07-18 16:01:34] [info] "Handling POST on /Ocpp/CentralSystemService"
[2022-07-18 16:01:34] [received] "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\">\n <soap:Header>\n <h:chargeBoxIdentity xmlns:h=\"urn://Ocpp/Cp/2012/06/\">Simulator 1</h:chargeBoxIdentity>\n <a:MessageID>urn:uuid:97fda734-4a3c-4d6e-a7e6-b4d4c9936aae</a:MessageID>\n <a:From>\n <a:Address>http://localhost:9221/Ocpp/ChargePointService</a:Address>\n </a:From>\n <a:ReplyTo>\n <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>\n </a:ReplyTo>\n <a:To>http://localhost:9220/Ocpp/CentralSystemService</a:To>\n <a:Action soap:mustUnderstand=\"1\">/Heartbeat</a:Action>\n </soap:Header>\n <soap:Body>\n <ns1:heartbeatRequest xmlns:ns1=\"urn://Ocpp/Cs/2012/06/\"/>\n </soap:Body>\n</soap:Envelope>"
[2022-07-18 16:01:34] [info] "Attempting to bind to /Ocpp/CentralSystemService"
[2022-07-18 16:01:34] [info] "Trying CentralSystemServiceSoap12 from path /Ocpp/CentralSystemService"
XML content is:
<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>
<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\"><soap:Header>
<h:chargeBoxIdentity xmlns:h=\"urn://Ocpp/Cp/2012/06/\">Simulator 1</h:chargeBoxIdentity> <a:MessageID>urn:uuid:97fda734-4a3c-4d6e-a7e6-b4d4c9936aae</a:MessageID> <a:From> <a:Address>http://localhost:9221/Ocpp/ChargePointService</a:Address></a:From>
<a:ReplyTo> <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>\n </a:ReplyTo> <a:To>http://localhost:9220/Ocpp/CentralSystemService</a:To> <a:Action soap:mustUnderstand=\"1\">/Heartbeat</a:Action>
</soap:Header>
<soap:Body>
<ns1:heartbeatRequest xmlns:ns1=\"urn://Ocpp/Cs/2012/06/\"/> </soap:Body>\n</soap:Envelope>
and full code is written below:
app.js
var OCPP = require('ocpp-js');
var express = require('express');
var app = express();
var options = {
centralSystem: {
port: 9220
},
chargingPoint: {
serverURI: 'http://localhost:9221/Ocpp/ChargePointService',
name: 'Simulator 1'
},
chargingPointServer: {
port: 9221
}
}
var ocppJS = new OCPP(options);
// Create Central System
var centralSystem = ocppJS.createCentralSystem();
// Create Charging Point Client
var chargingPoint1 = ocppJS.createChargingPoint('http://127.0.0.1:8081/ChargeBox/Ocpp', "chargingPoint1-Simulator");
//var chargingPoint2 = ocppJS.createChargingPoint('http://localhost:9221/Ocpp/ChargePointService', "chargingPoint2-Simulator");
// Charging Point Params can be also taken from options
//var chargingPoint1 = ocppJS.createChargingPoint();
// Create Charging Point Server
//var chargingPointServer = ocppJS.createChargingPointServer(9221);
//centralSystem.createChargeBoxClient(chargingPoint1);
centralSystem.clients.push(chargingPoint1);
console.log(centralSystem);
app.get('/', (req, res, next) => {
chargingPoint1.heartbeat();
});
app.get('/bootNot', (req, res, next) => {
res.json(chargingPoint1.bootNotification({req: "BootNotification"}));
});
app.get('/meterVal', (req, res, next) => {
chargingPoint1.meterValues({meterValueRequest: "REQ"});
});
app.get('/getId', (req, res, next) => {
res.json(chargingPoint1.getId());
});
app.listen(5000, (req, res, next) => {
console.log("App is listening");
});
I have a few quesions:
My first question is about completion of mission: according to logs has the heartbeat request completed successfully or not?
My last question is that if i create a SOAP server and sending request to soap clients (EV Charging units) with OCPP1.5 compliant data (maybe i'll use my own lib instead of occp-js), my created server can be accepted as an OCPP server?