hertzforge.core.modal_frf¶
modal_frf
¶
Each mode's own frequency response, synthesized from a shape set.
A real mode's modal FRF is the response of its modal coordinate to a unit modal force,
H_r(f) = (iw)^p / (m_r (w_r^2 - w^2 + 2i z_r w_r w)),
with w = 2pif and p = 0, 1 or 2 for displacement, velocity or
acceleration (ShapeSet.modal_frf). It needs only the mode's
frequency, damping and modal mass, not its shape. A physical FRF is the
shapes on both sides of it, H_jk = sum_r phi_jr H_r phi_kr, which is
what ShapeSet.synthesize_frf sums.
The result is an Frf with one record per mode, its response and its
reference both at the mode's modal coordinate (M1 ... Mn). The
lines are a test's: frame_length samples at sample_rate give
lines every sample_rate / frame_length Hz from 0 Hz to the Nyquist
frequency, the lines Compute FRFs gives a record framed that way.
The units follow the modal coordinates (transform): through
mass-normalized shapes a modal displacement is m·kg½ and a modal force
N/kg½, so the modal FRF is in s² for displacement, s for velocity and
is dimensionless for acceleration. A set with no mass unit gives modal
FRFs with no unit, the modal dimension kept as the hint.
frfs_at_channels goes back: from modal FRFs and the shapes at a
channel table's channels to the physical FRFs between them, each
response channel against each reference channel, each row in what its
channel measures. Modal FRFs that hold each mode against itself are a
diagonal matrix; a transform of a measured FRF holds every mode against
every mode, and both expand the same way.
driven_modes is the same sum stopped half way: a force at one DOF is
a modal force on each mode, its shape value there, and the modal FRFs
turn those into each modal coordinate's response. The shapes then give
the motion at every DOF the set covers (deform.modal_ods_deflection),
which is the operating deflection shape for that drive point with no
FRF made for any of them.
Classes:
| Name | Description |
|---|---|
DrivenModes |
Each mode's modal coordinate per unit force at one DOF. |
Functions:
| Name | Description |
|---|---|
frequency_lines |
The lines a frame of |
synthesize_modal_frfs |
Each picked mode's modal FRF, on the lines of a test's frame. |
above_nyquist |
How many of the picked modes lie above the Nyquist frequency: |
modal_matrix |
The modal FRF matrix a modal FRF's records hold. |
driven_modes |
Each modal coordinate's response to a unit force at |
frfs_at_channels |
Physical FRFs between channels, from modal FRFs and the shapes at |
Classes¶
DrivenModes
dataclass
¶
DrivenModes(drive: str, modes: list[int], coordinates: ndarray, lines: ndarray, quantity: str, known: bool)
Each mode's modal coordinate per unit force at one DOF.
Attributes:
| Name | Type | Description |
|---|---|---|
drive |
str
|
The DOF the force is at. |
modes |
list of int
|
The modes, by index from zero into the shape set. |
coordinates |
ndarray
|
The modal coordinates, complex, modes × lines. |
lines |
ndarray
|
The frequency lines, in Hz. |
quantity |
str
|
What the coordinates answer in: 'acceleration', 'velocity' or 'length'. |
known |
bool
|
Whether the modal FRFs' units are defined. |
Functions:¶
frequency_lines
¶
The lines a frame of frame_length samples at sample_rate
gives: every sample_rate / frame_length Hz from 0 Hz to the
Nyquist frequency.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sample_rate
|
float
|
Samples per second, in Hz. |
required |
frame_length
|
int
|
Samples in a frame, two or more. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
The lines, in Hz. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the sample rate is not positive or the frame has fewer than two samples. |
synthesize_modal_frfs
¶
synthesize_modal_frfs(shapes: ShapeSet, sample_rate: float, frame_length: int, quantity: str = 'acceleration', modes: Sequence[int] | None = None, label: str = 'shapes') -> Frf
Each picked mode's modal FRF, on the lines of a test's frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shapes
|
ShapeSet
|
A real shape set. Only its frequencies, damping, modal masses and mass unit are read. |
required |
sample_rate
|
float
|
The sample rate the lines follow from, in Hz. |
required |
frame_length
|
int
|
Samples in a frame; the line spacing is |
required |
quantity
|
str
|
The response per modal force: 'displacement', 'velocity' or 'acceleration'. |
'acceleration'
|
modes
|
sequence of int
|
Which modes, by index from zero. All of them when omitted. |
None
|
label
|
str
|
The set's name, written in each record's comment. |
'shapes'
|
Returns:
| Type | Description |
|---|---|
Frf
|
One record per mode, at |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the set is complex, a mode is not in it, the quantity is not
one of the three, or the lines cannot be made (as
|
above_nyquist
¶
above_nyquist(shapes: ShapeSet, modes: Sequence[int] | None, sample_rate: float) -> int
How many of the picked modes lie above the Nyquist frequency: they are kept, since each still adds its stiffness below it, and the pane says how many there are.
modal_matrix
¶
modal_matrix(modal: Frf, records: Sequence[int] | None = None) -> tuple[list[int], ndarray, str, bool]
The modal FRF matrix a modal FRF's records hold.
Each mode against itself, as Synthesize Modal FRFs writes them, is the diagonal and the rest is zero: a mode's coordinate answers only its own modal force. Every mode against every mode, as a transform of a measured FRF gives, is the whole matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
modal
|
Frf
|
Records at modal coordinates ( |
required |
records
|
sequence of int
|
Which records; all of them when omitted. Picking some modes' records sums those modes alone. |
None
|
Returns:
| Type | Description |
|---|---|
tuple of (list of int, numpy.ndarray, str, bool)
|
The modes by index from zero, the matrix (lines × modes × modes), the physical quantity the records answer in ('acceleration', 'velocity' or 'length'), and whether their units are defined. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If a record is not at a modal coordinate, or not a motion per modal force, the records answer in two quantities, or some modes hold cross terms and others do not. |
driven_modes
¶
driven_modes(modal: Frf, shapes: ShapeSet, drive: str, records: Sequence[int] | None = None) -> DrivenModes
Each modal coordinate's response to a unit force at drive:
q_r(f) = sum_s H_rs(f) phi_ks,
with k the drive DOF. A mode's shape may be scaled or turned over freely: its modal FRF carries the modal mass and its shape value appears here and again when the coordinates are turned into motion, so the motion does not change.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
modal
|
Frf
|
Modal FRFs ( |
required |
shapes
|
ShapeSet
|
The real set the modal FRFs are of, or that set at the drive's
DOF: its mode |
required |
drive
|
str
|
The DOF the force is at, such as '101Z+'. |
required |
records
|
sequence of int
|
Which modal records; all of them when omitted. Leaving a mode's record out leaves the mode out of the response. |
None
|
Returns:
| Type | Description |
|---|---|
DrivenModes
|
The modal coordinates per unit force. |
Raises:
| Type | Description |
|---|---|
ValueError
|
As |
frfs_at_channels
¶
frfs_at_channels(modal: Frf, shapes: ShapeSet, references: Sequence[str], responses: Sequence[tuple[str, str]], records: Sequence[int] | None = None, strains: Mapping[str, Any] | None = None) -> tuple[Frf, TransformReport]
Physical FRFs between channels, from modal FRFs and the shapes at those channels:
H_jk(f) = sum_r sum_s phi_jr H_rs(f) phi_ks,
which for modal FRFs each against itself is the modal sum
ShapeSet.synthesize_frf makes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
modal
|
Frf
|
Modal FRFs ( |
required |
shapes
|
ShapeSet
|
The set the modal FRFs are of, or that set at the channels'
DOFs: its mode |
required |
references
|
sequence of str
|
The force channels' DOFs, the columns. |
required |
responses
|
sequence of tuple of (str, str)
|
Each response channel's DOF and what it measures: 'acceleration', 'velocity', 'length' or 'strain'. Each row is turned from the modal FRFs' quantity into its own by (iw)^p, a strain as a displacement is; where that divides by zero frequency, the line is nan. |
required |
records
|
sequence of int
|
Which modal records; all of them when omitted. |
None
|
strains
|
mapping of str to array
|
For each strain channel's DOF, the strain a gauge there reads in
each of the set's modes ( |
None
|
Returns:
| Type | Description |
|---|---|
tuple of (Frf, TransformReport)
|
The FRFs, one record per response and reference pair in response order, and what was dropped. |
Raises:
| Type | Description |
|---|---|
ValueError
|
As |