14 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
2026-04-16T03:42:34.925173+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 2400faf1f9897d63 |
Documentation: DTS.Slice.Control.Event.Module.Channel Subsystem
1. Purpose
This module provides core data structures and abstractions for representing and manipulating channel data within event recordings in the DTS Slice Control system. It defines the foundational types for physical channels, calculated channels, filters (including SAE J211–compliant filters), and data storage mechanisms (in-memory vs. memory-mapped). The subsystem enables filtering, unit conversion, and serialization of channel data, supporting both raw sensor inputs (ADC) and derived quantities (EU, mV), as well as computed channels (e.g., integrals, derivatives, FFTs). It serves as the data model layer for event analysis and review workflows.
2. Public Interface
DataValues class
Defined in: Common/DTS.Common.Serialization/Control/Event/Module/Channel/DataValues.cs
-
DataValues()
Initializes aDataValuesinstance using in-memory storage (i.e.,UseMemoryMappedFile = false). -
DataValues(bool useMemoryMappedFile)
Initializes aDataValuesinstance. IfuseMemoryMappedFileistrue, the instance is configured to use memory-mapped files for data storage (intended for large datasets exceeding process memory limits). -
UseMemoryMappedFile: bool
Property controlling whether the instance uses memory-mapped files (true) or in-memory storage (false). Implemented via aProperty<bool>wrapper.
Filter abstract class
Defined in: Common/DTS.Common.Serialization/Control/Event/Module/Channel/Filter.cs
-
Name: string(abstract)
Returns a descriptive name for the filter (e.g.,"6G"for a 6g filter, or"123.45Hz"for ad hoc). -
IsCfc: bool(abstract)
Returnstrueif the filter corresponds to a defined CFC (Channel Filter Classification) value;falseforUnfilteredorAdHoc. -
Type: ChannelFilter(abstract)
Returns the canonicalChannelFilterenum value representing the filter (e.g.,ChannelFilter.SixG,ChannelFilter.AdHoc). -
CutoffFrequencyHz: double(abstract)
Returns the filter’s cutoff frequency in hertz. -
Apply(Channel input, DataDisplayUnits displayUnits, bool bUseLegacyTDCSoftwareFilterAdjustment): double[](abstract)
Applies the filter to the unfiltered data of the specifiedinputchannel, returning filtered data in the requesteddisplayUnits(ADC, EU, or mV). ThebUseLegacyTDCSoftwareFilterAdjustmentflag controls whether a one-sample phase shift is applied to match legacy TDC behavior (see issue #8747). -
Apply(double[] data, double sampleRate, bool bUseLegacyTDCSoftwareFilterAdjustment): double[](abstract)
Applies the filter to a raw data array with knownsampleRate, returning filtered data. Used when channel context is unavailable. -
ToBaseString(): string(abstract)
Returns the filter’s base name (e.g.,"6G"), without any decorative prefix (e.g.,"Default (6G)"). Distinct fromToString().
SaeJ211Filter class
Defined in: Common/DTS.Common.Serialization/Control/Event/Module/Channel/SaeJ211Filter.cs
-
SaeJ211Filter(ChannelFilter originalType)
Initializes a filter for a CFC-compliant type (e.g.,ChannelFilter.SixG). ThrowsExceptioniforiginalType == ChannelFilter.AdHoc. -
SaeJ211Filter(double cutoffFrequencyHz)
Initializes an ad hoc filter with the specified cutoff frequency. -
SaeJ211Filter(SaeJ211Filter originalFilter)
Copy constructor. -
OriginalType: ChannelFilter
Stores the original filter type passed at construction (e.g.,AdHocfor ad hoc filters). Not modifiable after construction. -
Type: ChannelFilter(override)
Returns the effective filter type: ifOriginalType == AdHoc, resolves to the nearest matching CFC (orAdHocif no match); otherwise returnsOriginalType. -
IsCfc: bool(override)
ReturnstrueifTypeis neitherUnfilterednorAdHoc. -
CutoffFrequencyHz: double(override)
Returns the cutoff frequency in Hz (derived fromOriginalTypeor explicitly set for ad hoc filters). -
IsoDescription: char
Returns the first character of the ISO description forOriginalType(e.g.,'G'forSixG). -
Name: string(override)
Returns a human-readable name:- For
AdHoc:"123.45Hz" - For CFC types: description from
DescriptionAttributeCoder<ChannelFilter>(e.g.,"6G").
- For
-
Apply(...)(override)
Implements filtering usingFilterUtility. Supports filtering fromUnfilteredData,UnfilteredDataEu, orUnfilteredDataMvdepending ondisplayUnits. Logs warnings for invalid data viaAPILogger. -
Parse(string serialization): Filter(static)
Parses a serialized filter string (e.g.,"6G","123.45Hz") into aFilterinstance. Falls back toUnfilteredon parse failure. -
Equals(object obj): bool(override)
Case-insensitive comparison of filter names. -
GetHashCode(): int(override)
Hash code based on lowercase filter name. -
ToString(): string(override)
ReturnsName. -
ToBaseString(): string(override)
ReturnsName.
DefaultSaeJ211Filter class
Defined in: Common/DTS.Common.Serialization/Control/Event/Module/Channel/ChannelDefaultSaeJ211Filter.cs
-
DefaultSaeJ211Filter(SaeJ211Filter filter)
Copy constructor. -
DefaultSaeJ211Filter(ChannelFilter filterType)
Initializes with a CFC filter type. -
DefaultSaeJ211Filter(double adHocFrequency)
Initializes with an ad hoc frequency. -
Name: string(override)
Returns"Default (" + base.Name + ")"(e.g.,"Default (6G)"). -
ToBaseString(): string(override)
Returnsbase.Name(e.g.,"6G"). -
ToString(): string(override)
ReturnsName.
CalculatedChannel abstract class
Defined in: Common/DTS.Common.Serialization/Control/Event/Module/Channel/CalculatedChannel.cs
-
Operationenum
Defines supported calculations:Integral,Derivative,HeadInjuryCriteria,FFT,ImportedCSV,Resultant,TSR,Scale,Offset,Sine,Cosine. -
CalculationType: Operation
Returns the operation performed by this channel. -
X: double[],Y: double[]
Read-only arrays of x-axis and y-axis data points. -
XAxis: XUnits
X-axis unit type (msec,sec,Hz,samples). -
XUnitsString: string
Human-readable unit string (e.g.,"ms","Hz"). -
EngineeringUnits: string
Y-axis engineering units (e.g.,"g","m/s"). -
SupportsADC: bool(override)
Alwaysfalsefor calculated channels. -
SupportsEU: bool(override)
Alwaystrue. -
SupportsmV: bool(override)
Alwaysfalse. -
ActualMaxRangeEu,ActualMinRangeEu,DataMaxEu,DataMinEu,DataRangeEu,DataHalfRangeValueEu(overrides)
Computed fromYdata (e.g.,DataMaxEu = _y.Max()). -
IsConfigured: bool(override)
Alwaystrue; setting throwsNotSupportedException. -
GetUnfilteredDataEu(): List<double>(override)
Returns a copy ofY. -
Constructors
CalculatedChannel(string name, XUnits xAxis, string yAxis, double[] xValues, double[] yValues, Operation calcType, int number, Module parentModule)
Initializes with data, axis labels, and calculation type. SetsCurrentFiltertoDefaultSaeJ211Filter(ChannelFilter.Unfiltered).
-
ToString(): string(override)
ReturnsChannelDescriptionStringor"N/A".
Derived CalculatedChannel classes
Defined in: Common/DTS.Common.Serialization/Control/Event/Module/Channel/CalculatedChannel.cs
-
FFTCalculatedChannelPeakFrequency: double
Returns the peak frequency from the FFT.
-
IntegralCalculatedChannel,DerivativeCalculatedChannel,ScaleCalculatedChannel,OffsetCalculatedChannel,ResultantCalculatedChannel,AdditiveVectorCalculatedChannel,SineCalculatedChannel,CosineCalculatedChannel
All inherit fromCalculatedChannelwith no additional public members.
Note
:
HICCalculatedChannelis commented out in source and not documented.
ReviewableAttribute.NotApplicableException class
Defined in: Common/DTS.Common.Serialization/Control/Event/Module/Channel/ReviewableAttribute.NotApplicableException.cs
-
NotApplicableException()
Default constructor. -
NotApplicableException(string msg)
Constructor with message. -
NotApplicableException(string msg, Exception innerEx)
Constructor with message and inner exception.
Inherits from
ApplicationException.
3. Invariants
-
DataValues.UseMemoryMappedFile
Once set during construction, this flag determines the storage strategy for channel data. No runtime switching is exposed. -
SaeJ211Filter.OriginalType
Immutable after construction.Typemay differ fromOriginalTypefor ad hoc filters (resolved to nearest CFC orAdHoc). -
Filter.Type
For ad hoc filters (OriginalType == AdHoc),Typeis computed dynamically based onCutoffFrequencyHz(viaConvertFrequencyToChannelFilter). If frequency matches a CFC enum value,Typebecomes that CFC; otherwise remainsAdHoc. -
CalculatedChannelpropertiesSupportsADCandSupportsmVare alwaysfalse;SupportsEUis alwaystrue.- Range properties (
ActualMaxRangeEu, etc.) are derived fromYdata and may change ifYis modified (thoughYis read-only via public API).
-
Filter.Apply(...)
Filtering always usesFilterUtilitywithCfc = Type,AdHocFrequency = CutoffFrequencyHz, andSampleRatefrom channel or parameter. Invalid data triggers logging and exception. -
Filter.Parse(...)
ReturnsUnfilteredfilter on parse failure (notnull).
4. Dependencies
Internal Dependencies (from source)
-
DTS.Common.Utilities
Used forProperty<T>, logging (APILogger), and encoding utilities (CfcValueAttributeCoder,DescriptionAttributeCoder,IsoDescriptionAttributeCoder). -
DTS.Slice.Control.DAS.Channel
Referenced forChannelFilterenum andDataDisplayUnitsenum. -
DTS.Common.DAS.Concepts.DAS.Channel.IEngineeringUnitAware
Implemented byCalculatedChannel. -
Serialization types
Serialization.SliceRaw.File.PersistentChannel,Serialization.TDAS.File.PersistentChannel,ILargeDataAware,Serialization.Test.Module.Channel. -
DTS.Calculations.HeadInjuryCriterion.HICResult
Referenced in commented-outHICCalculatedChannelcode. -
DTS.Common.Utilities.SaeJ211
Used forFilterUtilityand related encoding.
External Dependencies (inferred)
-
System
Standard .NET types (Exception,ApplicationException,CultureInfo,Enum, etc.). -
Windows Forms (commented)
System.Windows.Forms.MessageBoxappears in commented-out code (not active).
5. Gotchas
-
DataValueshas no data storage logic
The class only configures storage mode (UseMemoryMappedFile). Actual data handling is delegated toChannel(not shown in these files).DataValuesis a configuration helper, not a data container. -
SaeJ211Filter.Typemay differ fromOriginalType
For ad hoc filters,Typeresolves to the nearest CFC match. This can causeIsCfcto returntrueeven ifOriginalType == AdHoc. -
Filter.Parse(...)silently falls back toUnfiltered
On parse failure, returnsnew SaeJ211Filter(ChannelFilter.Unfiltered)instead of throwing. Callers must validate if needed. -
DefaultSaeJ211Filter.ToString()vsToBaseString()
ToString()returns"Default (X)", whileToBaseString()returns"X". Confusing if not documented. -
CalculatedChannelrange properties assume non-emptyY
DataMaxEu,DataMinEu, etc., use_y.Max()/_y.Min()without checking for empty data. Will throwInvalidOperationExceptionifYis empty. -
SupportsADC/SupportsmVare hard-codedfalse
Calculated channels never support raw ADC or mV; only engineering units (EU). Attempting to accessActualMinRangeMvthrowsNotImplementedException. -
CalculatedChannelserialization methods throwNotSupportedException
FromDtsSerializationTestModuleChannel,ToDtsSerializationTestModuleChannel,SetPropertyValuesFrom(...)all throw. Calculated channels are not serializable via these paths. -
Filter.Apply(...)logs invalid data but throws
FilterUtility.InvalidDataDelegatelogs viaAPILoggerbut then throws an exception. No silent failure. -
ChannelFilterenum values are used as frequencies
CFC filters (e.g.,ChannelFilter.SixG) are implicitly cast todoublefor frequency. This relies on enum underlying values matching CFC frequencies. -
IsoDescriptionusesOriginalType
The ISO description character is derived fromOriginalType, notType. For ad hoc filters, this may beUnfiltered(not meaningful). -
DataValuesconstructor catches and rethrows asException
Any exception during construction is wrapped in a genericExceptionwith a message like"encountered problem constructing DTS.Slice.Control.Event.Module.Channel.DataValues". Original exception is preserved inInnerException.