CounterMonitoring
CounterMonitoring (FB)
CounterMonitoring (FB)FUNCTION_BLOCK CounterMonitoring
Short description
Monitoring of a counter reading and generation of a fault message Typical application: Monitoring a water meter for exceeding a maximum consumption during a monitoring interval
Representation

Interfaces
Inputs
xEn
BOOL
FALSE
Enable / disable the counter monitoring (TRUE = enabled)
rCounterValue
REAL
0.0
Current absolute counter value (e.g. meter for water volume)
xResetAlarm
BOOL
FALSE
Reset of the output 'xAlarm' (on each rising edge)
Outputs
xAlarm
BOOL
FALSE
Fault message - counter monitoring (FALSE = off, TRUE = on)
tMonIntervall
TIME
Duration of a monitoring interval
tRemainIntervall
TIME
Remaining time in the monitoring interval
rConsumMax
REAL
Maximum consumption in the monitoring interval
rConsumIntervall
REAL
Current consumption in the monitoring interval
rConsumRemain
REAL
Remaining consumption in the monitoring interval before the alarm is triggered
Setpoints / parameters
udiMonIntervall
UDINT
24
Duration of a monitoring interval (0 … 4294967295)
tMinIntervall
TIME
T#0s
Absolute minimum duration of a monitoring interval
tMaxIntervall
TIME
T#7D
Absolute maximum duration of a monitoring interval
eScaleIntervall
eTime
eTime.Hour
Scaling of the duration 'udiMonIntervall'
rConsumLimit
REAL
10.0
Limit value for consumption in the monitoring interval
Function description
General
This function block is used to monitor a media consumption (water, electricity, etc.) (input 'rCounterValue') during the configurable monitoring interval 'tMonIntervall'. If the consumption exceeds the maximum value for the monitoring interval 'rConsumLimit', an alarm ('xAlarm' = TRUE) is triggered. It can be reset by a rising edge on the input 'xResetAlarm'.
Monitoring
The cyclic monitoring interval starts if all of the following conditions are met simultaneously:
'xEn' = TRUE
'rConsumLimit' > 0.0
'tMonIntervall' >= T#60s
The cyclic monitoring interval is terminated if at least one of these conditions is no longer met. At the start of each monitoring interval the current counter value 'rCounterValue' is stored as the start value. During the monitoring interval the difference between the current counter value and the start value is continuously calculated (rConsumIntervall). The output xAlarm is activated (= TRUE) whenever this difference exceeds the threshold rConsumLimit. The output xAlarm is reset (= FALSE) by each rising edge at the input 'xResetAlarm'. The setting of the duration 'tMonIntervall' is made by the set values 'udiMonIntervall' (absolute numeric value) in combination with 'eScaleIntervall' (scaling) taking into account 'tMinIntervall' (absolute minimum) and 'tMaxIntervall' (absolute maximum).
Indicators
The following outputs are available to display the current operating status:
xAlarm Fault message - counter monitoring (FALSE = off, TRUE = on)
tMonIntervall Duration of a monitoring interval
tRemainIntervall Remaining time in the monitoring interval
rConsumMax Maximum consumption in the monitoring interval (identical to rConsumLimit)
rConsumIntervall Current consumption in the monitoring interval (only consumptions >= 0.0 are displayed)
rConsumRemain Remaining consumption in the monitoring interval before the alarm is triggered (only consumptions >= 0.0 are displayed)
Locking of the block (xEn = FALSE)
These outputs take the following fixed states:
xAlarm FALSE
tMonIntervall T#0s
tRemainIntervall T#0s
rConsumMax 0.0
rConsumIntervall 0.0
rConsumRemain 0.0
CODESYS
InOut:
Input
xEn
BOOL
TRUE
Input
rCounterValue
REAL
0.0
Input
xResetAlarm
BOOL
FALSE
Input Const
rConsumLimit
REAL
10.0
Input Const
eScaleIntervall
eTime
eTime.Hour
Input Const
tMaxIntervall
TIME
TIME#10080m0s0ms
Input Const
tMinIntervall
TIME
TIME#0ms
Input Const
udiMonIntervall
UDINT
24
Output
xAlarm
BOOL
Output
tMonIntervall
TIME
Output
tRemainIntervall
TIME
Output
rConsumMax
REAL
Output
rConsumIntervall
REAL
Output
rConsumRemain
REAL
Last updated

