ae049bd0b963c64f2159f9997ee819f343ca6e16
[e-mobility-charging-stations-simulator.git] / ui / web / src / types / ChargingStationType.ts
1 import type { JsonObject } from './JsonType';
2
3 export type ChargingStationData = {
4 stationInfo: ChargingStationInfo;
5 started: boolean;
6 wsState?:
7 | typeof WebSocket.CONNECTING
8 | typeof WebSocket.OPEN
9 | typeof WebSocket.CLOSING
10 | typeof WebSocket.CLOSED;
11 bootNotificationResponse: BootNotificationResponse;
12 connectors: ConnectorStatus[];
13 automaticTransactionGeneratorStatuses?: Status[];
14 };
15
16 export type ChargingStationInfo = {
17 hashId: string;
18 chargingStationId?: string;
19 chargePointModel: string;
20 chargePointVendor: string;
21 firmwareVersion?: string;
22 numberOfConnectors?: number | number[];
23 baseName: string;
24 infoHash?: string;
25 templateHash?: string;
26 chargeBoxSerialNumber?: string;
27 chargePointSerialNumber?: string;
28 meterSerialNumber?: string;
29 maximumPower?: number; // Always in Watt
30 maximumAmperage?: number; // Always in Ampere
31 supervisionUrls?: string | string[];
32 supervisionUrlOcppConfiguration?: boolean;
33 supervisionUrlOcppKey?: string;
34 supervisionUser?: string;
35 supervisionPassword?: string;
36 ocppVersion?: OCPPVersion;
37 ocppProtocol?: OCPPProtocol;
38 ocppStrictCompliance?: boolean;
39 ocppPersistentConfiguration?: boolean;
40 stationInfoPersistentConfiguration?: boolean;
41 authorizationFile?: string;
42 nameSuffix?: string;
43 fixedName?: boolean;
44 iccid?: string;
45 imsi?: string;
46 meterType?: string;
47 powerSharedByConnectors?: boolean;
48 currentOutType?: CurrentType;
49 voltageOut?: Voltage;
50 numberOfPhases?: number;
51 useConnectorId0?: boolean;
52 randomConnectors?: boolean;
53 resetTime?: number;
54 autoRegister?: boolean;
55 autoReconnectMaxRetries?: number;
56 reconnectExponentialDelay?: boolean;
57 registrationMaxRetries?: number;
58 enableStatistics?: boolean;
59 mustAuthorizeAtRemoteStart?: boolean;
60 amperageLimitationOcppKey?: string;
61 amperageLimitationUnit?: AmpereUnits;
62 beginEndMeterValues?: boolean;
63 outOfOrderEndMeterValues?: boolean;
64 meteringPerTransaction?: boolean;
65 transactionDataMeterValues?: boolean;
66 mainVoltageMeterValues?: boolean;
67 phaseLineToLineVoltageMeterValues?: boolean;
68 customValueLimitationMeterValues?: boolean;
69 commandsSupport?: CommandsSupport;
70 messageTriggerSupport?: Record<MessageTrigger, boolean>;
71 };
72
73 export enum OCPP16IncomingRequestCommand {
74 RESET = 'Reset',
75 CLEAR_CACHE = 'ClearCache',
76 CHANGE_AVAILABILITY = 'ChangeAvailability',
77 UNLOCK_CONNECTOR = 'UnlockConnector',
78 GET_CONFIGURATION = 'GetConfiguration',
79 CHANGE_CONFIGURATION = 'ChangeConfiguration',
80 SET_CHARGING_PROFILE = 'SetChargingProfile',
81 CLEAR_CHARGING_PROFILE = 'ClearChargingProfile',
82 REMOTE_START_TRANSACTION = 'RemoteStartTransaction',
83 REMOTE_STOP_TRANSACTION = 'RemoteStopTransaction',
84 GET_DIAGNOSTICS = 'GetDiagnostics',
85 TRIGGER_MESSAGE = 'TriggerMessage',
86 }
87
88 export type IncomingRequestCommand = OCPP16IncomingRequestCommand;
89
90 export const IncomingRequestCommand = {
91 ...OCPP16IncomingRequestCommand,
92 };
93
94 export enum OCPP16RequestCommand {
95 BOOT_NOTIFICATION = 'BootNotification',
96 HEARTBEAT = 'Heartbeat',
97 STATUS_NOTIFICATION = 'StatusNotification',
98 AUTHORIZE = 'Authorize',
99 START_TRANSACTION = 'StartTransaction',
100 STOP_TRANSACTION = 'StopTransaction',
101 METER_VALUES = 'MeterValues',
102 DIAGNOSTICS_STATUS_NOTIFICATION = 'DiagnosticsStatusNotification',
103 }
104
105 export type RequestCommand = OCPP16RequestCommand;
106
107 export const RequestCommand = {
108 ...OCPP16RequestCommand,
109 };
110
111 export type BootNotificationResponse = OCPP16BootNotificationResponse;
112
113 export enum OCPP16RegistrationStatus {
114 ACCEPTED = 'Accepted',
115 PENDING = 'Pending',
116 REJECTED = 'Rejected',
117 }
118
119 export interface OCPP16BootNotificationResponse extends JsonObject {
120 status: OCPP16RegistrationStatus;
121 currentTime: string;
122 interval: number;
123 }
124
125 export enum OCPP16MessageTrigger {
126 BootNotification = 'BootNotification',
127 DiagnosticsStatusNotification = 'DiagnosticsStatusNotification',
128 FirmwareStatusNotification = 'FirmwareStatusNotification',
129 Heartbeat = 'Heartbeat',
130 MeterValues = 'MeterValues',
131 StatusNotification = 'StatusNotification',
132 }
133
134 export type MessageTrigger = OCPP16MessageTrigger;
135
136 export const MessageTrigger = {
137 ...OCPP16MessageTrigger,
138 };
139
140 type CommandsSupport = {
141 incomingCommands: Record<IncomingRequestCommand, boolean>;
142 outgoingCommands?: Record<RequestCommand, boolean>;
143 };
144
145 export enum OCPPVersion {
146 VERSION_16 = '1.6',
147 VERSION_20 = '2.0',
148 }
149
150 export enum OCPPProtocol {
151 JSON = 'json',
152 }
153
154 export enum CurrentType {
155 AC = 'AC',
156 DC = 'DC',
157 }
158
159 export enum Voltage {
160 VOLTAGE_110 = 110,
161 VOLTAGE_230 = 230,
162 VOLTAGE_400 = 400,
163 VOLTAGE_800 = 800,
164 }
165
166 export enum AmpereUnits {
167 MILLI_AMPERE = 'mA',
168 CENTI_AMPERE = 'cA',
169 DECI_AMPERE = 'dA',
170 AMPERE = 'A',
171 }
172
173 export type ConnectorStatus = {
174 availability: AvailabilityType;
175 bootStatus?: ChargePointStatus;
176 status?: ChargePointStatus;
177 authorizeIdTag?: string;
178 idTagAuthorized?: boolean;
179 localAuthorizeIdTag?: string;
180 idTagLocalAuthorized?: boolean;
181 transactionRemoteStarted?: boolean;
182 transactionStarted?: boolean;
183 transactionId?: number;
184 transactionIdTag?: string;
185 energyActiveImportRegisterValue?: number; // In Wh
186 transactionEnergyActiveImportRegisterValue?: number; // In Wh
187 };
188
189 export type AvailabilityType = OCPP16AvailabilityType;
190
191 export enum OCPP16AvailabilityType {
192 INOPERATIVE = 'Inoperative',
193 OPERATIVE = 'Operative',
194 }
195
196 export type ChargePointStatus = OCPP16ChargePointStatus;
197
198 export enum OCPP16ChargePointStatus {
199 AVAILABLE = 'Available',
200 PREPARING = 'Preparing',
201 CHARGING = 'Charging',
202 OCCUPIED = 'Occupied',
203 SUSPENDED_EVSE = 'SuspendedEVSE',
204 SUSPENDED_EV = 'SuspendedEV',
205 FINISHING = 'Finishing',
206 RESERVED = 'Reserved',
207 UNAVAILABLE = 'Unavailable',
208 FAULTED = 'Faulted',
209 }
210
211 export type Status = {
212 start?: boolean;
213 startDate?: Date;
214 lastRunDate?: Date;
215 stopDate?: Date;
216 stoppedDate?: Date;
217 authorizeRequests?: number;
218 acceptedAuthorizeRequests?: number;
219 rejectedAuthorizeRequests?: number;
220 startTransactionRequests?: number;
221 acceptedStartTransactionRequests?: number;
222 rejectedStartTransactionRequests?: number;
223 stopTransactionRequests?: number;
224 acceptedStopTransactionRequests?: number;
225 rejectedStopTransactionRequests?: number;
226 skippedConsecutiveTransactions?: number;
227 skippedTransactions?: number;
228 };