README.md: add more documentation for cs template
authorJérôme Benoit <jerome.benoit@sap.com>
Thu, 6 May 2021 18:21:18 +0000 (20:21 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Thu, 6 May 2021 18:21:18 +0000 (20:21 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
README.md
src/assets/station-templates/abb-atg.station-template.json
src/assets/station-templates/abb.station-template.json
src/assets/station-templates/virtual-simple-atg.station-template.json
src/assets/station-templates/virtual-simple.station-template.json
src/assets/station-templates/virtual.station-template.json
src/charging-station/ChargingStation.ts
src/charging-station/ocpp/1.6/OCPP16RequestService.ts
src/types/ChargingStationTemplate.ts

index 0813c836a430ebb064cbe7dfb50938d784759546..e63f32f6b4b5f08a9c1dbb371d99e9f49bc21730 100644 (file)
--- a/README.md
+++ b/README.md
@@ -58,6 +58,18 @@ firmwareVersion | | '' | string | charging stations firmware version
 power | | | integer\|integer[] | charging stations maximum power value(s)
 powerSharedByConnectors | true/false | false | boolean | charging stations power shared by its connectors
 powerUnit | W/kW | W | string | charging stations power unit
+currentOutType | AC/DC | AC | string | charging stations current out type
+numberOfPhases | 1/3 | AC:3/DC:0 | integer | charging stations number of phase(s) 
+numberOfConnectors | | | integer\|integer[] | charging stations number of connector(s)
+useConnectorId0 | true/false | true | boolean | use connector id 0 definition from the template
+randomConnectors | true/false | false | boolean | randomize the connector id
+resetTime | | 60 | integer | seconds to wait before the charging stations come back at reset
+connectionTimeout | | 30 | integer | connection timeout to the OCPP-J server
+autoReconnectMaxRetries | | -1 (unlimited) | integer | connection retries to the OCPP-J server
+reconnectExponentialDelay | true/false | false | boolean | connection delay retry to the OCPP-J server
+registrationMaxRetries | | -1 (unlimited) | boolean | charging stations boot notification retries
+enableStatistics | true/false | true | boolean | enable charging stations statistics   
+voltageOut | | AC:230/DC:400 | number | charging stations voltage out 
 
 ## License
 
index 316f8b3eac6df74351d7e31d12e80d496361ff08..b11a543f83c3fa9b7f170efe54a3b08856876809 100644 (file)
@@ -8,7 +8,7 @@
   "power": 50000,
   "powerSharedByConnectors": true,
   "powerUnit": "W",
-  "powerOutType": "DC",
+  "currentOutType": "DC",
   "useConnectorId0": true,
   "randomConnectors": false,
   "resetTime": 60,
index 3f743f966537f473db87b9c88af59c2be4d6a9a5..0ba61ec62ed46db772e8aa14c5979f516dcb1bbd 100644 (file)
@@ -7,7 +7,7 @@
   "power": 50000,
   "powerSharedByConnectors": true,
   "powerUnit": "W",
-  "powerOutType": "DC",
+  "currentOutType": "DC",
   "numberOfConnectors": 2,
   "useConnectorId0": true,
   "randomConnectors": false,
index 0da43ac6de86c80489071b3ffdf84ab3a4dba53a..a695e2bd999c051fe679a5988226d9fd8acaed76 100644 (file)
@@ -6,7 +6,7 @@
   "power": 75000,
   "powerUnit": "W",
   "powerSharedByConnectors": true,
-  "powerOutType": "DC",
+  "currentOutType": "DC",
   "numberOfConnectors": 3,
   "randomConnectors": false,
   "Configuration": {
index f251d2c4b73448881ae608d879a9cfc8d4d92d06..4af1ab1da97eb4ba46ae0aeb0d8f7aa397a0fec0 100644 (file)
@@ -6,7 +6,7 @@
   "power": 50000,
   "powerUnit": "W",
   "powerSharedByConnectors": true,
-  "powerOutType": "DC",
+  "currentOutType": "DC",
   "numberOfConnectors": 3,
   "randomConnectors": false,
   "Configuration": {
index 8cb63eb6967684086bfba8e6cb5a034efd37c748..0a713610b6ab0e60d9ccadfa018fe55f91c11f28 100644 (file)
@@ -6,7 +6,7 @@
   "power": 50000,
   "powerUnit": "W",
   "powerSharedByConnectors": true,
-  "powerOutType": "DC",
+  "currentOutType": "DC",
   "numberOfConnectors": 9,
   "randomConnectors": false,
   "Configuration": {
index a5e31588f0e3eb38f324888fcf05a423d8840b27..d1745f75529cf8868d7d7f62fcb46851162849ba 100644 (file)
@@ -1,6 +1,6 @@
 import { BootNotificationResponse, RegistrationStatus } from '../types/ocpp/Responses';
 import ChargingStationConfiguration, { ConfigurationKey } from '../types/ChargingStationConfiguration';
-import ChargingStationTemplate, { PowerOutType, VoltageOut } from '../types/ChargingStationTemplate';
+import ChargingStationTemplate, { CurrentOutType, VoltageOut } from '../types/ChargingStationTemplate';
 import Connectors, { Connector } from '../types/Connectors';
 import { PerformanceObserver, performance } from 'perf_hooks';
 import Requests, { AvailabilityType, BootNotificationRequest, IncomingRequest, IncomingRequestCommand } from '../types/ocpp/Requests';
@@ -91,10 +91,10 @@ export default class ChargingStation {
   }
 
   public getNumberOfPhases(): number {
-    switch (this.getPowerOutType()) {
-      case PowerOutType.AC:
+    switch (this.getCurrentOutType()) {
+      case CurrentOutType.AC:
         return !Utils.isUndefined(this.stationInfo.numberOfPhases) ? this.stationInfo.numberOfPhases : 3;
-      case PowerOutType.DC:
+      case CurrentOutType.DC:
         return 0;
     }
   }
@@ -119,18 +119,18 @@ export default class ChargingStation {
     return this.connectors[id];
   }
 
-  public getPowerOutType(): PowerOutType {
-    return !Utils.isUndefined(this.stationInfo.powerOutType) ? this.stationInfo.powerOutType : PowerOutType.AC;
+  public getCurrentOutType(): CurrentOutType {
+    return !Utils.isUndefined(this.stationInfo.currentOutType) ? this.stationInfo.currentOutType : CurrentOutType.AC;
   }
 
   public getVoltageOut(): number {
-    const errMsg = `${this.logPrefix()} Unknown ${this.getPowerOutType()} powerOutType in template file ${this.stationTemplateFile}, cannot define default voltage out`;
+    const errMsg = `${this.logPrefix()} Unknown ${this.getCurrentOutType()} currentOutType in template file ${this.stationTemplateFile}, cannot define default voltage out`;
     let defaultVoltageOut: number;
-    switch (this.getPowerOutType()) {
-      case PowerOutType.AC:
+    switch (this.getCurrentOutType()) {
+      case CurrentOutType.AC:
         defaultVoltageOut = VoltageOut.VOLTAGE_230;
         break;
-      case PowerOutType.DC:
+      case CurrentOutType.DC:
         defaultVoltageOut = VoltageOut.VOLTAGE_400;
         break;
       default:
index 96502b3cc9b81b9a7082fabd63cee87478ae0727..fe9d27f0f6d96a54a152fbe4efb6dfb93a05710a 100644 (file)
@@ -4,6 +4,7 @@ import { MeterValue, MeterValueLocation, MeterValuePhase, MeterValueUnit, MeterV
 
 import { ACElectricUtils } from '../../../utils/ElectricUtils';
 import Constants from '../../../utils/Constants';
+import { CurrentOutType } from '../../../types/ChargingStationTemplate';
 import MeasurandValues from '../../../types/MeasurandValues';
 import { MessageType } from '../../../types/ocpp/MessageType';
 import { OCPP16BootNotificationResponse } from '../../../types/ocpp/1.6/Responses';
@@ -12,7 +13,6 @@ import { OCPP16ChargePointStatus } from '../../../types/ocpp/1.6/ChargePointStat
 import { OCPP16StandardParametersKey } from '../../../types/ocpp/1.6/Configuration';
 import OCPPError from '../../OcppError';
 import OCPPRequestService from '../OCPPRequestService';
-import { PowerOutType } from '../../../types/ChargingStationTemplate';
 import Utils from '../../../utils/Utils';
 import logger from '../../../utils/Logger';
 
@@ -161,12 +161,12 @@ export default class OCPP16RequestService extends OCPPRequestService {
             logger.error(errMsg);
             throw Error(errMsg);
           }
-          const errMsg = `${self.chargingStation.logPrefix()} MeterValues measurand ${meterValuesTemplate[index].measurand ? meterValuesTemplate[index].measurand : OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER}: Unknown ${self.chargingStation.getPowerOutType()} powerOutType in template file ${self.chargingStation.stationTemplateFile}, cannot calculate ${meterValuesTemplate[index].measurand ? meterValuesTemplate[index].measurand : OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER} measurand value`;
+          const errMsg = `${self.chargingStation.logPrefix()} MeterValues measurand ${meterValuesTemplate[index].measurand ? meterValuesTemplate[index].measurand : OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER}: Unknown ${self.chargingStation.getCurrentOutType()} currentOutType in template file ${self.chargingStation.stationTemplateFile}, cannot calculate ${meterValuesTemplate[index].measurand ? meterValuesTemplate[index].measurand : OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER} measurand value`;
           const powerMeasurandValues = {} as MeasurandValues;
           const maxPower = Math.round(self.chargingStation.stationInfo.maxPower / self.chargingStation.stationInfo.powerDivider);
           const maxPowerPerPhase = Math.round((self.chargingStation.stationInfo.maxPower / self.chargingStation.stationInfo.powerDivider) / self.chargingStation.getNumberOfPhases());
-          switch (self.chargingStation.getPowerOutType()) {
-            case PowerOutType.AC:
+          switch (self.chargingStation.getCurrentOutType()) {
+            case CurrentOutType.AC:
               if (Utils.isUndefined(meterValuesTemplate[index].value)) {
                 powerMeasurandValues.L1 = Utils.getRandomFloatRounded(maxPowerPerPhase);
                 powerMeasurandValues.L2 = 0;
@@ -178,7 +178,7 @@ export default class OCPP16RequestService extends OCPPRequestService {
                 powerMeasurandValues.allPhases = Utils.roundTo(powerMeasurandValues.L1 + powerMeasurandValues.L2 + powerMeasurandValues.L3, 2);
               }
               break;
-            case PowerOutType.DC:
+            case CurrentOutType.DC:
               if (Utils.isUndefined(meterValuesTemplate[index].value)) {
                 powerMeasurandValues.allPhases = Utils.getRandomFloatRounded(maxPower);
               }
@@ -221,11 +221,11 @@ export default class OCPP16RequestService extends OCPPRequestService {
             logger.error(errMsg);
             throw Error(errMsg);
           }
-          const errMsg = `${self.chargingStation.logPrefix()} MeterValues measurand ${meterValuesTemplate[index].measurand ? meterValuesTemplate[index].measurand : OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER}: Unknown ${self.chargingStation.getPowerOutType()} powerOutType in template file ${self.chargingStation.stationTemplateFile}, cannot calculate ${meterValuesTemplate[index].measurand ? meterValuesTemplate[index].measurand : OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER} measurand value`;
+          const errMsg = `${self.chargingStation.logPrefix()} MeterValues measurand ${meterValuesTemplate[index].measurand ? meterValuesTemplate[index].measurand : OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER}: Unknown ${self.chargingStation.getCurrentOutType()} currentOutType in template file ${self.chargingStation.stationTemplateFile}, cannot calculate ${meterValuesTemplate[index].measurand ? meterValuesTemplate[index].measurand : OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER} measurand value`;
           const currentMeasurandValues: MeasurandValues = {} as MeasurandValues;
           let maxAmperage: number;
-          switch (self.chargingStation.getPowerOutType()) {
-            case PowerOutType.AC:
+          switch (self.chargingStation.getCurrentOutType()) {
+            case CurrentOutType.AC:
               maxAmperage = ACElectricUtils.amperagePerPhaseFromPower(self.chargingStation.getNumberOfPhases(), self.chargingStation.stationInfo.maxPower / self.chargingStation.stationInfo.powerDivider, self.chargingStation.getVoltageOut());
               if (Utils.isUndefined(meterValuesTemplate[index].value)) {
                 currentMeasurandValues.L1 = Utils.getRandomFloatRounded(maxAmperage);
@@ -238,7 +238,7 @@ export default class OCPP16RequestService extends OCPPRequestService {
                 currentMeasurandValues.allPhases = Utils.roundTo((currentMeasurandValues.L1 + currentMeasurandValues.L2 + currentMeasurandValues.L3) / self.chargingStation.getNumberOfPhases(), 2);
               }
               break;
-            case PowerOutType.DC:
+            case CurrentOutType.DC:
               maxAmperage = ACElectricUtils.amperageTotalFromPower(self.chargingStation.stationInfo.maxPower / self.chargingStation.stationInfo.powerDivider, self.chargingStation.getVoltageOut());
               if (Utils.isUndefined(meterValuesTemplate[index].value)) {
                 currentMeasurandValues.allPhases = Utils.getRandomFloatRounded(maxAmperage);
index a11f6aa045379df70fe7d2a5704002ca4f429734..44aea77fcaadd3aa67dc256c0c8c32195dc45fc2 100644 (file)
@@ -3,7 +3,7 @@ import Connectors from './Connectors';
 import { OCPPProtocol } from './ocpp/OCPPProtocol';
 import { OCPPVersion } from './ocpp/OCPPVersion';
 
-export enum PowerOutType {
+export enum CurrentOutType {
   AC = 'AC',
   DC = 'DC',
 }
@@ -46,7 +46,7 @@ export default interface ChargingStationTemplate {
   power: number | number[];
   powerSharedByConnectors?: boolean;
   powerUnit: PowerUnits;
-  powerOutType?: PowerOutType;
+  currentOutType?: CurrentOutType;
   numberOfPhases?: number;
   numberOfConnectors?: number | number[];
   useConnectorId0?: boolean;