this.chargingStation = chargingStation;
this.connectorsStatus = new Map<number, Status>();
this.initializeConnectorsStatus();
}
public static getInstance(
this.chargingStation = chargingStation;
this.connectorsStatus = new Map<number, Status>();
this.initializeConnectorsStatus();
}
public static getInstance(
chargingStation: ChargingStation
): AutomaticTransactionGenerator | undefined {
if (AutomaticTransactionGenerator.instances.has(chargingStation.stationInfo.hashId) === false) {
AutomaticTransactionGenerator.instances.set(
chargingStation.stationInfo.hashId,
chargingStation: ChargingStation
): AutomaticTransactionGenerator | undefined {
if (AutomaticTransactionGenerator.instances.has(chargingStation.stationInfo.hashId) === false) {
AutomaticTransactionGenerator.instances.set(
chargingStation.stationInfo.hashId,
- this.configuration.maxDelayBetweenTwoTransactions,
- this.configuration.minDelayBetweenTwoTransactions
+ this.chargingStation.getAutomaticTransactionGeneratorConfiguration()
+ .maxDelayBetweenTwoTransactions,
+ this.chargingStation.getAutomaticTransactionGeneratorConfiguration()
+ .minDelayBetweenTwoTransactions
) * 1000;
logger.info(
`${this.logPrefix(connectorId)} waiting for ${Utils.formatDurationMilliSeconds(wait)}`
);
await Utils.sleep(wait);
const start = Utils.secureRandom();
) * 1000;
logger.info(
`${this.logPrefix(connectorId)} waiting for ${Utils.formatDurationMilliSeconds(wait)}`
);
await Utils.sleep(wait);
const start = Utils.secureRandom();
this.connectorsStatus.get(connectorId).skippedConsecutiveTransactions = 0;
// Start transaction
const startResponse = await this.startTransaction(connectorId);
if (startResponse?.idTagInfo?.status === AuthorizationStatus.ACCEPTED) {
// Wait until end of transaction
const waitTrxEnd =
this.connectorsStatus.get(connectorId).skippedConsecutiveTransactions = 0;
// Start transaction
const startResponse = await this.startTransaction(connectorId);
if (startResponse?.idTagInfo?.status === AuthorizationStatus.ACCEPTED) {
// Wait until end of transaction
const waitTrxEnd =
- Utils.getRandomInteger(this.configuration.maxDuration, this.configuration.minDuration) *
- 1000;
+ Utils.getRandomInteger(
+ this.chargingStation.getAutomaticTransactionGeneratorConfiguration().maxDuration,
+ this.chargingStation.getAutomaticTransactionGeneratorConfiguration().minDuration
+ ) * 1000;
logger.info(
`${this.logPrefix(connectorId)} transaction started with id ${this.chargingStation
.getConnectorStatus(connectorId)
logger.info(
`${this.logPrefix(connectorId)} transaction started with id ${this.chargingStation
.getConnectorStatus(connectorId)
this.connectorsStatus.get(connectorId).startDate = new Date();
this.connectorsStatus.get(connectorId).stopDate = new Date(
this.connectorsStatus.get(connectorId).startDate.getTime() +
this.connectorsStatus.get(connectorId).startDate = new Date();
this.connectorsStatus.get(connectorId).stopDate = new Date(
this.connectorsStatus.get(connectorId).startDate.getTime() +
let startResponse: StartTransactionResponse;
if (this.chargingStation.hasIdTags()) {
const idTag = IdTagsCache.getInstance().getIdTag(
let startResponse: StartTransactionResponse;
if (this.chargingStation.hasIdTags()) {
const idTag = IdTagsCache.getInstance().getIdTag(