+ this.connectorsStatus.get(connectorId).skippedConsecutiveTransactions++;
+ this.connectorsStatus.get(connectorId).skippedTransactions++;
+ logger.info(
+ `${this.logPrefix(connectorId)} skipped consecutively ${this.connectorsStatus
+ .get(connectorId)
+ ?.skippedConsecutiveTransactions?.toString()}/${this.connectorsStatus
+ .get(connectorId)
+ ?.skippedTransactions?.toString()} transaction(s)`
+ );
+ }
+ this.connectorsStatus.get(connectorId).lastRunDate = new Date();
+ }
+ this.connectorsStatus.get(connectorId).stoppedDate = new Date();
+ logger.info(
+ `${this.logPrefix(
+ connectorId
+ )} stopped on connector and lasted for ${Utils.formatDurationMilliSeconds(
+ this.connectorsStatus.get(connectorId).stoppedDate.getTime() -
+ this.connectorsStatus.get(connectorId).startDate.getTime()
+ )}`
+ );
+ logger.debug(
+ `${this.logPrefix(connectorId)} connector status: %j`,
+ this.connectorsStatus.get(connectorId)
+ );
+ }
+
+ private setStartConnectorStatus(connectorId: number): void {
+ this.connectorsStatus.get(connectorId).skippedConsecutiveTransactions = 0;
+ const previousRunDuration =
+ this.connectorsStatus.get(connectorId)?.startDate &&
+ this.connectorsStatus.get(connectorId)?.lastRunDate
+ ? this.connectorsStatus.get(connectorId).lastRunDate.getTime() -
+ this.connectorsStatus.get(connectorId).startDate.getTime()
+ : 0;
+ this.connectorsStatus.get(connectorId).startDate = new Date();
+ this.connectorsStatus.get(connectorId).stopDate = new Date(
+ this.connectorsStatus.get(connectorId).startDate.getTime() +
+ (this.chargingStation.getAutomaticTransactionGeneratorConfiguration().stopAfterHours ??
+ Constants.CHARGING_STATION_ATG_DEFAULT_STOP_AFTER_HOURS) *
+ 3600 *
+ 1000 -
+ previousRunDuration
+ );
+ this.connectorsStatus.get(connectorId).start = true;
+ }
+
+ private initializeConnectorsStatus(): void {
+ if (this.chargingStation.hasEvses) {
+ for (const [evseId, evseStatus] of this.chargingStation.evses) {
+ if (evseId > 0) {
+ for (const connectorId of evseStatus.connectors.keys()) {
+ this.connectorsStatus.set(connectorId, {
+ start: false,
+ authorizeRequests: 0,
+ acceptedAuthorizeRequests: 0,
+ rejectedAuthorizeRequests: 0,
+ startTransactionRequests: 0,
+ acceptedStartTransactionRequests: 0,
+ rejectedStartTransactionRequests: 0,
+ stopTransactionRequests: 0,
+ acceptedStopTransactionRequests: 0,
+ rejectedStopTransactionRequests: 0,
+ skippedConsecutiveTransactions: 0,
+ skippedTransactions: 0,
+ });
+ }
+ }
+ }
+ } else {
+ for (const connectorId of this.chargingStation.connectors.keys()) {
+ if (connectorId > 0) {
+ this.connectorsStatus.set(connectorId, {
+ start: false,
+ authorizeRequests: 0,
+ acceptedAuthorizeRequests: 0,
+ rejectedAuthorizeRequests: 0,
+ startTransactionRequests: 0,
+ acceptedStartTransactionRequests: 0,
+ rejectedStartTransactionRequests: 0,
+ stopTransactionRequests: 0,
+ acceptedStopTransactionRequests: 0,
+ rejectedStopTransactionRequests: 0,
+ skippedConsecutiveTransactions: 0,
+ skippedTransactions: 0,
+ });
+ }