6.1 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-16T11:21:42.260506+00:00 | zai-org/GLM-5-FP8 | 1 | d05bf6b72e9c97be |
Documentation: CalculatedChannelCreator
1. Purpose
The CalculatedChannelCreator class is a static factory that creates derived data channels from existing test data channels. It supports multiple calculation types including aggregate operations (SUM, AVE, Resultant, HIC), binary operations (Integral, DoubleIntegral, Derivative, Sin, Cos), and specialized 3D IR-Tracc sensor calculations. The module handles sample rate alignment via super-sampling, creates persistent memory-mapped file storage for calculated data, and integrates the results back into the test data hierarchy.
2. Public Interface
CreateChannels
public static Test.Module.CalculatedChannel[] CreateChannels(
string testId,
string folder,
Calculation calculation,
List<Test.Module.Channel> inputChannels,
string channelName,
int startingNumber,
List<Test.Module.Channel> allChannels,
int clipLength,
out List<string> errorList,
int defaultEncoding)
Behavior: Main entry point for creating calculated channels. Routes to appropriate internal creation method based on Calculation type:
ThreeDIRTracc,ThreeDIRTraccLowerThorax,ThreeDIRTraccAbdomen→Create3DIRTraccChannelsSUM,AVE,Resultant,HIC→CreateChannelsAggregateOperation- All others →
CreateChannelsBinaryOperation
Returns null if channel name validation fails or calculation produces no results. Sets AbsoluteDisplayOrder on each returned channel starting from startingNumber.
ValidateChannelName
public static bool ValidateChannelName(
string channelName,
List<Test.Module.Channel> inputChannels,
List<Test.Module.Channel> allChannels,
out List<string> errorList)
Behavior: Validates that the channel name is non-empty and unique across both inputChannels and allChannels. Returns true if valid (empty error list). If allChannels is null, returns true immediately with no validation performed.
ThreeDIRTraccType (nested enum)
public enum ThreeDIRTraccType
{
Thorax,
Abdomen,
LowerThorax
}
Behavior: Specifies the anatomical mounting position for 3D IR-Tracc sensors, which affects calculation constants (δ and D0).
3. Invariants
-
Channel Number Offset: All calculated channels use
ChannelNumberCalculationChannelIndicator(100000) as a base offset added to the provided starting number. -
3D IR-Tracc Input Count:
Create3DIRTraccChannelsasserts that exactly 3 input channels are provided. Failure triggersSystem.Diagnostics.Trace.Assert. -
Aggregate Operation Input Count:
CreateChannelsAggregateOperationasserts at least 1 input channel is provided. -
Sample Rate Compatibility: For aggregate and 3D IR-Tracc operations, the maximum sample rate must be an integer multiple of all input channel sample rates. If not,
NotSupportedExceptionis thrown. -
Binary Operations: Only the first channel in
inputChannelsis used for binary operations (Integral, Derivative, Sin, Cos, etc.). -
HIC Unit Requirement: HIC calculations require acceleration in g's. If input engineering units are not "g", data is converted from m/s² using factor
9.80665. -
Super-Sampling Warning: When input channels have different sample rates, a
PageErrorEventis published withSuperSamplingWarningresource string.
4. Dependencies
This module depends on:
DTS.Common.Enums.Sensors-SensorConstantsfor IR-Tracc physical constantsDTS.Common.Utilities.Logging-APILoggerfor file operation loggingDTS.Common.Utils-FileUtilsfor file deletionDTS.Serialization-SliceRaw.Fileformat handlingDTS.Slice.Control- Test/Event module channel typesDTS.Common-Constants.ADC_MIDPOINT,ZeroMethodTypeDTS.Common.Events-PageErrorEvent,PageErrorArgDTS.Common.Calculations-HeadInjuryCriterionfor HIC calculationDTS.Common.Utilities.Math.Nhtsa-Integration,DifferentiationclassesPrism.Ioc-ContainerLocatorfor service resolutionPrism.Events-IEventAggregatorfor event publishing
What depends on this module:
- Inferred:
AddCalculatedChannelViewModel(referenced viausing staticforThreeDIRTraccTypecontext) - Inferred: Any module calling
CreateChannelsto generate derived data channels
5. Gotchas
-
Explicit GC.Collect():
CreatePersistentInformationObjectcallsGC.Collect()before attempting file deletion to release file handles. This is a heavy operation that may cause performance issues. -
Unused Variable: In
PerformCalculationsAggregate, the variabletimeAtIndexis declared and assigned (var timeAtIndex =) but the value is never used—the assignment result is discarded. -
Debug File Replacement:
PerformCalculation(3D IR-Tracc) callsDiskUtility.ReplaceDataIfNeededwith hardcoded filenames ("DISPLEU.txt","YPOTEU.txt","ZPOTEU.txt"). This appears to be debug/test instrumentation left in production code. -
ScaleEuData Scaling Logic: The scaling factor calculation handles bipolar signals by doubling the max value (
max *= 2), but the scaleFactor calculation differs based on whether max exceedsshort.MaxValue—one path divides, the other multiplies, which may produce unexpected scaling behavior. -
Null Return on Validation Failure:
CreateChannelsreturnsnullifValidateChannelNamefails, but the error list is populated viaoutparameter. Callers must check both the return value and error list. -
Binary Operations Ignore Additional Channels:
CreateChannelsBinaryOperationandPerformCalculationBinaryonly useinputChannels[0]. Additional channels in the list are silently ignored. -
HIC-Specific Handling: HIC calculation is performed inside
CreateChannelsAggregateOperationafter channel creation, settingT1,T2, andHICproperties on the calculated channel. This is not visible from the public method signature.