Files
DP44/docs/ai/DataPRO/DataPRO/Controls/TestSetups/Import/Classes.md
2026-04-17 14:55:32 -04:00

12 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
DataPRO/DataPRO/Controls/TestSetups/Import/Classes/UserISOUtility.cs
DataPRO/DataPRO/Controls/TestSetups/Import/Classes/DigitalInputPopulateChannels.cs
DataPRO/DataPRO/Controls/TestSetups/Import/Classes/SquibPopulateChannels.cs
DataPRO/DataPRO/Controls/TestSetups/Import/Classes/AnalogPopulateChannels.cs
DataPRO/DataPRO/Controls/TestSetups/Import/Classes/DASPopulateChannels.cs
DataPRO/DataPRO/Controls/TestSetups/Import/Classes/DigitalOutputPopulateChannels.cs
DataPRO/DataPRO/Controls/TestSetups/Import/Classes/SensorsPopulateChannels.cs
DataPRO/DataPRO/Controls/TestSetups/Import/Classes/SummaryRowHelper.cs
DataPRO/DataPRO/Controls/TestSetups/Import/Classes/GroupChannelHelper.cs
2026-04-17T15:49:39.114457+00:00 zai-org/GLM-5-FP8 1 e9e7933e368dfce9

Documentation: DataPRO Import Channel Population Module

1. Purpose

This module handles the population and synchronization of channel data during test setup imports in DataPRO. It provides classes for different channel types (Analog, Digital Input/Output, Squib) that implement common interfaces (ISensorsPopulateChannels, IDASPopulateChannels) to populate channel models from hardware configurations and sensor data. The module also includes utility classes for ISO/User code visibility, summary row generation for import results, and group channel management within test templates.


2. Public Interface

UserCodeISOUtility (static class)

Method Signature Description
ShowUserCode public static bool ShowUserCode() Returns true if IsoViewMode.ISOAndUserCode or IsoViewMode.UserCodeOnly is set in Common.SerializedSettings.ISOViewMode.
ShowISOCode public static bool ShowISOCode() Returns true if IsoViewMode.ISOAndUserCode or IsoViewMode.ISOOnly is set in Common.SerializedSettings.ISOViewMode.

DigitalInputPopulateChannels

Member Signature Description
HardwareChannelIdToSensorId public Dictionary<string, string> { get; set; } Mapping of hardware channel IDs to sensor IDs.
TestSetup public TestTemplate { get; set; } The test template being populated.
Sensors public IEnumerable<SensorData> { get; set; } Collection of sensor data.
PopulateDASChannels public IEnumerable<DASChannelModel> PopulateDASChannels(TestTemplate testTemplate, IEnumerable<SensorData> sensors, List<IDASHardware> hardware, ref Dictionary<string, DASChannelModel> channelIdToDASChannel) Populates DAS channels filtered by IHardwareChannel.IsDigitalIn, delegating to DASPopulateChannels.
PopulateSensorsChannels public IEnumerable<ChannelModel> PopulateSensorsChannels(TestTemplate testTemplate, IEnumerable<DASHardware> hardware, IEnumerable<SensorData> sensors, ref Dictionary<string, DASChannelModel> channelIdToDASChannel) Populates sensor channels filtered by SensorData.IsDigitalInput(), delegating to SensorsPopulateChannels.

SquibPopulateChannels

Member Signature Description
HardwareChannelIdToSensorId public Dictionary<string, string> { get; set; } Mapping of hardware channel IDs to sensor IDs.
TestSetup public TestTemplate { get; set; } The test template being populated.
Sensors public IEnumerable<SensorData> { get; set; } Collection of sensor data.
PopulateDASChannels public IEnumerable<DASChannelModel> PopulateDASChannels(TestTemplate testTemplate, IEnumerable<SensorData> sensors, List<IDASHardware> hardware, ref Dictionary<string, DASChannelModel> channelIdToDASChannel) Populates DAS channels filtered by IHardwareChannel.IsSquib, delegating to DASPopulateChannels.
PopulateSensorsChannels public IEnumerable<ChannelModel> PopulateSensorsChannels(TestTemplate testTemplate, IEnumerable<DASHardware> hardware, IEnumerable<SensorData> sensors, ref Dictionary<string, DASChannelModel> channelIdToDASChannel) Populates sensor channels filtered by SensorData.IsSquib(), delegating to SensorsPopulateChannels.

AnalogPopulateChannels

Member Signature Description
HardwareChannelIdToSensorId public Dictionary<string, string> { get; set; } Mapping of hardware channel IDs to sensor IDs.
TestSetup public TestTemplate { get; set; } The test template being populated.
Sensors public IEnumerable<SensorData> { get; set; } Collection of sensor data.
Constructor public AnalogPopulateChannels(Dictionary<string, string> hardwareChannelIdToSensorId) Initializes with the hardware-to-sensor mapping.
PopulateDASChannels public IEnumerable<DASChannelModel> PopulateDASChannels(TestTemplate testTemplate, IEnumerable<SensorData> sensors, List<IDASHardware> hardware, ref Dictionary<string, DASChannelModel> channelIdToDASChannel) Populates DAS channels filtered by IHardwareChannel.IsAnalog, delegating to DASPopulateChannels.
PopulateSensorsChannels public IEnumerable<ChannelModel> PopulateSensorsChannels(TestTemplate testTemplate, IEnumerable<DASHardware> hardware, IEnumerable<SensorData> sensors, ref Dictionary<string, DASChannelModel> channelIdToDASChannel) Populates sensor channels filtered by SensorData.IsAnalog(), delegating to SensorsPopulateChannels.

DASPopulateChannels

Member Signature Description
HardwareChannelIdToSensorId public Dictionary<string, string> { get; set; } Mapping of hardware channel IDs to sensor IDs.
TestSetup public TestTemplate { get; set; } The test template being populated.
Sensors public IEnumerable<SensorData> { get; set; } Collection of sensor data.
Constructor public DASPopulateChannels(Dictionary<string, string> hardwareChannelIdToSensorId, Predicate<IHardwareChannel> hardwareChannelFilter) Initializes with mapping and filter predicate.
PopulateDASChannels public IEnumerable<DASChannelModel> PopulateDASChannels(TestTemplate testTemplate, IEnumerable<SensorData> sensors, List<IDASHardware> hardware, ref Dictionary<string, DASChannelModel> channelIdToDASChannel) Core implementation that iterates hardware, applies filter, skips SLICE Ethernet controllers, skips odd-numbered Squib channels, creates DASChannelModel instances, maps EIDs, and populates the output dictionary.

DigitalOutputPopulateChannels

Member Signature Description
HardwareChannelIdToSensorId public Dictionary<string, string> { get; set; } Mapping of hardware channel IDs to sensor IDs.
TestSetup public TestTemplate { get; set; } The test template being populated.
Sensors public IEnumerable<SensorData> { get; set; } Collection of sensor data.
Constructor public DigitalOutputPopulateChannels(Dictionary<string, string> hardwareChannelIdToSensorId) Initializes with the hardware-to-sensor mapping.
PopulateDASChannels public IEnumerable<DASChannelModel> PopulateDASChannels(TestTemplate testTemplate, IEnumerable<SensorData> sensors, List<IDASHardware> hardware, ref Dictionary<string, DASChannelModel> channelIdToDASChannel) Populates digital output channels, sets properties from existing IGroupChannel (DigitalOutputMode, DigitalOutputDurationMs, DigitalOutputDelayMs, LimitDuration, UserChannelName, CustomCode, ISOChannelName, ISOCode), subscribes to DigitalOutputChannelChanged event.

SensorsPopulateChannels

Member Signature Description
Constructor public SensorsPopulateChannels(Predicate<SensorData> channelTypeFilter) Initializes with a sensor filter predicate.
GetSensorToChannels public Dictionary<int, List<IGroupChannel>> GetSensorToChannels(TestTemplate testTemplate, ref List<IGroupChannel> groupChannels) Extracts channels from test template, removes entries with SensorId == 0, returns dictionary grouped by sensor ID.
BuildHardwareLookup public void BuildHardwareLookup(IEnumerable<DASHardware> hardware, ref List<IGroupChannel> groupChannels) Links hardware channels to group channels using DASId and DASChannelIndex.
PopulateSensorsChannels public IEnumerable<ChannelModel> PopulateSensorsChannels(TestTemplate testTemplate, IEnumerable<DASHardware> hardware, IEnumerable<SensorData> sensors, ref Dictionary<string, DASChannelModel> channelIdToDASChannel) Orchestrates channel population: retrieves group channels, builds hardware lookup, filters sensors, and builds assigned channels.

SummaryRowHelper (static class)

Method Signature Description
GetSummaries public static void GetSummaries(ref List<SummaryRow> found, ref List<SummaryRow> missing, ref List<SummaryRow> extra, List<IDASCommunication> das, ImportObject importObject) Main entry point that populates found/missing/extra summary rows for import results.
GetChannelName public static string GetChannelName(IsoViewMode isoViewMode, ISensorData sd) Builds channel name using GroupChannel.BuildChannelName based on ISO view mode.

GroupChannelHelper (static class)

Method Signature Description
UpdateGroupChannelsInTestTemplate public static void UpdateGroupChannelsInTestTemplate(IEnumerable<DASChannelModel> analogDasChannels, IEnumerable<DASChannelModel> squibDasChannels, IEnumerable<DASChannelModel> digitalOutputDasChannels, IEnumerable<DASChannelModel> digitalInputDasChannels, ref TestTemplate testTemplate, IEnumerable<SensorData> sensors) Synchronizes group channels in the test template with populated DAS channel models. Updates existing channels, creates new ones for newly assigned sensors, and removes channels with no sensor assignment.

3. Invariants

  1. Channel Type Filtering: Each channel populator class filters by a specific channel type property (IsDigitalIn, IsSquib, IsAnalog, IsDigitalOut) on IHardwareChannel and corresponding methods (IsDigitalInput(), IsSquib(), IsAnalog(), IsDigitalOutput()) on SensorData.

  2. Squib Odd Channel Skip: In DASPopulateChannels.PopulateDASChannels, Squib channels with odd channel numbers (ch.ChannelNumber % 2 == 1) are always skipped (per FB 43723).

  3. SLICE Controller Exclusion: Hardware with IsSLICEEthernetController == true is always skipped in DASPopulateChannels.PopulateDASChannels.

  4. SensorId Zero Removal: In SensorsPopulateChannels.GetSensorToChannels, group channels with SensorId == 0 are removed from the list.

  5. Hardware Channel Index Bounds: In SensorsPopulateChannels.BuildHardwareLookup, the DASChannelIndex must be >= 0 and < h.Channels.Length to link hardware channels.

  6. Dictionary Key Uniqueness: The channelIdToDASChannel dictionary uses HardwareChannel.GetId() as the key; duplicate keys would cause exceptions.

  7. Null Hardware Handling: DASPopulateChannels.PopulateDASChannels and DigitalOutputPopulateChannels.PopulateDASChannels return empty lists if hardware is null.


4. Dependencies

External Dependencies (Imports)

  • DTS.Common.Enums - IsoViewMode enum
  • DTS.Common.Interface.DataRecorders - IDASHardware, IHardwareChannel
  • DTS.Common.Interface.Channels - IGroupChannel
  • DTS.Common.Interface.Sensors.SensorsList - Sensor interfaces
  • DTS.Common.Import - ImportObject
  • DTS.Common.Classes.Groups - GroupChannel, GroupList
  • DTS.Common.SharedResource.Strings - StringResources
  • DTS.Common.Utilities.Logging - APILogger
  • DTS.SensorDB - SensorData, DASHardware
  • DTS.DASLib.Service - IDASCommunication, IDASChannel, DASChannel
  • DataPROWin7.DataModel - TestTemplate

Internal Dependencies

  • DataPROWin7.Controls.TestSetups.Import.Models - DASChannelModel, ChannelModel, SummaryRow, DigitalOutputChannelEventArgs
  • Common.SerializedSettings - Static settings access for ISOViewMode

Implementations Provided

  • ISensorsPopulateChannels - Implemented by DigitalInputPopulateChannels, SquibPopulateChannels, AnalogPopulateChannels,