Sepasoft MES Module Suite
system.mes.addTagCollectorValues(equipmentPath, collectorType, key, values)
Record multiple values for the MES tag collector. If a value has already been recorded for one of the timestamps, an exception will be returned.
Syntax
system.mes.addTagCollectorValues(equipmentPath, collectorType, key, values)
- 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 information.
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.
PyDictionary values - A Python dictionary containing the date(of type Date) and value.
- Returns
Nothing
- Scope
All
Python |
#Define the from and to dates date1 = system.date.getDate(2017, 2, 17) dateTime1 = system.date.setTime(date1, 12, 55, 31) date2 = system.date.getDate(2017, 2, 17) dateTime2 = system.date.setTime(date2, 13, 06, 13) equipmentPath = '[global]\Enterprise\San Marcos\MP Rotator\MP Rotator 1' collectorType = 'Equipment State' key = '' #Date and Value pairs as a python dictionary values={dateTime1:4, dateTime2:3} system.mes.addTagCollectorValues(equipmentPath, collectorType, key, values) |
Post-Dated Production Data Insert Example
Python |
##This function takes relevant parameters, checks for existing values, and if there isn't an existing value, writes the values. ##Note that handling the conflicting data case is not provided (i.e. another value already exists.) def checkAddUpdateOEEVals(eqPath, collectorType, dateTimes, values): goodTimes = {} for i in range(len(dateTimes)): dateTime = dateTimes[i] result = system.mes.getTagCollectorValue(eqPath, collectorType, '', dateTime) if result is None: goodTimes.update({dateTime:values[i]}) system.mes.addTagCollectorValues(eqPath, collectorType, '', goodTimes) eqPath = 'New Enterprise\Site\Area\Line 1' collectorType = 'Equipment Mode' dateTimes = [system.date.now(), system.date.addHours(system.date.now(), -2)] values = [1, 3] checkAddUpdateOEEVals(eqPath, collectorType, dateTimes, values) |
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 or system.mes.addTagCollectorValues, the MES software will not automatically add/subtract the delta in counter value between the new entry and the previous entry to/from all entries forward in time to the present.
|
Sepasoft MES Module Suite