UNPKG

@citrineos/base

Version:

The base module for OCPP v2.0.1 including all interfaces. This module is not intended to be used directly, but rather as a dependency for other modules.

32 lines (31 loc) 1.28 kB
import { OCPP2_0_1 } from '../ocpp/model'; export declare class MeterValueUtils { private static readonly validContexts; /** * Calculate the total Kwh * * @param {array} meterValues - meterValues of a transaction. * @return {number} total Kwh based on the best available energy measurement. */ static getTotalKwh(meterValues: OCPP2_0_1.MeterValueType[]): number; private static filterValidMeterValues; private static getTimestampToKwhMap; /** * Find a specific measurand value from sampledValues * @param sampledValues Array of sampled values * @param measurand The measurand type to look for * @param phased Whether to look for phased values (true) or non-phased values (false) * @returns The normalized value in kWh, or null if not found */ private static findMeasurandValue; /** * Sum phased values for a specific measurand * @param sampledValues Array of sampled values * @param measurand The measurand type to sum * @returns The sum of phase values in kWh, or null if no valid phase values found */ private static sumPhasedValues; private static normalizeToKwh; private static getSortedKwhByTimestampAscending; private static calculateTotalKwh; }