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