This module provides data structures and parsing logic for reading and representing data from TSF (Test System Format) files, which are configuration and metadata files used in the SensorDB system. It defines channel entry classes (e.g., TSFSensorEntry, TSFSquibFireEntry, TSFTOMDigitalOutputChannel, G5DigtalInputChannelTSFEntry, TSFDIMEntry, TSFCalculatedChannelEntry) that model different physical and logical channel types found in TSF files, and section-handling classes (e.g., TSFSamplingInformationSection, TSFRackInformationSection, TSFModuleInformationSection, TSFTCFSection) that parse specific TSF file sections. The TSFChannel base class adds a TestChannelNumber field to all channel types, enabling unified indexing of channels that may lack an inherent data channel number in the raw TSF format.
2. Public Interface
Abstract Base Class
TSFChannel
public const int NOT_ASSIGNED = -1
public int TestChannelNumber { get; set; }
A user-assigned channel index used to unify indexing across channel types that may not have a data channel number in the TSF.
public static DigitalOutputModes GetDigitalOutputMode(DigitalOutputTypes outputType)
Maps internal DigitalOutputTypes to DTS.Common.Enums.DigitalOutputModes.
Represents digital output channels in the TOM Digital Channels section.
Represents calculated channel entries; currently unused in DataPRO.
Section Parsing Classes
TSFSamplingInformationSection
Constructor: TSFSamplingInformationSection(List<string> lines, ref int currentLine)
Parses the Sampling Information section. Throws EndOfStreamException or InvalidDataException on malformed input.
public void ReadFrom(List<string> lines, ref int currentLine, ref List<ReadTSFError> errors, TSFFile tsf, TSFSystemDescription system)
Parses the Rack Information section. Adds ReadTSFError entries to the errors list on failure.
TSFModuleInformationSection
public void ReadFrom(List<string> lines, ref int currentLine, ref List<ReadTSFError> errors, TSFSystemDescription system, TSFRackInformationSection rackSection)
Parses the Module Information section. Adds ReadTSFError entries to the errors list on failure. Populates module info on the matching TSFRackDescription.
TSFTCFSection
Properties: TCFPath
public void ReadFrom(List<string> lines, ref int currentLine, ref List<ReadTSFError> errors)
Parses the TCF Info section. Adds ReadTSFError entries to the errors list on failure.
TSFChannel.TestChannelNumber is initialized to TSFChannel.NOT_ASSIGNED (-1) and may be set to any int, including negative values.
TSFSamplingInformationSection always stores PreTriggerSeconds and PostTriggerSeconds as absolute (positive) values, regardless of sign in the TSF file.
TSFSquibFireEntry.Id setter normalizes "none" (case-insensitive) to an empty string.
TSFSensorEntry.SensorId setter normalizes "none" (case-insensitive) to an empty string.
Section parsing methods (ReadFrom) assume the currentLine index points to the start of the section header. They increment currentLine as they parse and expect the section to be well-formed.
TSFRackInformationSection.ReadFrom skips invalid rack entries (e.g., empty serial number, invalid rack index, mismatched test type) and logs errors, but continues parsing.
TSFModuleInformationSection.ReadFrom expects each module line to contain at least 7 comma-separated tokens; otherwise, it logs an error and skips the line.
4. Dependencies
Internal Dependencies (from source)
DTS.SensorDB namespace is used throughout.
DTS.Common.Enums is used in TSFTOMDigitalOutputChannel (DigitalOutputModes).
DTS.Common.Classes.Sensors is used in TSFSensorEntry (TDCSensorCategory).
ReadTSFError is used in ReadFrom methods of TSFRackInformationSection, TSFModuleInformationSection, and TSFTCFSection.
TSFFile is used in TSFRackInformationSection.ReadFrom (GetICrashBarrierType()).
TSFRackDescription is used in TSFRackInformationSection, TSFModuleInformationSection, TSFModuleDescription, TSFInputChannelDescription, TSFOutputChannelDescription, and TSFCalibrationInformation.
TSFChannelDescription is used in TSFCalibrationInformation, TSFInputChannelDescription, and TSFOutputChannelDescription.
These classes are used by higher-level TSF parsing logic (e.g., TSFFile class, referenced in TSFRackInformationSection.ReadFrom) to populate system, rack, module, and channel metadata.
TSFChannel and its derived types are likely used in conjunction with TSFChannelDescription, TSFRackDescription, and TSFModuleDescription to represent the full channel hierarchy.
5. Gotchas
Typo in property name: G5DigtalInputChannelTSFEntry.Descripton (missing 'i') instead of Description.
Case sensitivity in Id/SensorId normalization: TSFSquibFireEntry.Id and TSFSensorEntry.SensorId setters convert "none" (case-insensitive) to "", but other values are not normalized.
TSFRackInformationSection.ReadFrom has commented-out parsing code for additional fields (e.g., rackIsoObject, iRackIsoPosition), suggesting incomplete or deprecated functionality.
TSFModuleInformationSection.ReadFrom uses line.Contains("End Module Information") to detect section end, which is fragile if the header text appears elsewhere in a line.
TSFChannelDescription is referenced but not defined in the provided source, so its structure and relationship to the channel entry classes (TSFSensorEntry, etc.) are unclear.
TSFInputChannelDescription.RealtimeADC uses a lock for thread-safety, but no other properties in the codebase show similar patterns—this may indicate legacy or incomplete threading support.
TSFTOMDigitalOutputChannel.GetDigitalOutputMode maps DigitalOutputTypes to DigitalOutputModes, but the source does not define the target enum (DigitalOutputModes), so its exact mapping and behavior are inferred only from the switch.
TSFSystemDescription fields are marked as "sparsely used" or "not really used" in comments, suggesting potential dead code or incomplete implementation.
TSFModuleDescription comment warns: "we may want to remove these HLAPI derived classes soon", indicating technical debt.