const wait =
Utils.getRandomInteger(
this.chargingStation.getAutomaticTransactionGeneratorConfiguration()
- .maxDelayBetweenTwoTransactions,
+ .maxDelayBetweenTwoTransactions ??
+ Constants.DEFAULT_ATG_MAX_DELAY_BETWEEN_TWO_TRANSACTIONS,
this.chargingStation.getAutomaticTransactionGeneratorConfiguration()
- .minDelayBetweenTwoTransactions
+ .minDelayBetweenTwoTransactions ??
+ Constants.DEFAULT_ATG_MIN_DELAY_BETWEEN_TWO_TRANSACTIONS
) * 1000;
logger.info(
`${this.logPrefix(connectorId)} waiting for ${Utils.formatDurationMilliSeconds(wait)}`
// Wait until end of transaction
const waitTrxEnd =
Utils.getRandomInteger(
- this.chargingStation.getAutomaticTransactionGeneratorConfiguration().maxDuration,
- this.chargingStation.getAutomaticTransactionGeneratorConfiguration().minDuration
+ this.chargingStation.getAutomaticTransactionGeneratorConfiguration().maxDuration ??
+ Constants.DEFAULT_ATG_MAX_DURATION,
+ this.chargingStation.getAutomaticTransactionGeneratorConfiguration().minDuration ??
+ Constants.DEFAULT_ATG_MIN_DURATION
) * 1000;
logger.info(
`${this.logPrefix(connectorId)} transaction started with id ${this.chargingStation
static readonly CHARGING_STATION_DEFAULT_RESET_TIME = 60000; // Ms
static readonly CHARGING_STATION_ATG_INITIALIZATION_TIME = 1000; // Ms
+ static readonly DEFAULT_ATG_MIN_DURATION = 60;
+ static readonly DEFAULT_ATG_MAX_DURATION = 120;
+ static readonly DEFAULT_ATG_MIN_DELAY_BETWEEN_TWO_TRANSACTIONS = 15;
+ static readonly DEFAULT_ATG_MAX_DELAY_BETWEEN_TWO_TRANSACTIONS = 30;
static readonly DEFAULT_ATG_STOP_AFTER_HOURS = 0.25; // Hours
static readonly DEFAULT_ATG_CONFIGURATION: AutomaticTransactionGeneratorConfiguration =
Object.freeze({
enable: false,
- minDuration: 60,
- maxDuration: 120,
- minDelayBetweenTwoTransactions: 15,
- maxDelayBetweenTwoTransactions: 30,
+ minDuration: Constants.DEFAULT_ATG_MIN_DURATION,
+ maxDuration: Constants.DEFAULT_ATG_MAX_DURATION,
+ minDelayBetweenTwoTransactions: Constants.DEFAULT_ATG_MIN_DELAY_BETWEEN_TWO_TRANSACTIONS,
+ maxDelayBetweenTwoTransactions: Constants.DEFAULT_ATG_MAX_DELAY_BETWEEN_TWO_TRANSACTIONS,
probabilityOfStart: 1,
stopAfterHours: Constants.DEFAULT_ATG_STOP_AFTER_HOURS,
stopOnConnectionFailure: true,