export default abstract class AbstractUIService {
private static readonly ProcedureNameToBroadCastChannelProcedureNameMap: Omit<
Record<ProcedureName, BroadcastChannelProcedureName>,
- 'startSimulator' | 'stopSimulator' | 'listChargingStations'
+ | ProcedureName.START_SIMULATOR
+ | ProcedureName.STOP_SIMULATOR
+ | ProcedureName.LIST_CHARGING_STATIONS
> = {
[ProcedureName.START_CHARGING_STATION]: BroadcastChannelProcedureName.START_CHARGING_STATION,
[ProcedureName.STOP_CHARGING_STATION]: BroadcastChannelProcedureName.STOP_CHARGING_STATION,
import type { ChargingStationTemplate } from './ChargingStationTemplate';
-export interface ChargingStationInfo
- extends Omit<
- ChargingStationTemplate,
- | 'AutomaticTransactionGenerator'
- | 'Configuration'
- | 'power'
- | 'powerUnit'
- | 'chargeBoxSerialNumberPrefix'
- | 'chargePointSerialNumberPrefix'
- | 'meterSerialNumberPrefix'
- > {
+export type ChargingStationInfo = Omit<
+ ChargingStationTemplate,
+ | 'AutomaticTransactionGenerator'
+ | 'Configuration'
+ | 'power'
+ | 'powerUnit'
+ | 'chargeBoxSerialNumberPrefix'
+ | 'chargePointSerialNumberPrefix'
+ | 'meterSerialNumberPrefix'
+> & {
hashId: string;
infoHash?: string;
chargingStationId?: string;
meterSerialNumber?: string;
maximumPower?: number; // Always in Watt
maximumAmperage?: number; // Always in Ampere
-}
+};
export type ChargingStationInfoConfiguration = {
stationInfo?: ChargingStationInfo;
import type { OCPPConfigurationKey } from './ocpp/Configuration';
-export interface ConfigurationKey extends OCPPConfigurationKey {
+export type ConfigurationKey = OCPPConfigurationKey & {
visible?: boolean;
reboot?: boolean;
-}
+};
export type ChargingStationOcppConfiguration = {
configurationKey?: ConfigurationKey[];
+import type { WebSocket } from 'ws';
+
import type { Status } from './AutomaticTransactionGenerator';
import type { ChargingStationInfo } from './ChargingStationInfo';
import type { ConnectorStatus } from './ConnectorStatus';
export interface ChargingStationData extends WorkerData {
stationInfo: ChargingStationInfo;
started: boolean;
- wsState?: number;
+ wsState?:
+ | typeof WebSocket.CONNECTING
+ | typeof WebSocket.OPEN
+ | typeof WebSocket.CLOSING
+ | typeof WebSocket.CLOSED;
bootNotificationResponse: BootNotificationResponse;
connectors: ConnectorStatus[];
automaticTransactionGeneratorStatuses?: Status[];
export type ChargingStationWorkerMessageData = ChargingStationData | Statistics;
-export interface ChargingStationWorkerMessage<T extends WorkerData>
- extends Omit<WorkerMessage<T>, 'id'> {
+export type ChargingStationWorkerMessage<T extends WorkerData> = Omit<WorkerMessage<T>, 'id'> & {
id: ChargingStationWorkerMessageEvents;
-}
+};
import type { SampledValue } from './ocpp/MeterValues';
-export interface SampledValueTemplate extends SampledValue {
+export type SampledValueTemplate = SampledValue & {
fluctuationPercent?: number;
-}
+};
export type MeasurandPerPhaseSampledValueTemplates = {
L1?: SampledValueTemplate;
* Targeted to DC related values calculation.
*/
export class DCElectricUtils {
+ private constructor() {
+ // This is intentional
+ }
+
static power(V: number, I: number): number {
return V * I;
}
const logger: Logger = createLogger({
level: Configuration.getLogLevel(),
format: format.combine(format.splat(), (format[Configuration.getLogFormat()] as () => Format)()),
- transports: transports,
+ transports,
});
//