17 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||
|---|---|---|---|---|---|---|---|
|
2026-04-16T04:01:25.793483+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 14ca5b532e4bb3a2 |
Configure
Documentation: ConfigureStatusParameters and ConfigureStatusInformation Module
1. Purpose
This module provides the state and control logic for the configuration phase of the DAS (Data Acquisition System) lifecycle, specifically handling channel assignment resolution, hardware configuration application, and power/excitation state transitions. It enables asynchronous configuration of multiple DAS units with rich metadata about channel conflicts, missing sensors, and hardware incompatibilities, while supporting both production and diagnostic workflows. The module decouples configuration intent (expressed via ConfigureStatusParameters) from runtime state and progress tracking (managed by ConfigureStatusInformation), allowing integration with UI, testing, or headless environments via delegates.
2. Public Interface
ConfigureStatusParameters
-
public bool RequireIdFoundForSensorsWithIds { get; set; } = true;
Iftrue, sensors with a non-empty EID must be found on the configured hardware; otherwise, configuration may proceed without them. -
public bool AllowMissingSensors { get; set; } = false;
Iftrue, allows channels to be assigned without a corresponding sensor (e.g., for dummy testing). -
public bool AllowSensorsOutOfPosition { get; set; } = true;
Iftrue, permits sensors to be assigned to channels other than their specified physical position. -
public ITestSetup TestSetupConfiguration { get; set; }
Reference to the test setup configuration used during channel resolution. -
public delegate ISensorData GetSensorDelegate(IGroupChannel groupChannel);
Delegate to retrieve sensor metadata (ISensorData) for a given group channel. -
public GetSensorDelegate GetSensorAction { get; set; }
Implementation ofGetSensorDelegate; required for sensor lookup during channel resolution. -
public delegate ISensorCalibration GetSensorCalibrationDelegate(ISensorData sensor, ExcitationVoltageOptions.ExcitationVoltageOption excitation);
Delegate to retrieve calibration data for a sensor under a specific excitation. -
public GetSensorCalibrationDelegate GetCalibrationAction { get; set; }
Implementation ofGetSensorCalibrationDelegate; used to apply calibration to hardware channels. -
public delegate int GetDatabaseIdDelegate(IDASCommunication das);
Delegate to map a DAS unit to its database ID. -
public GetDatabaseIdDelegate GetDatabaseIdAction { get; set; }
Implementation ofGetDatabaseIdDelegate; used to correlate hardware units with database records. -
public delegate void SetSensorCalibrationDelegate(ISensorData sd, ISensorCalibration sc);
Delegate to persist calibration data back to the sensor. -
public SetSensorCalibrationDelegate SetSensorCalibrationAction { get; set; }
Implementation ofSetSensorCalibrationDelegate. -
public bool AllowSensorIdToBlankChannel { get; set; }
Iftrue, allows assignment of a sensor with an EID to a channel that has no EID (blank channel). -
public bool TurnOffExcitation { get; set; } = false;
Flag indicating that excitation should be turned off before applying configuration. Reverted upon starting the turn-off process. -
public IDASCommunication[] UnitsToConfigure { get; set; } = new IDASCommunication[0];
Array of DAS units to be configured. -
public bool DoStrictCheck { get; set; } = true;
Iftrue, perform strict validation of configuration (e.g., hardware compatibility, EID match). -
public bool EventConfig { get; set; } = true;
Iftrue, write configuration to the event file store (legacy SLICE feature); otherwise, use the diagnostic store. -
public bool DummyConfig { get; set; } = false;
Iftrue, perform configuration for dummy (non-data-collecting) mode. -
public double[] MaxAAF { get; set; } = new double[0];
Array of maximum Anti-Alias Filter (AAF) rates per unit (used for SLICE/TDAS). -
public bool ConfigureDigitalOutputs { get; set; } = true;
Iftrue, configure digital outputs; set tofalseto skip (e.g., for trigger checks). -
public ErrorCallback ErrorRequiringActionAction { get; set; }
Callback invoked when user interaction is required (e.g., AAF errors). -
public bool TurnOffAAFRealtime { get; set; } = true;
Iftrue, disable AAF for real-time acquisition to reduce latency. -
public bool ResetHardwareEventLines { get; set; } = false;
Iftrue, reset hardware event lines before applying configuration. -
public bool PrepareForDiagnostics { get; set; } = false;
Iftrue, prepare units for diagnostics (e.g., turn on excitation, switches) after configuration. -
public IReadOnlyDictionary<string, double> SampleRateLookup { get; set; } = new Dictionary<string, double>();
Lookup table mapping unit serial numbers to data collection sample rates. -
public IReadOnlyDictionary<string, float> AAFRateLookup { get; set; } = new Dictionary<string, float>();
Lookup table mapping unit serial numbers to AAF rates. -
public bool SkipTurnOnPower { get; set; } = false;
Iftrue, skip powering up units after configuration (e.g., to keep units in low-power state). -
public bool SetConfiguration { get; set; } = true;
Iftrue, actually write configuration to hardware; iffalse, only prepare for diagnostics. -
public DSPFilterType DSPFilterType { get; set; }
DSP filter type to apply during configuration. -
public bool DiscardDiagnostics { get; set; } = true;
Iftrue, discard existing diagnostic data before applying new configuration. -
public ConfigureStatusParameters()
Constructor; initializesDSPFilterTypeviaResetDSPFilterType(). -
public void Reset()
Resets all properties to their default values. -
public override string ToString()
Returns a human-readable string representation of all configuration parameters.
ConfigureStatusInformation
-
public enum StatusValues { ... }
Enum of possible status notifications (e.g.,ApplyingConfiguration,Completed,ChannelOutOfPosition,EIDNotFound,LowPowerSuccess, etc.). -
public bool NoChannelsAssigned { get; internal set; } = true;
trueif no channels have been assigned yet. -
public bool AllChannelsResolved { get; internal set; } = false;
trueif all channels requiring resolution have been successfully resolved. -
public bool ChannelsOutOfPosition { get; internal set; } = false;
trueif one or more sensors are assigned to channels other than their specified position. -
public bool HaveAppliedConfigAllUnits { get; set; } = false;
trueif all units inUnitsToConfigurewere successfully configured. -
public ManualResetEvent CancelEvent { get; }
Signaled to request cancellation of ongoing tasks. -
public ManualResetEvent DoneEvent { get; }
Signaled when all work (configuration, power, diagnostics) is complete. -
public ActionCompleteDelegate CompleteAction { get; set; }
Callback invoked on completion of the configuration process. -
public SetProgressValueDelegate ProgressAction { get; set; }
Callback invoked with progress updates (0–100). -
public StatusIntDelegate StatusAction { get; set; }
Callback invoked withStatusValuesenum values. -
public StatusExIntDelegate StatusExAction { get; set; }
Callback invoked with extended status (e.g., per-unit success/failure). -
public IDASCommunication[] UnitsConfigured { get; set; } = new IDASCommunication[0];
List of units successfully configured. -
public async Task Cancel()
Initiates cancellation: setsCancelEvent, waits for completion, and reportsCancelling/Cancelledstatus. -
public void TurnOffExcitation()
Asynchronously turns off excitation on all units, updates globalExcitationOnstatus, and signalsLowPowerSuccess/LowPowerFailure. -
public void ApplyConfig()
Starts asynchronous configuration process:- If
TurnOffExcitationis set, invokesTurnOffExcitation()first. - Otherwise, applies configuration via
ConfigurationService.SetConfiguration(...). - If
PrepareForDiagnosticsis set andSkipTurnOnPowerisfalse, callsPrepareForDiagnostics().
- If
-
public void ManuallyResolveChannel(IGroupChannel channel, IDASChannel hardwareChannel)
Manually assigns a hardware channel to a group channel. Validates:- Channel is not blank/disabled.
- Sensor exists and is compatible.
- Hardware channel is not already assigned.
- EID constraints (if sensor has EID, and
AllowSensorIdToBlankChannelisfalse, EID must match).
ThrowsInvalidAssignmentExceptionon failure.
-
public void ManuallyUnresolveChannel(IGroupChannel channel)
Removes manual assignment of a channel. Fails if channel is not resolved or if assignment was EID-locked.
ThrowsInvalidAssignmentException. -
public class InvalidAssignmentException : Exception
Exception thrown on manual assignment errors.Reasonsenum:BlankChannel,NoSensor,ChannelDisabled,SensorNotFound,IncompatibleHardware,ChannelAlreadyAssigned,EID_Locked,EIDRequiredAndMissing,ChannelNotAssigned.- Contains
GroupChannelandReason.
-
public void Reset()
Resets all status flags, clears channel resolution lists, and nullifies delegates.
GroupChannelWithMeta (internal helper)
-
public bool ChannelConflict { get; set; }
trueif this channel conflicts with another assignment. -
public IGroupChannel ConflictingChannel { get; set; }
Reference to the conflicting channel (if any). -
public IGroupChannel Channel { get; set; }
The group channel being described. -
public IGroup Group { get; set; }
The group containing the channel. -
public bool MissingID { get; set; }
trueif sensor EID is missing (but expected). -
public bool MissingSensor { get; set; }
trueif no sensor is associated with the channel. -
public bool EIDOutOfPlace { get; set; }
trueif the sensor’s EID is present but assigned to a different channel than expected. -
public bool HWNotFound { get; set; }
trueif the hardware channel could not be found. -
public bool HWChannelIncompatible { get; set; }
trueif the hardware channel is incompatible with the sensor. -
public IDASChannel DASChannel { get; set; }
The resolved hardware channel (if any). -
public bool AssignedByEID { get; set; }
trueif this channel was auto-resolved via EID matching.
3. Invariants
-
Channel Resolution State:
A channel is either in_resolvedChannelsor_unresolvedChannels, never both.
IsResolved(ch)andIsUnresolved(ch)are mutually exclusive. -
Hardware Channel Uniqueness:
A hardware channel (IDASChannel) may be assigned to only one group channel at a time. Enforced inAddResolvedChannelandManuallyResolveChannel. -
EID Locking:
If a channel is resolved via EID (AssignedByEID == true), it cannot be manually reassigned to a different hardware channel (EID_Lockedexception). -
Sensor Compatibility:
IsSensorHwCompatibleenforces strict compatibility rules:- Bridge mode must match.
- Digital input mode must match (if applicable).
- Supported excitation must exist and have calibration data.
- Squib/Digital Output sensors must match their respective hardware types.
-
Configuration Atomicity:
ApplyConfigonly proceeds toPrepareForDiagnosticsif no cancellation occurred (!CancelEvent.WaitOne(...)). -
Excitation State Consistency:
GlobalExcitationOnstatus is updated only after successfulTurnOffExcitationorPrepareForDiagnostics.TurnOffExcitation→ setsExcitationOn = falseon success.PrepareForDiagnostics→ setsExcitationOn = trueon success.
4. Dependencies
Imports / Dependencies Used
-
DTS.Common.Interface.*:Channels(IGroupChannel,IDASChannel,AnalogInputDASChannel, etc.)DASFactory(IDASCommunication,IDASFactory)Sensors(ISensorData,ISensorCalibration)StatusAndProgressBar(IStatusInfo,IStatusParameters, delegates)Groups.GroupList(IGroup)TestSetups.TestSetupsList(ITestSetup)
-
DTS.Common.Classes.DSP:DSPFilterCollection,DSPFilterType -
DTS.Common.Enums:ExcitationVoltageOptions -
DTS.DASLib.Service.StateMachine.StatusAndParameters.Configure:GroupChannelWithMeta -
DTS.DASLib.Service.StateMachine:States.Instance.ConfigureStart.Status.*,ConfigurationService,DiagnosticsService,ArmingService -
System.Threading.Tasks:Task,Task.Run -
System.Collections.Generic,System.Linq,System.Text,System.Threading,System
Consumers / Usage
-
ConfigureStatusParametersis used by:ConfigurationService.SetConfiguration(...)(to receive configuration intent)- UI or test harness to configure behavior before invoking
ApplyConfig()
-
ConfigureStatusInformationis used by:ConfigurationService.SetConfiguration(...)(to report progress/status)DiagnosticsService.PrepareForDiagnostics(...)ArmingService.EnterLowPowerMode(...)- UI to monitor and control configuration state (via delegates)
-
GroupChannelWithMetais used internally byConfigureStatusInformationto track channel resolution state.
5. Gotchas
-
AllChannelsResolvedLogic Inversion:
AllChannelsResolvedis set totruewhen_unresolvedChannels.Any()isfalse(i.e., no unresolved channels), but the property name suggests it should betruewhen all are resolved. This is counterintuitive and could cause bugs if misread. -
TurnOffExcitationFlag Reset Timing:
param.TurnOffExcitationis reset tofalseinsideTurnOffExcitation()before the task completes. IfApplyConfig()is called again beforeTurnOffExcitation()finishes, it may skip re-initiating turn-off. -
UnitsToConfigureMutability DuringApplyConfig:
InApplyConfig(), if a unit inUnitsToConfigureis not found indasFactory.GetDASList(), it is removed from the local list (unitsToConfigure) but not from the originalparam.UnitsToConfigure. This can causeHaveAppliedConfigAllUnitsto befalseeven though no error was reported for that unit. -
PrepareForDiagnosticsSpin-Wait:
PrepareForDiagnostics()uses a fixed spin-wait loop (PREPARE_SPIN_TIME = 200,EXPECTED_PREPARE_TIME = 8000) instead of relying solely onManualResetEvent. Progress is updated manually, but this is inefficient and not cancellation-aware. -
InvalidAssignmentExceptionMessage Format:
The exception message includes theReasonenum and the channel’sToString()representation. IfIGroupChannel.ToString()is not informative, debugging may be difficult. -
AllowSensorIdToBlankChannelDefault:
Default isfalse, meaning sensors with EIDs cannot be assigned to blank channels unless explicitly allowed. This may be unexpected in test scenarios. -
ResetDSPFilterType()Uses Empty String:
ResetDSPFilterType()callsGetFilter(string.Empty). If the filter collection does not define a default for empty string, this may return an unexpected or null filter. -
Thread Safety of
UnitsConfigured:
AddConfiguredDevice()useslock(MyLock)to safely append toUnitsConfigured, butUnitsConfiguredis exposed as a public property. External code could modify the array directly, bypassing the lock. -
PrepareForDiagnosticsFails ifUnitsConfiguredis Empty:
PrepareForDiagnostics()checks!status.UnitsConfigured.Any()and fails early. However,UnitsConfiguredis only populated duringApplyConfig(). IfPrepareForDiagnosticsis called independently (e.g., in diagnostics-only flow), it will always fail. -
No Handling of
GetCalibrationActionReturningnull:
InAddResolvedChannel, ifGetCalibrationActionreturnsnullfor all supported excitations, no calibration is applied, but no error is raised. This may silently leave hardware uncalibrated. -
EIDOutOfPlaceFlag Misleading:
EIDOutOfPlaceis set only inAddResolvedChannel, but never set totrueinAddUnresolvedChannel. It is unclear how out-of-position channels are tracked if they are unresolved.