MES 3.0

The Analysis Scripts set-up on the window OEE_03_Scripting/03_Analysis has five main components:

  1. Text Field (Ignition)
  2. MES Object Selector
  3. Power Table (Ignition)
  4. Two Buttons (Ignition)



Configure the components as follows:



Configure Text Field

  1. Drag an Ignition Label component and an Ignition Text Field component onto the window. Position and resize as shown above.

  2. Rename the Label to Name.

  3. Rename the Text Field to tf_AnalysisName.





Configure MES Object Selector

  1. Drag an MES Object Selector component onto the window. Position and resize as shown above.

  2. Rename it to mos_LineSelector.

  3. Set the checkboxes for Include MES Line Objects and Show Equipment Path.




Configure Power Table

  1. Drag an Ignition Power Table component onto the window. Position and resize along the bottom of the window, as shown above.

  2. Data will be 'pushed' into the Power Table by the Execute Analysis button event (button pressed and released), so there is no configuration required.




Configure Ignition Buttons

  1. Drag two Ignition Buttons onto the window. Position and resize as shown above.

  2. For each of the Buttons, use the associated code block in the panels below to configure, as follows:
    1. Change the Button's Text property to match the Button image.
    2. Change the Name property to match the name provided.
    3. Open the Component Scripting dialog box (Ctrl-J), select the actionPerformed event handler script area and paste in the associated script.




Button Name:  btn_CreateAnalysis

Script for the actionPerformed event handler:

analysisName = event.source.parent.getComponent('tf_AnalysisName').text
if analysisName == '': analysisName = "I Named This For You"

eqPath = event.source.parent.getComponent('mos_LineSelector').equipmentItemPath
analysisSettings = system.mes.analysis.createMESAnalysisSettings(analysisName)
 
analysisSettings.setFilterExpression('Equipment Path = %s' % eqPath)
analysisSettings.setDataPoints([
	'Equipment Name', 
	'Equipment Path', 
	'OEE', 
	'OEE Availability', 
	'OEE Performance', 
	'OEE Quality', 
	'Equipment State Name', 
	'State Duration'])
analysisSettings.setGroupBy('Equipment Path')
analysisSettings.setOrderBy('Equipment Name')
system.mes.saveMESObject(analysisSettings)
 
#If you add the optional MES Object Selector for use with the Delete Analysis button
#   then remove the comment for the line below to get updated data pushed out
#event.source.parent.getComponent('mos_analysisSettings').updateUI()

Reference:



Button Name:  btn_ExecuteAnalysis

Script for the actionPerformed event handler:

analysisName = event.source.parent.getComponent('tf_AnalysisName').text
asList = system.mes.analysis.getMESAnalysisSettingsList()
 
if analysisName in asList:
    endDate = system.date.now()
    beginDate = system.date.addDays(endDate, -30)
    results = system.mes.analysis.executeAnalysis(beginDate, endDate, analysisName)
    ds = results.getDataset()
else:
    ds = system.dataset.toDataSet([analysisName], [['Not a valid Analysis']])   
  
event.source.parent.getComponent('Power Table').data = ds

Reference:




OPTIONAL: Configure Delete Analysis

This optional component group allows you to delete any existing Analysis, so you can create it again for practice. The Update button updates the list of available Analyses shown in the MES Object Selector above it (if you go to a previous screen and create a new Analysis, it won't show up in the drop-down list until you click the Update button).

  1. Drag an MES Object Selector component onto the window. Position and resize in the upper-right area of the window.

  2. Rename it to mos_analysisSettings.

  3. Set the checkbox for Include Analysis Settings Objects.

  4. Drag two Ignition Button components onto the window. Size and position them under the new MES Object Selector, as shown to the right.

Delete Analysis Button

  1. Change the right Button's Text property to Delete Analysis.

  2. Bind the Enabled property to the following expression:

    Enabled property of Delete Analysis Button
    {Root Container.mos_analysisSettings.selectedName} != ''
  3. Paste the following script into the actionPerformed event handler:

    Script for Delete Analysis Button
    settingsName = event.source.parent.getComponent('mos_analysisSettings').selectedName
    system.mes.analysis.deleteMESAnalysisSettings(settingsName)
    event.source.parent.getComponent('mos_analysisSettings').updateUI()

Update Button

Clicking the Update button is only required if you have created a new Analysis on the OEE_02_Scheduling\03_Analysis screen, since the new Analysis won't show up in the MES Object Selector until you update its UI). Both the Create Analysis and Delete Analysis buttons already have an 'update UI' line in their scripts for when an Analysis is either created or deleted.

  1. Change the left Button's Text property to Update.

  2. Paste the following script into the actionPerformed event handler:

    Script for Update Analysis Button
    event.source.parent.getComponent('mos_analysisSettings').updateUI()

Modify Script

  1. Edit the script for the Create Analysis button:
    1. Remove the comment hash from the last line of the script, to enable updating the list of available Analyses in the MES Object Selector above the Delete Analysis button:






  • No labels