Documentation

This page hosts the documentation of the SmartCGMS software architecture and all of its components.


Log filters

Currently, two filters that works with the log file format exists: the log filter, and the CSV log replay filter. As the name suggests, the log filter stores all device events to a file, and the CSV File Log Replay filter reads the log file and replays the log such that all rows are transformed to a device events and are sent through the chain.

Configuration

Log filter

  • Log_File (string) - a path to a file to log the simulation into
  • Log_Segments_Individually (boolean) - log each segment into a separate file
  • Reduce_Log (boolean) - should the log filter omit several fields to reduce log size?

CSV file log replay filter

  • Log_File (string) - a path to the log file or directory containing log files
  • Emit_Shutdown (boolean) - should the filter emit the Shut_Down message after the replay?
  • Filename_as_segment_id (boolean) - should the filter interpret the file name as a segment identifier? (hash)
  • Emit_All_Events_Before_Shutdown (boolean) - should the filter emit all the other events before the Shut_Down message (no matter the source)

Supported interfaces

Log filter

  • scgms::ILog_Filter_Inspection

CSV file log replay filter

None.

General function

Both filters operate on the same file format. The log filter creates it and log replay filter loads it and transforms it back to device events.

Log filter

The filter opens the destination file given by the Log_File parameter and creates the file header (see below). Then it waits for the events to come through the chain. Once a device event passes through this filter, it is transformed to a row in a CSV file.

Several fields are first converted to a string format for a better readability. The filter converts the following fields:

  • device time is converted to a local time string conforming to ISO-8601
  • model (signal) parameters are serialized as a space-separated array of floating point numbers
  • signal GUID is transformed to a string representation, if the signal is registered within the SmartCGMS system
  • event code is transcribed as a string

If the Log_Segments_Individually parameter is set to true, the log filter creates one file for each time segment. The file naming convention then includes the segment identified as a dot-separated integer before the file extension. Events not belonging to any segment (or to all segments) are written into all log files.

CSV file log replay filter

The CSV file log replay loads the log file (or all log files from a directory) and replays them as device events. This might be seen as an "inverse operation" to the logging operation, but with several differences.

This filter ignores the logical clock values when replaying, as there is no effective way of renumbering the logical clocks of multiple logs. It also fixes the potential timing errors, when the log filter stored the time segment markers, that does not match the actual signal time bounds.

File format

The common format is a CSV file format with semicolons used as separators. Every log has a fixed header:

Logical Clock; Device Time; Event Code; Signal; Info; Segment Id; Event Code Id; Device Id; Signal Id

Then, rows with device event transcriptions follow. Some informations are duplicated in different forms to allow human-readability, e.g. the signal ID and name (Signal for name, Signal Id for GUID), event code and its identifier (Event Code for the transcription, Event Code Id for the identifier).