System identification is the act of verifying whether a model is identical to a real system. In control engineering in particular, it is important to perform system identification in the frequency domain. As Sun Tzu said, “If you know the other and know yourself, you need not fear the result of a hundred battles.” Knowing the characteristics of the control target works to a great advantage when controlling it. For this reason, system identification is an extremely important process in control design.
1.1 Frequency Response
Frequency response is the steady-state output of a system to a sinusoidal input, characterized by the amplitude ratio (gain) and the phase shift between the input and output signals as a function of frequency.
When a sinusoidal input \(\mathrm{In}(t)\) is applied to a system, the steady-state output \(\mathrm{Out}(t)\) is given by:
\(\begin{aligned} \mathrm{In}(t) &= A\sin(\omega t + \phi_A) \\ \mathrm{Out}(t) &= B\sin(\omega t + \phi_B) \end{aligned}\)
If the transfer function \(G(s)\) is already known, the frequency response can be determined by substituting \(s = j\omega\) to perform \(j\omega\) analysis:
In frequency response analysis, amplitude (gain) is expressed in \(\mathrm{dB}\), and phase is expressed in \(\mathrm{deg}\).
2 Useful dB Conversion Table
Times
\(\mathrm{dB}\)
\(1\)
\(0\)
\(2\)
\(6\)
\(3\)
\(10\)
\(10^n\)
\(20n\)
Note: Values other than \(1\) and \(10^n\) are approximations. By combining these values, you can easily derive dB conversions for various cases. For example, conversions for \(\sqrt{2}\), \(6\), and \(5\) times can be calculated as follows:
Frequency response represents the relationship of a system’s steady-state response. The steady-state response refers to the output after a sufficient amount of time has passed since the input was applied, and the system has stabilized. Therefore, the transient response immediately following the input cannot be read directly from the frequency response. How, then, can experts in control engineering instantly visualize the time response (including the transient response) just by looking at the frequency response? This is because they identify the transfer function model from the frequency response and derive the time response—including the transient behavior—by performing an inverse Laplace transform on that model.
3.1 Bode Plot
A Bode plot is a visualization of the frequency response, created by varying the frequency of a single sinusoidal wave and plotting the relationship of amplitude and phase at each frequency. The horizontal axis represents frequency, while the vertical axes represent amplitude (magnitude) in the upper plot and phase in the lower plot.
Let’s use Python to plot the Bode diagram for a spring-mass-damper system model \(P(s)\). This system consists of a spring \(K\), a mass \(M\), and a damper (viscosity) \(C\). Given an applied force \(u(=f)\) and position \(y\), the mechanical configuration is shown below:
Represented as a transfer function model, it is:
\[P(s) = \frac{y}{u} = \frac{1}{Ms^2+Cs+K}\]
While this example uses a translational system, a rotational system can be represented by the same transfer function model by simply replacing mass with inertia and force with torque.
# Copyright (c) 2021 Koichi Sakataimport numpy as npfrom pylib_sakata import ctrlfrom pylib_sakata import plotprint('Start simulation!')# Common parametersdataNum =10000freqrange = [1, 1000]freq = np.logspace(np.log10(freqrange[0]), np.log10(freqrange[1]), dataNum, base=10)print('Common parameters were set.')# Plant modelM =2.0C =10.0K = M * (2.0* np.pi *10.0)**2Pns = ctrl.tf([1], [M, C, K])Pns_frd = ctrl.sys2frd(Pns, freq)print('Plant model was set.')print('Plotting figures...')# Plantfig = plot.makefig()ax_mag = fig.add_subplot(211)ax_phase = fig.add_subplot(212)plot.plot_tffrd(ax_mag, ax_phase, Pns_frd, '-', 'b', 1.5, 1.0, title='Frequency response of plant')print('Finished.')
Start simulation!
Common parameters were set.
Plant model was set.
Plotting figures...
Finished.
When plotting a Bode plot, converting the frequency unit to \(\omega[\mathrm{rad/s}] = 2\pi f\) and setting the horizontal axis to \(f[\mathrm{Hz}]\) makes it more intuitive for engineering purposes. The resonant frequency (natural frequency) \(f_n[\mathrm{Hz}]\) of a spring-mass-damper system is given by:
\[f_n = \frac{1}{2\pi}\sqrt{\frac{K}{M}}\]
The plot above shows the Bode diagram of a spring-mass-damper system with parameters set such that \(f_n = 10[\mathrm{Hz}]\). Furthermore, a general second-order transfer function \(G_{2}(s)\) can be expressed using the gain \(A\), the undamped natural angular frequency \(\omega_n[\mathrm{rad/s}]\) (natural frequency \(f_n[\mathrm{Hz}]\)), and the damping ratio \(\zeta\) as follows:
This standard form can be used to represent the model of a spring-mass-damper system.
3.2 System Identification Procedure
In system identification, we compare the frequency response of the assumed plant model \(P(s)\) with the frequency response obtained from the input-output data of the actual system on a Bode plot. As previously described, the frequency response of the plant model \(P(s)\) is determined by performing \(j\omega\) analysis (substituting \(s = j\omega\)):
In contrast, the frequency response of the actual system is analyzed by applying an excitation signal and measuring the resulting input-output response. (Specific measurement methods for real systems will be explained in the next section.)
\(\begin{aligned} \mathrm{In}(t) &= A\sin(\omega t + \phi_A) \\ \mathrm{Out}(t) &= B\sin(\omega t + \phi_B) \end{aligned}\)
Once the frequency responses for both the model and the actual system are obtained, system identification is performed following the workflow in the flowchart below.
3.3 Methods for Measuring Frequency Response
This section introduces two methods for measuring the frequency response of an actual system: using commercially available measurement equipment and implementing measurement within an embedded system.
3.3.1 Measurement Using Commercial Equipment
Measurement devices are sold under names such as FFT Analyzers or Servo Analyzers. Generally, these devices consist of a signal generator for excitation, a DAC (Digital-to-Analog Converter) for signal output, ADCs (Analog-to-Digital Converters) to capture signals before and after the system, and a signal processing unit. The analysis results can then be output to an external PC.
Advantage
Equipped with a wide variety of standard excitation signals.
Automatically analyzes and provides frequency response characteristics.
Disadvantage
Signal noise and latency from the DAC/ADC are introduced into the measurements.
Expensive due to the need for high-resolution DACs/ADCs (typically ranging from 1 to 2 million yen per unit).
3.3.2 Measurement via Implementation in Embedded Systems
In cases where standard motor drivers are insufficient, you might consider setting up an environment to implement custom real-time control on an embedded system. Typically, digital control is implemented on chips optimized for real-time processing, such as microcontrollers (MCUs), DSPs, or FPGAs. In recent years, PC-based systems have also become capable of stable, high-speed real-time processing. For instance, using an IPC (Industrial PC) from Beckhoff Automation allows you to implement C/C++ based real-time control within a Visual Studio environment, which is highly recommended.
Once the development environment is ready, you can program an excitation signal generator alongside the real-time feedback (FB) controller, as shown in the diagram below. Since you can save the input/output time-series data as digital signals without going through D/A or A/D conversion, you can derive frequency response characteristics using analysis software like Python or MATLAB.
Advantage
No need for expensive commercial measurement equipment.
Maintains signal integrity since data is handled entirely as digital signals.
Disadvantage
Higher barrier to entry, requiring specialized knowledge of control engineering.
Increased development costs (time and effort).
4 Stabilizing the Actual System
To obtain frequency characteristics by inputting excitation signals, the system must be stable. Otherwise, the output signals will diverge.
The spring-mass-damper system mentioned earlier is a stable system because the spring provides a restoring force that pulls it back to its original position. In control engineering, system stability is judged by its poles (or eigenvalues), which will be explained in detail in a separate chapter.
When the goal is motor positioning, the model is often represented without a spring component:
\[P(s) = \frac{y}{u} = \frac{1}{Ms^2+Cs}\]
This system is inherently unstable (specifically, it is marginally stable or acts as an integrator), making a feedback (FB) controller essential to stabilize the system for positioning.
However, we are performing system identification specifically because we want to design an appropriate FB controller based on a model. So, how should we handle system identification for an unstable system?
First and foremost, the system must be stabilized. This requires designing an initial FB controller based on nominal values (catalog specifications). Since the nominal mass (or inertia for rotational systems) can be determined from the motor’s catalog or mechanical design, we use those values to design a baseline FB controller.
Tips
In motor control, the model from force (torque) \(u\) to velocity \(\dot{y}\):
\[P(s) = \frac{\dot{y}}{u} = \frac{1}{Ms+C}\]
is actually a stable system due to the damping \(C\), meaning system identification is possible without an FB controller. However, obtaining actual velocity from a position sensor (encoder) requires differentiation. This process often introduces significant quantization noise due to encoder resolution, especially at low speeds. Therefore, it is highly recommended to use the raw encoder position data and stabilize the system with a “loose” FB controller to perform identification from force (torque) to position.
4.1 Adding Spring and Damping Effects via PD Control
To measure the frequency response of the transfer function from motor force (torque) to position, we can stabilize the system using PD (Proportional-Derivative) control.
As mentioned earlier, if the system is a spring-mass-damper system as shown below, it is inherently stable. Therefore, you can measure the input-output response directly by applying an excitation signal to \(d\) without adding any feedback control:
\[y = \frac{1}{Ms^2+Cs+K}d\]
Next, let’s look at a motor model without a spring \(K\), which is stabilized by feedback control using a PD controller, as illustrated below:
The original system without feedback was unstable:
\[y = \frac{1}{Ms^2+Cs}d\]
However, with the PD controller, the characteristic from \(d\) to \(y\) becomes:
\[y = \frac{1}{Ms^2+(C+K_D)s+K_P}d\]
This takes the same form as a spring-mass-damper system, meaning it is now stabilized. From a systems perspective, we can say that “virtual spring and damping effects” have been added through the proportional gain \(K_P\) and derivative gain \(K_D\) of the PD controller.
By using the PD controller to provide a “loose” spring effect and appropriate damping, the system remains stable. This allows us to measure the input-output response from the total input to the plant \((u+d)\) to the output \(y\) while the excitation signal is being injected at \(d\):