Skip to main content
Version: V2 (Ignition 8.1)

system.mes.meter.calculateMeterSummary

Description

Calculates a comprehensive meter summary of usage and cost within a date range with optional filters and unit conversions. Returns aggregated totals, rates, and peak and minimum values for the period.

Permissions

This method requires the METERING.READ.CALCULATE permission.

Syntax

system.mes.meter.calculateMeterSummary(startDate, endDate, equipmentIdOrPath=None, locationIdOrPath=None, meterTypeIdOrName=None, meterIdOrName=None, statuses=None, targetUsageUomIdOrName=None, targetCostUomIdOrName=None)

Parameters

ParameterTypeNullableDescription
startDateDateFalseStart date (inclusive) as a Date object or milliseconds since epoch.
endDateDateFalseEnd date (inclusive) as a Date object or milliseconds since epoch.
equipmentIdOrPathStringTrueFilter by equipment ID or path.
locationIdOrPathStringTrueFilter by location ID or path.
meterTypeIdOrNameStringTrueFilter by meter type ID or name.
meterIdOrNameStringTrueFilter by meter record ID or name.
statusesList<String>TrueFilter by status values (e.g., ['RUNNING', 'COMPLETED']).
targetUsageUomIdOrNameStringTrueTarget unit of measure ID or name for usage conversion. If omitted, uses the most frequent unit from matched records.
targetCostUomIdOrNameStringTrueTarget unit of measure ID or name for cost conversion. If omitted, uses the most frequent unit from matched records.

Returns

Returns a JSON object containing the meter summary.

NameTypeDescription
startDateInstantStart date (inclusive) of the summary window.
endDateInstantEnd date (inclusive) of the summary window.
totalUsageDoubleTotal usage accumulated during the summary window.
totalCostDoubleTotal cost accumulated during the summary window.
averageCostPerUsageDoubleAverage cost per usage unit (totalCost / totalUsage).
usageUnitOfMeasureNameStringName of the usage unit of measure.
usageUnitOfMeasureSymbolStringSymbol of the usage unit of measure.
costUnitOfMeasureNameStringName of the cost unit of measure.
costUnitOfMeasureSymbolStringSymbol of the cost unit of measure.
recordCountIntegerNumber of Meter Records included in this summary.
totalDurationSecDoubleTotal duration across all records in seconds.
averageUsagePerSecondDoubleAverage usage rate per second.
averageCostPerSecondDoubleAverage cost rate per second.
peakUsagePerSecondDoublePeak (maximum) usage rate per second across all records.
minUsagePerSecondDoubleMinimum usage rate per second across all records.
peakCostPerSecondDoublePeak (maximum) cost rate per second across all records.
minCostPerSecondDoubleMinimum cost rate per second across all records.
peakCostPerUsageDoublePeak cost per usage unit across all records.
minCostPerUsageDoubleMinimum cost per usage unit across all records.

Code Examples

# Calculate a 30-day electricity usage summary for a specific piece of equipment
startDate = system.date.addDays(system.date.now(), -30)
endDate = system.date.now()

summary = system.mes.meter.calculateMeterSummary(
startDate,
endDate,
equipmentIdOrPath='Enterprise/Site/Line1',
meterTypeIdOrName='Electricity'
)

print("Total Usage:", summary['totalUsage'], summary['usageUnitOfMeasureSymbol'])
print("Total Cost:", summary['totalCost'], summary['costUnitOfMeasureSymbol'])
print("Average Rate (per sec):", summary['averageUsagePerSecond'])
print("Peak Rate (per sec):", summary['peakUsagePerSecond'])
print("Record Count:", summary['recordCount'])