Skip to content

hertzforge.core.srs

srs

Shock response spectra.

An SRS is not a spectrum of the shock itself. A single-degree-of-freedom oscillator is attached to the base, the base is driven with the measured transient, and the largest response the oscillator reaches is recorded. Repeating that for natural frequencies across the band of interest gives the curve of peaks that is the shock response spectrum.

For that reason two shocks with the same SRS can look very different, and an SRS cannot be inverted back to a time history: each point is one number taken from a whole run of one filter, and the phase that produced it is lost.

The filter is Smallwood's ramp-invariant recursion (Smallwood 1981), the standard method for shock response spectra. Multiplying by the continuous transfer function in the frequency domain is the other common approach, and it is inaccurate near Nyquist: the sampled input is a ramp between samples, not a train of impulses, and the ramp-invariant filter is built on that assumption. The recursion below is exact for that assumption rather than an approximation of it.

Damping is given either as a ratio or as Q = 1/(2*zeta). Q = 10 (5% of critical) is the usual default, and a specification is assumed to be written at that value unless it says otherwise.

References

The recursion implemented here is Smallwood's; the others set out the same analysis and where it goes wrong.

  1. Smallwood, D. O. (1981). "An Improved Recursive Formula for Calculating Shock Response Spectra." Shock and Vibration Bulletin.
  2. ISO 18431-4:2007, Mechanical vibration and shock - Signal processing - Part 4: Shock-response spectrum analysis.
  3. Irvine, T. "An Introduction to the Shock Response Spectrum", including why multiplying by the continuous transfer function in the frequency domain goes wrong near Nyquist.

Functions:

Name Description
damping_for

The damping ratio an amplification factor means.

q_for

The amplification factor a damping ratio means.

octave_frequencies

Natural frequencies from low to high, per_octave to an octave.

ramp_invariant

Smallwood's filter coefficients, one row per natural frequency.

peaks

(highest, lowest) response the oscillators reach, one per

spectra

The three spectra read off peaks: 'positive' is highest,

maximax

The peak absolute response, in either direction, one per

Functions:

damping_for

damping_for(q: float = DEFAULT_Q) -> float

The damping ratio an amplification factor means.

q_for

q_for(damping: float) -> float

The amplification factor a damping ratio means.

octave_frequencies

octave_frequencies(low: float, high: float, per_octave: int = PER_OCTAVE) -> ndarray

Natural frequencies from low to high, per_octave to an octave.

The spacing is geometric, because an SRS is read on a log axis and a linear grid would put most of its points at the top of the band and few at the bottom. The last frequency is the nearest whole number of steps to high, so it can land slightly above or below it. Raises ValueError unless 0 < low < high.

ramp_invariant

ramp_invariant(frequencies: ArrayLike, sample_rate: float, damping: float) -> tuple[ndarray, ndarray]

Smallwood's filter coefficients, one row per natural frequency.

Returns (b, a), each (F, 3), for the absolute acceleration of the oscillator given the acceleration of its base. damping is a ratio of critical and must be between 0 and 1, or it raises ValueError.

The gain at DC is exactly one (b.sum() / a.sum() == 1), because an infinitely stiff oscillator moves with its base. That is the simplest check that the coefficients are correct, and test_srs makes it.

peaks

peaks(signal: ArrayLike, frequencies: ArrayLike, sample_rate: float, damping: float | None = None, q: float = DEFAULT_Q) -> tuple[ndarray, ndarray]

(highest, lowest) response the oscillators reach, one per frequency.

damping is a ratio of critical; when it is None, q sets it. Each oscillator's response is run over the whole record in turn and only its maximum and minimum kept, so no array of size (frequencies x samples) is held, which is all an SRS needs. Both start at zero, so highest is never below zero and lowest never above it.

spectra

spectra(highest: ArrayLike, lowest: ArrayLike) -> dict[str, ndarray]

The three spectra read off peaks: 'positive' is highest, 'negative' the depth of lowest as a magnitude, and 'maximax' the larger of the two at each frequency.

Parameters:

Name Type Description Default
highest array_like

What peaks returned.

required
lowest array_like

What peaks returned.

required

Returns:

Type Description
dict of str to numpy.ndarray

Keyed 'positive', 'negative' and 'maximax'.

maximax

maximax(signal: ArrayLike, frequencies: ArrayLike, sample_rate: float, damping: float | None = None, q: float = DEFAULT_Q) -> ndarray

The peak absolute response, in either direction, one per frequency.

This is the value a shock specification is written against: a shock whose response is all in one direction is no less severe for it. damping and q are as in peaks.