refactor(simulator): add more default values to ATG
[e-mobility-charging-stations-simulator.git] / src / utils / Constants.ts
CommitLineData
1fe0632a
JB
1import type { AutomaticTransactionGeneratorConfiguration } from '../types';
2
268a74bb 3export class Constants {
7d34a2f4 4 static readonly DEFAULT_BOOT_NOTIFICATION_INTERVAL = 60000; // Ms
c3da35d4
JB
5 static readonly DEFAULT_HEARTBEAT_INTERVAL = 60000; // Ms
6 static readonly DEFAULT_METER_VALUES_INTERVAL = 60000; // Ms
d2a64eb5 7
10570d97 8 static readonly CHARGING_STATION_DEFAULT_RESET_TIME = 60000; // Ms
a4cc42ea 9 static readonly CHARGING_STATION_ATG_INITIALIZATION_TIME = 1000; // Ms
1fe0632a 10
6170d8cd
JB
11 static readonly DEFAULT_ATG_MIN_DURATION = 60;
12 static readonly DEFAULT_ATG_MAX_DURATION = 120;
13 static readonly DEFAULT_ATG_MIN_DELAY_BETWEEN_TWO_TRANSACTIONS = 15;
14 static readonly DEFAULT_ATG_MAX_DELAY_BETWEEN_TWO_TRANSACTIONS = 30;
1fe0632a
JB
15 static readonly DEFAULT_ATG_STOP_AFTER_HOURS = 0.25; // Hours
16 static readonly DEFAULT_ATG_CONFIGURATION: AutomaticTransactionGeneratorConfiguration =
17 Object.freeze({
18 enable: false,
6170d8cd
JB
19 minDuration: Constants.DEFAULT_ATG_MIN_DURATION,
20 maxDuration: Constants.DEFAULT_ATG_MAX_DURATION,
21 minDelayBetweenTwoTransactions: Constants.DEFAULT_ATG_MIN_DELAY_BETWEEN_TWO_TRANSACTIONS,
22 maxDelayBetweenTwoTransactions: Constants.DEFAULT_ATG_MAX_DELAY_BETWEEN_TWO_TRANSACTIONS,
1fe0632a
JB
23 probabilityOfStart: 1,
24 stopAfterHours: Constants.DEFAULT_ATG_STOP_AFTER_HOURS,
25 stopOnConnectionFailure: true,
26 });
9ac86a7e 27
b25b8684 28 // See https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
3637ca2c
JB
29 static readonly SEMVER_PATTERN =
30 '^(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 31
9a15316c 32 static readonly DEFAULT_CIRCULAR_BUFFER_CAPACITY = 1024;
1e080116 33
3f94cab5
JB
34 static readonly DEFAULT_HASH_ALGORITHM = 'sha384';
35
c69294f7 36 static readonly DEFAULT_IDTAG = '00000000';
3d2ff9e4 37
291cb255 38 static readonly DEFAULT_CONNECTION_TIMEOUT = 30;
9ccca265 39
25f5a959
JB
40 static readonly DEFAULT_LOG_STATISTICS_INTERVAL = 60; // Seconds
41
9ccca265 42 static readonly DEFAULT_FLUCTUATION_PERCENT = 5;
2a370053 43
a6b3c6c3 44 static readonly DEFAULT_PERFORMANCE_RECORDS_FILENAME = 'performanceRecords.json';
7f774a55 45 static readonly DEFAULT_PERFORMANCE_RECORDS_DB_NAME = 'e-mobility-charging-stations-simulator';
ae8ee665 46 static readonly PERFORMANCE_RECORDS_TABLE = 'performance_records';
6a49ad23 47
adbddcb4
JB
48 static readonly DEFAULT_UI_SERVER_HOST = 'localhost';
49 static readonly DEFAULT_UI_SERVER_PORT = 8080;
4db8406c 50
2a232a18
JB
51 static readonly UNKNOWN_COMMAND = 'unknown command';
52
59395dc1
JB
53 static readonly MAX_RANDOM_INTEGER = 281474976710654;
54
59b6ed8d
JB
55 static readonly EMPTY_FREEZED_OBJECT = Object.freeze({});
56 static readonly EMPTY_FUNCTION = Object.freeze(() => {
57 /* This is intentional */
58 });
59
4db8406c
JB
60 private constructor() {
61 // This is intentional
62 }
f7869514 63}