Skip to main content
Version: V3 (Ignition 8.3)

system.mes.oee.calculateOeeByCalendarPeriod

Description

Calculates OEE (Overall Equipment Effectiveness) metrics broken down by time intervals for a specific location within a date range. Unlike calculateOeeByTimeInterval, the time intervals are snapped to natural time boundaries such as hourly or daily periods. This allows for efficient use of the pre-computed records cache, which can be configured using saveCalculationConfig.

Returns one OeeResultsDTO per calendar-aligned bucket for the given location, period type, bucket size, and date range. Each result spans exactly one bucket aligned to a calendar boundary — for example, periodType="HOUR" produces whole-hour results (01:00-02:00, 02:00-03:00, etc.) and periodType="DAY" produces midnight-to-midnight results.

periodsPerBucket controls how many calendar periods form one bucket. With the default of 1, each result covers one period (one hour, one day, etc.). However, with periodsPerBucket=4 and periodType="HOUR" for example, each result covers a 4-hour window anchored to the day boundary (00:00–04:00, 04:00–08:00, and so on).

The returned buckets always cover complete calendar periods. For example, hourly results with startDate=10:45 and endDate=11:15 return two buckets: 10:00–11:00 and 11:00–12:00.

For each bucket, the method tries the pre-computed record cache at the requested periodType first. On a miss it steps down through smaller granularities (MONTH → WEEK → DAY → HOUR) until a cached record is found. If no cached record exists at any granularity, the bucket falls back to a raw calculation.

Permissions

This method requires the OEE.READ.GET permission.

Syntax

system.mes.oee.calculateOeeByCalendarPeriod(locationIdOrPath, periodType, startDate, periodsPerBucket=1, endDate=None, unitOfMeasureName=None)

Parameters

ParameterTypeNullableDescription
locationIdOrPathStringFalseLocation ID (ULID) or path.
periodTypeStringFalsePeriod granularity: "HOUR", "DAY", "WEEK", or "MONTH".
startDateDateFalseStart of the query range. Snapped to the nearest calendar boundary if not already aligned.
periodsPerBucketIntegerTrueNumber of base periods per bucket. For example, periodType="HOUR" with periodsPerBucket=4 produces 4-hour buckets anchored to the day. Defaults to 1.
endDateDateTrueEnd of the query range (inclusive). Defaults to now if omitted.
unitOfMeasureNameStringTrueUnit of measure name for production counts. Uses the location OEE configuration default if omitted.

Returns

A JSON list of OeeResultsDTO objects, one per calendar-aligned bucket.

NameTypeNullableDescriptionDefault Value
locationIdStringFalseIdentifier of the associated location.null
locationPathStringTruePath of the associated location.null
startDateInstantFalseStart of the bucket (calendar-aligned).Instant.now()
endDateInstantTrueEnd of the bucket.null
totalDurationSecDoubleFalseTotal duration of the bucket in seconds.0.0
scheduledDurationSecDoubleFalseDuration scheduled for production in seconds.0.0
scheduledProductionModeEventCountIntegerFalseTotal number of scheduled production mode events.0
scheduledDowntimeDurationSecDoubleFalseDuration in scheduled downtime mode in seconds.0.0
scheduledDowntimeModeEventCountIntegerFalseTotal number of scheduled downtime mode events.0
unscheduledDowntimeDurationSecDoubleFalseDuration in unscheduled downtime mode in seconds.0.0
unscheduledDowntimeEventCountIntegerFalseTotal number of unscheduled downtime mode events.0
runningDurationSecDoubleFalseDuration the machine was actively running in seconds.0.0
runningStateEventCountIntegerFalseTotal number of running state events.0
blockedDurationSecDoubleFalseDuration in BLOCKED state in seconds.0.0
blockedStateEventCountIntegerFalseTotal number of blocked state events.0
starvedDurationSecDoubleFalseDuration in STARVED state in seconds.0.0
starvedStateEventCountIntegerFalseTotal number of starved state events.0
idleDurationSecDoubleFalseDuration in IDLE state in seconds.0.0
idleStateEventCountIntegerFalseTotal number of idle state events.0
downtimeDurationSecDoubleFalseDuration in DOWNTIME state in seconds.0.0
downtimeStateEventCountIntegerFalseTotal number of downtime state events.0
productionCountDoubleFalseTotal units produced during the bucket.0.0
expectedProductionCountDoubleFalseExpected units to be produced during the bucket.0.0
averageStandardRateDoubleFalseAverage standard rate for the bucket (units per minute).0.0
maximumStandardRateDoubleFalseMaximum standard rate for the bucket (units per minute).0.0
wasteCountDoubleFalseTotal waste units recorded during the bucket.0.0
goodCountDoubleFalseTotal good units recorded during the bucket.0.0
productionCountUnitOfMeasureIdStringTrueIdentifier of the unit of measure for production count.null
productionCountUnitOfMeasureNameStringTrueName of the unit of measure for production count.null
productionCountUnitOfMeasureSymbolStringTrueSymbol of the unit of measure for production count.null
availabilityDoubleTrueAvailability metric (0.0 to 1.0).1.0
performanceDoubleTruePerformance metric (0.0 to 1.0).1.0
qualityDoubleTrueQuality metric (0.0 to 1.0).1.0
oeeDoubleTrueOverall Equipment Effectiveness (OEE) metric (0.0 to 1.0).1.0
teepDoubleTrueTotal Effective Equipment Performance (TEEP) metric (0.0 to 1.0).1.0

Code Examples

from java.util import Date
import system.date

# Get daily OEE buckets for the past 7 days
location = "Enterprise/Site/Line1"
endDate = Date()
startDate = system.date.addDays(endDate, -7)

buckets = system.mes.oee.calculateOeeByCalendarPeriod(location, "DAY", startDate, endDate=endDate)
for bucket in buckets:
print bucket['startDate'], "OEE:", bucket['oee']

# Get 4-hour buckets for the past 24 hours
startDate24h = system.date.addHours(endDate, -24)
buckets4h = system.mes.oee.calculateOeeByCalendarPeriod(
location, "HOUR", startDate24h, periodsPerBucket=4, endDate=endDate
)
for bucket in buckets4h:
print bucket['startDate'], "->", bucket['endDate'], "OEE:", bucket['oee']