1 export class OCPPServiceUtils
{
2 protected constructor() {
6 protected static getLimitFromSampledValueTemplateCustomValue(
9 options
: { limitationEnabled
?: boolean; unitMultiplier
?: number } = {
10 limitationEnabled
: true,
14 options
.limitationEnabled
= options
?.limitationEnabled
?? true;
15 options
.unitMultiplier
= options
?.unitMultiplier
?? 1;
16 const numberValue
= isNaN(parseInt(value
)) ? Infinity : parseInt(value
);
17 return options
?.limitationEnabled
18 ? Math.min(numberValue
* options
.unitMultiplier
, limit
)
19 : numberValue
* options
.unitMultiplier
;