Files

233 lines
17 KiB
Markdown
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- Common/DTS.Common/Interface/DASFactory/IAutoArmed.cs
- Common/DTS.Common/Interface/DASFactory/ITMATSStreamingDevice.cs
- Common/DTS.Common/Interface/DASFactory/ITiltSensorCalAware.cs
- Common/DTS.Common/Interface/DASFactory/IRangeBandwidthLimited.cs
- Common/DTS.Common/Interface/DASFactory/IAutoArmStatus.cs
- Common/DTS.Common/Interface/DASFactory/ITimeSynchronization.cs
- Common/DTS.Common/Interface/DASFactory/IConnectedEthernetDevice.cs
- Common/DTS.Common/Interface/DASFactory/IDASReconfigure.cs
- Common/DTS.Common/Interface/DASFactory/IDASConfigurationArg.cs
- Common/DTS.Common/Interface/DASFactory/IRealtime.cs
- Common/DTS.Common/Interface/DASFactory/IUDPQATSEntry.cs
- Common/DTS.Common/Interface/DASFactory/IDASFactory.cs
- Common/DTS.Common/Interface/DASFactory/ICommunication.cs
- Common/DTS.Common/Interface/DASFactory/IDiscoveredDevice.cs
- Common/DTS.Common/Interface/DASFactory/IAnalogInputDASChannel.cs
- Common/DTS.Common/Interface/DASFactory/IDASCommunication.cs
generated_at: "2026-04-16T03:03:27.191298+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "00da82090d5b9e0b"
---
# DASFactory
## Documentation: DASFactory Interface Module
### 1. Purpose
This module defines a set of interfaces that collectively describe the contract for interacting with Data Acquisition Systems (DAS) in the DASFactory subsystem. It serves as the primary abstraction layer between the application logic and hardware-specific implementations, enabling uniform access to device capabilities such as configuration, diagnostics, real-time streaming, arming, time synchronization, and discovery. The interfaces are intentionally granular to support composition (via interface inheritance, e.g., `IDASCommunication` implements multiple sub-interfaces) and to decouple concerns like communication transport, device metadata, channel configuration, and feature support flags. This design allows the system to handle heterogeneous hardware (e.g., SLICE6, TDAS, g5, SPS) through a unified API surface while preserving hardware-specific behavior via optional interface implementations.
### 2. Public Interface
#### Core Interfaces
- **`IAutoArmed`**
- `bool AutoArmed { get; set; }`
Gets or sets whether the device is in auto-armed mode (i.e., automatically arms upon meeting arming conditions).
- **`ITMATSStreamingDevice`**
- `int GetMaxFileLengthTMATS()`
Returns the maximum file length (in samples or bytes, context-dependent) for TMATS-compliant streaming output.
- **`ITiltSensorCalAware`**
- `double[] TiltSensorCals { get; }`
Gets an array of calibration coefficients for tilt sensors (e.g., channel offsets/gains).
- **`IRangeBandwidthLimited`**
- `bool RangeBandwidthLimited { get; }`
Indicates whether the devices measurement range is constrained by bandwidth limitations (e.g., anti-aliasing filters).
- **`IAutoArmStatus`**
- `DFConstantsAndEnums.CommandStatus AutoArmStatus { get; set; }`
Gets or sets the current status of the auto-arm process (e.g., `Ready`, `InProgress`, `Failed`).
- **`ITimeSynchronization`**
- `bool SupportsTimeSynchronization { get; }`
Indicates whether the device supports time synchronization (e.g., via PTP or GPS).
- `DateTime SystemBaseTime { get; }`
Gets the devices base system time (typically the reference timestamp for sample timestamps).
- **`IConnectedEthernetDevice`**
- `string MACAddress { get; }`
Gets the MAC address of the device.
- `int Port { get; }`
Gets the port number on the parent device (e.g., SLICE6DB) to which this device is connected.
- `string SerialNumber { get; set; }`
Gets or sets the devices serial number.
- **`IDASReconfigure`**
- `int GetMaxModuleCount()`
Returns the maximum number of modules supported by the DAS base unit.
- `void SetMaxModuleCount(int count)`
Sets the maximum module count (used during reconfiguration).
- **`IDASConfigurationArg`**
- `IDASCommunication DAS { get; }`
Reference to the DAS unit being configured.
- `bool BlankConfigurationRead { get; }`
Indicates whether the configuration was read from a blank/empty XML file (e.g., during emergency download).
- `bool ConfigurationFailedValidation { get; }`
Indicates whether the configuration failed validation (e.g., missing required fields).
- **`IRealTime`**
- `List<int> RealtimeDASChannels { get; set; }`
Gets or sets the list of channel indices to stream in real-time.
- `List<double> TiltAxisData { get; set; }`
Gets or sets the current tilt sensor readings (X, Y, Z) in degrees.
- `string UDPStreamAddress { get; }`
Gets the UDP stream address (IP:port) for real-time data.
- **`IUDPQATSEntry`**
- Comprehensive read-only interface for UDP QATS (Quick Analysis and Test System) status entries. Key properties include:
- Device identity: `SerialNumber`, `ResponseHostMac`, `ResponseClientMacAddress`.
- Arm state: `ArmState`, `ArmMode`, `Started`, `Triggered`, `FaultFlags`, `LegacyFaultFlags`.
- Acquisition metrics: `SampleRate`, `TotalSamples`, `CurrentSample`, `EventNumber`, `FaultSampleNumber`, `EventTriggerSample`.
- Power/health: `InputVoltage`, `BackupVoltage`, `BatterySOC`, `SysTempC`.
- Sync status: `SyncClockEnable`, `ADCExtClockSyncEnable`, `SyncClockStatus`, `ADCExtClockSyncStatus`.
- Sensor data: `TiltSensorCh1`, `TiltSensorCh2`, `TiltSensorCh3`, `ChannelOffsetMV`, `ShuntDeviationPercent`.
- Metadata: `Timestamp`, `EstimateMaxSamples`.
#### Discovery & Management Interfaces
- **`IDASFactory`**
- `void StartMulticastAutoDiscovery()` / `void StopMulticastAutoDiscovery()`
Start/stop device discovery via multicast.
- `IDiscoveredDevice[] GetDiscoveredDevices()`
Returns all devices discovered via multicast.
- `bool PingAll()`
Sends a ping to all connected devices to verify liveness.
- `List<IDASCommunication> GetDASList()` / `List<IDASCommunication> GetSortedDASList()`
Returns the list of all connected DAS units (sorted by position or not).
- `List<ICommunication> GetDevList()`
Returns all connected communication endpoints (not limited to DAS).
- `void DetachAllDevices(bool detachUSB = false)`
Removes all devices from the factorys internal state.
- `void Refresh(ActionCompleteDelegate action)`
Re-scans hardware and updates `GetDASList()` asynchronously.
- `SortableBindingList<IDiscoveredDevice> AutoDiscoverMulticast(CancellationToken cancelToken, bool discoverParents = true)`
Performs multicast-based discovery and returns a sorted list of discovered devices.
- Properties: `Language`, `AllowSDBCommandPort`, `S6ConnectNewTimeout`, `SliceDBHostNames`, `TDASHostNames`, `TDASSerialPortNames`, `TDASSerialRackSerialNumber`, `MultiCastAutoDiscoveryDefaultTimeoutMS`.
#### Communication Interface
- **`ICommunication`**
- `bool ErrorInSetup { get; set; }`
Indicates if an error occurred during device setup.
- `IConnection Transport { get; set; }`
Gets/sets the underlying transport (e.g., TCP, UDP, serial).
- `void SetupReader()`
Initializes the receive buffer and callback for incoming data.
- `string SerialNumber`, `FirmwareVersion`, `ProtocolVersion { get; set; }`
Device metadata.
- `ICommunication_DASInfo DASInfo { get; set; }`
Device-specific info (type not defined in source; inferred as a nested interface).
- `Dictionary<DFConstantsAndEnums.ProtocolLimitedCommands, byte> MinimumProtocols { get; set; }`
Maps protocol commands to minimum required protocol versions.
- `void InitMinProto()` / `bool IsCommandSupported(...)` / `byte GetMinProto(...)`
Protocol version management.
- `event EventHandler OnDisconnected`
Fired when the device disconnects.
- `string ConnectString { get; }` / `bool Connected { get; }`
Connection state and identifier.
- `void Connect(...)`, `void Disconnect(...)`, `void Close(int Timeout)`, `void Flush(int Timeout)`
Connection lifecycle methods.
- `void Execute(...)`, `void PseudoExecute(...)`, `byte[] SyncExecute(...)`
Command execution (async, pseudo-async, and synchronous).
- `void Cancel()`, `void ForceCancel()`, `bool IsCanceled()`, `void ClearCancel()`
Command cancellation.
- `ManualResetEvent CancelEvent { get; }`
Event signaled when cancellation occurs.
#### Discovery Metadata Interface
- **`IDiscoveredDevice`**
- `string Serial { get; set; }`, `string Mac { get; set; }`
Device identifiers.
- `MultiCastDeviceClasses DevClass { get; set; }`
Device classification (e.g., `SLICE6`, `TDAS`).
- `IDiscoveredDevice Parent { get; set; }`
Parent device (e.g., SLICE6DB for a module).
- `bool IsParent(IDiscoveredDevice possibleChild)` / `int GetPort(...)` / `int GetSlot(...)` / `int GetSlotOnPort(...)`
Topology traversal methods.
- `bool IsModule { get; set; }`
Indicates if the device is a module (not a base unit).
- `int Port`, `int PositionOnDistributor`, `int PositionOnChain`
Physical placement metadata for UI/channel mapping.
- Network config: `Dhcp`, `Ip`, `Subnet`, `Gateway`, `Dns`.
- Connection state: `Connected`, `ConnectedIp`, `ConnectedHost`.
- User metadata: `SystemId`, `Location`.
- Firmware: `FirmwareVersion`, `BuildId`.
- `IConnectedEthernetDevice[] Connections { get; set; }`
List of Ethernet connections (e.g., for SLICE6DB modules).
#### Channel Configuration Interface
- **`IAnalogInputDASChannel`**
- Sensor configuration: `TypeOfBridge`, `SupportedBridges`, `CouplingMode`, `BridgeResistanceOhms`, `SensitivityMilliVoltsPerEU`, `IsProportionalToExcitation`, `IsInverted`.
- Range/units: `SensorCapacityEU`, `DesiredRangeWithHeadroomEU`, `EngineeringUnits`, `Unipolar`.
- Excitation: `Excitation`, `SupportedExcitation`, `IsSupported(...)`.
- Channel identity: `ChannelId`, `ChannelGroupName`, `HardwareChannelName`, `OriginalChannelName`, `ChannelName2`.
- Digital input: `DigitalMode`, `SupportedDigitalInputModes`, `DigitalInputChannel`, `DIUnits`.
- Calibration: `ZeroPoint`, `ZeroMethod`, `ZeroAverageStartSeconds`, `ZeroAverageStopSeconds`, `InitialEU`, `InitialOffset`, `LastCalibrationDate`, `CalDueDate`.
- Diagnostics: `ShuntTargetADC`, `ShuntIsEnabled`, `ZeromVInADC`, `VoltageInsertionCheckEnabled`, `RemoveOffset`, `VerifyOffset`, `OffsetToleranceLowMilliVolts`, `OffsetToleranceHighMilliVolts`.
- Filtering: `SoftwareFilterFrequency`, `SoftwareFilterClass`, `BypassAAFilter`.
- Scaling: `ScalefactorMilliVoltsPerADC`, `ScalefactorEngineeringUnitsPerADC`, `NoiseAsPercentOfFullScale`, `UnsupersampledSampleRate`.
- Triggering: `TriggerBelowThresholdEu`, `TriggerAboveThresholdEu`, `AlreadyLevelTriggered`, `MeasuredEULevelTriggerCheck`.
- Metadata: `SensorID`, `SerialNumber`, `Manufacturer`, `Model`, `Description`, `ISOCode`, `UpdateChannelFromDatabase`.
- Diagnostics: `IDiagnosticResult Diagnostics { get; }`, `IDiagnosticResult DiagnosticInformation { get; }`.
- Excitation: `double? MeasuredExcitationVolts { get; }`, `double? FactoryExcitationVolts { get; }`.
- XML serialization: `WriteXml(...)`, `WriteElementEnd(...)`, `GetSupportedExcitationSerialized()`, `WriteXmlCRC32(...)`.
- Utility: `bool IsConfigured()`.
#### Primary DAS Interface
- **`IDASCommunication`**
- **Inherits all interfaces**: `IConfiguration`, `IDiagnos`, `ITriggerCheck`, `IRealTime`, `IArmStatus`, `IDownload`, `IInformation`, `IAutoArmStatus`, `IAutoArmed`, `IRangeBandwidthLimited`, `ITimeSynchronization`.
- Hardware metadata: `ExcitationStatus`, `FirstUseDate`, `IsFirstUseDateSupported`, `IsStreamingSupported`, `MACAddress`, `DownstreamMACAddresses`, `SerialNumber`, `FirmwareVersion`.
- State flags: `DiagnosticsHasBeenRun`, `ConfigureHasBeenRun`.
- Channel counts: `NumberOfConfiguredChannels()`, `NumberOfChannels()`.
- Capacity: `MaxMemory()`, `MaxModules`, `MinSampleRate()`, `MaxSampleRate(int)`, `MaxAAFilterRate()`.
- Feature support flags: `SupportsAutoArm()`, `SupportsMultipleConfigurations()`, `SupportsLevelTrigger()`, `SupportsRealtime()`, `SupportsMultipleEvents()`, `SupportsTriggerInversion()`, `SupportsStartInversion()`, `SupportsHardwareInputCheck()`, `SupportsMultipleSampleRealtime()`, `ControlsDAQ()`, `CheckAAF(float)`, `RequireDiagnosticRateMatchSampleRate()`, `GetPhaseShiftSamples(...)`, `IsEthernetDistributor()`, `IsSlice6Distributor()`, `IsBattery()`, `IsTSRAIR()`, `IsSlice6Air()`, `IsSlice6AirTc()`, `IsScheduleEventCountSupported()`, `SupportsIndividualChannelRealtimeStreaming`.
- Trigger/start inversion: `InvertTrigger`, `InvertStart`, `IgnoreShortedStart`, `IgnoreShortedTrigger`.
- Voltage monitoring: `InputLowVoltage`, `InputMediumVoltage`, `InputHighVoltage`, `BatteryLowVoltage`, `BatteryMediumVoltage`, `BatteryHighVoltage`, `MinimumValidInputVoltage`, `MaximumValidInputVoltage`, `MinimumValidBatteryVoltage`, `MaximumValidBatteryVoltage`.
- Utility: `ConnectionCheck()`, `GetHardwareType()`, `GetStackChannelConfigTypes()`, `RecordId`, `GetNominalRanges(...)`, `ReadFirstUseDate()`.
### 3. Invariants
- **`IDASCommunication`** must implement all sub-interfaces listed in its declaration (e.g., `IAutoArmed`, `ITimeSynchronization`, `IRealTime`).
- **`ICommunication.Transport`** must be non-null after `Connect()` succeeds and before `Disconnect()` completes.
- **`ICommunication.Connected`** must be `true` only when the underlying transport is actively connected.
- **`IDiscoveredDevice.DevClass`** must be consistent with `IDiscoveredDevice.IsModule` (e.g., modules have `DevClass` values like `SLICE6_MODULE`, bases like `SLICE6DB`).
- **`IAnalogInputDASChannel.IsConfigured()`** must return `true` if and only if `SerialNumber` is non-null/non-empty (per the comment).
- **`IUDPQATSEntry.Timestamp`** must represent the time the UDP packet was received by the host (not the devices internal timestamp).
- **`IDASFactory.GetDASList()`** must reflect the current state of connected hardware only after `Refresh()` completes.
- **`IAutoArmStatus.AutoArmStatus`** must be set to `DFConstantsAndEnums.CommandStatus.Unknown` if auto-arm is unsupported or uninitialized.
### 4. Dependencies
- **External Dependencies**:
- `DTS.Common.Enums.*` (e.g., `DFConstantsAndEnums`, `CommunicationConstantsAndEnums`, `HardwareTypes`, `SensorConstants`, `DigitalInputModes`, `ExcitationVoltageOptions`, `ZeroMethodType`).
- `DTS.Common.Interface.*` (e.g., `ICommunication_DASInfo`, `IConnection`, `IDiagnosticResult`, `IFilterClass`, `ActionCompleteDelegate`).
- `System.Collections.Generic`, `System.Threading`, `System.Xml`, `System` (for `DateTime`, `ManualResetEvent`).
- **Depended Upon By**:
- Services in `DASFactory` (e.g., `ConfigurationService`, `DiagnosticsService`, `DownloadService`) use `IDASCommunication` as the primary input.
- Discovery logic in `IDASFactory` relies on `IDiscoveredDevice` to build device topologies.
- Real-time streaming clients consume `IRealTime` and `IUDPQATSEntry` for live data.
- UI components use `IAnalogInputDASChannel` for channel configuration and `IDiscoveredDevice` for device topology visualization.
### 5. Gotchas
- **`IDASReconfigure`** is explicitly suppressed for PascalCase naming (`S101`) due to "DAS" being an acronym; this is a known code-smell exception.
- **`ICommunication.CancelEvent`** is a `ManualResetEvent`—consumers must dispose it properly if the `ICommunication` instance is long-lived.
- **`IUDPQATSEntry.TiltSensorCh1/2/3`** are `short` (raw ADC counts), not calibrated values; calibration requires `ITiltSensorCalAware.TiltSensorCals`.
- **`IAnalogInputDASChannel.SoftwareFilterClass`** is marked as a temporary fix (FB 13120) and may be refactored; avoid relying on its current implementation.
- **`IDASCommunication.IsFirstUseDateSupported`** requires hardware support and prior calibration; `FirstUseDate` is `null` if unsupported or unset.
- **`IDiscoveredDevice.PositionOnChain`** and `PositionOnDistributor` are used exclusively for SLICE6 devices on a SLICE6DB; other topologies may leave these unset.
- **`ICommunication.SyncExecute`** blocks the calling thread; avoid in UI threads.
- **`IDASFactory.Refresh()`** is asynchronous (via `ActionCompleteDelegate`); callers must wait for completion before using `GetDASList()`.
- **`IAnalogInputDASChannel.UpdateChannelFromDatabase`** is a flag to prevent overwriting group-channel configurations during configuration; misuse may cause stale data.
- **`IDASCommunication.SupportsHardwareInputCheck()`** requires protocol version ≥7 for SLICE Base firmware; older devices will return `false`.
- **`IUDPQATSEntry.ShuntDeviationPercent`** and `ChannelOffsetMV` are arrays—size is not specified in the interface (likely fixed per hardware type).