refactor: cleanup arguments namespace
[e-mobility-charging-stations-simulator.git] / src / utils / Constants.ts
CommitLineData
4f03d842
JB
1import {
2 type AutomaticTransactionGeneratorConfiguration,
3 type ChargingStationInfo,
4 CurrentType,
5 OCPPVersion,
66a7748d
JB
6 VendorParametersKey
7} from '../types/index.js'
1fe0632a 8
66a7748d 9// eslint-disable-next-line @typescript-eslint/no-extraneous-class
268a74bb 10export class Constants {
4f03d842
JB
11 static readonly DEFAULT_STATION_INFO: Partial<ChargingStationInfo> = Object.freeze({
12 enableStatistics: false,
13 remoteAuthorization: true,
14 currentOutType: CurrentType.AC,
15 mainVoltageMeterValues: true,
16 phaseLineToLineVoltageMeterValues: false,
17 customValueLimitationMeterValues: true,
18 ocppStrictCompliance: true,
19 outOfOrderEndMeterValues: false,
20 beginEndMeterValues: false,
21 meteringPerTransaction: true,
22 transactionDataMeterValues: false,
23 supervisionUrlOcppConfiguration: false,
24 supervisionUrlOcppKey: VendorParametersKey.ConnectionUrl,
25 ocppVersion: OCPPVersion.VERSION_16,
26 ocppPersistentConfiguration: true,
27 stationInfoPersistentConfiguration: true,
28 automaticTransactionGeneratorPersistentConfiguration: true,
29 autoReconnectMaxRetries: -1,
30 registrationMaxRetries: -1,
31 reconnectExponentialDelay: false,
66a7748d
JB
32 stopTransactionsOnStopped: true
33 })
4f03d842 34
66a7748d
JB
35 static readonly DEFAULT_BOOT_NOTIFICATION_INTERVAL = 60000 // Ms
36 static readonly DEFAULT_HEARTBEAT_INTERVAL = 60000 // Ms
37 static readonly DEFAULT_METER_VALUES_INTERVAL = 60000 // Ms
d2a64eb5 38
66a7748d
JB
39 static readonly CHARGING_STATION_DEFAULT_RESET_TIME = 60000 // Ms
40 static readonly CHARGING_STATION_ATG_AVAILABILITY_TIME = 1000 // Ms
41 static readonly CHARGING_STATION_ATG_INITIALIZATION_TIME = 1000 // Ms
1fe0632a 42
1fe0632a
JB
43 static readonly DEFAULT_ATG_CONFIGURATION: AutomaticTransactionGeneratorConfiguration =
44 Object.freeze({
45 enable: false,
86b46b49
JB
46 minDuration: 60,
47 maxDuration: 120,
48 minDelayBetweenTwoTransactions: 15,
49 maxDelayBetweenTwoTransactions: 30,
1fe0632a 50 probabilityOfStart: 1,
86b46b49 51 stopAfterHours: 0.25,
46a830d2 52 stopAbsoluteDuration: false,
66a7748d
JB
53 stopOnConnectionFailure: true
54 })
9ac86a7e 55
b25b8684 56 // See https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
3637ca2c 57 static readonly SEMVER_PATTERN =
66a7748d 58 '^(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-]+)*))?$'
b25b8684 59
66a7748d 60 static readonly DEFAULT_CIRCULAR_BUFFER_CAPACITY = 4096
1e080116 61
66a7748d 62 static readonly DEFAULT_HASH_ALGORITHM = 'sha384'
3f94cab5 63
66a7748d 64 static readonly DEFAULT_IDTAG = '00000000'
3d2ff9e4 65
66a7748d 66 static readonly DEFAULT_CONNECTION_TIMEOUT = 30
9ccca265 67
66a7748d 68 static readonly DEFAULT_LOG_STATISTICS_INTERVAL = 60 // Seconds
25f5a959 69
66a7748d 70 static readonly DEFAULT_FLUCTUATION_PERCENT = 5
2a370053 71
66a7748d
JB
72 static readonly DEFAULT_PERFORMANCE_DIRECTORY = 'performance'
73 static readonly DEFAULT_PERFORMANCE_RECORDS_FILENAME = 'performanceRecords.json'
74 static readonly DEFAULT_PERFORMANCE_RECORDS_DB_NAME = 'e-mobility-charging-stations-simulator'
75 static readonly PERFORMANCE_RECORDS_TABLE = 'performance_records'
6a49ad23 76
66a7748d
JB
77 static readonly DEFAULT_UI_SERVER_HOST = 'localhost'
78 static readonly DEFAULT_UI_SERVER_PORT = 8080
4db8406c 79
66a7748d 80 static readonly UNKNOWN_COMMAND = 'unknown command'
2a232a18 81
66a7748d 82 static readonly MAX_RANDOM_INTEGER = 281474976710654
59395dc1 83
66a7748d 84 static readonly STOP_CHARGING_STATIONS_TIMEOUT = 120000 // Ms
1832a986 85
66a7748d 86 static readonly EMPTY_FROZEN_OBJECT = Object.freeze({})
59b6ed8d
JB
87 static readonly EMPTY_FUNCTION = Object.freeze(() => {
88 /* This is intentional */
66a7748d 89 })
59b6ed8d 90
66a7748d 91 static readonly DEFAULT_MESSAGE_BUFFER_FLUSH_INTERVAL = 60000 // Ms
d193a949 92
66a7748d 93 private constructor () {
4db8406c
JB
94 // This is intentional
95 }
f7869514 96}