Updated Charge Point
MODIFY
src/integration/charging-station-vendor/delta/DeltaChargingStationVendorIntegration.ts
src/integration/charging-station-vendor/delta/DeltaChargingStationVendorIntegration.ts
@@ -14,7 +14,7 @@ export default class DeltaChargingStationVendorIntegration extends ChargingStati
}
public getOCPPParamValueForChargingLimitation(chargingStation: ChargingStation, limitAmp: number): number {
- return limitAmp / chargingStation.connectors.length / Utils.getNumberOfConnectedPhases(chargingStation);
+ return limitAmp / chargingStation.connectors.length / Utils.getChargingStationNumberOfConnectedPhases(chargingStation);
}
public convertToVendorChargingProfile(chargingStation: ChargingStation, chargingProfile: ChargingProfile): ChargingProfile {
@@ -29,7 +29,7 @@ export default class DeltaChargingStationVendorIntegration extends ChargingStati
// Divide the power by the number of connectors and number of phases
for (const schedulePeriod of vendorSpecificChargingProfile.profile.chargingSchedule.chargingSchedulePeriod) {
schedulePeriod.limit = schedulePeriod.limit / (vendorSpecificChargingProfile.connectorID === 0 ?
- chargingStation.connectors.length : 1) / Utils.getNumberOfConnectedPhases(chargingStation, chargingProfile.connectorID);
+ chargingStation.connectors.length : 1) / Utils.getChargingStationNumberOfConnectedPhases(chargingStation, chargingProfile.connectorID);
// Check Unit
if (chargingStation.powerLimitUnit === PowerLimitUnits.WATT) {
schedulePeriod.limit = Utils.convertAmpToWatt(chargingStation, chargingProfile.connectorID, schedulePeriod.limit);
@@ -52,7 +52,7 @@ export default class DeltaChargingStationVendorIntegration extends ChargingStati
}
// Limit is per connector and per phase Convert to max Amp
chargingSchedulePeriod.limit = chargingSchedulePeriod.limit * (connectorID === 0 ?
- chargingStation.connectors.length : 1) * Utils.getNumberOfConnectedPhases(chargingStation, connectorID);
+ chargingStation.connectors.length : 1) * Utils.getChargingStationNumberOfConnectedPhases(chargingStation, connectorID);
}
}
// Convert to Amps?

MODIFY
src/integration/charging-station-vendor/schneider/SchneiderChargingStationVendorIntegration.ts
src/integration/charging-station-vendor/schneider/SchneiderChargingStationVendorIntegration.ts
@@ -14,7 +14,7 @@ export default class SchneiderChargingStationVendorIntegration extends ChargingS
}
public getOCPPParamValueForChargingLimitation(chargingStation: ChargingStation, limitAmp: number): number {
- return limitAmp / chargingStation.connectors.length / Utils.getNumberOfConnectedPhases(chargingStation);
+ return limitAmp / chargingStation.connectors.length / Utils.getChargingStationNumberOfConnectedPhases(chargingStation);
}
public convertToVendorChargingProfile(chargingStation: ChargingStation, chargingProfile: ChargingProfile): ChargingProfile {
@@ -29,7 +29,7 @@ export default class SchneiderChargingStationVendorIntegration extends ChargingS
// Divide the power by the number of connectors and number of phases
for (const schedulePeriod of vendorSpecificChargingProfile.profile.chargingSchedule.chargingSchedulePeriod) {
schedulePeriod.limit = schedulePeriod.limit / (vendorSpecificChargingProfile.connectorID === 0 ?
- chargingStation.connectors.length : 1) / Utils.getNumberOfConnectedPhases(chargingStation, chargingProfile.connectorID);
+ chargingStation.connectors.length : 1) / Utils.getChargingStationNumberOfConnectedPhases(chargingStation, chargingProfile.connectorID);
// Check Unit
if (chargingStation.powerLimitUnit === PowerLimitUnits.WATT) {
schedulePeriod.limit = Utils.convertAmpToWatt(chargingStation, chargingProfile.connectorID, schedulePeriod.limit);
@@ -52,7 +52,7 @@ export default class SchneiderChargingStationVendorIntegration extends ChargingS
}
// Limit is per connector and per phase Convert to max Amp
chargingSchedulePeriod.limit = chargingSchedulePeriod.limit * (connectorID === 0 ?
- chargingStation.connectors.length : 1) * Utils.getNumberOfConnectedPhases(chargingStation, connectorID);
+ chargingStation.connectors.length : 1) * Utils.getChargingStationNumberOfConnectedPhases(chargingStation, connectorID);
}
}
// Convert to Amps?

MODIFY
src/integration/charging-station-vendor/webasto/WebastoChargingStationVendorIntegration.ts
src/integration/charging-station-vendor/webasto/WebastoChargingStationVendorIntegration.ts
@@ -14,7 +14,7 @@ export default class WebastoChargingStationVendorIntegration extends ChargingSta
}
public getOCPPParamValueForChargingLimitation(chargingStation: ChargingStation, limitAmp: number): number {
- return limitAmp / chargingStation.connectors.length / Utils.getNumberOfConnectedPhases(chargingStation);
+ return limitAmp / chargingStation.connectors.length / Utils.getChargingStationNumberOfConnectedPhases(chargingStation);
}
public convertToVendorChargingProfile(chargingStation: ChargingStation, chargingProfile: ChargingProfile): ChargingProfile {
@@ -29,7 +29,7 @@ export default class WebastoChargingStationVendorIntegration extends ChargingSta
// Divide the power by the number of connectors and number of phases
for (const schedulePeriod of vendorSpecificChargingProfile.profile.chargingSchedule.chargingSchedulePeriod) {
schedulePeriod.limit = schedulePeriod.limit / (vendorSpecificChargingProfile.connectorID === 0 ?
- chargingStation.connectors.length : 1) / Utils.getNumberOfConnectedPhases(chargingStation, chargingProfile.connectorID);
+ chargingStation.connectors.length : 1) / Utils.getChargingStationNumberOfConnectedPhases(chargingStation, chargingProfile.connectorID);
// Check Unit
if (chargingStation.powerLimitUnit === PowerLimitUnits.WATT) {
schedulePeriod.limit = Utils.convertAmpToWatt(chargingStation, chargingProfile.connectorID, schedulePeriod.limit);
@@ -52,7 +52,7 @@ export default class WebastoChargingStationVendorIntegration extends ChargingSta
}
// Limit is per connector and per phase Convert to max Amp
chargingSchedulePeriod.limit = chargingSchedulePeriod.limit * (connectorID === 0 ?
- chargingStation.connectors.length : 1) * Utils.getNumberOfConnectedPhases(chargingStation, connectorID);
+ chargingStation.connectors.length : 1) * Utils.getChargingStationNumberOfConnectedPhases(chargingStation, connectorID);
}
}
// Convert to Amps?

MODIFY
src/server/ocpp/utils/OCPPUtils.ts
src/server/ocpp/utils/OCPPUtils.ts
import { ActionsResponse, KeyValue } from '../../../types/GlobalType';
import { ChargingProfile, ChargingProfilePurposeType } from '../../../types/ChargingProfile';
-import ChargingStation, { ChargingStationCapabilities, ChargingStationCurrentType, ChargingStationOcppParameters, ChargingStationTemplate } from '../../../types/ChargingStation';
+import ChargingStation, { ChargingStationCapabilities, ChargingStationOcppParameters, ChargingStationTemplate } from '../../../types/ChargingStation';
import { OCPPChangeConfigurationCommandParam, OCPPChangeConfigurationCommandResult, OCPPChargingProfileStatus, OCPPConfigurationStatus, OCPPGetConfigurationCommandParam } from '../../../types/ocpp/OCPPClient';
import BackendError from '../../../exception/BackendError';
@@ -453,11 +453,6 @@ export default class OCPPUtils {
public static recalculateChargingStationMaxPower(chargingStation: ChargingStation) {
let maximumPower = 0;
- // Only for AC
- // TODO
- // if (chargingStation.currentType !== ChargingStationCurrentType.AC) {
- // return;
- // }
for (const connector of chargingStation.connectors) {
if (Utils.objectHasProperty(connector, 'power')) {
maximumPower += connector.power;

MODIFY
src/storage/mongodb/ChargingStationStorage.ts
src/storage/mongodb/ChargingStationStorage.ts
import { ChargingProfile, ChargingProfilePurposeType } from '../../types/ChargingProfile';
-import ChargingStation, { ChargingStationCurrentType, ChargingStationOcppParameters, ChargingStationTemplate, Connector, ConnectorType, OcppParameter, PowerLimitUnits } from '../../types/ChargingStation';
+import ChargingStation, { ChargingStationOcppParameters, ChargingStationTemplate, Connector, ConnectorType, OcppParameter, PowerLimitUnits } from '../../types/ChargingStation';
import { ChargingStationInError, ChargingStationInErrorType } from '../../types/InError';
import { GridFSBucket, GridFSBucketReadStream } from 'mongodb';
@@ -494,7 +494,6 @@ export default class ChargingStationStorage {
remoteAuthorizations: chargingStationToSave.remoteAuthorizations,
currentIPAddress: chargingStationToSave.currentIPAddress,
capabilities: chargingStationToSave.capabilities,
- ocppAdvancedCommands: chargingStationToSave.ocppAdvancedCommands,
ocppStandardParameters: chargingStationToSave.ocppStandardParameters,
ocppVendorParameters: chargingStationToSave.ocppVendorParameters,
ocpiData: chargingStationToSave.ocpiData
@@ -916,9 +915,6 @@ export default class ChargingStationStorage {
{ 'powerLimitUnit': { $exists: false } }, { 'powerLimitUnit': null },
{ 'powerLimitUnit': { $nin: [PowerLimitUnits.AMPERE, PowerLimitUnits.WATT] } },
{ 'chargingStationURL': { $exists: false } }, { 'chargingStationURL': null }, { 'chargingStationURL': { $eq: '' } },
- { 'cannotChargeInParallel': { $exists: false } }, { 'cannotChargeInParallel': null },
- { 'currentType': { $exists: false } }, { 'currentType': null },
- { 'currentType': { $nin: [ChargingStationCurrentType.AC, ChargingStationCurrentType.DC, ChargingStationCurrentType.AC_DC] } },
{ 'connectors.numberOfConnectedPhase': { $exists: false } }, { 'connectors.numberOfConnectedPhase': null }, { 'connectors.numberOfConnectedPhase': { $nin: [0, 1, 3] } },
{ 'connectors.type': { $exists: false } }, { 'connectors.type': null }, { 'connectors.type': { $eq: '' } },
{ 'connectors.type': { $nin: [ConnectorType.CHADEMO, ConnectorType.COMBO_CCS, ConnectorType.DOMESTIC, ConnectorType.TYPE_1, ConnectorType.TYPE_1_CCS, ConnectorType.TYPE_2, ConnectorType.TYPE_3C] } },

MODIFY
src/types/ChargingStation.ts
src/types/ChargingStation.ts
@@ -43,7 +43,6 @@ export default interface ChargingStation extends CreatedUpdatedProps {
currentIPAddress?: string;
siteArea?: SiteArea;
capabilities?: ChargingStationCapabilities;
- ocppAdvancedCommands?: OcppAdvancedCommands[];
ocppStandardParameters?: KeyValue[];
ocppVendorParameters?: KeyValue[];
ocpiData?: {
@@ -51,12 +50,6 @@ export default interface ChargingStation extends CreatedUpdatedProps {
};
}
-export enum ChargingStationCurrentType {
- AC = 'AC',
- DC = 'DC',
- AC_DC = 'AC/DC',
-}
-
export interface OcppCommand {
command: string;
parameters: string[];
@@ -78,10 +71,6 @@ export enum Command {
UPDATE_FIRMWARE = 'UpdateFirmware',
}
-export interface OcppAdvancedCommands {
- command: string|OcppCommand;
-}
-
export enum PowerLimitUnits {
WATT = 'W',
AMPERE = 'A'
@@ -113,7 +102,7 @@ export interface Connector {
statusLastChangedOn?: Date;
inactivityStatus?: InactivityStatus;
numberOfConnectedPhase?: number;
- currentType?: ConnectorCurrentType;
+ currentType?: CurrentType;
chargePointID?: number;
}
@@ -141,13 +130,13 @@ export enum ConnectorCurrentLimitSource {
CONNECTOR = 'CO'
}
-export enum ConnectorCurrentType {
+export enum CurrentType {
AC = 'AC',
DC = 'DC'
}
export interface ChargePoint {
- currentType: ChargingStationCurrentType;
+ currentType: CurrentType;
voltage: number;
amperage: number;
numberOfConnectedPhase: number;
@@ -180,7 +169,7 @@ export interface ChargingStationTemplate {
amperage?: number;
voltage?: number;
chargePointID?: number;
- currentType?: ConnectorCurrentType;
+ currentType?: CurrentType;
numberOfConnectedPhase?: number;
}[];
};

MODIFY
src/types/requests/HttpChargingStationRequest.ts
src/types/requests/HttpChargingStationRequest.ts
-import { ConnectorCurrentType, ConnectorType } from '../ChargingStation';
+import { ConnectorType, CurrentType } from '../ChargingStation';
import HttpDatabaseRequest from './HttpDatabaseRequest';
@@ -49,7 +49,7 @@ export interface HttpChargingStationParamsUpdateRequest {
power: number;
amperage: number;
voltage: number;
- currentType: ConnectorCurrentType;
+ currentType: CurrentType;
numberOfConnectedPhase: number;
}[];
}

MODIFY
src/utils/Utils.ts
src/utils/Utils.ts
import { ChargePointStatus, OCPPProtocol, OCPPVersion } from '../types/ocpp/OCPPServer';
-import ChargingStation, { ConnectorCurrentType, StaticLimitAmps } from '../types/ChargingStation';
+import ChargingStation, { CurrentType, StaticLimitAmps } from '../types/ChargingStation';
import User, { UserRole, UserStatus } from '../types/User';
import { ActionsResponse } from '../types/GlobalType';
@@ -502,7 +502,7 @@ export default class Utils {
return 0;
}
- public static getNumberOfConnectedPhases(chargingStation: ChargingStation, connectorId = 0): number {
+ public static getChargingStationNumberOfConnectedPhases(chargingStation: ChargingStation, connectorId = 0): number {
if (chargingStation) {
// Check phase at charge point level
if (chargingStation.chargePoints) {
@@ -535,7 +535,7 @@ export default class Utils {
public static getChargingStationVoltage(chargingStation: ChargingStation, connectorId = 0): number {
if (chargingStation) {
// Check voltage at charging station level
- if (connectorId === 0 && chargingStation.voltage > 0) {
+ if (chargingStation.voltage > 0) {
return chargingStation.voltage;
}
// Check voltage at charge point level
@@ -566,6 +566,35 @@ export default class Utils {
return 0;
}
+ public static getChargingStationCurrentType(chargingStation: ChargingStation, connectorId = 0): CurrentType {
+ if (chargingStation) {
+ // Check voltage at charge point level
+ if (chargingStation.chargePoints) {
+ for (const chargePoint of chargingStation.chargePoints) {
+ // Take the first
+ if (connectorId === 0 && chargePoint.currentType) {
+ return chargePoint.currentType;
+ }
+ if (chargePoint.connectorIDs.includes(connectorId) && chargePoint.currentType) {
+ return chargePoint.currentType;
+ }
+ }
+ }
+ // Check voltage at connector level
+ if (chargingStation.connectors) {
+ for (const connector of chargingStation.connectors) {
+ // Take the first
+ if (connectorId === 0 && connector.currentType) {
+ return connector.currentType;
+ }
+ if (connector.connectorId === connectorId && connector.currentType) {
+ return connector.currentType;
+ }
+ }
+ }
+ }
+ return null;
+ }
public static isEmptyArray(array): boolean {
if (Array.isArray(array) && array.length > 0) {

Updated Charge Point