system.mes.getEquipmentStateHistory

Sepasoft MES Module Suite

system.mes.getEquipmentStateHistory

This script function returns equipment state history.


Warning

Depending on your data (number of state changes, length of runs), this script function may return a very large dataset particularly if including all children as a row is returned for every state change for every cell under the equipment path. Calling this method frequently with differing start and end times is inefficient and will cause system performance issues. Using the MES Analysis Controller with filters or an Analysis Settings object to return state history is the recommended approach.


Equipment State Dataset

Data Name
Description

Equipment Cell Order

Integer value that determines the cell order of the equipment within the line or cell group. This is utilized in the OEE Downtime module. This value is set to  null  for the line. The cell order is set to 0 for the key cell or first cell (if key reason downtime detection is not used) within each cell group. Please note that this is a local order, not a global order. This value resets to zero under every line and cell group.

Equipment Path

Equipment path is the location path for the specified equipment.

The equipment path is based on the hierarchy of the item in the production model. Referring to the image below, the equipment path for Cell 1A, is:

My Company Name\My Site\My Area\Line 1\Cell 1A

Equipment paths are used by some of the MES components and script functions to easily identify equipment items.

Is Key Cell

See Downtime Detection Modes - Creating the Key Cell

Line State Object

See MES Equipment State - MES Object dataset

Line State Event Sequence

Every downtime event on the line is provided with an incrementing sequence number.

Line Downtime Equipment Name

Name of the equipment that is responsible for causing line downtime.

Script Function Options


system.mes.getEquipmentStateHistory(equipmentPath, runLookBackCount, includeChildren, lookbackHours)

Return equipment state history.

Syntax

system.mes.getEquipmentStateHistory(equipmentPath, runLookBackCount, includeChildren, lookbackHours)

  • Parameters

String equipmentPath - The path of equipment to return the state history for.

Integer runLookBackCount - The number of runs to return downtime events for within the selected date range. Set to 0 to return all runs within the date range. Set to 1 to return only the current or most recent run.

Boolean includeChildren - If true, include state history for children.

Int lookbackHours - Optionally provide a number of hours to lookback for finding blame in events that happened prior to the begin date time. Value must be a positive integer to be used.

  • Returns

Dataset - A dataset containing the equipment state history.

  • Scope

All


system.mes.getEquipmentStateHistory(equipmentPath, beginDateTime, endDateTime, includeChildren, unknownStateAsUnplannedDowntime, lookbackHours)

Return equipment state history.

Syntax

system.mes.getEquipmentStateHistory(equipmentPath, beginDateTime, endDateTime, includeChildren, unknownStateAsUnplannedDowntime, lookbackHours)

  • Parameters

String equipmentPath - The path of equipment to return the state history for.

Date beginDateTime - The begin date time.

Date endDateTime - The end date time.

Boolean includeChildren - If true, include state history for children.

Boolean unknownStateAsUnplannedDowntime - If true, unknown (undefined) Equipment State values will be counted as unplanned downtime.

Int lookbackHours - Optionally provide a number of hours to lookback for finding blame in events that happened prior to the begin date time. Value must be a positive integer to be used.

  • Returns

Dataset - A dataset containing the equipment state history.

Note Note that the Line State Object column is an MES Object, and thus this dataset cannot be simply dumped into a table.
  • Scope

All

Python
equipmentPath = event.source.parent.getComponent('MES Object Selector').equipmentItemPath
beginDateTime = event.source.parent.getComponent('Date Range').startDate
endDateTime = event.source.parent.getComponent('Date Range').endDate
includeChildren = False
unknownStateAsUnplannedDowntime = True
dataset = system.mes.getEquipmentStateHistory(equipmentPath, beginDateTime, endDateTime, includeChildren, unknownStateAsUnplannedDowntime)
print dataset.getColumnNames()
equipmentDowntimeReason = dataset.getValueAt(0, 'Line State Object')
print equipmentDowntimeReason.getState().getEquipmentState()
print equipmentDowntimeReason.getBeginDateTime()
print equipmentDowntimeReason.getEndDateTime()

Output

Python
[Equipment Cell Order, Equipment Path, Is Key Cell, Line State Object, Line State Event Sequence, Line Downtime Equipment Name]
Disabled [DISABLED]
Thu Sep 06 00:00:00 UTC 2018
Fri Sep 07 18:52:20 UTC 2018


Python
equipmentPath = event.source.parent.getComponent('MES Object Selector').equipmentItemPath
beginDateTime = event.source.parent.getComponent('Date Range').startDate
endDateTime = event.source.parent.getComponent('Date Range').endDate
includeChildren = False
unknownStateAsUnplannedDowntime = True
dataset = system.mes.getEquipmentStateHistory(equipmentPath, beginDateTime, endDateTime, includeChildren, unknownStateAsUnplannedDowntime)
print dataset.getColumnNames()
for row in range(dataset.getRowCount()):
    s = `row` + ': '
    for column in dataset.getColumnNames():
        s += `column` + ": " + `dataset.getValueAt(row, column)` + " || "
    print s
equipmentDowntimeReason = dataset.getValueAt(0, 'Line State Object')
print equipmentDowntimeReason
print equipmentDowntimeReason.getState().getEquipmentState()
print equipmentDowntimeReason.getBeginDateTime()
print equipmentDowntimeReason.getEndDateTime()

Output

Python
[Equipment Cell Order, Equipment Path, Is Key Cell, Line State Object, Line State Event Sequence, Line Downtime Equipment Name]
0: u'Equipment Cell Order': -2147483648 || u'Equipment Path': u'Enterprise\\Site\\Area\\Line' || u'Is Key Cell': False || u'Line State Object': [926940971]<null> - Unknown || u'Line State Event Sequence': 1 || u'Line Downtime Equipment Name': u'' || 
1: u'Equipment Cell Order': -2147483648 || u'Equipment Path': u'Enterprise\\Site\\Area\\Line' || u'Is Key Cell': False || u'Line State Object': [1244605307]<null> - Unknown || u'Line State Event Sequence': 2 || u'Line Downtime Equipment Name': u'' || 
2: u'Equipment Cell Order': -2147483648 || u'Equipment Path': u'Enterprise\\Site\\Area\\Line' || u'Is Key Cell': False || u'Line State Object': [1849300051]<null> - Unknown || u'Line State Event Sequence': 3 || u'Line Downtime Equipment Name': u'New Line' || 
3: u'Equipment Cell Order': -2147483648 || u'Equipment Path': u'Enterprise\\Site\\Area\\Line' || u'Is Key Cell': False || u'Line State Object': [1700342576]<null> - Unknown || u'Line State Event Sequence': 4 || u'Line Downtime Equipment Name': u'' || 
4: u'Equipment Cell Order': -2147483648 || u'Equipment Path': u'Enterprise\\Site\\Area\\Line' || u'Is Key Cell': False || u'Line State Object': [769082903]<null> - Unknown || u'Line State Event Sequence': 5 || u'Line Downtime Equipment Name': u'' || 
5: u'Equipment Cell Order': -2147483648 || u'Equipment Path': u'Enterprise\\Site\\Area\\Line' || u'Is Key Cell': False || u'Line State Object': [504415269]<null> - Unknown || u'Line State Event Sequence': 6 || u'Line Downtime Equipment Name': u'' || 
[926940971]<null> - Unknown
Disabled [DISABLED]
Thu Sep 06 00:00:00 UTC 2018
Fri Sep 07 18:52:20 UTC 2018

Python
equipmentPath = event.source.parent.getComponent('MES Object Selector').equipmentItemPath
beginDateTime = event.source.parent.getComponent('Date Range').startDate
endDateTime = event.source.parent.getComponent('Date Range').endDate
includeChildren = False
unknownStateAsUnplannedDowntime = True
dataset = system.mes.getEquipmentStateHistory(equipmentPath, beginDateTime, endDateTime, includeChildren, unknownStateAsUnplannedDowntime)
print dataset.getColumnNames()
equipmentDowntimeReason = dataset.getValueAt(0, 'Line State Object')
print equipmentDowntimeReason.getState().getEquipmentState()
print equipmentDowntimeReason.getBeginDateTime()
print equipmentDowntimeReason.getEndDateTime()

Python
[Equipment Cell Order, Equipment Path, Is Key Cell, Line State Object, Line State Event Sequence, Line Downtime Equipment Name]
Disabled [DISABLED]
Thu Sep 06 00:00:00 UTC 2018
Fri Sep 07 18:52:20 UTC 2018


Sepasoft MES Module Suite