98 lines
5.0 KiB
Markdown
98 lines
5.0 KiB
Markdown
---
|
|
source_files:
|
|
- Common/DTS.Common/Classes/TMAT/TmtSingleFile.cs
|
|
- Common/DTS.Common/Classes/TMAT/TmtSplitFiles.cs
|
|
- Common/DTS.Common/Classes/TMAT/TMTBase.cs
|
|
generated_at: "2026-04-17T15:40:01.328534+00:00"
|
|
model: "zai-org/GLM-5-FP8"
|
|
schema_version: 1
|
|
sha256: "eff9cc19ef2279f2"
|
|
---
|
|
|
|
# TMAT Template Processing Module Documentation
|
|
|
|
## 1. Purpose
|
|
|
|
This module provides a framework for processing TMATS (Telemetry Attributes Transfer Standard) template files. It supports two template configurations: single-file templates (`TmtSingleFile`) and split-file templates (`TmtSplitFile`) where channel definitions are separated from global settings. The module enables placeholder replacement in template files using strongly-typed enum keys, facilitating the generation of configuration files for data acquisition systems.
|
|
|
|
---
|
|
|
|
## 2. Public Interface
|
|
|
|
### `TmtBase` (Abstract Base Class)
|
|
|
|
The abstract base class implementing `ITMTTemplate` that defines the contract for template processing.
|
|
|
|
**Constants:**
|
|
- `TMT_MAX_CHANNEL_LENGTH` (`private const int = 200`) — Maximum length for channel names in TMT files.
|
|
|
|
**Static Methods:**
|
|
|
|
| Signature | Description |
|
|
|-----------|-------------|
|
|
| `string TMT_LimitString(string s)` | Truncates a string to `TMT_MAX_CHANNEL_LENGTH` characters. |
|
|
| `void UpdateChannelField(TMTChannelKeysEx key, ITMTTemplate template, int channelIndex, float[] ranges, double minEU, double maxEU, string eu, float[] scaleFactors, double adcToEUScalingFactor, string channelName2, string offsetEU, bool bSigned)` | Updates a channel-specific field in the template based on the key type. Handles scaling, formatting, and conditional logic for EU metadata masking. |
|
|
| `void UpdateGlobalField(IDASCommunication das, TMTGlobalKeys key, ITMTTemplate template, IConfigurationData ConfigData, String serialNumber, ushort? timeChannelId, ushort? dataChannelId, ushort? uartChannelId, int dasIndex, int bitsPerFrame)` | Updates a global field in the template. Handles program name, test ID, timestamps, DAS configuration, and streaming parameters. |
|
|
| `int GetNumberOfStreamedChannels(IDASCommunication das)` | Returns the number of streamed channels based on hardware type and module configuration. |
|
|
|
|
**Abstract Methods:**
|
|
|
|
| Signature | Description |
|
|
|-----------|-------------|
|
|
| `void UpdateValue(TMTChannelKeysEx key, string value, int channelNumber)` | Updates a channel-specific key (extended format) with the given value. |
|
|
| `void UpdateValue(TMTGlobalKeys key, string value)` | Updates a global key with the given value. |
|
|
| `void UpdateValue(TMTChannelKeys key, string value, int channelNumber)` | Updates a channel-specific key with the given value. |
|
|
| `string[] GetAllLines()` | Returns all lines in the processed template. |
|
|
|
|
---
|
|
|
|
### `TmtSingleFile` Class
|
|
|
|
Handles TMATS templates contained in a single file.
|
|
|
|
**Constructor:**
|
|
```csharp
|
|
public TmtSingleFile(string templateLocation)
|
|
```
|
|
Reads all lines from the file at `templateLocation` into memory. If the file does not exist, the internal line collection remains empty (no exception is thrown).
|
|
|
|
**Methods:**
|
|
|
|
| Signature | Description |
|
|
|-----------|-------------|
|
|
| `override void UpdateValue(TMTChannelKeysEx key, string value, int channelNumber)` | Iterates all lines, replacing occurrences of the pattern (from `TMTKey.GetKey(key)`) with `value`. |
|
|
| `override void UpdateValue(TMTGlobalKeys key, string value)` | Iterates all lines, replacing occurrences of the pattern (from `TMTKey.GetKey(key)`) with `value`. |
|
|
| `override void UpdateValue(TMTChannelKeys key, string value, int channelNumber)` | Iterates all lines, replacing occurrences of the pattern (from `TMTKey.GetKey(key, channelNumber)`) with `value`. |
|
|
| `override string[] GetAllLines()` | Returns a copy of all stored lines as an array. |
|
|
|
|
---
|
|
|
|
### `TmtSplitFile` Class
|
|
|
|
Handles TMATS templates split into two files: a DAS template and a channel template.
|
|
|
|
**Constructor:**
|
|
```csharp
|
|
public TmtSplitFile(string dasTemplate, string channelTemplate)
|
|
```
|
|
Reads lines from `dasTemplate` into `_lines` and lines from `channelTemplate` into `_channelTemplate`. Non-existent files are silently ignored.
|
|
|
|
**Methods:**
|
|
|
|
| Signature | Description |
|
|
|-----------|-------------|
|
|
| `override void UpdateValue(TMTChannelKeysEx key, string value, int channelNumber)` | Ensures a channel entry exists for `channelNumber`, then updates lines in that channel's specific copy of the template. |
|
|
| `override void UpdateValue(TMTGlobalKeys key, string value)` | Updates lines in `_lines` (the DAS template portion). |
|
|
| `override void UpdateValue(TMTChannelKeys key, string value, int channelNumber)` | Updates lines in `_lines` (the DAS template portion), using a channel-number-formatted pattern. |
|
|
| `override string[] GetAllLines()` | Concatenates `_lines` with all channel lines ordered by channel number (min to max). Returns just `_lines` if no channels exist. |
|
|
|
|
---
|
|
|
|
### `ITMTTemplate` Interface
|
|
|
|
Defines the contract for template implementations.
|
|
|
|
```csharp
|
|
void UpdateValue(TMTChannelKeysEx key, string value, int channelNumber);
|
|
void UpdateValue(TMTGlobalKeys key, string value);
|
|
void UpdateValue(TMT |