System Identification Injector

The System Identification (Sys. Id.) Injector block allows the user to inject an excitation signal on a user code variable.

Together with the Cockpit Sys. Id. module, the block can be used to set up a system identification experiment and estimate the frequency response of a system. In Simulink and PLECS simulations, the block records the identification experiment data and uses it to estimate the system frequency response by itself.

Concrete application examples using the Imperix System Identification Toolbox are given in PN215 and PN216.

Principles of operation

The system identification procedure is applied identically in the simulation environment and Imperix Cockpit. It is performed in two steps:

  1. The excitation is injected into the system and the system response is recorded
  2. The recorded data is used to estimate the system frequency response

In Cockpit, the estimated frequency response is displayed in the Sys. Id. module, in the form of a Bode plot. The data can be examined in the module, saved as a snapshot, as well as exported in the form of a CSV or MAT file.

In Simulink and PLECS, once the simulation run is complete, both the recorded and estimated data are saved automatically. In Simulink, the data is saved in a struct variable in the MATLAB base workspace, while in PLECS, the time- and frequency-domain data are saved in separate CSV files in a folder next to the PLECS model file.

Excitation Injection

Configuring the excitation signal and deciding where and how it should be injected into the system are the two most important parts of designing the identification experiment.
To accurately estimate the frequency response of a system, the applied signal should be able to excite the system over the whole frequency range of interest.

Once formed, the excitation signal can be injected in two ways:

  1. In open loop mode, by adding it to the average of the block input signal. This effectively breaks any control loops running through the injector.
  2. In closed loop mode, by adding the excitation to the block input signal

The excitation injected by the Sys. Id. Injector block is a pseudorandom binary sequence (PRBS).

PRBS Injection

A pseudorandom binary sequence (PRBS) signal has properties similar to white noise, allowing it to excite the system at a wide range of frequencies upon injection. The signal is also periodic and deterministically generated, making it easy to repeat identification experiments.

The injected PRBS signal consists of the pre-excitation part and the main part. The pre-excitation part is defined in seconds and doesn’t have to last a full PRBS period. The main part continues the binary sequence started in the pre-excitation part and lasts for 1 or more whole periods.

Figure 1: Injected PRBS signal and the closed-loop system response

The two signals that are used to estimate the system frequency response are called the numerator and the denominator. They are only recorded during the main part of the signal, while the samples corresponding to the pre-excitation part are discarded.
This is done because using non-steady state data to estimate the system frequency response significantly degrades the quality of the result. Injecting some PRBS samples before the system response is recorded helps to avoid capturing the transition from the previous steady state to the steady state under a continuous PRBS injection.

Frequency response estimation

Once the system response data is recorded, the estimation phase starts. In Cockpit, since the Sys. Id. module uses the Scope module to record the system response, this phase starts once the Scope acquisition finishes. In Simulink and PLECS, estimation begins automatically after the simulation run by the user ends.

Frequency response estimation is done in three steps:

  1. The recorded numerator and denominator data are divided into intervals corresponding to each period of the injected PRBS
  2. An Empirical Transfer Function Estimate (ETFE) is calculated for every interval. This is done by dividing the Discrete Fourier Transforms (DFT) of the numerator and denominator data.
  3. The final estimate is obtained as the average of the calculated ETFEs
Figure 2: The Bode plot of the frequency response estimated by the Sys. Id. Injector block from the data seen in Figure 1

Block parameters

Injector parameters

  • Injector name: sets the injector name. This name is used by the Sys. Id. module for active injector selection and to save simulated system identification data.
    This name must start with a character and must not contain any spaces or special characters except for the “_“ character. Also, the maximum number of characters is 21.
  • Output safety limits: allows the user to configure the upper and lower limit of the block output signal

Simulation parameters

The simulation parameters are revealed by activating the Simulate System Identification option in the Simulation parameters tab. When this option is active, the block records the input model data and estimates the frequency response at the end of the simulation.

For a given Injector name (e.g. sys_id_injector), Simulink saves the system identification data in a struct variable with that name and a suffix “_data” (e.g. sys_id_injector_data) in the MATLAB base workspace. PLECS, on the other hand, saves two CSV files (system_response.csv and etfe_result.csv), in a folder with the same name as the injector next to the PLECS model file.

The simulation parameters include:

  • Injection mode: allows the user to choose between open loop and closed loop injection modes
  • Injection start time [s]: tells the block when to start the injection. It is recommended to start the injection once the system under identification reaches a steady state
  • PRBS Peak-to-peak: configures the difference between the high and low state values of the pseudorandom binary sequence
  • Advanced PRBS settings:
    • PRBS Order: determines the length of one period of the PRBS. For an order \(N\), the length of a period is \(L=2^N-1\)
    • Number of PRBS sequence repetitions: configures how many periods of the PRBS will be injected. For \(R\) repetitions, \(R\) frequency responses are estimated using data recorded during each period. The final estimate displayed in the module is then calculated as the average of these estimates
    • Pre-excitation time [s]: sets the duration of the PRBS injected before the \(R\) full periods. The data recorded over this interval is not used for estimation. Instead, the pre-excitation samples are used to transition the system to the new steady state induced by the injected PRBS input

In PLECS, an additional parameter, CPU task execution rate [Hz], needs to be configured for proper system identification. For a CLK0 frequency \(F_{\text{CLK0}}\) and a postscaler value configured in the CONFIG block this parameter should be set to \(F_{\text{CPU}} = F_{\text{CLK0}}\) / postscaler.

Signal specification

  • in is the block input signal, upon which the PRBS is injected
  • num and den inputs record system response data to use in system identification in Simulation mode
  • out is the block output signal. Its value depends on the injection mode:
    • PRBS + in, during injection in the closed loop mode
    • PRBS + the estimated average of in, during injection in the open loop mode
    • in, otherwise
  • The open signal outputs:
    • 1, during injection in the open loop mode
    • 0, otherwise

Mask

Simulink block mask dialog
PLECS block mask dialog

References

[1] Lennart Ljung, “System Identification: Theory for the User”, Pearson Education, 1998,
ISBN: 978-0-132-44053-0