Skip to main content

Event counter module

Description

The "eventcounter" module offers the functionality to evaluate the time series of numerical and Boolean channels. The user can define one or more counters for an input channel, which can count the following events based on an event types and other parameters to count the following events:

  • Exceeding/falling below a limit value for numerical channels
  • For Boolean channels, the number of transitions Low to High, High to Low or both

Interfaces

  • smartCORE channels
  • RPC callbacks (for the "opticloud" module)

JSON configuration

The following section lists examples of configurations for defining your own counters.

Example configuration (minimum)

A minimum configuration only consists of specifying which input channels are to be evaluated by a counter.

{
"module": "eventcounter",
"factory": "eventcounter",
"config": {
"channels": [
{
"inputChannel": "Producer.BooleanChannel"
},
{
"inputChannel": "Producer.DoubleChannel"
},
{
"inputChannel": "Producer.IntChannel"
},
...
]
}
}

Example configuration (maximum)

{
"module": "eventcounter",
"factory": "eventcounter",
"config": {
"pollingInterval": 1000,
"channels": [
{
"inputChannel": "Producer.FloatChannel",
"outputChannel": "Events.MyCounter",
"threshold": 13.5,
"eventType": "Falling",
"enableStartTimeChannel": true
},
...
]
}
}

Parameter list

Global parameters

Parameter NameRequiredData TypeMeaningful Value RangeDefaultDescription
channelsYesArray[counter]--List of definitions of all event counters. See further below.
pollingIntervalNoNumber[100 - 10000 ]500Constant time interval(ms) after which the counters poll the assigned input channel for available values.

Counter structure

General meter parameters

Parameter NameRequiredData TypeMeaningful Value RangeDefaultDescription
inputChannelYesStringAny-Input channel for the event counter.
outputChannelNoStringAny*Name of the counter channel from which the last counter value can be read.
eventTypeNoString Enum["Rising", "Falling", "Both"]"Rising"Event type according to which the counter evaluates the time series.
enableStartTimeChannelNoBool-falseSet to true to enable the production of timestamps** that indicate the last counter restart.

*If not specified, a name is created for the output channel according to the following pattern: {inputChannel}.{eventType}Counter
**The timestamp specifies the nanoseconds since the UNIX epoch. The name of a timestamp channel is formed as follows is formed as follows: {outputChannel}.LastStartTime

Parameters for numeric channels

The following is a list of parameters that are evaluated for numerical input channels.

Parameter NameRequiredData TypeMeaningful Value RangeDefaultDescription
thresholdNoNumberAny0Numeric threshold value for the detection of the threshold being exceeded.

Note on optiCLOUD configuration

The following section contains additional information on configuring and using the "opticloud" module in conjunction with this module.

optiCLOUD Channel configuration

The following configuration is recommended for transferring the counter and timestamp channels:

{
"module": "opticloud_eventcounter_example",
"factory": "opticloud",
"config": {
"channels": [
{
"messageType": "telemetry",
"name": "*Counter"
},
{
"messageType": "clientAttribute",
"name": "Events.*.LastStartTime"
}
],
...
}
}

RPC Callbacks

Reference for the available RPC callbacks:

NameInstance function?Payload ExampleDescription
resetYes{"counter": "producer1.signal.Counter"}Resets the counter with the output channel producer1.signal.Counter to 0*
setYes{"counter": "producer1.signal.Counter", "value": 300}Sets the counter with the output channel producer1.signal.Counter to 300*

*Optionally, all counters can also be set or reset with "counter":".*".

Module information

InformationValue
AuthorsoptiMEAS Measurement and Automation Systems GmbH
since smartCORE2.5
Module typeConsumer
DependenciesNONE