Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
Add missing src/charging-station/ocpp/OCPPServiceUtils.ts file
Browse files Browse the repository at this point in the history
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
  • Loading branch information
Jérôme Benoit committed May 8, 2022
1 parent 7bc31f9 commit 90befdb
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/charging-station/ocpp/OCPPServiceUtils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export class OCPPServiceUtils {
protected static getLimitFromSampledValueTemplateCustomValue(
value: string,
limit: number,
options: { limitationEnabled?: boolean; unitMultiplier?: number } = {
limitationEnabled: true,
unitMultiplier: 1,
}
): number {
options.limitationEnabled = options?.limitationEnabled ?? true;
options.unitMultiplier = options?.unitMultiplier ?? 1;
return options?.limitationEnabled
? Math.min(parseInt(value) * options.unitMultiplier, limit)
: parseInt(value) * options.unitMultiplier;
}
}

0 comments on commit 90befdb

Please sign in to comment.