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