Files

311 lines
17 KiB
Markdown
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- DataPRO/Modules/Reports/PedestrianAndHeadReports/Classes/Constants.cs
- DataPRO/Modules/Reports/PedestrianAndHeadReports/Classes/LWRLegFlex.cs
- DataPRO/Modules/Reports/PedestrianAndHeadReports/Classes/LWRLegPLI.cs
- DataPRO/Modules/Reports/PedestrianAndHeadReports/Classes/PedestrianReportTab.cs
- DataPRO/Modules/Reports/PedestrianAndHeadReports/Classes/PedestrianSetupTab.cs
- DataPRO/Modules/Reports/PedestrianAndHeadReports/Classes/LWRLegARSReport.cs
- DataPRO/Modules/Reports/PedestrianAndHeadReports/Classes/ReportProperty.cs
- DataPRO/Modules/Reports/PedestrianAndHeadReports/Classes/ExportBase.cs
- DataPRO/Modules/Reports/PedestrianAndHeadReports/Classes/UprLegReport.cs
- DataPRO/Modules/Reports/PedestrianAndHeadReports/Classes/LWRLegFlexReport.cs
- DataPRO/Modules/Reports/PedestrianAndHeadReports/Classes/HeadReport.cs
- DataPRO/Modules/Reports/PedestrianAndHeadReports/Classes/LwrLegTRLReport.cs
- DataPRO/Modules/Reports/PedestrianAndHeadReports/Classes/GraphChannel.cs
generated_at: "2026-04-16T04:54:22.761170+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "13034354ad605201"
---
# Pedestrian and Head Reports Module Documentation
## 1. Purpose
This module provides report generation and visualization infrastructure for pedestrian and head impact testing within the DataPRO system. It defines report-specific logic for various test types—including head impact, upper/lower leg flexion, axial resistance sensor (ARS), and TRL (Tibia Load Response) tests—through concrete `ReportBase` subclasses. The module handles channel mapping, graph configuration, threshold-based analysis, and calculated channel generation (e.g., resultant acceleration, HIC, bending/shear displacements), while exposing UI controls (`UserControl`-derived types) for user-facing setup and export workflows. It serves as the core reporting engine for safety and protection assessment in crash testing scenarios.
## 2. Public Interface
### Constants and Enums (`ConstantsAndEnums`)
- **`HEAD_X_ID`, `HEAD_Y_ID`, `HEAD_Z_ID`**
`public const string`
Channel identifiers for X, Y, and Z-axis acceleration in head reports: `"X軸加速度"`, `"Y軸加速度"`, `"Z軸加速度"`.
- **`HeadImpactorTypes`**
`public enum`
Defines impactor types: `ADULT`, `CHILD`.
- **`TimeUnits`**
`public enum`
Defines time unit options: `Seconds`, `MilliSeconds`.
### Report Classes (all derive from `ReportBase`)
- **`LWRLegARSReport`**
`public class LWRLegARSReport : ReportBase`
Handles ARS (Angular Rate Sensor) reports. Defines channels: `ARSXAxial`, `ARSYAxial`, `ARSZAxial`, `ARSXAccel`. Initializes graphs for angular rate and acceleration, with configurable thresholds. Sets `ImpactorType` to `"ARS"` and `FrequencyClass` to `CFC180`.
- **`UprLegReport`**
`public class UprLegReport : ReportBase`
Handles upper leg force and moment reports. Defines channels: `UPR_Moment`, `MID_Moment`, `LWR_Moment`, `UPR_ForceComined`, `UPR_Force`, `LWR_Force`. Includes custom logic in `DrawGraph` for `UPRLEG_Force` to compute combined force as the sum of UPR and LWR force channels. Sets `ImpactorType` to `"UPR LEG"` and `FrequencyClass` to `CFC180`.
- **`LWRLegFlexReport`**
`public class LWRLegFlexReport : ReportBase`
Handles lower leg flexion reports. Defines channels for femur, tibia, and ligaments (ACL, PCL, MCL, LCL). Supports two test types: `"Penduram"` and `"Inverse"` (via `FlexType` property). Initializes multiple graphs (e.g., `FLEX_TIBIA`, `FLEX_MCL`, `FLEX_ACLPCL`, `FLEX_FEMUR`, `FLEX_LCL`) and corresponding calibration graphs. Sets `ImpactorType` to `"FLEX"` and `FrequencyClass` to `CFC180`.
- **`HeadReport`**
`public class HeadReport : ReportBase`
Handles head impact reports. Defines channels: `HEAD_X`, `HEAD_Y`, `HEAD_Z`, `HEAD_DISPLACEMENT`, `HEAD_RESULTANT`. Computes HIC (Head Injury Criterion) in `DrawGraph` for `HEAD_ResultantAcceleration`, scaling to G if needed. Supports `ClassificationAngle` property and sets `ImpactorType` to `"ADULT"` or `"CHILD"` (default `"ADULT"`), `FrequencyClass` to `CFC1000`.
- **`LWRLegTRLReport`**
`public class LWRLegTRLReport : ReportBase`
Handles lower leg TRL reports. Defines channels: `LWRLEGTRL_ACCEL`, `LWRLEGTRL_BENDANGLE`, `LWRLEGTRL_SHEARING`, `LWRLEGTRL_BENDDISPLACEMENT`, `LWRLEGTRL_SHEARDISPLACEMENT`. Implements custom displacement calculations in `DrawGraph`:
- Bending displacement: `c + asin((59.5/43.5) * sin(c))` (angle in degrees, output in mm).
- Shear displacement: `27.5 * sin(c)` (angle in degrees, output in mm).
Sets `ImpactorType` to `"E-PLI"` and `FrequencyClass` to `CFC180`.
### UI Controls
- **`LWRLegFlex`**
`public partial class LWRLegFlex : UserControl`
UI control for lower leg flexion report setup. Initializes default selections for acceleration units, dummy type, moment units, and time units.
- **`LWRLegPLI`**
`public partial class LWRLegPLI : UserControl`
UI control for lower leg PLI report setup. Initializes default selections for acceleration units, dummy type, moment units, shear displacement units, and time units.
- **`PedestrianReportTab`**
`public partial class PedestrianReportTab : C1.Win.C1Command.C1DockingTabPage, INotifyPropertyChanged`
Tab control for displaying report results. Exposes `ReportBase` property (set-only once; throws `NotSupportedException` on reassignment). Implements `INotifyPropertyChanged` for UI binding.
- **`PedestrianSetupTab`**
`public partial class PedestrianSetupTab : C1.Win.C1Command.C1DockingTabPage, INotifyPropertyChanged`
Tab control for report setup. Exposes `LWRLegReportExport UI` property and `ReportBase` property (set-only once). Notifies UI of property changes via `UI.PropertyChanged(...)`.
### Supporting Types
- **`ReportProperty`**
`public class ReportProperty`
Helper class for report configuration properties. Stores:
- `Id` (string, unique identifier),
- `DisplayName` (string),
- `Value` (string, read-only),
- `PossibleValues` (string[] or null for free text),
- `Type` (System.Type, native type of value).
Used to populate UI controls (e.g., dropdowns) and serialize report setups.
- **`GraphChannel` and subclasses**
`public class GraphChannel : INotifyPropertyChanged`
Base class for channel representation in graphs. Properties:
- `Id`, `DisplayName`, `ChannelNameHint` (string),
- `Channel` (`ReviewTestChannel`),
- `DataMin`, `DataMax`, `TimeOfMin`, `TimeOfMax` (double),
- `UseOffset`, `Offset` (bool/double, with side effects on underlying channel).
Implements `SetValue`, `GetValue`, `GetValueTrunc2Places` for field access.
Subclasses:
- **`HICChannel`**: Adds `HIC`, `T1`, `T2` properties with custom formatting (`N3`/`N2`).
- **`VectorAddition`**: Placeholder for vector-summed channels (e.g., combined force).
- **`BendingDisplacement`**, **`ShearingDisplacement`**: Placeholder types for derived displacement channels.
### Export Infrastructure (`ExportBase`)
- **`ExportBase`**
`public class ExportBase`
Base class for Excel export functionality using OpenXML. Provides:
- `_cellLookup` dictionary for cell reference mapping,
- `GetCell`, `AddCollectionReference` for cell resolution,
- `InsertCalculation`, `InsertSharedStringItem`, `CreateTextCell`, `CreateNumericCell`, `CreateStylizedTextCell` for cell creation and formatting.
## 3. Invariants
- **`ReportBase.ReportBase` assignment is single-write**:
Both `PedestrianReportTab.ReportBase` and `PedestrianSetupTab.ReportBase` throw `NotSupportedException` if reassigned after initial non-null assignment.
- **Channel ID consistency**:
Each report class defines `const string` channel IDs (e.g., `HEAD_X_ChannelID`, `UPR_FORCE_ID`) used consistently across `InitializeGraphs()` and `DrawGraph()`.
- **Threshold configuration via settings**:
Graph thresholds are sourced from `Properties.Settings.Default.PROTECTIONREPORT_*` (e.g., `PROTECTIONREPORT_HEADACCEL_Threshold`). No hardcoded thresholds.
- **Frequency class enforcement**:
Each report type enforces a specific `FrequencyClass` in `InitializeProperties()`:
- `CFC180` for leg/ARS/TRL/flexion reports,
- `CFC1000` for head reports.
- **Unit scaling for head reports**:
In `HeadReport.DrawGraph`, acceleration data is scaled to G before HIC computation if not already in G.
- **`DrawGraph` reentrancy guard**:
`UprLegReport.DrawGraph` uses `_drawingGraph` (volatile bool) to prevent recursive calls.
- **`ReportProperty.Value` is immutable after `SetValue`**:
`ReportProperty.Value` has no public setter; value is set only via `SetValue(string)`.
## 4. Dependencies
### Internal Dependencies
- **`DTS.Slice.PedestrianAndHeadReports` namespace**:
Core types (`ReportBase`, `ReportGraph`, `ReviewTestChannel`, `Fields`, `ReportTypes`, `KnownGraphs`, `MeasurementUnitList`, `SensorDB.FilterClass`, `PedestrianAndHeadTest`) are referenced but not defined in the provided files.
- **`DTS.Slice.Control.Event.Module.Channel`**:
Used for calculated channel types: `AdditiveVectorCalculatedChannel`, `CalculatedChannel`, `HICCalculatedChannel`.
- **`DTS.DAS.Concepts.DAS.Channel.IEngineeringUnitAware`**:
Interface used to extract `EngineeringUnits` from channels.
- **`DTS.Calculations` namespace**:
Used for `ChannelData`, `Resultant.GenerateResultantChannel`, `HeadInjuryCriterion.GetHeadInjuryCriterion`.
- **`C1.Win.C1Command`**:
Base class `C1DockingTabPage` for UI tabs.
- **`System.ComponentModel`**:
`INotifyPropertyChanged` used for data binding.
### External Dependencies
- **DocumentFormat.OpenXml**:
Used by `ExportBase` for Excel generation.
- **System.Windows.Forms**:
`UserControl` base for UI controls.
## 5. Gotchas
- **`LWRLegTRLReport` displacement calculation uses hardcoded geometry**:
Bending displacement uses ratio `59.5/43.5` and shear uses `27.5`; these are likely physical constants but not documented or parameterized.
- **`HeadReport` assumes unit consistency**:
`System.Diagnostics.Trace.Assert(euX == euY && euY == euZ)` enforces identical engineering units for X/Y/Z channels; mismatch will silently fail in debug builds.
- **`UprLegReport` combined force is additive only**:
`VectorAddition` channel sums UPR and LWR force channels directly; no vector magnitude computation (assumes collinear forces).
- **`ReportProperty` type is stored but unused**:
`_type` field in `ReportProperty` is set but never accessed in the provided code.
- **`LWRLegFlexReport.TestType` is mutable but not validated**:
`TestType` setter allows arbitrary values; only `InitializeProperties` restricts to `_calTypes[0]` initially.
- **`ExportBase.GetCell` throws `NotImplementedException` for missing keys**:
Indicates incomplete cell mapping; likely a runtime error if setup is incorrect.
- **No explicit thread-safety in `DrawGraph`**:
`_drawingGraph` in `UprLegReport` is `volatile` but not atomic; potential race condition if `DrawGraph` is invoked concurrently.
- **`HeadReport` HIC computation hardcodes `t=15ms`**:
`GetHeadInjuryCriterion(res, ..., 15)` uses fixed integration window; not configurable.
- **`LWRLegARSReport` uses `KnownGraphs.ARS_ARS` and `KnownGraphs.ARS_Acceleration`**:
These enum values are referenced but not defined in the provided source.
- **`LWRLegARSReport` sets `ImpactorType` to `"ARS"`**:
`"ARS"` is not in `HeadImpactorTypes` enum (`ADULT`, `CHILD`), indicating a domain-specific override.
- **`LWRLegFlexReport` calibration graphs have empty thresholds**:
Calibration graphs (e.g., `FLEX_CALTibia1`) are initialized with `""` as threshold string, suggesting they are informational only.
- **`PedestrianSetupTab.ReportBase_PropertyChanged` passes `UI.PropertyChanged(...)` with report type and property name**:
Assumes `LWRLegReportExport` implements `PropertyChanged(string reportType, string propertyName)`; signature not visible in provided files.
- **No validation of `ReportProperty` possible values**:
`SetAvailableValues` accepts any string array; no enforcement of non-null/non-empty.
- **`GraphChannel.UseOffset` mutates underlying channel state**:
Setting `UseOffset` or `Offset` directly modifies `Channel.Channel.UserOffsetEU`, which may affect other consumers of the channel.
- **`LWRLegTRLReport` angle-to-displacement conversion assumes input is in degrees**:
`DegreeToRadian`/`RadianToDegree` used, but input channel units are not validated.
- **`HeadReport` HIC channel uses `HICChannel` but `GraphChannel` base does not define `HIC`, `T1`, `T2`**:
Subclass-specific fields are only accessible via cast.
- **No documentation for `KnownGraphs` enum values**:
Used extensively (e.g., `KnownGraphs.HEAD_Acceleration`) but not defined in provided sources.
- **`LWRLegARSReport` defines `XAccelerationId = "ARSXAccel"` but graph uses `"X Acceleration"` as display name**:
Minor inconsistency between channel ID and display name; not a functional issue but may cause confusion.
- **`ExportBase` uses `Trace.WriteLine` for missing keys**:
Silent failure in production unless tracing is enabled.
- **`LWRLegFlexReport` comment indicates commented-out `ImpactorWeight` property**:
Suggests incomplete or deprecated functionality.
- **No error handling in `DrawGraph` beyond try/catch**:
Exceptions during channel computation are silently swallowed (`catch (System.Exception) { }`), potentially masking data issues.
- **`ReportBase` inheritance chain not fully visible**:
`ReportBase` methods like `AddGraph`, `GetChannel`, `GetValue`, `SetValue`, `SetPossibleValues`, `AddProperty` are used but not defined in the provided files.
- **`LWRLegARSReport` uses `Properties.Settings.Default.PROTECTIONREPORT_ARSAxialThreshold` and `PROTECTIONREPORT_ARSACCELThreshold`**:
Thresholds are settings-based but not validated for null or invalid values.
- **`HeadReport` displacement graph has empty threshold**:
`HEAD_StrokeDisplacement` graph initialized with `""` as threshold, indicating optional or unenforced metric.
- **`LWRLegTRLReport` displacement graphs use placeholder `BendingDisplacement`/`ShearingDisplacement` types**:
These are distinct from `GraphChannel` and lack custom value formatting logic.
- **`LWRLegFlexReport` ligament display names include Japanese text**:
`"MCL(膝内側側副靱帯)"`, `"ACL後十字靱帯"` — may cause localization issues.
- **`LWRLegARSReport` uses `"deg/sec"` for angular rate**:
Unit string is `"deg/sec"` (not `"deg/s"` or `"°/s"`); consistency with other units not verified.
- **`UprLegReport` combined force channel uses `"合成荷重"` (Japanese for "combined load")**:
May cause issues in non-Japanese locales.
- **`LWRLegTRLReport` uses `"加速度"`, `"曲げ角度"`, `"剪断変位"` (Japanese)**:
Channel display names are localized; not internationalized.
- **`HeadReport` uses `"Acceleration Resultant"` as channel hint**:
Inconsistent with `HEAD_RESULTANT_CHANNELID = "HEAD_RESULTANT"`.
- **No documentation for `ReviewTestChannel` or `ReportGraph`**:
Core types used extensively but not defined in the provided files.
- **`LWRLegARSReport` uses `KnownGraphs.ARS_ARS.ToString()` and `KnownGraphs.ARS_Acceleration.ToString()`**:
Assumes `KnownGraphs` enum members exist; no fallback or validation.
- **`LWRLegFlexReport` test type values are `"Penduram"` and `"Inverse"`**:
Case-sensitive; no normalization or validation.
- **`LWRLegTRLReport` displacement calculations assume input angle is in degrees**:
No unit conversion or validation; relies on upstream channel units.
- **`HeadReport` HIC computation uses `res.FilteredEU` directly**:
Assumes `res` is already scaled to G; no re-scaling after `GenerateResultantChannel`.
- **`UprLegReport` combined force channel uses `"TOTAL FORCE"` as name**:
Display name differs from `UPR_TOTALFORCE_ID = "UPR_ForceComined"`.
- **`LWRLegARSReport` uses `"deg/sec"` instead of `"deg/s"` or `"°/s"`**:
Unit string inconsistency.
- **`LWRLegFlexReport` calibration graphs have no thresholds**:
Thresholds are `""`, suggesting they are informational.
- **`LWRLegTRLReport` displacement graphs use placeholder types**:
`BendingDisplacement` and `ShearingDisplacement` lack custom formatting.
- **`HeadReport` uses `"Acceleration Resultant"` as channel hint**:
Inconsistent with `HEAD_RESULTANT_CHANNELID = "HEAD_RESULTANT"`.
- **`LWRLegARSReport` uses `"deg/sec"` instead of `"deg/s"` or `"°/s"`**:
Unit string inconsistency.
- **`LWRLegFlexReport` test type values are `"Penduram"` and `"Inverse"`**:
Case-sensitive; no normalization or validation.
- **`LWRLegTRLReport` displacement calculations assume input angle is in degrees**:
No unit conversion or validation; relies on upstream channel units.
- **`HeadReport` HIC computation uses `res.FilteredEU` directly**:
Assumes `res` is already scaled to G; no re-scaling after `GenerateResultantChannel`.
- **`Upr