2 type AutomaticTransactionGeneratorConfiguration
,
3 type ChargingStationInfo
,
5 type IncomingRequestCommand
,
9 } from
'../types/index.js'
11 // eslint-disable-next-line @typescript-eslint/no-extraneous-class
12 export class Constants
{
13 // See https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
14 private static readonly SEMVER_PATTERN
=
15 '^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$'
17 private static readonly DEFAULT_CHARGING_STATION_RESET_TIME
= 30000 // Ms
19 static readonly DEFAULT_STATION_INFO
: Partial
<ChargingStationInfo
> = Object.freeze({
20 enableStatistics
: false,
22 remoteAuthorization
: true,
23 currentOutType
: CurrentType
.AC
,
24 mainVoltageMeterValues
: true,
25 phaseLineToLineVoltageMeterValues
: false,
26 customValueLimitationMeterValues
: true,
27 ocppStrictCompliance
: true,
28 outOfOrderEndMeterValues
: false,
29 beginEndMeterValues
: false,
30 meteringPerTransaction
: true,
31 transactionDataMeterValues
: false,
32 supervisionUrlOcppConfiguration
: false,
33 supervisionUrlOcppKey
: VendorParametersKey
.ConnectionUrl
,
34 useConnectorId0
: true,
35 ocppVersion
: OCPPVersion
.VERSION_16
,
36 firmwareVersionPattern
: Constants
.SEMVER_PATTERN
,
43 ocppPersistentConfiguration
: true,
44 stationInfoPersistentConfiguration
: true,
45 automaticTransactionGeneratorPersistentConfiguration
: true,
46 resetTime
: Constants
.DEFAULT_CHARGING_STATION_RESET_TIME
,
47 autoReconnectMaxRetries
: -1,
48 registrationMaxRetries
: -1,
49 reconnectExponentialDelay
: false,
50 stopTransactionsOnStopped
: true
53 static readonly DEFAULT_BOOT_NOTIFICATION_INTERVAL
= 60000 // Ms
54 static readonly DEFAULT_HEARTBEAT_INTERVAL
= 60000 // Ms
55 static readonly DEFAULT_METER_VALUES_INTERVAL
= 60000 // Ms
57 static readonly DEFAULT_ATG_WAIT_TIME
= 1000 // Ms
58 static readonly DEFAULT_ATG_CONFIGURATION
: AutomaticTransactionGeneratorConfiguration
=
63 minDelayBetweenTwoTransactions
: 15,
64 maxDelayBetweenTwoTransactions
: 30,
65 probabilityOfStart
: 1,
67 stopAbsoluteDuration
: false
70 static readonly DEFAULT_CIRCULAR_BUFFER_CAPACITY
= 386
72 static readonly DEFAULT_HASH_ALGORITHM
= 'sha384'
74 static readonly DEFAULT_IDTAG
= '00000000'
76 static readonly DEFAULT_CONNECTION_TIMEOUT
= 30
78 static readonly DEFAULT_LOG_STATISTICS_INTERVAL
= 60 // Seconds
80 static readonly DEFAULT_FLUCTUATION_PERCENT
= 5
82 static readonly DEFAULT_PERFORMANCE_DIRECTORY
= 'performance'
83 static readonly DEFAULT_PERFORMANCE_RECORDS_FILENAME
= 'performanceRecords.json'
84 static readonly DEFAULT_PERFORMANCE_RECORDS_DB_NAME
= 'e-mobility-charging-stations-simulator'
85 static readonly PERFORMANCE_RECORDS_TABLE
= 'performance_records'
87 static readonly DEFAULT_UI_SERVER_HOST
= 'localhost'
88 static readonly DEFAULT_UI_SERVER_PORT
= 8080
90 static readonly UNKNOWN_OCPP_COMMAND
= 'unknown OCPP command' as
92 | IncomingRequestCommand
94 static readonly MAX_RANDOM_INTEGER
= 281474976710655
96 static readonly STOP_CHARGING_STATIONS_TIMEOUT
= 60000 // Ms
98 static readonly EMPTY_FROZEN_OBJECT
= Object.freeze({})
99 static readonly EMPTY_FUNCTION
= Object.freeze(() => {
100 /* This is intentional */
103 static readonly DEFAULT_MESSAGE_BUFFER_FLUSH_INTERVAL
= 60000 // Ms
105 private constructor () {
106 // This is intentional