Skip to end of metadata
Go to start of metadata

Equipment States represent the status of the line (or cells within a line) that provide an indication of whether the equipment is off-line, idle, running, faulted, blocked, starved, Clean in Place (CIP), etc. It is entirely separate from the equipment mode, which provides a logistical view of intended purpose. The equipment status will generally come from a PLC tag that provides real-time state information of the equipment, but can really come from any source that can populate an Ignition tag. This allows for manual entry screens of operator input equipment state or data parsed from a flat file entry.

Equipment States can be grouped, allowing multiple states to be considered as Running by OEE i.e. loading, heating, molding → running. They allow for the tracking of specific events that may prevent a line or cell from running. Some reasons are considered causes of line downtime where others are not. As an example, if a cell on a production line becomes blocked as the outfeed from it backs up and there is no room to discharge product it will stop. In this example, it is simply normal operation for the cell and not the cause of the production line not producing product. A cell further down the line is the cell preventing the production line from producing product. Other downtime reasons may be planned. Any time that the production line is scheduled around breaks, lunches, safety meetings, disabled shifts, etc., is planned and will not count against the production line OEE Availability. The current state is captured from equipment via tag values passed to the state tag collector in the production model. Refer to OEE 2.0 Downtime Tab - Equipment State for more details.

The OEE Equipment Manager component is used to change equipment mode class, state and schedule. 

Obtaining Status Values for Cells on a Production Line

The OEE module determines the equipment state from a single numeric integer value. Single numeric values are stable and can only represent one state. There is no limit to the number of equipment states that can be defined other than by the maximum numeric value your PLC can handle.

When the OEE module detects a production line or cell state change, it will lookup the downtime reason from the state value. If communication to the PLC fails, in the case when an electrical connection is shut off, the production line or cell state is replaced with 0. If this happens during a production run, it will count as downtime if configured as such.

Line Downtime Versus Cell Downtime

It is important to understand the difference between line downtime and cell downtime. Line downtime is created by events that prevent the production line from producing product, and is typically used to focus on improving OEE. Cell downtime is used to look at trends and detect maintenance issues before they cause line downtime. Consider a production line that has 25 cells. If 5 of the cells are down all at the same time for unrelated reasons and only one of them is preventing product from being produced on the line there will be a lot of noise (extra irrelevant data) to weed through. Also, if a faster downstream cell stops, restarts and catches up, it may never affect the production of the line as a whole. The OEE Downtime Module provides the best of both worlds and tracks both line downtime and cell downtime.

After an automatic reason has been triggered, the operator can override it with a more specific reason. Both are logged and can be viewed in analysis and reporting. For details about how to disable manual override see the Editable property in the Downtime Table section.

In this Section



Default Equipment State Class

Equipment manager component by default has an equipment state class named Default. The default class consists of the following default states.

  • Blocked 

  • Disabled 

  • Idle 

  • Planned Downtime 

  • Running 

  • Starved  

  • Unplanned Downtime 



Creating Equipment State Classes

  • Select the production model item for which the equipment state class is to be changed
  • Click on the change button next to the equipment state class
  • The Equipment State List window appears
  • Click on either an existing Equipment State or the Equipment States and then select the New Equipment State Class
  • Provide a name for the new State Class and assign security roles for who can modify this State Class

  • We can add an equipment state class to an existing equipment state class, creating nested state classes.
  • At the Equipment State Class level, Edit, Delete, Copy, Paste and Export operations are available. At the Root level, only Paste, Import and Export operations are available.



Creating Equipment States for an Equipment State Class

  • Adding - Select the Equipment State Class you wish to modify and click on the New Equipment State to add a new state
  • Editing - Select the Equipment State you wish to modify and click on the Edit to change the State


If you expand the Equipment State Class folder you can see the existing states. 


  • The Edit Equipment State slide out editor allows you to change the properties of the selected Equipment State
  • Add or change the NameTypeCode, and Operator Selection Properties and click Save


State Type

Valid State Types are...

  • Unplanned Downtime
  • Planned Downtime
  • Blocked
  • Starved
  • Running
  • Idle
  • Disabled


Code

Enter in the integer value for this equipment state. This will generally align with the status code value from the PLC.

Assigned Codes

The Assigned Codes list provide a view of all codes that have already been assigned.

Short Stop Threshold (seconds)

Enter in a time value in seconds for how long a state must persist for before it considered to be in this. The Short Stop Threshold is not used for states of state type RUNNING.

Down Time events can be prevented from affecting OEE Availability for a set duration of time (Short Stop Threshold). Events that occur during the Short Stop Threshold period will be ignored for ongoing OEE Availability calculations. To have all events be included in OEE Availability calculations, set Short Stop Threshold = 0.

Enable Meantime Metrics

When enabled, this state will be included in the calculation of Mean Time Between Failure (MTBF), when this state is responsible for causing a line downtime event. MTBF is calculated by taking total running time, or time during a run in which the line is not down, and dividing it by the number of applicable events. So if a production run had 3.5 hours of running time and had 5 events for which Meantime Metrics were enabled, the MTBF would be 0.7.  MTBF is pertinent for unexpected downtime events or Unplanned Downtime Type states.

Override

The Override property defines if it is possible for a operator to override the equipment state through the Downtime Table Editor component. Valid options are...


  • Optional - Operator can select a different state based on the Scope setting
  • Prohibited - Operator cannot change this equipment state
  • Required - Operator is required to select a state based on the Scope setting for this equipment state

Scope

The scope setting is used by the Override setting to provide a set of operator selectable equipment states. Valid Options are....

  • Detected Equipment State - operator can only select from list of equipment states for the equipment (cell)
  • Any Equipment State - operator can select from list of equipment states for any piece of equipment (cell) on the Line
  • Sub State - operator can only select from list of sub states created under this Equipment State

Sub States

It is possible to create Equipment States under Equipment States. These are known as Sub States and can be used to group States together that can be used with the Scope Function to allow operators to select specific states (or Downtime reasons) based on the original equipment state.

Example - Stamping Press state is set to 'Quality Issue'. The Scope for 'Quality Issue' is set to 'Sub-State' and Override is set to 'Required'. Whenever a 'Quality Issue' state occurs on the Stamping Press that results in a line downtime event, the operator will be prompted and required to select one of the sub-state reasons such as 'O2 Deviation', 'Wrong Color' or 'Burr on Mold'.




Creating Equipment States Through Scripting

Refer to for more MES Equipment State information.



Equipment State Properties can be set through scripting with the use of MES Equipment State object.


Description

In OEE 2.0, Downtime Events are now replaced with Equipment States that have a configurable State Type. The State Type provides the ability to logically group equipment states together.

Default State Types 

  • IDLE
  • STARVED
  • RUNNING
  • BLOCKED
  • DISABLED
  • DOWN PLANNED
  • DOWN UNPLANNED

          Equipment States

This provides the following benefits…

  • Raw equipment status coming from the PLC maintains its finite state machine which is captured and stored and allows for cycle time analysis etc.

  • PLC status for LOADING, HEATING, PURGING etc. can be grouped and considered as RUNNING for OEE.

This object is derived from the MESAbstractObject and inherits all its exposed properties, functions and events.



Object Creation

New equipment state classes can be created using the OEE Equipment Manager component.

Equipment states can also be created through scripting.

Steps

  1. Load the Equipment State Class object
  2. Create a new Equipment State object
  3. Assign the Equipment State as the child of the Equipment State Class
  4. Give the Equipment State a name and setting other required properties like EquipmentStateCodeEquipmentStateType, etc.
  5. Save the Equipment State object and Equipment State Class object


Sample State Creation Script
stateCls = system.mes.loadMESObject('YourStateClass','EquipmentStateClass')
#insert the name of your State Class here
name = 'YourStateName'
code = 12 #this is the state code provided by your PLC
state = system.mes.createMESObject('EquipmentState')
stateCls.addChild(state)
state.setPropertyValue('Name', name)
state.setPropertyValue('EquipmentStateCode', code)
state.setPropertyValue('EquipmentStateType', 'Unplanned Downtime') 
#valid values for EquipmentStateType: "Running", "Idle", "Blocked", "Starved", "Planned Downtime", "Unplanned Downtime", "Disabled"
state.setPropertyValue('EquipmentStateOverride', 'Optional')
state.setPropertyValue('EquipmentStateOverrideScope', 'Detected Equipment State')
system.mes.saveMESObject(state)
print 'Created %s' % name	
system.mes.saveMESObject(stateCls)


Use

No scripting function or component use this object directly.



Object Properties

These properties are accessible through the provided object functions, but not directly as obj.properties. Property values can be accessed and changed for an object by using the getPropertyValue() and setPropertyValue() method.

NameDescription
EquipmentStateCode

Enter in the integer value for this equipment state. This will generally align with the status code value from the PLC.

Note:

Do not set state code to zero as it is used internally.

EquipmentStateType

Valid equipment state types are...

  • Unplanned Downtime
  • Planned Downtime
  • Blocked
  • Starved
  • Running
  • Idle
  • Disabled
EquipmentStateShortStopThresholdEnter in a time value in seconds for how long a state must persist for before it considered to be in this. The Short Stop Threshold is not used for states of state type RUNNING.
EquipmentStateOverride

The Override property defines if it is possible for a operator to override the equipment state through the Downtime Table Editor component.

Valid options are...

  • Optional - Operator can select a different state based on the Scope setting
  • Prohibited - Operator cannot change this equipment state
  • Required - Operator is required to select a state based on the Scope setting for this equipment state
EquipmentStateOverrideScope

The scope setting is used by the Override setting to provide a set of operator selectable equipment states.

Valid Options are....

  • Detected Equipment State - operator can only select from list of equipment states for the equipment (cell)
  • Any Equipment State - operator can select from list of equipment states for any piece of equipment (cell) on the Line
  • Sub State - operator can only select from list of sub states created under this Equipment State


This object inherits the AbstractMESObject properties...

 Click here to expand...

The base AbstractMESObject object provides core properties that are common to all MES objects. The values of the core properties are accessed using the getPropertyValue() and setPropertyValue() functions of the AbstractMESObject object.

 


 

Core Properties

 Name
Type
Description
Nameread, writeThis is the name of the MES object. This name is used when referencing the object. It must be a unique name meaning that no other MES object of it's type can have the same name.
UUIDread-onlyThis will contain the Universally Unique Identifier for each instance of a MES object.
Enabledread, writeThis property will be set to true when the MES object is active and usable. When MES objects are deleted they are still retained in the database and the Enabled setting is set to false. This is done to maintain past traceability information.
Descriptionread, writeAn optional setting to give more details for a MES object.

 

Code Examples
Read Object UUID Snippet
#Get MES object UUID example:
mesObject = system.mes.loadMESObject("Vinegar", "MaterialClass")
print mesObject.getPropertyValue('UUID')
Set Object Name Snippet
#Set MES object name example:
mesObject = system.mes.loadMESObject("Vinegar", "MaterialClass")
mesObject.setPropertyValue('Name', 'MyNewObjectName')



Object Functions


This object provides the following functions:

 getStateCode()
Description

Returns the code (an integer) that represents this equipment state.

Syntax

getStateCode()


  • Parameters

None

  • Returns

Integer - The integer code that is associated with this equipment state.

 getStateOverrideScope()
Description

Returns the override scope of this equipment state.

Syntax

getStateOverrideScope()


  • Parameters

None

  • Returns

String scope - The override scope associated with this equipment state.

 getStateOverrideSetting()
Description

Returns the override setting of this equipment state.

Syntax

getStateOverrideSetting()


  • Parameters

None

  • Returns

String setting - The override setting associated with this equipment state.

 getStateShortStopThreshold()
Description

Returns the duration (in seconds) that a state will be considered as a short stop (if less than). If state duration is longer, then it will be considered a downtime event, or planned downtime event or other.

Syntax

getStateShortStopThreshold()


  • Parameters

None

  • Returns

Integer threshold - The duration (in seconds) that a state will be considered as a short stop.

 getStateType()
Description

 Returns the type of the equipment state.

Syntax

getStateType()


  • Parameters

None

  • Returns

String type - The type of this equipment state. Options are Unknown, Unplanned Downtime, Planned Downtime, Blocked, Starved, Running, Idle, Disabled, Changeover, Maintenance.

 getStateTypeName()
Description

 Returns the name of the equipment state type.

Syntax

getStateTypeName()


  • Parameters

None

  • Returns

String name - Name of the equipment state mode.


This object inherits the AbstractMESObject functions.

 Click here to expand...


 addChild(mesObject)
Description

Add a MES object as a child to another MES object. MES objects can have children and parents. Depending on the type of MES object determines the types of children or parents that can be added. For example, a material class (MESMaterialClass) object can have material definitions (MESMaterialDef) as children, but material definitions objects cannot have material class objects as children.

Note

When a child is added to an MES object, then a parent reference will be added to the child behind the scenes. Likewise, when a parent is added to a child, a child reference will be added to the parent behind the scenes. This insures if integrity of relationships are maintained.

Syntax

addChild(mesObject)


  • Parameters

AbstractMESObject mesObject - An instance to an MES object. An AbstractMESObject object is just the generic form of an MES object when the specific type is unknown.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Get the Screws material class object
matCls = system.mes.loadMESObject('Screws', 'MaterialClass')
 
#Get the 10-32 NC Screw material definition object
matDef = system.mes.loadMESObject('10-32 NC Screw', 'MaterialDef')
 
#Add the 10-32 NC Screw material definition object as a child to the Screws material class object
matCls.addChild(matDef)
 
#Save the changes
system.mes.saveMESObject(matCls)
 addChild(mesObjectLink)
Description

Add a MES object link as a child to another MES object. MES objects can have children and parents. Depending on the type of MES object determines the types of children or parents that can be added. For example, a material class (MESMaterialClass) object can have material definitions (MESMaterialDef) as children, but material definitions objects cannot have material class objects as children.

Note

When a child is added to an MES object, then a parent reference will be added to the child behind the scenes. Likewise, when a parent is added to a child, a child reference will be added to the parent behind the scenes. This insures if integrity of relationships are maintained.

Syntax

addChild(mesObject)


  • Parameters

MES Object Link mesObjectLink - A link to an MES object. A MES Object Link holds identification information to a MES object. This is very efficient when displaying MES objects in a list and all the MES object details are not needed.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Get the Storage Tanks equipment class object
eqCls = system.mes.loadMESObject('Storage Tanks', 'EquipmentClass')
 
#Get the Tank 1A equipment object from the equipment path
eq = system.mes.getMESObjectLinkByEquipmentPath('[global]\Dressings Inc\California\Raw Materials\Tank Farm\Tank 1A')
 
#Add the 10-32 NC Screw material definition object as a child to the Screws material class object
eqCls.addChild(eq)
 
#Save the changes
system.mes.saveMESObject(eqCls)
 addCustomProperty(name, dataTypeName, description, units, productionVisible, required, value)
Description

Custom properties can be added to MES objects or even complex properties (such as a material, equipment or personnel reference) of an MES object. The Object Functions method can be used to add a custom property directly to a MES object by not specifying a path to the parent property. To add a custom property as a child of an existing custom property or to a complex property, the parent path is used to specify the parent.

Each level of the path is separated with a period. This allows for names to be duplicated provided the path is unique. For example, it is possible for a MES object to have custom properties "Dimension 1.Width" and "Dimension 2.Width"

Syntax

addCustomProperty(name, dataTypeName, description, units, productionVisible, required, value)


  • Parameters

String name - Name of the custom property to add.

String dataTypeName - Name of the Ignition data type to make the new custom property. Options: Int1, Int2, Int4, Int8, Float4, Float8, Boolean, String, DateTime, DataSet, Text, Int1Array, Int2Array, Int4Array, Int8Array, Float4Array, Float8Array, BooleanArray, StringArray, DateTimeArray.

String description - The description of the custom property.

String units - The units of the new custom property. This is just for reference.

boolean productionVisible - The default is false. If True, show the custom property in various components. If False, it will be hidden and can be used to store values behind the scenes.

boolean required - If True, a value must be assigned to the custom property before and segment is ended.

String value - The value to assign to the custom property after it has been added. Note that this value is cast to a string, even if the custom property is not a string.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Load a MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
 
#Add Type custom property directly to the MES object
obj.addCustomProperty('Type', 'String')
 
#Add Dimension custom property directly to the MES object
obj.addCustomProperty('Dimension', 'String', 'Dimension of box', '', True, False)
 
#Add Width custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension', 'Width', 'Int4', 'Width of box', 'in', True, False, '24')
 
#Add Height custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension', 'Height', 'Int4', 'Height of box', 'in', True, False, '12')
 
#Type custom property was never assigned a value so None is returned
print obj.getPropertyValue('Type')
 
#Remember to save the MES object
system.mes.saveMESObject(obj)
 
#Width and Height custom properties were assigned values
print obj.getPropertyValue('Dimension.Width')
print obj.getPropertyValue('Dimension.Height')
Output
None
24
12
 addCustomProperty(name, dataTypeName, description, units, productionVisible, required)
Description

Custom properties can be added to MES objects or even complex properties (such as a material, equipment or personnel reference) of an MES object. The Object Functions method can be used to add a custom property directly to a MES object by not specifying a path to the parent property. To add a custom property as a child of an existing custom property or to a complex property, the parent path is used to specify the parent.

Each level of the path is separated with a period. This allows for names to be duplicated provided the path is unique. For example, it is possible for a MES object to have custom properties "Dimension 1.Width" and "Dimension 2.Width"

Syntax

addCustomProperty(name, dataTypeName, description, units, productionVisible, required)


  • Parameters

String name - The name of the custom property to add.

String dataTypeName - Name of the Ignition data type to make the new custom property. Options: Int1, Int2, Int4, Int8, Float4, Float8, Boolean, String, DateTime, DataSet, Text, Int1Array, Int2Array, Int4Array, Int8Array, Float4Array, Float8Array, BooleanArray, StringArray, DateTimeArray.

String description - The description of the custom property.

String units - The units of the new custom property. This is just for reference.

boolean productionVisible - The default is false. If True, show the custom property in various components. If False, it will be hidden and can be used to store values behind the scenes.

boolean required - If True, a value must be assigned to the custom property before and segment is ended.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Load a MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
 
#Add Type custom property directly to the MES object
obj.addCustomProperty('Type', 'String')
 
#Add Dimension custom property directly to the MES object
obj.addCustomProperty('Dimension', 'String', 'Dimension of box', '', True, False)
 
#Add Width custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension', 'Width', 'Int4', 'Width of box', 'in', True, False, '24')
 
#Add Height custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension', 'Height', 'Int4', 'Height of box', 'in', True, False, '12')
 
#Type custom property was never assigned a value so None is returned
print obj.getPropertyValue('Type')
 
#Remember to save the MES object
system.mes.saveMESObject(obj)
 
#Width and Height custom properties were assigned values
print obj.getPropertyValue('Dimension.Width')
print obj.getPropertyValue('Dimension.Height')
Output
None
24
12
 addCustomProperty(name, dataTypeName)
Description

Custom properties can be added to MES objects or even complex properties (such as a material, equipment or personnel reference) of an MES object. The Object Functions method can be used to add a custom property directly to a MES object by not specifying a path to the parent property. To add a custom property as a child of an existing custom property or to a complex property, the parent path is used to specify the parent.

Each level of the path is separated with a period. This allows for names to be duplicated provided the path is unique. For example, it is possible for a MES object to have custom properties "Dimension 1.Width" and "Dimension 2.Width"

Syntax

addCustomProperty(name, dataTypeName)


  • Parameters

String name - The name of the custom property to add.

String dataTypeName - Name of the Ignition data type to make the new custom property. Options: Int1, Int2, Int4, Int8, Float4, Float8, Boolean, String, DateTime, DataSet, Text, Int1Array, Int2Array, Int4Array, Int8Array, Float4Array, Float8Array, BooleanArray, StringArray, DateTimeArray.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Load a MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
 
#Add Type custom property directly to the MES object
obj.addCustomProperty('Type', 'String')
 
#Add Dimension custom property directly to the MES object
obj.addCustomProperty('Dimension', 'String', 'Dimension of box', '', True, False)
 
#Add Width custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension', 'Width', 'Int4', 'Width of box', 'in', True, False, '24')
 
#Add Height custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension', 'Height', 'Int4', 'Height of box', 'in', True, False, '12')
 
#Type custom property was never assigned a value so None is returned
print obj.getPropertyValue('Type')
 
#Remember to save the MES object
system.mes.saveMESObject(obj)
 
#Width and Height custom properties were assigned values
print obj.getPropertyValue('Dimension.Width')
print obj.getPropertyValue('Dimension.Height')
Output
None
24
12
 addCustomProperty(parentPath, name, dataTypeName, description, units, productionVisible, required, value)
Description

Custom properties can be added to MES objects or even complex properties (such as a material, equipment or personnel reference) of an MES object. The Object Functions method can be used to add a custom property directly to a MES object by not specifying a path to the parent property. To add a custom property as a child of an existing custom property or to a complex property, the parent path is used to specify the parent.

Each level of the path is separated with a period. This allows for names to be duplicated provided the path is unique. For example, it is possible for a MES object to have custom properties "Dimension 1.Width" and "Dimension 2.Width"

Syntax

addCustomProperty(parentPath, name, dataTypeName, description, units, productionVisible, required, value)


  • Parameters

String parentPath - The path of the parent to add the custom property to.

String name - The name of the custom property to add.

String dataTypeName - Name of the Ignition data type to make the new custom property. Options: Int1, Int2, Int4, Int8, Float4, Float8, Boolean, String, DateTime, DataSet, Text, Int1Array, Int2Array, Int4Array, Int8Array, Float4Array, Float8Array, BooleanArray, StringArray, DateTimeArray.

String description - The description of the custom property.

String units - The units of the new custom property. This is just for reference.

boolean productionVisible - The default is false. If True, show the custom property in various components. If False, it will be hidden and can be used to store values behind the scenes.

boolean required - If True, a value must be assigned to the custom property before and segment is ended.

String value - The value to assign to the custom property after it has been added. Note that this value is cast to a string, even if the custom property is not a string.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Load a MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
 
#Add Type custom property directly to the MES object
obj.addCustomProperty('Type', 'String')
 
#Add Dimension custom property directly to the MES object
obj.addCustomProperty('Dimension', 'String', 'Dimension of box', '', True, False)
 
#Add Width custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension', 'Width', 'Int4', 'Width of box', 'in', True, False, '24')
 
#Add Height custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension', 'Height', 'Int4', 'Height of box', 'in', True, False, '12')
 
#Type custom property was never assigned a value so None is returned
print obj.getPropertyValue('Type')
 
#Remember to save the MES object
system.mes.saveMESObject(obj)
 
#Width and Height custom properties were assigned values
print obj.getPropertyValue('Dimension.Width')
print obj.getPropertyValue('Dimension.Height')
Output
None
24
12
 addCustomProperty(parentPath, name, dataTypeName, description, units, productionVisible, required)
Description

Custom properties can be added to MES objects or even complex properties (such as a material, equipment or personnel reference) of an MES object. The Object Functions method can be used to add a custom property directly to a MES object by not specifying a path to the parent property. To add a custom property as a child of an existing custom property or to a complex property, the parent path is used to specify the parent.

Each level of the path is separated with a period. This allows for names to be duplicated provided the path is unique. For example, it is possible for a MES object to have custom properties "Dimension 1.Width" and "Dimension 2.Width"

Syntax

addCustomProperty(parentPath, name, dataTypeName, description, units, productionVisible, required)


  • Parameters

String parentPath - The path of the parent to add the custom property to.

String name - The name of the custom property to add.

String dataTypeName - Name of the Ignition data type to make the new custom property. Options: Int1, Int2, Int4, Int8, Float4, Float8, Boolean, String, DateTime, DataSet, Text, Int1Array, Int2Array, Int4Array, Int8Array, Float4Array, Float8Array, BooleanArray, StringArray, DateTimeArray.

String description - The description of the custom property.

String units - The units of the new custom property. This is just for reference.

boolean productionVisible - The default is false. If True, show the custom property in various components. If False, it will be hidden and can be used to store values behind the scenes.

boolean required - If True, a value must be assigned to the custom property before and segment is ended.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Load a MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
 
#Add Type custom property directly to the MES object
obj.addCustomProperty('Type', 'String')
 
#Add Dimension custom property directly to the MES object
obj.addCustomProperty('Dimension', 'String', 'Dimension of box', '', True, False)
 
#Add Width custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension', 'Width', 'Int4', 'Width of box', 'in', True, False, '24')
 
#Add Height custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension', 'Height', 'Int4', 'Height of box', 'in', True, False, '12')
 
#Type custom property was never assigned a value so None is returned
print obj.getPropertyValue('Type')
 
#Remember to save the MES object
system.mes.saveMESObject(obj)
 
#Width and Height custom properties were assigned values
print obj.getPropertyValue('Dimension.Width')
print obj.getPropertyValue('Dimension.Height')
Output
None
24
12
 addCustomProperty(parentPath, name, dataTypeName)
Description

Custom properties can be added to MES objects or even complex properties (such as a material, equipment or personnel reference) of an MES object. The Object Functions method can be used to add a custom property directly to a MES object by not specifying a path to the parent property. To add a custom property as a child of an existing custom property or to a complex property, the parent path is used to specify the parent.

Each level of the path is separated with a period. This allows for names to be duplicated provided the path is unique. For example, it is possible for a MES object to have custom properties "Dimension 1.Width" and "Dimension 2.Width"

Syntax

addCustomProperty(parentPath, name, dataTypeName)


  • Parameters

String parentPath - The path of the parent to add the custom property to.

String name - The name of the custom property to add.

String dataTypeName - Name of the Ignition data type to make the new custom property. Options: Int1, Int2, Int4, Int8, Float4, Float8, Boolean, String, DateTime, DataSet, Text, Int1Array, Int2Array, Int4Array, Int8Array, Float4Array, Float8Array, BooleanArray, StringArray, DateTimeArray.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Load a MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
 
#Add Type custom property directly to the MES object
obj.addCustomProperty('Type', 'String')
 
#Add Dimension custom property directly to the MES object
obj.addCustomProperty('Dimension', 'String', 'Dimension of box', '', True, False)
 
#Add Width custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension', 'Width', 'Int4', 'Width of box', 'in', True, False, '24')
 
#Add Height custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension', 'Height', 'Int4', 'Height of box', 'in', True, False, '12')
 
#Type custom property was never assigned a value so None is returned
print obj.getPropertyValue('Type')
 
#Remember to save the MES object
system.mes.saveMESObject(obj)
 
#Width and Height custom properties were assigned values
print obj.getPropertyValue('Dimension.Width')
print obj.getPropertyValue('Dimension.Height')
Output
None
24
12
 addParent(mesObject)
Description

Add a MES object as a parent to another MES object. MES objects can have children and parents. Depending on the type of MES object determines the types of children or parents that can be added. For example, a material class (MESMaterialClass) object can have material definitions (MESMaterialDef) as children, but material definitions objects cannot have material class objects as children.

Note

When a child is added to an MES object, then a parent reference will be added to the child behind the scenes. Likewise, when a parent is added to a child, a child reference will be added to the parent behind the scenes. This insures if integrity of relationships are maintained.

Syntax

addParent(mesObject)


  • Parameters

AbstractMESObject mesObject - An instance to an MES object. An AbstractMESObject object is just the generic form of an MES object when the specific type is unknown.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Get the 10-32 NC Screw material definition object
matDef = system.mes.loadMESObject('10-32 NC Screw', 'MaterialDef')

#Get the Screws material class object
matCls = system.mes.loadMESObject('Screws', 'MaterialClass')
 
#Add the Screws material class object as a parent to the 10-32 NC Screw material definition object
matDef.addParent(matCls)
 
#Save the changes
system.mes.saveMESObject(matDef)
 addParent(mesObjectLink)
Description

Add a MES object link as a parent to another MES object. MES objects can have children and parents. Depending on the type of MES object determines the types of children or parents that can be added. For example, a material class (MESMaterialClass) object can have material definitions (MESMaterialDef) as children, but material definitions objects cannot have material class objects as children.

Note

When a child is added to an MES object, then a parent reference will be added to the child behind the scenes. Likewise, when a parent is added to a child, a child reference will be added to the parent behind the scenes. This insures if integrity of relationships are maintained.

Syntax

addParent(mesObject)


  • Parameters

MES Object Link mesObjectLink - A link to an MES object. A MES Object Link holds identification information to a MES object. This is very efficient when displaying MES objects in a list and all the MES object details are not needed.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Get the Tank 1A equipment object from the equipment path
eq = system.mes.getMESObjectLinkByEquipmentPath('[global]\Dressings Inc\California\Raw Materials\Tank Farm\Tank 1A')

#Get the Storage Tanks equipment class object
eqCls = system.mes.loadMESObject('Storage Tanks', 'EquipmentClass')
  
#Add the Screws material class object to the 10-32 NC Screw material definition object
eq.addChild(eqCls)
 
#Save the changes
system.mes.saveMESObject(eq)

 createComplexProperty(complexPropertyType, name)
Description

Create a complex property directly to an MES object by not specifying a path to the parent property.

Syntax

createComplexProperty(complexPropertyType, name)


  • Parameters

String complexPropertyType - The type of complex property.

String name - The name of complex property.

  • Returns

The complex property for the specified type (Material Resource Property, Equipment Resource Property, Personnel Resource Property, etc.)

  • Scope

All

Code Examples
Code Snippet
od = system.mes.createMESObject('OperationsDefinition')
 
#Load the process segment to base the operations segments on
ps = system.mes.loadMESObject('Receive Material', 'ProcessSegment')
depProp = od.createComplexProperty('SegmentDependency', ps.getName())
 
#Derive a new operation segment from the process segment
os = system.mes.deriveMESObject(ps, 'OperationsSegment', True)
depProp.setSegmentRefType('OperationsSegment')
depProp.setSegmentRefUUID(os.getUUID())
print depProp
Output
{SegmentRef=Operations Segment, , SegmentRefUUID=cfabeb4a-0b2d-4e43-91a8-1258d8b41e32, SegmentRefType=OperationsSegment, SegmentDependencyType=null, SegmentDependencyFactor=null, SegmentDependencyFactorUnits=null}
 getAllCustomProperties()
Description

Returns all the custom properties for the definition and any class object that the definition is a member of plus the inherited custom properties as a list of MESCustomProperty objects.

Syntax

getAllCustomProperties()


  • Parameters

None

  • Returns

List<MESCustomProperty> - The list of custom properties.

  • Scope

All

Code Examples
Code Snippet
matDef = system.mes.loadMESObject('Cane Sugar', 'MaterialDef')
matDef.getAllCustomProperties()

 getChildCollection()
Description

Get the collection of children for an MES object.

Syntax

getChildCollection()


  • Parameters

None

  • Returns

MESObjectCollection - Returns a collection object containing references to all children of the MES object.

  • Scope

All

Code Examples
Code Snippet
#This example reads and prints the name of all child MES objects that belong to the Vinegar Material Class.
mesObject = system.mes.loadMESObject('Vinegar', 'MaterialClass')
 
if mesObject != None:
    childList = mesObject.getChildCollection().getList()
    for child in childList:
		
		#The child variable is of the MESObjectLink type
        print child.getName()
Output
Balsamic Vinegar
Red Wine Vinegar
White Vinegar

 getComplexProperty(complexPropertyName, entryName)
Description

Get the collection of complex properties.

Syntax

getComplexProperty(complexPropertyName, entryName)


  • Parameters

String complexPropertyName - The name for the type of complex property.

String entryName - The name of the complex property entry.

  • Returns

The complex property collection.

  • Scope

All

Code Examples
Code Snippet
seg = system.mes.createMESObject('ProcessSegment')
 
#Create a new material reference complex property
materialProp = seg.createComplexProperty('Material', 'Vinegar')
print seg.getComplexProperty('Material','Vinegar')
Output
{MaterialOptional=false, MaterialProductionSelectable=true, MaterialUse=null, MaterialAutoGenerateLot=false, MaterialRef=, MaterialRefUUID=null, MaterialRefType=null, MaterialEquipmentRef=, MaterialEquipmentRefType=null, MaterialEquipmentRefUUID=null, MaterialEnableSublots=false, MaterialLotNoSource=null, MaterialLotNoSourceLink=null, MaterialQuantitySource=null, MaterialQuantitySourceLink=null, MaterialQuantity=null, MaterialUnits=null, MaterialRatePeriod=null, MaterialRate=null, MaterialCycleTime=0, MaterialFinalLotStatus=null, MaterialAutoLotCompletion=Disabled, MaterialLotDepletionWarning=0, MaterialLotStatusFilter=null}
 getComplexProperty(complexPropertyName, index)
Description

Get the collection of complex properties.

Syntax

getComplexProperty(complexPropertyName, index)


  • Parameters

String complexPropertyName - The name for the type of complex property.

Integer index - The specified position in this list.

  • Returns

The complex property collection.

  • Scope

All

Code Examples
Code Snippet
seg = system.mes.createMESObject('ProcessSegment')
 
#Create a new material reference complex property
materialProp = seg.createComplexProperty('Material', 'Vinegar')
print seg.getComplexProperty('Material', 0)
Output
{MaterialOptional=false, MaterialProductionSelectable=true, MaterialUse=null, MaterialAutoGenerateLot=false, MaterialRef=, MaterialRefUUID=null, MaterialRefType=null, MaterialEquipmentRef=, MaterialEquipmentRefType=null, MaterialEquipmentRefUUID=null, MaterialEnableSublots=false, MaterialLotNoSource=null, MaterialLotNoSourceLink=null, MaterialQuantitySource=null, MaterialQuantitySourceLink=null, MaterialQuantity=null, MaterialUnits=null, MaterialRatePeriod=null, MaterialRate=null, MaterialCycleTime=0, MaterialFinalLotStatus=null, MaterialAutoLotCompletion=Disabled, MaterialLotDepletionWarning=0, MaterialLotStatusFilter=null}
 getComplexProperty(path)
Description

Get the collection of complex properties.

Syntax

getComplexProperty(path)


  • Parameters

String The path to the MES property to get.

  • Returns

The complex property for the specified path.

  • Scope

All

Code Examples
Code Snippet
seg = system.mes.createMESObject('ProcessSegment')
 
#Create a new material reference complex property
materialProp = seg.createComplexProperty('Material', 'Vinegar')
print seg.getComplexProperty('Material.Vinegar')
Output
{MaterialOptional=false, MaterialProductionSelectable=true, MaterialUse=null, MaterialAutoGenerateLot=false, MaterialRef=, MaterialRefUUID=null, MaterialRefType=null, MaterialEquipmentRef=, MaterialEquipmentRefType=null, MaterialEquipmentRefUUID=null, MaterialEnableSublots=false, MaterialLotNoSource=null, MaterialLotNoSourceLink=null, MaterialQuantitySource=null, MaterialQuantitySourceLink=null, MaterialQuantity=null, MaterialUnits=null, MaterialRatePeriod=null, MaterialRate=null, MaterialCycleTime=0, MaterialFinalLotStatus=null, MaterialAutoLotCompletion=Disabled, MaterialLotDepletionWarning=0, MaterialLotStatusFilter=null}
 getComplexPropertyByKind(path)
Description

This method is used to reference properties with various MES object types that have the same property kind and base names.

Options for Kind

  • Material
  • Equipment
  • SupplEquip
  • Personnel

Sample MES property paths:

  • Material.Vinegar.LotNo - where Material is the kind, Vinegar is the base name and LotNo is the property name.
  • Response Material.Vinegar-1.LotNo - where Response Material is the name of the complex property type, Vinegar-1 is the entry name and LotNo is the property name.
Syntax

getComplexPropertyByKind(path)


  • Parameters

String path - The path to the MES property to get. Options for Kind are Material, Equipment, SupplEquip, and Personnel.

  • Returns

AbstractMESProperty - An AbstractMESProperty for the specified path.

  • Scope

All

 getComplexPropertyCount(complexPropertyName)
Description

Get the number of complex properties.

Syntax

getComplexPropertyCount(complexPropertyName)


  • Parameters

String complexPropertyName - The name for the complex property.

  • Returns

Integer count - The size of the complex property collection.

  • Scope

All

Code Examples
Code Snippet
#This code snippet will print the size of complex property with name 'Material'
seg = system.mes.createMESObject('ProcessSegment')
 
#Create a new material reference complex property
materialProp = seg.createComplexProperty('Material', 'White Vinegar')
materialProp = seg.createComplexProperty('Material', 'Balsamic Vinegar')
materialProp = seg.createComplexProperty('Material', 'Red Wine Vinegar')
print seg.getComplexPropertyCount('Material')
Output
3
 getComplexPropertyItemNames(complexPropertyName)
Description

Gets the list of production item with the specified complex property.

Syntax

getComplexPropertyItemNames(complexPropertyName)


  • Parameters

String complexPropertyName - The name of the complex property.

  • Returns

List<String> itemNameList - The list of production item names with the specified complex property.

  • Scope

All

Code Examples
Code Snippet
segName = 'Mixed Nuts 8oz-Nuts Unlimited:Folsom:Packaging:Packaging Line 1'
mesObject = system.mes.loadMESObject(segName, "OperationsSegment")
prodList = mesObject.getComplexPropertyItemNames('ProductionSettings')
for item in prodList:
    print item, " - ", mesObject.getComplexProperty('ProductionSettings',item).getModeRefProperty().getValue()
Output
Packaging Line 1 - Equipment Mode, Production
Packaging Line 1:Casepacker - Equipment Mode, Production
Packaging Line 1:Checkweigher - Equipment Mode, Production
Packaging Line 1:Filler - Equipment Mode, Production
Packaging Line 1:Palletizer - Equipment Mode, Production
Packaging Line 1:Labeler - Equipment Mode, Disabled
 getComplexPropertyTypeNames()
Description

Get the complex properties of a specific type.

Syntax

getComplexPropertyTypeNames()


  • Parameters

None

  • Returns

A list of complex properties that matches the given type.

  • Scope

All

Code Examples
Code Snippet
#This example prints the list of complex properties that matches the type 'Process Segment'.
seg = system.mes.loadMESObject('e9acd913-0ac2-497a-8c41-efa9285bd3ed')
 
#Create a new material reference complex property
materialProp = seg.createComplexProperty('Material', 'Vinegar')
print seg.getComplexPropertyTypeNames()
Output
[Material, Equipment, SupplEquip, Personnel]
 getCoreProperties()
Description

Get the collection of core properties.

Syntax

getCoreProperties()


  • Parameters

None

  • Returns

MESPropertyCollection coreProperties - The collection of core properties.

  • Scope

All

 getCustomProperties()
Description

Returns all of the custom properties of the definition object as an MESPropertyCollection.

Syntax

getCustomProperties()


  • Parameters

None

  • Returns

MESPropertyCollection - A collection of the names of custom properties as strings.

  • Scope

All

Code Examples
Code Snippet
matDef = system.mes.loadMESObject('Cane Sugar', 'MaterialDef')
print matDef.getCustomProperties()
 getCustomPropertiesFull()
Description

Return the custom properties for the MES object as a Python dictionary. The Python dictionary will contain custom property path, definition pairs. The definition is a Python list containing the data type, value, description, units, production visible and required settings of the custom property.

Because custom properties can be nested, the path of the custom property is used. Each level of the path is separated with a period. This allows for names to be duplicated provided the path is unique. For example, it is possible for a MES object to have custom properties "Dimension 1.Width" and "Dimension 2.Width"

Syntax

getCustomPropertiesFull()

  • Parameters

Nothing

  • Returns

PyDictionary - A Python dictionary containing custom property path (name) definition pairs.

  • Scope

All

Code Examples
Code Snippet
#Get the full custom property definitions for a MES object
cp = obj.getCustomPropertiesFull()
 
#Print the Python dictionary of all custom properties
print cp

#Get the definition for just the Width custom property
widthDef = cp['Dimension.Width']
 
#Print the Python list for the Width custom property definition
print widthDef
 
#Print setting individually for the Width custom property
print widthDef[0]	#Data type
print widthDef[1]	#Value
print widthDef[2]	#Description
print widthDef[3]	#Units
print widthDef[4]	#Production Visible
print widthDef[5]	#Required
Output
{u'Dimension.Width': [u'Int8', u'10', u'Box width', u'in', True, False], u'Dimension': [u'String', u'', u'', u'', True, False], u'Dimension.Height': [u'Int8', u'12', u'Box height', u'in', True, False]}
[u'Int8', u'10', u'Box width', u'in', True, False]
Int8
10
Box width
in
True
False
 getCustomPropertiesFull(complexPropertyName, entryName)
Description

Return the custom properties for a complex property of a MES object as a Python dictionary. When the complex properties on a MES object (for example, a material reference) have custom properties, this method is used to get them by type and name. The Python dictionary will contain custom property path, definition pairs. The definition is a Python list containing the data type, value, description, units, production visible and required settings of the custom property.

Because custom properties can be nested, the path of the custom property is used. Each level of the path is separated with a period. This allows for names to be duplicated provided the path is unique. For example, it is possible for a MES object to have custom properties "Dimension 1.Width" and "Dimension 2.Width"

Syntax

getCustomPropertiesFull(complexPropertyName, entryName)


  • Parameters

String complexPropertyType - The name for the type of complex property.

String name - The name of the complex property entry.

  • Returns

PyDictionary - A Python dictionary containing custom property path (name) definition pairs.

  • Scope

All

Code Examples
Code Snippet
#Load a segment MES object
proSeg = system.mes.loadMESObject('Receive Steel', 'ProcessSegment')
 
#Get the custom property values for the Steel In material reference
cp = proSeg.getCustomPropertiesFull('Material', 'Steel In')
 
#Get the definition for just the Thickness custom property
cpDef = cp['Dimension.Thickness']
 
#Print the Python list for the Thickness custom property definition
print cpDef 
 
#Print setting individually for the Thickness custom property
print cpDef [0]	#Data type
print cpDef [1]	#Value
print cpDef [2]	#Description
print cpDef [3]	#Units
print cpDef [4]	#Production Visible
print cpDef [5]	#Required

Output
[u'Float8', u'100', u'Thickness of steel', u'1/1000th', True, True]
Float8
100
Thickness of steel
1/1000th
True
True
 getCustomPropertyDescription(propertyPath)
Description

Get the description of the custom property by name or property path.

Syntax

getCustomPropertyDescription(propertyPath)


  • Parameters

String propertyPath - The name or property path of the custom property to get the description for.

  • Returns

String description - The custom property description.

  • Scope

All

Code Examples
Code Snippet
#Load an MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
 
#Add a custom property
obj.addCustomProperty('Kind', 'String', 'Kind of box', '', True, True)
 
#Print the current enabled state
print obj.getCustomPropertyDescription('Kind')
Output
Kind of box
 getCustomPropertyEnabled(propertyPath)
Description

Get the enabled state of a custom property. If the enabled state is True then custom property is available. If False, the custom property will not appear in component, be used during production or is not accessible in script.

Syntax

getCustomPropertyEnabled(propertyPath)


  • Parameters

String propertyPath - The name or property path of the custom property to get the enabled state.

  • Returns

boolean The enabled state of the custom property.

  • Scope

All

Code Examples
Code Snippet
#Load an MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
 
#Add a custom property
obj.addCustomProperty('Kind', 'String')
 
#Print the current enabled state
print obj.getCustomPropertyEnabled('Kind')

#Disable the custom property named Kind
obj.setCustomPropertyEnabled('Kind', False)

#Print the current enabled state
print obj.getCustomPropertyEnabled('Kind')
Output
True
False
 getCustomPropertyUnits(propertyPath)
Description

Get the units of the custom property.

Syntax

getCustomPropertyUnits(propertyPath)


  • Parameters

String propertyPath - The name or property path of the custom property to get the description for.

  • Returns

String units - The units of the new custom property.

  • Scope

All

Code Examples
Code Snippet
#Load MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
print obj.getCustomPropertyUnits('Kind.Class of Box')
Output
lbs
 getCustomPropertyValues(complexPropertyType, name)
Description

Return the custom properties for the complex property (resource reference) as a Python dictionary. The Python dictionary will contain custom property path, value pairs. Because custom properties can be nested, the path of the custom property is used. Each level of the path is separated with a period. This allows for names to be duplicated provided the path is unique. For example, it is possible for a MES object to have custom properties "Dimension 1.Widith" and "Dimension 2.Width".

For response segments, references to resources are created for each lot, person or supplemental equipment. For example, if a segment is started filling tank 1 and then switches to tank 2, then there will be two complex properties. One that has all the information while tank 1 was selected and a second that has all the information while tank 2 was selected. Custom properties can be added to the complex properties that will be unique for the time each tank was selected. If a pH reading is collected for each tank, then the separate readings can be saved in the appropriate complex property. To specify which complex property to access, extended naming is used. Referring to our sample, if we named the material complex property "Liquid", then the extend name for the first entry is "Liquid-1" and the second entry is "Liquid-2".

Syntax

getCustomPropertyValues(complexPropertyType, name)

  • Parameters

String complexPropertyType - The name for the type of complex property.

String name - The name of the complex property entry.

  • Returns

PyDictionary - A Python dictionary containing custom property path (name) value pairs.

  • Scope

All

Code Examples
Code Snippet
#Get the Storage Tanks equipment class object
proSeg = system.mes.loadMESObject('Receive Steel', 'ProcessSegment')
 
#Get the custom property values for the Steel In material reference
cp = proSeg.getCustomPropertyValues('Material', 'Steel In')
 
#Cycle through and print the custom property values
for path in cp.keys():
	print 'Path: %s = %s' % (path, cp[path])
print
 
#Just access a specific custom property by known path
print 'Dimension 1.Width = %s' % cp['Dimension 1.Width']
 getInheritedProperties()
Description

Get properties inherited by the MES object. These inherited properties are custom properties on the parent(s) of the object.

Syntax

getInheritedProperties()


  • Parameters

None

  • Returns

MESPropertyCollection - The list of inherited properties.

  • Scope

All

Code Examples
Code Snippet
obj = system.mes.loadMESObject('Cashew Nuts', 'MaterialDef')
print obj.getInheritedProperties()
 getMESObjectType()
Description

Get the type of the MES object. This returns an object that represents the MES object type. This object contains other information associated with the type. In most cases only the name of the MES object type is needed and using the getMESObjectTypeName script function is recommended instead.

Syntax

getMESObjectType()


  • Parameters

None

  • Returns

MESObjectType - The type of MES object.

  • Scope

All

Code Examples
Code Snippet
#This example will print the type of MES object.
seg = system.mes.loadMESObject('e9acd913-0ac2-497a-8c41-efa9285bd3ed')
 
#Create a new material reference complex property
materialProp = seg.createComplexProperty('Material', 'Vinegar')
print seg.getMESObjectType()
Output
 Process Segment
 getMESObjectTypeName()
Description

Get the name of the MES object type.

Syntax

getMESObjectTypeName()


  • Parameters

None

  • Returns

String - The MES object type name of the MES object.

  • Scope

All

Code Examples
Code Snippet
obj = system.mes.loadMESObject('Box', 'MaterialDef')
print obj.getMESObjectTypeName()
Output
Material Definition

 getName()
Description

Get the name of the MES object. For each type of MES object, the name must be unique. For example, the name of each material definition is unique. In addition, the MES object name must also be unique for various categories of MES object types.

Syntax

getName()


  • Parameters

None

  • Returns

String - MES object name.

  • Scope

All

Info

Below are the categories of MES object types that the names will be unique:

CategoryMES Object Types
EquipmentEquipment, EquipmentClass
Material, PersonnelMaterialDef, MaterialClass, Person, Personnel Class
OperationOperations Definition, OperationSegment
Code Examples
Code Snippet
obj = system.mes.loadMESObject('Box', 'MaterialDef')
print obj.getName()
Output
Box
Code Examples
Code Snippet
#Example
obj = system.mes.loadMESObject('8da06ff8-2922-4e0c-a01a-e7cda6899a0e')
objLink = system.mes.object.link.create(obj)
print objLink.getName()
Output
Vinegar Tank 1

 getParentCollection()
Description

Get the collection of parents for an MES object.

Syntax

getParentCollection()


  • Parameters

None

  • Returns

MESObjectCollection - Returns a collection object containing references to all parents of the MES object.

  • Scope

All

Code Examples
Code Snippet
#This example reads and prints the name of all parent MES objects that belong to Balsamic Vinegar.
mesObject = system.mes.loadMESObject('Balsamic Vinegar', 'MaterialDef')
 
if mesObject != None:
    parentList = mesObject.getParentCollection().getList()
    for parent in parentList:
		
		#The parent variable is of the MESObjectLink type
        print parent.getName()
Output
Vinegar
 getPropertyValue(propertyPath)
Description

Get a property value of an MES object by name or path. The property can be a core property, custom property or complex property of the MES object. In the case where custom properties are nested, a path is required to return the correct value.

The type of the value depends on the property being read. If no value is currently assigned to the property, None will be returned.

Syntax

getPropertyValue(propertyPath)


  • Parameters

String propertyPath - The name or path of the property being read.

  • Returns

The value of the property. The type depends on the property being read.

  • Scope

All

Code Examples
Code Snippet
#Load a MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
 
#Read and print the Width and Height custom properties that are children of the Dimension custom property.
width = obj.getPropertyValue('Dimension.Width')
height = obj.getPropertyValue('Dimension.Height')
print "Width = %d, Height = %d" % (width, height)
Output
Width = 10, Height = 12
 getUUID()
Description

Return the UUID value from the UUID property of the MES object. UUID stands for Universally Unique Identifier and each MES object will have a UUID assigned.

Syntax

getUUID()


  • Parameters

None

  • Returns

String - UUID of the MES object

  • Scope

All

Code Examples
Code Snippet
obj = system.mes.loadMESObject('Box', 'MaterialDef')
print obj.getUUID()
Output
b17159b6-81ce-4057-a5b3-626126079320
 getVersion()
Description

Return the version number of the MES object. Not all MES objects have version number. Every time a definition type of MES object is modified, the version number is increased. When new schedules or production is run based on the definition MES object, it is tied the latest version of the definition MES objects.

Syntax

getVersion()


  • Parameters

None

  • Returns

Integer - The version number of this MES object.

  • Scope

All

Code Examples
Code Snippet
obj = system.mes.loadMESObject('Box', 'MaterialDef')
print obj.getVersion()
Output
3
 isEnabled()
Description

Get the enabled state of the MES object. If an MES object is not enabled, it will not show in any selection list or able to be selected within script. Essentially, the enabled state will change to false when the MES object is deleted. Deleted MES object still reside in the system for history of past production.

Syntax

isEnabled()


  • Parameters

None

  • Returns

boolean - The enabled state of the MES object.

  • Scope

All

Code Examples
Code Snippet
obj = system.mes.loadMESObject('Box', 'MaterialDef')
print obj.isEnabled()
Output
True
 isModified()
Description

If one or more properties of an MES object are changed, then True will be returned.

Syntax

isModified()


  • Parameters

None

  • Returns

boolean - The MES object modified state.

  • Scope

All

Code Examples
Code Snippet
#Load a MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
print obj.isModified()
 
#Change a property of it
obj.setPropertyValue('Name', 'Empty Box')
print obj.isModified()
Output
False
True
 removeChild(mesObject)
Description

Remove another MES child object for an MES object.

MES objects can have children and parents. Depending on the type of MES object determines the types of children or parents that can be added. For example, a material class (MESMaterialClass) object can have material definitions (MESMaterialDef) as children, but material definitions objects cannot have material class objects as children.

Note

When a child is removed from an MES object, then the parent reference will be removed from the child behind the scenes. Likewise, when a parent is removed from a child, the child reference will be removed from the parent behind the scenes. This insures if integrity of relationships are maintained.

Syntax

removeChild(mesObject)


  • Parameters

AbstractMESObject mesObject - An instance to an MES object. An AbstractMESObject object is just the generic form of an MES object when the specific type is unknown.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Get the Screws material class object
matCls = system.mes.loadMESObject('Screws', 'MaterialClass')
 
#Get the 10-32 NC Screw material definition object
matDef = system.mes.loadMESObject('10-32 NC Screw', 'MaterialDef')
 
#Remove the 10-32 NC Screw material definition object from the Screws material class object
matCls.removeChild(matDef)
 
#Save the changes
system.mes.saveMESObject(matCls)
 removeComplexProperty(complexPropertyName, entryName)
Description

Removes an existing complex property.

Syntax

removeComplexProperty(complexPropertyName, entryName)


  • Parameters

String complexPropertyName - The name for the type of complex property.

String entryName - The name of the complex property entry.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
seg = system.mes.createMESObject('ProcessSegment')
 
#In order to make it more clear, Let us create a complex property named Equipment. 
materialProp = seg.createComplexProperty('Equipment', 'Vinegar Tank1')
 
#This code snippet removed the complex property named 'Equipment'. So that when script function getComplexProperty() is executed it prints None.
removeProp = seg.removeComplexProperty('Equipment', 'Vinegar Tank1')
print seg.getComplexProperty('Equipment', 'Vinegar Tank1')
Output
None
 removeCustomProperty(propertyPath)
Description

Removes an existing custom property.

Syntax

removeCustomProperty(propertyPath)


  • Parameters

String propertyPath - The path of property to remove.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Load MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
obj.removeCustomProperty('Kind.Class of Box') 
 removeParent(mesObject)
Description

Remove another MES parent object for an MES object.

MES objects can have children and parents. Depending on the type of MES object determines the types of children or parents that can be added. For example, a material class (MESMaterialClass) object can have material definitions (MESMaterialDef) as children, but material definitions objects cannot have material class objects as children.

Note

When a child is removed from an MES object, then the parent reference will be removed from the child behind the scenes. Likewise, when a parent is removed from a child, the child reference will be removed from the parent behind the scenes. This insures the integrity of relationships are maintained.

Syntax

removeParent(mesObject)


  • Parameters

AbstractMESObject mesObject - An instance to an MES object. An AbstractMESObject object is just the generic form of an MES object when the specific type is unknown.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Get the 10-32 NC Screw material definition object
matDef = system.mes.loadMESObject('10-32 NC Screw', 'MaterialDef')

#Get the Screws material class object
matCls = system.mes.loadMESObject('Screws', 'MaterialClass')
 
#Remove the Screws material class object from the 10-32 NC Screw material definition object
matDef.removeParent(matCls)
 
#Save the changes
system.mes.saveMESObject(matDef)
 renameComplexProperty(complexPropertyName, entryName, newEntryName)
Description

Renaming an existing complex property.

Syntax

renameComplexProperty(complexPropertyName, entryName, newEntryName)


  • Parameters

String complexPropertyName - The name for the type of complex property.

String entryName - The name of the complex property entry.

String newEntryName - The new complex property name.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
seg = system.mes.createMESObject('ProcessSegment')
 
#Creates a complex property with name 'Equipment'
proSeg = seg.createComplexProperty('Equipment', 'Vinegar Tank1')
 
#Changes the name 'Vinegar Tank1' into 'Vinegar Tank2'
renameProp = seg.renameComplexProperty('Equipment', 'Vinegar Tank1', 'Vinegar Tank2')
 renameCustomProperty(propertyPath, newName)
Description

Rename an existing custom property.

Syntax

renameCustomProperty(propertyPath, newName)


  • Parameters

String propertyPath - The name or property path of the existing custom property to rename.

String newName - New custom property name.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Load an MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
 
#Add a custom property named Type
obj.addCustomProperty('Type', 'String')
 
#Remember to save the MES object
#system.mes.saveMESObject(obj)
 
#Print it to see the name of the new custom property
print obj.getCustomPropertiesFull()
 
#Rename the custom property from Type to Kind
obj.renameCustomProperty('Type', 'Kind')
 
#Print it to see the new custom property name
print obj.getCustomPropertiesFull()

#Remember to save the MES object
system.mes.saveMESObject(obj)

Output
{u'Type': [u'String', u'', u'', u'', False, False]}
{u'Kind': [u'String', u'', u'', u'', False, False]}
 setCustomPropertyDescription(propertyPath, description)
Description

Set the description of the custom property by name or property path.

Syntax

setCustomPropertyDescription(propertyPath, description)


  • Parameters

String propertyPath - The name or property path of the custom property to get the description for.

String description - The custom property description.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Load an MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
 
#Set a new description for Kind
obj.setCustomPropertyDescription('Kind', 'Class of Box')
 
#Prints the current description of the custom property.
print obj.getCustomPropertyDescription('Kind')
Output
Class of Box
 setCustomPropertyEnabled(propertyPath, enable)
Description

Set the enabled state of a custom property. If set to True then custom property is available. If False, the custom property will not appear in component, be used during production or is not accessible in script.

Syntax

setCustomPropertyEnabled(propertyPath, enable)


  • Parameters

String propertyPath - The name or property path of the custom property to set the enabled state.

boolean enable - The enabled state to set the custom property to.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Load an MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
 
#Add a custom property
obj.addCustomProperty('Kind', 'String')
 
#Print the current enabled state
print obj.getCustomPropertyEnabled('Kind')

#Disable the custom property named Kind
obj.setCustomPropertyEnabled('Kind', False)

#Print the current enabled state
print obj.getCustomPropertyEnabled('Kind')
Output
True
False
 setCustomPropertyUnits(propertyPath, units)
Description

Set the units of the custom property.

Syntax

setCustomPropertyUnits(propertyPath, units)


  • Parameters

String propertyPath - The name or property path of the custom property to get the description for.

String units - The units of the new custom property.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Load MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
obj.setCustomPropertyUnits('Kind.Class of Box','lbs')
print obj.getCustomPropertyUnits('Kind.Class of Box')
Output
lbs
 setCustomPropertyValues(customProperties)
Description

This method can be used to set custom properties values or create custom properties of an MES object. The format of the customProperties parameter determines if just custom property values will be assigned or custom properties will be created and values assigned.

Because custom properties can be nested, the path of the custom property is used. Each level of the path is separated with a period. This allows for names to be duplicated provided the path is unique. For example, it is possible for a MES object to have custom properties "Dimension 1.Width" and "Dimension 2.Width"

Python dictionary

To just set the custom property values, use a Python dictionary for the customProperties parameter that contains name value pairs.

To create custom properties, use a Python dictionary for the customProperties parameter that contains name definition pairs. The custom property definition is a Python list that contains the settings. The order of the setting must be data type, value, description, units, production visible and required. Optionally, the production visible and required can be left out. If they are left out the default values of production visible = true and required = false will be used.

Syntax

setCustomPropertyValues(customProperties)

  • Parameters

PyDictionary customProperties - A Python dictionary containing custom property path (name) definition pairs.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Load a material lot MES object
obj = system.mes.loadMESObject('0000000031', 'MaterialLot')
 
#Build the definition of the custom properties to add
current_dataType = 'Float8'
current = 3.2
current_desc = 'Test results - current'
current_units = 'Amps'
 
volts_dataType = 'Float8'
volts= 12.0
volts_desc = 'Test results - current'
volts_units = 'Volts'
lotCP = {'Amps' : [current_dataType , current, current_desc , current_units], 'Volts': [volts_dataType , volts, volts_desc, volts_units]}
print lotCP
 
#Add the custom properties to the material lot MES object
obj.setCustomPropertyValues(lotCP)
 
#Remember to save the MES object
system.mes.saveMESObject(obj)
Output
{'Amps': ['Float8', 3.2, 'Test results - current', 'Amps'], 'Volts': ['Float8', 12.0, 'Test results - volts', 'Volts']}
Code Snippet
#Copy custom properties from one MES object to another
#Load a material lot MES object to copy custom properties values from
obj1 = system.mes.loadMESObject('0000000031', 'MaterialLot')
 
#Read the custom properties
cp = obj1.getCustomPropertiesFull()
print cp
 
#Load a material lot MES object to copy custom properties to
obj2 = system.mes.loadMESObject('0000000030', 'MaterialLot')
 
#Add the custom properties
obj2.setCustomPropertyValues(cp)
 
#Change the values of the custom properties
current = 3.4
volts = 11.9
obj2.setPropertyValue('Amps', str(current))
obj2.setPropertyValue('Volts', str(volts))
 
#Remember to save the MES object
system.mes.saveMESObject(obj2)
Output
{u'Amps': [u'Float8', u'3.2', u'Test results - current', u'Amps', True, False], u'Volts': [u'Float8', u'12.0', u'Test results - volts', u'Volts', True, False]}{u'Amps': 3.4, u'Volts': 11.9}
Code Snippet
#Load a response segment MES object
segObj = system.mes.loadMESObject('8163976b-1333-4aa2-9f76-e622ef1b5174')
 
#Build the custom property definitions
weight = 25
length = 152
cp = {'Weight': ['Int4', weight], 'Length': ['Int4', length]}
 
#Add the custom properties to the Pencil material reference
segObj.setCustomPropertyValues('ResponseMaterial', 'Pencil', cp)  

print segObj.getCustomPropertyValues('ResponseMaterial', 'Pencil')
 
#Remember to save the MES object
system.mes.saveMESObject(segObj)
Output
{u'ResponseMaterial.Pencil.Weight': 25, u'ResponseMaterial.Pencil.Length': 152}
 setEnabled(enable)
Description

Set the enabled state of the MES object. By using this script function with parameter of False will delete the MES object. After setting the enabled state to false, the object must be saved for the changes to take effect. At the time the disabled MES object is saved, the name is also modified. This allows for the name to be reused in the future without naming conflicts.

Syntax

setEnabled(enable)


  • Parameters

boolean enable - The new enabled state to make the MES object.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Disable MES object example
#Load the MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
print "Name of enabled MES object: %s" % obj.getName()
 
#Disable the MES object and save it
obj.setEnabled(False)
system.mes.saveMESObject(obj)
Output
Name of enabled MES object: Box
Code Snippet
#Enable MES object example
#Load the disabled MES object
obj = system.mes.loadDisabledMESObject('Box', 'MaterialDef')
print "Name of disabled MES object: %s" % obj.getName()
 
#Disable the MES object and save it
obj.setEnabled(True)
system.mes.saveMESObject(obj)
Output
Name of disabled MES object: Box{9320}
 setPropertyValue(propertyPath, value)
Description

Set a property value of an MES object by name or path. The property can be a core property, custom property or complex property of the MES object. In the case where custom properties are nested, a path is required to set the correct value.

The property value is passed as a String, but is converted to the correct data type for the property.

Syntax

setPropertyValue(propertyPath, value)


  • Parameters

String propertyPath - The name or path of the property being written to.

String value - The value to set the property to.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Load a MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
 
#Get and print the values before changing them
width = obj.getPropertyValue('Dimension.Width')
height = obj.getPropertyValue('Dimension.Height')
print "Values before setPropertyValue is called: Width = %d, Height = %d" % (width, height)
 
#Set the properties to new values
width = 14
height = 24
obj.setPropertyValue('Dimension.Width', str(width))
obj.setPropertyValue('Dimension.Height', str(height))
 
#Don't forget to save the MES object after changing property values
system.mes.saveMESObject(obj)

#Get and print the new values of the properties
width = obj.getPropertyValue('Dimension.Width')
height = obj.getPropertyValue('Dimension.Height')
print "Values after setPropertyValue is called: Width = %d, Height = %d" % (width, height)
Output
Values before setPropertyValue is called: Width = 10, Height = 12
Values after setPropertyValue is called: Width = 14, Height = 24
Code Snippet
#Rename MES object example
#Load a MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
 
#Get and print the current name of the MES object
#Notice either method can be used to read the Name property
print obj.getName()
print obj.getPropertyValue('Name')
 
#Change the name of the MES object
obj.setPropertyValue('Name', 'Empty Box')

#Don't forget to save the MES object after changing property values
system.mes.saveMESObject(obj)



Object Events

Besides the common MES object events, the following events exist for Equipment State objects.

Setting Name
Description
New

The event is fired when a new instance of a Equipment State object is created.

If no script is entered, then the default handler will be executed. To execute the default handler from within the script entered here, add a script line:

event.runDefaultHandler()  


This object inherits the AbstractMESObject events...

 Click here to expand...

Objects have events associated with them that allow for custom scripts to be added whenever the event occurs. Refer to Object Events for more information.

 

'New' Event

This event is run every time a new MES object is created. It can be used to add custom properties or to perform other tasks.

If no script is entered, then the default handler will be executed. To execute the default handler from within the script entered here, add a script line:

Code Snippet
#Add custom property when a new instance of a MaterialDef object is created.
obj = event.getMESObject()
obj.addCustomProperty('Width', 'Int4', 'Part Width', 'mm', True, False)
event.runDefaultHandler()



Delete Equipment State

  • Click on the Equipment State to be deleted and click Delete




Copy and Paste Equipment State

  • Select the Equipment State to be copied and click Copy
  • Select the Equipment State Class to which the state is to be copied to and click Paste
  • Expand the destination folder to see the copied equipment state









Export and Importing Equipment States

  • Select  the root Equipment States to export all Equipment State Classes and States or select a specific Equipment State Class and Click Export
  • A file Save dialog box will open allowing you to select where to store the file

  • Select Equipment States or a specific State Class and Click Import
  • Select the xml file to be imported and Click Open


  • No labels