system.mes.monitor.count

Sepasoft MES Module Suite

Description

Creates a new counter. Increment or decrement the counter value using the methods .increment() and .decrement().

Syntax

system.mes.monitor.count(name)


  • Parameters

String name - The name to identify this metric by. Using '/' in the name will create sub folders in the Tag structure.

  • Returns

counter - Counter object.

  • Scope

All

Object Functions

The following methods use the Counter object.

increment()

Description

Increments the counter metric by the integer n. If not present, the counter metric is incremented by 1.

Syntax

increment(n)


  • Parameters

Integer n - (optional) The integer to increment the counter metric by. If not present, the counter metric is incremented by 1.

  • Returns

 None

  • Scope

All

Code Examples

Code Snippet

Code
#Increment monitor counter by integer value n (or by 1 if no integer is present)
#In this example, Counter1 will be incremented by 2
system.mes.monitor.count("Counter1").increment(2)


Counter value appears in Metric Categories list in the MES Monitor component:

The associated Tag value is also updated:

decrement()

Description

Decrements the counter metric by the integer n. If not present, the counter metric is decremented by 1.

Syntax

decrement(n)


  • Parameters

Integer n - (optional) The integer to decrement the counter metric by. If not present, the counter metric is decremented by 1.

  • Returns

 None

  • Scope

All

Code Examples

Code Snippet

Code
#Decrement monitor counter by integer value n (or by 1 if no integer is present)
#In this example, Counter1 will be decremented by 2
system.mes.monitor.count("Counter1").decrement(2)


Counter value appears in Metric Categories list in the MES Monitor component:

The associated Tag value is also updated:

addException()

Description

Adds an exception to the counter metric.

Syntax

addException(e)


  • Parameters

Exception e - The exception to add to the counter metric.

  • Returns

 None

  • Scope

All

Code Examples

Code Snippet

Code
#Add a custom exception associated with Counter1
from java.lang import Exception
system.mes.monitor.count("Counter1").addException(Exception('This is a custom exception'))


The existence of an exception is noted on the server in the MES Monitor component by the  icon:

The exception appears in the Metric Categories list in the MES Monitor component (in several places):





Sepasoft MES Module Suite