Added instantWatts per phase
MODIFY
src/server/ocpp/services/OCPPService.ts
src/server/ocpp/services/OCPPService.ts
@@ -474,6 +474,16 @@ export default class OCPPService {
consumption.instantAmps = totalAmps;
}
}
+ // Fill Power per Phase
+ if (consumption.instantAmpsL1 > 0 || consumption.instantAmpsL2 > 0 || consumption.instantAmpsL3 > 0) {
+ consumption.instantWattsL1 = Utils.convertAmpToWatt(chargingStation, null, transaction.connectorId, consumption.instantAmpsL1);
+ consumption.instantWattsL2 = Utils.convertAmpToWatt(chargingStation, null, transaction.connectorId, consumption.instantAmpsL2);
+ consumption.instantWattsL3 = Utils.convertAmpToWatt(chargingStation, null, transaction.connectorId, consumption.instantAmpsL3);
+ }
+ // Fill Power per Phase
+ if (consumption.instantAmpsDC > 0 && consumption.instantVoltsDC) {
+ consumption.instantWattsDC = consumption.instantAmpsDC * consumption.instantVoltsDC;
+ }
}
public async handleAuthorize(headers: OCPPHeader, authorize: OCPPAuthorizeRequestExtended): Promise<OCPPIdTagInfo> {

MODIFY
src/server/rest/service/security/TransactionSecurity.ts
src/server/rest/service/security/TransactionSecurity.ts
@@ -303,6 +303,10 @@ export default class TransactionSecurity {
const newConsumption: TransactionConsumption = {
date: consumption.endedAt,
instantWatts: consumption.instantWatts,
+ instantWattsL1: consumption.instantWattsL1,
+ instantWattsL2: consumption.instantWattsL2,
+ instantWattsL3: consumption.instantWattsL3,
+ instantWattsDC: consumption.instantWattsDC,
instantAmps: consumption.instantAmps,
instantAmpsL1: consumption.instantAmpsL1,
instantAmpsL2: consumption.instantAmpsL2,

MODIFY
src/storage/mongodb/ConsumptionStorage.ts
src/storage/mongodb/ConsumptionStorage.ts
@@ -39,6 +39,10 @@ export default class ConsumptionStorage {
roundedAmount: Utils.convertToFloat(consumptionToSave.roundedAmount),
currencyCode: consumptionToSave.currencyCode,
instantWatts: Utils.convertToFloat(consumptionToSave.instantWatts),
+ instantWattsL1: Utils.convertToFloat(consumptionToSave.instantWattsL1),
+ instantWattsL2: Utils.convertToFloat(consumptionToSave.instantWattsL2),
+ instantWattsL3: Utils.convertToFloat(consumptionToSave.instantWattsL3),
+ instantWattsDC: Utils.convertToFloat(consumptionToSave.instantWattsDC),
instantAmps: Utils.convertToFloat(consumptionToSave.instantAmps),
instantAmpsL1: Utils.convertToFloat(consumptionToSave.instantAmpsL1),
instantAmpsL2: Utils.convertToFloat(consumptionToSave.instantAmpsL2),

MODIFY
src/types/Consumption.ts
src/types/Consumption.ts
@@ -19,6 +19,10 @@ export default interface Consumption {
roundedAmount: number;
currencyCode: string;
instantWatts: number;
+ instantWattsL1: number;
+ instantWattsL2: number;
+ instantWattsL3: number;
+ instantWattsDC: number;
instantAmps: number;
instantAmpsL1: number;
instantAmpsL2: number;

MODIFY
src/types/Transaction.ts
src/types/Transaction.ts
@@ -110,6 +110,10 @@ export default interface Transaction {
export interface TransactionConsumption {
date: Date;
instantWatts: number;
+ instantWattsL1: number;
+ instantWattsL2: number;
+ instantWattsL3: number;
+ instantWattsDC: number;
instantAmps: number;
instantAmpsL1: number;
instantAmpsL2: number;

MODIFY
test/api/OCPPCommonTests.ts
test/api/OCPPCommonTests.ts
@@ -634,6 +634,15 @@ export default class OCPPCommonTests {
'instantAmpsL2': checkNewMeterValues ? this.amperageL2MeterValues[i] : 0,
'instantAmpsL3': checkNewMeterValues ? this.amperageL3MeterValues[i] : 0,
'instantWatts': this.powerImportMeterValues[i],
+ 'instantWattsL1': checkNewMeterValues ?
+ Utils.convertAmpToWatt(this.chargingStationContext.getChargingStation(),
+ null, this.newTransaction.connectorId, this.amperageL1MeterValues[i]) : 0,
+ 'instantWattsL2': checkNewMeterValues ?
+ Utils.convertAmpToWatt(this.chargingStationContext.getChargingStation(),
+ null, this.newTransaction.connectorId, this.amperageL2MeterValues[i]) : 0,
+ 'instantWattsL3': checkNewMeterValues ?
+ Utils.convertAmpToWatt(this.chargingStationContext.getChargingStation(),
+ null, this.newTransaction.connectorId, this.amperageL3MeterValues[i]) : 0,
'cumulatedConsumptionWh': transactionCumulatedConsumption,
'cumulatedConsumptionAmps': Utils.convertWattToAmp(this.chargingStationContext.getChargingStation(),
null, this.newTransaction.connectorId, transactionCumulatedConsumption)

Added instantWatts per phase