Allow to specify a hardcoded value for metervalues in template.
authorJérôme Benoit <jerome.benoit@sap.com>
Tue, 20 Oct 2020 17:51:51 +0000 (19:51 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Tue, 20 Oct 2020 17:51:51 +0000 (19:51 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/assets/station-templates/evlink.station-template.json
src/assets/station-templates/schneider-imredd.station-template.json
src/assets/station-templates/schneider.station-template.json
src/assets/station-templates/siemens.station-template.json [moved from src/assets/station-templates/siemens.mougins69.station-template.json with 95% similarity]
src/charging-station/ChargingStation.js

index 1efb99f6879e91c45d00ffb246d2bff3f3d49cad..3acbbfb40deb334997be820f7ccfa1ca6247c4d8 100644 (file)
@@ -1,8 +1,8 @@
 {
   "authorizationFile": "./src/assets/authorization-tags.json",
   "baseName": "CS-EVLINK",
-  "chargePointModel": "EVLINKXX213",
-  "chargePointVendor": "SCHNEIDER",
+  "chargePointModel": "MONOBLOCK",
+  "chargePointVendor": "Schneider Electric",
   "chargePointSerialNumberPrefix": "EV.2S7P04",
   "firmwareVersion": "3.3.0.10",
   "power": 7360,
index 1660e4a4cdf4b5584f90881d2c90af8db834418c..f383008e35c3e9f577757f4ebfa15c1d24848ea4 100644 (file)
@@ -1,8 +1,8 @@
 {
   "authorizationFile": "./src/assets/authorization-tags.json",
   "baseName": "CS-SCHNEIDER",
-  "chargePointModel": "SCHNEIDERXX213",
-  "chargePointVendor": "SCHNEIDER",
+  "chargePointModel": "MONOBLOCK",
+  "chargePointVendor": "Schneider Electric",
   "power": 44160,
   "powerUnit": "W",
   "numberOfConnectors": 2,
index 54a71498728075fc14985ba439d4adf0aea9be5a..225ce0e734793f8d36dbf6a2dc3da265f2a40e20 100644 (file)
@@ -1,8 +1,8 @@
 {
   "authorizationFile": "./src/assets/authorization-tags.json",
   "baseName": "CS-SCHNEIDER",
-  "chargePointModel": "SCHNEIDERXX213",
-  "chargePointVendor": "SCHNEIDER",
+  "chargePointModel": "MONOBLOCK",
+  "chargePointVendor": "Schneider Electric",
   "chargePointSerialNumberPrefix": "EV.2S22P44",
   "power": 44160,
   "powerUnit": "W",
similarity index 95%
rename from src/assets/station-templates/siemens.mougins69.station-template.json
rename to src/assets/station-templates/siemens.station-template.json
index 206526adc84eb5f5dd994a1484d5c92a3d1349c5..e362505ee18ba9cd9117015dbdf586f0fa6547f2 100644 (file)
@@ -1,8 +1,8 @@
 {
   "authorizationFile": "./src/assets/authorization-tags.json",
-  "baseName": "SAP-Mougins-69",
+  "baseName": "CS-SIEMENS",
   "fixedName": true,
-  "chargePointModel": "SiemensXX213",
+  "chargePointModel": "SIEMENSXX213",
   "chargePointVendor": "SIEMENS",
   "power": 44160,
   "powerUnit": "W",
index cb0cf3a5dd4bb62cb3e41a65eff663fb8cc5fc6f..34cd53d521d84bcee2e4f823a1524343de58ee09 100644 (file)
@@ -548,25 +548,29 @@ class ChargingStation {
         const connector = self._connectors[connectorID];
         // SoC measurand
         if (sampledValueLcl.sampledValue[index].measurand && sampledValueLcl.sampledValue[index].measurand === 'SoC') {
-          sampledValueLcl.sampledValue[index].value = Utils.getRandomInt(100);
+          sampledValueLcl.sampledValue[index].value = sampledValueLcl.sampledValue[index].value ?
+            sampledValueLcl.sampledValue[index].value :
+            sampledValueLcl.sampledValue[index].value = Utils.getRandomInt(100);
           if (sampledValueLcl.sampledValue[index].value > 100 || debug) {
             logger.error(`${self._basicFormatLog()} MeterValues measurand ${sampledValueLcl.sampledValue[index].measurand ? sampledValueLcl.sampledValue[index].measurand : 'Energy.Active.Import.Register'}: connectorID ${connectorID}, transaction ${connector.transactionId}, value: ${sampledValueLcl.sampledValue[index].value}`);
           }
         // Voltage measurand
         } else if (sampledValueLcl.sampledValue[index].measurand && sampledValueLcl.sampledValue[index].measurand === 'Voltage') {
-          sampledValueLcl.sampledValue[index].value = 230;
+          sampledValueLcl.sampledValue[index].value = sampledValueLcl.sampledValue[index].value ? sampledValueLcl.sampledValue[index].value : 230;
         // Energy.Active.Import.Register measurand (default)
         } else if (!sampledValueLcl.sampledValue[index].measurand || sampledValueLcl.sampledValue[index].measurand === 'Energy.Active.Import.Register') {
-          // Persist previous value in connector
-          const consumption = Utils.getRandomInt(self._stationInfo.maxPower / 3600000 * interval);
-          if (connector && connector.lastConsumptionValue >= 0) {
-            connector.lastConsumptionValue += consumption;
-          } else {
-            connector.lastConsumptionValue = 0;
+          if (!sampledValueLcl.sampledValue[index].value) {
+            const measurandValue = Utils.getRandomInt(self._stationInfo.maxPower / 3600000 * interval);
+            // Persist previous value in connector
+            if (connector && connector.lastEnergyActiveImportRegisterValue >= 0) {
+              connector.lastEnergyActiveImportRegisterValue += measurandValue;
+            } else {
+              connector.lastEnergyActiveImportRegisterValue = 0;
+            }
+            sampledValueLcl.sampledValue[index].value = connector.lastEnergyActiveImportRegisterValue;
           }
+          logger.info(`${self._basicFormatLog()} MeterValues measurand ${sampledValueLcl.sampledValue[index].measurand ? sampledValueLcl.sampledValue[index].measurand : 'Energy.Active.Import.Register'}: connectorID ${connectorID}, transaction ${connector.transactionId}, value ${sampledValueLcl.sampledValue[index].value}`);
           const maxConsumption = self._stationInfo.maxPower * 3600 / interval;
-          logger.info(`${self._basicFormatLog()} MeterValues measurand ${sampledValueLcl.sampledValue[index].measurand ? sampledValueLcl.sampledValue[index].measurand : 'Energy.Active.Import.Register'}: connectorID ${connectorID}, transaction ${connector.transactionId}, value ${connector.lastConsumptionValue}`);
-          sampledValueLcl.sampledValue[index].value = connector.lastConsumptionValue;
           if (sampledValueLcl.sampledValue[index].value > maxConsumption || debug) {
             logger.error(`${self._basicFormatLog()} MeterValues measurand ${sampledValueLcl.sampledValue[index].measurand ? sampledValueLcl.sampledValue[index].measurand : 'Energy.Active.Import.Register'}: connectorID ${connectorID}, transaction ${connector.transactionId}, value: ${sampledValueLcl.sampledValue[index].value}/${maxConsumption}`);
           }
@@ -684,7 +688,7 @@ class ChargingStation {
     this._connectors[connectorID].transactionStarted = false;
     this._connectors[connectorID].transactionId = null;
     this._connectors[connectorID].idTag = null;
-    this._connectors[connectorID].lastConsumptionValue = -1;
+    this._connectors[connectorID].lastEnergyActiveImportRegisterValue = -1;
   }
 
   _resetTransactionOnConnector(connectorID) {
@@ -715,7 +719,7 @@ class ChargingStation {
       this._connectors[transactionConnectorId].transactionStarted = true;
       this._connectors[transactionConnectorId].transactionId = payload.transactionId;
       this._connectors[transactionConnectorId].idTag = requestPayload.idTag;
-      this._connectors[transactionConnectorId].lastConsumptionValue = 0;
+      this._connectors[transactionConnectorId].lastEnergyActiveImportRegisterValue = 0;
       this.sendStatusNotification(requestPayload.connectorId, 'Charging');
       logger.info(this._basicFormatLog() + ' Transaction ' + payload.transactionId + ' STARTED on ' + this._stationInfo.name + '#' + requestPayload.connectorId + ' for idTag ' + requestPayload.idTag);
       const configuredMeterValueSampleInterval = this._getConfigurationKey('MeterValueSampleInterval');