fix: fallback to minimum measurand value at meterValues generation
authorJérôme Benoit <jerome.benoit@sap.com>
Wed, 15 Nov 2023 23:12:45 +0000 (00:12 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Wed, 15 Nov 2023 23:12:45 +0000 (00:12 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts

index 502fd6a57c2fde8d27eca15f4b78ab62aba66f72..c329a2c88a50aa820c2d9fc2eab98ea8840a8e5d 100644 (file)
@@ -303,6 +303,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
                   {
                     limitationEnabled:
                       chargingStation.stationInfo?.customValueLimitationMeterValues,
+                    defaultValue: connectorMinimumPower / unitDivider,
                   },
                 ) / chargingStation.getNumberOfPhases(),
                 powerSampledValueTemplate.fluctuationPercent ??
@@ -317,6 +318,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
                   {
                     limitationEnabled:
                       chargingStation.stationInfo?.customValueLimitationMeterValues,
+                    defaultValue: connectorMinimumPowerPerPhase / unitDivider,
                   },
                 ),
                 powerPerPhaseSampledValueTemplates.L1.fluctuationPercent ??
@@ -331,6 +333,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
                   {
                     limitationEnabled:
                       chargingStation.stationInfo?.customValueLimitationMeterValues,
+                    defaultValue: connectorMinimumPowerPerPhase / unitDivider,
                   },
                 ),
                 powerPerPhaseSampledValueTemplates.L2.fluctuationPercent ??
@@ -345,6 +348,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
                   {
                     limitationEnabled:
                       chargingStation.stationInfo?.customValueLimitationMeterValues,
+                    defaultValue: connectorMinimumPowerPerPhase / unitDivider,
                   },
                 ),
                 powerPerPhaseSampledValueTemplates.L3.fluctuationPercent ??
@@ -380,6 +384,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
                     {
                       limitationEnabled:
                         chargingStation.stationInfo?.customValueLimitationMeterValues,
+                      defaultValue: connectorMinimumPower / unitDivider,
                     },
                   ),
                   powerSampledValueTemplate.fluctuationPercent ??
@@ -406,6 +411,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
                   {
                     limitationEnabled:
                       chargingStation.stationInfo?.customValueLimitationMeterValues,
+                    defaultValue: connectorMinimumPower / unitDivider,
                   },
                 ),
                 powerSampledValueTemplate.fluctuationPercent ??
@@ -555,6 +561,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
                   {
                     limitationEnabled:
                       chargingStation.stationInfo?.customValueLimitationMeterValues,
+                    defaultValue: connectorMinimumAmperage,
                   },
                 ),
                 currentSampledValueTemplate.fluctuationPercent ??
@@ -569,6 +576,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
                   {
                     limitationEnabled:
                       chargingStation.stationInfo?.customValueLimitationMeterValues,
+                    defaultValue: connectorMinimumAmperage,
                   },
                 ),
                 currentPerPhaseSampledValueTemplates.L1.fluctuationPercent ??
@@ -583,6 +591,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
                   {
                     limitationEnabled:
                       chargingStation.stationInfo?.customValueLimitationMeterValues,
+                    defaultValue: connectorMinimumAmperage,
                   },
                 ),
                 currentPerPhaseSampledValueTemplates.L2.fluctuationPercent ??
@@ -597,6 +606,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
                   {
                     limitationEnabled:
                       chargingStation.stationInfo?.customValueLimitationMeterValues,
+                    defaultValue: connectorMinimumAmperage,
                   },
                 ),
                 currentPerPhaseSampledValueTemplates.L3.fluctuationPercent ??
@@ -623,6 +633,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
                     {
                       limitationEnabled:
                         chargingStation.stationInfo?.customValueLimitationMeterValues,
+                      defaultValue: connectorMinimumAmperage,
                     },
                   ),
                   currentSampledValueTemplate.fluctuationPercent ??
@@ -651,6 +662,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
                   {
                     limitationEnabled:
                       chargingStation.stationInfo?.customValueLimitationMeterValues,
+                    defaultValue: connectorMinimumAmperage,
                   },
                 ),
                 currentSampledValueTemplate.fluctuationPercent ??