Code documentation

The Model class

class pyLump.Model(n_dof, mass, stiffness, damping, boundaries='both')[source]

Multi Degree of Freedom Models (mass-spring-damper).

__init__(n_dof, mass, stiffness, damping, boundaries='both')[source]

Initiates the data class:

Parameters

n_dofint

Number of degrees of freedom - number of masses.

massint, float, array, list, tuple

Weight of connected masses in kg. int, float - all masses have the same weight. array, list, tuple of length n_dof - specify different weight for each mass in order.

stiffnessint, float, array, list, tuple

Stiffness of springs that are connecting masses. int, float - all springs have the same stiffness. array, list, tuple of length n_dof or n_dof+1, depending on boundary condition - specify different stiffness for each spring in order.

dampingint, float, array, list, tuple

Damping coefficient of dampers that are connecting masses. int, float - all dampers have the same daming coefficient. array, list, tuple of length n_dof or n_dof+1, depending on boundary condition - specify different damping coefficients for each damper in order.

boundariesstr, optional

Boundary conditions: "free", "both", "left", "right" - which side the masses are connected to rigid surface.

get_mass_matrix()[source]

Get mass (M) matrix of the system.

Returns

ndarray

Mass matrix array of shape (n_dof, n_dof).

get_stiffness_matrix()[source]

Get stiffness (K) matrix of the system.

Returns

ndarray

Stiffness matrix array of shape (n_dof, n_dof).

get_damping_matrix()[source]

Get damping (C) matrix of the system.

Returns

ndarray

Damping matrix array of shape (n_dof, n_dof).

get_eig_val()[source]

Get state-space model eigen values and their conjugate pairs.

Returns

tuple(ndarray)

Tuple of eigen values array and their conjugate pairs array.

get_eig_vec()[source]

Get state-space model mass-normalized eigen vectors and their conjugate pairs.

Returns

tuple(ndarray)

Tuple of mass-normalized eigen vectors array and their conjugate pairs array.

get_damping_ratios()[source]

Get viscous damping ratios of the system.

Returns

ndarray

Array of shape (n_dof,) of viscous damping ratios of the system.

get_eig_freq()[source]

Get eigen frequencies of the system (in Hz).

Returns

ndarray

Array of shape (n_dof,) of eigen frequencies (in Hz).

get_FRF_matrix(freq, frf_method='f', **kwargs)[source]

Get FRF (frequency response function) matrix of the system.

Parameters

freqndarray

Frequency array (in Hz) at which the FRF values are calculated.

frf_methodstr

Method of calculating the FRF matrix: "f" - frequency domain, based on impedance inverse or "s" - state space domain, based on state-space model parameters.

Keyword arguments

n_modesint

Number of modes used for calculation of FRF matrix via state-space method (frf_method="s") by modes superpostion.

Returns

ndarray

FRF matrix array of shape of shape (n_dof, n_dof, frequency_series).

get_IRF_matrix(freq, frf_method='f', return_t_axis=False, **kwargs)[source]

Get IRF (impulse response function) matrix of the system.

Parameters

freqndarray

Frequency array (in Hz) at which the FRF values are calculated.

frf_methodstr

Method of calculating the FRF matrix: "f" - frequency domain, based on impedance inverse or "s" - state space domain, based on state-space model parameters.

return_t_axisbool, optional

True if you want to return the time axis.

Keyword arguments

n_modesint

Number of modes used for calculation of FRF matrix via state-space method (frf_method="s") by modes superpostion.

Returns

ndarray or tuple(ndarray)

Impulse response function (IRF) matrix of shape (n_dof, n_dof, time_series) or tuple based on requested returns.

get_response(exc_dof, exc, sampling_rate, resp_dof=None, domain='f', frf_method='f', return_matrix=False, return_t_axis=False, return_f_axis=False, **kwargs)[source]

Get response time series.

Parameters

exc_dofndarray, list, int

Degrees of freedom (masses) where the system is excited.

excndarray

Excitation time array 1D (one excitation DOF) or 2D (multiple excitation DOFs). 1D shape (single excitation DOF): (time series) 2D shape (multiple excitation DOFs): (number of DOFs, time series)

sampling_rateint

Sampling rate of excitation time signals.

resp_dofndarray, list, int, optional

Degrees of freedom (masses) where the response is calculated. If None - responses of all masses are caluclated.

frf_methodstr, optional

Method of calculating the FRF matrix: "f" - frequency domain, based on impedance inverse or "s" - state space domain, based on state-space model parameters

domainstr, optional

Domain used for calculation: "f" - frequency domain multiplication (via FRF matrix) or "t" - time domain convolution (via impulse response matrix).

return_matrixbool, optional

True if you want to return the FRF matrix (domain="f") or the IRF (domain="t") used for calculation.

return_t_axisbool, optional

True if you want to return the time axis.

return_f_axisbool, optional

True if you want to return the frequency axis.

Keyword arguments

n_modesint

Number of modes used for calculation of FRF matrix via state-space method (frf_method="s") by modes superpostion.

modestr

Used for convolution calculation in time domain (domain="t"). A string indicating the size of the output ("full", "valid", "same").

methodstr

Used for convolution calculation in time domain (domain="t"). A string indicating which method to use to calculate the convolution ("auto", "direct", "fft").

Returns

ndarray or tuple(ndarray)

Response time signals array of shape (len(resp_dof), time_series) or tuple based on requested returns.