Overview

These script functions are used to record a single value for the MES tag collector. If a value has already been recorded for the same timestamp, an exception will be returned.

Method Options

Description

Record a single value for the MES tag collector at the current gateway time. If a value has already been recorded for the same timestamp, an exception will be returned.

Syntax

system.mes.addTagCollectorValue(equipmentPath, collectorType, key, 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.

Datatype value - The value to record to the MES tag collector.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#The following script will add tag value 2 at the current gateway time
equipmentPath = '[global]\Enterprise\San Marcos\MP Rotator\MP Rotator 1'
collectorType = 'Equipment Mode'
key = ''
value = 4 #Maintenance
system.mes.addTagCollectorValue(equipmentPath, collectorType, key, value)
Description

Record a single value for the MES tag collector. If a value has already been recorded for the same timestamp, an exception will be returned. If dateTime is in the future, the current gateway time will be used instead.

Syntax

system.mes.addTagCollectorValue(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 to the value being added. If dateTime is in the future, the current gateway time will be used instead.

Datatype value - The value to record to the MES tag collector.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#The following script will add tag value 2
dateTime = system.date.now()
equipmentPath = '[global]\Enterprise\San Marcos\MP Rotator\MP Rotator 1'
collectorType = 'Equipment Mode'
key = ''
value = 4 #Maintenance
system.mes.addTagCollectorValue(equipmentPath, collectorType, key, dateTime, value)
Description

(function available in 2.79.0 SP1 and 2.80.0 SP1 onward) Record a single value for the MES tag collector. For the tag collector types Equipment Count and Equipment Cycle Count, an option checkbox is provided to update all subsequent entries up to the present time to include the numeric change in value between the new entry and the entry previous to it. If a value has already been recorded for the same timestamp, an exception will be returned. If dateTime is in the future, the current gateway time will be used instead.

Syntax

system.mes.addTagCollectorValue(equipmentPath, collectorType, key, dateTime, value, updateFollowing)


  • 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 to the value being added. If dateTime is in the future, the current gateway time will be used instead.

Datatype value - The value to record to the MES tag collector.

Boolean updateFollowing - (for tag collector types Equipment Count and Equipment Cycle Count) If True, all subsequent entries will be updated to reflect the change in value of the new entry. If False, subsequent entries will be not be updated.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#The following script will add tag value 2 and then update subsequent tag collector entries to reflect the change in value due to the new entry.
dateTime = system.date.now()
equipmentPath = '[global]\Enterprise\San Marcos\MP Rotator\MP Rotator 1'
collectorType = 'Equipment Mode'
key = ''
value = 4 #Maintenance
updateFollowing = True
system.mes.addTagCollectorValue(equipmentPath, collectorType, key, dateTime, value, updateFollowing)



How Manually Adding a New Historical Tag Collector Value Affects an MES Counter

  • If a Tag Collector entry is made for an MES Counter using system.mes.addTagCollectorValue with the overloaded function updateFollowing set to True, the MES software will automatically add/subtract the delta in counter value between the edited entry and the previous entry to/from all entries forward in time to the present. If updateFollowing set to false, then then values of subsequent entries will not be adjusted.
  • system.mes.addTagCollectorValues will not automatically add/subtract the delta in counter value from subsequent entries (there is no overload function available).

Refer to this Sepasoft Knowledge Base article for details: How Manually Adding a New Historical Tag Collector Value Affects an MES Counter