Changed default nbr of phase to 3
MODIFY
src/server/ocpp/services/OCPPService.ts
src/server/ocpp/services/OCPPService.ts
@@ -356,7 +356,9 @@ export default class OCPPService {
// Save all
await ConsumptionStorage.saveConsumption(headers.tenantID, consumption);
}
- if (!transaction.phasesUsed && Utils.checkIfPhasesProvidedInTransactionInProgress(transaction) &&
+ // Get the phases really used from Meter Values (for AC single phase charger/car)
+ if (!transaction.phasesUsed &&
+ Utils.checkIfPhasesProvidedInTransactionInProgress(transaction) &&
transaction.numberOfMeterValues >= 1) {
transaction.phasesUsed = Utils.getUsedPhasesInTransactionInProgress(chargingStation, transaction);
}

MODIFY
src/utils/Utils.ts
src/utils/Utils.ts
@@ -73,20 +73,13 @@ export default class Utils {
public static isTransactionInProgressOnThreePhases(chargingStation: ChargingStation, transaction: Transaction): boolean {
const currentType = Utils.getChargingStationCurrentType(chargingStation, null, transaction.connectorId);
- let threePhases = true;
if (currentType === CurrentType.AC &&
- (transaction.currentInstantAmpsL1 > 0 &&
- (transaction.currentInstantAmpsL2 === 0 ||
- transaction.currentInstantAmpsL3 === 0)) ||
- (transaction.currentInstantAmpsL2 > 0 &&
- (transaction.currentInstantAmpsL1 === 0 ||
- transaction.currentInstantAmpsL3 === 0)) ||
- (transaction.currentInstantAmpsL3 > 0 &&
- (transaction.currentInstantAmpsL1 === 0 ||
- transaction.currentInstantAmpsL2 === 0))) {
- threePhases = false;
+ (transaction.currentInstantAmpsL1 > 0 && (transaction.currentInstantAmpsL2 === 0 || transaction.currentInstantAmpsL3 === 0)) ||
+ (transaction.currentInstantAmpsL2 > 0 && (transaction.currentInstantAmpsL1 === 0 || transaction.currentInstantAmpsL3 === 0)) ||
+ (transaction.currentInstantAmpsL3 > 0 && (transaction.currentInstantAmpsL1 === 0 || transaction.currentInstantAmpsL2 === 0))) {
+ return false;
}
- return threePhases;
+ return true;
}
public static getUsedPhasesInTransactionInProgress(chargingStation: ChargingStation, transaction: Transaction): CSPhasesUsed {
@@ -109,26 +102,26 @@ export default class Utils {
cSPhasesUsed.csPhase3 = true;
}
return cSPhasesUsed;
- // Standard on three phases
}
+ // Standard on three phases
return {
csPhase1: true,
csPhase2: true,
- csPhase3: true };
+ csPhase3: true
+ };
}
public static checkIfPhasesProvidedInTransactionInProgress(transaction: Transaction): boolean {
- if (transaction.currentInstantAmps) {
- if (transaction.currentInstantAmpsL1 > 0 || transaction.currentInstantAmpsL2 > 0 || transaction.currentInstantAmpsL3 > 0) {
- return true;
- }
- }
- return false;
+ return transaction.currentInstantAmps > 0 &&
+ (transaction.currentInstantAmpsL1 > 0 ||
+ transaction.currentInstantAmpsL2 > 0 ||
+ transaction.currentInstantAmpsL3 > 0);
}
public static getNumberOfUsedPhaseInTransactionInProgress(chargingStation: ChargingStation, transaction: Transaction): number {
const currentType = Utils.getChargingStationCurrentType(chargingStation, null, transaction.connectorId);
- let nbrOfPhases = 0;
+ // Default 3 phases
+ let nbrOfPhases = 3;
if (currentType === CurrentType.AC && transaction.phasesUsed) {
if (transaction.phasesUsed.csPhase1) {
nbrOfPhases++;

Changed default nbr of phase to 3