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