Files
DP44/enriched-qwen3-coder-next/Common/DTS.Common/Interface/TestSetups/Imports/TTS/ReadFile.md
2026-04-17 14:55:32 -04:00

14 KiB
Raw Blame History

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
Common/DTS.Common/Interface/TestSetups/Imports/TTS/ReadFile/IReadFileView.cs
Common/DTS.Common/Interface/TestSetups/Imports/TTS/ReadFile/IReadFileViewModel.cs
Common/DTS.Common/Interface/TestSetups/Imports/TTS/ReadFile/ITTSSetup.cs
Common/DTS.Common/Interface/TestSetups/Imports/TTS/ReadFile/ITTSChannelRecord.cs
2026-04-16T03:13:56.877656+00:00 Qwen/Qwen3-Coder-Next-FP8 1 ac5173b821639ae8

ReadFile

Documentation: TTS Import File Reading Module


1. Purpose

This module defines the interfaces and contracts required to support importing and processing TTS (Time-To-Sample) format test setup files—specifically CSV-based configurations used in data acquisition test setups. It enables decoupled reading of file metadata (e.g., channel definitions, trigger settings, sensor properties) into structured domain objects (ITTSSetup, ITTSChannelRecord) while supporting view-model/view patterns for UI integration. The module does not contain implementation logic for parsing files; rather, it provides the abstraction layer for consumers (e.g., import handlers, UI views) to interact with imported test setup data in a consistent, testable manner.


2. Public Interface

IReadFileView

  • Namespace: DTS.Common.Interface
  • Inherits: IBaseView
  • Description: Marker interface for the view layer in the TTS import flow. No additional members beyond base view contract.

IReadFileViewModel

  • Namespace: DTS.Common.Interface

  • Inherits: IBaseViewModel

  • Members:

    • IReadFileView View { get; set; }
      Binds the view instance to the view model.
    • void SetStatus(string status)
      Updates the UI status with a single status message.
    • void SetStatus(string status, string error)
      Updates the UI status with both a status message and an error string (e.g., for warnings or failures).
    • void SetProgress(double progress)
      Reports progress (0.01.0) during file reading.
    • string FileToImport { get; set; }
      Gets or sets the path of the file currently being processed.
    • void ReadFile(string fileName, double defaultSampleRate, RecordingModes defaultMode, double defaultTTSPreTrigger, double defaultTTSPostTrigger, double defaultTTSROIStart, double defaultTTSROIEnd, bool defaultRequireEIDFound, string defaultDigitalInputMode, ISquibSettingDefaults squibDefaults)
      Initiates reading and parsing of the specified file (fileName) using provided default configuration values. Populates an ITTSSetup instance (implementation detail, not exposed here).
  • Delegate:

    • ReadFileDelegate(string importFile)
      A delegate type used to invoke file reading asynchronously or via event subscription. Signature matches ReadFiles primary parameter.

ITTSSetup

  • Namespace: DTS.Common.Interface.TestSetups.Imports.TTS.ReadFile
  • Properties:
    • string Filename { get; set; }
      Path of the imported file.
    • string TestId { get; set; }
      Identifier for the test setup.
    • string Line1 through Line4 { get; set; }
      First four lines of the CSV file (used for preserving header context in "Edit File" workflows).
    • string[] DummyList { get; set; }
      Placeholder for unused or legacy data (purpose unclear from interface alone).
    • double SampleRate { get; set; }
      Sampling rate (Hz) for the test.
    • RecordingModes Mode { get; set; }
      Recording mode (e.g., Standard, Circular, etc.).
    • double TestLength { get; }
      Duration (seconds) of the test (read-only).
    • double PreTrigger { get; set; }
      Pre-trigger buffer duration (seconds).
    • double PostTrigger { get; set; }
      Post-trigger buffer duration (seconds).
    • double ROIStart { get; set; }
      Start time (seconds) of Region of Interest.
    • double ROIEnd { get; set; }
      End time (seconds) of Region of Interest.
    • ITTSChannelRecord[] Channels { get; set; }
      Array of channel records (sensors, digital I/O, squibs).
    • ILevelTrigger[] LevelTriggers { get; set; }
      Array of level trigger configurations.
    • string OriginalImportFile { get; set; }
      Original file path before any modifications.
    • bool AllowAdvancedRecordingModes { get; set; }
      Global flag allowing hybrid/circular buffer + recorder modes.
    • bool AllowActiveRecordingModes { get; set; }
      Global flag allowing Active RAM and Active RAM Multiple Events modes.
    • bool AllowTSRAIRRecordingModes { get; set; }
      Global flag allowing TSR-AIR modes (purpose unclear from interface alone).
    • bool RequireEIDFound { get; set; }
      If true, sensors without a valid EID are excluded.
    • string DefaultDigitalInputMode { get; set; }
      Default digital input mode (e.g., from DataPRO.config.exe).
    • double DefaultSquibFireDurationMs { get; set; }
      Default squib fire duration (ms) from configuration.
    • string GetHashCode()
      Returns a hash code string for the setup (likely for change detection).
    • Tuple<string, string>[] PreAssignedSensorIdAndHwId { get; set; }
      Pre-assigned sensor-to-hardware mappings (used during XML import before hardware scan completes).

ITTSChannelRecord

  • Namespace: DTS.Common.Interface.TestSetups.Imports.TTS.ReadFile
  • Properties:
    • int ChannelNumber { get; set; }
      Logical channel index.
    • string ChannelCode { get; set; }
      Channel identifier (e.g., "ACC1").
    • string JCodeOrDescription { get; set; }
      J-code or human-readable description.
    • double ChannelRange { get; set; }
      Measurement range (e.g., ±5V).
    • int ChannelFilterHz { get; set; }
      Anti-aliasing filter cutoff (Hz).
    • string SensorEID { get; set; }
      Sensor Electronic ID (unique identifier).
    • string SensorSerialNumber { get; set; }
      Sensor serial number.
    • double SensorSensitivity { get; set; }
      Sensor sensitivity (e.g., mV/unit).
    • double SensorExcitationVolts { get; set; }
      Excitation voltage (V) for the sensor.
    • double SensorCapacity { get; set; }
      Sensor capacitance (pF).
    • string SensorEU { get; set; }
      Sensor engineering units (e.g., "g", "psi").
    • bool SensorPolarity { get; set; }
      Sensor polarity (true = positive).
    • ToyotaBridgeType ChannelType { get; set; }
      Bridge type (e.g., Full, Half, Quarter).
    • string Description { get; set; }
      Channel description.
    • bool ProportionalToExcitation { get; set; }
      Whether sensor output scales with excitation voltage.
    • double BridgeResistance { get; set; }
      Bridge resistance (Ω).
    • double InitialOffsetVoltage { get; set; }
      Initial offset voltage (V).
    • double InitialOffsetVoltageTolerance { get; set; }
      Tolerance for offset voltage (V).
    • bool RemoveOffset { get; set; }
      Whether to subtract offset during processing.
    • ToyotaZeroMethods ZeroMethod { get; set; }
      Zeroing method (e.g., Manual, Auto).
    • double CableMultiplier { get; set; }
      Cable length compensation factor.
    • double InitialEUInMV { get; set; }
      Initial value in engineering units (converted to mV).
    • double InitialEUInEU { get; set; }
      Initial value in engineering units.
    • double IRTraccExponent { get; set; }
      IR Tracc exponent for temperature compensation.
    • double PolynomialConstant { get; set; }
      Polynomial calibration constant term.
    • double PolynomialCoefficientC { get; set; }
      Polynomial coefficient C (quadratic term).
    • double PolynomialCoefficentB { get; set; }
      Polynomial coefficient B (linear term).
    • double PolynomialCoefficientA { get; set; }
      Polynomial coefficient A (quadratic term).
    • double PolynomialCoefficientAlpha { get; set; }
      Polynomial coefficient α (exponential term).
    • string ISOCode { get; set; }
      ISO standard code for the channel.
    • string ISODescription { get; set; }
      ISO description.
    • string ISOPolarity { get; set; }
      ISO polarity specification.
    • bool IsSquib { get; set; }
      Indicates if channel is a squib (pyrotechnic device).
    • bool IsDigitalInput { get; set; }
      Indicates if channel is a digital input.
    • bool IsDigitalOutput { get; set; }
      Indicates if channel is a digital output.
    • bool IsEmptyRecord { get; }
      true if ChannelCode and SensorSerialNumber are both empty.
    • IHardwareChannel HardwareChannel { get; set; }
      Reference to the hardware channel assigned to this record.
    • bool IsChannelCodeValid { get; set; }
      Whether ChannelCode passes validation.
    • bool IsJCodeValid { get; set; }
      Whether JCodeOrDescription passes validation.
    • bool IsRangeValid { get; set; }
      Whether ChannelRange is valid.
    • bool IsFilterValid { get; set; }
      Whether ChannelFilterHz is valid.
    • bool Disabled { get; set; }
      If true, channel is excluded during test execution.
    • SquibFireMode SquibFireMode { get; set; }
      Fire mode for squib channels (e.g., Normal, Test).
    • double SquibFireDelayMs { get; set; }
      Delay (ms) between trigger and squib fire.
    • bool LimitDuration { get; set; }
      Whether to limit squib fire duration.
    • double SquibFireDurationMs { get; set; }
      Duration (ms) of squib fire (if limited).
    • double SquibFireCurrent { get; set; }
      Current limit (amps) for squib fire.
    • double SquibFireResistanceLowOhm { get; set; }
      Lower bound of squib resistance tolerance (Ω).
    • double SquibFireResistanceHighOhm { get; set; }
      Upper bound of squib resistance tolerance (Ω).
    • DigitalInputModes DigitalInputMode { get; set; }
      Digital input mode (e.g., Edge, Level).
    • DigitalOutputModes DigitalOutputMode { get; set; }
      Digital output mode (e.g., Pulse, Latch).
    • double DigitalOutputDelay { get; set; }
      Delay (ms) between trigger and digital output.
    • double DigitalOutputDuration { get; set; }
      Duration (ms) of digital output pulse.
    • IEditFileViewModel Parent { get; set; }
      Reference to parent view model (for UI binding).
    • ITTSChannelRecord Copy()
      Deep copy of the channel record.
    • Visibility RangeVisible { get; }
      UI visibility state for range input (e.g., Visible, Collapsed).
    • Visibility FilterVisible { get; }
      UI visibility state for filter input.
    • bool OriginallyRequestedChannel { get; set; }
      Whether the channel was explicitly requested (vs. auto-generated).
    • bool DiagnosticsMode { get; set; }
      Enables diagnostics mode (if supported by hardware/firmware).
    • bool IsModified { get; set; }
      Whether the record has been modified since import.
    • byte[] GetBytes()
      Returns a byte array representation for hashing/CRC (used for integrity checks).

3. Invariants

  • ITTSChannelRecord.IsEmptyRecord: Must be true if and only if both ChannelCode and SensorSerialNumber are null or empty strings.
  • ITTSChannelRecord.IsSquib, IsDigitalInput, IsDigitalOutput: These flags are mutually exclusive—only one may be true per record.
  • ITTSSetup.TestLength: Read-only; value is derived from other properties (e.g., PreTrigger, PostTrigger, ROIStart, ROIEnd) and must be consistent with them.
  • IReadFileViewModel.ReadFile: Must not throw exceptions during file parsing; errors should be reported via SetStatus(string, string).
  • ITTSSetup.PreAssignedSensorIdAndHwId: Only populated during XML import; cleared once hardware assignment is finalized.
  • AllowAdvancedRecordingModes, AllowActiveRecordingModes, AllowTSRAIRRecordingModes: Global flags that constrain which RecordingModes are permitted in ITTSSetup.Mode.

4. Dependencies

Dependencies of this module:

  • DTS.Common.Base: Provides IBaseView, IBaseViewModel, IBaseClass base interfaces.
  • DTS.Common.Enums: Supplies RecordingModes, ToyotaBridgeType, ToyotaZeroMethods, SquibFireMode, DigitalInputModes, DigitalOutputModes.
  • DTS.Common.Interface.Sensors: Likely contains ISquibSettingDefaults (used in ReadFile signature).
  • DTS.Common.Interface.DataRecorders: Supplies IHardwareChannel (used in ITTSChannelRecord.HardwareChannel).
  • DTS.Common.Interface.TestSetups.Imports.TTS.LevelTrigger: Supplies ILevelTrigger (used in ITTSSetup.LevelTriggers).

Dependencies on this module:

  • UI Layer: IReadFileView and IReadFileViewModel imply binding to WPF views (via Visibility, IEditFileViewModel).
  • Import Handlers: Concrete implementations of IReadFileViewModel (e.g., ReadFileViewModel) will depend on this interface to parse files.
  • Test Setup Logic: ITTSSetup and ITTSChannelRecord are used by downstream components (e.g., test execution, validation, export).

5. Gotchas

  • GetHashCode() in ITTSSetup: This method is declared explicitly in the interface but not inherited from object. This is unusual—likely a legacy workaround for hashing. Consumers should verify whether it returns a string representation of a hash (e.g., "ABC123") or a standard hash code.
  • DummyList: Purpose and usage are undocumented; may be obsolete or reserved for future use. Avoid relying on its contents.
  • IEditFileViewModel.Parent: The Parent property in ITTSChannelRecord creates a circular reference. Ensure implementations handle this carefully to avoid memory leaks or serialization issues.
  • IsModified: No mechanism is defined to reset this flag; consumers must manage state manually (e.g., after saving).
  • PreAssignedSensorIdAndHwId: Only used for XML imports. If non-XML import paths are used, this list should remain empty.
  • ReadFileDelegate: Signature matches only the fileName parameter of ReadFile. It does not include the default configuration parameters—this may cause confusion if used for async invocation.
  • IsChannelCodeValid, IsJCodeValid, etc.: These are settable properties, not computed read-only properties. Validation logic must be implemented externally (e.g., in view model or service layer).
  • No explicit error handling interface: Errors during ReadFile are communicated via SetStatus(string, string), but there is no structured exception or error code mechanism. Consumers must parse status strings for error details.

None identified beyond the above.