refactor: rename constant to a more sensible name
[e-mobility-charging-stations-simulator.git] / src / utils / Constants.ts
1 import type { AutomaticTransactionGeneratorConfiguration } from '../types';
2
3 export class Constants {
4 static readonly DEFAULT_BOOT_NOTIFICATION_INTERVAL = 60000; // Ms
5 static readonly DEFAULT_HEARTBEAT_INTERVAL = 60000; // Ms
6 static readonly DEFAULT_METER_VALUES_INTERVAL = 60000; // Ms
7
8 static readonly CHARGING_STATION_DEFAULT_RESET_TIME = 60000; // Ms
9 static readonly CHARGING_STATION_ATG_AVAILABILITY_TIME = 1000; // Ms
10 static readonly CHARGING_STATION_ATG_INITIALIZATION_TIME = 1000; // Ms
11
12 static readonly DEFAULT_ATG_CONFIGURATION: AutomaticTransactionGeneratorConfiguration =
13 Object.freeze({
14 enable: false,
15 minDuration: 60,
16 maxDuration: 120,
17 minDelayBetweenTwoTransactions: 15,
18 maxDelayBetweenTwoTransactions: 30,
19 probabilityOfStart: 1,
20 stopAfterHours: 0.25,
21 stopOnConnectionFailure: true,
22 });
23
24 // See https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
25 static readonly SEMVER_PATTERN =
26 '^(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-]+)*))?$';
27
28 static readonly DEFAULT_CIRCULAR_BUFFER_CAPACITY = 4096;
29
30 static readonly DEFAULT_HASH_ALGORITHM = 'sha384';
31
32 static readonly DEFAULT_IDTAG = '00000000';
33
34 static readonly DEFAULT_CONNECTION_TIMEOUT = 30;
35
36 static readonly DEFAULT_LOG_STATISTICS_INTERVAL = 60; // Seconds
37
38 static readonly DEFAULT_FLUCTUATION_PERCENT = 5;
39
40 static readonly DEFAULT_PERFORMANCE_DIRECTORY = 'performance';
41 static readonly DEFAULT_PERFORMANCE_RECORDS_FILENAME = 'performanceRecords.json';
42 static readonly DEFAULT_PERFORMANCE_RECORDS_DB_NAME = 'e-mobility-charging-stations-simulator';
43 static readonly PERFORMANCE_RECORDS_TABLE = 'performance_records';
44
45 static readonly DEFAULT_UI_SERVER_HOST = 'localhost';
46 static readonly DEFAULT_UI_SERVER_PORT = 8080;
47
48 static readonly UNKNOWN_COMMAND = 'unknown command';
49
50 static readonly MAX_RANDOM_INTEGER = 281474976710654;
51
52 static readonly STOP_CHARGING_STATIONS_TIMEOUT = 120000; // Ms
53
54 static readonly EMPTY_FROZEN_OBJECT = Object.freeze({});
55 static readonly EMPTY_FUNCTION = Object.freeze(() => {
56 /* This is intentional */
57 });
58
59 static readonly DEFAULT_RESERVATION_EXPIRATION_INTERVAL = 60000; // Ms
60
61 private constructor() {
62 // This is intentional
63 }
64 }