Skip to main content

system.mes.oee.calculateOee

Description

Calculates OEE (Overall Equipment Effectiveness) metrics for a specific location within a date range.

Permissions

This method requires the OEE.READ.CALCULATE permission.

Syntax

# Basic calculation with required parameters
system.mes.oee.calculateOee(locationIdOrPath, startDate, endDate=None)

# Extended calculation with keyword arguments
system.mes.oee.calculateOee(locationIdOrPath=location, startDate=start, endDate=end, unitOfMeasureName=unit)

Parameters

ParameterTypeNullableDescription
locationIdOrPathStringFalseThe ULID or path of the location to calculate OEE for.
startDateDateFalseThe start date for the calculation period.
endDateDateTrueThe end date for the calculation period. Defaults to current time.
unitOfMeasureNameStringTrueThe unit of measure name for production calculations (keyword only).

Returns

Returns a JSON object containing calculated OEE metrics.

NameTypeNullableDescriptionDefault Value
locationIdStringFalseIdentifier of the associated location where this OEE production record was capturednull
locationPathStringTruePath of the location where this OEE production record was capturednull
startDateInstantFalseStart date and time of the OEE production recordInstant.now()
endDateInstantTrueEnd date and time of the OEE production recordnull
totalDurationSecDoubleFalseTotal duration of the OEE production record in seconds0.0
scheduledDurationSecDoubleFalseDuration in seconds that the machine was scheduled to run during this record period0.0
scheduledProductionModeEventCountIntegerFalseTotal number of scheduled production mode events during this record period0
scheduledDowntimeDurationSecDoubleFalseDuration in seconds that the machine was scheduled to be in downtime during this record period0.0
scheduledDowntimeModeEventCountIntegerFalseTotal number of scheduled downtime mode events during this record period0
unscheduledDowntimeDurationSecDoubleFalseDuration in seconds that the machine was in unscheduled downtime during this record period0.0
unscheduledDowntimeEventCountIntegerFalseTotal number of unscheduled downtime mode events during this record period0
runningDurationSecDoubleFalseDuration in seconds that the machine was actively running during this record period0.0
runningStateEventCountIntegerFalseTotal number of running state events during this record period0
blockedDurationSecDoubleFalseDuration in seconds that the machine was in BLOCKED state during this record period0.0
blockedStateEventCountIntegerFalseTotal number of blocked state events during this record period0
starvedDurationSecDoubleFalseDuration in seconds that the machine was in STARVED state during this record period0.0
starvedStateEventCountIntegerFalseTotal number of starved state events during this record period0
idleDurationSecDoubleFalseDuration in seconds that the machine was in IDLE state during this record period0.0
idleStateEventCountIntegerFalseTotal number of idle state events during this record period0
downtimeDurationSecDoubleFalseDuration in seconds that the machine was in DOWNTIME state during this record period0.0
downtimeStateEventCountIntegerFalseTotal number of downtime state events during this record period0
productionCountDoubleFalseTotal number of units produced during this record period0.0
expectedProductionCountDoubleFalseExpected number of units to be produced during this record period0.0
averageStandardRateDoubleFalseAverage Standard Rate for the time period. Calculated as per minute0.0
maximumStandardRateDoubleFalseMaximum Standard Rate for the time period. Calculated as per minute0.0
wasteCountDoubleFalseTotal number of waste units recorded during this period0.0
goodCountDoubleFalseTotal number of good units recorded during this period0.0
productionCountUnitOfMeasureIdStringTrueIdentifier of the unit of measure for the production countnull
productionCountUnitOfMeasureNameStringTrueName of the unit of measure for the production countnull
productionCountUnitOfMeasureSymbolStringTrueSymbol of the unit of measure for the production countnull
availabilityDoubleTrueAvailability metric (0.0 to 1.0)1.0
teepDoubleTrueTotal Effective Equipment Performance (TEEP) 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

Code Examples

from java.util import Date
import system.date

# Calculate OEE for the last 24 hours
locationPath = "Enterprise/Site/Area/Line1"
endDate = Date()
startDate = system.date.addHours(endDate, -24)

oeeResult = system.mes.oee.calculateOee(location_path, start_date, end_date)

print("OEE Calculation Results:")
print("OEE:", oeeResult.get('oee', 0))
print("Availability:", oeeResult.get('availability', 0))
print("Performance:", oeeResult.get('performance', 0))
print("Quality:", oeeResult.get('quality', 0))

# Calculate OEE for a specific time range with unit of measure
startDate = system.date.parse("2024-10-01 00:00:00", "yyyy-MM-dd HH:mm:ss")
endDate = system.date.parse("2024-10-01 23:59:59", "yyyy-MM-dd HH:mm:ss")

oee_detailed = system.mes.oee.calculateOee(
locationIdOrPath=locationPath,
startDate=startDate,
endDate=endDate,
unitOfMeasureName="Parts"
)

print("\nDetailed OEE Results:")
print("Production Count:", oee_detailed.get('productionCount', 0))
print("Expected Production:", oee_detailed.get('expectedProductionCount', 0))
print("Total Duration (sec):", oee_detailed.get('totalDurationSec', 0))
print("Scheduled Duration (sec):", oee_detailed.get('scheduledDurationSec', 0))
print("Running Duration (sec):", oee_detailed.get('runningDurationSec', 0))

# Calculate OEE for current day (endDate defaults to now)
todayStart = system.date.midnight(Date())
oeeToday = system.mes.oee.calculateOee(locationPath, todayStart)

print("\nToday's OEE:", oeeToday.get('oee', 0))