pyvib.modal module

LSCE, LSCF, LSFD are modified from OpenModal https://github.com/openmodal/ Copyright (C) 2014-2017 Matjaž Mršnik, Miha Pirnat, Janko Slavič, Blaž Starc (in alphabetic order)

The rest is by Paw Møller <pawsen@gmail.com>

class pyvib.modal.EMA(method, frf)[source]

Bases: object

Experimental modal analysis

Methods: LSCE, Least-Squares Complex Exponential LSCF, Least-Squares Complex frequency. Also known as PolyMax

id(*args, **kwargs)[source]
methods = {'lsce': <function lsce>, 'lscf': <function lscf>}
modal()[source]
stabilization(fmin=0, fmax=inf, tol_freq=1, tol_damping=5, tol_mode=0.98, macchoice='None')[source]
pyvib.modal.ModalAC(M1, M2)[source]

Calculate MAC value for real valued mode shapes

M1 and M2 can be 1D arrays. Then they are recast to 2D.

Parameters:
  • M1 (ndarray (modes, nodes))
  • M1 (ndarray (modes, nodes))
Returns:

MAC – MAC value in range [0-1]. 1 is perfect fit.

Return type:

ndarray float (modes_m1, modes_m2)

pyvib.modal.ModalACX(M1, M2)[source]

Calculate MACX value for complex valued mode shapes

M1 and M2 can be 1D arrays. Then they are recast to 2D.

Parameters:
  • M1 (ndarray (modes, nodes))
  • M1 (ndarray (modes, nodes))
Returns:

MACX – MAC value in range [0-1]. 1 is perfect fit.

Return type:

ndarray float (modes_m1, modes_m2)

pyvib.modal.frf_mkc(M, K, fmin, fmax, fres, C=None, idof=None, odof=None)[source]

Compute the frequency response for a FEM model, given a range of frequencies.

Parameters:
  • M (array) – Mass matrix
  • K (array) – Stiffness matrix
  • C (array, optional) – Damping matrix
  • fmin (float) – Minimum frequency used
  • fmax (float) – Maximum frequency used
  • fres (float) – Frequency resolution
  • idof (array[int], default None) – Array of in dofs/modes to use. If None, use all.
  • odof (array[int], default None) – Array of out dofs/modes to use. If None, use all.
Returns:

  • freq (ndarray) – The frequencies where H is calculated.
  • H (ndarray, [idof, odof, len(freq)]) – The transfer function. H[0,0] gives H1 for DOF1, etc.

Examples

>>> M = np.array([[1, 0],
...               [0, 1]])
>>> K = np.array([[2, -1],
...               [-1, 6]])
>>> C = np.array([[0.3, -0.02],
...               [-0.02, 0.1]])
>>> freq, H = frf_mkc(M, K,  C)
pyvib.modal.irfft_adjusted_lower_limit(x, low_lim, indices)[source]

Compute the ifft of real matrix x with adjusted summation limits:

y(j) = sum[k=-n-2, … , -low_lim-1, low_lim, low_lim+1, … n-2,
n-1] x[k] * exp(sqrt(-1)*j*k* 2*pi/n),

j =-n-2, …, -low_limit-1, low_limit, low_limit+1, … n-2, n-1

Parameters:
  • x – Single-sided real array to Fourier transform.
  • low_lim – lower limit index of the array x.
  • indices – list of indices of interest
Returns:

Fourier transformed two-sided array x with adjusted lower limit. Retruns values.

pyvib.modal.lsce(frf, f, low_lim, nmax, fs, additional_timepoints=0)[source]

Compute poles(natural frequencies and damping) from FRFs.

The Least-Squares Complex Exponential method (LSCE), introduced in [1]_, is the extension of the Complex Exponential method (CE) to a global procedure. It is therefore a SIMO method, processing simultaneously several IRFs obtained by exciting a structure at one single point and measuring the responses at several locations. With such a procedure, a consistent set of global parameters (natural frequencies and damping factors) is obtained, thus overcoming the variations obtained in the results for those parameters when applying the CE method on different IRFs.

The output from LSCE is used by LSFD to compute mode shapes.

Parameters:
  • frf (ndarray) – frequency response function array - receptance
  • f (float) – starting frequency
  • low_lim (float) – lower limit of the frf/f
  • nmax (int) – the maximal order of the polynomial
  • fs (float) – time sampling interval
  • additional_timepoints (float, default 0) – normed additional time points (default is 0% added time points, max. is 1, all time points (100%) taken into computation)
Returns:

srlist – list of complex eigenfrequencies

Return type:

list

References

[1] Brown, D. L., Allemang, R. J. Zimmermann, R., Mergeay, M.,
“Parameter Estimation Techniques For Modal Analysis” SAE Technical Paper Series, No. 790221, 1979
[2] Ewins, D.J .; Modal Testing: Theory, practice and application,
second edition. Reasearch Studies Press, John Wiley & Sons, 2000.
[3] N. M. M. Maia, J. M. M. Silva, J. He, N. A. J. Lieven, R. M.
Lin, G. W. Skingle, W. To, and A. P. V Urgueira. Theoretical and Experimental Modal Analysis. Reasearch Studio Press Ltd., 1997.
[4] Kerschen, G., Golinval, J.-C., Experimental Modal Analysis,
http://www.ltas-vis.ulg.ac.be/cmsms/uploads/File/Mvibr_notes.pdf
pyvib.modal.lsce_reconstruction(n, f, sr, vr, irf, two_sided_frf=False)[source]

Reconstruction of the least-squares complex exponential (CE) method.

Parameters:
  • n – number of degrees of freedom
  • f – frequency vector [Hz]
  • sr – the complex natural frequency
  • vr – the roots of the polynomial
  • irf – impulse response function vector
Returns:

residues and reconstructed FRFs

pyvib.modal.lscf(frf, low_lim, n, fs)[source]

LSCF - Least-Squares Complex frequency domain method

The LSCF method is an frequency-domain Linear Least Squares estimator optimized for modal parameter estimation. The choice of the most important algorithm characteristics is based on the results in [1] (Section 5.3.3.) and can be summarized as:

  • Formulation: the normal equations [1]_

(Eq. 5.26: [sum(Tk - Sk.H * Rk^-1 * Sk)]*ThetaA=D*ThetaA = 0) are constructed for the common denominator discrete-time model in the Z-domain. Consequently, by looping over the outputs and inputs, the submatrices Rk, Sk, and Tk are formulated through the use of the FFT algorithm as Toeplitz structured (n+1) square matrices. Using complex coefficients, the FRF data within the frequency band of interest (FRF-zoom) is projected in the Z-domain in the interval of [0, 2*pi] in order to improve numerical conditioning. (In the case that real coefficients are used, the data is projected in the interval of [0, pi].) The projecting on an interval that does not completely describe the unity circle, say [0, alpha*2*pi] where alpha is typically 0.9-0.95. Deliberately over-modeling is best applied to cope with discontinuities. This is justified by the use of a discrete time model in the Z-domain, which is much more robust for a high order of the transfer function polynomials.

  • Solver: the normal equations can be solved for the denominator

coefficients ThetaA by computing the Least-Squares (LS) or mixed Total-Least-Squares (TLS) solution. The inverse of the square matrix D for the LS solution is computed by means of a pseudo inverse operation for reasons of numerical stability, while the mixed LS-TLS solution is computed using an SVD (Singular Value Decomposition).

Parameters:
  • frf (ndarray) – frequency response function - receptance
  • low_lim – lower limit of the frf
  • n (int) – the order of the polynomial
  • fs (float) – time sampling interval
Returns:

srlist – list of complex eigenfrequencies

Return type:

list

References

[1] Verboven, P., Frequency-domain System Identification for Modal
Analysis, Ph. D. thesis, Mechanical Engineering Dept. (WERK), Vrije Universiteit Brussel, Brussel, (Belgium), May 2002, (http://mech.vub.ac.be/avrg/PhD/thesis_PV_web.pdf)
[2] Verboven, P., Guillaume, P., Cauberghe, B., Parloo, E. and Vanlanduit
S., Stabilization Charts and Uncertainty Bounds For Frequency-Domain Linear Least Squares Estimators, Vrije Universiteit Brussel(VUB), Mechanical Engineering Dept. (WERK), Acoustic and Vibration Research Group (AVRG), Pleinlaan 2, B-1050 Brussels, Belgium, e-mail: Peter.Verboven@vub.ac.be, url: (http://sem-proceedings.com/21i/sem.org-IMAC-XXI-Conf-s02p01 -Stabilization-Charts-Uncertainty-Bounds-Frequency-Domain- Linear-Least.pdf)
[3] P. Guillaume, P. Verboven, S. Vanlanduit, H. Van der Auweraer, B.
Peeters, A Poly-Reference Implementation of the Least-Squares Complex Frequency-Domain Estimator, Vrije Universiteit Brussel, LMS International
pyvib.modal.lsfd(lambdak, f, frf)[source]

LSFD (Least-Squares Frequency domain) method

Determine the residues and mode shapes from complex natural frquencies and the measured frequency response functions.

Parameters:
  • lambdak (ndarray) – a vector of selected complex natural frequencies
  • f (ndarray) – frequency vector
  • frf (ndarray) – frequency response functions
Returns:

reconstructed FRF, modal constant(residue), lower residual, upper residual

Return type:

h, a, lr, ur

pyvib.modal.modal_ac(A, C=None)[source]

Calculate eigenvalues and modes from state space matrices A and C

Parameters:A, C – State space matrices
Returns:
  • sd (dict) – Keys are the names written below.
  • wn (real ndarray. (modes)) – Natural frequency (Hz)
  • wd (real ndarray. (modes)) – Damped frequency (Hz)
  • zeta (real ndarray. (modes)) – Damping factor
  • cpxmode (complex ndarray. (modes, nodes)) – Complex mode(s) shape
  • realmode (real ndarray. (nodes, nodes)) – Real part of cpxmode. Normalized to 1.
pyvib.modal.modal_mkc(M, K, C=None, neigs=6)[source]

Calculate natural frequencies, damping ratios and mode shapes.

If the dampind matrix C is none or if the damping is proportional, wd and zeta are None.

Parameters:
  • M (array) – Mass matrix
  • K (array) – Stiffness matrix
  • C (array) – Damping matrix
  • neigs (int, optional) – Number of eigenvalues to calculate
Returns:

sd – dict with modal parameters. Keys: {‘wn’, ‘wd’, ‘zeta’, ‘cpxmode’,’realmode’, ‘realmode’}

Return type:

dict

Examples

>>> M = np.array([[1, 0],
...               [0, 1]])
>>> K = np.array([[2, -1],
...               [-1, 6]])
>>> C = np.array([[0.3, -0.02],
...               [-0.02, 0.1]])
>>> sd = modes_system(M, K, C)
pyvib.modal.remove_redundant(omega, xi, prec=0.001)[source]

Remove the redundant values of frequency and damping vectors (due to the complex conjugate eigenvalues)

Input: omega - eiqenfrquencies vector xi - damping ratios vector prec - absoulute precision in order to distinguish between two values

pyvib.modal.stabilization(sd, fmin=0, fmax=inf, tol_freq=1, tol_damping=5, tol_mode=0.98, macchoice='complex')[source]

Calculate stabilization of modal parameters for increasing model order. Used for plotting stabilization diagram

Parameters:
  • sd (dict with keys {‘wn’, ‘zeta’, ‘realmode’/’cpxmode’, ‘stable’}) – dict of dicts having modal parameters for each model order.
  • fmin (float, default 0) – Minimum frequency to consider
  • fmax (float, default np.inf) – Maximum frequency to consider
  • tol_freq (float, default 1) – Tolerance for frequency in %, lower is better. Between [0, 100]
  • tol_damping (float, default 5) – Tolerance for damping in %, lower is better. Between [0, 100]
  • tol_freq (float, default 0.98) – Tolerance for mode shape, higher is better. Between [0, 1]
  • macchoice (str, {‘complex’, ‘real’, ‘None’}) – Method for comparing mode shapes. ‘None’ for no comparison.
Returns:

SDout – First Keys is model order, second key is modal property: {stab, freq, zeta, mode} = {True, False}

Return type:

two nested defaultdicts.