The ssi module
This module provides a collection of utility functions to support the implementation of Stochastic Subspace Identification (SSI) algorithms [BPDG99], [MiDo11], [DOME13]. It includes functions for building Hankel matrices with various methods, converting state-space representations to modal parameters,performing system identification using SSI, and extracting modal parameters from identified systems.
- Functions:
build_hank(): Constructs a Hankel matrix from time series data.SSI(): Performs system identification using the SSI method.SSI_fast(): Efficient implementation of the SSI system identification.SSI_poles(): Computes modal parameters from identified state-space models.SSI_multi_setup(): SSI for multiple setup measurements.SSI_mpe(): Extracts modal parameters for selected frequencies.
Stochastic Subspace Identification (SSI) Utility Functions module. Part of the pyOMA2 package. Authors: Dag Pasca Angelo Aloisio
- pyoma2.functions.ssi.SSI(H: ndarray, br: int, ordmax: int, step: int = 1) Tuple[ndarray, List[ndarray], List[ndarray]][source]
Perform System Identification using the Stochastic Subspace Identification (SSI) method.
The SSI algorithm estimates system matrices and output influence matrices for increasing model orders, based on a provided Hankel matrix.
- Parameters:
- Returns:
Obs (np.ndarray) – The observability matrix for the system.
A (list of np.ndarray) – Estimated system matrices for various system orders.
C (list of np.ndarray) – Estimated output influence matrices for various system orders.
Notes
This is a classical implementation of SSI using the shift structure of the observability matrix. For faster implementations, consider using SSI_fast.
- pyoma2.functions.ssi.SSI_fast(H: ndarray, br: int, ordmax: int, step: int = 1) Tuple[List[ndarray], List[ndarray], List[ndarray]][source]
Perform a fast implementation of Stochastic Subspace Identification (SSI).
This optimized SSI method uses QR decomposition to accelerate the extraction of system and output matrices for varying model orders.
- Parameters:
- Returns:
Obs (np.ndarray) – The global observability matrix of the system.
A (list of np.ndarray) – List of estimated system matrices for each model order.
C (list of np.ndarray) – List of estimated output influence matrices for each model order.
Notes
This method is computationally more efficient than the classical SSI approach, leveraging QR decomposition for rapid estimation, see [DOME13].
- pyoma2.functions.ssi.SSI_mpe(freq_ref: list, Fn_pol: ndarray, Xi_pol: ndarray, Phi_pol: ndarray, order: int | list | str, step: int, Lab: ndarray | None = None, rtol: float = 0.05, Fn_std: ndarray = None, Xi_std: ndarray = None, Phi_std: ndarray = None) Tuple[ndarray, ndarray, ndarray, ndarray | int, ndarray | None, ndarray | None, ndarray | None][source]
Extract modal parameters using the Stochastic Subspace Identification (SSI) method for selected frequencies.
- Parameters:
freq_ref (list) – List of selected frequencies for modal parameter extraction.
Fn_pol (numpy.ndarray) – Array of natural frequencies obtained from SSI for each model order.
Xi_pol (numpy.ndarray) – Array of damping ratios obtained from SSI for each model order.
Phi_pol (numpy.ndarray) – 3D array of mode shapes obtained from SSI for each model order.
order (int, list of int, or str) – Specifies the model order(s) for which the modal parameters are to be extracted. If ‘find_min’, the function attempts to find the minimum model order that provides stable poles for each mode of interest.
Lab (numpy.ndarray, optional) – Array of labels identifying stable poles. Required if order is ‘find_min’.
rtol (float, optional) – Relative tolerance for comparing frequencies, by default 5e-2.
Fn_std (numpy.ndarray, optional) – Covariance array of natural frequencies, by default None.
Xi_std (numpy.ndarray, optional) – Covariance array of damping ratios, by default None.
Phi_std (numpy.ndarray, optional) – Covariance array of mode shapes, by default None.
- Returns:
A tuple containing: - Fn (numpy.ndarray): Extracted natural frequencies. - Xi (numpy.ndarray): Extracted damping ratios. - Phi (numpy.ndarray): Extracted mode shapes. - order_out (numpy.ndarray or int): Output model order used for extraction for each frequency. - Fn_std (numpy.ndarray, optional): Covariance of extracted natural frequencies. - Xi_std (numpy.ndarray, optional): Covariance of extracted damping ratios. - Phi_std (numpy.ndarray, optional): Covariance of extracted mode shapes.
- Return type:
- Raises:
AttributeError – If ‘order’ is not an int, list of int, or ‘find_min’, or if ‘order’ is ‘find_min’ but ‘Lab’ is not provided.
- pyoma2.functions.ssi.SSI_multi_setup(Y: list, fs: float, br: int, ordmax: int, method_hank: str, step: int = 1) Tuple[ndarray, List[ndarray], List[ndarray]][source]
Perform Subspace System Identification SSI for multiple setup measurements.
- Parameters:
Y (list of dictionaries) – List of dictionaries, each representing data from a different setup. Each dictionary must have keys ‘ref’ (reference sensor data) and ‘mov’ (moving sensor data), with corresponding numpy arrays.
fs (float) – Sampling frequency of the data.
br (int) – Number of block rows in the Hankel matrix.
ordmax (int) – Maximum order for the system identification process.
methodHank (str) – Method for Hankel matrix construction. Can be ‘cov’, ‘cov_R’, ‘dat’.
step (int, optional) – Step size for increasing the order in the identification process. Default is 1.
- Returns:
Obs_all : numpy array of the global observability matrix. A : list of numpy arrays
System matrices for each model order.
- Clist of numpy arrays
Output influence matrices for each model order.
- Return type:
- pyoma2.functions.ssi.SSI_poles(Obs: ndarray, AA: List[ndarray], CC: List[ndarray], ordmax: int, dt: float, step: int = 1, HC: bool = True, xi_max: float = 0.1, calc_unc: bool = False, H: ndarray = None, T: ndarray = None) Tuple[ndarray, ndarray, ndarray, ndarray, ndarray | None, ndarray | None, ndarray | None, ndarray | None][source]
Calculate modal parameters using the Stochastic Subspace Identification (SSI) method.
The function computes natural frequencies, damping ratios, and mode shapes for a range of system orders. Optional uncertainty propagation can be performed.
- Parameters:
Obs (np.ndarray) – The global observability matrix.
AA (list of np.ndarray) – List of estimated system matrices for each model order.
CC (list of np.ndarray) – List of output matrices for each model order.
ordmax (int) – The maximum model order.
dt (float) – Sampling time step.
step (int, optional) – Step size for increasing model order. Default is 1.
HC (bool, optional) – Whether to apply modal filtering to remove unstable poles. Default is True.
xi_max (float, optional) – Maximum allowed damping ratio. Default is 0.1.
calc_unc (bool, optional) – Whether to calculate uncertainties for modal parameters. Default is False.
H (np.ndarray, optional) – The Hankel matrix, required for uncertainty propagation. Default is None.
T (np.ndarray, optional) – Auxiliary uncertainty matrix cov(H) used in uncertainty propagation.
- Returns:
Fn (np.ndarray) – Array of natural frequencies for each system order.
Xi (np.ndarray) – Array of damping ratios for each system order.
Phi (np.ndarray) – Normalised (to unity) mode shapes for each system order.
Lambdas (np.ndarray) – Continuous-time eigenvalues for each system order.
Fn_std (np.ndarray, optional) – Standard deviations of natural frequencies, returned if calc_unc is True.
Xi_std (np.ndarray, optional) – Standard deviations of damping ratios, returned if calc_unc is True.
Phi_std (np.ndarray, optional) – Standard deviations of mode shapes, returned if calc_unc is True.
- pyoma2.functions.ssi.build_hank(Y: ndarray, Yref: ndarray, br: int, method: Literal['cov', 'cov_R', 'dat'], calc_unc: bool = False, nb: int = 50) Tuple[ndarray, ndarray | None][source]
Construct a Hankel matrix with optional uncertainty calculations.
This function constructs a Hankel matrix using various methods, such as covariance-based or data-driven approaches, and optionally computes uncertainty matrices.
- Parameters:
Y (np.ndarray) – The primary data matrix with shape (number of channels, number of data points).
Yref (np.ndarray) – The reference data matrix with shape (number of reference channels, number of data points).
br (int) – The number of block rows in the Hankel matrix.
method ({'cov', 'cov_R', 'dat'}) – The method for constructing the Hankel matrix: - ‘cov’: Covariance-based. - ‘cov_R’: Covariance-based with auto-correlations. - ‘dat’: Data-driven.
calc_unc (bool, optional) – Whether to calculate uncertainty matrices. Default is False.
nb (int, optional) – The number of data blocks to use for uncertainty calculations. Default is 50.
- Returns:
Hank (np.ndarray) – The constructed Hankel matrix.
T (np.ndarray or None) – The uncertainty matrix, returned only if calc_unc is True. None otherwise.
- Raises:
AttributeError – If method is not one of {‘cov’, ‘cov_R’, ‘dat’}, or if data is insufficient for uncertainty calculation.
Notes
Uncertainty calculations follow the approach detailed in [DOME13].