| 1 | import { |
| 2 | AvailabilityStatus, |
| 3 | ChargingProfileStatus, |
| 4 | ClearChargingProfileStatus, |
| 5 | ConfigurationStatus, |
| 6 | DefaultStatus, |
| 7 | TriggerMessageStatus, |
| 8 | UnlockStatus, |
| 9 | } from '../types/ocpp/Responses'; |
| 10 | |
| 11 | import { MeterValueMeasurand } from '../types/ocpp/MeterValues'; |
| 12 | |
| 13 | export default class Constants { |
| 14 | static readonly OCPP_RESPONSE_EMPTY = Object.freeze({}); |
| 15 | static readonly OCPP_RESPONSE_ACCEPTED = Object.freeze({ status: DefaultStatus.ACCEPTED }); |
| 16 | static readonly OCPP_RESPONSE_REJECTED = Object.freeze({ status: DefaultStatus.REJECTED }); |
| 17 | static readonly OCPP_CONFIGURATION_RESPONSE_ACCEPTED = Object.freeze({ |
| 18 | status: ConfigurationStatus.ACCEPTED, |
| 19 | }); |
| 20 | |
| 21 | static readonly OCPP_CONFIGURATION_RESPONSE_REJECTED = Object.freeze({ |
| 22 | status: ConfigurationStatus.REJECTED, |
| 23 | }); |
| 24 | |
| 25 | static readonly OCPP_CONFIGURATION_RESPONSE_REBOOT_REQUIRED = Object.freeze({ |
| 26 | status: ConfigurationStatus.REBOOT_REQUIRED, |
| 27 | }); |
| 28 | |
| 29 | static readonly OCPP_CONFIGURATION_RESPONSE_NOT_SUPPORTED = Object.freeze({ |
| 30 | status: ConfigurationStatus.NOT_SUPPORTED, |
| 31 | }); |
| 32 | |
| 33 | static readonly OCPP_SET_CHARGING_PROFILE_RESPONSE_ACCEPTED = Object.freeze({ |
| 34 | status: ChargingProfileStatus.ACCEPTED, |
| 35 | }); |
| 36 | |
| 37 | static readonly OCPP_SET_CHARGING_PROFILE_RESPONSE_REJECTED = Object.freeze({ |
| 38 | status: ChargingProfileStatus.REJECTED, |
| 39 | }); |
| 40 | |
| 41 | static readonly OCPP_SET_CHARGING_PROFILE_RESPONSE_NOT_SUPPORTED = Object.freeze({ |
| 42 | status: ChargingProfileStatus.NOT_SUPPORTED, |
| 43 | }); |
| 44 | |
| 45 | static readonly OCPP_CLEAR_CHARGING_PROFILE_RESPONSE_ACCEPTED = Object.freeze({ |
| 46 | status: ClearChargingProfileStatus.ACCEPTED, |
| 47 | }); |
| 48 | |
| 49 | static readonly OCPP_CLEAR_CHARGING_PROFILE_RESPONSE_UNKNOWN = Object.freeze({ |
| 50 | status: ClearChargingProfileStatus.UNKNOWN, |
| 51 | }); |
| 52 | |
| 53 | static readonly OCPP_RESPONSE_UNLOCKED = Object.freeze({ status: UnlockStatus.UNLOCKED }); |
| 54 | static readonly OCPP_RESPONSE_UNLOCK_FAILED = Object.freeze({ |
| 55 | status: UnlockStatus.UNLOCK_FAILED, |
| 56 | }); |
| 57 | |
| 58 | static readonly OCPP_RESPONSE_UNLOCK_NOT_SUPPORTED = Object.freeze({ |
| 59 | status: UnlockStatus.NOT_SUPPORTED, |
| 60 | }); |
| 61 | |
| 62 | static readonly OCPP_AVAILABILITY_RESPONSE_ACCEPTED = Object.freeze({ |
| 63 | status: AvailabilityStatus.ACCEPTED, |
| 64 | }); |
| 65 | |
| 66 | static readonly OCPP_AVAILABILITY_RESPONSE_REJECTED = Object.freeze({ |
| 67 | status: AvailabilityStatus.REJECTED, |
| 68 | }); |
| 69 | |
| 70 | static readonly OCPP_AVAILABILITY_RESPONSE_SCHEDULED = Object.freeze({ |
| 71 | status: AvailabilityStatus.SCHEDULED, |
| 72 | }); |
| 73 | |
| 74 | static readonly OCPP_TRIGGER_MESSAGE_RESPONSE_ACCEPTED = Object.freeze({ |
| 75 | status: TriggerMessageStatus.ACCEPTED, |
| 76 | }); |
| 77 | |
| 78 | static readonly OCPP_TRIGGER_MESSAGE_RESPONSE_REJECTED = Object.freeze({ |
| 79 | status: TriggerMessageStatus.REJECTED, |
| 80 | }); |
| 81 | |
| 82 | static readonly OCPP_TRIGGER_MESSAGE_RESPONSE_NOT_IMPLEMENTED = Object.freeze({ |
| 83 | status: TriggerMessageStatus.NOT_IMPLEMENTED, |
| 84 | }); |
| 85 | |
| 86 | static readonly OCPP_DEFAULT_BOOT_NOTIFICATION_INTERVAL = 60000; // Ms |
| 87 | static readonly OCPP_WEBSOCKET_TIMEOUT = 60000; // Ms |
| 88 | static readonly OCPP_TRIGGER_MESSAGE_DELAY = 500; // Ms |
| 89 | |
| 90 | static readonly CHARGING_STATION_DEFAULT_RESET_TIME = 60000; // Ms |
| 91 | static readonly CHARGING_STATION_ATG_INITIALIZATION_TIME = 1000; // Ms |
| 92 | static readonly CHARGING_STATION_ATG_DEFAULT_STOP_AFTER_HOURS = 0.25; // Hours |
| 93 | static readonly CHARGING_STATION_CONFIGURATION_SECTIONS = Object.freeze([ |
| 94 | 'stationInfo', |
| 95 | 'configurationKey', |
| 96 | 'configurationHash', |
| 97 | ]); |
| 98 | |
| 99 | static readonly DEFAULT_HASH_ALGORITHM = 'sha384'; |
| 100 | |
| 101 | static readonly DEFAULT_IDTAG = '00000000'; |
| 102 | |
| 103 | static readonly DEFAULT_CONNECTION_TIMEOUT = 30; |
| 104 | |
| 105 | static readonly DEFAULT_LOG_STATISTICS_INTERVAL = 60; // Seconds |
| 106 | |
| 107 | static readonly DEFAULT_HEARTBEAT_INTERVAL = 60000; // Ms |
| 108 | |
| 109 | static readonly SUPPORTED_MEASURANDS = Object.freeze([ |
| 110 | MeterValueMeasurand.STATE_OF_CHARGE, |
| 111 | MeterValueMeasurand.VOLTAGE, |
| 112 | MeterValueMeasurand.POWER_ACTIVE_IMPORT, |
| 113 | MeterValueMeasurand.CURRENT_IMPORT, |
| 114 | MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER, |
| 115 | ]); |
| 116 | |
| 117 | static readonly DEFAULT_FLUCTUATION_PERCENT = 5; |
| 118 | |
| 119 | static readonly DEFAULT_PERFORMANCE_RECORDS_FILENAME = 'performanceRecords.json'; |
| 120 | static readonly DEFAULT_PERFORMANCE_RECORDS_DB_NAME = 'emobility-charging-stations-simulator'; |
| 121 | static readonly PERFORMANCE_RECORDS_TABLE = 'performance_records'; |
| 122 | |
| 123 | static readonly DEFAULT_UI_WEBSOCKET_SERVER_HOST = 'localhost'; |
| 124 | static readonly DEFAULT_UI_WEBSOCKET_SERVER_PORT = 8080; |
| 125 | } |