Skip to content

crashmetrics.pedestrian.clearance

clearance

Bonnet clearance: why a headform impact point is red.

A headform point is red for one of two reasons: the head runs out of space and hits a hard part under the bonnet (bottoming out), or the bonnet itself is too stiff where it is hit (a hinge, a reinforcement, the wing edge). This module tells them apart, point by point:

  • Geometry: clearance measures the free space under each impact point to the hard parts (engine, strut towers, battery, hinges ...), along the headform's path and along the surface normal, for the 165 mm headform sphere, from a mesh (crashmetrics.mesh.read_mesh) or any point clouds. impact_direction and HEADFORMS give the Euro NCAP impact directions and headforms.
  • What is needed: required_clearance is the smallest deformation space that keeps HIC15 below a target for a given pulse shape (the square wave is the physical limit), clearance_table for all colour limits.
  • What happened: head_impact reads the headform's nodout (CFC 1000 acceleration, penetration and speed along the impact direction); assess_impact gives HIC15 and its colour, the first contact peak, the deceleration plateau, the deepest penetration, whether and when the head bottomed out (from the geometry, from a second peak in the pulse, or both), the speed and energy left at that moment, the share of the HIC window after it, the extra space that would have stopped the head on the plateau, and a diagnosis.
  • The grid: assess_grid assesses all points, prints a text map of the grid with the colours and the bottoming points, counts the points lost per cause, gives the Euro NCAP head score (crashmetrics.pedestrian.headform_score), and compare_grids compares two design loops.

Lengths are in mm, times in ms, speeds in m/s, accelerations in g, for any unit system of the model. crashmetrics.pedestrian. synthetic writes a bonnet, its hard parts and a grid of headform impacts to try all of this without a solver.

COLOUR_LIMITS module-attribute

COLOUR_LIMITS: dict[str, float] = {
    "green": 650.0,
    "yellow": 1000.0,
    "orange": 1350.0,
    "brown": 1700.0,
}

Upper HIC15 limit of each colour (Euro NCAP).

HEADFORMS module-attribute

HEADFORMS: dict[str, Headform] = {
    "child": Headform("child", 3.5, 165.0, 50.0, 40.0),
    "adult": Headform("adult", 4.5, 165.0, 65.0, 40.0),
}

Euro NCAP headforms: child 3.5 kg at 50°, adult 4.5 kg at 65°, both 165 mm and 40 km/h.

PULSE_SHAPES module-attribute

PULSE_SHAPES: dict[
    str, Callable[[FloatArray], FloatArray]
] = {
    "square": lambda t: np.ones_like(t),
    "half_sine": lambda t: np.sin(np.pi * t),
    "triangle": lambda t: 1.0 - np.abs(2.0 * t - 1.0),
    "rising": lambda t: t,
    "falling": lambda t: 1.0 - t,
}

Deceleration pulse shapes over the stopping time (0 to 1). The square wave stops the head in the least space for a HIC; real bonnet pulses need more.

DIAGNOSES module-attribute

DIAGNOSES: dict[str, str] = {
    "ok": "within the target colour",
    "bottoming": "the head bottoms out on a hard part, which sets the HIC",
    "light_bottoming": "the head touches a hard part, but the HIC is within the target",
    "first_peak": "the first contact peak sets the HIC (its HIC alone is 70 % or more of the total): the bonnet is locally heavy or stiff in contact (reinforcement, latch, hinge, edge)",
    "stiff": "the deceleration plateau sets the HIC without reaching a hard part: the bonnet structure is too stiff in bending",
}

Diagnosis codes of assess_impact.

Headform dataclass

Headform(
    name: str,
    mass: float,
    diameter: float,
    angle: float,
    speed: float,
)

A headform impactor (Euro NCAP, UN GTR 9).

mass instance-attribute

mass: float

kg.

diameter instance-attribute

diameter: float

mm.

angle instance-attribute

angle: float

Impact angle to the ground reference plane, degrees.

speed instance-attribute

speed: float

km/h.

velocity property

velocity: float

m/s.

energy property

energy: float

Impact energy, J.

ImpactPoint dataclass

ImpactPoint(
    key: Hashable,
    point: tuple[float, float, float],
    headform: str = "child",
    run: str = "",
)

A grid point: its position, headform and run folder.

Clearance dataclass

Clearance(
    point: tuple[float, float, float],
    direction: tuple[float, float, float],
    distance: float,
    part: str,
    contact: tuple[float, float, float] | None,
    lateral: float,
    normal_distance: float = nan,
    normal_part: str = "",
    centre: tuple[float, float, float] | None = None,
)

Free space under one impact point.

point instance-attribute

point: tuple[float, float, float]

Impact point on the bonnet, mm.

distance instance-attribute

distance: float

Travel of the headform along direction from first contact until the sphere touches a hard part, mm (inf: nothing within max_distance).

part instance-attribute

part: str

Hard part touched first ('' if none).

contact instance-attribute

contact: tuple[float, float, float] | None

The hard-part point touched first, mm.

lateral instance-attribute

lateral: float

Its distance from the line of the headform centre, mm.

normal_distance class-attribute instance-attribute

normal_distance: float = math.nan

The same along the inward surface normal (NaN without a surface).

centre class-attribute instance-attribute

centre: tuple[float, float, float] | None = None

Headform centre at first contact, mm: point + radius * normal with a surface, point - radius * direction without one.

HeadImpact dataclass

HeadImpact(
    name: str,
    time: FloatArray,
    acceleration: FloatArray,
    penetration: FloatArray,
    velocity: FloatArray,
    headform: Headform,
    direction: tuple[float, float, float],
    contact_time: float,
    cfc: float | None = 1000.0,
    source: str = "",
)

Headform motion of one impact (mm, ms, m/s, g).

time instance-attribute

time: FloatArray

ms.

acceleration instance-attribute

acceleration: FloatArray

Resultant, g (CFC 1000 unless cfc was None).

penetration instance-attribute

penetration: FloatArray

Travel along the impact direction from first contact, mm.

velocity instance-attribute

velocity: FloatArray

Speed along the impact direction, m/s (negative: rebound).

contact_time instance-attribute

contact_time: float

ms of first contact (unfiltered acceleration reaches contact_g).

ImpactAssessment dataclass

ImpactAssessment(
    name: str,
    hic: float,
    hic_window: tuple[float, float],
    colour: str,
    peak: float,
    peak_time: float,
    first_peak: float,
    first_peak_time: float,
    plateau: float,
    penetration: float,
    penetration_time: float,
    clearance: float,
    margin: float,
    part: str,
    bottoming: bool,
    bottoming_time: float,
    bottoming_source: str,
    residual_speed: float,
    residual_energy: float,
    residual_share: float,
    extra_space: float,
    hic_share_after: float,
    diagnosis: str,
    reason: str,
)

What happened in one headform impact (mm, ms, m/s, g, J).

hic_window instance-attribute

hic_window: tuple[float, float]

ms.

peak instance-attribute

peak: float

Highest acceleration, g.

first_peak instance-attribute

first_peak: float

The first contact peak, g.

plateau instance-attribute

plateau: float

Mean acceleration from the first peak to bottoming (or to the deepest penetration), g.

penetration instance-attribute

penetration: float

Deepest travel along the impact direction, mm.

clearance instance-attribute

clearance: float

Geometric clearance, mm (NaN if not given).

margin instance-attribute

margin: float

Space left at the deepest penetration: clearance - stack + skin - penetration, mm (negative: used up).

part instance-attribute

part: str

Hard part under the point (from the clearance).

bottoming_time instance-attribute

bottoming_time: float

ms, NaN without bottoming.

bottoming_source instance-attribute

bottoming_source: str

"geometry", "pulse", "both" or "".

residual_speed instance-attribute

residual_speed: float

Speed along the impact direction when bottoming, m/s.

residual_energy instance-attribute

residual_energy: float

Headform energy left when bottoming, J (share of the impact energy in residual_share).

extra_space instance-attribute

extra_space: float

Space that would have stopped the residual speed on the plateau, mm.

hic_share_after instance-attribute

hic_share_after: float

Share of the HIC window's velocity change after bottoming (0 to 1).

diagnosis instance-attribute

diagnosis: str

A key of DIAGNOSES.

points property

points: float

Euro NCAP points of the colour (1 green to 0 red).

GridAssessment dataclass

GridAssessment(
    points: dict[Hashable, ImpactAssessment],
    protocol: str = "euroncap_2026",
    notes: tuple[str, ...] = tuple(),
)

All impact points of a grid.

lost_points

lost_points() -> dict[str, float]

Grid points lost to each cause (1 per point minus its colour's points).

score

score(**kwargs: object) -> HeadformScore

Euro NCAP head score of the predicted HIC15 values (headform_score; keyword arguments are passed on).

map

map() -> str

Text map of a (row, column) grid: colour letter (G Y O B R), with * for bottoming and ^ for a first-peak or stiff point.

table

table(
    top: int | None = 15, worst_first: bool = True
) -> str

Markdown table of the points, worst first.

to_csv

to_csv(path: str | Path) -> Path

All points, one row each (for Excel or a dashboard).

GridComparison dataclass

GridComparison(
    baseline: str,
    variant: str,
    changes: tuple[
        tuple[Hashable, str, str, float, float], ...
    ],
    score: tuple[float, float],
    grid_points: tuple[float, float],
    no_longer_bottoming: tuple[Hashable, ...],
    new_bottoming: tuple[Hashable, ...],
)

Two design loops of the same grid.

changes instance-attribute

changes: tuple[tuple[Hashable, str, str, float, float], ...]

(point, colour before, colour after, HIC before, HIC after) of the points whose colour changed, most improved first.

grid_points instance-attribute

grid_points: tuple[float, float]

Sum of colour points before and after.

impact_direction

impact_direction(
    headform: str | Headform | float = "child",
    *,
    rearward: ArrayLike = (1.0, 0.0, 0.0),
    up: ArrayLike = (0.0, 0.0, 1.0),
) -> FloatArray

Unit vector of the headform's path: rearward and down at the headform's angle to the ground (or an angle in degrees).

rearward and up are the vehicle's rearward and upward axes in the model (x rearward and z up by default, as in most crash models).

read_impact_points

read_impact_points(
    path: str | Path,
) -> dict[Hashable, ImpactPoint]

Impact points from a CSV with the columns row, column, x, y, z and optionally headform (child or adult) and run (the run folder, relative to the CSV). Keys are (row, column), as integers when they are numbers.

surface_normals

surface_normals(
    surface: ArrayLike,
    points: ArrayLike,
    *,
    up: ArrayLike = (0.0, 0.0, 1.0),
    neighbours: int = 24,
) -> FloatArray

Outward (upward) unit normals of a surface point cloud at points, from a plane fitted to the nearest neighbours surface points.

clearance

clearance(
    points: Mapping[Hashable, ArrayLike] | ArrayLike,
    hard_parts: Mapping[str, ArrayLike],
    direction: ArrayLike | Mapping[Hashable, ArrayLike],
    *,
    surface: ArrayLike | None = None,
    radius: float = 82.5,
    max_distance: float = 400.0,
    up: ArrayLike = (0.0, 0.0, 1.0),
    unit_system: str = "mm-ms-kg",
) -> dict[Hashable, Clearance]

Free space under impact points to the hard parts.

Parameters:

Name Type Description Default
points Mapping[Hashable, ArrayLike] | ArrayLike

Impact points on the bonnet: {key: (x, y, z)} (keys such as grid (row, column)) or an (n, 3) array (keys 0..n-1).

required
hard_parts Mapping[str, ArrayLike]

Part name -> its node coordinates (n, 3), for example {"Engine": mesh.points(401)}. Give only parts the head cannot push away (deformable inner panels are not hard parts).

required
direction ArrayLike | Mapping[Hashable, ArrayLike]

The headform's path (impact_direction), one for all points or {key: vector}.

required
surface ArrayLike | None

Bonnet surface points. The headform touches the bonnet at the impact point with its centre on the surface normal, which on an inclined bonnet is not the leading point of the sphere along its path; give the surface for the right result there. It also adds the clearance along the inward surface normal. Without it the headform is assumed to hit the surface head-on.

None
radius float

Headform radius, mm (82.5: the 165 mm Euro NCAP headform).

82.5
max_distance float

Hard parts farther than this along the path are ignored, mm.

400.0
unit_system str

Of the coordinates (results in mm).

'mm-ms-kg'

clearance_map

clearance_map(
    clearances: Mapping[Hashable, Clearance],
    *,
    needed: float | None = None,
    normal: bool = False,
) -> str

Text map of the free space (mm) of a (row, column) grid: - for no hard part within reach, ! after points with less than needed mm (required_clearance plus the stack, say). normal maps the clearance along the surface normal instead.

required_clearance

required_clearance(
    hic: float,
    *,
    speed: float = 40.0,
    shape: str = "half_sine",
    window_ms: float = 15.0,
) -> float

Smallest stopping distance (mm) that keeps HIC15 at hic for a head at speed (km/h) stopped by a pulse of shape (PULSE_SHAPES).

The pulse is scaled in time and level until it stops the head and gives exactly that HIC; its stopping distance is returned. The square wave gives the physical lower limit (about 68 mm for HIC 1000 at 40 km/h). Add the crushed thickness of the bonnet and the headform skin to compare with the geometric clearance.

clearance_table

clearance_table(
    *,
    speed: float = 40.0,
    shapes: Sequence[str] = (
        "square",
        "half_sine",
        "triangle",
    ),
    limits: Mapping[str, float] | None = None,
) -> str

Markdown table: deformation space needed (mm) to stay within each colour limit, per pulse shape.

head_impact

head_impact(
    source: str | Path | AsciiOutput,
    *,
    node: int | None = None,
    direction: ArrayLike | None = None,
    headform: str | Headform = "child",
    unit_system: str = "mm-ms-kg",
    cfc: float | None = 1000.0,
    contact_g: float = 2.0,
    name: str | None = None,
) -> HeadImpact

The headform's motion from nodout.

Parameters:

Name Type Description Default
source str | Path | AsciiOutput

A nodout file, a run folder with one, or an AsciiOutput.

required
node int | None

The headform's centre of gravity node; the only (or first) node of the file by default.

None
direction ArrayLike | None

Impact direction; impact_direction(headform) by default.

None
headform str | Headform

"child", "adult" or a Headform.

'child'
cfc float | None

SAE J211 class for the acceleration (Euro NCAP: 1000); None for none. Unevenly spaced output is resampled first.

1000.0
contact_g float

First contact: the unfiltered acceleration first reaches this, g. The penetration is measured from then.

2.0

assess_impact

assess_impact(
    impact: HeadImpact,
    clearance: Clearance | float | None = None,
    *,
    stack: float = 5.0,
    skin: float = 3.0,
    rise: float = 1.25,
    first_fraction: float = 0.3,
    target: str = "yellow",
    window_ms: float = 15.0,
) -> ImpactAssessment

HIC, bottoming out and its cause for one impact.

Parameters:

Name Type Description Default
impact HeadImpact

From head_impact.

required
clearance Clearance | float | None

A Clearance (its distance and hard part) or a distance in mm.

None
stack float

Crushed thickness of the bonnet outer and inner panels between the head and the hard part, mm.

5.0
skin float

Compression of the headform skin under the bonnet load, mm: the head centre travels this much more than the bonnet. The head bottoms out when its penetration reaches clearance - stack + skin.

3.0
rise float

Pulse test: a later peak at least rise times the first contact peak after a dip marks bottoming out.

1.25
first_fraction float

The first contact peak is the first local peak above this fraction of the highest acceleration.

0.3
target str

Colour the point should reach; worse colours get a cause.

'yellow'

assess_grid

assess_grid(
    impacts: Mapping[Hashable, HeadImpact],
    clearances: Mapping[Hashable, Clearance | float]
    | None = None,
    *,
    protocol: str = "euroncap_2026",
    **kwargs: float | str,
) -> GridAssessment

assess_impact for every point of a grid (keyword arguments are passed on); clearances by the same keys.

compare_grids

compare_grids(
    baseline: GridAssessment,
    variant: GridAssessment,
    *,
    names: tuple[str, str] = ("baseline", "variant"),
) -> GridComparison

Colour, score and bottoming changes between two grids (same keys).

crashmetrics.pedestrian.synthetic

synthetic

A synthetic bonnet and its headform impacts, for examples and tests.

bonnet_model gives a bonnet surface over hard parts (engine, intake plenum, strut towers, battery, hinges, cowl) and a Euro NCAP-like grid of impact points every 100 mm; simulate_grid impacts every point with the child (front rows) or adult (rear rows) headform at 40 km/h; BonnetRun.write writes what a real headform study gives:

  • bonnet.k: the bonnet outer and the hard parts as shell meshes (read with crashmetrics.mesh.read_mesh);
  • impact_points.csv: the grid points, headform and run folder of each (read with crashmetrics.pedestrian.clearance.read_impact_points);
  • one folder per impact with a nodout of the headform centre node.

Each impact is a lumped model along the headform's path: the headform (mass, a stiff skin contact) pushes a local bonnet mass, held by the bonnet's elastic-plastic bending support (the inner panel). The free space under the point is measured from the meshes with crashmetrics.pedestrian.clearance.clearance; when the bonnet has used it up (less the stack of the panels), it lands on the hard part, which is stiff and crushes at a high force. Stiff zones (latch, hinges, wing edges) have a higher bending force and more local mass.

VARIANTS change one thing with a known effect: the engine 20 mm lower (the points over the plenum stop being red) and a stiffer bonnet inner panel (the head stops in less space, but the bonnet itself is now too stiff). The truth of every impact is kept (BonnetRun.truth) to test the analysis against. The model is for teaching and testing, not a vehicle simulation; the files say so.

Units of the files: mm, ms, kg.

VARIANTS module-attribute

VARIANTS: dict[str, str] = {
    "baseline": "Reference bonnet: the head bottoms out on the intake plenum, the strut towers, the battery, the hinges and the cowl; the latch and the wing edges are stiff",
    "lower_engine": "Engine and plenum 20 mm lower: the plenum points go from red to brown, orange or yellow",
    "stiff_inner": "Inner panel 40 % stiffer: the head stops in less space, but the bonnet itself is now too stiff and the score drops",
}

Variants of bonnet_model and what the analysis should find.

HardPart dataclass

HardPart(
    part_id: int,
    name: str,
    top: float,
    x: tuple[float, float] = (0.0, 0.0),
    y: tuple[float, float] = (0.0, 0.0),
    centre: tuple[float, float] | None = None,
    radius: float = 0.0,
    height: float = 80.0,
    crush_force: float = 15.0,
    stiffness: float = 15.0,
)

A hard part under the bonnet: a box (x, y ranges) or a vertical cylinder (centre, radius), from top down by height (mm).

crush_force class-attribute instance-attribute

crush_force: float = 15.0

Force at which the part's surface crushes, kN.

stiffness class-attribute instance-attribute

stiffness: float = 15.0

Contact stiffness before it crushes, kN/mm.

mesh

mesh(
    size: float = 10.0,
) -> tuple[FloatArray, list[list[int]]]

Nodes (n, 3) and quads (local indices) of the top and sides.

StiffZone dataclass

StiffZone(
    name: str,
    x: tuple[float, float],
    y: tuple[float, float],
    plateau_factor: float,
    mass_factor: float = 1.0,
)

A stiffer area of the bonnet (latch, hinge, wing edge).

BonnetModel dataclass

BonnetModel(
    name: str,
    hard_parts: tuple[HardPart, ...],
    stiff_zones: tuple[StiffZone, ...],
    z_front: float = 770.0,
    slope: float = 0.17,
    crown: float = 70.0,
    length: float = 1100.0,
    half_width: float = 700.0,
    rows: tuple[int, ...] = tuple(range(1, 11)),
    columns: tuple[int, ...] = tuple(range(-6, 7)),
    adult_from_row: int = 6,
    plateau: float = 2.0,
    hardening: float = 0.0015,
    bonnet_stiffness: float = 0.25,
    bonnet_mass: float = 0.45,
    skin_stiffness: float = 0.6,
    skin_damping: float = 0.25,
    stack: float = 5.0,
    notes: str = "",
)

A bonnet over hard parts (mm, kg, kN).

z_front class-attribute instance-attribute

z_front: float = 770.0

Bonnet height at the leading edge (x = 0, y = 0), mm.

slope class-attribute instance-attribute

slope: float = 0.17

Rise of the bonnet per mm rearward.

crown class-attribute instance-attribute

crown: float = 70.0

Drop from the centre line to y = +-700 mm.

rows class-attribute instance-attribute

rows: tuple[int, ...] = tuple(range(1, 11))

Grid rows; row r is at x = 100 r mm.

columns class-attribute instance-attribute

columns: tuple[int, ...] = tuple(range(-6, 7))

Grid columns; column c is at y = 100 c mm (LH positive).

adult_from_row class-attribute instance-attribute

adult_from_row: int = 6

Rows from here on are adult headform points.

plateau class-attribute instance-attribute

plateau: float = 2.0

Bending (crush) force of the bonnet inner panel, kN.

hardening class-attribute instance-attribute

hardening: float = 0.0015

Rise of that force per mm of bonnet travel (share).

bonnet_stiffness class-attribute instance-attribute

bonnet_stiffness: float = 0.25

Elastic bending stiffness of the bonnet, kN/mm.

bonnet_mass class-attribute instance-attribute

bonnet_mass: float = 0.45

Local bonnet mass the head accelerates, kg.

skin_stiffness class-attribute instance-attribute

skin_stiffness: float = 0.6

Headform skin contact stiffness, kN/mm.

skin_damping class-attribute instance-attribute

skin_damping: float = 0.25

Hunt-Crossley damping of the skin contact, s/m: the vinyl skin absorbs energy, so the bonnet does not bounce off the head, and the damping force grows with the compression (no jump at first touch).

stack class-attribute instance-attribute

stack: float = 5.0

Crushed thickness of bonnet outer and inner, mm.

points

points() -> dict[
    tuple[int, int], tuple[float, float, float]
]

Grid points on the bonnet surface, by (row, column).

ImpactTruth dataclass

ImpactTruth(
    clearance: float,
    part: str,
    bottoming_time: float,
    residual_speed: float,
    max_hard_force: float,
)

What the lumped model did at one point (mm, ms, m/s, J).

bottoming_time instance-attribute

bottoming_time: float

When the bonnet landed on the hard part, ms after the start (NaN: never).

residual_speed instance-attribute

residual_speed: float

Head speed then, m/s.

max_hard_force instance-attribute

max_hard_force: float

Highest hard-part force, kN.

BonnetRun dataclass

BonnetRun(
    model: BonnetModel,
    time: FloatArray,
    keys: list[tuple[int, int]],
    points: dict[
        tuple[int, int], tuple[float, float, float]
    ],
    directions: dict[tuple[int, int], FloatArray],
    clearances: dict[Hashable, Clearance],
    travel: FloatArray,
    speed: FloatArray,
    acceleration: FloatArray,
    truth: dict[tuple[int, int], ImpactTruth] = dict(),
)

Impacts of all grid points of a BonnetModel (mm, ms).

time instance-attribute

time: FloatArray

Output times, ms.

travel instance-attribute

travel: FloatArray

(time, point): head travel along its path from first contact (negative before it), mm.

speed instance-attribute

speed: FloatArray

(time, point): m/s along the path.

acceleration instance-attribute

acceleration: FloatArray

(time, point): deceleration, g.

write

write(folder: str | Path) -> Path

Write bonnet.k, impact_points.csv and a nodout per point.

bonnet_model

bonnet_model(variant: str = 'baseline') -> BonnetModel

The reference bonnet or one of VARIANTS.

simulate_grid

simulate_grid(
    model: BonnetModel,
    *,
    duration: float = 16.0,
    pre_contact: float = 1.0,
    output_step: float = 0.1,
    step: float = 0.004,
) -> BonnetRun

Impact every grid point (child or adult headform at 40 km/h).

The head starts pre_contact ms before touching the bonnet; output every output_step ms (10 kHz). Times in ms.