Files
DP44/enriched-qwen3-coder-next/DataPRO/DataPRO/Controls/TestSetups/Import/Models.md
2026-04-17 14:55:32 -04:00

16 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
DataPRO/DataPRO/Controls/TestSetups/Import/Models/TestSetupModel.cs
DataPRO/DataPRO/Controls/TestSetups/Import/Models/SummaryChannelModel.cs
DataPRO/DataPRO/Controls/TestSetups/Import/Models/ChannelSummaryRow.cs
DataPRO/DataPRO/Controls/TestSetups/Import/Models/SummaryRow.cs
DataPRO/DataPRO/Controls/TestSetups/Import/Models/DASRow.cs
DataPRO/DataPRO/Controls/TestSetups/Import/Models/DASSummaryRow.cs
DataPRO/DataPRO/Controls/TestSetups/Import/Models/ChannelModel.cs
DataPRO/DataPRO/Controls/TestSetups/Import/Models/DASChannelModel.cs
2026-04-16T04:21:17.003966+00:00 Qwen/Qwen3-Coder-Next-FP8 1 c6d2c56784c09efc

Documentation: Test Setup Import Models

1. Purpose

This module provides data models for representing and manipulating test setup channel configurations during import operations in the DataPRO application. It serves as the data layer for UI components that display, validate, and allow editing of channel assignments between physical DAS hardware channels and logical sensor records. The models bridge the gap between low-level hardware interfaces (IHardwareChannel, IDASCommunication) and high-level UI requirements (e.g., summary tables, validation indicators), supporting operations such as sensor assignment, configuration synchronization, and status reporting (e.g., EID counts, voltage status, channel type summaries).

2. Public Interface

TestSetupModel

  • List<ChannelModel> Channels { get; set; }
    Collection of logical ChannelModel instances representing sensor/channel assignments.
  • ObservableCollection<DASChannelModel> DASChannels { get; set; }
    Collection of DASChannelModel instances representing physical DAS hardware channels.

SummaryChannelModel

  • string ChannelType { get; set; }
    Type of channel (e.g., "Analog", "Squib").
  • int Assigned { get; set; }
    Number of channels of this type that are assigned to sensors.
  • string Unassigned { get; set; }
    String representation of unassigned channel count (likely for display formatting).

ChannelSummaryRow

  • ChannelSummaryRow(string channelType, int requested, int assigned, int unassigned)
    Constructor initializing summary statistics for a channel type.
  • string ChannelType { get; }
    Channel type identifier.
  • int Requested { get; }
    Total requested channels of this type.
  • int Assigned { get; }
    Number of assigned channels.
  • int Unassigned { get; }
    Number of unassigned channels.
  • void AddCount(bool assigned)
    Increments Requested and either Assigned or Unassigned based on assigned.
  • SolidColorBrush UnassignedColor { get; }
    Returns Brush_ApplicationStatus_Failed if any unassigned channels exist, otherwise Brush_ApplicationStatus_Complete.

SummaryRow

  • SummaryRow(int number, string description, string serialNumber, string sensorTag, string eid, string location)
    Constructor for rows in "Extra/Found/Missing" tables in sensor import summary.
  • int Number { get; set; }
    Channel number (not index), if available.
  • string Description { get; set; }
    Channel description.
  • string SerialNumber { get; set; }
    Sensor serial number.
  • string SensorTag { get; set; }
    Sensor tag (e.g., "CF", "P4").
  • string EID { get; set; }
    Electronic ID on the sensor.
  • string Location { get; set; }
    Physical location of the sensor.

DASRow

  • DASRow(IDASCommunication das)
    Constructor that initializes DAS hardware metadata and counts valid EIDs from configuration.
  • string SerialNumberFamily { get; }
    Serial number of the DAS hardware.
  • int EIDFound { get; }
    Count of valid EIDs found in DAS configuration (only for non-Ethernet distributors).
  • string InputVoltageStatus { get; }
    Voltage status string for input voltage.
  • SolidColorBrush InputVoltageColor { get; }
    Color brush corresponding to input voltage status.
  • string BatteryVoltageStatus { get; }
    Voltage status string for battery voltage.
  • SolidColorBrush BatteryVoltageColor { get; }
    Color brush corresponding to battery voltage status.

DASSummaryRow

  • void AddDAS(DataModel.DASHardware das)
    Adds a DAS hardware instance to the summary and updates channel type counts.
  • HardwareTypes[] GetRelevantDAS()
    Returns array of hardware types present (non-empty).
  • int GetHardwareTypeOrder(HardwareTypes a)
    Returns display order integer for a given HardwareTypes enum value (custom ordering defined in _hardwareDisplayOrder).
  • int GetDASCount(HardwareTypes dasType)
    Returns count of DAS units of specified type.
  • void Clear()
    Resets all internal state (DAS list and channel counts).
  • Properties (all int):
    Analog, Squib, DigitalIn, DigitalOut, StreamOut, UART, StreamIn, CAN
    Represent counts of each channel type across all added DAS units.

ChannelModel

  • ChannelModel()
    Default constructor initializing default values.
  • ChannelModel(SensorData sd)
    Constructor initializing from SensorData.
  • void InitializeFromGroupChannel(IGroupChannel groupChannel)
    Updates properties from a group channel (e.g., user overrides).
  • SensorData Sensor { get; set; }
    Underlying sensor data record.
  • IHardwareChannel HardwareChannel { get; set; }
    Associated hardware channel.
  • bool IsModified { get; set; }
    Flag indicating whether the record has been modified.
  • bool IsEmptyRecord { get; }
    Returns true if ChannelCode == "None" and SensorSerialNumber is null/empty.
  • bool IsChannelCodeValid { get; set; }
    Indicates whether ChannelCode is non-empty and not "None".
  • bool RemoveOffset { get; set; }
    Whether offset removal is enabled.
  • bool ProportionalToExcitation { get; set; }
    Whether sensor output is proportional to excitation.
  • double InitialOffsetVoltage { get; set; }
    Initial offset voltage.
  • double InitialOffsetVoltageTolerance { get; set; }
    Tolerance for initial offset voltage.
  • string SensorEU { get; set; }
    Engineering units of the sensor.
  • double BridgeResistance { get; set; }
    Bridge resistance.
  • string ChannelRangeString { get; set; }
    String representation of ChannelRange (formatted with SYSTEMSETTING format).
  • string ISOCode { get; set; }
    ISO standard code.
  • string ISODescription { get; set; }
    ISO channel description.
  • string ISOPolarity { get; set; }
    ISO polarity ("+" or "-").
  • bool IsSquib { get; set; }
    Whether channel is a squib.
  • bool IsDigitalInput { get; set; }
    Whether channel is digital input.
  • bool IsDigitalOutput { get; set; }
    Whether channel is digital output.
  • double InitialEUInMV { get; set; }
    Initial EU in millivolts.
  • double InitialEUInEU { get; set; }
    Initial EU in engineering units.
  • double IRTraccExponent { get; set; }
    IR Tracc linearization exponent.
  • string DASChannelString { get; }
    String representation of HardwareChannel.
  • string ChannelCode { get; set; }
    User-defined channel code.
  • string CustomCodeDescription { get; set; }
    Custom code description.
  • string SensorSerialNumber { get; set; }
    Sensor serial number.
  • string ChannelEID { get; set; }
    EID on the channel.
  • string SensorEID { get; }
    EID from Sensor.EID or backing field.
  • double SensorSensitivity { get; set; }
    Sensor sensitivity.
  • double SensorCapacity { get; set; }
    Sensor capacity.
  • bool SensorPolarity { get; set; }
    Sensor polarity (true = positive).
  • double ChannelRange { get; set; }
    Channel range.
  • IFilterClass FilterClass { get; set; }
    Software filter class.
  • bool IsRangeValid { get; set; }
    Whether ChannelRange is valid (>0 and not NaN).
  • double CableMultiplier { get; set; }
    Cable multiplier factor.
  • bool Disabled { get; set; }
    Whether channel is disabled.
  • double SensorExcitationVolts { get; }
    Excitation voltage magnitude from Sensor.SupportedExcitation.
  • SquibFireMode SquibFireMode { get; set; }
    Squib fire mode (CAP or CONSTANT).
  • double SquibFireDelayMs { get; set; }
    Delay between trigger and squib fire.
  • double SquibFireCurrent { get; set; }
    Squib fire current limit (amps).
  • bool LimitDuration { get; set; }
    Whether squib fire duration is limited.
  • double SquibFireDurationMs { get; set; }
    Squib fire duration (clamped to DEFAULT_MIN_FIRE_DURATION_MS/DEFAULT_MAX_FIRE_DURATION_MS).
  • double SquibFireResistanceLowOhm { get; set; }
    Squib resistance tolerance low (ohms).
  • double SquibFireResistanceHighOhm { get; set; }
    Squib resistance tolerance high (ohms).
  • DigitalInputModes DigitalInputMode { get; set; }
    Digital input mode.
  • DigitalOutputModes DigitalOutputMode { get; set; }
    Digital output mode.
  • double DigitalOutputDelay { get; set; }
    Digital output delay (ms).
  • double DigitalOutputDuration { get; set; }
    Digital output duration (ms).

DASChannelModel

  • DASChannelModel(IHardwareChannel channel)
    Constructor wrapping a hardware channel.
  • void SetChannelModel(ChannelModel channel)
    Assigns/removes a ChannelModel to/from this hardware channel, updating bidirectional references and raising property change notifications.
  • DigitalOutputModes DigitalOutputMode { get; set; }
    Gets/sets digital output mode; raises DigitalOutputChannelChanged event on mode transitions.
  • double DigitalOutputDelayMs { get; set; }
    Digital output delay (ms).
  • double DigitalOutputDurationMs { get; set; }
    Digital output duration (ms).
  • string Polarity { get; set; }
    Sensor polarity ("+" or "-").
  • SquibFireMode SquibFireMode { get; set; }
    Squib fire mode.
  • bool Disabled { get; set; }
    Whether channel is disabled (via DependencyProperty).
  • ChannelModel Channel { get; private set; }
    Associated ChannelModel (sensor record).
  • string DASChannelString { get; }
    String representation of HardwareChannel.
  • string CustomCode { get; set; }
    Custom code description.
  • string EID { get; set; }
    Electronic ID on the channel.
  • string UserChannelName { get; set; }
    Channel code (user name).
  • string ISOCode { get; set; }
    ISO code.
  • string ISOChannelName { get; set; }
    ISO channel name.
  • string SerialNumber { get; }
    Sensor serial number (with special handling for test-specific serials).
  • double Sensitivity { get; }
    Sensor sensitivity.
  • string SensitivityString { get; }
    Sensitivity formatted to 12 decimal places.
  • bool IsActive { get; }
    true if channel has a record and is not a disabled digital output.
  • double Capacity { get; }
    Sensor capacity.
  • double Range { get; set; }
    Channel range.
  • IFilterClass FilterClass { get; set; }
    Filter class.
  • double CableMultiplier { get; set; }
    Cable multiplier.
  • double SquibFireDelayMs { get; set; }
    Squib fire delay.
  • double SquibFireCurrent { get; set; }
    Squib fire current limit.
  • bool LimitDuration { get; set; }
    Whether squib duration is limited.
  • double SquibFireDurationMs { get; set; }
    Squib fire duration.
  • double SquibFireResistanceLowOhm { get; set; }
    Squib resistance low tolerance.
  • double SquibFireResistanceHighOhm { get; set; }
    Squib resistance high tolerance.
  • IHardwareChannel HardwareChannel { get; }
    Wrapped hardware channel.

3. Invariants

  • ChannelModel.ChannelCode must not be "None" for a record to be considered non-empty (IsEmptyRecord == false).
  • ChannelModel.SquibFireDurationMs is always clamped to [DEFAULT_MIN_FIRE_DURATION_MS, DEFAULT_MAX_FIRE_FIRE_DURATION_MS] (enforced in setter).
  • ChannelSummaryRow.UnassignedColor is determined solely by Unassigned > 0.
  • DASSummaryRow._hardwareDisplayOrder defines explicit ordering for known hardware types; unknown types fall back to _hardwareDisplayOrder.Count + (int)HardwareTypes.
  • DASRow.EIDFound counts only valid EIDs from non-Ethernet-distributor DAS units (excludes IsEthernetDistributor() units).
  • DASChannelModel.Channel and ChannelModel.HardwareChannel are kept in sync: assigning a ChannelModel to a DASChannelModel sets Channel.HardwareChannel = HardwareChannel, and vice versa.
  • DASChannelModel.IsActive for digital outputs is false only if DigitalOutputMode == DigitalOutputModes.NONE.
  • DASChannelModel.SerialNumber returns a localized string for TEST_SPECIFIC_ANALOG_SERIAL; otherwise returns Channel.SensorSerialNumber.

4. Dependencies

Dependencies of this module:

  • DTS.Common.*
    Core infrastructure: BasePropertyChanged, HardwareTypes, DigitalInputModes, DigitalOutputModes, SquibFireMode, IFilterClass, IHardwareChannel, IGroupChannel, ExcitationVoltageOptions, SensorConstants, Logging.APILogger, SharedResource.Strings.StringResources, DAS.Concepts.Test.Module.Channel.Sensor, DASLib.Service.OutputSquibChannel, Enums.Hardware.HardwareConstants.
  • DTS.SensorDB
    SensorData type.
  • DTS.Common.Interface.Channels
    ChannelModel uses DASChannelModel and IGroupChannel.
  • DTS.Common.Interface.DASFactory
    IDASCommunication.
  • DTS.DASLib.Service
    OutputSquibChannel, HardwareConstants.
  • System.Windows.Media
    SolidColorBrush, BrushesAndColors (via ChannelSummaryRow.UnassignedColor).
  • System.Collections.ObjectModel
    ObservableCollection<T>.

Dependencies on this module:

  • UI Controls (inferred from namespace DataPROWin7.Controls.TestSetups.Import.Models)
    Likely consumed by XAML views and view models for test setup import workflows (e.g., channel assignment grids, summary tables).
  • Import Logic
    Code in DataPROWin7.Controls.TestSetups.Import.* (e.g., view models, services) that populates and manipulates these models during import.

5. Gotchas

  • ChannelModel.SquibFireDurationMs setter silently clamps values to min/max constants (DEFAULT_MIN_FIRE_DURATION_MS, DEFAULT_MAX_FIRE_DURATION_MS). No exception or warning is raised for out-of-range assignments.
  • DASRow.EIDFound excludes Ethernet distributors (das.IsEthernetDistributor()), but does not exclude SLICE Ethernet controllers (which are counted in DASSummaryRow.AddChannelCountForDAS only if not IsSLICEEthernetController).
  • DASSummaryRow.AddChannelCountForDAS skips SLICE Ethernet controllers entirely (if (das.IsSLICEEthernetController) { return; }), meaning no channel counts are accumulated for them.
  • DASChannelModel.Polarity and ChannelModel.SensorPolarity use inverse semantics: SensorPolarity = true means positive polarity (no inversion), while Polarity string is "+" for positive.
  • DASChannelModel.SerialNumber has special handling for TEST_SPECIFIC_ANALOG_SERIAL, returning a localized string via StringResources; other values are returned as-is.
  • ChannelModel.ChannelRangeString setter parses and updates ChannelRange, but also sets IsRangeValid = true on success — this may overwrite prior validation state.
  • DASSummaryRow.GetHardwareTypeOrder for unknown hardware types uses _hardwareDisplayOrder.Count + (int)HardwareTypes, which may cause ordering instability if new hardware types are added without updating _hardwareDisplayOrder.
  • ChannelModel.InitializeFromGroupChannel logs exceptions via APILogger.Log(ex) but does not propagate them, potentially masking configuration errors.
  • DASChannelModel.SetChannelModel raises many OnPropertyChanged notifications (e.g., for IsActive, SerialNumber, SquibFireDelayMs) — callers should be aware of