Activity counting module "uptime"
Description
The "uptime" module consumes a certain set of input channels, applies a predicate to their channel values and adds up the time periods for which the predicate is fulfilled. The summed time periods are then stored in a corresponding persistent file and additionally produced in the form of channels.
Interfaces and protocols used
NONE
JSON configuration example (demo)
The following section shows a demo configuration of the module.
{
"module": "uptime",
"factory": "uptime",
"config":{
"fileName": "/sdi/log/uptimes.ini",
"pollingIntervalMs": 1000,
"writeIntervalMs":5000,
"reproductionTimeoutMs":60000,
"triggerChannels":[
{
"inputChannel": "ch_trigger_sawtooth_int64",
"outputChannel": "ch_trigger_sawtooth_int64_and2_ch",
"countIf": "&2"
},
{
"inputChannel": "ch_trigger_sawtooth_int64",
"outputChannel": "ch_trigger_sawtooth_int64_and4_ch",
"countIf": "&4"
},
{
"inputChannel": "ch_trigger_sawtooth_int64",
"outputChannel": "ch_trigger_sawtooth_int64_andoct8_ch",
"countIf": "&010"
},
{
"inputChannel": "ch_trigger_sawtooth_int64",
"outputChannel": "ch_trigger_sawtooth_int64_andhex16_ch",
"countIf": "&0xA"
},
{
"inputChannel": "ch_trigger_sawtooth_int64",
"outputChannel": "ch_trigger_sawtooth_int64_andbinary4_ch",
"countIf": "&0b100"
},
{
"inputChannel": "ch_trigger_sawtooth_int64",
"outputChannel": "ch_trigger_sawtooth_int64_andbinary4or1_ch",
"countIf": "&0b101"
},
{
"inputChannel": "ch_trigger",
"outputChannel": "ch_trigger_outputChannel",
"offset":-10
},
{
"inputChannel": "ch_trigger",
"outputChannel": "ch_trigger_outputChannel_RENAMED_CHANNEL"
},
{
"inputChannel": "ch_trigger_sawtooth",
"outputChannel": "ch_trigger_sawtooth_lessThan_90_channel",
"countIf": "<90,0"
},
{
"inputChannel": "ch_trigger_sawtooth",
"outputChannel": "ch_trigger_sawtooth_lessOrEqual_90_channel",
"countIf": "<=90"
},
{
"inputChannel": "ch_trigger_sawtooth",
"outputChannel": "ch_trigger_sawtooth_greaterThan_130_channel",
"countIf": ">130"
},
{
"inputChannel": "ch_trigger_sawtooth",
"outputChannel": "ch_trigger_sawtooth_greaterOrEqual_130_channel",
"countIf":">=130.0"
},
{
"inputChannel": "ch_trigger_sawtooth",
"outputChannel": "ch_trigger_sawtooth_inRangeExclusive_90_130_channel",
"countIf": "90.0~130"
},
{
"inputChannel": "ch_trigger_sawtooth",
"outputChannel": "ch_trigger_sawtooth_inRangeInclusive_90_130_channel",
"countIf": "90=~=130.0"
},
{
"inputChannel": "ch_trigger_sawtooth",
"outputChannel": "ch_trigger_sawtooth_notInRangeExclusive_90_130_channel",
"countIf": "90.!~130"
},
{
"inputChannel": "ch_trigger_sawtooth",
"outputChannel": "ch_trigger_sawtooth_notInRangeInclusive_90_130_channel",
"countIf": "90=!~=130."
},
{
"inputChannel": "ch_trigger_sawtooth",
"outputChannel": "ch_trigger_sawtooth_equal_110_channel",
"countIf":"==110."
},
{
"inputChannel": "ch_trigger_sawtooth",
"outputChannel": "ch_trigger_sawtooth_notEqual_110_channel",
"countIf":"!=110."
}
]
}
}
Module parameters
Parameter Name | Required | Data Type | Meaningful Value Range | Default | Description |
---|---|---|---|---|---|
fileName | No | STRING | valid writable file path | "/sdi/config/uptimes.ini" | path to the persistent file in which the counter readings are saved |
pollingIntervalMs | No | INT | 1000 (1 s) | Interval [ms] for the periodic evaluation of the counter predicates | |
writeIntervalMs | No | INT | 60000 (60 s) | Interval [ms] for updating the counter readings within the persistent file | |
reproductionTimeoutMs | No | INT | 60000 (60 s) | Timeout [ms] for the unconditional production of the resulting counter channels if no counter update has taken place | |
triggerChannels | YES | JSON Array of JSON objects | see below | Configuration of the channels to be monitored and their counter channels |
Configuration of the "triggerChannels"
Parameter Name | Required | Data Type | Meaningful Value Range | Default | Description |
---|---|---|---|---|---|
inputChannel | YES | STRING | valid channel name | monitored channel | |
outputChannel | YES | STRING | counter channel of the monitored channel | ||
offset | No | INT | 0 | an additional offset that is added to the CounterChannel value | |
countIf | No | STRING | inputChannel value is interpreted as true | an optional predicate that converts the value of inputChannel into a Boolean value (see below) |
Configuration of the "countIf" predicate
The predicate can be defined with the following notations
predicate type | predicate examples | description |
---|---|---|
Bitwise & | "&2", "&010", "&0xf0", "&0b10010" | Bitwise conjunction of the value of the monitored (integer) channel, e.g. for status monitoring of bit masks. Decimal, octal, hexadecimal and binary representations are supported (displayed from left to right). |
True comparison < , > | "<70.0", ">90" | True comparison of the value of the monitored channel |
Comparison <= , >= | "<=70.0", ">=90" | Comparison of the value of the monitored channel |
Comparison for within range ~ | "7~10", "7=~10", "7~=10", "7=~=10" | Comparison for belonging to the range for the ranges 7-10, excluding 7 and 10, excluding 10, excluding 7, including 7 and 10 (shown from left to right) |
Comparison for out-of-range !~ | "7!~10", "7=!~10", "7!~=10", "7=!~=10" | Comparison for not belonging to the range 7-10, excluding 7 and 10, excluding 10, excluding 7, including 7 and 10 (shown from left to right) |
Equality == and inequality != | "==42", "!=7.0" | Checking the monitored channel for equality or inequality |
Reset the meter readings (Reset) via SCPI
The counter readings can be reset or changed via the SCPI action UPTIME:SET
.
Parameters
Optional | Parameter | Data type | Value range | Meaning |
---|---|---|---|---|
No | Name | STRING | Name of counter | |
No | Meter reading | INT | Newly assigned meter reading |
Returns
OK or ERR
Example
< uptime:set counter,42
> OK
Reset the meter readings (Reset) via RPC
The counter readings can be reset or changed via the remote procedure call [$Module instance]::setCounter
in optiCloud.
Parameter
Optional | Parameter | Data type | Value range | Meaning |
---|---|---|---|---|
No | counterVariable | STRING | The channel name of the counter to be changed. | |
No | counterValue | INT | 0 - * | The value to which the counter should be set. |
Example
RPC method: [uptime0]::setCounter
.
RPC parameter:
{
"counterVariable": "SawToothExceed70_Time",
"counterValue": 0
}
Module information
Information | Value |
---|---|
Author | optiMEAS Measurement and Automation Systems GmbH |
since smartCORE | 0.143 |
Module type | Consumer / Producer |
Dependencies | Channels to be monitored |