Added connector id in power conversion
MODIFY
src/integration/charging-station-vendor/ChargingStationVendorIntegration.ts
src/integration/charging-station-vendor/ChargingStationVendorIntegration.ts
@@ -436,7 +436,8 @@ export default abstract class ChargingStationVendorIntegration {
chargingRateUnit: chargingStation.powerLimitUnit
});
// Convert
- connectorResult.chargingSchedule = this.convertFromVendorChargingSchedule(chargingStation, connectorResult.chargingSchedule);
+ connectorResult.chargingSchedule = this.convertFromVendorChargingSchedule(
+ chargingStation, connectorResult.connectorId, connectorResult.chargingSchedule);
results.push(connectorResult);
}
Logging.logDebug({
@@ -458,7 +459,8 @@ export default abstract class ChargingStationVendorIntegration {
detailedMessages: { result }
});
// Convert
- result.chargingSchedule = this.convertFromVendorChargingSchedule(chargingStation, result.chargingSchedule);
+ result.chargingSchedule = this.convertFromVendorChargingSchedule(
+ chargingStation, result.connectorId, result.chargingSchedule);
return result;
}
// Connector ID > 0
@@ -477,7 +479,8 @@ export default abstract class ChargingStationVendorIntegration {
detailedMessages: { result }
});
// Convert
- result.chargingSchedule = this.convertFromVendorChargingSchedule(chargingStation, result.chargingSchedule);
+ result.chargingSchedule = this.convertFromVendorChargingSchedule(
+ chargingStation, result.connectorId, result.chargingSchedule);
return result;
} catch (error) {
Logging.logError({

MODIFY
src/integration/charging-station-vendor/delta/DeltaChargingStationVendorIntegration.ts
src/integration/charging-station-vendor/delta/DeltaChargingStationVendorIntegration.ts
@@ -32,7 +32,7 @@ export default class DeltaChargingStationVendorIntegration extends ChargingStati
chargingStation.connectors.length : 1) / Utils.getNumberOfConnectedPhases(chargingStation, chargingProfile.connectorID);
// Check Unit
if (chargingStation.powerLimitUnit === PowerLimitUnits.WATT) {
- schedulePeriod.limit = Utils.convertAmpToWatt(chargingStation, schedulePeriod.limit);
+ schedulePeriod.limit = Utils.convertAmpToWatt(chargingStation, chargingProfile.connectorID, schedulePeriod.limit);
}
}
}
@@ -48,7 +48,7 @@ export default class DeltaChargingStationVendorIntegration extends ChargingStati
for (const chargingSchedulePeriod of chargingSchedule.chargingSchedulePeriod) {
// Convert to Amps?
if (chargingSchedule.chargingRateUnit === ChargingRateUnitType.WATT) {
- chargingSchedulePeriod.limit = Utils.convertWattToAmp(chargingStation, chargingSchedulePeriod.limit);
+ chargingSchedulePeriod.limit = Utils.convertWattToAmp(chargingStation, connectorID, chargingSchedulePeriod.limit);
}
// Limit is per connector and per phase Convert to max Amp
chargingSchedulePeriod.limit = chargingSchedulePeriod.limit * (connectorID === 0 ?

MODIFY
src/integration/charging-station-vendor/schneider/SchneiderChargingStationVendorIntegration.ts
src/integration/charging-station-vendor/schneider/SchneiderChargingStationVendorIntegration.ts
@@ -32,7 +32,7 @@ export default class SchneiderChargingStationVendorIntegration extends ChargingS
chargingStation.connectors.length : 1) / Utils.getNumberOfConnectedPhases(chargingStation, chargingProfile.connectorID);
// Check Unit
if (chargingStation.powerLimitUnit === PowerLimitUnits.WATT) {
- schedulePeriod.limit = Utils.convertAmpToWatt(chargingStation, schedulePeriod.limit);
+ schedulePeriod.limit = Utils.convertAmpToWatt(chargingStation, chargingProfile.connectorID, schedulePeriod.limit);
}
}
}
@@ -48,7 +48,7 @@ export default class SchneiderChargingStationVendorIntegration extends ChargingS
for (const chargingSchedulePeriod of chargingSchedule.chargingSchedulePeriod) {
// Convert to Amps?
if (chargingSchedule.chargingRateUnit === ChargingRateUnitType.WATT) {
- chargingSchedulePeriod.limit = Utils.convertWattToAmp(chargingStation, chargingSchedulePeriod.limit);
+ chargingSchedulePeriod.limit = Utils.convertWattToAmp(chargingStation, connectorID, chargingSchedulePeriod.limit);
}
// Limit is per connector and per phase Convert to max Amp
chargingSchedulePeriod.limit = chargingSchedulePeriod.limit * (connectorID === 0 ?

MODIFY
src/integration/charging-station-vendor/webasto/WebastoChargingStationVendorIntegration.ts
src/integration/charging-station-vendor/webasto/WebastoChargingStationVendorIntegration.ts
@@ -32,7 +32,7 @@ export default class WebastoChargingStationVendorIntegration extends ChargingSta
chargingStation.connectors.length : 1) / Utils.getNumberOfConnectedPhases(chargingStation, chargingProfile.connectorID);
// Check Unit
if (chargingStation.powerLimitUnit === PowerLimitUnits.WATT) {
- schedulePeriod.limit = Utils.convertAmpToWatt(chargingStation, schedulePeriod.limit);
+ schedulePeriod.limit = Utils.convertAmpToWatt(chargingStation, chargingProfile.connectorID, schedulePeriod.limit);
}
}
}
@@ -48,7 +48,7 @@ export default class WebastoChargingStationVendorIntegration extends ChargingSta
for (const chargingSchedulePeriod of chargingSchedule.chargingSchedulePeriod) {
// Convert to Amps?
if (chargingSchedule.chargingRateUnit === ChargingRateUnitType.WATT) {
- chargingSchedulePeriod.limit = Utils.convertWattToAmp(chargingStation, chargingSchedulePeriod.limit);
+ chargingSchedulePeriod.limit = Utils.convertWattToAmp(chargingStation, connectorID, chargingSchedulePeriod.limit);
}
// Limit is per connector and per phase Convert to max Amp
chargingSchedulePeriod.limit = chargingSchedulePeriod.limit * (connectorID === 0 ?

MODIFY
src/migration/tasks/AddSiteAreaLimitToConsumptionsTask.ts
src/migration/tasks/AddSiteAreaLimitToConsumptionsTask.ts
@@ -33,7 +33,7 @@ export default class AddSiteAreaLimitToConsumptionsTask extends MigrationTask {
},
{
$set: {
- limitSiteAreaAmps: Utils.convertWattToAmp(1, siteArea.maximumPower),
+ limitSiteAreaAmps: siteArea.maximumPower / 230,
limitSiteAreaWatts: siteArea.maximumPower,
limitSiteAreaSource: SiteAreaLimitSource.SITE_AREA
}
@@ -55,7 +55,7 @@ export default class AddSiteAreaLimitToConsumptionsTask extends MigrationTask {
},
{
$set: {
- limitSiteAreaAmps: Utils.convertWattToAmp(1, limitSiteAreaWatts),
+ limitSiteAreaAmps: limitSiteAreaWatts / 230,
limitSiteAreaWatts: limitSiteAreaWatts,
limitSiteAreaSource: SiteAreaLimitSource.CHARGING_STATIONS
}

MODIFY
src/server/ocpi/OCPIUtils.ts
src/server/ocpi/OCPIUtils.ts
@@ -122,7 +122,6 @@ export default class OCPIUtils {
*/
public static buildEvseID(countryCode: string, partyId: string, chargingStation: ChargingStation, connector?: Connector): string {
let evseID = `${countryCode}*${partyId}*E${chargingStation.id}`;
- if (!chargingStation.cannotChargeInParallel) {
if (!connector) {
for (const _connector of chargingStation.connectors) {
if (_connector) {
@@ -132,7 +131,6 @@ export default class OCPIUtils {
}
}
evseID = `${evseID}*${connector.connectorId}`;
- }
return evseID.replace(/[\W_]+/g, '*').toUpperCase();
}
@@ -142,9 +140,6 @@ export default class OCPIUtils {
* @param {*} connector the connector used to build the evse id
*/
public static buildEvseUID(chargingStation: ChargingStation, connector?: Connector): string {
- if (chargingStation.cannotChargeInParallel) {
- return chargingStation.id;
- }
if (!connector) {
for (const _connector of chargingStation.connectors) {
if (_connector) {
@@ -163,9 +158,7 @@ export default class OCPIUtils {
*/
public static buildEvseUIDs(chargingStation: ChargingStation, connector?: Connector): string[] {
const evseUIDs = [];
- if (chargingStation.cannotChargeInParallel) {
- evseUIDs.push(chargingStation.id);
- } else if (connector) {
+ if (connector) {
evseUIDs.push(`${chargingStation.id}*${connector.connectorId}`);
} else if (chargingStation.connectors) {
for (const _connector of chargingStation.connectors) {

MODIFY
src/server/ocpi/ocpi-services-impl/ocpi-2.1.1/OCPIMapping.ts
src/server/ocpi/ocpi-services-impl/ocpi-2.1.1/OCPIMapping.ts
@@ -58,10 +58,9 @@ export default class OCPIMapping {
}
static convertEvseToChargingStation(evseId: string, evse: Partial<OCPIEvse>, location?: OCPILocation): ChargingStation {
- const chargingStation: ChargingStation = {
+ const chargingStation = {
id: evseId,
maximumPower: 0,
- cannotChargeInParallel: true,
issuer: false,
connectors: [],
chargeBoxSerialNumber: evse.evse_id,
@@ -115,11 +114,7 @@ export default class OCPIMapping {
// Convert charging stations to evse(s)
siteArea.chargingStations.forEach((chargingStation) => {
if (chargingStation.issuer === true && !chargingStation.private) {
- if (!chargingStation.cannotChargeInParallel) {
evses.push(...OCPIMapping.convertChargingStation2MultipleEvses(tenant, chargingStation, options));
- } else {
- evses.push(...OCPIMapping.convertChargingStation2UniqueEvse(tenant, chargingStation, options));
- }
}
});
// Return evses

MODIFY
src/server/ocpp/services/OCPPService.ts
src/server/ocpp/services/OCPPService.ts
@@ -1197,7 +1197,7 @@ export default class OCPPService {
// Maximum power of the Site Area provided?
if (chargingStation.siteArea.maximumPower) {
consumption.limitSiteAreaWatts = chargingStation.siteArea.maximumPower;
- consumption.limitSiteAreaAmps = Utils.convertWattToAmp(1, chargingStation.siteArea.maximumPower);
+ consumption.limitSiteAreaAmps = chargingStation.siteArea.maximumPower / 230;
consumption.limitSiteAreaSource = SiteAreaLimitSource.SITE_AREA;
} else {
// Compute it for Charging Stations
@@ -1207,7 +1207,7 @@ export default class OCPPService {
consumption.limitSiteAreaWatts += connector.power;
}
}
- consumption.limitSiteAreaAmps = Utils.convertWattToAmp(1, consumption.limitSiteAreaWatts);
+ consumption.limitSiteAreaAmps = consumption.limitSiteAreaWatts / 230;
consumption.limitSiteAreaSource = SiteAreaLimitSource.CHARGING_STATIONS;
}
}

MODIFY
src/types/ocpp/OCPPServer.ts
src/types/ocpp/OCPPServer.ts
@@ -63,9 +63,11 @@ export interface OCPPStatusNotificationRequestExtended extends OCPPStatusNotific
timezone: string;
}
+// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface OCPPStatusNotificationResponse {
}
+// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface OCPPHeartbeatRequest {
}
@@ -95,6 +97,7 @@ export interface OCPPMeterValuesExtended extends OCPPMeterValues {
values: OCPPMeterValue[];
}
+// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface OCPPMeterValuesResponse {
}
@@ -291,6 +294,7 @@ export enum OCPPDiagnosticsStatus {
UPLOADING = 'Uploading'
}
+// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface OCPPDiagnosticsStatusNotificationResponse {
}
@@ -314,6 +318,7 @@ export interface OCPPFirmwareStatusNotificationRequestExtended extends OCPPFirmw
timezone: string;
}
+// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface OCPPFirmwareStatusNotificationResponse {
}

MODIFY
src/utils/Utils.ts
src/utils/Utils.ts
@@ -486,16 +486,16 @@ export default class Utils {
return totalAmps;
}
- public static convertAmpToWatt(chargingStation: ChargingStation, ampValue: number): number {
- const voltage = Utils.getChargingStationVoltage(chargingStation);
+ public static convertAmpToWatt(chargingStation: ChargingStation, connectorID = 0, ampValue: number): number {
+ const voltage = Utils.getChargingStationVoltage(chargingStation, connectorID);
if (voltage > 0) {
return voltage * ampValue;
}
return 0;
}
- public static convertWattToAmp(chargingStation: ChargingStation, wattValue: number): number {
- const voltage = Utils.getChargingStationVoltage(chargingStation);
+ public static convertWattToAmp(chargingStation: ChargingStation, connectorID = 0, wattValue: number): number {
+ const voltage = Utils.getChargingStationVoltage(chargingStation, connectorID);
if (voltage > 0) {
return Math.floor(wattValue / voltage);
}

Added connector id in power conversion