Example: F-16 Ground Vibration Test benchmark¶
Example created by Wilson Rocha Lacerda Junior
Note: The following examples do not try to replicate the results of the cited manuscripts. Even the model parameters such as ylag and xlag and size of identification and validation data are not the same of the cited papers. Moreover, sampling rate adjustment and other different data preparation are not handled here.
The following text was taken from the link http://www.nonlinearbenchmark.org/#F16.
Note: The reader is reffered to the mentioned website for a complete reference concerning the experiment. For now, this notebook is just a simple example of the performance of SysIdentPy on a real world dataset. A more detailed study of this system will be published in the future.
The F-16 Ground Vibration Test benchmark features a high order system with clearance and friction nonlinearities at the mounting interface of the payloads.
The experimental data made available to the Workshop participants were acquired on a full-scale F-16 aircraft on the occasion of the Siemens LMS Ground Vibration Testing Master Class, held in September 2014 at the Saffraanberg military basis, Sint-Truiden, Belgium.
During the test campaign, two dummy payloads were mounted at the wing tips to simulate the mass and inertia properties of real devices typically equipping an F-16 in ﬂight. The aircraft structure was instrumented with accelerometers. One shaker was attached underneath the right wing to apply input signals. The dominant source of nonlinearity in the structural dynamics was expected to originate from the mounting interfaces of the two payloads. These interfaces consist of T-shaped connecting elements on the payload side, slid through a rail attached to the wing side. A preliminary investigation showed that the back connection of the right-wing-to-payload interface was the predominant source of nonlinear distortions in the aircraft dynamics, and is therefore the focus of this benchmark study.
A detailed formulation of the identification problem can be found here. All the provided files and information on the F-16 aircraft benchmark system are available for download here. This zip-file contains a detailed system description, the estimation and test data sets, and some pictures of the setup. The data is available in the .csv and .mat file format.
Please refer to the F16 benchmark as:
J.P. Noël and M. Schoukens, F-16 aircraft benchmark based on ground vibration test data, 2017 Workshop on Nonlinear System Identification Benchmarks, pp. 19-23, Brussels, Belgium, April 24-26, 2017.
pip install sysidentpy
import numpy as np import matplotlib.pyplot as plt import pandas as pd from sysidentpy.polynomial_basis import PolynomialNarmax from sysidentpy.metrics import root_relative_squared_error import pandas as pd pd.set_option('display.max_columns', 1000)
f_16 = pd.read_csv(r'../../../examples/datasets/f-16.txt', header=None, names=['x1', 'x2', 'y'])
Visualizating the data¶
f_16[['x1', 'x2']][0:500].plot(figsize=(12, 8))
Spliting the data¶
x1_id, x1_val = f_16['x1'][0:16384].values.reshape(-1, 1), f_16['x1'][16384::].values.reshape(-1, 1) x2_id, x2_val = f_16['x2'][0:16384].values.reshape(-1, 1), f_16['x2'][16384::].values.reshape(-1, 1) x_id = np.concatenate([x1_id, x2_id], axis=1) x_val = np.concatenate([x1_val, x2_val], axis=1) y_id, y_val = f_16['y'][0:16384].values.reshape(-1, 1), f_16['y'][16384::].values.reshape(-1, 1)
Setting the lags the inputs¶
x1lag = list(range(1, 10)) x2lag = list(range(1, 10)) x2lag
[1, 2, 3, 4, 5, 6, 7, 8, 9]
Model training and evalutation¶
model = PolynomialNarmax(# n_terms=8, non_degree=1, order_selection=True, ylag=20, xlag=[x1lag, x2lag], n_inputs = 2, n_info_values=39, info_criteria='bic', extended_least_squares=False, estimator='least_squares') model.fit(x_id, y_id) y_hat = model.predict(x_val, y_val) rrse = root_relative_squared_error(y_val, y_hat) print(rrse) results = pd.DataFrame(model.results(err_precision=8, dtype='sci'), columns=['Regressors', 'Parameters', 'ERR']) results
a, b,c,d = model.residuals(x_val, y_val, y_hat) model.plot_result(y_val, y_hat, a, b, n=600)
Information Criteria plot¶
xaxis = np.arange(1, model.n_info_values + 1) plt.plot(xaxis, model.info_values) plt.xlabel('n_terms') plt.ylabel('Information Criteria') # You can use the plot below to choose the "n_terms" and run the model again with the most adequate value of terms.
Text(0, 0.5, 'Information Criteria')