How to create Equipment State Class using scripting in Ignition


How to create equipment state class inside the "Equipment States" using scripting in sepasoft.

Above image is of Equipment Manager OEE State Class

Following example from Sepasoft user manual.
https://docs.sepasoft.com/articles/#!user-manual/mes-equipment-state/a/MESEquipmentState-eqstateObjectCreation

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')
stateObjList = system.mes.object.list.createList()
stateObjList.add(stateCls)
stateObjList.add(state)
system.mes.saveMESObjects(stateObjList)
1 Like