Test efficiency excluded cs
MODIFY
test/api/SmartChargingTest.ts
test/api/SmartChargingTest.ts
@@ -891,9 +891,13 @@ describe('Smart Charging Service', function() {
it('Test if whole charge point is excluded from root fuse when charging station is excluded (one connector charging)', async () => {
await smartChargingIntegration.buildChargingProfiles(testData.siteAreaContext.getSiteArea(), [testData.chargingStationContext.getChargingStation().id]);
const log = await LoggingStorage.getLogs(testData.tenantContext.getTenant().id, { actions: [ServerAction.SMART_CHARGING], search: 'currently being used' }, Constants.DB_PARAMS_SINGLE_RECORD, null);
+ const chargingStation = testData.chargingStationContext.getChargingStation();
+ const chargePoint = chargingStation.chargePoints.find((cp) => cp.connectorIDs.includes(transaction.connectorId));
const siteArea = testData.siteAreaContext.getSiteArea();
const siteAreaLimitPerPhase = Utils.createDecimal(siteArea.maximumPower).div(siteArea.voltage).div(3).toNumber();
- const connectorLimitPerPhase = Utils.createDecimal(Utils.getChargingStationAmperage(testData.chargingStationContext.getChargingStation())).div(3).toNumber();
+ let connectorLimitPerPhase = Utils.createDecimal(Utils.getChargingStationAmperage(chargingStation)).div(3).toNumber();
+ // Calculate efficiency
+ connectorLimitPerPhase = Utils.createDecimal(connectorLimitPerPhase).mul(100).div(chargePoint.efficiency).toNumber();
expect(log.result[0].detailedMessages).include('"fusePhase1": ' + (siteAreaLimitPerPhase - connectorLimitPerPhase));
expect(log.result[0].detailedMessages).include('"fusePhase2": ' + (siteAreaLimitPerPhase - connectorLimitPerPhase));
expect(log.result[0].detailedMessages).include('"fusePhase3": ' + (siteAreaLimitPerPhase - connectorLimitPerPhase));
@@ -940,9 +944,13 @@ describe('Smart Charging Service', function() {
it('Test if only charge point is excluded from root fuse when charging station is excluded (two connectors charging)', async () => {
await smartChargingIntegration.buildChargingProfiles(testData.siteAreaContext.getSiteArea(), [testData.chargingStationContext.getChargingStation().id]);
const log = await LoggingStorage.getLogs(testData.tenantContext.getTenant().id, { actions: [ServerAction.SMART_CHARGING], search: 'currently being used' }, Constants.DB_PARAMS_SINGLE_RECORD, null);
+ const chargingStation = testData.chargingStationContext.getChargingStation();
+ const chargePoint = chargingStation.chargePoints.find((cp) => cp.connectorIDs.includes(transaction.connectorId));
const siteArea = testData.siteAreaContext.getSiteArea();
const siteAreaLimitPerPhase = Utils.createDecimal(siteArea.maximumPower).div(siteArea.voltage).div(3).toNumber();
- const connectorLimitPerPhase = Utils.createDecimal(Utils.getChargingStationAmperage(testData.chargingStationContext.getChargingStation())).div(3).toNumber();
+ let connectorLimitPerPhase = Utils.createDecimal(Utils.getChargingStationAmperage(chargingStation)).div(3).toNumber();
+ // Calculate efficiency
+ connectorLimitPerPhase = Utils.createDecimal(connectorLimitPerPhase).mul(100).div(chargePoint.efficiency).toNumber();
expect(log.result[0].detailedMessages).include('"fusePhase1": ' + (siteAreaLimitPerPhase - connectorLimitPerPhase));
expect(log.result[0].detailedMessages).include('"fusePhase2": ' + (siteAreaLimitPerPhase - connectorLimitPerPhase));
expect(log.result[0].detailedMessages).include('"fusePhase3": ' + (siteAreaLimitPerPhase - connectorLimitPerPhase));

Test efficiency excluded cs