12 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-16T03:34:15.620410+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 9ad8e7542b559d55 |
Diagnostics
Documentation Page: Diagnostics Class (DataPROWin7.DataModel.Classes.Diagnostics)
1. Purpose
The Diagnostics class orchestrates the initialization and configuration of Data Acquisition System (DAS) hardware and associated channels for diagnostic testing. It handles the transition from test setup definition to a state where DAS units are ready for real-time data collection or diagnostics execution. Specifically, it queries DAS configurations, validates hardware/sensor compatibility, synchronizes test setup metadata (e.g., XML export to DAS and local storage), and prepares channel-level configurations (analog, CAN, squib, TOM digital) for diagnostics. It serves as the central coordinator between the high-level test template and low-level DAS communication interfaces.
2. Public Interface
public class LevelTriggerCapableChannel
Encapsulates level-triggering configuration for a single hardware channel, enabling conversion to/from ISO-level LevelTriggerChannel objects.
-
public LevelTriggerCapableChannel(HardwareChannel hwch, SensorData sd, SensorCalibration sc, IGroup group, IGroupChannel groupChannel)
Constructor. Initializes the channel with hardware, sensor, calibration, and group context. Stores calibration onsd. -
public HardwareChannel HardwareChannel { get; }
Immutable reference to the underlying hardware channel. -
public string DASOrModuleSerialNumber { get; }
Returns the DAS serial number for most hardware types, but returns the module serial number forTDAS_Pro_RackandTDAS_LabRack. -
public double LessThanValue { get; private set; }
Threshold value for "less than" triggering (EU). -
public double GreaterThanValue { get; private set; }
Threshold value for "greater than" triggering (EU). -
public bool IsLessThanThresholdEnabled { get; set; }
Enables/disables the "less than" threshold. Updates_testSetupLevelTriggerif present. -
public bool IsGreatherThanThresholdEnabled { get; set; }
Enables/disables the "greater than" threshold. Updates_testSetupLevelTriggerif present. -
public double InsideUpperBoundValue,InsideLowerBoundValue,OutsideUpperBoundValue,OutsideLowerBoundValue { get; private set; }
Bound values for window-based triggering. -
public DTS.Common.ISO.LevelTriggerChannel ToISOLevelTriggerChannel()
Constructs and returns an ISOLevelTriggerChannelobject, applying special handling for TSRAIRGo high-G sensors (e.g., disabling thresholds by default). -
public void FromISOLevelTriggerChannel(DTS.Common.ISO.LevelTriggerChannel channel)
Populates internal state from an ISOLevelTriggerChannel. Sets_testSetupLevelTriggerreference.
public class Diagnostics
-
public bool Reset(TestTemplate currentTest, List<IDASCommunication> dasList, Dictionary<string, int> dasSampleRateList, DASHardware[] hardware, StatusHelpers.SetProgressValueDelegate setProgressFunction, User currentUser)
Performs initial reset steps: marks all DAS as unclean, attempts partial configuration query (with timeout), and returnsfalseif no data has ever been downloaded (DataNeverDownloaded(dasList)). Does not perform full diagnostics. -
public void ContinueReset(TestTemplate currentTest, List<IDASCommunication> dasList, Dictionary<string, int> dasSampleRateList, DASHardware[] hardware, StatusHelpers.SetProgressValueDelegate setProgressFunction, User currentUser)
Continues reset: callsUpdateConfigAndPrepareForDiagnostics, thenRunDiagnostics. (Note:RunDiagnosticsis not defined in this file—its implementation is external.)
public static bool SortOutConfigAnalog(...)
public static bool SortOutConfigAnalog(AnalogInputDASChannel dasChannel, string key, int moduleChannelNumber, IDASCommunication das, DASHardware h, IDASModule mod, SortOutConfigParams soParams, ReportErrorsDelegate ReportErrors = null)
Configures anAnalogInputDASChannelusing test setup metadata (sensor, calibration, group channel). Handles:- Excitation, coupling, filter bypass, zero point, sensitivity, linearization, IEPE mode, trigger thresholds (via
LevelTriggerCapableChannel), and more. - Special logic for TSRAIR low-G (AC coupling), non-linear calibrations, and IEPE channels.
- Reports errors via
ReportErrorsif IEPE state mismatch cannot be reprogrammed. - Returns
falseif no valid calibration found.
- Excitation, coupling, filter bypass, zero point, sensitivity, linearization, IEPE mode, trigger thresholds (via
public static void SortOutConfigCAN(...)
public static void SortOutConfigCAN(IDASChannel c, int moduleChannelNumber, SortOutConfigParams soParams)
Configures aCANInputDASChannelwith CAN-specific parameters (FD, bitrate, SJW, file type) from the first channel insoParams.TestTemplate.ChannelsForGroup.
public static void SortOutConfigSquib(...)
public static void SortOutConfigSquib(ref int currentChannelIdx, IDASModule mod, string key, ref int moduleChannelNumber, IDASChannel c, IDASCommunication das, SortOutConfigParams soParams)
Configures a squib pair (voltage and current channels) from test setup. Handles fire delay/duration, tolerance, output current, filter bypass, and channel naming (.1/.2suffix handling). Requires both VO and CU channels.
public static void SortOutConfigTOMDigitalChannel(...)
public static void SortOutConfigTOMDigitalChannel(IDASChannel c, string key, int moduleChannelNumber, SortOutConfigParams soParams)
Configures anOutputTOMDigitalChannelwith delay, duration, limit duration, and output mode from test setup.
public static void SortOutConfig(...)
public static void SortOutConfig(TestTemplate currentTest, List<IDASCommunication> ldas, bool clearDiagnostics, DASHardware[] allHardware, User currentUser)
Top-level configuration entry point. Orchestrates channel ordering, DAS-specific configuration (SortOutConfigDAS), and sets DAS order indices for TMATS support.
public static void SortOutConfigDAS(...)
public static void SortOutConfigDAS(IDASCommunication das, User currentUser, SortOutConfigParams soParams, ReportErrorsDelegate reportErrors = null)
AppliesSortOutConfig*methods to each channel in a DAS’s module configuration. Handles clock, UART, stream in/out, and normal modes. Sets module-level properties (AA filter rate, pre/post-trigger, recording mode, sample rate, etc.). Disables channels not in the test.
3. Invariants
-
LevelTriggerCapableChannel:IsLessThanThresholdEnabledandIsGreatherThanThresholdEnableddefault totrueandfalse, respectively.- For TSRAIRGo high-G sensors (
SensorConstants.IsTSRAirHighGChannel), thresholds are disabled by default inToISOLevelTriggerChannel, andTriggerOutsideBoundsis forcedtrueif the sensor is high-G. _testSetupLevelTriggeris only updated when set viaFromISOLevelTriggerChannel.
-
Diagnostics:Resetmust be called beforeContinueReset;ContinueResetassumes partial configuration (viaReset) has occurred.SortOutConfigAnalogrequires a validSensorCalibration(sc) matching the sensor’s supported excitation; otherwise, it returnsfalse.- Squib configuration (
SortOutConfigSquib) requires both voltage and current output channels to exist in the DAS module (throwsNotSupportedExceptionotherwise). - IEPE status mismatch between sensor and DAS channel is only auto-corrected if
CanReProgram()returnstrue; otherwise, errors are reported and the channel may be left in an invalid state.
4. Dependencies
Imports / Dependencies Used
DataPROWin7.Common,DTS.Common.*(core data model, enums, utilities, logging, hardware interfaces)DTS.DASLib.Service.ConfigurationService(forGetConfiguration,StoreTestSetupXML)DTS.Slice.Users.UserSettings,DTS.Common.Constant.DASSpecific,DTS.Common.DAS.Concepts.*DTS.Common.Interface.*(e.g.,IDASCommunication,IDASModule,IGroup,IGroupChannel)DTS.Slice.Users.User,DTS.Common.Interface.Sensors.AnalogDiagnosticsDTS.Slice.Users.UserSettings,DTS.Common.SharedResource.StringsDataPROWin7.DataModel.Classes.Hardware,DTS.Common.Classes.*,DTS.Slice.*
Key External Components
ConfigurationService: Used for querying DAS configuration and storing test setup XML.SensorConstants,SensorCalibration,MeasurementUnitList,SerializedSettings,APILogger,Defaults,ExportTestSetup.DASHardware,HardwareChannel,AnalogInputDASChannel,CANInputDASChannel,OutputSquibChannel,OutputTOMDigitalChannel,IDASCommunication.
Depended Upon By
- Likely called by higher-level test orchestration (e.g.,
TestTemplate.RunDiagnostics,TestSetupBuilder). LevelTriggerCapableChannelis used internally inSortOutConfigAnalogto map test-level level triggers to DAS channel properties.
5. Gotchas
-
Timeout Handling:
QueryConfigurationPartialuses a hardcoded 150-second timeout for TSRAIRGo (TSRAIRGO_QUERYCONFIG_TIMEOUT = 150000 ms); other systems useSerializedSettings.ResolveChannels_SLICE_QueryConfigTimeoutSec * 1000. Timeout exceptions are logged and rethrown. -
IEPE Mismatch: If
dasChannel.IEPEChanneldiffers fromsensor.Bridge == IEPE, andCanReProgram()isfalse, errors are reported viaReportErrors, but the method does not returnfalse—execution continues, potentially leaving the channel misconfigured. -
Non-Linear Calibration Logic: The
bUseNonLinearflag logic is complex:- Uses non-linear calibration if
!sc.NonLinear || !sc.LinearAdded || CalibrationBehaviors.LinearIfAvailable != TestTemplate.CalibrationBehavior. - Zero point and sensitivity calculations differ for linear vs. non-linear calibrations.
- Special handling for
IRTraccCalculationType.IRTraccCalFactorandPolynomial.
- Uses non-linear calibration if
-
Squib Channel Naming: Squib current channel description suffix
.1is replaced with.2, andChannelName2is updated accordingly. -
TSRAIRGo High-G Sensors: Thresholds are disabled by default in
ToISOLevelTriggerChannel, andTriggerOutsideBoundsis forcedtrueif the sensor is high-G—even ifchannel.TriggerOutsideBoundsisfalse. -
ResetReturnsfalseonDataNeverDownloaded: This check is not defined in the source file—behavior is inferred from usage. Its implementation is unknown. -
SortOutConfigAnalogDoes Not Short-Circuit on Failure: If calibration lookup fails, it logs and returnsfalse, but the caller (SortOutConfigDAS) continues to the next channel (per comment: "for instance if we fail to sort out this channel because of support excitation you still want to go onto the next channel"). -
SortOutConfigDASDisables Channels Not in Test: If a DAS is not insoParams, all its channels are disabled viaDisableChannel(c). TheDisableChannelmethod is not defined in this file. -
ExportCurrentTestSetupFieldsClears Groups: A temporaryTestTemplateis created withGroups.Clear()before exporting DAS/Fields-only XML—this may affect downstream logic ifcurrentTestis reused. -
LevelTriggerCapableChannelConstructor Parameter Order: The constructor order is(HardwareChannel, SensorData, SensorCalibration, IGroup, IGroupChannel).IGroupis unused in the constructor body (per source), but included—could be legacy or for future use. -
DiagnosticsModeHandling: For analog channels,DiagnosticsModeis taken directly fromsensor.DiagnosticsMode. For squib/TOM digital, it is hardcoded tofalse. -
SortOutConfigParamsIncomplete Source: The class definition is truncated mid-method (SetHard...). Full behavior ofSetHard*methods is unknown. -
RunDiagnosticsNot Defined:ContinueResetcallsRunDiagnostics, but its implementation is not in this file—behavior is undefined here.
End of Documentation.