Skip to end of metadata
Go to start of metadata

Overview

These script functions are used to update the value specified by the date and time for the MES tag collector.

Method Options

 

 system.mes.updateTagCollectorValue(equipmentPath, collectorType, key, dateTime, value)
Description

Update the value specified by the date and time for the MES tag collector. If a value does not existing for the specified timestamp, then an exception will be returned.

Syntax

system.mes.updateTagCollectorValue(equipmentPath, collectorType, key, dateTime, value)


  • Parameters

String equipmentPath - The path from the production model to the desired equipment.

String collectorType - The name of the tag collector type. See Tag Collector Types for more details.

String key Where there are multiple instances of a tag collector type, this specifies which one to use. For example, there can be multiple MES counters for the "Equipment Count" tag collector type. If not needed, pass an empty string. In other words it is the name of the MES counter or the name of the Additional Factor.

Date dateTime - The date of the value to update.

Datatype value - The MES tag collector will be updated with this value.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Set the start and end time
date = system.date.getDate(2017, 2, 21)
beginDateTime = system.date.setTime(date, 15, 58, 15)
endDateTime = system.date.now()
 
equipmentPath = '[global]\Enterprise\San Marcos\MP Rotator\MP Rotator 1'
collectorType = 'Equipment State'
key = ''
#update the tag values
system.mes.updateTagCollectorValue(equipmentPath, collectorType, key, beginDateTime, 9)
#get the tag values
data= system.mes.getTagCollectorValues(equipmentPath, collectorType, key, beginDateTime, endDateTime)
for row in range(data.rowCount):
   for col in range(data.columnCount):
      print data.getValueAt(row, col)
Output
Tue Mar 21 15:58:15 PDT 2017
9
8
None
None
Tue Mar 21 15:58:15 PDT 2017
9
5
None
None
Tue Mar 21 15:58:15 PDT 2017
9
5
None
None
Tue Mar 21 15:58:15 PDT 2017
9
5
None
None 
 system.mes.updateTagCollectorValue(equipmentPath, collectorType, auxValueName, key, dateTime, value)
Description

Update the value specified by the date and time for the MES tag collector. If a value does not existing for the specified timestamp, then an exception will be returned.


If you are using this scripting function to alter a downtime entry, and you point the DifferedToUUID to another equipment item, ensure it is part of the same line. In other words, do not set a Line 1 downtime event to Line 2, this is not supported functionality.

Syntax

system.mes.updateTagCollectorValue(equipmentPath, collectorType, auxValueName, key, dateTime, value)


  • Parameters

String equipmentPath - The path from the production model to the desired equipment. 

String collectorType - The name of the tag collector type. See Tag Collector Types for more details.

String auxValueNameThis specifies which auxiliary value to update. The collectorType 'Equipment State' has the following auxiliary values.  

                              • EquipmentUUID - The unique identifier for the equipment.
                              • State - The current equipment state.
                              • OriginalState - The original equipment state before it is updated.
                              • DifferedToUUID - If the original EquipmentUUID is changed using the Downtime Table then the new uuid is DifferedToUUID.
                              • DifferedState - If the original state is changed using the Downtime Table then the new state is DifferedState.

String key Where there are multiple instances of a tag collector type, this specifies which one to use. For example, there can be multiple MES counters for the "Equipment Count" tag collector type. If not needed, pass an empty string. In other words it is the name of the MES counter or the name of the Additional Factor.

Date dateTime The date of the value to update.  

Datatype value - The MES tag collector will be updated with this value. 

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Set the start and end time
date = system.date.getDate(2017, 2, 21)
dateTime = system.date.setTime(date, 15, 58, 15)
endDateTime = system.date.now()
  
equipmentPath = '[global]\Enterprise\San Marcos\MP Rotator\MP Rotator 1'
collectorType = 'Equipment State'
key = ''
system.mes.updateTagCollectorValue(equipmentPath, collectorType, 'DifferedState', key, dateTime, 4)

#get the tag values
data= system.mes.getTagCollectorValues(equipmentPath, collectorType, key, dateTime, endDateTime)
for row in range(data.rowCount):
   for col in range(data.columnCount):
      print data.getValueAt(row, col)
Output
Tue Mar 21 15:58:15 PDT 2017
9
2
None
4
Tue Mar 21 15:58:15 PDT 2017
9
5
None
4
Tue Mar 21 15:58:15 PDT 2017
9
5
None
4
Tue Mar 21 15:58:15 PDT 2017
9
5
None
4

 

 

  • No labels