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
,
37 ocppPersistentConfiguration
: true,
38 stationInfoPersistentConfiguration
: true,
39 automaticTransactionGeneratorPersistentConfiguration
: true,
40 resetTime
: Constants
.DEFAULT_CHARGING_STATION_RESET_TIME
,
41 autoReconnectMaxRetries
: -1,
42 registrationMaxRetries
: -1,
43 reconnectExponentialDelay
: false,
44 stopTransactionsOnStopped
: true
47 static readonly DEFAULT_BOOT_NOTIFICATION_INTERVAL
= 60000 // Ms
48 static readonly DEFAULT_HEARTBEAT_INTERVAL
= 60000 // Ms
49 static readonly DEFAULT_METER_VALUES_INTERVAL
= 60000 // Ms
51 static readonly DEFAULT_ATG_WAIT_TIME
= 1000 // Ms
52 static readonly DEFAULT_ATG_CONFIGURATION
: AutomaticTransactionGeneratorConfiguration
=
57 minDelayBetweenTwoTransactions
: 15,
58 maxDelayBetweenTwoTransactions
: 30,
59 probabilityOfStart
: 1,
61 stopAbsoluteDuration
: false
64 static readonly DEFAULT_CIRCULAR_BUFFER_CAPACITY
= 4096
66 static readonly DEFAULT_HASH_ALGORITHM
= 'sha384'
68 static readonly DEFAULT_IDTAG
= '00000000'
70 static readonly DEFAULT_CONNECTION_TIMEOUT
= 30
72 static readonly DEFAULT_LOG_STATISTICS_INTERVAL
= 60 // Seconds
74 static readonly DEFAULT_FLUCTUATION_PERCENT
= 5
76 static readonly DEFAULT_PERFORMANCE_DIRECTORY
= 'performance'
77 static readonly DEFAULT_PERFORMANCE_RECORDS_FILENAME
= 'performanceRecords.json'
78 static readonly DEFAULT_PERFORMANCE_RECORDS_DB_NAME
= 'e-mobility-charging-stations-simulator'
79 static readonly PERFORMANCE_RECORDS_TABLE
= 'performance_records'
81 static readonly DEFAULT_UI_SERVER_HOST
= 'localhost'
82 static readonly DEFAULT_UI_SERVER_PORT
= 8080
84 static readonly UNKNOWN_OCPP_COMMAND
= 'unknown OCPP command' as
86 | IncomingRequestCommand
88 static readonly MAX_RANDOM_INTEGER
= 281474976710654
90 static readonly STOP_CHARGING_STATIONS_TIMEOUT
= 60000 // Ms
92 static readonly EMPTY_FROZEN_OBJECT
= Object.freeze({})
93 static readonly EMPTY_FUNCTION
= Object.freeze(() => {
94 /* This is intentional */
97 static readonly DEFAULT_MESSAGE_BUFFER_FLUSH_INTERVAL
= 60000 // Ms
99 private constructor () {
100 // This is intentional