1 Introduction

In the last two decades, soft sensors proved themselves as a valuable alternative to the physical sensor for gathering critical process information. Predictive or virtual models are built based on the large amounts of data being measured and stored in the process industry, which are called soft sensors. This is a combination of the words “software” to compose of computer programs, and “sensors” to deliver similar information with hardware sensors [1,2,3].

Soft sensors are classified into two categories: model and data-driven soft sensors [4]. Model-driven soft sensors is commonly based on the first principle under ideal conditions. On the other hand, data-driven models apply statistical techniques to predict the value of interest. Besides, the data-driven soft sensor describes the true process condition better than the model-driven soft sensor since all data are measured within the real process.

The self-sensing technique for the magnetic bearing is considered a soft sensor since the object position is estimated from the current signal of the electromagnet [5]. Although a gap sensor is an essential element to firmly support an object, the position sensor increases the cost and size as well as causes difficult engineering or non-collocation problem. Different self-sensing approaches for magnetic bearing have been studied to replace the physical position sensor with a virtual software sensor or self-sensing technique.

Self-sensing techniques developed so far are the model-driven soft sensors [6,7,8,9,10,11,12,13,14,15,16]. Self-sensing techniques rely on the circuit equation of the electromagnet derived under the ideal condition and the nonlinear characteristic of the electromagnet is one of the most challenging problems for self-sensing technique [9].

This paper presents a data-driven self-sensing technique to compensate for the nonlinear characteristic of the electromagnet. First, model-driven self-sensing techniques and their problems are reviewed briefly. Then, data-driven self-sensing technique using RNN is proposed to compensate for the nonlinear characteristics. The effectiveness of the proposed method is experimentally verified by comparison with the current slope method.

2 Self-sensing for AMB (Active Magnetic Bearing)

AMB is to support the object without any contact using electromagnetic actuators and the feature of non-contact allows lubrication-free, high-speed operation, and easy maintenance. Therefore, AMBs have been applied to vacuum techniques, turbomachinery, electric drives, space and physics fields [17,18,19].

AMB consists of an electromagnet, an object to be suspended, a sensor, and a controller, as shown in Fig. 1. The position or gap sensor is an essential element for stably controlling the position of objects. However, the position sensor not only increases the hardware cost and size but also causes non-collocation problems, which indicates that the sensor and the actuator are not located at the same placement.

Fig. 1
figure 1

Typical block diagram of active magnetic bearings

Researchers have studied sensorless or self-sensing magnetic bearing by using an electromagnetic actuator as a sensor. In detail, the target movement changes the inductance of the electromagnetic actuator and results in a variation of the current signal due to the driving voltage. The target position can be estimated by measuring the current signal according to the driving voltage. Previous studies of self-sensing magnetic bearings are classified into three main methods. The first one is last method is more accurate and simpler than the other methods, it the state observer. In this method, the position is estimated with a state observer based on control theory [6,7,8, 20]. However, this method does not show either adequate accuracy or robustness even a little further from the operating point. The second one is the signal injection method. A high-frequency voltage signal is injected into the electromagnetic actuator and the current signal of the actuator is measured to estimate the target position through a demodulation circuit [9]. However, the desired performance can hardly be achieved due to the trade-off between the bandwidth and the accuracy of the position estimation. The final one is the parameter estimation method. The position is estimated from the current ripple or slope due to PWM voltage [10,11,12,13, 21]. The PWM voltage is very high frequency and has considerable amplitude to overcome the drawback of the high-frequency signal injection method. Although the still has estimation errors caused by non-linear properties and PWM duty cycle [15, 16].

3 Data-Driven Self-sensing

3.1 Model-Based Self-sensing Using Current Slope

If the coil of an electromagnet is driven by PWM voltage, the current ripple generated during switching is dependent on the inductance of the coil. Since the coil inductance is inversely proportional to the air gap, the air gap of the electromagnet can be estimated using the magnitude of the current ripple of the PWM [9]. Since the amplitude of the current ripple also highly depends on the PWM duty cycle, we need to compensate the effect of PWM duty cycle for accurate estimation of the air gap.

The slope of the current ripple was also used to estimate the air gap instead of the magnitude to reduce the effect of the PWM duty cycle [16]. The current slope is usually measured several times with a separate embedded device such as FPGA and estimated with the least square method. The circuit equation for the current can be expressed with Eq. (1). Here, x is air gap variation, x0 is a nominal air gap, u is PWM voltage to drive the coil, R is the resistance of the coil and I is coil current.

$$\dot{I}= \dot{x}\frac{I}{x+ {x}_{0}}+\frac{(x+ {x}_{0})}{\beta }(u-RI)$$
(1)
$$\dot{I}= \frac{\left({x}_{n}-{x}_{n-1}\right)}{{T}_{s}}\left(\frac{I}{{x}_{n}+{x}_{0}}\right)+\frac{\left({x}_{n}+{x}_{0}\right){\mu }_{0}{A}_{g}{N}^{2}}{1+a}({V}_{dc}-RI)$$
(2)
$${\widehat{x}}_{n}=\frac{I{\widehat{x}}_{n-1}{T}_{s}\dot{I}{x}_{0}-{T}_{s}{\beta {x}_{0}}^{2}({V}_{dc}-RI)}{I+2\beta {T}_{s}{x}_{0}\left({V}_{dc}-RI\right)-{T}_{s}\dot{I}}$$
(3)

The approximate current profile due to bipolar PWM is shown in Fig. 2. Here, TS is the sampling time. Current at several points during a given cycle time is measured to calculate the slope of the current ripple. Equation (1) can be discretized as Eq. (2) considering the forward difference of x and u = \({V}_{dc}\) during the current measurement. Here, \({T}_{S}\) is the PWM switching period and \({V}_{dc}\) is the voltage of the DC supplier. The air gap can be estimated from the measured current slope as shown in Eq. (3). Here, \({(1+{x}_{n}/{x}_{0})}^{2}\approx (1+2{x}_{n}/{x}_{0})\) considering \({x}_{n}\ll {x}_{0}\). As shown in Eq. (3), the nominal gap, current, and current slope are the main variables. When the average current increases or the current slope decreases, the estimated gap increases.

Fig. 2
figure 2

Bipolar PWM and current slope estimation

The non-linear relationship between the PWM current slope and the PWM duty ratio under various air gaps is measured and shown in Fig. 3. The current slopes are measured as increasing PWM duty up to 5 A coil current with a constant air gap. Although the current slope theoretically does not depend on the PWM duty cycle [15], PWM duty cycle has a large effect on the current slope under the small air gap, which may cause considerable estimation error, especially during an initial levitation. The voltage can be expressed as Eq. (4) considering bipolar PWM and duty cycle \(\upgamma\).

Fig. 3
figure 3

Non-linear relationship between PWM current slope and PWM duty under various air gaps

The current in one PWM cycle can be expressed with Eq. (5). Here, \(H(t)\) is the unit step function. Differentiating Eq. (5) and considering constant voltage (\({V}_{dc}\)) during measuring the current, the current slope does not depend on the PWM duty cycle, as shown in Eq. (6). In the case of a 50% PWM duty cycle (zero voltage command), the current slope is nearly proportional to the air gap, as shown in Fig. 3.

$$V(t)= \left\{\begin{array}{l}{V}_{dc}\,\, ({N}_{c}{T}_{s}\le t<{N}_{c}{T}_{s}+\gamma {T}_{s})\\ {-V}_{dc}\,\, ({N}_{c}{T}_{s}+\gamma {T}_{s}<t\le {(N}_{c}+1){T}_{s})\end{array}\right.$$
(4)
$$\begin{aligned} I(t) =& \ e^{-\tau t}I(0) + \frac{V_{dc}}{R} \Bigg( \Bigg. \left( 1-e^{- \tau t} \right) \nonumber \\ &- 2 \left( 1 - e^{- \tau \left( t - \gamma T_{s} \right)} \right)H \left(t - \gamma T_{s} \right) \nonumber \\ &+ \left(1-e^{-\gamma \left(t-T_{s} \right)} \right)H \left(t-T_{s} \right) \Bigg. \Bigg) \end{aligned}$$
(5)
$$\dot{I}\left( {\frac{{T_{s} }}{4}} \right) = \left( {\frac{{V_{dc} }}{L} - \frac{R}{L}I(0)} \right)e^{{ - \tau T_{s} /4}}$$
(6)

Since the initial current or I(0) of Eq. (5) within a given cycle time is closely related to the PWM duty cycle, the current slope must depend on the PWM duty cycle. Besides, non-linear characteristics such as eddy current, magnetic flux leakage, and saturation affect the estimation error of the air gap and result in degrading robustness of the position control. Furthermore, the initial current is no longer a constant value due to continuously varying PWM during the position control of AMB, and the nonlinearity becomes stronger. The higher PWM duty cycle and smaller air gap result in a severe non-linear relationship between the current slope, PWM duty, and air gap, which usually happens during the initial levitation. The high flux density due to the large current and small air gap makes the electromagnet operate in the nonlinear part of the BH curve.

3.2 Data-Driven Approach for Self-sensing

A schematic diagram of the data-driven approach for the self-sensing is shown in Fig. 4. There are two estimated air gaps: one is calculated using the model-based method \(({\widehat{x}}_{S})\), and the other is an output of the RNN model \(({\widehat{x}}_{R})\). Due to the physical limitation of digital signal processor (DSP), deep and complex neural network is not suitable for our application. Hence, we adopted a simple vanilla structure of RNN, consisting of one or two layers and three to seven sequential lengths and hidden dimensions. First, we estimate the air gap using the model-based method of Eq. (3). Then, RNN compensates for the nonlinearity of the estimated air gap. We used not only the estimated gap of the model-based method but also average current, PWM duty, and current slope (current change during one PWM cycle) as input for RNN. Besides, a fully-connected layer is used to integrate all features of the input for RNN.

Fig. 4
figure 4

Block diagram of the data-driven approach for self-sensing

After various activation functions are tested as shown in Table 1, the hyperbolic tangent function is finally employed as an activation function. Here, R2 is the training score and Q2 is the test score. The square sum of the estimation error of the air gap is used as the cost function. We employed the Adam optimization algorithm and set a 0.01 learning rate to update the weight. Besides, we used the dropout technique to avoid over-fitting.

Table 1 Training result for various activation functions

Sine wave tracking experiment is used for training data of RNN, while the initial levitation experiment is used as test data. Training data is 0.2 Hz sine wave with an amplitude of 400 μm, which is slightly less than the nominal air gap. While learning the model, we use 6 sizes of batch training. Each batch consists of 4000 data of partial sine wave, as shown in Fig. 5. Test data is the initial levitation from − 500 to 0 μm or the balanced state, which is one of the most important behaviors of magnetic levitation systems. As the hyperparameters such as the number of hidden dimensions and sequential length are adjusted, training is performed 10,000 times and the result is shown in Fig. 6. RNN with one layer, three hidden dimensions, and three sequential lengths show the best test score. Besides, the training result of LSTM (long short-term memory) is compared with that of RNN in Table 2. The RNN model reported a higher test score than any other LSTM model since the states of AMB changes rapidly during the initial levitation and the short-term memory of the LSTM is no longer critical for the performance.

Fig. 5
figure 5

Training data for one batch

Fig. 6
figure 6

Training result for each RNN model

Table 2 Training results for various models and hyperparameters

4 Experiment

4.1 Experimental Equipment

The experimental set-up of the SISO AMB system using self-sensing with RNN is shown in Fig. 7. One DOF SISO AMB system consists of a balanced beam supported with pivot bearing, an electromagnetic actuator on one side, and the weight on the other side. Parameters of the SISO AMB system are summarized in Table 3.

Fig. 7
figure 7

Block diagram of experimental set-up and device. a Block diagram, b experimental device

Table 3 Specifications for the AMB system

Electronics for self-sensing consists of a DSP (Launchpad-F28069M), 3 phase motor driver (BOOSTXL-DRV8305EVM), In-house current sensor circuit, power supply (48 V), and PC. Online monitoring and gain tuning programs are built via UART. The average current is measured with a shunt resistor in the 3-phase motor driver while the current slope is calculated with a current sensor (LEM, LTS 15-NP). We use a 0.007 \(\Omega\) resister with a differential connection in the power driver (DRV8305) to sense the average current. The current ripple is differentially amplified by 40 V/A around 1.65 V and digitized with a built-in 12-bit ADC of DSP [22]. A reference gap sensor (AEC, PU-09) is used to evaluate the performance of the self-sensing with RNN.

4.2 Implementation of RNN with DSP

Self-sensing with RNN is implemented in CLA (control law accelerator) together with position and current control, as shown in Fig. 8. Based on Eq. (3), the air gap is firstly estimated using the current slope and the RNN compensates the nonlinearity of the estimated air gap. Then, PID position and PI current controls are used to levitate the balanced beam. Training and model parameters are determined off-line using python and TensorFlow. Then, weights for the neural network are extracted and the RNN model is implemented based on hard coding, as shown in Algorithm 1 below. Since the CLA provides efficient floating-point operation in hardware, the RNN that has high computation cost is realized in CLA so that the control and self-sensing can be completed in a sample time.

Fig. 8
figure 8

DSP structure for control and self-sensing

figure e

4.3 Result

Comparison of self-sensing with current slope and RNN during initial levitation is shown in Fig. 9. At the very early stage of initial levitation, self-sensing with the current slope has a peak estimation error of 400 μm while that with RNN has just an estimation error of 40 μm (90% improvement). Besides, self-sensing with RNN has a jitter of 9 μm, which is a 36% improvement compared with 14 μm of the previous method using the current slope.

Fig. 9
figure 9

Air gap estimation of RNN and current slope methods during initial levitation a estimation performance, b estimation errors

Sine wave tracking experiments with self-sensing using current slope and RNN are shown in Fig. 10 (2 Hz). Self-sensing with the current slope has a 51 μm peak tracking error and very large phase delay while that with RNN has 17.55 μm peak tracking error (65.9% improvement) and very small phase delay.

Fig. 10
figure 10

Air gap estimation of RNN and current slope methods under 2 Hz sine wave reference. a Results, b errors

The balance beam is levitated with two self-sensing methods and their performances are compared in Fig. 11. Levitation jitter with current slope is 265.3 μm while that with RNN is 194.3 μm (26.8% improvement).

Fig. 11
figure 11

Measured air gap during sensorless control with RNN and current slope methods under step reference

5 Conclusions

This paper presents a data-driven self-sensing technique to compensate for the nonlinear characteristic of the electromagnet. First, model-driven self-sensing techniques and their problems are reviewed briefly. Then, data-driven self-sensing technique using RNN (recurrent neural network) is proposed to compensate for the nonlinear characteristics. Both the position control and self-sensing with the RNN are implemented in a single digital signal processor (DSP). The effectiveness of the proposed method is experimentally verified by comparison with the current slope method. Both estimation errors during initial levitation and jitter after levitation are reduced by 90% and 36%, respectively. Estimation error with 2 Hz sine wave is improved by 65.9% while jitter during self-sensing levitation is cut down to 26.8%.