| 1 | import { |
| 2 | type AutomaticTransactionGeneratorConfiguration, |
| 3 | type ChargingStationInfo, |
| 4 | CurrentType, |
| 5 | OCPPVersion, |
| 6 | VendorParametersKey |
| 7 | } from '../types/index.js' |
| 8 | |
| 9 | // eslint-disable-next-line @typescript-eslint/no-extraneous-class |
| 10 | export class Constants { |
| 11 | static readonly DEFAULT_STATION_INFO: Partial<ChargingStationInfo> = Object.freeze({ |
| 12 | enableStatistics: false, |
| 13 | remoteAuthorization: true, |
| 14 | currentOutType: CurrentType.AC, |
| 15 | mainVoltageMeterValues: true, |
| 16 | phaseLineToLineVoltageMeterValues: false, |
| 17 | customValueLimitationMeterValues: true, |
| 18 | ocppStrictCompliance: true, |
| 19 | outOfOrderEndMeterValues: false, |
| 20 | beginEndMeterValues: false, |
| 21 | meteringPerTransaction: true, |
| 22 | transactionDataMeterValues: false, |
| 23 | supervisionUrlOcppConfiguration: false, |
| 24 | supervisionUrlOcppKey: VendorParametersKey.ConnectionUrl, |
| 25 | ocppVersion: OCPPVersion.VERSION_16, |
| 26 | ocppPersistentConfiguration: true, |
| 27 | stationInfoPersistentConfiguration: true, |
| 28 | automaticTransactionGeneratorPersistentConfiguration: true, |
| 29 | autoReconnectMaxRetries: -1, |
| 30 | registrationMaxRetries: -1, |
| 31 | reconnectExponentialDelay: false, |
| 32 | stopTransactionsOnStopped: true |
| 33 | }) |
| 34 | |
| 35 | static readonly DEFAULT_BOOT_NOTIFICATION_INTERVAL = 60000 // Ms |
| 36 | static readonly DEFAULT_HEARTBEAT_INTERVAL = 60000 // Ms |
| 37 | static readonly DEFAULT_METER_VALUES_INTERVAL = 60000 // Ms |
| 38 | |
| 39 | static readonly CHARGING_STATION_DEFAULT_RESET_TIME = 60000 // Ms |
| 40 | static readonly CHARGING_STATION_ATG_AVAILABILITY_TIME = 1000 // Ms |
| 41 | static readonly CHARGING_STATION_ATG_INITIALIZATION_TIME = 1000 // Ms |
| 42 | |
| 43 | static readonly DEFAULT_ATG_CONFIGURATION: AutomaticTransactionGeneratorConfiguration = |
| 44 | Object.freeze({ |
| 45 | enable: false, |
| 46 | minDuration: 60, |
| 47 | maxDuration: 120, |
| 48 | minDelayBetweenTwoTransactions: 15, |
| 49 | maxDelayBetweenTwoTransactions: 30, |
| 50 | probabilityOfStart: 1, |
| 51 | stopAfterHours: 0.25, |
| 52 | stopOnConnectionFailure: true |
| 53 | }) |
| 54 | |
| 55 | // See https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string |
| 56 | static readonly SEMVER_PATTERN = |
| 57 | '^(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-]+)*))?$' |
| 58 | |
| 59 | static readonly DEFAULT_CIRCULAR_BUFFER_CAPACITY = 4096 |
| 60 | |
| 61 | static readonly DEFAULT_HASH_ALGORITHM = 'sha384' |
| 62 | |
| 63 | static readonly DEFAULT_IDTAG = '00000000' |
| 64 | |
| 65 | static readonly DEFAULT_CONNECTION_TIMEOUT = 30 |
| 66 | |
| 67 | static readonly DEFAULT_LOG_STATISTICS_INTERVAL = 60 // Seconds |
| 68 | |
| 69 | static readonly DEFAULT_FLUCTUATION_PERCENT = 5 |
| 70 | |
| 71 | static readonly DEFAULT_PERFORMANCE_DIRECTORY = 'performance' |
| 72 | static readonly DEFAULT_PERFORMANCE_RECORDS_FILENAME = 'performanceRecords.json' |
| 73 | static readonly DEFAULT_PERFORMANCE_RECORDS_DB_NAME = 'e-mobility-charging-stations-simulator' |
| 74 | static readonly PERFORMANCE_RECORDS_TABLE = 'performance_records' |
| 75 | |
| 76 | static readonly DEFAULT_UI_SERVER_HOST = 'localhost' |
| 77 | static readonly DEFAULT_UI_SERVER_PORT = 8080 |
| 78 | |
| 79 | static readonly UNKNOWN_COMMAND = 'unknown command' |
| 80 | |
| 81 | static readonly MAX_RANDOM_INTEGER = 281474976710654 |
| 82 | |
| 83 | static readonly STOP_CHARGING_STATIONS_TIMEOUT = 120000 // Ms |
| 84 | |
| 85 | static readonly EMPTY_FROZEN_OBJECT = Object.freeze({}) |
| 86 | static readonly EMPTY_FUNCTION = Object.freeze(() => { |
| 87 | /* This is intentional */ |
| 88 | }) |
| 89 | |
| 90 | static readonly DEFAULT_MESSAGE_BUFFER_FLUSH_INTERVAL = 60000 // Ms |
| 91 | |
| 92 | private constructor () { |
| 93 | // This is intentional |
| 94 | } |
| 95 | } |