Skip to main content
Version: V3 (Ignition 8.3)

system.mes.oee.calculateOeeByShift

Description

Returns one OeeShiftResultsDTO per shift instance in the date range for the given location. Each result pairs a ShiftRecordDTO (shift metadata and timing) with an OeeResultsDTO (all OEE metrics for that shift window). Results are sorted by shift start date ascending.

Uses the SHIFT pre-computed record cache where available. On a cache miss, falls back to the hierarchical record cache (MONTH → WEEK → DAY → HOUR records), then to raw calculation.

Permissions

This method requires the OEE.READ.GET permission.

Syntax

system.mes.oee.calculateOeeByShift(locationIdOrPath, startDate, endDate=None, shiftNameOrId=None, unitOfMeasureName=None)

Parameters

ParameterTypeNullableDescription
locationIdOrPathStringFalseLocation ID (ULID) or path.
startDateDateFalseStart of the query range (inclusive).
endDateDateTrueEnd of the query range (inclusive). Defaults to now if None.
shiftNameOrIdStringTrueShift name or ID (ULID). When provided, only instances of this shift are returned. Omit for all shifts.
unitOfMeasureNameStringTrueUnit of measure name for production counts. Uses the location OEE configuration default if None.

Returns

A JSON list of OeeShiftResultsDTO objects sorted by shift start date ascending. Each entry contains the following top-level fields:

NameTypeDescription
shiftRecordObjectShift instance metadata (ShiftRecordDTO).
oeeResultsObjectOEE metrics for the shift window (OeeResultsDTO).

shiftRecord fields (ShiftRecordDTO)

NameTypeNullableDescription
idStringTrueThe ID of the shift record (ULID).
shiftIdStringFalseID of the shift definition that generated this record.
shiftNameStringTrueName of the shift (display only).
startDateInstantTrueStart of the shift instance.
endDateInstantTrueEnd of the shift instance.
statusStringFalseShift status: "IDLE", "ACTIVE", "CLOSED", or "VERIFIED".
locationIdStringFalseID of the location where the shift ran.
locationPathStringTruePath of the location (display only).
durationDoubleFalseDuration of the shift instance in seconds.

oeeResults fields (OeeResultsDTO)

NameTypeNullableDescriptionDefault Value
locationIdStringFalseIdentifier of the associated location.null
locationPathStringTruePath of the associated location.null
startDateInstantFalseStart of the shift window.Instant.now()
endDateInstantTrueEnd of the shift window.null
totalDurationSecDoubleFalseTotal duration of the shift window 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 shift.0.0
expectedProductionCountDoubleFalseExpected units to be produced during the shift.0.0
averageStandardRateDoubleFalseAverage standard rate for the shift (units per minute).0.0
maximumStandardRateDoubleFalseMaximum standard rate for the shift (units per minute).0.0
wasteCountDoubleFalseTotal waste units recorded during the shift.0.0
goodCountDoubleFalseTotal good units recorded during the shift.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 OEE for all shifts over the past 7 days
location = "Enterprise/Site/Line1"
endDate = Date()
startDate = system.date.addDays(endDate, -7)

shiftResults = system.mes.oee.calculateOeeByShift(location, startDate, endDate)
for result in shiftResults:
shift = result['shiftRecord']
oee = result['oeeResults']
print shift['shiftName'], shift['startDate'], "OEE:", oee['oee']

# Get OEE for a specific shift only
dayShiftResults = system.mes.oee.calculateOeeByShift(
location,
startDate,
endDate,
shiftNameOrId="Day Shift"
)
for result in dayShiftResults:
print result['shiftRecord']['startDate'], "->", result['oeeResults']['oee']