HIC accuracy and performance¶
Module: crashmetrics.pedestrian.hic (calculate_hic).
HIC is a maximum over all intervals [t1, t2] no longer than the window
(15 or 36 ms):
Protocols define this formula but not how to search for the maximum.
calculate_hic offers two methods. Both treat the record as linearly
interpolated between samples, and both integrate that signal exactly.
| Method | End points searched | Result | Use |
|---|---|---|---|
"grid" (default) |
A uniform grid (resolution_ms, 0.1 ms by default), the samples and the points one window before them |
Lower bound of the exact value, usually within 0.05 % | Everyday post-processing, batch runs |
"exact" |
Continuous: any t1, t2 |
The maximum for the interpolated signal, to rounding | Reference values, verification, tie-breaking near a limit |
from crashmetrics.pedestrian import calculate_hic
calculate_hic(t, a_res) # grid search, 0.1 ms
calculate_hic(t, a_res, method="exact") # exact maximum
How the exact method works¶
On each pair of linear segments the integral is a quadratic in t1 and
t2, so HIC is smooth there and its maximum is one of:
- an interior stationary point, where
a(t1) = a(t2) = 0.6 * (integral / duration); - a window-length interval (
t2 - t1equal to the window), wherea(t1) = a(t2); - an interval starting or ending at the record limits;
- a corner of these cases (a sample or a sample one window away).
On linear segments every condition reduces to a quadratic equation, solved in closed form. Candidate segment pairs are pruned by a branch-and-bound bound (an upper limit of HIC from the largest acceleration and the integral over a block), seeded with the grid result, so long records stay fast.
Verification¶
- Closed forms. Constant acceleration gives
window * a^2.5. A symmetric triangle of peakPand half widthThas its optimum at the interval of half width4T/7around the peak, withHIC = (8T/7) (5P/7)^2.5. The exact method reproduces both to1e-10and finds the end points to1e-12s. - Independent searches. On random piecewise-linear signals, the exact value was never below the grid result, a brute-force search of all pairs of a 0.01 ms grid, or a multistart Nelder-Mead optimisation (40 signals during development, 8 in the test suite).
- Consistency. The value equals HIC recomputed independently from
the returned
start_timeandend_time.
The tests are in tests/test_hic_exact.py and
tests/test_hic_reference.py.
Accuracy of the grid search¶
Relative shortfall of the grid search against the exact HIC15, for pulses sampled at 10 kHz (the last one is a real LS-DYNA nodout of a helmeted Hybrid III head drop, CFC 1000):
| Pulse | Exact HIC15 | 0.4 ms | 0.2 ms | 0.1 ms | 0.05 ms |
|---|---|---|---|---|---|
| Half-sine 120 g, 10 ms | 653.94 | 2.3e-4 | 2.3e-4 | 2.3e-4 | 1.1e-7 |
| Triangle 90 g, 8 ms | 151.47 | 2.7e-5 | 2.7e-5 | 2.7e-5 | 2.7e-5 |
| Double peak 70 + 95 g | 255.21 | 4.2e-4 | 4.2e-4 | 4.2e-4 | 3.7e-6 |
| Long low pulse 45 g, 30 ms | 156.71 | 0 | 0 | 0 | 0 |
| Helmet drop (real nodout) | 194.62 | 7.4e-5 | 7.4e-5 | 7.4e-5 | 7.4e-5 |
- At 10 kHz the samples are themselves candidates, so resolutions of 0.1 ms and coarser give the same result; a finer grid adds points between the samples.
- On smooth pulses the shortfall is below 0.05 %, far below test scatter. On rough random signals with few samples it reached 0.6 %.
- The grid result is always a lower bound: if it is just under a limit,
the exact value may be just over it. Use
method="exact"there.
Run time¶
A half-sine pulse in records of different length, Python 3.13 on one core of a 2.1 GHz Xeon (indicative only):
| Samples | Sample rate | Grid, 0.1 ms | Exact |
|---|---|---|---|
| 1 500 | 10 kHz | 0.01 s | 0.02 s |
| 6 000 | 20 kHz | 0.09 s | 0.13 s |
| 100 000 | 100 kHz | 0.08 s | 0.5 s |
| 250 000 | 500 kHz | 0.04 s | 8 s |
The grid search is vectorised over the interval length; version 0.15.0 needed 5.4 s for 100 000 samples. Records of more than 20 000 samples that are over four times as dense as the grid use the grid points only as candidates (the integral stays exact), so very long, densely sampled records stay fast. The exact method needs memory in proportion to the record (about 70 MB for 250 000 samples).
Reproduce¶
"""HIC numerical convergence: the grid search against the exact maximum.
For several pulse shapes, HIC15 from the grid search at different
resolutions is compared with the exact maximum over continuous end
points (``method="exact"``), and both are timed on long records.
Run times depend on the computer; the relative errors do not.
"""
import time
from pathlib import Path
import numpy as np
from crashmetrics.lsdyna import read_nodout
from crashmetrics.pedestrian import calculate_hic
from crashmetrics.signals import cfc_filter, resample_uniform
t = np.arange(0.0, 0.05, 1e-4) # 10 kHz, like CAE output
def half_sine(peak, start, width):
phase = (t - start) / width
return np.where((phase > 0) & (phase < 1), peak * np.sin(np.pi * phase), 0.0)
def helmet_drop():
"""Real LS-DYNA nodout: helmeted Hybrid III head CG, CFC 1000 (tests/data)."""
data = Path(__file__).resolve().parents[1] / "tests/data/lsdyna/helmet/drop/nodout"
n = read_nodout(data)
axes = []
for c in "xyz":
tu, au = resample_uniform(n.time / 1000, n.channel(f"{c}_acceleration")
* 1000 / 9.80665, 10_000.0)
axes.append(cfc_filter(tu, au, 1000))
return tu, np.sqrt(sum(x * x for x in axes))
pulses = {
"half-sine 120 g, 10 ms": (t, half_sine(120.0, 0.005, 0.010)),
"triangle 90 g, 8 ms": (t, np.interp(t, [0.0, 0.010, 0.014, 0.018, 0.05],
[0.0, 0.0, 90.0, 0.0, 0.0])),
"double peak 70 + 95 g": (t, half_sine(70.0, 0.004, 0.006)
+ half_sine(95.0, 0.012, 0.007)),
"long low pulse 45 g, 30 ms": (t, half_sine(45.0, 0.005, 0.030)),
"helmet drop (real nodout)": helmet_drop(),
}
resolutions = (0.4, 0.2, 0.1, 0.05)
print("HIC numerical convergence study")
print("Relative error of the grid search vs the exact HIC15")
print(f"{'pulse':28} {'exact HIC15':>11} "
+ " ".join(f"{r:>7} ms" for r in resolutions))
for name, (tt, aa) in pulses.items():
exact = calculate_hic(tt, aa, method="exact").value
errors = [(exact - calculate_hic(tt, aa, resolution_ms=r).value) / exact
for r in resolutions]
print(f"{name:28} {exact:11.2f} " + " ".join(f"{e:10.1e}" for e in errors))
print("\nRun time, half-sine pulse in records of different length (indicative)")
print(f"{'samples':>9} {'rate':>8} {'grid 0.1 ms':>12} {'exact':>9}")
for duration, rate in ((0.15, 10e3), (0.3, 20e3), (1.0, 100e3), (0.5, 500e3)):
tt = np.arange(0.0, duration, 1.0 / rate)
aa = 120.0 * np.where((tt > 0.02) & (tt < 0.03), np.sin(np.pi * (tt - 0.02) / 0.01),
0.0)
timings = []
for method in ("grid", "exact"):
start = time.perf_counter()
calculate_hic(tt, aa, method=method)
timings.append(time.perf_counter() - start)
print(f"{len(tt):9d} {rate / 1000:6.0f} kHz "
f"{timings[0]:10.3f} s {timings[1]:7.3f} s")
References¶
- J. Versace (1971). A review of the severity index. SAE 710881.
- SAE J1727. Injury Calculations Guidelines.