Move web ui code in its own directory
[e-mobility-charging-stations-simulator.git] / ui / web / src / types / ChargingStationType.ts
CommitLineData
6c1761d4 1import type { JsonObject } from './JsonType';
ce7a4fc3 2
32de5a57 3export type ChargingStationData = {
32de5a57 4 stationInfo: ChargingStationInfo;
452a82ca 5 started: boolean;
36999e77
JB
6 wsState?:
7 | typeof WebSocket.CONNECTING
8 | typeof WebSocket.OPEN
9 | typeof WebSocket.CLOSING
10 | typeof WebSocket.CLOSED;
ce7a4fc3 11 bootNotificationResponse: BootNotificationResponse;
32de5a57 12 connectors: ConnectorStatus[];
02cde3b7 13 automaticTransactionGeneratorStatuses?: Status[];
32de5a57
LM
14};
15
16export type ChargingStationInfo = {
51c83d6f 17 hashId: string;
32de5a57
LM
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;
03ebf4c1 59 mustAuthorizeAtRemoteStart?: boolean;
32de5a57
LM
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};
71
72export enum OCPP16IncomingRequestCommand {
73 RESET = 'Reset',
74 CLEAR_CACHE = 'ClearCache',
75 CHANGE_AVAILABILITY = 'ChangeAvailability',
76 UNLOCK_CONNECTOR = 'UnlockConnector',
77 GET_CONFIGURATION = 'GetConfiguration',
78 CHANGE_CONFIGURATION = 'ChangeConfiguration',
79 SET_CHARGING_PROFILE = 'SetChargingProfile',
80 CLEAR_CHARGING_PROFILE = 'ClearChargingProfile',
81 REMOTE_START_TRANSACTION = 'RemoteStartTransaction',
82 REMOTE_STOP_TRANSACTION = 'RemoteStopTransaction',
83 GET_DIAGNOSTICS = 'GetDiagnostics',
84 TRIGGER_MESSAGE = 'TriggerMessage',
85}
86
87export type IncomingRequestCommand = OCPP16IncomingRequestCommand;
88
89export const IncomingRequestCommand = {
90 ...OCPP16IncomingRequestCommand,
91};
92
93export enum OCPP16RequestCommand {
94 BOOT_NOTIFICATION = 'BootNotification',
95 HEARTBEAT = 'Heartbeat',
96 STATUS_NOTIFICATION = 'StatusNotification',
97 AUTHORIZE = 'Authorize',
98 START_TRANSACTION = 'StartTransaction',
99 STOP_TRANSACTION = 'StopTransaction',
100 METER_VALUES = 'MeterValues',
101 DIAGNOSTICS_STATUS_NOTIFICATION = 'DiagnosticsStatusNotification',
102}
103
104export type RequestCommand = OCPP16RequestCommand;
105
106export const RequestCommand = {
107 ...OCPP16RequestCommand,
108};
109
ce7a4fc3
JB
110export type BootNotificationResponse = OCPP16BootNotificationResponse;
111
112export enum OCPP16RegistrationStatus {
113 ACCEPTED = 'Accepted',
114 PENDING = 'Pending',
115 REJECTED = 'Rejected',
116}
117
118export interface OCPP16BootNotificationResponse extends JsonObject {
119 status: OCPP16RegistrationStatus;
120 currentTime: string;
121 interval: number;
122}
123
284900bc 124type CommandsSupport = {
32de5a57
LM
125 incomingCommands: Record<IncomingRequestCommand, boolean>;
126 outgoingCommands?: Record<RequestCommand, boolean>;
284900bc 127};
32de5a57
LM
128
129export enum OCPPVersion {
130 VERSION_16 = '1.6',
131 VERSION_20 = '2.0',
132}
133
134export enum OCPPProtocol {
135 SOAP = 'soap',
136 JSON = 'json',
137}
138
139export enum CurrentType {
140 AC = 'AC',
141 DC = 'DC',
142}
143
144export enum Voltage {
145 VOLTAGE_110 = 110,
146 VOLTAGE_230 = 230,
147 VOLTAGE_400 = 400,
148 VOLTAGE_800 = 800,
149}
150
151export enum AmpereUnits {
152 MILLI_AMPERE = 'mA',
153 CENTI_AMPERE = 'cA',
154 DECI_AMPERE = 'dA',
155 AMPERE = 'A',
156}
157
158export type ConnectorStatus = {
159 availability: AvailabilityType;
160 bootStatus?: ChargePointStatus;
161 status?: ChargePointStatus;
162 authorizeIdTag?: string;
163 idTagAuthorized?: boolean;
164 localAuthorizeIdTag?: string;
165 idTagLocalAuthorized?: boolean;
166 transactionRemoteStarted?: boolean;
167 transactionStarted?: boolean;
168 transactionId?: number;
169 transactionIdTag?: string;
170 energyActiveImportRegisterValue?: number; // In Wh
171 transactionEnergyActiveImportRegisterValue?: number; // In Wh
172};
173
174export type AvailabilityType = OCPP16AvailabilityType;
175
176export enum OCPP16AvailabilityType {
177 INOPERATIVE = 'Inoperative',
178 OPERATIVE = 'Operative',
179}
180
181export type ChargePointStatus = OCPP16ChargePointStatus;
182
183export enum OCPP16ChargePointStatus {
184 AVAILABLE = 'Available',
185 PREPARING = 'Preparing',
186 CHARGING = 'Charging',
187 OCCUPIED = 'Occupied',
188 SUSPENDED_EVSE = 'SuspendedEVSE',
189 SUSPENDED_EV = 'SuspendedEV',
190 FINISHING = 'Finishing',
191 RESERVED = 'Reserved',
192 UNAVAILABLE = 'Unavailable',
193 FAULTED = 'Faulted',
194}
02cde3b7
JB
195
196export type Status = {
197 start?: boolean;
198 startDate?: Date;
199 lastRunDate?: Date;
200 stopDate?: Date;
201 stoppedDate?: Date;
202 authorizeRequests?: number;
203 acceptedAuthorizeRequests?: number;
204 rejectedAuthorizeRequests?: number;
205 startTransactionRequests?: number;
206 acceptedStartTransactionRequests?: number;
207 rejectedStartTransactionRequests?: number;
208 stopTransactionRequests?: number;
6d9876e7
JB
209 acceptedStopTransactionRequests?: number;
210 rejectedStopTransactionRequests?: number;
02cde3b7
JB
211 skippedConsecutiveTransactions?: number;
212 skippedTransactions?: number;
213};