Design Pattern: Time-Stamped Messaging

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:

  1. The time at which the message is logged will always be later than the time at which the message is generated.
  2. The delay between message generation and its logging may be variable, especially in distributed systems.
  3. 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

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.