crashmetrics.energy¶
energy
¶
Energy and force-displacement metrics.
Functions:
integrate_acceleration: Velocity and displacement from an acceleration time history.absorbed_energy: Cumulative energy absorbed along a force-displacement curve.crush_metrics: Peak force, mean force, energy, crush force efficiency and specific energy absorption of a crush response.kinetic_energy: Kinetic energy of a mass.
Units
These functions do not convert units: use a consistent system. A few useful combinations:
- force in kN and displacement in mm give energy in J
- force in N and displacement in m give energy in J
- acceleration in mm/ms^2 and time in ms give velocity in mm/ms (m/s) and displacement in mm
Use crashmetrics.signals.to_g and to_seconds to convert
inputs first if needed. All integrals use the trapezoidal rule.
CrushResult
dataclass
¶
CrushResult(
energy: float,
crush_distance: float,
peak_force: float,
peak_force_displacement: float,
mean_force: float,
crush_force_efficiency: float,
specific_energy_absorption: float | None,
)
Metrics of a crush (force-displacement) response.
crush_distance
instance-attribute
¶
Maximum displacement reached, relative to the first sample.
peak_force_displacement
instance-attribute
¶
Displacement at which the peak force occurs (first occurrence).
crush_force_efficiency
instance-attribute
¶
Mean force divided by peak force (CFE). NaN if peak force <= 0.
specific_energy_absorption
instance-attribute
¶
Energy divided by absorber mass (SEA), or None without a mass.
integrate_acceleration
¶
integrate_acceleration(
time: ArrayLike,
acceleration: ArrayLike,
v0: float = 0.0,
x0: float = 0.0,
) -> tuple[NDArray[float64], NDArray[float64]]
Integrate acceleration to velocity and displacement.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time
|
ArrayLike
|
Strictly increasing 1D time array. |
required |
acceleration
|
ArrayLike
|
1D acceleration in units consistent with |
required |
v0
|
float
|
Initial velocity. |
0.0
|
x0
|
float
|
Initial displacement. |
0.0
|
Returns:
| Type | Description |
|---|---|
tuple of numpy.ndarray
|
|
Notes
Velocity is the cumulative trapezoidal integral of acceleration; displacement is the cumulative trapezoidal integral of velocity. Integration amplifies sensor offset and drift: a small constant error in acceleration grows linearly in velocity and quadratically in displacement.
absorbed_energy
¶
Cumulative energy along a force-displacement curve.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
displacement
|
ArrayLike
|
1D displacement (crush), in the order the samples were recorded. It need not be monotonic: during unloading the displacement decreases and the energy drops by the work returned. |
required |
force
|
ArrayLike
|
1D force, positive in the loading (crushing) direction. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Energy at each sample, starting at zero, in force x length units (kN x mm = J). |
crush_metrics
¶
crush_metrics(
displacement: ArrayLike,
force: ArrayLike,
mass: float | None = None,
max_displacement: float | None = None,
) -> CrushResult
Summarise a crush response from its force-displacement curve.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
displacement
|
ArrayLike
|
1D displacement (crush) in recording order. |
required |
force
|
ArrayLike
|
1D force, positive in the crushing direction. |
required |
mass
|
float | None
|
Optional absorber mass, for specific energy absorption. Use units that give the SEA you want, for example J with kg. |
None
|
max_displacement
|
float | None
|
Optional stroke limit. The curve is cut, with linear interpolation, where the displacement first reaches this value, for example to evaluate metrics over an effective stroke. |
None
|
Returns:
| Type | Description |
|---|---|
CrushResult
|
|
Notes
Mean force is the net absorbed energy divided by the crush distance, and the crush force efficiency (CFE) is the mean force divided by the peak force. Both depend on the stroke over which they are evaluated, so state the stroke when reporting them.
kinetic_energy
¶
Return the kinetic energy 0.5 * mass * velocity**2.
Works element-wise on arrays. With mass in kg and velocity in m/s (equal to mm/ms) the result is in J.