11 KiB
11 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
2026-04-16T04:20:26.330131+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 8f0536e102b7ae08 |
Documentation: Test Setup Import Channel Population Module
1. Purpose
This module handles the population and synchronization of channel models between hardware (DAS), sensors, and test setup group channels during test setup import. It bridges the gap between raw hardware channel data (IDASHardware, IHardwareChannel), sensor definitions (SensorData), and logical groupings in the test template (TestTemplate.ChannelsForGroup). The module ensures that hardware channels are correctly mapped to sensors and that channel-specific properties (e.g., ISO/user codes, squib/fire settings, digital output modes) are propagated to the appropriate logical channel representations. It supports multiple channel types—Analog, Digital Input, Digital Output, and Squib—via dedicated populate classes implementing shared interfaces.
2. Public Interface
Static Classes
UserCodeISOUtility
ShowUserCode()(bool)
Returnstrueif the currentISOViewModesetting isISOAndUserCodeorUserCodeOnly. Controls visibility of user-defined channel names/codes in UI.ShowISOCode()(bool)
Returnstrueif the currentISOViewModesetting isISOAndUserCodeorISOOnly. Controls visibility of ISO-standard channel names/codes in UI.
Classes Implementing ISensorsPopulateChannels and/or IDASPopulateChannels
DigitalInputPopulateChannels
- Constructor: Not exposed (no public constructor defined; relies on dependency injection or external instantiation).
PopulateDASChannels(...)(IEnumerable<DASChannelModel>)
Filters hardware channels to those whereIsDigitalIn == true, then delegates toDASPopulateChannels.PopulateSensorsChannels(...)(IEnumerable<ChannelModel>)
Filters sensors to those whereIsDigitalInput() == true, then delegates toSensorsPopulateChannels.
SquibPopulateChannels
PopulateDASChannels(...)(IEnumerable<DASChannelModel>)
Filters hardware channels to those whereIsSquib == true, excluding odd-numbered channels (perch.IsSquib && 1 == ch.ChannelNumber % 2check inDASPopulateChannels). Delegates toDASPopulateChannels.PopulateSensorsChannels(...)(IEnumerable<ChannelModel>)
Filters sensors to those whereIsSquib() == true, then delegates toSensorsPopulateChannels.
AnalogPopulateChannels
- Constructor:
AnalogPopulateChannels(Dictionary<string, string> hardwareChannelIdToSensorId)
Initializes with a mapping from hardware channel IDs to sensor EIDs. PopulateDASChannels(...)(IEnumerable<DASChannelModel>)
Filters hardware channels to those whereIsAnalog == true, then delegates toDASPopulateChannels.PopulateSensorsChannels(...)(IEnumerable<ChannelModel>)
Filters sensors to those whereIsAnalog() == true, then delegates toSensorsPopulateChannels.
DigitalOutputPopulateChannels
- Constructor:
DigitalOutputPopulateChannels(Dictionary<string, string> hardwareChannelIdToSensorId)
Initializes with a mapping from hardware channel IDs to sensor EIDs. PopulateDASChannels(...)(IEnumerable<DASChannelModel>)
Filters hardware channels to those whereIsDigitalOut == true. For each channel:- If a mapping exists (
HardwareChannelIdToSensorId), assignsEID. - If a corresponding
IGroupChannelexists (viachannelIdToGroupChannel), copies digital output settings (DigitalOutputMode,DigitalOutputDurationMs, etc.) and creates/updatesChannelModel. - Otherwise, creates a new
ChannelModelwith default digital output settings.
- If a mapping exists (
DASPopulateChannels
- Constructor:
DASPopulateChannels(Dictionary<string, string> hardwareChannelIdToSensorId, Predicate<IHardwareChannel> hardwareChannelFilter)
Stores hardware channel filter and EID mapping. PopulateDASChannels(...)(IEnumerable<DASChannelModel>)
Iterates over DAS hardware (skipping SLICE Ethernet controllers), applies filter, and:- Skips squib channels on odd channel numbers (
ch.IsSquib && 1 == ch.ChannelNumber % 2). - Creates
DASChannelModelfor each qualifying hardware channel. - If
HardwareChannelIdToSensorIdcontains the channel ID, assignsEID, then attempts to link toIGroupChannelvia sensor lookup. - Populates
channelIdToDASChanneldictionary.
- Skips squib channels on odd channel numbers (
SensorsPopulateChannels
- Constructor:
SensorsPopulateChannels(Predicate<SensorData> channelTypeFilter)
Stores sensor type filter. GetSensorToChannels(...)(Dictionary<int, List<IGroupChannel>>)
Returns group channels grouped bySensorId, removing channels withSensorId == 0.BuildHardwareLookup(...)(void)
LinksIGroupChannel.HardwareChannelby matchingDASIdandDASChannelIndexto hardware.PopulateSensorsChannels(...)(IEnumerable<ChannelModel>)
Filters sensors using_channelTypeFilter, then builds assignedChannelModels for sensors with hardware channels, or unassigned models otherwise. CallsSetPropertiesFromGroupChannelto copy settings.
Helper Classes
SummaryRowHelper
GetSummaries(...)(void)
Populatesfound,missing, andextralists based on comparison between test setup sensors and DAS hardware channels. UsesGetFoundEids,GetSummaryRowFound,GetSummaryRowMissing, andGetSummaryRowExtraEidsinternally. Includes logic to exclude TOM squib odd channels and handle missing sensor descriptions.
GroupChannelHelper
UpdateGroupChannelsInTestTemplate(...)(void)
SynchronizesIGroupChannelinstances inTestTemplate.ChannelsForGroupwithDASChannelModels from all channel types. Handles:- Updating existing group channels with new sensor assignments.
- Removing group channels with no sensor.
- Creating new group channels for newly assigned sensors.
- Preserving hardware channel assignments from previous runs (FB 31874).
- Copying channel-specific properties (squib, digital output, analog, etc.) via
AssignProperties.
3. Invariants
- Hardware Channel Filtering: Each
Populate*Channelsclass enforces a specific filter on hardware channels (e.g.,IsAnalog,IsDigitalIn,IsSquib,IsDigitalOut). Filters are applied inDASPopulateChannelsandDigitalOutputPopulateChannels. - Squib Channel Exclusion: For squib channels, odd-numbered channels (
ChannelNumber % 2 == 1) are always skipped during DAS population (FB 43723). - EID Mapping:
HardwareChannelIdToSensorIdis used to map hardware channels to sensor EIDs. If absent, no sensor assignment occurs. - Hardware Channel Uniqueness: Each hardware channel ID maps to at most one
DASChannelModelinchannelIdToDASChannel. - Group Channel Consistency:
GroupChannelHelper.UpdateGroupChannelsInTestTemplateensures that:- Group channels with no hardware channel are removed unless they were pre-assigned (FB 31874).
- Sensor assignments are updated only if a valid
SerialNumberexists in theDASChannelModel. - Channel properties (e.g.,
Range,Polarity,SquibFireMode,DigitalOutputMode) are copied fromDASChannelModeltoIGroupChannel.
- ISO/User Code Visibility:
ShowUserCode()andShowISOCode()depend solely onCommon.SerializedSettings.ISOViewMode, which must be set before calling.
4. Dependencies
Imports/Usings (External)
DTS.Common.*: Core enums (IsoViewMode,Sensors.SensorConstants), interfaces (IDASHardware,IHardwareChannel,IGroupChannel,ISensorData,IDASCommunication), classes (ChannelRepresentation,DASHardware,GroupChannel,SummaryRow), and utilities (Logging.APILogger,SharedResource.Strings.StringResources).DTS.SensorDB:SensorData,DbOperations.DataPROWin7.DataModel:TestTemplate,ChannelModel,DASChannelModel,DASHardware.System.*: LINQ, collections, predicates.
Module Dependencies
- Consumers: Likely invoked during test setup import (e.g.,
ImportObject,TestSetupImporter). - Depends on:
Common.SerializedSettings.ISOViewMode(forUserCodeISOUtility).TestTemplate.ChannelsForGroup(forGroupChannelHelper).Sensors()andTestSetups()fromImportObject(forSummaryRowHelper).- Hardware configuration (
IDASHardware,IDASCommunication) from DAS devices.
5. Gotchas
- Squib Odd-Channel Exclusion: The
DASPopulateChannels.PopulateDASChannelsmethod unconditionally skips squib channels on odd channel numbers (1 == ch.ChannelNumber % 2). This is hardcoded and applies to all callers, not justSquibPopulateChannels. Ensure hardware configuration accounts for this. - SLICE Ethernet Controller Skipping:
DASPopulateChannelsskips any DAS whereIsSLICEEthernetController == true. This may cause channels on such devices to be silently ignored. HardwareChannelIdToSensorIdRequirement: If this dictionary is empty or missing keys,DASChannelModel.EIDwill not be assigned, and sensor linking will fail.CleanSerialNumberLogic:GroupChannelHelper.CleanSerialNumberreplaces test-specific serial numbers (e.g.,"TEST_SPECIFIC_ANALOG_SERIAL") with the constant string, but only if the input matches exactly the resource string value. This may cause mismatches if the constant is updated.- Digital Output Channel Assignment:
DigitalOutputPopulateChannelsrelies onIGroupChannel.HardwareChannelbeing pre-assigned (viaDASChannelIndexandDASId) to link to existing group channels. If hardware channel assignment is missing, new group channels are created. - FB References: Comments like
//FB 41819refer to internal bug/feature numbers. These may be useful for historical context but are not self-documenting. - No Public Constructors:
DigitalInputPopulateChannels,SquibPopulateChannels, andAnalogPopulateChannelslack public constructors, implying instantiation is handled externally (e.g., via DI or factory). This is not explicit in the source. - Event Subscription:
DigitalOutputPopulateChannelssubscribes toDigitalOutputChannelChangedonDASChannelModel. Ensure event handlers are cleaned up to avoid memory leaks if instances are reused. GetSummariesSide Effects:GetSummariesmodifiesreflists (found,missing,extra) and usesimportObject.TestSetups().First()—assumes at least one test setup exists.