Files

314 lines
15 KiB
Markdown
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- DataPRO/Modules/TestSetups/Imports/TTS/Model/WorkFunctionThreadData.cs
- DataPRO/Modules/TestSetups/Imports/TTS/Model/SummaryChannel.cs
- DataPRO/Modules/TestSetups/Imports/TTS/Model/ChannelSummary.cs
- DataPRO/Modules/TestSetups/Imports/TTS/Model/DasSummary.cs
- DataPRO/Modules/TestSetups/Imports/TTS/Model/HardwareSummaryRecord.cs
- DataPRO/Modules/TestSetups/Imports/TTS/Model/TTSTestSetup.cs
- DataPRO/Modules/TestSetups/Imports/TTS/Model/TTSLevelTriggerRecord.cs
- DataPRO/Modules/TestSetups/Imports/TTS/Model/DASChannel.cs
- DataPRO/Modules/TestSetups/Imports/TTS/Model/TTSChannelRecord.cs
generated_at: "2026-04-16T04:50:55.201620+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "7bc3f89b4437f095"
---
# Model
**Documentation: TTS Import Model Layer**
---
### 1. Purpose
This module provides core data models for representing test setup configurations, hardware channel assignments, and sensor metadata in the TTS (Toyota Test System) import workflow. It serves as the domain model layer for parsing, editing, and serializing TTS test configurations—primarily from CSV files or hardware scans—while supporting real-time UI binding via `INotifyPropertyChanged`. The models encapsulate channel definitions (`TTSChannelRecord`), hardware channel wrappers (`DASChannel`), level trigger logic (`TTSLevelTriggerRecord`), and summary data structures (`ChannelSummary`, `DasSummary`, `SummaryChannel`, `HardwareSummaryRecord`). These classes are used by UI view models and import/export logic to manage sensor-to-hardware assignments, trigger thresholds, and validation rules.
---
### 2. Public Interface
#### `WorkFunctionThreadData`
- **`ManualResetEvent CancelEvent { get; }`**
Signal to request cancellation of a background operation.
- **`ManualResetEvent DoneEvent { get; }`**
Signal to indicate completion of a background operation.
*Constructor initializes both events to non-signaled state.*
#### `SummaryChannel`
- **`string ChannelType { get; set; }`**
Gets/sets the channel type string; raises `PropertyChanged` on change.
- **`int Assigned { get; set; }`**
Gets/sets the count of assigned channels; raises `PropertyChanged`.
- **`string Unassigned { get; set; }`**
Gets/sets the unassigned channel list string; raises `PropertyChanged`.
#### `ChannelSummary`
- **`string ChannelType { get; set; }`**
Channel type identifier; raises `PropertyChanged`.
- **`int Requested { get; set; }`**
Number of channels requested for this type; raises `PropertyChanged`.
- **`int Assigned { get; set; }`**
Number of channels assigned; raises `PropertyChanged`.
- **`int Unassigned { get; set; }`**
Number of channels unassigned; raises `PropertyChanged`.
#### `DasSummary`
- **`string DASSerial { get; set; }`**
DAS unit serial number; raises `PropertyChanged`.
- **`string EIDFound { get; set; }`**
EID status string (e.g., "Found"/"Missing"); raises `PropertyChanged`.
- **`string BatteryVoltageStatus { get; set; }`**
Battery voltage status string; raises `PropertyChanged`.
- **`System.Windows.Media.SolidColorBrush BatteryVoltageColor { get; set; }`**
Brush for UI color coding of battery status; raises `PropertyChanged`.
- **`string InputVoltageStatus { get; set; }`**
Input voltage status string; raises `PropertyChanged`.
- **`System.Windows.Media.SolidColorBrush InputVoltageColor { get; set; }`**
Brush for UI color coding of input voltage status; raises `PropertyChanged`.
#### `HardwareSummaryRecord`
- **`uint DOut { get; set; }`**
Count of digital output channels; raises `PropertyChanged`.
- **`uint DIn { get; set; }`**
Count of digital input channels; raises `PropertyChanged`.
- **`uint Squib { get; set; }`**
Count of squib channels; raises `PropertyChanged`.
- **`uint Analog { get; set; }`**
Count of analog channels; raises `PropertyChanged`.
- **`uint SPS { get; set; }`**
Count of SPS modules; raises `PropertyChanged`.
- **`uint SPD { get; set; }`**
Count of SPD modules; raises `PropertyChanged`.
- **`uint SPT { get; set; }`**
Count of SPT modules; raises `PropertyChanged`.
- **`uint ECM { get; set; }`**
Count of ECM modules; raises `PropertyChanged`.
- **`uint Rack { get; set; }`**
Count of rack units; raises `PropertyChanged`.
- **`uint G5 { get; set; }`**
Count of G5 modules; raises `PropertyChanged`.
- **`uint Total { get; private set; }`**
Sum of `Analog + Squib + DIn + DOut`; *only updated via `UpdateTotal()`*.
- **`void UpdateTotal()`**
Recalculates `Total` as sum of analog, squib, digital input, and digital output counts.
- **`void Update(uint analog, uint squib, uint din, uint dout, uint ecm, uint sps, uint spt, uint spd, uint g5, uint rack)`**
Sets all module counts and calls `UpdateTotal()`.
#### `TTSTestSetup`
- **`double SampleRate { get; set; }`**
Sampling rate in Hz.
- **`RecordingModes Mode { get; set; }`**
Recording mode enum (e.g., Circular, File).
- **`double TestLength { get; }`**
Computed as `PreTrigger + PostTrigger`.
- **`double PreTrigger { get; set; }`**
Pre-trigger time in seconds.
- **`double PostTrigger { get; set; }`**
Post-trigger time in seconds.
- **`double ROIStart { get; set; }`**
Region of interest start time (seconds).
- **`double ROIEnd { get; set; }`**
Region of interest end time (seconds).
- **`string Filename { get; set; }`**
Path to the imported CSV file.
- **`string TestId { get; set; }`**
Test identifier string.
- **`string Line1 { get; set; }`**, **`Line2 { get; set; }`**, **`Line3 { get; set; }`**, **`Line4 { get; set; }`**
First four lines of the CSV header (used when generating new CSVs).
- **`string[] DummyList { get; set; }`**
Array of 8 strings (purpose unclear from source).
- **`ITTSChannelRecord[] Channels { get; set; }`**
Array of channel records.
- **`ILevelTrigger[] LevelTriggers { get; }`**
Fixed-size array of 6 `ILevelTrigger` instances (initialized in constructor).
- **`string OriginalImportFile { get; set; }`**
Path of the original imported file.
- **`bool AllowAdvancedRecordingModes { get; set; }`**
Enables HybridRecorder mode.
- **`bool AllowActiveRecordingModes { get; set; }`**
Enables Active RAM and Active RAM Multiple modes.
- **`bool AllowTSRAIRRecordingModes { get; set; }`**
Enables TSRAIR modes.
- **`bool RequireEIDFound { get; set; }`**
If `true`, sensors without EIDs are excluded.
- **`string DefaultDigitalInputMode { get; set; }`**
Default digital input mode from config.
- **`ISquibSettingDefaults SquibDefaults { get; set; }`**
Default squib settings.
- **`double DefaultSquibFireDurationMs { get; set; }`**
Default squib fire duration (ms) from config.
- **`Tuple<string, string>[] PreAssignedSensorIdAndHwId { get; set; }`**
Pre-existing sensor-to-hardware assignments (from XML import).
- **`string GetHashCode()`**
Computes SHA-256 hash over key properties and channel/trigger data; *note: overrides `object.GetHashCode()` but is named `GetHashCode()` (not `override`)*.
#### `TTSLevelTriggerRecord`
- **`string Code { get; }`**
Channel code of associated `Channel` (`""` if none).
- **`string JCode { get; }`**
JCode/Description of associated `Channel` (`""` if none).
- **`double ValuePercent { get; set; }`**
Threshold as % of full scale; triggers `RecalculateEUValue()`.
- **`double ValueEU { get; set; }`**
Threshold in engineering units; triggers `RecalculatePercent()`.
- **`string EULabel { get; }`**
Engineering unit label from `Channel.SensorEU`.
- **`string HWSerialNumber { get; }`**
Hardware module serial number from `Channel.HardwareChannel`.
- **`int ChannelNumber { get; }`**
TTS channel number from `Channel.ChannelNumber`.
- **`ITTSChannelRecord Channel { get; set; }`**
Sensor channel assignment; setter triggers `Refresh()` on *all other level triggers*.
- **`ITTSSetup TestSetup { get; }`**
Parent test setup instance.
- **`ITTSChannelRecord[] AvailableChannels { get; }`**
Read-only array of channels eligible for assignment, enforcing uniqueness of channel codes, SIMs (for TDASRack), and max 2 per G5.
- **`bool IsActive { get; }`**
`true` if `Channel` is non-null and not an empty record.
- **`bool IsModified { get; set; }`**
Flag indicating user modification.
- **`byte[] GetBytes()`**
Serializes active trigger data (code, JCode, ValueEU, HWSerialNumber).
- **`void Refresh()`**
Rebuilds `AvailableChannels`, revalidates current assignment, and raises `PropertyChanged("AvailableChannels")`.
- **`void Add(ITTSChannelRecord channel)`**
Raises `PropertyChanged("AvailableChannels")`.
- **`void Remove(ITTSChannelRecord channel)`**
Unassigns `Channel` if it matches, then raises `PropertyChanged("AvailableChannels")`.
#### `DASChannel`
- **`DigitalOutputModes DigitalOutputMode { get; set; }`**
Gets/sets digital output mode; auto-adds/removes channel from `TestSetup.Channels`.
- **`double DigitalOutputDelayMs { get; set; }`**
Delay (ms) from trigger to output start.
- **`double DigitalOutputDurationMs { get; set; }`**
Duration (ms) of output pulse.
- **`string Polarity { get; set; }`**
`"+"` or `"-"`; maps to `Channel.SensorPolarity`.
- **`SquibFireMode SquibFireMode { get; set; }`**
Gets/sets squib fire mode (`CAP` or `CONSTANT`).
- **`bool Disabled { get; set; }`**
Dependency property for UI styling; reflects `Channel.Disabled`.
- **`ITTSChannelRecord Channel { get; private set; }`**
Associated TTS channel record (can be `null`).
- **`string DASChannelString { get; }`**
Hardware channel string representation (e.g., `[SPS00001] ch 13`).
- **`string ToyotaCode { get; set; }`**
Gets/sets `Channel.ChannelCode`.
- **`string EID { get; set; }`**
Electronic ID of sensor (if any).
- **`string Name { get; set; }`**
Gets/sets `Channel.JCodeOrDescription`.
- **`string SerialNumber { get; }`**
`Channel.SensorSerialNumber`.
- **`double Sensitivity { get; }`**
`Channel.SensorSensitivity`.
- **`string SensitivityString { get; }`**
Formatted sensitivity string (`N12`).
- **`bool IsActive { get; }`**
`true` if `Channel` is non-null and (not digital output or has non-`NONE` mode).
- **`double Capacity { get; }`**
`Channel.SensorCapacity`.
- **`double Range { get; set; }`**
Gets/sets `Channel.ChannelRange`.
- **`double CableMultiplier { get; set; }`**
Gets/sets `Channel.CableMultiplier`.
- **`double SquibFireDelayMs { get; set; }`**
Gets/sets `Channel.SquibFireDelayMs`.
- **`double SquibFireCurrent { get; set; }`**
Gets/sets `Channel.SquibFireCurrent`.
- **`bool LimitDuration { get; set; }`**
Gets/sets `Channel.LimitDuration`.
- **`double SquibFireDurationMs { get; set; }`**
Gets/sets `Channel.SquibFireDurationMs` (clamped to min/max).
- **`double SquibFireResistanceLowOhm { get; set; }`**
Gets/sets `Channel.SquibFireResistanceLowOhm`.
- **`double SquibFireResistanceHighOhm { get; set; }`**
Gets/sets `Channel.SquibFireResistanceHighOhm`.
- **`IHardwareChannel HardwareChannel { get; }`**
Wrapped hardware channel instance.
- **`void SetITTSChannelRecord(ITTSChannelRecord channel)`**
Assigns/unassigns sensor to hardware; updates all dependent properties.
#### `TTSChannelRecord`
- **`int ChannelNumber { get; set; }`**
TTS channel number.
- **`string ChannelCode { get; set; }`**
Channel code (e.g., `"1650"`); raises validation flags in `Parent`.
- **`string JCodeOrDescription { get; set; }`**
J-code or description; sets `IsJCodeValid`.
- **`double ChannelRange { get; set; }`**
Channel range (e.g., 05V); sets `IsRangeValid`.
- **`string ChannelRangeString { get; set; }`**
String representation of `ChannelRange`; parses to `ChannelRange`.
- **`int ChannelFilterHz { get; set; }`**
Filter cutoff in Hz (e.g., 1650, 1000, 300, 100, 17); sets `IsFilterValid`.
- **`string FilterString { get; set; }`**
String representation of filter; validates against known values.
- **`string SensorSerialNumber { get; set; }`**
Sensor serial number.
- **`string SensorEID { get; set; }`**
Electronic ID of sensor.
- **`double SensorSensitivity { get; set; }`**
Sensor sensitivity.
- **`double SensorExcitationVolts { get; set; }`**
Excitation voltage.
- **`double SensorCapacity { get; set; }`**
Sensor capacity.
- **`string SensorEU { get; set; }`**
Engineering unit label.
- **`bool SensorPolarity { get; set; }`**
`true` = positive polarity.
- **`ToyotaBridgeType ChannelType { get; set; }`**
Channel type enum (e.g., `FullBridge`, `HalfBridge`, `IRTRACC`).
- **`string Description { get; set; }`**
Sensor description.
- **`bool ProportionalToExcitation { get; set; }`**
Whether sensitivity is proportional to excitation.
- **`double BridgeResistance { get; set; }`**
Bridge resistance (ohms).
- **`double InitialOffsetVoltage { get; set; }`**, **`InitialOffsetVoltageTolerance { get; set; }`**
Offset voltage and tolerance.
- **`bool RemoveOffset { get; set; }`**
Whether to remove initial offset.
- **`ToyotaZeroMethods ZeroMethod { get; set; }`**
Zeroing method enum.
- **`double CableMultiplier { get; set; }`**
Cable gain multiplier.
- **`double InitialEUInMV { get; set; }`**, **`InitialEUInEU { get; set; }`**
Initial offset in mV and EU.
- **`double IRTraccExponent { get; set; }`**, **`PolynomialConstant { get; set; }`**, etc.
Non-linear calibration coefficients.
- **`string ISOCode { get; set; }`**, **`ISODescription { get; set; }`**, **`ISOPolarity { get; set; }`**
ISO 14229-related fields.
- **`bool IsSquib { get; set; }`**, **`IsDigitalInput { get; set; }`**, **`IsDigitalOutput { get; set; }`**
Channel type flags.
- **`IHardwareChannel HardwareChannel { get; set; }`**
Assigned hardware channel.
- **`bool IsEmptyRecord { get; }`**
`true` if `ChannelCode == "None"` and `SensorSerialNumber` is whitespace.
- **`bool IsChannelCodeValid { get; set; }`**, **`IsJCodeValid { get; set; }`**, **`IsRangeValid { get; set; }`**, **`IsFilterValid { get; set; }`**
Validation flags.
- **`bool Disabled { get; set; }`**
Channel disabled flag.
- **`SquibFireMode SquibFireMode { get; set; }`**
Squib fire mode.
- **`double SquibFireDelayMs { get; set; }`**
Squib fire delay.
- **`double SquibFireCurrent { get; set; }`**
Squib current limit.
- **`bool LimitDuration { get; set; }`**
Squib duration limiting flag.
- **`double SquibFireDurationMs { get; set; }`**
Squib fire duration (clamped to min/max).
- **`double SquibFireResistanceLowOhm { get; set; }`**, **`SquibFireResistanceHighOhm { get; set; }`**
Squib resistance tolerance.
- **`DigitalInputModes DigitalInputMode { get; set; }`**
Digital input mode.
- **`DigitalOutputModes DigitalOutputMode { get; set; }`**
Digital output mode.
- **`double DigitalOutputDelay { get; set; }`**, **`DigitalOutputDuration { get; set; }`**
Digital output timing.
- **`bool DiagnosticsMode { get; set; }`**
Diagnostics