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