| 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 | static readonly OCPP_CONFIGURATION_RESPONSE_REJECTED = Object.freeze({ |
| 21 | status: ConfigurationStatus.REJECTED, |
| 22 | }); |
| 23 | static readonly OCPP_CONFIGURATION_RESPONSE_REBOOT_REQUIRED = Object.freeze({ |
| 24 | status: ConfigurationStatus.REBOOT_REQUIRED, |
| 25 | }); |
| 26 | static readonly OCPP_CONFIGURATION_RESPONSE_NOT_SUPPORTED = Object.freeze({ |
| 27 | status: ConfigurationStatus.NOT_SUPPORTED, |
| 28 | }); |
| 29 | static readonly OCPP_SET_CHARGING_PROFILE_RESPONSE_ACCEPTED = Object.freeze({ |
| 30 | status: ChargingProfileStatus.ACCEPTED, |
| 31 | }); |
| 32 | static readonly OCPP_SET_CHARGING_PROFILE_RESPONSE_REJECTED = Object.freeze({ |
| 33 | status: ChargingProfileStatus.REJECTED, |
| 34 | }); |
| 35 | static readonly OCPP_SET_CHARGING_PROFILE_RESPONSE_NOT_SUPPORTED = Object.freeze({ |
| 36 | status: ChargingProfileStatus.NOT_SUPPORTED, |
| 37 | }); |
| 38 | static readonly OCPP_CLEAR_CHARGING_PROFILE_RESPONSE_ACCEPTED = Object.freeze({ |
| 39 | status: ClearChargingProfileStatus.ACCEPTED, |
| 40 | }); |
| 41 | static readonly OCPP_CLEAR_CHARGING_PROFILE_RESPONSE_UNKNOWN = Object.freeze({ |
| 42 | status: ClearChargingProfileStatus.UNKNOWN, |
| 43 | }); |
| 44 | static readonly OCPP_RESPONSE_UNLOCKED = Object.freeze({ status: UnlockStatus.UNLOCKED }); |
| 45 | static readonly OCPP_RESPONSE_UNLOCK_FAILED = Object.freeze({ |
| 46 | status: UnlockStatus.UNLOCK_FAILED, |
| 47 | }); |
| 48 | static readonly OCPP_RESPONSE_UNLOCK_NOT_SUPPORTED = Object.freeze({ |
| 49 | status: UnlockStatus.NOT_SUPPORTED, |
| 50 | }); |
| 51 | static readonly OCPP_AVAILABILITY_RESPONSE_ACCEPTED = Object.freeze({ |
| 52 | status: AvailabilityStatus.ACCEPTED, |
| 53 | }); |
| 54 | static readonly OCPP_AVAILABILITY_RESPONSE_REJECTED = Object.freeze({ |
| 55 | status: AvailabilityStatus.REJECTED, |
| 56 | }); |
| 57 | static readonly OCPP_AVAILABILITY_RESPONSE_SCHEDULED = Object.freeze({ |
| 58 | status: AvailabilityStatus.SCHEDULED, |
| 59 | }); |
| 60 | static readonly OCPP_TRIGGER_MESSAGE_RESPONSE_ACCEPTED = Object.freeze({ |
| 61 | status: TriggerMessageStatus.ACCEPTED, |
| 62 | }); |
| 63 | static readonly OCPP_TRIGGER_MESSAGE_RESPONSE_REJECTED = Object.freeze({ |
| 64 | status: TriggerMessageStatus.REJECTED, |
| 65 | }); |
| 66 | static readonly OCPP_TRIGGER_MESSAGE_RESPONSE_NOT_IMPLEMENTED = Object.freeze({ |
| 67 | status: TriggerMessageStatus.NOT_IMPLEMENTED, |
| 68 | }); |
| 69 | |
| 70 | static readonly OCPP_DEFAULT_BOOT_NOTIFICATION_INTERVAL = 60000; // Ms |
| 71 | static readonly OCPP_WEBSOCKET_TIMEOUT = 60000; // Ms |
| 72 | static readonly OCPP_TRIGGER_MESSAGE_DELAY = 500; // Ms |
| 73 | |
| 74 | static readonly CHARGING_STATION_DEFAULT_RESET_TIME = 60000; // Ms |
| 75 | static readonly CHARGING_STATION_ATG_INITIALIZATION_TIME = 1000; // Ms |
| 76 | static readonly CHARGING_STATION_ATG_DEFAULT_STOP_AFTER_HOURS = 0.25; // Hours |
| 77 | |
| 78 | static readonly DEFAULT_IDTAG = '00000000'; |
| 79 | |
| 80 | static readonly ELEMENT_START_DELAY = 0; |
| 81 | static readonly WORKER_START_DELAY = 500; |
| 82 | static readonly WORKER_POOL_MAX_INACTIVE_TIME = 60000; |
| 83 | static readonly DEFAULT_WORKER_POOL_MIN_SIZE = 4; |
| 84 | static readonly DEFAULT_WORKER_POOL_MAX_SIZE = 16; |
| 85 | static readonly DEFAULT_CHARGING_STATIONS_PER_WORKER = 1; |
| 86 | |
| 87 | static readonly DEFAULT_CONNECTION_TIMEOUT = 30; |
| 88 | |
| 89 | static readonly DEFAULT_HEARTBEAT_INTERVAL = 60000; // Ms |
| 90 | |
| 91 | static readonly SUPPORTED_MEASURANDS = Object.freeze([ |
| 92 | MeterValueMeasurand.STATE_OF_CHARGE, |
| 93 | MeterValueMeasurand.VOLTAGE, |
| 94 | MeterValueMeasurand.POWER_ACTIVE_IMPORT, |
| 95 | MeterValueMeasurand.CURRENT_IMPORT, |
| 96 | MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER, |
| 97 | ]); |
| 98 | |
| 99 | static readonly DEFAULT_FLUCTUATION_PERCENT = 5; |
| 100 | |
| 101 | static readonly PERFORMANCE_RECORDS_FILETYPE = 'Performance records'; |
| 102 | static readonly DEFAULT_PERFORMANCE_RECORDS_FILENAME = 'performanceRecords.json'; |
| 103 | static readonly DEFAULT_PERFORMANCE_RECORDS_DB_NAME = 'charging-stations-simulator'; |
| 104 | static readonly PERFORMANCE_RECORDS_TABLE = 'performance_records'; |
| 105 | |
| 106 | static readonly DEFAULT_UI_WEBSOCKET_SERVER_HOST = 'localhost'; |
| 107 | static readonly DEFAULT_UI_WEBSOCKET_SERVER_PORT = 8080; |
| 108 | } |