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