--- source_files: - Common/DTS.Common.Serialization/Test/Module/IConvertable.cs - Common/DTS.Common.Serialization/Test/Module/CalculatedChannel.cs generated_at: "2026-04-17T15:38:29.079561+00:00" model: "zai-org/GLM-5-FP8" schema_version: 1 sha256: "a6c5362a20ffc690" --- # Documentation: DTS.Serialization.Test.Module ## 1. Purpose This module defines the `CalculatedChannel` class and `IConvertable` interface within the `DTS.Serialization.Test.Module` namespace hierarchy. The `CalculatedChannel` class represents a derived data channel whose values are computed from one or more source channels, supporting XML serialization/deserialization and aggregation of multiple source channels. The `IConvertable` interface provides a contract for objects that can transform themselves to/from `Module` objects. This is part of a larger test serialization framework for capturing test measurement data. --- ## 2. Public Interface ### `DTS.Serialization.Test.Module.IConvertable` (Interface) **Location:** `IConvertable.cs` | Method | Signature | Description | |--------|-----------|-------------| | `ToDtsSerializationTestModule` | `Module ToDtsSerializationTestModule(Test parentTest)` | Converts the implementing object to a `Module` instance, receiving the containing `ParentTest` as context. | | `FromDtsSerializationTestModule` | `void FromDtsSerializationTestModule(Module testModule, ReportErrors reportErrors)` | Initializes the implementing object from a `Module` instance, with error reporting via `ReportErrors` delegate/callback. | --- ### `DTS.Serialization.Test.Module.CalculatedChannel` (Class) **Location:** `CalculatedChannel.cs` **Inheritance:** Inherits from `AnalogInputChannel` **XML Tag:** `[XmlSerializationTag("CalculatedChannel")]` #### Constructor | Signature | Description | |-----------|-------------| | `CalculatedChannel(Module parentModule)` | Constructs a new instance with a reference to its parent `Module`. | #### Properties | Property | Type | Default | XML Tag | Description | |----------|------|---------|---------|-------------| | `SourceChannelNumber` | `int[]` | `null` | `SourceChannelNumber` | Array of source channel numbers this calculated channel derives from. | | `SourceModuleNumber` | `int[]` | `null` | `SourceModuleNumber` | Array of source module numbers. | | `SourceModuleSerialNumber` | `string[]` | `null` | `SourceModuleSerialNumber` | Array of source module serial numbers. | | `Calculation` | `string` | `"NONE"` | `Calculation` | The calculation expression/formula for this channel. | | `T1` | `ulong` | `0` | `T1` | Time parameter 1 (HIC-related). Only serialized if `HIC` is initialized. | | `T2` | `ulong` | `0` | `T2` | Time parameter 2 (HIC-related). Only serialized if `HIC` is initialized. | | `HIC` | `double` | `0D` | `HIC` | Head Injury Criterion value. Conditionally serialized. | | `SampleRateHz` | `double` | `0` | `SampleRateHz` | Sample rate in Hertz. | #### Methods | Method | Signature | Description | |--------|-----------|-------------| | `WriteXml` | `void WriteXml(XmlWriter writer)` | Serializes this object to XML. Writes `HIC`, `T1`, `T2` attributes only if `_HIC.IsValueInitialized` is true. | | `ReadXml` | `void ReadXml(XmlReader reader)` | Deserializes from XML. Calls `base.ReadXml(reader)` first, then populates derived properties. `HIC`, `T1`, `T2` only read if `HIC` attribute is present and non-whitespace. | | `Equals` | `override bool Equals(object obj)` | Memberwise equality check comparing: `ChannelId`, `SourceChannelNumber`, `ChannelDescriptionString`, `EngineeringUnits`, `Calculation`, `IsoCode`. | | `GetHashCode` | `override int GetHashCode()` | Returns `base.GetHashCode()`. | | `ToString` | `override string ToString()` | Returns `ChannelDescriptionString`. | | `CreateInstance` (static) | `static CalculatedChannel CreateInstance(Channel[] channels)` | Factory method creating a `CalculatedChannel` from multiple source channels. Validates that the maximum sample rate is a multiple of each source's sample rate. Copies properties from the first channel via reflection. | | `CreateInstance