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,68 @@
---
source_files:
- Common/DTS.Common.SerializationPlus/Control/ReviewableAttribute.cs
- Common/DTS.Common.SerializationPlus/Control/IntervalSec.cs
generated_at: "2026-04-17T15:41:28.581864+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "6dbfe6ac8568fa23"
---
# Documentation: DTS.Slice.Control Types
## 1. Purpose
This module provides two foundational types for the DTS Slice Control subsystem. `ReviewableAttribute` is an abstract base class representing attributes that can be displayed on a "review tab," with values computed on-demand via a delegate. `IntervalSec` is a simple value type representing a time interval in seconds, with bidirectional implicit conversion to/from `DTS.Serialization.Test.IntervalSec` for serialization purposes.
---
## 2. Public Interface
### `ReviewableAttribute` (abstract class)
**Namespace:** `DTS.Slice.Control`
**Base class:** `Exceptional`
#### Constructor
```csharp
public ReviewableAttribute(string name, DetermineValueString calculateValue)
```
Initializes a new instance with the given name and value calculation delegate.
#### Properties
| Property | Type | Access | Description |
|----------|------|--------|-------------|
| `Name` | `string` | get / private set | The name associated with this review tab-displayable attribute. |
| `Value` | `string` | get | Returns the computed value string. On exception, logs the error via `Utilities.Logging.APILogger.Log()` and returns `"N/A"`. |
#### Delegate
```csharp
public delegate string DetermineValueString()
```
Delegate type used to compute the attribute's value on demand.
---
### `IntervalSec` (class)
**Namespace:** `DTS.Slice.Control`
**Base class:** `Exceptional`
#### Constructors
```csharp
public IntervalSec()
```
Creates an instance with `Begin` and `End` properties left "uninitialized" (defaulting to `0` per the `Property<double>` initialization).
```csharp
public IntervalSec(double begin, double end)
```
Creates an instance with the specified begin and end times.
#### Properties
| Property | Type | Access | Description |
|----------|------|--------|-------------|
| `Begin` | `double`

View File

@@ -0,0 +1,55 @@
---
source_files:
- Common/DTS.Common.SerializationPlus/Control/Event/DasModuleAccessor.cs
- Common/DTS.Common.SerializationPlus/Control/Event/DasChannelAccessor.cs
- Common/DTS.Common.SerializationPlus/Control/Event/ChannelAccessor.cs
- Common/DTS.Common.SerializationPlus/Control/Event/ModuleChannelAccessor.cs
- Common/DTS.Common.SerializationPlus/Control/Event/DasModuleChannelAccessor.cs
- Common/DTS.Common.SerializationPlus/Control/Event/TestInformation.cs
generated_at: "2026-04-17T15:33:42.039746+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "1a6c1ba258606f39"
---
# Documentation: DTS.Slice.Control Event Accessors
## 1. Purpose
This module provides a set of nested accessor classes within the `Event` partial class that enable hierarchical lookup of module and channel information associated with DAS (Data Acquisition System) events. These accessors are returned during Event creation and allow consumers to retrieve module and channel data using various key combinations (DAS ID, module number, channel number). The module also contains a private `TestInformation` class for internal representation of test metadata associated with DAS events.
---
## 2. Public Interface
### `Event.DasModuleAccessor`
**Signature:** `public class DasModuleAccessor : ExceptionalDictionary<Common.DAS.Concepts.DAS.Id, List<Module>>`
An accessor returned during Event creation that provides access to event module information keyed by `DAS.Id`.
- **Constructor:** `public DasModuleAccessor()`
---
### `Event.DasChannelAccessor`
**Signature:** `public class DasChannelAccessor : ExceptionalDictionary<Common.DAS.Concepts.DAS.Id, List<Module.Channel>>`
An accessor returned during Event creation that provides access to event channels keyed by `DAS.Id`.
- **Constructor:** `public DasChannelAccessor()`
---
### `Event.ChannelAccessor`
**Signature:** `public class ChannelAccessor : ExceptionalDictionary<int, Module.Channel>`
A component object of `Event.DasModuleChannelAccessor` that maps integer keys to `Module.Channel` values.
- **Constructor:** `public ChannelAccessor()`
---
### `Event.ModuleChannelAccessor`
**Signature:** `public class ModuleChannelAccessor : ExceptionalDictionary<int, ChannelAccessor>`
A component object of `

View File

@@ -0,0 +1,28 @@
---
source_files:
- Common/DTS.Common.SerializationPlus/Control/Event/Module/ReviewableDasSerialNumberAttribute.cs
- Common/DTS.Common.SerializationPlus/Control/Event/Module/ReviewableAttribute.cs
- Common/DTS.Common.SerializationPlus/Control/Event/Module/ReviewableSampleRateAttribute.cs
generated_at: "2026-04-17T15:38:06.771428+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "bfab31fefc0af181"
---
# Documentation: DTS.Slice.Control.Event.Module Reviewable Attributes
## 1. Purpose
This module provides a framework for defining reviewable attributes attached to `Event.Module` instances within the DTS.Slice.Control namespace. It enables extraction and formatting of module metadata—such as serial numbers, sample rates, hardware filter settings, and test descriptions—through a standardized attribute system. The pattern allows concrete attribute classes to encapsulate both a display name and a value-retrieval delegate, facilitating consistent data presentation for review purposes.
---
## 2. Public Interface
### `Event.Module.ReviewableAttribute` (Abstract Base Class)
**Inheritance:** Inherits from `Slice.Control.ReviewableAttribute`
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor (public) | `ReviewableAttribute(Event.Module channel)` | **Throws

View File

@@ -0,0 +1,91 @@
---
source_files:
- Common/DTS.Common.SerializationPlus/Control/Event/Module/AnalogInputChannel/ReviewableShuntDeflectionAttribute.cs
- Common/DTS.Common.SerializationPlus/Control/Event/Module/AnalogInputChannel/ReviewableFilterFrequencyAttribute.cs
- Common/DTS.Common.SerializationPlus/Control/Event/Module/AnalogInputChannel/ReviewableIsoCodeAttribute.cs
- Common/DTS.Common.SerializationPlus/Control/Event/Module/AnalogInputChannel/ReviewableDescriptionAttribute.cs
- Common/DTS.Common.SerializationPlus/Control/Event/Module/AnalogInputChannel/ReviewableSerialNumberAttribute.cs
- Common/DTS.Common.SerializationPlus/Control/Event/Module/AnalogInputChannel/ReviewableUnitsAttribute.cs
- Common/DTS.Common.SerializationPlus/Control/Event/Module/AnalogInputChannel/ReviewableMinMaxEuAttribute.cs
- Common/DTS.Common.SerializationPlus/Control/Event/Module/AnalogInputChannel/ReviewableCfcAttribute.cs
- Common/DTS.Common.SerializationPlus/Control/Event/Module/AnalogInputChannel/ReviewableTargetShuntDeflectionAttribute.cs
- Common/DTS.Common.SerializationPlus/Control/Event/Module/AnalogInputChannel/ReviewableMeasuredShuntDeflectionAttribute.cs
- Common/DTS.Common.SerializationPlus/Control/Event/Module/AnalogInputChannel/ReviewableShuntDeflectionPercentageAttribute.cs
generated_at: "2026-04-17T15:31:05.691210+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "4f8edc6331324b2a"
---
# Documentation: AnalogInputChannel Reviewable Attributes
## 1. Purpose
This module provides a collection of reviewable attribute classes nested within `DTS.Slice.Control.Event.Module.AnalogInputChannel`. These classes serve as adapters that extract, format, and present channel-specific metadata—such as calibration values, filter settings, engineering units, and measurement errors—for display or reporting purposes. Each attribute inherits from `Slice.Control.Event.Module.Channel.ReviewableAttribute` and uses a delegate-based approach to lazily retrieve values from the underlying channel object.
---
## 2. Public Interface
All classes are nested within the partial class hierarchy: `Event.Module.AnalogInputChannel`.
### ReviewableShuntDeflectionAttribute
```csharp
public ReviewableShuntDeflectionAttribute(Event.Module.Channel channel)
```
- **Label:** "Shunt Deflection (mV)"
- **Behavior:** Returns `MeasuredShuntDeflectionMv` from `IShuntAware` interface, formatted to 1 decimal place.
---
### ReviewableFilterFrequencyAttribute
```csharp
public ReviewableFilterFrequencyAttribute(Event.Module.Channel channel)
```
- **Label:** "Filter Frequency"
- **Behavior:** Returns `CutoffFrequencyHz` from `SaeJ211Filter`, cast to integer and formatted with thousands separator ("N").
---
### ReviewableIsoCodeAttribute
```csharp
public ReviewableIsoCodeAttribute(Event.Module.Channel channel)
```
- **Label:** "ISO Code"
- **Behavior:** Returns `IsoCode` from `AnalogInputChannel` as string.
---
### ReviewableDescriptionAttribute
```csharp
public ReviewableDescriptionAttribute(Event.Module.Channel channel)
```
- **Label:** "Description"
- **Behavior:** Returns `ChannelDescriptionString` from the channel.
---
### ReviewableSerialNumberAttribute
```csharp
public ReviewableSerialNumberAttribute(Event.Module.Channel channel)
```
- **Label:** "Serial Number"
- **Behavior:** Returns `SerialNumber` from `AnalogInputChannel` as string.
---
### ReviewableUnitsAttribute
```csharp
public ReviewableUnitsAttribute(Event.Module.Channel channel)
```
- **Label:** "Units"
- **Behavior:** Returns `EngineeringUnits` from `IEngineeringUnitAware` interface as string.
---
### ReviewableMinMaxEuAttribute
```csharp
public ReviewableMinMaxEuAttribute(Event.Module.Channel channel)
```
- **Label:** "Max/Min (EU)"
- **Behavior:** Returns a combined string of `DataMaxFilteredEu` and `DataMinFilteredEu`, both formatted to

View File

@@ -0,0 +1,156 @@
---
source_files:
- Common/DTS.Common.SerializationPlus/Control/Event/Module/Channel/ReviewableAttribute.NotApplicableException.cs
- Common/DTS.Common.SerializationPlus/Control/Event/Module/Channel/DataValues.cs
- Common/DTS.Common.SerializationPlus/Control/Event/Module/Channel/CalculatedChannel.cs
generated_at: "2026-04-17T15:38:30.345685+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "7405548f6ed6f3f6"
---
# Documentation: DTS.Slice.Control.Event.Module.Channel
## 1. Purpose
This module provides channel-related types within the `DTS.Slice.Control` namespace hierarchy. It defines exception types for attribute validation, data storage mechanisms for channel values (with optional memory-mapped file support), and an abstract class hierarchy for calculated channels that derive data from operations such as FFT, integration, differentiation, and vector mathematics. The module supports engineering unit-aware channels with various calculation types used in data acquisition and analysis workflows.
---
## 2. Public Interface
### `Event.Module.Channel.ReviewableAttribute.NotApplicableException`
**Namespace:** `DTS.Slice.Control`
A nested exception class representing attempts to use a channel attribute that is not applicable to the associated channel. Inherits from `ApplicationException`.
| Constructor | Signature | Description |
|-------------|-----------|-------------|
| Default | `public NotApplicableException()` | Initializes an instance with no message. |
| With Message | `public NotApplicableException(string msg)` | Initializes with a custom message string. |
| With Message and Inner | `public NotApplicableException(string msg, System.Exception innerEx)` | Initializes with a message and inner exception. |
---
### `Event.Module.Channel.DataValues`
**Namespace:** `DTS.Slice.Control`
Represents a channel's data storage. Inherits from `Exceptional`.
| Constructor | Signature | Description |
|-------------|-----------|-------------|
| Default | `public DataValues()` | Initializes with `useMemoryMappedFile = true`. |
| Parameterized | `public DataValues(bool useMemoryMappedFile)` | Initializes with explicit memory-mapped file setting. |
| Property | Type | Access | Description |
|----------|------|--------|-------------|
| `UseMemoryMappedFile` | `bool` | get/set | Switch to use memory-mapped files instead of in-memory lists (for large data sets). |
---
### `Event.Module.Channel.CalculatedChannel` (Abstract)
**Namespace:** `DTS.Slice.Control`
Abstract base class for calculated channels. Inherits from `Channel` and implements `Common.DAS.Concepts.DAS.Channel.IEngineeringUnitAware`.
**Nested Enums:**
| Enum | Values |
|------|--------|
| `Operation` | `Integral`, `Derivative`, `HeadInjuryCriteria`, `FFT`, `ImportedCSV`, `Resultant`, `TSR`, `Scale`, `Offset`, `Sine`, `Cosine` |
| `XUnits` | `msec`, `sec`, `Hz`, `samples` |
**Constructor:**
```csharp
public CalculatedChannel(
string name,
XUnits xAxis,
string yAxis,
double[] xValues,
double[] yValues,
Operation calcType,
int number,
Module parentModule
)
```
**Properties:**
| Property | Type | Access | Description |
|----------|------|--------|-------------|
| `CalculationType` | `Operation` | get | Returns the operation type for this channel. |
| `X` | `double[]` | get | Returns X-axis values as array. |
| `Y` | `double[]` | get | Returns Y-axis values as array. |
| `XAxis` | `XUnits` | get | Returns the X-axis unit type. |
| `XUnitsString` | `string` | get | Returns string representation ("Hz", "ms", "samples", "s", or "N/A"). |
| `EngineeringUnits` | `string` | get/set | Gets or sets the Y-axis engineering units string. |
| `SupportsADC` | `bool` | get | Always returns `false`. |
| `SupportsEU` | `bool` | get | Always returns `true`. |
| `SupportsmV` | `bool` | get | Always returns `false`. |
| `ActualMaxRangeEu` | `double` | get | Returns `_y.Max()`. |
| `ActualMinRangeEu` | `double` | get | Returns `_y.Min()`. |
| `DataHalfRangeValueEu` | `double` | get | Returns midpoint of min/max Y values. |
| `DataMaxEu` | `double` | get | Returns `_y.Max()`. |
| `DataMinEu` | `double` | get | Returns `_y.Min()`. |
| `DataRangeEu` | `double` | get | Returns max of absolute min/max Y values. |
| `DataZeroLevelAdc` | `short` | get | Always returns `0`. |
| `IsConfigured` | `bool` | get/set | Getter returns `true`; setter throws `NotSupportedException`. |
**Methods:**
| Method | Return Type | Behavior |
|--------|-------------|----------|
| `ToString()` | `string` | Returns `ChannelDescriptionString` or "N/A". |
| `GetUnfilteredDataEu()` | `List<double>` | Returns a new `List<double>` copy of Y values. |
| `FromDtsSerializationTestModuleChannel(Serialization.Test.Module.Channel)` | `void` | Throws `NotSupportedException`. |
| `SetPropertyValuesFrom(DASLib.Service.DASChannel)` | `void` | Throws `NotSupportedException`. |
| `SetPropertyValuesFrom(IDiagnosticResult)` | `void` | Throws `NotSupportedException`. |
| `ToDtsSerializationTestModuleChannel(Serialization.Test.Module)` | `Serialization.Test.Module.Channel` | Throws `NotSupportedException`. |
| `ActualMaxRangeMv` | `double` | Throws `NotSupportedException`. |
| `ActualMinRangeMv` | `double` | Throws `NotImplementedException`. |
| `GetUnfilteredDataMV()` | `List<double>` | Throws `NotImplementedException`. |
| `SensorCapacityEU` | `double` | Throws `NotImplementedException`. |
| `DesiredRangeEU` | `double` | Throws `NotImplementedException`. |
---
### Concrete Calculated Channel Classes
All inherit from `CalculatedChannel` and expose only constructors matching the base signature:
| Class | Additional Members |
|-------|-------------------|
| `IntegralCalculatedChannel` | None beyond base constructor. |
| `DerivativeCalculatedChannel` | None beyond base constructor. |
| `ScaleCalculatedChannel` | None beyond base constructor. |
| `OffsetCalculatedChannel` | None beyond base constructor. |
| `ResultantCalculatedChannel` | None beyond base constructor. |
| `AdditiveVectorCalculatedChannel` | None beyond base constructor. |
| `SineCalculatedChannel` | None beyond base constructor. |
| `CosineCalculatedChannel` | None beyond base constructor. |
### `FFTCalculatedChannel`
Extends `CalculatedChannel` with FFT-specific data.
**Constructor:**
```csharp
public FFTCalculatedChannel(
string name,
XUnits xAxis,
string yAxis,
double[] xValues,
double[] yValues,
Operation calcType,
int number,
Module parentModule,
double peakFrequency
)
```
| Property | Type | Access | Description |
|----------|------|--------|-------------|
| `PeakFrequency` | `double

View File

@@ -0,0 +1,117 @@
---
source_files:
- Common/DTS.Common.SerializationPlus/Filter/IFilterable.cs
- Common/DTS.Common.SerializationPlus/Filter/IFilter.cs
- Common/DTS.Common.SerializationPlus/Filter/Filter.cs
- Common/DTS.Common.SerializationPlus/Filter/ChannelDefaultSaeJ211Filter.cs
- Common/DTS.Common.SerializationPlus/Filter/SaeJ211Filter.cs
generated_at: "2026-04-17T15:36:56.212578+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "184fcb42f27aa9cb"
---
# Documentation: DTS.Common.SerializationPlus.Filter
## 1. Purpose
This module provides a filtering framework for signal data processing within the DTS system. It defines interfaces and implementations for applying SAE J211-compliant filters to event module channel data, supporting both standard CFC (Channel Filter Class) values and ad-hoc frequency-based filters. The module enables filtering of raw ADC data, millivolt data, or engineering units (EU) data with optional legacy TDC software filter adjustment for backward compatibility.
---
## 2. Public Interface
### IFilterable
**File:** `Common/DTS.Common.SerializationPlus/Filter/IFilterable.cs`
Interface defining a filterable slice control event module channel.
| Member | Signature | Description |
|--------|-----------|-------------|
| `UseFilterCaching` | `bool UseFilterCaching { get; set; }` | Switch to enable/disable filter caching. |
| `AvailableFilters` | `List<IFilter> AvailableFilters { get; }` | Returns list of available filters for this object. |
| `CurrentFilter` | `IFilter CurrentFilter { get; set; }` | The currently applied filter. |
| `GetDataFilteredBy` | `double[] GetDataFilteredBy(IFilter filter, Event.Module.Channel.DataDisplayUnits displayUnits)` | Returns filtered data array based on specified filter and display units. |
---
### IFilter
**File:** `Common/DTS.Common.SerializationPlus/Filter/IFilter.cs`
Interface defining a slice control event module channel filter.
| Member | Signature | Description |
|--------|-----------|-------------|
| `Name` | `string Name { get; }` | Descriptive designation for the filter. |
| `IsCfc` | `bool IsCfc { get; }` | Indicates whether this filter is a cardinal CFC value. |
| `Type` | `ChannelFilter Type { get; }` | Returns the `ChannelFilter` designation. |
| `CutoffFrequencyHz` | `double CutoffFrequencyHz { get; }` | Returns the cutoff frequency in Hz. |
| `IsoDescription` | `char IsoDescription { get; }` | Returns ISO description character. |
| `Apply` | `double[] Apply(Event.Module.Channel input, Event.Module.Channel.DataDisplayUnits displayUnits, bool bUseLegacyTDCSofwareFilterAdjustment)` | Applies filter to channel data with specified display units. |
| `Apply` | `double[] Apply(double[] data, double sampleRate, bool bUseLegacyTDCSoftwareFilterAdjustment)` | Applies filter to raw double array with specified sample rate. |
| `ToBaseString` | `string ToBaseString()` | Returns base name without decoration (contrast with `ToString()`). |
---
### Filter (Abstract Class)
**File:** `Common/DTS.Common.SerializationPlus/Filter/Filter.cs`
Abstract base class for filters, inheriting from `Exceptional` and implementing `IFilter`. All members are abstract and must be implemented by derived classes.
---
### SaeJ211Filter
**File:** `Common/DTS.Common.SerializationPlus/Filter/SaeJ211Filter.cs`
Concrete implementation of SAE J211-based filters.
**Constructors:**
| Signature | Description |
|-----------|-------------|
| `SaeJ211Filter(SaeJ211Filter originalFilter)` | Copy constructor preserving `OriginalType` and `CutoffFrequencyHz`. |
| `SaeJ211Filter(ChannelFilter originalType)` | Initializes from `ChannelFilter` enum value. Throws `Exception` if `ChannelFilter.AdHoc` is passed (requires frequency). |
| `SaeJ211Filter(double cutoffFrequencyHz)` | Initializes ad-hoc filter with specified cutoff frequency. Sets `OriginalType` to `ChannelFilter.AdHoc`. |
**Properties:**
| Member | Description |
|--------|-------------|
| `IsCfc` | Returns `true` if `Type` is not `Unfiltered`, `UnfilteredZero`, or `AdHoc`. |
| `Type` | Returns best-fitting `ChannelFilter` by converting frequency to CFC if applicable. |
| `IsoDescription` | Decoded via `IsoDescriptionAttributeCoder`. |
| `CutoffFrequencyHz` | The cutoff frequency value. |
| `OriginalType` | The original `ChannelFilter` type set during construction. |
| `Name` | Lazily computed: frequency + "Hz" for AdHoc, or description from `DescriptionAttributeCoder<ChannelFilter>`. |
**Methods:**
| Signature | Description |
|-----------|-------------|
| `double[] Apply(Event.Module.Channel channel, Slice.Control.Event.Module.Channel.DataDisplayUnits displayUnits, bool bUseLegacyTDCSoftwareFilterAdjustment)` | Applies filter using `FilterUtility`. Handles `PersistentChannel` from both `Serialization.SliceRaw.File` and `Serialization.TDAS.File`. Supports `Adc`, `Eu`, and `Mv` display units. |
| `double[] Apply(double[] data, double sampleRate, bool bUseLegacyTDCSoftwareFilterAdjustment)` | Applies filter directly to data array. |
| `string ToString()` | Returns `Name`. |
| `string ToBaseString()` | Returns `Name`. |
| `bool Equals(object obj)` | Compares filters by `Name` (case-insensitive). |
| `int GetHashCode()` | Returns hash of `Name.ToLower()`. |
| `static Filter Parse(string serialization)` | Factory method. Parses strings like "1000Hz" or CFC descriptions. Returns `SaeJ211Filter(ChannelFilter.Unfiltered)` for null/empty input. |
---
### DefaultSaeJ211Filter
**File:** `Common/DTS.Common.SerializationPlus/Filter/ChannelDefaultSaeJ211Filter.cs`
Wrapper filter that decorates the base name with "Default (...)" prefix.
**Constructors:**
| Signature | Description |
|-----------|-------------|
| `DefaultSaeJ211Filter(SaeJ211Filter filter)` | Copy constructor from existing filter. |
| `DefaultSaeJ211Filter(ChannelFilter filterType)` | Initializes from `ChannelFilter` enum. |
| `DefaultSaeJ211Filter(double adHocFrequency)` | Initializes ad-hoc filter with specified frequency. |
**Methods:**
| Signature | Description |
|-----------|-------------|
| `string ToBaseString()` | Returns `base.Name` (undecorated). |
| `string ToString()` | Returns `Name` (decorated). |
---

View File

@@ -0,0 +1,23 @@
---
source_files:
- Common/DTS.Common.SerializationPlus/Properties/AssemblyInfo.cs
generated_at: "2026-04-17T16:27:42.028976+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "277d9af1f82368b7"
---
# Properties
### Purpose
This module contains assembly-level metadata for the `DTS.Common.SerializationPlus` assembly. It provides versioning, COM visibility settings, and identification information for a serialization-related component.
### Public Interface
No public types are exposed. This module consists solely of assembly-level attributes:
- `[assembly: AssemblyTitle("DTS.Common.SerializationPlus")]`
- `[assembly: AssemblyDescription("")]`
- `[assembly: AssemblyConfiguration("")]`
- `[assembly: AssemblyCompany("")]`
- `[assembly: AssemblyProduct("DTS.Common.SerializationPlus")]`
- `[assembly: AssemblyCopyright("Copyright ©

View File

@@ -0,0 +1,109 @@
---
source_files:
- Common/DTS.Common.SerializationPlus/XLSX/Excel.File.cs
- Common/DTS.Common.SerializationPlus/XLSX/Excel.File.Writer.cs
generated_at: "2026-04-17T15:42:01.836098+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "6e876d1fde5a5ee5"
---
# Documentation: DTS.Serialization.XLSX
## 1. Purpose
This module provides XLSX (Excel) export functionality for test data within the DTS serialization framework. It implements the `Serialization.File` abstract base class and `IWriter<Test>` interface to export test data—including channel information, sensor metadata, and sampled data—to Excel spreadsheets. The module supports exporting data in Engineering Units (EU), millivolts (mV), or raw ADC values, with optional software filtering applied during export.
---
## 2. Public Interface
### `File` Class (partial)
**Namespace:** `DTS.Serialization.XLSX`
**Inheritance:** `Serialization.File`, `IWritable<Test>`
| Member | Signature | Description |
|--------|-----------|-------------|
| `File()` | `public File()` | Constructor that initializes the file type as "XLSX". |
| `Exporter` | `IWriter<Test> Exporter { get; }` | Lazily initializes and returns the writer instance for XLSX export. Creates a new `Writer` on first access. |
| `ExportADC` | `bool ExportADC { set; }` | Write-only property that controls whether ADC values are exported. Delegates to `Writer.ExportADC`. |
| `ExportEU` | `bool ExportEU { set; }` | Write-only property that controls whether Engineering Units are exported. Delegates to `Writer.ExportEU`. |
| `ExportMV` | `bool ExportMV { set; }` | Write-only property that controls whether millivolt values are exported. Delegates to `Writer.ExportMv`. |
### `File.Writer` Class (nested)
**Namespace:** `DTS.Serialization.XLSX`
**Inheritance:** `Writer<File>`, `IWriter<Test>`
| Member | Signature | Description |
|--------|-----------|-------------|
| `ExportADC` | `bool ExportADC { get; set; }` | Controls whether ADC values are included in export. Default: `false`. |
| `ExportEU` | `bool ExportEU { get; set; }` | Controls whether Engineering Units are included in export. Default: `true`. |
| `ExportMv` | `bool ExportMv { get; set; }` | Controls whether millivolt values are included in export. Default: `false`. |
| `Start` | `double Start { get; set; }` | Starting time bound for data export. |
| `Stop` | `double Stop { get; set; }` | Ending time bound for data export. |
| `Filtered` | `bool Filtered { get; set; }` | Indicates whether software filtering should be applied to exported data. |
| `ExportHeaders` | `List<IExportHeader> ExportHeaders { get; set; }` | List of user-selected headers to export (FB 6410). |
| `WriterParent` | `File WriterParent { get; }` | Internal property referencing the owning `File` instance. |
| `Write` | `void Write(string pathname, string id, Test test, bool bFiltering, bool includeGroupNameInISOExport, double minStartTime, int dataCollectionLength)` | **Empty implementation** — no code body. |
| `Write` | `void Write(string pathname, string id, string dataFolder, Test test, bool bFiltering, bool includeGroupNameInISOExport, FilteredData fd, Test.Module.Channel tmChannel, int channelNumber, BeginEventHandler beginEventHandler, CancelEventHandler cancelEventHandler, EndEventHandler endEventHandler, TickEventHandler tickEventHandler, ErrorEventHandler errorEventHandler, CancelRequested cancelRequested, double minStartTime, int dataCollectionLength)` | Main export method. Writes test data to XLSX file at specified path. Handles channel metadata, filtering, and sample data export. |
| `Initialize` | `void Initialize(string pathname, string id, string dataFolder, Test test, bool bFiltering, bool includeGroupNameInISOExport, FilteredData fd, Test.Module.Channel tmChannel, int channelNumber, BeginEventHandler beginEventHandler, CancelEventHandler cancelEventHandler, EndEventHandler endEventHandler, TickEventHandler tickEventHandler, ErrorEventHandler errorEventHandler, CancelRequested cancelRequested)` | **Empty implementation** — no code body. |
| `GetDataScaler` | `static Common.DAS.Concepts.DataScaler GetDataScaler(Test.Module.AnalogInputChannel currentAnalogChannel)` | Static factory method that constructs a `DataScaler` from an `AnalogInputChannel`, configuring inversion, IEPE, unit conversion, linearization, offsets, excitation voltages, and digital properties. |
---
## 3. Invariants
1. **Template File Requirement:** The file `XLSXExportTemplate.xlsx` must exist at `{AppDomain.CurrentDomain.BaseDirectory}/ReportTemplates/` or the export will fail.
2. **Channel Processing Order:** Channels are sorted by `AbsoluteDisplayOrder` then by `Number` before processing, not by display order (per FB 14659).
3. **Default Export Mode:** The `Writer` defaults to `ExportEU = true`, `ExportADC = false`, `ExportMv = false`.
4. **AnalogInputChannel Only:** Only channels of type `Test.Module.AnalogInputChannel` are processed; all other channel types are skipped during export.
5. **Progress Update Interval:** Progress updates occur every `UPDATE_INTERVAL` (1000) samples.
6. **Column Indexing:** Excel columns start at "B" (index 0 maps to column B) due to column A being reserved for header labels.
7. **ISO Code Mode:** When `WriterParent.ISOViewMode` is `ChannelNameOnly`, the ISO code field is written as empty string.
---
## 4. Dependencies
### This Module Depends On:
- **DocumentFormat.OpenXml** — OpenXML SDK for Excel file manipulation
- **DocumentFormat.OpenXml.Packaging** — Spreadsheet document handling
- **DocumentFormat.OpenXml.Spreadsheet** — Spreadsheet-specific OpenXML types
- **DTS.Common.Enums** — Enumerations including `IsoViewMode`
- **DTS.Common.Enums.Sensors** — `SensorConstants.BridgeType.IEPE`
- **DTS.Common.Interface.ExportData** — `IExportHeader` interface
- **DTS.Common.SerializationPlus** — Base serialization framework (`Serialization.File`, `Writer<T>`)
- **DTS.Common.Utilities.Logging** — `APILogger` for error logging
- **DTS.Slice.Control** — `SaeJ211Filter`, `FilteredData`, event handler delegates
- **Common.DAS.Concepts.DataScaler** — Data scaling and unit conversion
### What Depends On This Module:
- Unclear from source alone — no direct consumers visible in these files.
---
## 5. Gotchas
1. **Empty Method Implementations:** Both the 6-parameter `Write` overload and the `Initialize` method have empty bodies. This may indicate incomplete implementation or dead code.
2. **Cast in Property Setters:** The `ExportADC`, `ExportEU`, and `ExportMV` setters on `File` cast `_exporter` from `IWriter<Test>` to `Writer`. This will throw an `InvalidCastException` if a different `IWriter<Test>` implementation is substituted.
3. **Dual Excel Writing Approaches:** The export uses DOM-based writing (via `GetCell`, `InsertCellInWorksheet`) for headers/metadata, then switches to SAX-based writing (via `OpenXmlReader`/`OpenXmlWriter`) for sample data. This is a performance optimization but creates complexity.
4. **Removed GC Calls:** Commented-out garbage collection code exists in the `Write` method with a note that it caused significant performance hit. It was likely added when the application was 32-bit only.
5. **Static Row Cache:** `_rowIndexToRow` is a `static readonly Dictionary<uint, Row>` that is cleared at the start of each `Write` call. This could cause issues if multiple exports run concurrently.
6. **String Lookup Not Thread-Safe:** `_stringLookup` is an instance field initialized to `null` and built lazily during `InsertSharedStringItem`. The method is not thread-safe.
7. **Filtered Data Behavior:** When `Filtered` is `false`, the software filter column writes "NONE" instead of the actual filter name (FB 18024).
8. **Interpolation Logic:** When sample rates differ between channels, linear interpolation is applied. The interpolation handles edge cases (end of data) by using the previous sample for the increment calculation.
9. **FogBugz References:** Multiple comments reference FogBugz tickets (9920, 6410, 14659, 18024, 14469, 14513) indicating historical bug fixes that may be relevant for understanding edge cases.