Added consumption A.h
MODIFY
src/migration/tasks/AddInstantAmpsToConsumptionsTask.ts
src/migration/tasks/AddInstantAmpsToConsumptionsTask.ts
@@ -23,6 +23,7 @@ export default class AddInstantAmpsToConsumptionsTask extends MigrationTask {
[
{
'$set': {
+ 'cumulatedConsumptionAmps': { '$round': [{ '$divide': ['$cumulatedConsumption', 230] }] },
'limitSiteAreaAmps': { '$round': [{ '$divide': ['$limitSiteAreaWatts', 230] }] },
'instantAmps': { '$round': [{ '$divide': ['$instantPower', 230] }] }
}

MODIFY
src/server/ocpi/ocpi-services-impl/ocpi-2.1.1/OCPISessionsService.ts
src/server/ocpi/ocpi-services-impl/ocpi-2.1.1/OCPISessionsService.ts
@@ -256,9 +256,10 @@ export default class OCPISessionsService {
startedAt: new Date(transaction.lastMeterValue.timestamp),
endedAt: new Date(session.last_updated),
consumption: transaction.currentConsumptionWh,
- instantPower: Math.round(transaction.currentConsumption),
- instantAmps: transaction.currentConsumption / 230,
+ instantPower: Math.floor(transaction.currentConsumption),
+ instantAmps: Math.floor(transaction.currentConsumption / 230),
cumulatedConsumption: transaction.currentTotalConsumption,
+ cumulatedConsumptionAmps: Math.floor(transaction.currentTotalConsumption / 230),
totalInactivitySecs: transaction.currentTotalInactivitySecs,
totalDurationSecs: transaction.stop ?
moment.duration(moment(transaction.stop.timestamp).diff(moment(transaction.timestamp))).asSeconds() :

MODIFY
src/server/ocpp/services/OCPPService.ts
src/server/ocpp/services/OCPPService.ts
@@ -1172,6 +1172,7 @@ export default class OCPPService {
consumption.instantPower = Math.round(transaction.currentConsumption);
consumption.instantAmps = Utils.convertWattToAmp(chargingStation, null, transaction.connectorId, transaction.currentConsumption);
consumption.cumulatedConsumption = transaction.currentTotalConsumption;
+ consumption.cumulatedConsumptionAmps = Utils.convertWattToAmp(chargingStation, null, transaction.connectorId, transaction.currentTotalConsumption);
consumption.totalInactivitySecs = transaction.currentTotalInactivitySecs;
consumption.totalDurationSecs = !transaction.stop ?
moment.duration(moment(transaction.lastMeterValue.timestamp).diff(moment(transaction.timestamp))).asSeconds() :

MODIFY
src/server/rest/service/security/TransactionSecurity.ts
src/server/rest/service/security/TransactionSecurity.ts
@@ -320,6 +320,7 @@ export default class TransactionSecurity {
instantPower: consumption.instantPower,
instantAmps: consumption.instantAmps,
cumulatedConsumption: consumption.cumulatedConsumption,
+ cumulatedConsumptionAmps: consumption.cumulatedConsumptionAmps,
stateOfCharge: consumption.stateOfCharge,
cumulatedAmount: consumption.cumulatedAmount,
limitWatts: consumption.limitWatts,

MODIFY
src/storage/mongodb/ConsumptionStorage.ts
src/storage/mongodb/ConsumptionStorage.ts
@@ -32,6 +32,7 @@ export default class ConsumptionStorage {
consumption: Utils.convertToFloat(consumptionToSave.consumption),
cumulatedAmount: Utils.convertToFloat(consumptionToSave.cumulatedAmount),
cumulatedConsumption: Utils.convertToFloat(consumptionToSave.cumulatedConsumption),
+ cumulatedConsumptionAmps: Utils.convertToFloat(consumptionToSave.cumulatedConsumptionAmps),
pricingSource: consumptionToSave.pricingSource,
amount: Utils.convertToFloat(consumptionToSave.amount),
roundedAmount: Utils.convertToFloat(consumptionToSave.roundedAmount),

MODIFY
src/types/Consumption.ts
src/types/Consumption.ts
@@ -12,6 +12,7 @@ export default interface Consumption {
consumption: number;
cumulatedAmount: number;
cumulatedConsumption: number;
+ cumulatedConsumptionAmps: number;
pricingSource: string;
amount: number;
roundedAmount: number;

MODIFY
src/types/Transaction.ts
src/types/Transaction.ts
@@ -102,6 +102,7 @@ export interface TransactionConsumption {
limitWatts: number;
limitAmps: number;
cumulatedConsumption: number;
+ cumulatedConsumptionAmps: number;
stateOfCharge: number;
cumulatedAmount: number;
}

Added consumption A.h