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 Name | Required | Data Type | Meaningful Value Range | Default | Description |
---|---|---|---|---|---|
channels | Yes | Array[counter] | - | - | List of definitions of all event counters. See further below. |
pollingInterval | No | Number | [100 - 10000 ] | 500 | Constant time interval(ms) after which the counters poll the assigned input channel for available values. |
Counter structure
General meter parameters
Parameter Name | Required | Data Type | Meaningful Value Range | Default | Description |
---|---|---|---|---|---|
inputChannel | Yes | String | Any | - | Input channel for the event counter. |
outputChannel | No | String | Any | * | Name of the counter channel from which the last counter value can be read. |
eventType | No | String Enum | ["Rising", "Falling", "Both"] | "Rising" | Event type according to which the counter evaluates the time series. |
enableStartTimeChannel | No | Bool | - | false | Set 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 Name | Required | Data Type | Meaningful Value Range | Default | Description |
---|---|---|---|---|---|
threshold | No | Number | Any | 0 | Numeric 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:
Name | Instance function? | Payload Example | Description |
---|---|---|---|
reset | Yes | {"counter": "producer1.signal.Counter"} | Resets the counter with the output channel producer1.signal.Counter to 0* |
set | Yes | {"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
Information | Value |
---|---|
Authors | optiMEAS Measurement and Automation Systems GmbH |
since smartCORE | 2.5 |
Module type | Consumer |
Dependencies | NONE |