Intrusion measurement¶
Module: crashmetrics.intrusion.
How far did the pedal, the steering column, the toe pan or the A-pillar move into the occupant space? The answer depends entirely on what you measure against. The vehicle itself moves, pitches and yaws during a crash, so a node's displacement in the global (ground) system is mostly vehicle motion. This module measures intrusions every common way, from CAE time histories and from static before/after test measurements.
| You have | Use | Measures |
|---|---|---|
| A node and the vehicle's undeformed rear structure | intrusion(point, reference_nodes) (3 or more nodes) |
Intrusion relative to the vehicle: translation and rotation removed |
| A node and one reference node | intrusion(point, reference_node) |
Displacement relative to that node: translation removed, rotation not |
| A node only | intrusion(point) |
Displacement in the global system (barriers, impactors, sleds) |
| Two nodes | node_distance(a, b) |
Change in the distance between them: survival space, gaps |
| Before/after coordinates from a test | Any of the above with two rows | Static (residual) intrusion |
| Many points | intrusions({name: point}, reference) |
A result per point, ready for a table |
Step 1: get the coordinates¶
Each point is an array of shape (n, 3): one row per time step, columns
x, y, z, in any length unit (the results use the same unit).
from crashmetrics.intrusion import node_track
pedal = node_track(x, y, z) # coordinate columns
pedal = node_track(ux, uy, uz, initial=(2350.0, 350.0, 250.0)) # displacements
LS-DYNA nodout holds both coordinates and displacements per node;
either form works:
from crashmetrics.lsdyna import read_nodout
nodout = read_nodout("run01/nodout")
t = nodout.time / 1000.0 # ms -> s
pedal = node_track(*(nodout.channel(f"{c}_coordinate", 501) for c in "xyz"))
Step 2: choose the reference¶
from crashmetrics.intrusion import intrusion
reference = [seat_cross_member, b_pillar_left, b_pillar_right, sill_rear]
r = intrusion(pedal, reference, time=t, direction="-x")
Three or more reference nodes on structure that stays undeformed (rear seat cross member, B-pillar bases, rear sills, tunnel). At every time step the best rigid fit of these nodes to their initial positions gives the vehicle's translation and rotation, and the point's displacement is measured in the vehicle's axes. This is what a test measurement relative to reference points on the body does.
Removes the reference node's translation only. Any pitch or yaw of the vehicle adds an error that grows with the distance from the reference node: in the example, 3° of pitch over 1.4 m gives about 65 mm of false upward intrusion. Use it only for a nearby reference or when the vehicle does not rotate.
Check the reference
r.reference_fit_error is the largest RMS distance of the
reference nodes from their rigid fit. Near 0 means they moved
rigidly; several millimetres means a reference node deforms, so
choose others. Spread the reference nodes widely: measurement noise
is amplified by the ratio of the distance to the point and the
spread of the reference nodes.
Step 3: directions, dynamic and static values¶
r = intrusion(pedal, reference, time=t, direction="-x") # x forward: -x is rearward
r.along_dynamic, r.t_along_ms # largest rearward intrusion and when (CAE)
r.along_static # final (residual) value, after springback
r.x_static, r.y_static, r.z_static, r.resultant_static
r.x_dynamic, r.resultant_dynamic, r.t_dynamic_ms
r.displacement # full (n, 3) history, for plots
| Value | Meaning |
|---|---|
*_dynamic |
Peak during the event: the signed component with the largest magnitude, the largest resultant, or the largest value along direction |
*_static |
Final value: the residual deformation after springback (the last sample, or the mean over the last static_window_ms) |
along_* |
Displacement projected on direction; positive means in that direction |
direction is a vector or "x", "-x", "y", "-y", "z",
"-z" in the reference's initial (vehicle) axes. Check your model's
axes. With x forward and z up: rearward is "-x", upward "z". With
x rearward (common in CAE models): rearward is "x".
CAE gives both values; a test measured before and after gives only the
static value. CAE results stop at the end time, so springback may not
be complete; static_window_ms averages the last part of the record to
smooth oscillation.
Step 4: distances and survival space¶
from crashmetrics.intrusion import node_distance
gap = node_distance(steering_wheel_hub, seat_h_point, time=t)
gap.initial, gap.minimum, gap.t_minimum_ms, gap.final
gap.closing_dynamic, gap.closing_static
A distance does not depend on any reference frame, so it is the simplest robust measure for survival space (steering wheel to seat, roof to head position, door inner panel to seat) and for gaps that must not close.
Step 5: many points and the rating¶
from crashmetrics.intrusion import intrusions
from crashmetrics.bncap import pedal_blocking_modifier, steering_column_modifier
results = intrusions(
{"brake_pedal": pedal, "steering_column": column, "a_pillar": pillar},
reference, time=t,
direction={"brake_pedal": "-x", "steering_column": "-x", "a_pillar": "-x"},
)
col = results["steering_column"]
steering_column_modifier(rearward=col.along_static, upward=col.z_static,
lateral=abs(col.y_static))
pedal_blocking_modifier(results["brake_pedal"].along_static)
The Bharat NCAP modifiers in crashmetrics.bncap take the steering
column, A-pillar and pedal displacements directly. Use the value your
protocol specifies (post-test static or dynamic) and the measurement
points it defines. flatten(results) turns all values into columns
such as brake_pedal.along_static for a feature table.
Complete example¶
An offset frontal crash in which the vehicle moves 700 mm, pitches 3° and yaws 2° while five points deform. It compares the three references, lists all points, checks survival space, repeats the measurement as a noisy static test measurement, and applies the Bharat NCAP modifiers:
"""Example 13: intrusion measurement, CAE (dynamic) and test (static).
Synthetic offset frontal crash. The vehicle moves 700 mm forward,
pitches 3 deg and yaws 2 deg while the footwell, pedal, steering column
and A-pillar deform. Vehicle axes: x forward, y left, z up, mm.
"""
import math
import numpy as np
from crashmetrics.bncap import (
a_pillar_modifier,
pedal_blocking_modifier,
pedal_upward_modifier,
steering_column_modifier,
)
from crashmetrics.features import flatten
from crashmetrics.intrusion import intrusion, intrusions, node_distance
t = np.arange(0.0, 0.1501, 0.0005) # s, 0.5 ms output
ramp = np.clip(t / 0.09, 0.0, 1.0) # deformation 0..90 ms
settle = np.clip((t - 0.09) / 0.03, 0.0, 1.0) # springback 90..120 ms
def rotation(fraction):
pitch, yaw = math.radians(-3.0) * fraction, math.radians(2.0) * fraction
cp, sp, cy, sy = math.cos(pitch), math.sin(pitch), math.cos(yaw), math.sin(yaw)
r_pitch = np.array([[cp, 0, sp], [0, 1, 0], [-sp, 0, cp]])
r_yaw = np.array([[cy, -sy, 0], [sy, cy, 0], [0, 0, 1]])
return r_yaw @ r_pitch
def mm(value):
"""Round for printing; turns -0.0 from round-off noise into 0.0."""
return round(value, 6) + 0.0
def move(point0, local=None):
"""Rigid vehicle motion plus an optional local deformation (n, 3)."""
out = np.empty((t.size, 3))
for i, f in enumerate(ramp):
p = point0 + (0.0 if local is None else local[i])
out[i] = rotation(f) @ p + np.array([700.0, -40.0, -15.0]) * f
return out
def deformation(rearward, upward, lateral=0.0, springback=0.15):
"""Local deformation (x, y, z): peaks at 90 ms, springs back 15 %."""
shape = np.sin(np.pi / 2 * ramp) * (1 - springback * settle)
return np.column_stack([-rearward * shape, lateral * shape, upward * shape])
# Undeformed positions (vehicle axes) and their local deformation
nodes = {
"brake_pedal": (np.array([2350.0, 350.0, 250.0]), deformation(140, 56, -8)),
"steering_column": (np.array([1950.0, 370.0, 700.0]), deformation(76, 60, 12)),
"a_pillar": (np.array([2050.0, 760.0, 650.0]), deformation(120, 10, 6)),
"toe_pan_left": (np.array([2500.0, 500.0, 150.0]), deformation(190, 70)),
"toe_pan_right": (np.array([2500.0, 150.0, 150.0]), deformation(130, 50)),
}
tracks = {name: move(p0, d) for name, (p0, d) in nodes.items()}
# Reference: rear seat cross member and both B-pillar bases (undeformed)
reference = np.array([move(np.array(p)) for p in
[(1000.0, 0.0, 200.0), (1300.0, 750.0, 300.0),
(1300.0, -750.0, 300.0), (900.0, 300.0, 450.0)]])
# --- 1. One point, three references ------------------------------------------
pedal = tracks["brake_pedal"]
print("Brake pedal, rearward (direction -x), dynamic / static, mm:")
for label, ref in [("global (ground)", None), ("one node", reference[0]),
("frame of 4 nodes", reference)]:
r = intrusion(pedal, ref, time=t, direction="-x")
print(f" {label:17}: {mm(r.along_dynamic):7.1f} / {mm(r.along_static):7.1f}"
f" upward z static {mm(r.z_static):6.1f}")
true = nodes["brake_pedal"][1]
print(f" true deformation : {-true[:, 0].min():7.1f} / {-true[-1, 0]:7.1f}"
f" upward z static {true[-1, 2]:6.1f}")
print(" (the ground system includes the vehicle's motion; one node misses "
"its pitch and yaw)")
# --- 2. All points against the vehicle frame ---------------------------------
directions = {"brake_pedal": "-x", "steering_column": "-x", "a_pillar": "-x",
"toe_pan_left": "-x", "toe_pan_right": "-x"}
results = intrusions(tracks, reference, time=t, direction=directions)
print(f"\n{'point':16} {'rearward dyn':>12} {'static':>7} {'at ms':>6} "
f"{'up static':>9} {'lat static':>10}")
for name, r in results.items():
print(f"{name:16} {mm(r.along_dynamic):12.1f} {mm(r.along_static):7.1f} "
f"{r.t_along_ms:6.1f} {mm(r.z_static):9.1f} {mm(r.y_static):10.1f}")
rigid = results["brake_pedal"].reference_fit_error < 1e-6
print("Reference points stay rigid (fit error below 1e-6 mm):", rigid)
# --- 3. Survival space: steering wheel to seat --------------------------------
seat = move(np.array([1450.0, 370.0, 450.0]))
gap = node_distance(tracks["steering_column"], seat, time=t)
print(f"\nSteering column to seat: {gap.initial:.0f} mm before, closest "
f"{gap.minimum:.0f} mm at {gap.t_minimum_ms:.1f} ms, {gap.final:.0f} mm after "
f"(closed {gap.closing_dynamic:.0f} mm dynamic, {gap.closing_static:.0f} static)")
# --- 4. Physical test: before/after measurement (two rows per point) --------
rng = np.random.default_rng(13)
before = np.array([p for p, _ in nodes.values()])
after = np.array([tr[-1] for tr in tracks.values()])
ref_before = reference[:, 0] + rng.normal(0, 0.2, (4, 3)) # 0.2 mm noise
ref_after = reference[:, -1] + rng.normal(0, 0.2, (4, 3))
measured = intrusions(
{name: np.array([before[i], after[i] + rng.normal(0, 0.2, 3)])
for i, name in enumerate(nodes)},
np.stack([ref_before, ref_after], axis=1), direction=directions)
print("\nStatic test measurement (before/after, best-fit reference):")
print(" ", ", ".join(f"{n} {mm(r.along_static):.1f}" for n, r in measured.items()))
print(f" reference fit error {measured['a_pillar'].reference_fit_error:.2f} mm")
# --- 5. Into the Bharat NCAP modifiers (static values here) ----------------
col, pdl = results["steering_column"], results["brake_pedal"]
penalties = {
"steering column (head)": steering_column_modifier(
rearward=col.along_static, upward=col.z_static, lateral=abs(col.y_static)),
"A-pillar (chest)": a_pillar_modifier(results["a_pillar"].along_static),
"pedal upward (lower leg)": pedal_upward_modifier(pdl.z_static),
"pedal blocking (foot)": pedal_blocking_modifier(pdl.along_static),
}
print("\nBharat NCAP modifiers:",
", ".join(f"{k} -{v:.2f}" for k, v in penalties.items()))
# --- 6. As feature columns ---------------------------------------------------
row = flatten(results)
print(f"Feature row: {len(row)} columns, e.g. brake_pedal.along_static = "
f"{row['brake_pedal.along_static']:.1f}")
Output:
Brake pedal, rearward (direction -x), dynamic / static, mm:
global (ground) : 0.0 / -549.0 upward z static 149.0
one node : 159.9 / 138.5 upward z static 111.9
frame of 4 nodes : 140.0 / 119.0 upward z static 47.6
true deformation : 140.0 / 119.0 upward z static 47.6
(the ground system includes the vehicle's motion; one node misses its pitch and yaw)
point rearward dyn static at ms up static lat static
brake_pedal 140.0 119.0 90.0 47.6 -6.8
steering_column 76.0 64.6 90.0 51.0 10.2
a_pillar 120.0 102.0 90.0 8.5 5.1
toe_pan_left 190.0 161.5 90.0 59.5 0.0
toe_pan_right 130.0 110.5 90.0 42.5 0.0
Reference points stay rigid (fit error below 1e-6 mm): True
Steering column to seat: 559 mm before, closest 525 mm at 90.0 ms, 529 mm after (closed 34 mm dynamic, 30 static)
Static test measurement (before/after, best-fit reference):
brake_pedal 118.8, steering_column 64.7, a_pillar 102.1, toe_pan_left 161.5, toe_pan_right 110.1
reference fit error 0.46 mm
Bharat NCAP modifiers: steering column (head) -0.00, A-pillar (chest) -0.04, pedal upward (lower leg) -0.00, pedal blocking (foot) -0.55
Feature row: 70 columns, e.g. brake_pedal.along_static = 119.0