OperatingHours
OperatingHours (FB)
OperatingHours (FB)FUNCTION_BLOCK OperatingHours
Short description
Counter for operating hours and switch-on events
Representation

Interfaces
Inputs
xFb
BOOL
Counter - input
xReset
BOOL
FALSE
Enable - input - reset
Outputs
udiOperatingHours
UDINT
Counter - output - operating hours
udiCountFb
UDINT
Counter - output - switch-ons
dtLastFb
DATE_AND_TIME
Date/time of the end of the last counting process
Function description
General
This function block is used to record the operating hours and switch-on events at the counter input xFb. The outputs udiOperatingHours and udiCountFb are reset to 0 as soon as a rising edge is detected at the input xReset A counting process is active as long as the counter input xFb is TRUE. The output udiOperatingHours shows the cumulative duration of the counting processes since the last reset operation in hours. The output udiCountFb is incremented with each rising edge at the input xFb is incremented. At the output dtLastFb the current date / time is available during the counting process. At the output dtLastFb the date / time at the end of the last counting process is available outside the counting process. At the output dtLastFb the initialization value DT#1970-1-1-0.0.0 is output before the first counting process.
Value ranges of the outputs udiOperatingHours and udiCountFb
Valid counter values are within the limits 0 and 4294967295. Incrementing the counter value 4294967295 resets the counter value to 0. Subsequently the counter value is incremented continuously again.
Prerequisite for the use of the OperatingHours function block
The use of the TimeRead2 function block is required for correct operation.
Write access to the counter values
Via the path 'InstanceName._OperatingHours.udiOperatingHours' or 'InstanceName._OperatingHours.udiCountFb' write access to both counters is possible.
CODESYS
InOut:
Input
xFb
BOOL
Input
xReset
BOOL
FALSE
Output
udiOperatingHours
UDINT
Output
udiCountFb
UDINT
Output
dtLastFb
DT
Methods:
mReset
Structure:
mReset (Method)
Last updated

