]>
Commit | Line | Data |
---|---|---|
1 | import { | |
2 | type AutomaticTransactionGeneratorConfiguration, | |
3 | type ChargingStationInfo, | |
4 | CurrentType, | |
5 | type IncomingRequestCommand, | |
6 | OCPPVersion, | |
7 | type RequestCommand, | |
8 | VendorParametersKey, | |
9 | } from '../types/index.js' | |
10 | ||
11 | // eslint-disable-next-line @typescript-eslint/no-extraneous-class | |
12 | export class Constants { | |
13 | static readonly DEFAULT_ATG_CONFIGURATION: AutomaticTransactionGeneratorConfiguration = | |
14 | Object.freeze({ | |
15 | enable: false, | |
16 | maxDelayBetweenTwoTransactions: 30, | |
17 | maxDuration: 120, | |
18 | minDelayBetweenTwoTransactions: 15, | |
19 | minDuration: 60, | |
20 | probabilityOfStart: 1, | |
21 | stopAbsoluteDuration: false, | |
22 | stopAfterHours: 0.25, | |
23 | }) | |
24 | ||
25 | static readonly DEFAULT_ATG_WAIT_TIME = 1000 // Ms | |
26 | ||
27 | static readonly DEFAULT_BOOT_NOTIFICATION_INTERVAL = 60000 // Ms | |
28 | ||
29 | static readonly DEFAULT_CIRCULAR_BUFFER_CAPACITY = 386 | |
30 | static readonly DEFAULT_CONNECTION_TIMEOUT = 30 | |
31 | ||
32 | static readonly DEFAULT_FLUCTUATION_PERCENT = 5 | |
33 | static readonly DEFAULT_HASH_ALGORITHM = 'sha384' | |
34 | ||
35 | static readonly DEFAULT_HEARTBEAT_INTERVAL = 60000 // Ms | |
36 | ||
37 | static readonly DEFAULT_IDTAG = '00000000' | |
38 | ||
39 | static readonly DEFAULT_LOG_STATISTICS_INTERVAL = 60 // Seconds | |
40 | ||
41 | static readonly DEFAULT_MESSAGE_BUFFER_FLUSH_INTERVAL = 60000 // Ms | |
42 | ||
43 | static readonly DEFAULT_METER_VALUES_INTERVAL = 60000 // Ms | |
44 | ||
45 | static readonly DEFAULT_PERFORMANCE_DIRECTORY = 'performance' | |
46 | ||
47 | static readonly DEFAULT_PERFORMANCE_RECORDS_DB_NAME = 'e-mobility-charging-stations-simulator' | |
48 | static readonly DEFAULT_PERFORMANCE_RECORDS_FILENAME = 'performanceRecords.json' | |
49 | static readonly DEFAULT_STATION_INFO: Readonly<Partial<ChargingStationInfo>> = Object.freeze({ | |
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 | }, | |
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-]+)*))?$', | |
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, | |
76 | resetTime: 30000, // Ms | |
77 | stationInfoPersistentConfiguration: true, | |
78 | stopTransactionsOnStopped: true, | |
79 | supervisionUrlOcppConfiguration: false, | |
80 | supervisionUrlOcppKey: VendorParametersKey.ConnectionUrl, | |
81 | transactionDataMeterValues: false, | |
82 | useConnectorId0: true, | |
83 | }) | |
84 | ||
85 | static readonly DEFAULT_UI_SERVER_HOST = 'localhost' | |
86 | ||
87 | static readonly DEFAULT_UI_SERVER_PORT = 8080 | |
88 | static readonly EMPTY_FROZEN_OBJECT = Object.freeze({}) | |
89 | ||
90 | static readonly EMPTY_FUNCTION = Object.freeze(() => { | |
91 | /* This is intentional */ | |
92 | }) | |
93 | ||
94 | static readonly MAX_RANDOM_INTEGER = 281474976710655 | |
95 | ||
96 | static readonly PERFORMANCE_RECORDS_TABLE = 'performance_records' | |
97 | ||
98 | static readonly STOP_CHARGING_STATIONS_TIMEOUT = 60000 // Ms | |
99 | ||
100 | static readonly UNKNOWN_OCPP_COMMAND = 'unknown OCPP command' as | |
101 | | IncomingRequestCommand | |
102 | | RequestCommand | |
103 | ||
104 | private constructor () { | |
105 | // This is intentional | |
106 | } | |
107 | } |