## 2 Theoretical Background and Preliminaries
### Nn-Narx Modeling of the MI System
The reason for using the filter is that in the real model, the signal has noise and needs a filter. The same was done in the neural network model. In fact, the neural network model is the same as the maglev model with a raw signal without a filter. After sending the simulated control signal to the hardware and acquiring the real signals (voltage) from the hardware, the signals are converted to corresponding position, [m] and current [A] by experimental look-up tables. Then, the signals are filtered to eliminate undesirable noises. The velocity of the ball is obtained by an inaccurate, but acceptable, memory element which applies a unity integration step delay. The output is the previous input value. In Figure 6, an overview of our project is shown. The mathematical model and ANN model were inserted in the real-time Simulink model in order to compare the three parts in the same situations. The input includes the range of sine wave, chirp wave with the frequency variation from 1 Hz to 6 Hz, the step input which contains all range of frequency and the constant input (steady state position is 0.011 m). To determine this NARX configuration, several sizes of TDL and neuron numbers in the hidden layer were tested for data from the experimental system. The best modeling performance was obtained for 12 neurons in hidden layer and TDL units with one sample delay element. The training algorithm used was the Levenberg-Marquardt method and the training process was completed in 113 iterations. The training task of the NARX model was carried out off-line by using the data set [\(u(t)y(t)\)] that was collected from the experimental system. The time-series data set was automatically divided into training, validation and test sets. Figure 6 shows a Simulink model  
Figure 4: Representation of neural network (NN)-nonlinear autoregressive neural network with external inputs (NARX) structure. The first layer activation function \(f_{1}\) is generally a nonlinear activation function to model nonlinear relations in the data. The second layer activation function \(f_{2}\) is a linear activation function that rescales NARX output to original output data. Thus, it can yield satisfactory predictions of a nonlinear system dynamics. that was developed for the training of NARX model in a virtual closed-loop. For the closed-loop model identification, NARX model is put into a virtual control loop that is composed of the controller function of the identified closed-loop system and the NARX model to access the in-loop dynamics of the ML system. This virtual closed-loop can provide relevant training data, which is related to the in-loop dynamics of ML setup, to learn by NARX model. In the cases that outputs of the identified closed-loop experimental control system and the virtual closed-loop system with NARX model match, NARX model is said to be learned responses of ML system in the closed-loop. In the following section, this virtual closed-loop control system with NARX model is used as the reference model of multi-loop MRAC-FOPID control structure. All simulation results were obtained at Control Systems Research Laboratory, Tallinn University of Technology.