OperatingHours
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
Functional description
General
This function block is used to record operating hours and switch-on events at the counter input xFb. The outputs udiOperatingHours and udiCountFb are reset to 0 as soon as at the input xReset a rising edge is detected. The counting process is active as long as at the counter input xFb the state TRUE is present. The output udiOperatingHours shows the cumulative duration of the counting processes since the last reset in hours. The output udiCountFb is incremented with every rising edge at the input xFb incremented. At the output dtLastFb the current date / current time is available during the counting process. At output dtLastFb the date / time at the end of the last counting process is available outside the counting process. At 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. Afterwards, the counter value is incremented continuously again.
Requirement for the use of the function block OperatingHours
For correct operation, the use of the TimeRead2 function block is required.
Write access to the counter values
Via the path ‘InstanceName._OperatingHours.udiOperatingHours’ or ‘InstanceName._OperatingHours.udiCountFb’, write access to both counter values 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

