This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
---
source_files:
- Common/DTS.Common.Serialization/IRIGCH10/Attributes/DescriptionDecoder.cs
- Common/DTS.Common.Serialization/IRIGCH10/Attributes/PacketHeaderValueAttribute.cs
- Common/DTS.Common.Serialization/IRIGCH10/Attributes/DataTypeVersionValueAttribute.cs
generated_at: "2026-04-17T15:40:03.278067+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "62884204c246cc16"
---
# Documentation: IRIG Chapter 10 Attribute Utilities
## 1. Purpose
This module provides attribute-based metadata extraction utilities for IRIG 106 Chapter 10 data serialization. It enables annotating enum values with descriptive strings, max lengths, packet header values, and data type version numbers—metadata used when generating TMATS (Telemetry Attributes Transfer Standard) files and processing Chapter 10 packet structures. The module serves as a bridge between .NET enum definitions and their corresponding binary protocol representations as defined in the IRIG 106 Chapter 10 specification.
---
## 2. Public Interface
### `DescriptionDecoder` (static class)
**Namespace:** `IRIGCh10`
| Method | Signature | Description |
|--------|-----------|-------------|
| `GetDescription` | `public static string GetDescription(Enum value)` | Retrieves the `DescriptionAttribute` value from an enum member. Returns the description string if the attribute is present; otherwise returns `value.ToString()`. |
### `MaxLengthDecoder` (static class)
**Namespace:** `IRIGCh10`
| Method | Signature | Description |
|--------|-----------|-------------|
| `GetMaxLength` | `public static int GetMaxLength(Enum value)` | Retrieves the `MaxLengthAttribute` length value from an enum member. Returns the length if the attribute is present; otherwise returns `0`. |
### `PacketHeaderValueAttribute`
**Namespace:** `DTS.Serialization.IRIGCh10.Attributes`
| Member | Signature | Description |
|--------|-----------|-------------|
| `Default` (static field) | `public static readonly PacketHeaderValueAttribute Default` | Default instance initialized with `0x00`. |
| `PacketHeader` (property) | `public virtual byte PacketHeader { get; }` | Gets the packet header byte value. |
| `GetPacketHeaderValue` (static method) | `public static byte GetPacketHeaderValue(Enum value)` | Retrieves the `PacketHeaderValueAttribute` byte from an enum member. Returns the attribute value if present; otherwise returns `Default.PacketHeaderValue` (`0x00`). |
**Constructors:**
- `public PacketHeaderValueAttribute()` — Initializes with `0x00`.
- `public PacketHeaderValueAttribute(byte packetHeader)` — Initializes with the specified byte value.
### `DataTypeVersionValueAttribute`
**Namespace:** `DTS.Serialization.IRIGCh10.Attributes`
| Member | Signature | Description |
|--------|-----------|-------------|
| `Default` (static field) | `public static readonly DataTypeVersionValueAttribute Default` | Default instance initialized with `0x00`. |
| `DataTypeVersion` (

View File

@@ -0,0 +1,87 @@
---
source_files:
- Common/DTS.Common.Serialization/IRIGCH10/Enums/Enums.cs
generated_at: "2026-04-17T15:43:02.181959+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "c232b0142638d2a2"
---
# Documentation: DTS.Serialization.IRIGCH10.Enums
## 1. Purpose
This module defines enumeration types for the IRIG 106 Chapter 10 data serialization system. It provides strongly-typed mappings between logical data type identifiers and their binary packet header representations used in flight data recording formats. The enums cover data file types, time sources, time formats, data type versions, secondary header time formats, and checksum types, all annotated with `PacketHeaderValue` attributes that specify the exact binary encoding for each value per the IRIG 106 standard.
---
## 2. Public Interface
### `DataFileDataTypes` (enum)
Defines all supported data type formats for IRIG 106 Chapter 10 packets. Each value is decorated with `[PacketHeaderValue(byte)]` and `[DataTypeVersionValue(byte)]` attributes.
**Notable defined values:**
| Value Name | Packet Header | Description |
|------------|---------------|-------------|
| `ComputerGeneratedDataFormat0` | 0x00 | User-Defined |
| `ComputerGeneratedDataFormat1` | 0x01 | Setup Record |
| `ComputerGeneratedDataFormat2` | 0x02 | Recording Events |
| `ComputerGeneratedDataFormat3` | 0x03 | Recording Index |
| `PCMDataFormat1` | 0x09 | Chapter 4 or 8 |
| `TimeDataFormat1` | 0x11 | RCC/Global Positioning System [GPS]/RTC |
| `MILSTD1553DataFormat1` | 0x19 | MIL-STD-1553B Data |
| `MILSTD1553DataFormat2` | 0x1A | 16PP194 Bus |
| `AnalogDataFormat1` | 0x21 | Analog Data |
| `DiscreteDataFormat1` | 0x29 | Discrete Data |
| `MessageDataFormat0` | 0x30 | Generic Message Data |
| `ARINC429DataFormat0` | 0x38 | ARINC-429 Data |
| `VideoDataFormat0` | 0x40 | MPEG-2/H.264 Video |
| `VideoDataFormat1` | 0x41 | ISO 13818-1 MPEG-2 |
| `VideoDataFormat2` | 0x42 | ISO 14496 MPEG-4 Part10 110 AVC/H.264 |
| `VideoDataFormat3` | 0x43 | MJPEG |
| `VideoDataFormat4` | 0x44 | MJPEG 2000 |
| `ImageDataFormat0` | 0x48 | Image Data |
| `ImageDataFormat1` | 0x49 | Still Imagery |
| `ImageDataFormat2` | 0x4A | Dynamic Imagery |
| `UARTDataFormat0` | 0x50 | UART Data |
| `IEEE1394DataFormat0` | 0x58 | IEEE 1394 Transaction |
| `IEEE1394DataFormat1` | 0x59 | IEEE 1394 Physical Layer |
| `ParallelDataFormat0` | 0x60 | Parallel Data |
| `EthernetDataFormat0` | 0x68 | Ethernet Data |
| `EthernetDataFormat1` | 0x69 | Ethernet UDP Payload |
| `TSPI_CTSDataFormat0` | 0x70 | GPS NMEA-RTCM |
| `TSPI_CTSDataFormat1` | 0x71 | EAG ACMI |
| `TSPI_CTSDataFormat2` | 0x72 | ACTTS |
| `ControllerAreaNetworkBus` | 0x78 | CAN Bus |
| `FibreChannelDataFormat0` | 0x79 | Fibre Channel Data |
Many additional values (Format0, Format2-Format7 variants for each category) are marked as "Reserved for future use."
---
### `TimeSource` (enum)
Defines the origin of time information in recordings.
| Value Name | Packet Header | Description |
|------------|---------------|-------------|
| `Internal` | 0x00 | Time derived from a clock in the recorder |
| `External` | 0x01 | Time derived from a clock not in the recorder |
| `InternalFromRMM` | 0x02 | Internal from RMM (Time derived from the clock in the RMM) |
| `None` | 0x0F | None |
---
### `TimeFormats` (enum)
Defines supported time encoding formats.
| Value Name | Packet Header | Description |
|------------|---------------|-------------|
| `IRIGB` | 0x00 | IRIG-B |
| `IRIGA` | 0x01 | IRIG-A |
| `IRIGG` | 0x02 | IRIG-G |
| `RTC` | 0x03 | Real-Time Clock |
| `UTC` | 0x04

View File

@@ -0,0 +1,256 @@
---
source_files:
- Common/DTS.Common.Serialization/IRIGCH10/Packets/ITransportStreamHeader.cs
- Common/DTS.Common.Serialization/IRIGCH10/Packets/ISecondaryTimeFormatHeader.cs
- Common/DTS.Common.Serialization/IRIGCH10/Packets/TransportStreamHeader.cs
- Common/DTS.Common.Serialization/IRIGCH10/Packets/SecondaryTimeFormatHeader.cs
- Common/DTS.Common.Serialization/IRIGCH10/Packets/TimeDataPacket.cs
- Common/DTS.Common.Serialization/IRIGCH10/Packets/TMATSPacket.cs
- Common/DTS.Common.Serialization/IRIGCH10/Packets/RootRecorderIndexPacket.cs
- Common/DTS.Common.Serialization/IRIGCH10/Packets/RecorderIndexPacket.cs
- Common/DTS.Common.Serialization/IRIGCH10/Packets/TimePacketFormat2.cs
- Common/DTS.Common.Serialization/IRIGCH10/Packets/IDataPacket.cs
- Common/DTS.Common.Serialization/IRIGCH10/Packets/TimePacketFormat1.cs
- Common/DTS.Common.Serialization/IRIGCH10/Packets/AnalogDataFormat1Packet.cs
generated_at: "2026-04-17T15:30:22.882503+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "ea68d7597278f2c1"
---
# IRIG Chapter 10 Packet Serialization Module Documentation
## 1. Purpose
This module provides serialization and deserialization support for IRIG 106 Chapter 10 data packets. It implements the packet structures defined in the Chapter 10 standard for recording and playback of telemetry data, including time data packets (Format 1 and Format 2), TMATS configuration packets, analog data packets, and recorder index packets. The module serves as the foundational layer for reading and writing Chapter 10 format files, handling binary encoding, checksums, and time format conversions.
---
## 2. Public Interface
### Interfaces
#### `ITransportStreamHeader`
```csharp
public interface ITransportStreamHeader
{
int MessageFormat { get; }
int MessageType { get; }
int SequenceNumber { get; }
}
```
Defines read-only access to transport stream header fields.
#### `ISecondaryTimeFormatHeader`
```csharp
public interface ISecondaryTimeFormatHeader
{
int NanoSeconds { get; }
int Seconds { get; }
ushort Reserved { get; }
ushort CheckSum { get; }
DateTime LocalTime { get; }
}
```
Defines read-only access to secondary time format header fields.
#### `IDataPacket`
```csharp
public interface IDataPacket
{
IPacketHeader PacketHeader { get; }
uint ComputeCheckSum();
byte[] GetBytes();
void SetRTC(long rtc);
void SetDataVersion(DataTypeVersion version);
void SetChannelID(ushort channelID);
void SetSequenceNumber(ushort seq);
}
```
Defines the contract for all Chapter 10 data packets.
---
### Abstract Base Class
#### `AbstractDataPacket`
Base class for all packet types. Provides common functionality:
| Member | Signature | Description |
|--------|-----------|-------------|
| `ChannelSpecificDataWord` | `uint` property | Gets/sets the Channel Specific Data Word (CSDW). |
| `PacketHeader` | `IPacketHeader` property | Gets the packet header. |
| `ComputeCheckSum` | `uint ComputeCheckSum()` | Computes 32-bit checksum of packet data. |
| `GetRTC` | `long GetRTC()` | Returns the 10MHz Realtime Counter value. |
| `SetRTC` | `void SetRTC(long rtc)` | Sets the RTC value in both the packet and header. |
| `SetSequenceNumber` | `void SetSequenceNumber(ushort seq)` | Sets the packet sequence number. |
| `SetDataVersion` | `void SetDataVersion(DataTypeVersion version)` | Sets the data version in the header. |
| `SetChannelID` | `void SetChannelID(ushort channelID)` | Sets the channel ID in the header. |
| `GetBytes` | `virtual byte[] GetBytes()` | Serializes the packet to a byte array. |
| `BASE_RTC` | `const long = 141989612500056L` | Base RTC value constant. |
---
### Concrete Packet Classes
#### `TransportStreamHeader`
```csharp
public TransportStreamHeader(byte[] input)
public const int TRANSPORT_HEADER_LENGTH = 4;
```
Parses a 4-byte transport stream header. Extracts `MessageFormat` (bits 0-3), `MessageType` (bits 4-7), and `SequenceNumber` (bits 8-31) from the input bytes.
#### `SecondaryTimeFormatHeader`
```csharp
public SecondaryTimeFormatHeader(byte[] input)
public static byte[] GetBytes(int nanoseconds, int seconds)
public const int SECONDARY_TIME_HEADER_LENGTH = 12;
```
Parses or constructs a 12-byte secondary time header. `LocalTime` is computed as Unix epoch (1970-01-01) plus `Seconds` and `NanoSeconds` converted to ticks, then converted to local time. Constructor validates checksum and writes to `Trace` on mismatch.
#### `TimeDataPacket`
```csharp
public TimeDataPacket()
public DateTime GetDateTime()
public void SetTime(DateTime dt)
public void SetTimeSource(byte b)
public void SetTimeSource(TimeSource src)
public void SetTimeFormat(TimeFormats fmt)
```
Implements Time Data Format 1 packet. `SetTime` encodes a `DateTime` into BCD format in a 12-byte payload at positions 4-11.
#### `TimePacketFormat1`
```csharp
public TimePacketFormat1(byte sequenceNumber, DateTime packetTime, long rtc, int nanoseconds, int seconds)
```
Implements Time Data Format 1 with full IRIG time encoding. Properties include:
- `ITS` (`IRIGTimeSource` enum) - IRIG time source (bits 15-12, not serialized per comment)
- `TimeFormat` (`TimeFormats` enum) - bits 7-4
- `TimeSource` (`TimeSources` enum) - bits 3-0
- `DateFormat` (`DateFormats` enum) - bit 9
- `IsLeapYear` (`bool`) - bit 8
- `TimePacketTime` (`DateTime`) - the time represented by this packet
#### `TimePacketFormat2`
```csharp
public TimePacketFormat2(byte sequenceNumber, bool rtcSyncError, int nanoseconds, int seconds, long rtc, bool includeSecondaryHeader)
public TimePacketFormat2(byte[] bytes)
```
Implements Time Data Format 2 for network time protocols. Properties include:
- `LocalTimeOfFirstSample` (`DateTime`)
- `NetworkTimeFormat` (`NetworkTimeFormats` enum) - bits 7-4
- `TimeStatus` (`TimeStatuses` enum) - bits 3-0
- `UnsignedSeconds` (`uint`)
- `UnsignedNanoSeconds` (`uint`)
- `PTPTime` (`string`) - formatted PTP timestamp
#### `TMATSPacket`
```csharp
public TMATSPacket(int nanoseconds, int seconds, string tmatsDoc, bool secondaryHeaderPresent)
public TMATSPacket(byte[] bytes)
public string TMATSDocument { get; }
public bool XMLFormat { get; }
public bool SetupRecordConfigurationChange { get; }
public RCCChapter10Versions Chapter10Version { get; }
```
Implements TMATS (Telemetry Attributes Transfer Standard) packet. `TMATSDocument` returns ASCII-decoded content. `RCCChapter10Versions` enum maps values 0x07-0x0B to versions RCC_106_07 through RCC_106_15.
#### `AnalogDataFormat1Packet`
```csharp
public AnalogDataFormat1Packet(int nanoseconds, int seconds, Chapter10File.GetNextSampleDelegate getNextSample, int totalChannels, long channelLength, long rtc, long numSamples, long currentSample, byte sequenceNumber, ushort channelId, bool includeSecondaryHeader)
public AnalogDataFormat1Packet(byte[] bytes)
public SampleData[] Samples { get; }
```
Implements Analog Data Format 1 packet. CSDW properties:
- `Same` (bit 28)
- `Factor` (bits 27-24)
- `TotChan` (bits 23-16)
- `Subchan` (bits 15-8)
- `Length` (bits 7-2)
- `Mode` (`Modes` enum, bits 1-0)
`SampleData` inner class holds `ChannelData` as `short[]`.
#### `RecorderIndexPacket`
```csharp
public RecorderIndexPacket()
public void SetRootPacketAddress(long address)
public void AddRecordingIndex(RecordingIndex index)
public int NumberOfEntries { get; }
public DateTime GetDateTime()
public override byte[] GetBytes()
```
Implements recorder index packet. Uses hardcoded `ChannelSpecificDataWord = {0x8D, 0x02, 0x00, 0xE0}`.
#### `RootRecorderIndexPacket`
```csharp
public RootRecorderIndexPacket(DateTime dt)
public void SetRootPacketAddress(long address)
public void AddRecordingIndex(RecordingIndexIndex index)
public override byte[] GetBytes()
```
Implements root recorder index packet (last packet in file). Uses hardcoded `ChannelSpecificDataWord = {0x8D, 0x00, 0x00, 0x60}`.
#### `RecordingIndex`
```csharp
public RecordingIndex(long rtc, long offset, DateTime dt)
public const int SIZE = 28;
public byte[] GetBytes()
public DateTime GetDateTime()
```
Helper structure for recorder index entries. Fixed size of 28 bytes.
#### `RecordingIndexIndex`
```csharp
public RecordingIndexIndex(long rtc, long offset, DateTime dt)
public const int SIZE = 24;
public byte[] GetBytes()
```
Helper structure for root index entries. Fixed size of 24 bytes.
---
## 3. Invariants
- **TransportStreamHeader**: Input must be exactly `TRANSPORT_HEADER_LENGTH` (4) bytes; null input throws `NullReferenceException`.
- **SecondaryTimeFormatHeader**: Input must be exactly `SECONDARY_TIME_HEADER_LENGTH` (12) bytes.
- **Packet alignment**: `PacketHeader.PacketLength` is always padded to a multiple of 4 bytes.
- **RTC consistency**: Setting RTC via `SetRTC(long)` updates both the internal `_rtc` field and `PacketHeader`.
- **Sequence numbers**: Should be monotonically increasing and wrap to 0 after maximum value (caller responsibility).
- **TimeDataPacket**: `_dataBytes` is initialized to 12 bytes; time data is written at positions 4-11.
- **TMATSDocument encoding**: Always decoded as ASCII.
- **AnalogDataFormat1Packet sample data**: Samples are byte-swapped and offset by 0x8000 for signed/unsigned conversion.
---
## 4. Dependencies
### This module depends on:
- `DTS.Serialization.IRIGCH10.Enums` - Data type enumerations (`DataFileDataTypes`, `DataTypeVersion`)
- `DTS.Serialization.IRIGCh10.Attributes` - `PacketHeaderValueAttribute`
- `DTS.Serialization.IRIGCH10.Packets` - `PacketHeader`, `IPacketHeader`
- `DTS.Common.Utilities` - `PTP1588Timestamps` (referenced in `TimePacketFormat2`)
- `Utils.Utils` (external utility class) - Static methods: `BitArrayToInt32`, `SetBits`, `GetCheckSum8`, `GetCheckSum32`, `GetBCDBytes`
- `System.IO` - `MemoryStream`, `BinaryWriter`
- `System.Collections` - `BitArray`
### What depends on this module:
- `Chapter10File` (referenced in `AnalogDataFormat1Packet` constructor delegate type `GetNextSampleDelegate`)
---
## 5. Gotchas
1. **SecondaryTimeFormatHeader checksum validation is non-blocking**: When checksum mismatch occurs, the constructor only writes to `System.Diagnostics.Trace.WriteLine` rather than throwing an exception. Callers must not assume valid checksums.
2. **TimePacketFormat1 ITS field not serialized**: The `ITS` property (IRIGTimeSource) is explicitly not serialized to the CSDW due to EMC validation tool compatibility issues (comment dated 2023-10-27).
3. **Hardcoded ChannelSpecificDataWord values**: `RecorderIndexPacket` and `RootRecorderIndexPacket` use hardcoded byte arrays for `ChannelSpecificDataWord` with comments indicating uncertainty about individual field breakdown.
4. **AnalogDataFormat1Packet data version selection**: Uses `DATA_VERSION_DASSAULT` (0x06) when secondary header is present, otherwise `DATA_VERSION_V105` (0x01). Comment indicates EMC validation tool only supports CH10 106v5.
5. **TimeDataPacket SetTimeSource overloads behave differently**: The `byte` overload sets bits 0-3 directly, while the `TimeSource` enum overload reverses bit order (bit 0←3, bit 1←2, etc.) per Chapter 10 reference 10-47.
6. **LocalTime calculation in SecondaryTimeFormatHeader**: Uses `AddTicks(NanoSeconds / 100)` which truncates nanoseconds to 100-nanosecond tick precision.
7. **RecordingIndexIndex added automatically in RootRecorderIndexPacket.GetBytes()**: The last index entry pointing back to the current packet is appended internally during `GetBytes()` call, modifying `_indices` list state.

View File

@@ -0,0 +1,166 @@
---
source_files:
- Common/DTS.Common.Serialization/IRIGCH10/TMATS/DescriptionDecoder.cs
- Common/DTS.Common.Serialization/IRIGCH10/TMATS/TMATSectionNumbered.cs
- Common/DTS.Common.Serialization/IRIGCH10/TMATS/TMATSSection.cs
- Common/DTS.Common.Serialization/IRIGCH10/TMATS/TMATS.cs
- Common/DTS.Common.Serialization/IRIGCH10/TMATS/GeneralInformation.cs
- Common/DTS.Common.Serialization/IRIGCH10/TMATS/PCM.cs
generated_at: "2026-04-17T15:35:03.196850+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "d1584336ff58226c"
---
# TMATS Serialization Module Documentation
## 1. Purpose
This module provides a C# implementation for generating TMATS (Telemetry Attributes Transfer Standard) documents compliant with the IRIG 106 standard. It offers a strongly-typed, object-oriented API for constructing telemetry configuration metadata, including PCM format attributes, storage source definitions, and general information sections. The module serializes configured objects into the TMATS text format using reflection-based attribute decoding to map enum values to their standard TMATS field identifiers.
---
## 2. Public Interface
### DescriptionDecoder (static class)
**Signature:** `public static string GetDescription(Enum value)`
Returns the `DescriptionAttribute` value from the enum field, or the enum's string representation if no attribute is present. Used to map enum values to TMATS field codes.
### MaxLengthDecoder (static class)
**Signature:** `public static int GetMaxLength(Enum value)`
Returns the `MaxLengthAttribute.Length` value from the enum field, or `0` if no attribute is present. Intended for field length validation.
### TMATSSection\<T\> (abstract class)
Generic base class for TMATS sections where `T : Enum`.
| Member | Signature | Description |
|--------|-----------|-------------|
| `SetValue` | `public void SetValue(T tag, string value)` | Stores a value for the given tag key. |
| `GetValue` | `public string GetValue(T tag)` | Retrieves value for tag, or `null` if unset. |
| `SetDate` | `public void SetDate(T tag, DateTime? value)` | Sets a date in `MM-DD-YYYY` format, or empty string if `null`. |
| `GetDate` | `public DateTime? GetDate(T tag)` | Parses date from `MM-DD-YYYY` format, or `null` if invalid/empty. |
| `GetIntOrNull` | `public int? GetIntOrNull(T tag)` | Parses integer value, or `null` if unset/unparseable. |
| `SetIntOrNull` | `public void SetIntOrNull(T tag, int? val)` | Sets integer as string, or empty string if `null`. |
| `SetValueWithLength` | `public void SetValueWithLength(T tag, string value)` | Sets value (length validation currently disabled). |
| `Serialize` | `public virtual string Serialize()` | Serializes all tag/value pairs to TMATS format. |
| Constructor | `public TMATSSection()` | Default constructor for unnumbered sections. |
| Constructor | `public TMATSSection(AttributeIdentifiers attribute, int number)` | Constructor for numbered sections (e.g., channel-specific). |
### TMATSectionNumbered\<T\> (class)
Represents a section with numbered sub-items where `T : Enum`.
| Member | Signature | Description |
|--------|-----------|-------------|
| `Identifier` | `public AttributeIdentifiers Identifier { get; set; }` | Section identifier (default: `GeneralInformation`). |
| `Number` | `public int Number { get; set; }` | Section number (default: `-1`). |
| `SetValue` | `public void SetValue(T tag, string value)` | Sets value for tag in internal dictionary. |
| `GetValue` | `public string GetValue(T tag)` | Gets value for tag, or `null`. |
| `Serialize` | `public string Serialize(int number)` | Serializes all tags with the given number. |
| `SetValueWithLength` | `public void SetValueWithLength(T tag, string value)` | Sets value with length retrieval (validation disabled). |
### TMATSectionNumberedArray\<T\> (class)
Manages an array of `TMATSectionNumbered<T>` items where `T : Enum`.
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `public TMATSectionNumberedArray(string numberedTag)` | Initializes with tag name for count field. |
| Constructor | `public TMATSectionNumberedArray(string numberedTag, int maxNumber)` | Initializes with tag name and maximum count. |
| Constructor | `public TMATSectionNumberedArray(AttributeIdentifiers identifier, int number, string numberedTag, int maxNumber)` | Full constructor with all parameters. |
| `SetValue` | `public virtual void SetValue(int number, T tag, string value)` | Sets value at 1-based index, expanding array if needed. |
| `GetValue` | `public string GetValue(int number, T tag)` | Gets value at 1-based index, or `null` if out of range. |
| `Serialize` | `public string Serialize()` | Serializes array with count header and all items. |
| `GetCount` | `public int GetCount()` | Returns current item count. |
| `SetCount` | `public void SetCount(int count)` | Resizes array, enforcing `maxNumber` if set. |
### AttributeIdentifiers (enum)
TMATS top-level section identifiers with `Description` attributes:
- `GeneralInformation` ("G")
- `TransmitionAttributes` ("T")
- `StorageSourceAttributes` ("R")
- `MultiplexingAttributes` ("M")
- `PCMFormatAttributes` ("P")
- `PCMMeasurementDescription` ("D")
- `BusDataAttributes` ("B")
- `PacketFormatAttributes` ("S")
- `PAMAttributes` ("A")
- `DataConversionAttributes` ("C")
- `AirborneHardwareAttributes` ("H")
- `VendorSpecificAttributes` ("V")
### GeneralInformationGroup (class)
Extends `TMATSSection<GeneralTags>`. Key properties include:
- `ProgramName`, `TestItem` (string)
- `IRIG106RevisionLevel`, `RevisionNumber`, `UpdateNumber`, `TestNumber` (string)
- `OriginationDate`, `RevisionDate`, `UpdateDate` (DateTime?)
- `NumberOfDataSources`, `NumberOfPointsOfContact` (int)
- `PreTestRequirement`, `PostTestRequirement` (bool)
- `SecurityClassification` (enum)
- `Comments` (string)
Methods:
- `SetDataSourceField(int number, Information.DataSourceIdentificationTags tag, string value)`
- `SetDataSourceType(int number, Information.DataSourceTypes sourceType)`
- `Serialize()` override
### PCM (class)
Extends `TMATSSection<PCMAttributes>`. Constructor: `public PCM(int number)`.
Properties: `DataLinkName`, `PCMCode`, `BitsPerSecond`, `DataRandomized`, `Polarity`, `DataDirection`, `TypeFormat`, `NumberOfBitsInCommonWordLength`, `WordTransferOrder`, `PCMWordParity`.
### MinorFrameSection (class)
Extends `TMATSSection<MinorFrameTags>`. Constructor: `public MinorFrameSection(int number = 1)`.
Properties: `NumberOfMinorFramesInAMajorFrame`, `NumberOfWordsInMinorFrame`, `NumberOfBitsInMinorFrame`, `SyncLength`, `SynchronizationPattern`.
### TMATSCreationTest (class)
**Signature:** `public static string CreateTMATS()`
Demonstration method that constructs a complete TMATS document with storage, PCM, and message data configurations.
---
## 3. Invariants
- **1-based indexing**: `TMATSectionNumberedArray<T>.SetValue` and `GetValue` use 1-based indexing internally (`_items[number - 1]`).
- **Enum attribute requirements**: All enum values used as TMATS tags must have `[Description("...")]` attributes for proper serialization.
- **Date format**: Dates are serialized/parsed in `MM-DD-YYYY` format only.
- **TMATS output format**: Serialized lines follow pattern `{identifier}-{number}\{attribute}{subnumber}:{value};` or `{identifier}\{attribute}:{value};` for unnumbered sections.
- **Default number value**: Sections with `Number < 0` serialize without the `-{number}` suffix.
- **Null handling**: `GetValue` methods return `null` for unset keys, not empty strings or exceptions.
---
## 4. Dependencies
**This module depends on:**
- `System` (core types, `DateTime`, `Enum`)
- `System.ComponentModel` (`DescriptionAttribute`)
- `System.ComponentModel.DataAnnotations` (`MaxLengthAttribute`)
- `System.Collections.Generic` (`Dictionary<T,K>`, `List<T>`)
- `System.Linq` (`Cast<T>()`, `Any()`, `First()`, etc.)
- `System.Text` (`StringBuilder`)
- `System.Globalization` (used in `GetDate` for parsing)
**Consumers (inferred):**
- Any module requiring IRIG 106 TMATS document generation for telemetry recording configuration.
---
## 5. Gotchas
1. **MaxLength validation is disabled**: Both `TMATSSection<T>.SetValueWithLength` and `TMATSectionNumbered<T>.SetValueWithLength` contain commented-out validation logic. The code comments state "maxlength is just a suggestion in the spec." Values exceeding `MaxLengthAttribute` will be stored without error.
2. **DataSource ID uniqueness check bug**: In `GeneralInformationGroup.Information.SetDataSourceField`, the loop iterates with `i` but compares using `number`:
```csharp
if (_datasources.GetValue(number, tag) == value) // Should likely be GetValue(i, tag)
```
This compares the value against itself rather than checking other indices.
3. **Typo in enum**: `AttributeIdentifiers.TransmitionAttributes` is misspelled (should be "Transmission").
4. **Double semicolon**: In `TMATSectionNumberedArray<T>.SetCount`, there is a syntax quirk: `newItem.Number = _number;;`.
5. **Incomplete enum definitions**: `SubFrameSynchronizationTags` and `SubFrameDefinitionTags` lack `[Description]` attributes, meaning they cannot be properly serialized using `DescriptionDecoder.GetDescription`.
6. **Date format inconsistency**: The format string `"MM-DD-YYYY"` uses non-standard year formatting. Standard C# would be `"MM-dd-yyyy"`. The behavior with `DateTime.TryParseExact` using `"YYYY"` (uppercase) may not parse correctly on all systems.
7. **Empty vs null ambiguity**: `SetIntOrNull` and `SetDate` set empty strings for `null` values, but `GetValue` returns `null` for missing keys. This creates an inconsistency where explicitly-set nulls become empty strings while never-set values remain null.

View File

@@ -0,0 +1,81 @@
---
source_files:
- Common/DTS.Common.Serialization/IRIGCH10/TMATS/DataConversion/DataConversionSection.cs
- Common/DTS.Common.Serialization/IRIGCH10/TMATS/DataConversion/TelemetrySection.cs
- Common/DTS.Common.Serialization/IRIGCH10/TMATS/DataConversion/CoefficientSection.cs
- Common/DTS.Common.Serialization/IRIGCH10/TMATS/DataConversion/Measurand.cs
- Common/DTS.Common.Serialization/IRIGCH10/TMATS/DataConversion/OtherInformationSection.cs
- Common/DTS.Common.Serialization/IRIGCH10/TMATS/DataConversion/TransducerInformation.cs
generated_at: "2026-04-17T15:35:23.451592+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "f25d8d008b57c725"
---
# TMATS Data Conversion Module Documentation
## 1. Purpose
This module implements the Data Conversion section of TMATS (Telemetry Attributes Transfer Standard) packets for IRIG Ch10 data serialization. It provides strongly-typed classes and enumerations for defining measurement metadata including conversion types, telemetry formats, calibration coefficients, measurand descriptions, alert/warning limits, and transducer information. Each section class maps enum-backed attributes to their TMATS-compliant string representations via `Description` attributes.
---
## 2. Public Interface
### `DataConversionSection` (class)
**Namespace:** `DTS.Serialization.IRIGCH10.Attributes`
**Inherits:** `TMATSSection<DataConversionAttributes>`
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `DataConversionSection(int number)` | Initializes with `AttributeIdentifiers.DataConversionAttributes` and section number |
| `SetConversionType` | `void SetConversionType(ConversionTypes type)` | Sets the DCT attribute using the `Description` value of the provided `ConversionTypes` enum |
**Related Enums:**
- `DataConversionAttributes`: Contains `ConversionType` (Description: "DCT")
- `ConversionTypes`: `None`, `PairSets`, `Coefficients`, `CoefficientsNegative`, `Derived`, `Discrete`, `PCMTime`, `Time1553`, `DigitalVoice`, `DigitalVideo`, `SpecializedProcessing`, `Other`
---
### `TelemetrySection` (class)
**Namespace:** `DTS.Serialization.IRIGCH10.TMATS.DataConversion`
**Inherits:** `TMATSSection<TelemetryAttributes>`
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `TelemetrySection(int number)` | Initializes with `AttributeIdentifiers.DataConversionAttributes` and section number |
| `SetBinaryFormat` | `void SetBinaryFormat(BinaryFormats format)` | Sets the BFM attribute using the `Description` value of the provided `BinaryFormats` enum |
**Related Enums:**
- `TelemetryAttributes`: Contains `BinaryFormat` (Description: "BFM", MaxLength: 3)
- `BinaryFormats`: `Integer`, `UnsignedBinary`, `SignAndMagnitudeSig`, `SignAndMagnitudeSim`, `OnesCompliment`, `TwosCompliment`, `OffsetBinary`, `FloatingPoint`, `BinaryCodedDecimal`, `BitWeight`, `Other`
---
### `CoefficientSection` (class)
**Namespace:** `DTS.Serialization.IRIGCH10.TMATS.DataConversion`
**Inherits:** `TMATSSection<CoefficientsAttributes>`
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `CoefficientSection(int number)` | Initializes with `AttributeIdentifiers.DataConversionAttributes` and section number |
| `OrderOfCurveFit` | `int?` (property) | Gets/sets the polynomial curve fit order (attribute "CO\\N") |
| `Coefficient0` | `string` (property) | Gets/sets the zero-order term/offset (attribute "CO") |
| `Coefficient1` | `string` (property) | Gets/sets the first-order coefficient (attribute "CO-1") |
**Related Enum:**
- `CoefficientsAttributes`: `OrderOfCurveFit` ("CO\\N"), `DerivedFromPairSet` ("CO1"), `Coefficient0` ("CO"), `Coefficient1` through `Coefficient7` ("CO-1" through "CO-7")
---
### `MeasurandSection` (class)
**Namespace:** `DTS.Serialization.IRIGCH10.TMATS.DataConversion`
**Inherits:** `TMATSSection<MeasurandAttributes>`
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `MeasurandSection(int number)` | Initializes with `AttributeIdentifiers.DataConversionAttributes` and section number |
| `Description` | `string` (property) | Gets/sets parameter description (attribute "MN1", MaxLength: 64) |
| `MeasurementAlias` | `string` (property) | Gets/sets alternate measurand name (attribute "MNA", MaxLength: 32) |
| `ExcitationVoltage` | `string` (property) | Gets/sets sensor reference voltage in volts (attribute "MN2", MaxLength: 10) |
| `EngineeringUnits` | `string` (property) | Gets/sets engineering units (attribute

View File

@@ -0,0 +1,38 @@
---
source_files:
- Common/DTS.Common.Serialization/IRIGCH10/Utils/Utils.cs
generated_at: "2026-04-17T16:43:36.818421+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "2999f5bcc681631b"
---
# Documentation: DTS.Serialization.IRIGCH10.Utils.Utils
## 1. Purpose
This module provides low-level utility functions for IRIG Chapter 10 data serialization, including Binary Coded Decimal (BCD) encoding for date/time values, checksum computation (8-bit, 16-bit, and 32-bit variants per the CH10 specification), and bit-level manipulation of `BitArray` structures. It serves as a foundational helper class for encoding and validating binary packet data in the IRIG Chapter 10 format.
---
## 2. Public Interface
### `public static byte[] GetBCDBytes(int value)`
Converts an integer value to a 2-byte Binary Coded Decimal representation.
- **Parameter:** `value` — must be in range [0, 9999]
- **Returns:** 2-byte array containing the BCD-encoded value
- **Throws:** `ArgumentOutOfRangeException` if `value` is outside the valid range
### `public static ushort GetCheckSum8(byte[] bytes)`
Computes an 8-bit checksum by summing all byte values.
- **Parameter:** `bytes` — input byte array
- **Returns:** `ushort` representing the sum of all bytes (wrapping at 8 bits via implicit truncation)
### `public static ushort GetCheckSum16(byte[] bytes)`
Computes a 16-bit checksum per the Chapter 10 specification by treating the byte array as an array of 16-bit unsigned integers and summing them.
- **Parameter:** `bytes` — input byte array (must have even length)
- **Returns:** `ushort` checksum value
- **Asserts:** `bytes.Length % 2 == 0` via `System.Diagnostics.Trace.Assert`
### `public static uint GetCheckSum32(byte[] bytes)`
Computes a 32-bit checksum per the Chapter 10 specification by treating the byte array as an array of