X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FChargingStationUtils.ts;h=f86c5d783b82657c483183f9bf43c562e2c11de1;hb=0b22144c135af531858c989650e864edb352764d;hp=93e34ec69024b8dfe7dbe7e86e50614eec5180be;hpb=51022aa0d811eec79514fbeb56cb9556e7168cd7;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ChargingStationUtils.ts b/src/charging-station/ChargingStationUtils.ts index 93e34ec6..f86c5d78 100644 --- a/src/charging-station/ChargingStationUtils.ts +++ b/src/charging-station/ChargingStationUtils.ts @@ -29,15 +29,7 @@ import { RecurrencyKindType, Voltage, } from '../types'; -import { - ACElectricUtils, - Configuration, - Constants, - DCElectricUtils, - Utils, - logger, -} from '../utils'; -import { WorkerProcessType } from '../worker'; +import { ACElectricUtils, Constants, DCElectricUtils, Utils, logger } from '../utils'; const moduleName = 'ChargingStationUtils'; @@ -153,7 +145,7 @@ export class ChargingStationUtils { return connectorBootStatus; } - public static checkTemplateFile( + public static checkTemplate( stationTemplate: ChargingStationTemplate, logPrefix: string, templateFile: string @@ -169,18 +161,18 @@ export class ChargingStationUtils { throw new BaseError(errorMsg); } if (Utils.isEmptyObject(stationTemplate.AutomaticTransactionGenerator)) { - stationTemplate.AutomaticTransactionGenerator = { - enable: false, - minDuration: 60, - maxDuration: 120, - minDelayBetweenTwoTransactions: 15, - maxDelayBetweenTwoTransactions: 30, - probabilityOfStart: 1, - stopAfterHours: 0.3, - stopOnConnectionFailure: true, - }; + stationTemplate.AutomaticTransactionGenerator = Constants.DEFAULT_ATG_CONFIGURATION; + logger.warn( + `${logPrefix} Empty automatic transaction generator configuration from template file ${templateFile}, set to default: %j`, + Constants.DEFAULT_ATG_CONFIGURATION + ); + } + if ( + Utils.isNullOrUndefined(stationTemplate.idTagsFile) || + Utils.isEmptyString(stationTemplate.idTagsFile) + ) { logger.warn( - `${logPrefix} Empty automatic transaction generator configuration from template file ${templateFile}, set to default values` + `${logPrefix} Missing id tags file in template file ${templateFile}. That can lead to issues with the Automatic Transaction Generator` ); } } @@ -351,16 +343,6 @@ export class ChargingStationUtils { } } - public static workerPoolInUse(): boolean { - return [WorkerProcessType.dynamicPool, WorkerProcessType.staticPool].includes( - Configuration.getWorker().processType - ); - } - - public static workerDynamicPoolInUse(): boolean { - return Configuration.getWorker().processType === WorkerProcessType.dynamicPool; - } - public static warnTemplateKeysDeprecation( stationTemplate: ChargingStationTemplate, logPrefix: string,