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