13 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
2026-04-16T03:41:53.208866+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | e1ba9340d986b9b2 |
Documentation: DTS.Slice.Control.Event Accessor Classes and Related Types
1. Purpose
This module provides accessor objects and supporting infrastructure for navigating and manipulating event data within the DTS Slice Control system. Specifically, it defines hierarchical dictionary-based accessors (DasModuleAccessor, DasChannelAccessor, DasModuleChannelAccessor, ChannelAccessor, ModuleChannelAccessor) that enable lookup of modules and channels by DAS ID, module number, and channel number combinations. It also includes the core Event class (a partial class with multiple files), which serves as the in-memory representation of a DAS event—encapsulating test metadata, modules, channels, and derived properties such as validation flags and serialization support. The module bridges low-level DAS serialization data (e.g., DTS.Serialization.Test) and higher-level control logic by offering structured, type-safe access to event components.
2. Public Interface
All accessor classes and the Event class reside in the DTS.Slice.Control namespace and are declared as public partial class Event.
Event Class
-
Event()
Default constructor. Initializes all properties to their default values. -
Event(string id, string description)
Initializes anEventwith the givenidanddescription. Throws a wrapped exception on failure. -
Event(Test test, Test.ReportErrors reportErrors)
Initializes anEventby converting from aDTS.Serialization.Testobject viaFromDtsSerializationTest. Rethrows exceptions directly. -
Event(string id, string description, List<Module> modules)
Initializes anEventwithid,description, and a list ofModules. -
Event(List<IDASCommunication> dases, EventInfoAggregate info)
Initializes anEventby aggregating configuration and channel data from a list of DAS devices (IDASCommunication) andEventInfoAggregate. PopulatesModules,DasModules,DasChannels, andDasModuleChannels. ThrowsUserExceptionfor missing DAS info or configuration. Validates test ID consistency across DAS units. -
string Id { get; set; }
Gets/sets the event’s test ID. -
string Description { get; set; }
Gets/sets the event’s description. -
Guid Guid { get; set; }
Gets/sets the globally unique identifier for the event. Default isGuid.Empty. -
UInt16 FaultFlags { get; set; }
Gets/sets the global fault flags for the event. -
DateTime InceptionDate { get; private set; }
Gets the creation date of the event (set during construction). Defaults toDateTime.Now. -
List<Module> Modules { get; set; }
Gets/sets the list ofModuleobjects associated with this event. -
List<Module.Channel> CalculatedChannels { get; set; }
Gets/sets the list of calculated channels. -
DasModuleAccessor DasModules { get; private set; }
Returns aDasModuleAccessorkeyed by DAS ID (Common.DAS.Concepts.DAS.Id), mapping to aList<Module>. -
DasChannelAccessor DasChannels { get; private set; }
Returns aDasChannelAccessorkeyed by DAS ID, mapping to aList<Module.Channel>. -
DasModuleChannelAccessor DasModuleChannels { get; private set; }
Returns aDasModuleChannelAccessorkeyed by DAS ID, mapping to aModuleChannelAccessor. -
int LastAbsoluteChannelNumberInEvent { get; }
Returns the highest absolute channel number across all modules and channels. -
bool IsTooLargeFor32BitVisualization { get; }
Returnstrueif the total data volume (based onTooLargeFor32BitVisualizationBytesPerSampleThreshold) exceeds 2GB (0x7FFFFFFF bytes). -
double TooLargeFor32BitVisualizationBytesPerSampleThreshold { get; private set; }
Threshold in bytes per sample used for 32-bit visualization size checks. Default:2.0. -
bool ContainsChannelsActiveInvalidZeroingWindows { get; }
Returnstrueif any channel hasZeroMethod == AverageOverTimeand an invalid averaging window. -
List<Module.Channel> ChannelsWithActiveInvalidZeroingWindows { get; }
Returns the list of channels with active but invalid zeroing windows (e.g., window outside data range or negative indices). -
static string BaseSerializationDirectory { get; set; }
Gets/sets the base directory path for event serialization. -
static string GetEventSerializationDirectory(string eventId)
Returns the full path for the serialization directory of the giveneventId. -
bool Equals(object obj)
OverridesEqualsto compareId,Description,Guid,Modules, andFaultFlags. -
int GetHashCode()
OverridesGetHashCode. -
Test ToDtsSerializationTest()
Converts thisEventto aDTS.Serialization.Test. Removes unconfigured/dummy channels before serialization. -
void FromDtsSerializationTest(Test that, Test.ReportErrors reportErrors)
Populates thisEventfrom aDTS.Serialization.Test. Re-throwsInvalidDataExceptiondirectly; wraps others. -
static implicit operator Test(Event sliceControlEvent)
Implicit conversion operator toDTS.Serialization.Test. -
static bool IsG5(IDASCommunication idas)
Returnstrueif the DAS serial number starts with"5M". -
static bool IsSlice6DBModule(Module module)
Returnstrueifmodule.Description.ToLower() == "slice6db module".
Accessor Classes
-
DasModuleAccessor : ExceptionalDictionary<Common.DAS.Concepts.DAS.Id, List<Module>>
Keyed by DAS ID, maps to list ofModules. Used to retrieve modules by DAS. -
DasChannelAccessor : ExceptionalDictionary<Common.DAS.Concepts.DAS.Id, List<Module.Channel>>
Keyed by DAS ID, maps to list ofModule.Channels. Used to retrieve channels by DAS. -
DasModuleChannelAccessor : ExceptionalDictionary<Common.DAS.Concepts.DAS.Id, ModuleChannelAccessor>
Keyed by DAS ID, maps to aModuleChannelAccessor. Enables 3-level lookup: DAS ID → module index → channel index. -
ChannelAccessor : ExceptionalDictionary<int, Module.Channel>
Keyed byint(module channel number), maps to aModule.Channel. Used as the innermost accessor. -
ModuleChannelAccessor : ExceptionalDictionary<int, ChannelAccessor>
Keyed byint(module array index), maps to aChannelAccessor. Enables lookup of channels by module number. -
TestInformation : Exceptional(private)
Holds test metadata (Id,Description) per DAS. Used internally during event construction.
Helper Methods (in Event)
-
bool IsDummyChannel(Module.Channel channel)
Returnstrueifchannel.ChannelDescriptionString.ToLower() == "dummy arm channel". -
bool IsTom(DASModule module)
Returnstrueif module is a TOM (based on serial number or channel type). -
void PurgeUnconfiguredChannels()
Removes unconfigured or dummy channels from all modules. -
bool IsEmptyModule(Module module)
Returnstrueif module has no configured/non-dummy channels.
3. Invariants
-
DasModules,DasChannels,DasModuleChannelsare always initialized
These properties are initialized in theProperty<T>declaration with new accessor instances and are markedreadonly/true(immutable reference after construction). -
Module array indices must match list positions
The constructor forEvent(List<IDASCommunication>, EventInfoAggregate)asserts:
Debug.Assert(DasModules[das.SerialNumber].Count - 1 == dasModule.ModuleArrayIndex);
This implies modules are inserted in order, and empty slots are filled with placeholderModuleinstances. -
Test ID must be consistent across all DAS units
During construction, if any DAS reports a differentTestID, an exception is thrown. -
Channel absolute numbers are assigned sequentially
absoluteChannelNumberis incremented per channel added, andModule.Channel.AbsoluteNumberis set duringChannel.CreateChannel. -
InceptionDateis set once at construction
The setter isprivate, and the property is initialized withDateTime.Nowor the serialization date. -
TooLargeFor32BitVisualizationBytesPerSampleThresholdis immutable after construction
MarkedreadonlyandtrueinProperty<T>. -
IsSlice6DBModulecheck is case-insensitive
Comparesmodule.Description.ToLower()to"slice6db module". -
InvalidWindowAverageisshort.MinValue
Used to detect uninitialized or invalid window averages in zeroing logic.
4. Dependencies
Internal Dependencies (within this module)
DTS.Slice.Control.Event.Moduleand nested types (Module.Channel,Module.AnalogInputChannel, etc.)DTS.Common.Utilities.ExceptionalDictionary<TKey, TValue>DTS.Common.Utilities.DotNetProgrammingConstructs.Property<T>DTS.Slice.Control.Event.TestInformation(private helper)
External Dependencies
DTS.Serialization.Test(fromDTS.Serializationnamespace)DTS.DASLib.Service.IDASCommunication,DASModule,DASChannel,EthernetTDASDTS.Common.Utilities.Logging.APILoggerSystem.Collections.Generic.List<T>,System.Guid,System.DateTime,System.Diagnostics.DebugDTS.Serialization.StringResources.Strings(for error messages)
Inferred Usage
EventInfoAggregateis required forEvent(List<IDASCommunication>, EventInfoAggregate)constructor.Test.ReportErrorsdelegate is used inFromDtsSerializationTest.- Serialization infrastructure (
DTS.Serialization) is used for round-trip conversion (ToDtsSerializationTest,FromDtsSerializationTest).
5. Gotchas
-
DasModuleChannelsproperty key is"DTS.Slice.Control.Event.DasModules"(typo)
In theEventconstructor, theProperty<DasModuleChannelAccessor>forDasModuleChannelsis initialized with the key"DTS.Slice.Control.Event.DasModules"instead of"DTS.Slice.Control.Event.DasModuleChannels". This is likely a copy-paste bug. -
DasModuleChannelAccessorusesintkeys for module/channel indices, not typed IDs
BothModuleChannelAccessorandChannelAccessoruseintkeys (for module number and channel number, respectively), not strongly-typed IDs (seexxxcomments in source). This risks confusion or errors if indices are misaligned. -
InceptionDatedefaults toDateTime.Now
If constructed via the default constructor,InceptionDatereflects the current time—not the serialization time. Only theEvent(Test, ...)constructor sets it from theTest.InceptionDate. -
IsSlice6DBModuleis case-sensitive on"slice6db module"
UsesToLower()for comparison, but the literal string is lowercase. If the source description varies in casing (e.g.,"Slice6DB Module"), it may not match. -
Zeroing window validation is complex and fragile
ChannelsWithActiveInvalidZeroingWindowsperforms multiple checks (negative indices, window outside data range). Edge cases (e.g., emptyTriggerSampleNumbers, zero sample rate) are not explicitly handled beyond defaulting to0. -
PurgeUnconfiguredChannelsmodifiesModulesin-place
Called duringToDtsSerializationTest, this permanently removes channels. If theEventobject is reused, data may be lost. -
IsDummyChannelandIsSlice6DBModuleuse string comparisons
Relies on literal string matching ("dummy arm channel","slice6db module"). No constants or enums are defined for these. -
IsG5checks only serial number prefix
Assumes"5M"prefix is sufficient to identify G5 devices. May be brittle if serial number formats change. -
No thread safety
Comments inEvent.csexplicitly note: "Also need to add thread protection." and "Can we set locks in the property accessors..." — no synchronization is present. -
TestInformationis private and not exposed
While used internally, it is not part of the public API. Its properties (Id,Description) are not validated beyond assignment. -
TooLargeFor32BitVisualizationBytesPerSampleThresholdis hardcoded to2.0
The justification in comments is detailed, but the value is not configurable at runtime (only via reflection or subclassing).