Add Reset command handling.
[e-mobility-charging-stations-simulator.git] / src / charging-station / AutomaticTransactionGenerator.js
index ebb0a8e0a5d17baf73bb1de4733e8717559bc2b8..bb2119b29ef86fa181383a7ad43996a59c68be62 100644 (file)
@@ -24,17 +24,6 @@ class AutomaticTransactionGenerator {
     return Utils.basicFormatLog(' ' + this._chargingStation._stationInfo.name + ' ATG:');
   }
 
-  async stop() {
-    logger.info(this._basicFormatLog() + ' ATG OVER => STOPPING ALL TRANSACTIONS');
-    for (const connector in this._chargingStation._connectors) {
-      if (this._chargingStation._connectors[connector].transactionStarted) {
-        logger.info(this._basicFormatLog(connector) + ' ATG OVER. Stop transaction ' + this._chargingStation._connectors[connector].transactionId);
-        await this._chargingStation.sendStopTransaction(this._chargingStation._connectors[connector].transactionId);
-      }
-    }
-    this._timeToStop = true;
-  }
-
   async start() {
     this._timeToStop = false;
     if (this._chargingStation._stationInfo.AutomaticTransactionGenerator.stopAfterHours &&
@@ -51,6 +40,17 @@ class AutomaticTransactionGenerator {
     }
   }
 
+  async stop() {
+    logger.info(this._basicFormatLog() + ' ATG OVER => STOPPING ALL TRANSACTIONS');
+    for (const connector in this._chargingStation._connectors) {
+      if (this._chargingStation._connectors[connector].transactionStarted) {
+        logger.info(this._basicFormatLog(connector) + ' ATG OVER. Stop transaction ' + this._chargingStation._connectors[connector].transactionId);
+        await this._chargingStation.sendStopTransaction(this._chargingStation._connectors[connector].transactionId);
+      }
+    }
+    this._timeToStop = true;
+  }
+
   async startConnector(connectorId) {
     do {
       const wait = Utils.getRandomInt(this._chargingStation._stationInfo.AutomaticTransactionGenerator.maxDelayBetweenTwoTransactions,