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