14 KiB
14 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
2026-04-16T03:16:28.845582+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | b79a1cdde998f5b5 |
Documentation: Groups Module
1. Purpose
This module provides data structures and helper utilities for representing, importing, and managing group-based test configurations—specifically those sourced from .GRP files (TDC format)—and their persistence in the database. It defines import-time models (GroupGRPImportGroup, GroupGRPImportChannel, GroupGRPImportError) for parsing and validating .GRP files, database record models (GroupDbRecord, GroupHardwareDbRecord, TestSetupGroupRecord, ChannelDbRecord) for ORM-style data access, and a static GroupHelper class to cache and manage cross-referenced metadata (e.g., static group names, DAS IDs, channel-group mappings) during runtime. The module serves as the canonical data model layer for group-centric test setups in the DTS system.
2. Public Interface
GroupGRPImportError
Errorsenum: Defines all possible error codes during.GRPfile import:FileEmpty,InvalidISOCodeInput,InvalidFullScaleInput,InvalidSensorInput,InvalidInvertInput,SensorNotFound,InvalidInputMode,InvalidDefaultValue,InvalidActiveValue,InvalidFireMode,InvalidDelay,InvalidLimitDuration,InvalidDuration,InvalidCurrent
- Properties:
Errors ErrorCode { get; set; }: The specific error encountered.string File { get; set; }: Path or name of the.GRPfile where the error occurred.int Line { get; set; }: Line number in the file where the error occurred.string ExtraInfo { get; set; }: Human-readable error details.
override string ToString(): ReturnsExtraInfo.
GroupGRPImportGroup
- Properties:
bool Included { get; set; } = true: Whether the group is included in the current import operation.bool Overwrite { get; set; } = true: Whether existing group data should be overwritten.string GroupName { get; set; }: Name of the group.string GroupTags { get; set; }: Tags associated with the group.string ImportingUserTags { get; set; }: User-provided tags during import.string SourceFile { get; set; }: Path to the source.GRPfile.GroupGRPImportChannel[] Channels { get; set; } = { }: Array of imported channels.GroupGRPImportError[] GroupErrors { get; set; } = null: Array of errors encountered during import of the entire group.bool GroupNameHasError { get; set; }: UI hint indicating if the group name field has an error (used for visual feedback).
GroupHardwareDbRecord
- Implements:
IGroupHardwareDbRecord - Properties:
int Id { get; set; }: Primary key (database ID).int GroupId { get; set; }: Foreign key toGrouptable.int DASId { get; set; }: Foreign key to DAS (Data Acquisition System) record.string SerialNumber { get; set; }: Serial number of hardware associated with the group.
- Constructors:
GroupHardwareDbRecord(): Default constructor.GroupHardwareDbRecord(IGroupHardwareDbRecord copy): Copy constructor.GroupHardwareDbRecord(IDataReader reader): Populates from database reader.
TestSetupGroupRecord
- Implements:
ITestSetupGroupRecord - Properties:
int GroupId { get; set; }: Foreign key to group.int DisplayOrder { get; set; }: Order in which the group appears in a test setup UI.string Position { get; set; }: ISO 13499 position field.string TestObjectType { get; set; }: ISO 13499 test object field.int TestSetupId { get; set; }: Foreign key to test setup.
- Constructors:
TestSetupGroupRecord(): Default constructor.TestSetupGroupRecord(IDataReader reader): Populates from database reader.TestSetupGroupRecord(ITestSetupGroupRecord copy): Copy constructor.
GroupDbRecord
- Implements:
IGroupDbRecord - Properties:
int Id { get; set; }: Primary key (database ID).string SerialNumber { get; set; }: Serial number (used as group identifier).string Picture { get; set; }: Path or identifier for group image.string DisplayName { get; set; }: Human-readable name.string Description { get; set; }: Group description.bool Embedded { get; set; }: Whether the group is embedded (system-managed).DateTime LastModified { get; set; }: Timestamp of last modification.string LastModifiedBy { get; set; }: User who last modified the group.int? StaticGroupId { get; set; }: Reference to static group ID if applicable.string ExtraProperties { get; set; }: Serialized JSON of additional properties.
- Constructors:
GroupDbRecord(): Default constructor.GroupDbRecord(IGroupDbRecord copy): Copy constructor.GroupDbRecord(IGroup copy, List<KeyValuePair<string, string>> extraProperties): Converts from domainIGroupmodel.GroupDbRecord(IDataReader reader): Populates from database reader.
GroupGRPImportChannel
- Constants:
SerialNumberField = 0,DisplayNameField = 1,ISOCodeField = 2,InvertField = 3,CapacityField = 4,InputModeField = 5,DefaultValueField = 6,ActiveValueField = 7,FireModeField = 8,DelayField = 9,LimitDurationField = 10,DurationField = 11,CurrentField = 12: Field indices for parsing.GRPfiles.
- Properties:
string SensorSerialNumber { get; set; }: Serial number of the sensor.string DisplayName { get; set; }: Channel display name.string ISOCode { get; set; }: ISO-compliant channel code.bool Invert { get; set; }: Whether the channel signal is inverted.double FullScale { get; set; }: Full-scale value (e.g., for analog channels).InputModes? InputMode { get; set; } = null: Input mode (see enum below).FireModes? FireMode { get; set; } = null: Fire mode (see enum below).double? DefaultValue { get; set; } = null: Default value (e.g., for analog channels).double? ActiveValue { get; set; } = null: Active value (e.g., trigger threshold).double? Delay { get; set; } = null: Delay before firing (seconds).bool? LimitDuration { get; set; } = null: Whether duration is limited.double? Duration { get; set; } = null: Duration of fire pulse (seconds).double? Current { get; set; } = null: Current limit for squib firing.GroupGRPImportError Error { get; set; } = null: Channel-specific import error.GroupGRPImportGroup ParentGroup { get; set; }: Parent group reference.string GroupName { get; }: Derived fromParentGroup.GroupName; returns"---"if no parent.
- Nested Enums:
InputModes:na,TLH,THL,CCNO,CCNCFireModes:na,CD,CC
- Constants:
DefaultInputMode = InputModes.CCNODefaultFireMode = FireModes.CDDefaultDefaultValue = 0.0,DefaultActiveValue = 1.0,DefaultDelay = 0.00,DefaultLimitDuration = true,DefaultDuration = 10.0,DefaultCurrent = 1.5
- Methods:
void GroupNameInvalidate(): Forces UI refresh forGroupNamebinding.
ChannelDbRecord
- Implements:
IChannelDbRecord - Properties:
long Id { get; set; }: Primary key (database ID).int GroupId { get; set; }: Foreign key to group.string IsoCode { get; set; }: ISO channel code.string IsoChannelName { get; set; }: ISO-compliant channel name.string UserCode { get; set; }: User-defined channel code.string UserChannelName { get; set; }: User-defined channel name.int DASId { get; set; }: Foreign key to DAS.int DASChannelIndex { get; set; }: Channel index on the DAS.int GroupChannelOrder { get; set; }: Order within the group.int TestSetupOrder { get; set; }: Order within a test setup.int SensorId { get; set; }: Foreign key to sensor.bool Disabled { get; set; }: Whether channel is disabled.bool IsDisabled { get; set; }: Backward-compatible alias forDisabled.DateTime LastModified { get; set; }: Timestamp of last modification.string LastModifiedBy { get; set; }: User who last modified the channel.
- Constructors:
ChannelDbRecord(): Default constructor.ChannelDbRecord(IChannelDbRecord copy): Copy constructor.ChannelDbRecord(IDataReader reader): Populates from database reader.
GroupHelper
- Static utility class (abstract, non-instantiable).
- Methods:
ClearStaticGroupNames(),SetStaticGroupName(int id, string name),GetStaticGroupName(int id): Manage mapping of static group IDs to names.ClearEmbeddedGroupIdList(),SetEmbeddedGroupId(int id),IsGroupEmbedded(int id): Manage list of embedded group IDs.ClearTestSetupGroupIds(),SetTestSetupGroupId(int groupId, int testSetupId),GetTestSetupGroupId(int groupId): Map group IDs to test setup IDs.ClearGroupChannelIds(),AddGroupChannelId(int sensorId, int groupId),GetGroupIdsFromChannels(int sensorId): Map sensor IDs to associated group IDs.ClearDASIds(),SetDASId(string serialNumber, int dasId),GetDASId(string serialNumber): Map DAS serial numbers to database IDs.ClearBaseModuleChannelIndexList(),SetBaseModuleChannelIndexList(...),GetChannelIndexes(...): Manage channel index mappings for base/module serial number pairs.ClearDASIdChannelIndexGroupIdList(),SetDASIdChannelIndexGroupIdList(...),GetGroupIds(...): Map DAS ID + channel index → group ID.ClearTestSetupHardwareIds(),AddTestSetupHardwareId(int dasId, int testSetupId),GetTestSetupHardwareIds(int DASId): Map DAS IDs to associated test setup IDs.ClearGroupHardwareIds(),AddGroupHardwareId(int dasId, int groupId),GetGroupHardwareIds(int DASId): Map DAS IDs to associated group IDs.
3. Invariants
GroupGRPImportGroup.Channels: Always initialized to an empty array ({ }), nevernull.GroupGRPImportGroup.GroupErrors: Initialized tonullby default; non-null only if errors occurred during import.GroupGRPImportChannel.*nullable properties (e.g.,InputMode,DefaultValue,FireMode, etc.): May benullif not specified in the.GRPfile; default values are defined as constants (e.g.,DefaultInputMode,DefaultFireMode, etc.).GroupDbRecord.ExtraProperties: Serialized as JSON usingJavaScriptSerializer; deserialization responsibility lies with consumers.ChannelDbRecord.IsDisabled: Redirects toDisabled; both properties must be kept in sync when set viaIsDisabled.GroupHelperstatic caches: Must be cleared between operations (e.g., import sessions) to avoid stale data; no automatic cleanup is provided.
4. Dependencies
Dependencies of this module:
DTS.Common.Base: Base classes (BasePropertyChanged) used byGroupGRPImportGroup,GroupGRPImportChannel,GroupHardwareDbRecord,TestSetupGroupRecord,GroupDbRecord,ChannelDbRecord.DTS.Common.Interface.Groups: InterfacesIGroupHardwareDbRecord,ITestSetupGroupRecord,IGroupDbRecord.DTS.Common.Interface.Channels: InterfaceIChannelDbRecord.System.Data:IDataReaderused in record constructors.System.ComponentModel.DataAnnotations:[Key]attribute onIdfields.System.Web.Script.Serialization.JavaScriptSerializer: Used inGroupDbRecordconstructor to serializeExtraProperties.
Dependencies on this module:
- Import/Export logic:
.GRPfile parsing and validation (not included here, but inferred fromGroupGRPImport*classes). - Database layer:
GroupDbRecord,ChannelDbRecord,GroupHardwareDbRecord,TestSetupGroupRecordare used by data access layers. - UI layer:
GroupGRPImportGroup.GroupNameHasErrorandGroupGRPImportChannel.GroupNamesuggest binding to UI controls (e.g., textboxes, error indicators). - Runtime metadata management:
GroupHelperis used by other modules to resolve IDs, serial numbers, and mappings without repeated DB queries.
5. Gotchas
GroupGRPImportChannel.GroupNameis a computed property: It returnsParentGroup.GroupNameor"---"ifParentGroupisnull. UI bindings must be manually invalidated viaGroupNameInvalidate()ifParentGroupchanges after construction.IsDisabledalias inChannelDbRecord: WhileIsDisabledredirects toDisabled, settingIsDisabledonly raisesOnPropertyChanged("IsDisabled"), not"Disabled". This may cause UI binding inconsistencies if consumers bind to"Disabled"directly.GroupDbRecord.ExtraPropertiesserialization: Uses legacyJavaScriptSerializer; not compatible with modernSystem.Text.Json. Consumers must use the same serializer for round-tripping.GroupHelperstatic state: Caches are global and mutable; failure to callClear*()methods between operations (e.g., import sessions) can lead to incorrect ID lookups or stale mappings.GroupHardwareDbRecord.IdvsGroupDbRecord.Id: Both useint Id, butChannelDbRecord.Iduseslong Id. Ensure correct type usage in queries.GroupGRPImportGroup.GroupErrorsis nullable: Consumers must explicitly check fornullbefore iterating (e.g.,?.LengthorGroupErrors?.Any()).GroupHelper.GetChannelIndexesandGetGroupIds: Use exact string/ID matching on nested dictionaries; performance may degrade with large datasets due to nested loops.GroupDbRecord.SerialNumbervsGroupName: InGroupDbRecord(IGroup copy, ...),SerialNumberis set tocopy.Name, butDisplayNameis set separately. EnsureNameandDisplayNameare distinct in theIGroupinterface.