Files

119 lines
7.5 KiB
Markdown
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- Common/DTS.Common.ISO/IsoMDBFile.cs
- Common/DTS.Common.ISO/ISerializableFile.cs
- Common/DTS.Common.ISO/AbstractOLEDbWrapper.cs
- Common/DTS.Common.ISO/HardwareChannel.cs
- Common/DTS.Common.ISO/IsoCode.cs
- Common/DTS.Common.ISO/TestObjectChannel.cs
- Common/DTS.Common.ISO/CalculatedValueClass.cs
- Common/DTS.Common.ISO/LevelTriggerChannel.cs
- Common/DTS.Common.ISO/TestSetting.cs
- Common/DTS.Common.ISO/TestObjectTemplate.cs
- Common/DTS.Common.ISO/MMEFilterClasses.cs
- Common/DTS.Common.ISO/MMEPositions.cs
- Common/DTS.Common.ISO/MMEFineLocations2.cs
generated_at: "2026-04-16T14:13:51.176520+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "8371f072462a5521"
---
# Documentation: DTS.Common.ISO
## 1. Purpose
The `DTS.Common.ISO` namespace provides a domain model and data access layer for a Data Acquisition System (DAS), with specific support for ISO 13499 (MME) standards. It defines core entities representing hardware channels, test object templates, calculated channels, and trigger logic. The module bridges raw database records (via OLE DB) and XML serialization with higher-level application logic, facilitating the configuration and execution of crash test simulations or data recording scenarios.
## 2. Public Interface
### Classes
#### `AbstractOLEDbWrapper`
An abstract base class providing utility methods for safe data reading.
* `protected static long GetLong(IDataReader reader, string field)`: Returns `long.MinValue` if the database field is `DBNull`, otherwise converts the value to `long`.
* `protected static DateTime GetDate(IDataReader reader, string field)`: Returns `DateTime.MinValue` if the database field is `DBNull`, otherwise casts to `DateTime`.
#### `HardwareChannel`
Represents a physical hardware channel, inheriting from `DASChannelDBRecord`.
* `Hardware ParentDAS`: Gets or sets the parent hardware device.
* `HardwareChannel()`: Default constructor.
* `HardwareChannel(IDASChannelDBRecord record, Hardware h)`: Constructs a channel from a record and parent hardware.
* `HardwareChannel(HardwareChannel copy, Hardware h)`: Copy constructor.
* `static int PhysicalCompare(HardwareChannel left, HardwareChannel right)`: Compares two channels by `ChannelIdx`. Handles nulls.
* `void Insert()`: Inserts the channel into the database via `DbOperations.DASChannelsInsert`.
* `bool IsSupported(SensorConstants.BridgeType bridge)`: Checks if a specific bridge type is supported using bitwise comparison.
#### `IsoCodeStatics`
Static helper class for generating ISO code strings.
* `static string GetString(MMEPossibleChannels channel, MMETestObjects container, MMEPositions position, MMEFilterClasses fc)`: Constructs an ISO code string from channel metadata.
* `static string GetString(MMEPossibleChannels channel, bool careAboutTestTimeFields)`: Overload that optionally masks test time fields (TestObject, FilterClass) with placeholders ("??", "?").
* `static string GetString(string testObject, ..., string fc)`: Constructs the string via concatenation of parameters.
#### `TestObjectChannel`
Represents a channel within a test object, implementing `IComparable<TestObjectChannel>` and `IGroupChannel`.
* `bool Disabled`: Determines if the channel is used in data collection.
* `int ChannelIdx`: Index of the channel, defaults to `CHANNEL_IDX_UNKNOWN` (-1).
* `string SensorSerialNumber`: Serial number of the associated sensor.
* `string HardwareId`: Physical hardware channel ID. The setter parses and reformats the string if it contains underscores.
* `SquibChannelTypes SquibChannelType`: Enum (`None`, `Voltage`, `Current`).
* `TestObject TestObject`: The parent test object.
* `int CompareTo(TestObjectChannel right)`: Sorts by `DisplayOrder`, then `Name`, then `TestObject.SerialNumber`.
* `string GetGraphId()`: Returns the ID, appending `Constants.CURRENT_SUFFIX` if `SquibChannelType` is `Current`.
* `string GetId()`: Returns a composite ID string (`SerialNumber_MMEChannelType_Id`).
* `string GetDASId()`: Extracts the DAS ID from the `HardwareId` string.
#### `CalculatedValueClass`
Represents a calculated/derived channel (e.g., sum, HIC), inheriting from `CalculatedChannelRecord`.
* `bool SupportsRealtime`: Returns true if `ViewInRealtime` is true.
* `bool IsValid(Dictionary<string, bool> channelIdLookup)`: Validates that the channel has a name and all input channel IDs exist in the lookup.
* `Operations Operation`: Setter triggers property change events for `ViewInRealtime` and `CanChangeViewInRealtime`.
* `bool ViewInRealtime`: Returns false for specific operations (`IRTRACC3D`, `HIC`, etc.) regardless of the base value.
* `string[] InputChannelIds`: Getter reconstructs the array from the `_channels` list if populated.
* `byte[] InputChannelIdsBlob`: Serializes/deserializes input channel IDs to/from UTF-8 bytes.
* `void ReplaceInputChannelIdAtIndex(int index, string newId)`: Replaces a specific ID in the input array.
#### `CCAttributeBase`
Abstract base class for attributes attached to calculated channels.
* `int AttributeId`: Read-only ID.
* `abstract string GetSerializedValue()`: Must be implemented to return the string value.
* `abstract string GetDefaultValue()`: Must be implemented to return the default value.
* `abstract CCAttributeBase Copy()`: Must be implemented for deep copying.
#### `LevelTriggerChannel`
Defines trigger conditions based on signal levels.
* `LevelTriggerChannel(DataRow dr)`: Constructs the object from a database row.
* `string LevelTriggerText`: Generates a human-readable description of the trigger logic (e.g., "Less than 5.00(V)").
* Properties include thresholds: `GreaterThanThresholdEU`, `LessThanThresholdEU`, `InsideUpperLevelEU`, etc.
#### `TestSetting` & `TestSettingDictionary`
Manage configuration settings for a test.
* `TestSetting(int id, string value, string defaultValue)`: Constructor.
* `static bool TryParse(string s, out TestSetting ts)`: Parses a string format "id=value".
* `TestSettingDictionary.GetValue(int id, string defaultValue)`: Retrieves a value or returns the default.
* `TestSettingDictionary.SetValue(TestSetting setting)`: Sets or updates a setting in the internal dictionary.
* `string ToSerializeString()`: Serializes the dictionary to a string using culture-invariant separators.
#### `TestObjectTemplate`
A lightweight wrapper for group templates (ISO metadata).
* `string TemplateNameOrOriginalTemplateName`: Returns the original name if embedded (GUID name), otherwise `TemplateName`.
* `TestObjectTemplateChannel[] Channels`: Array of channels belonging to the template.
* `bool IsISOMode()`: Checks if `TestObjectType` contains specific non-ISO markers.
#### ISO Metadata Classes (`MMEFilterClasses`, `MMEPositions`, `MMEFineLocations2`)
Data mappers for ISO 13499 reference tables.
* `static [Type][] Get[Types]()`: Static method that queries the database (via `DbOperations.GetISOCommand()`) and returns an array of objects.
* `static [Type] ReadXML(XmlElement node)`: Factory method to instantiate from XML attributes.
* Properties map directly to DB columns: `S_GUID`, `Text_L1`, `Version`, `Expired`, `History`, etc.
### Interfaces
#### `ISerializableFile`
* `string GetDirectory()`
* `string GetExtension()`
* `string GetFilter()`
* `string GetFileLocation()`
## 3. Invariants
* **HardwareChannel Insertion**: Calling `HardwareChannel.Insert()` requires `ParentDAS` to be non-null, as it calls `ParentDAS.GetId()`.
* **TestObjectChannel ID Parsing**: The `HardwareId` setter expects a specific format (tokens separated by `_`). If it does not match the expected