# Comparison of Nonlinear and Linear Controllers for Magnetic Levitation System
## 2 Nonlinear Magnetic Levitation System  
This paper studies and compares control designs for Magnetic levitation laboratory plant (ML), Figure 1. Magnetic levitation is inherently unstable system with fast dynamics corresponding to electromagnetic forces [19; 25]. In our laboratory plant, the aim is to position the levitating ferromagnetic ball (sphere) within the air-space between two electromagnets. Below, we consider the upper coil serving as an actuator which compensates gravitation of the ball.  
The ML nonlinear model below can be derived using Lagrange function. More details can be found in [26]. We omit argument \(t\) to improve readability. For the readers convenience we recall the basic steps of the development. Lagrange function (the difference between kinetic and potential energy) \(T\) is used in the form  
\[T=\frac{1}{2}m(\frac{dx}{dt})^{2}+\frac{1}{2}L(x)(\frac{dq}{dt})^{2}+\frac{1}{2 }\int_{0}^{t}R(\frac{dq}{dt})^{2}dt+mgx+qu \tag{1}\]  
where \(x\) is a distance of the sphere from electromagnet (position), \(q\) is electric charge, \(m\) is a mass of the sphere, \(R\) is a resistance of the electromagnet coil, \(L(x)\) is dependence of inductance of the coil on \(x\), \(I=dq/dt\) is a current in the coil, \(g\) is acceleration of gravity, \(u\) is voltage on the coil. From Lagrange equations, the following equations are obtained  
\[\begin{split}\frac{d^{2}x}{dt^{2}}&=\frac{1}{2m} \frac{dL}{dx}I^{2}+g\\ \frac{dI}{dt}&=\frac{1}{L}\biggl{(}-\frac{dL}{dx} \frac{dx}{dt}I-RI+u\biggr{)}.\end{split} \tag{2}\]  
For inductance \(L\), the next approximation is used  
\[\frac{dL}{dx}=-aL_{1}\,exp(-ax) \tag{3}\]  
The term \(\frac{dI}{dt}\) is approximated by experimentally received expression  
\[\frac{dI}{dt}=\frac{1}{f_{1}(x_{1})}(k_{1}u+c_{1}-I), \tag{4}\]  
\(k_{1},c_{1}\) can be directly measured, \(f_{1}(x_{1})\) is approximated analogically to (3). Substituting (3) and (4) into (2), splitting the first equation from (2) into two first order equations and introducing denotation  
\[a\approx\frac{1}{F_{emP2}},\quad L_{1}\approx F_{emP1},\quad\frac{dL}{dx} \approx-\frac{F_{emP1}}{F_{emP2}}exp(-\frac{x_{1}}{F_{emP2}}),\]  
Figure 1: Laboratory Magnetic Levitation Plant from INTECO [25] having 2 electromagnets (coils). A levitating sphere ball should be positioned in the air-space.  
the nonlinear ML model (5) is obtained  
\[\frac{dx_{1}}{dt} =x_{2}\] \[\frac{dx_{2}}{dt} =-\frac{F_{em1}}{2m}+g \tag{5}\] \[\frac{dx_{3}}{dt} =\frac{1}{f_{1}(x_{1})}(k_{1}u+c_{1}-x_{3})\]  
where  
\[F_{em1}=x_{3}^{2}\frac{F_{emP1}}{F_{emP2}}exp(-\frac{x_{1}}{F_{emP2}}),\quad f_ {1}(x_{1})=\frac{f_{1P1}}{f_{1P2}}exp(-\frac{x_{1}}{f_{1P2}}),\]  
state variables are: \(x_{1}=x\)--position of the ball, \(x_{2}\)--velocity of the ball, \(x_{3}=l\)--current in the upper electromagnet coil, control input \(u\) is the voltage on the upper coil, output is the position of the ball \(x_{1}\) measured as a distance from the upper coil.  
Values for \(F_{emP1},F_{emP2},f_{1P1},f_{1P2},k_{1},c_{1}\) are inherent plant parameters, their values are specific for the concrete coil; see Table 1 for the considered ML.  
All parameters are summarized in Table 1. The mass of the ball is 0.016 kg for the small ball, 0.023 kg for the medium ball and 0.039 kg for the big ball.