Problem Statement
The DIAG_LOG
function block (FB) type is used in the MVCD framework to provide a time-stamped log of
diagnostic messages and their sources. The time stamp provided by
DIAG_LOG
records the local time at which an event occurs at its
REQ
input to report the diagnostic message. This leads to multiple
possible sources of significant error:
- The time at which the message is logged will always be later than the time at which the message is generated.
- The delay between message generation and its logging may be variable, especially in distributed systems.
- As a result, messages from different devices in a distributed system may even be logged in the reverse order of their occurrence, making it impossible to perform correct higher-level sequence-of-events analysis.
The purpose of this design pattern is to remove the above sources of error by time-stamping the message and source identification associated with an event, immediately upon the occurrence of the event, before passing this information on to the logging function.
Framework
- The structured data type
TS_MSG
is used to transport a message of typeWSTRING
, along with a timestamp of typeDATE_AND_TIME
and aWSTRING
identifier of the source of the data. - In response to an event at its
REQ
input, an instance of theSTAMP_MSG
FB type transfers the values of itsSRC
andMSG
inputs to the corresponding fields of itsTS_MSG
-valued output, and adds a time stamp corresponding to the current date and time. - The
MSG_LOG
FB type provides the capability of logging events reported by variables of theTS_MSG
type, in a manner similar to that of theDIAG_LOG
FB type. - This framework also provides the convenience FB types
E_TO_PRIM
andE_TO_PRIM2
for the generation of messages in the format of IEC 61499 service primitives.
Tool Support
The FBDK support for the Tagged Data and Local Multicast patterns can be used effectively in conjunction with this pattern when a system configuration is being edited.
Methodology
This design pattern and framework, in conjunction with the Tagged Data and Local Multicast patterns, can be used in several ways in the design, implementation, debugging and monitoring of embedded and distributed systems.
- It can be used to improve the accuracy of time-stamping of diagnostic messages in the Diagnostics and Distribution phases of the MVCD methodology.
- As illustrated in the
AGENTS_LOGL
andAGENTS_LOGR
system configurations, it can be used to debug the operation of FB instances by logging their outputs as sequences of service primitives, using theE_TO_PRIM
andE_TO_PRIM2
FB types. - This pattern could also be used by software agents in holonic systems to exchange time-tagged messages with source identification within a cooperation domain whose name is given by the channel ID of a Tagged Data item.