# Design of a Discrete Tracking Controller for a Magnetic Levitation System: A Nonlinear Rational Model Approach

Authors: Fernando Gómez-Salas; Yongji Wang; Quanmin Zhu
Journal: Mathematical Problems in Engineering
 (2015)

---

## Abstract

This work proposes a discrete-time nonlinear rational approximate model for the unstable magnetic levitation system. Based on this model and as an application of the input-output linearization technique, a discrete-time tracking control design will be derived using the corresponding classical state space representation of the model. A simulation example illustrates the efficiency of the proposed methodology.


---

## Body

## 1. Introduction

The magnetic levitation system is an interesting nonlinear and unstable complex system. Due to its great importance in many fields of the engineering, this system is becoming popular in recent years. In fact, the magnetic levitation system has been successfully applied in high speed trains [1, 2], frictionless bearings [3, 4], and vibration isolation tables [5].Although the magnetic levitation has been successfully applied to many real systems which work in continuous time, most of the control functions need to be implemented through digital devices such as computers. For this reason, a direct design strategy is to design discrete-time controllers directly from discrete-time models based on either input-output models or state space models. Moreover, when a nonlinear plant needs to be controlled, this immediately raises the problem of what class of model should be used [6]. Polynomial models are generally used for many applications but they are inadequate for severe nonlinear systems and the nonlinear rational NARMAX model was introduced to overcome this problem. The main advantage of the rational model is the efficiency to depict high nonlinearities with a few parameters. However, control design and identification for this model are comparatively complicated compared with the polynomial models [7–10].Despite the fact that many works have used either input-output models or state space models for control design, the model based control system design expresses a clear preference for the latter. In fact, the classical state space representation is still dominant in the control literature since it allows describing internal dynamics in almost all systems (mechanical systems, electrical systems, economics systems, and so forth). Some advantages of this representation can be described as follows: the model directly provides a time-domain solution, which is ultimately the thing of interest; the form of the solution is the same as that for a single first-order differential equation; the effect of initial conditions can be easily incorporated in the solution; the matrix-vector modeling is very efficient in computation and computer implementation, which are particularly significant in large and complex system simulations. In this way, the importance of the state space models for either simulation or control design is undisputed.As is well known, the nonlinear trajectory tracking problem is a topic of great importance in many real applications [11–13]. In practical control problems, however, the nonlinearities of a complex system are in general very difficult to handle in a direct way. Therefore, a well-known control strategy consists, first of all, in transforming the system structure by appropriate feedbacks, so as to substitute nonlinear relations with linear ones [14].In the literature, a number of control strategies have been reported in order to design stabilizing control laws for the magnetic levitation system. However, these existing solutions are mainly discussed using classical methods [15, 16]. Moreover, new approaches have been reported (frequently based on continuous-time techniques); however, these are based on the linearized model about a nominal operating point and the tracking performance falls quickly when the deviations leave the nominal operating point [17]. Therefore, to ensure long ranges of motion and still having a good tracking performance, it is necessary to consider a nonlinear model rather that a linear one.In this spirit and since control functions need to be implemented through digital devices, this work considers the problem of finding a discrete-time nonlinear rational model for a generic magnetic levitation system and then designing a discrete-time tracking controller for this model.The arrangement of this study is as follows. In Section2, the discrete-time model for a generic magnetic levitation system is presented. Section 3 formulates the tracking problem studied in this work. Additionally, this section presents the corresponding feedback solution derived as an application of the input-output linearization technique. In Section 4, a numerical example is presented in order to validate the proposed methodology of the study. Finally, in Section 5 some conclusions are given.


## 2. System Dynamics and Modeling

Figure1 shows the schematic of a generic magnetic levitation system. The target of this system is to control the position of the small ball of mass m. By using an electromagnetic force fm, which is produced from a current i(t), this small metal ball can be displaced a distance y(t) from the electromagnet. Notice, however, that this system assumes that y(t)≠0.Figure 1
A generic magnetic levitation system.As it is mentioned in [19], the mathematical model for this generic magnetic levitation system can be described as(1)Ldi(t)dt+Ri(t)=u(t)my¨t=mg-fm=mg-ci(t)y(t)2,where fm is electromagnetic force, i(t) is coil current, y(t) is distance between the electromagnet and the small metal ball, c is inductive coupling constant, u(t) is applied voltage, L is coil inductance, R is coil resistance, m is mass of the small metal ball, and g is gravitational constant.As can be seen from (1), the system dynamics for this generic magnetic levitation system are nonlinear. Therefore, since this nonlinear continuous-time model needs to be controlled via a digital controller, this nonlinear model can be discretized using sampling devices. However, a shortcoming of this approach is that the sampling will destroy important features of the dynamics of this system. For this reason, an alternative approach is to find the corresponding Euler approximate model of this system [20]. Indeed, one motivation for doing this comes from the fact that this technique preserves many important features of the continuous systems such as the strict feedback structure [21].Consider the nonlinear coupled system (1). That is, (2)d2y(t)dt2=g-cmi2(t)y2(t)di(t)dt=-RLi(t)+1Lu(t).Thus, the last equations can be discretized in time by setting t=nT, where T is a fixed positive number and n takes only integer values. This means that(3)d2y(t)dt2t=nT=g-cmi2nTy2nT,di(t)dtt=nT=-RLi(nT)+1Lu(nT).Moreover, notice that(4)d2y(t)dt2t=nT=y(nT+2T)-2y(nT+T)+y(nT)T2,di(t)dtt=nT=i(nT+T)-i(nT)T.Now, inserting the approximations (4) into (3) gives(5)y(nT+2T)-2y(nT+T)+y(nT)T2=g-cmi2(nT)y2(nT)i(nT+T)-i(nT)T=-RLi(nT)+1Lu(nT).In order to be consistent with the notation that is being used for discrete-time signals, the signal i(nT) and the signal y(nT) can be denoted by i(k) and y(k), respectively; that is,(6)ik=itt=nT,y(k)=y(t)t=nT.Therefore, in terms of this notation and after some algebra (5) becomes (7)y(k+2)=T2g-cT2mi2(k)y2(k)+2y(k+1)-y(k)ik+1=1-RTLik+TLuk,where T is the sampling period.Now, without loss of generality assume thatT=1. Hence the discrete-time representation of the magnetic levitation system considered in this work is given by(8)y(k+2)=g-cmikyk2+2y(k+1)-yki(k+1)=1-RLi(k)+1Lu(k).Notice that the difference equation (8) is a nonlinear rational NARMAX model. Moreover, if we define x1(k)=y(k), x2(k)=y(k+1), and x3(k)=i(k), this yields(9)x1(k+1)=x2(k)x2(k+1)=g-cmx3(k)x1(k)2+2x2(k)-x1(k)x3(k+1)=1-RLx3(k)+1Lu(k)yk=x1k,which is the classical state space representation of the coupled system (8).


## 3. Design of the Controller

In this section, as an application of the input-output linearization technique, a discrete-time tracking controller for the system (9) will be developed. In general, this problem can be stated as follows.Consider the system(10)x(k+1)=f(x(k),u(k))y(k)=h(x(k)),where x∈Rn, u∈R, and y∈R. The mappings f and h are assumed to be analytic.Thus, given a referenceyd(k),  k=1,2,3,…, one needs to find a suitable control input so that the output y(k) of the closed-loop system follows yd(k) asymptotically. That is,(11)e(k)=yd(k)-y(k)goes asymptotically to 0 as k→∞.Theorem 1 (general tracking [14, 22]).
If the nonlinear system (10) has a well-defined relative degree r and if the zero dynamics of the linearized system is asymptotically stable, then a control law u(k) exists.Note that the relative degreer is the smallest number of sampling periods after which the input u(k) affects the output y(k). In fact, in every well-formulated control problem the output y(k) has a finite relative degree r.Remark 2.
In the special case thatr=n, the zero dynamics of the linearized system does not exist. In this case, the linearized system is called minimum phase [14].Under the special conditionr=n, one can define in an arbitrary way the behavior of the error. However, this behavior needs to satisfy the asymptotic performance of the original problem. In general, one can select the evolution of the error as(12)ek+r=-∑i=0r-1‍piek+1,where zr+pr-1zr-1+⋯+p0 is a Schur polynomial and the pi’s are real numbers.After some basic algebra, (12) can be rewritten as(13)yk+r=ydk+r+∑i=0r-1‍piek+1,where(14)y(k+r)=h∘fr-1∘fx(k),u(k).And ∘ denotes the composition operator. In this way, via the implicit function theorem, (13) is locally solvable in u(k) which is assumed to be well defined on Rn×R and solves the problem.Based on above discussion, let us consider to design a discrete-time tracking controller for the nonlinear discrete rational model system (9). Since this system has a finite relative degree r=3 and satisfies the special condition r=n (one can readily verify this), one can proceed as follows.Given a desired trajectoryyd(k), define the tracking error as (15)ek=ydk-yk=yd(k)-x1k.Next, increasing one step time ahead the last expression gives (16)ek+1=ydk-x1k+1=yd(k+1)-x2(k).Moreover, notice that (17)ek+2=ydk+2-x2k+1=yd(k+2)-g+cmx3(k)x1(k)2-2x2(k)+x1(k),(18)ek+3=ydk+3-g+cmx3k+1x1k+12-2x2k+1+x1k+1=ydk+3+cm1-R/Lx3k+(1/L)ukx2k2+2cmx3(k)x1(k)2+2x1(k)-3g+x2(k).Now, since the behavior of the error can be chosen as (19)ek+3=-p2ek+2-p1ek+1-p0ek,it can be seen from the Schur-Cohn Criterion [23] that a necessary and sufficient condition for the zero solution of the last equation to be asymptotically stable is(20)p2+p0<1+p1,p1-p2p0<1-p02.Thus, after some algebra (18) can be rewritten as(21)cm1-R/Lx3k+(1/L)uk2x22k=ek+3-ydk+3+3g+x2k-2cmx3(k)x1(k)2+x1(k),or(22)u2(k)+2L-Rx3(k)u(k)+L-R2x32(k)+T(k)=0,where(23)Tk=-mL2x22kc×ek+3-ydk+3+3g+x2k-2x1k+2L2x22(k)x3(k)x1(k)2.Finally, (22) can be easily solved in u(n) as(24)u1,2k=2L-Rx3(k)2-4L-R2x32(k)-T(k)-2L-Rx3k±2L-Rx3(k)2-4L-R2x32(k)-T(k)×2-1which solves our problem. Notice, however, that these solutions are well defined for(25)x1(k)>0,x2(k)>0,x3(k)≠0,ek+3+3g+x2k≥yd(k+3)+2cmx3(k)x1(k)2+2x1(t).Remark 3.
At this point it is important to mention that in this work it is assumed that(i)
yd(k) and its time-shift up to yd(k+r) are bounded for all k≥0 and the kth time-shift is a piecewise continuous function of k;(ii)
the signalsyd(k),…,yd(k+r) are available online.With this in mind, one can easily compute the evolution of the error(26)e(k+3)=-p2e(k+2)-p1e(k+1)-p0e(k),as follows. After choosing the corresponding p0, p1, and p2, we have that(27)e(k)=yd(k)-y(t),e(k+1)=yd(k+1)-x2(t),e(k+2)=yd(k+2)-g+cmx3(k)x1(k)2-2x2(k)+x1(k),where x1(k),x2(k), and x3(k) can be estimated from system (9).Remark 4.
When the input-output linearization technique is applied to a nonlinear system we have to consider two cases.
In the first case (r<n), the complete dynamic of the compensated system can be divided in two parts: the external controller part and the internal unobserved and uncontrolled part also known as the internal dynamic system. As is well known, to determine the internal dynamics of the system can be very difficult; however, the designed control for external dynamics is applicable only when the internal dynamics of the systems is stable or bounded in some sense.
In the second case (r=n), the zero dynamics of the linearized system does not exist. In this case, the linearized system is called minimum phase [14]. In this way, since this study considers the special case r=n, the stability analysis of this work can be stated as follows. Consider system (12); that is,(28)ek+r+pr-1ek+r-1+⋯+p1e(k+1)+poe(k)=0with p0,p1,…,pr-1∈R.
Thus, the zero solution of (12) will be asymptotically stable if and only if z<1 for every characteristic root z of (12). That is, for every zero solution of the characteristic polynomial,(29)Pz=zk+pr-1zk-1+⋯+p0.Additionally, the solution of (12) is stable if and only if |z|≤1 for all characteristic roots of (12) and those characteristic roots z with |z|=1 are simple (not repeated). In contrast, if there is a repeated characteristic root z with |z|=1, then the zero solution of (12) is unstable. Note that necessary and sufficient conditions for the stability of system (19) are(30)p2+p0<1+p1,p1-p2p0<1-p02.


## 4. Simulation Results

In this section, in order to validate the procedure described in the last section, a simulation was developed to control the nonlinear rational model (8).The physical parameter values used in this simulation were taken from [19] and are presented in Table 1.Table 1
Physical parameters of the magnetic levitation system.
Parameter
Symbol
Value
Mass of the small metal ball
m [kg]
0.068
Steady-state coil current
i
0 [A]
0.76
Coil inductance
L [H]
0.438
Coil resistance
R [Ω]
28
Inductive coupling constant
C [Nm2/A2]
7.39
×
1
0
-
5
Gravitational constant
g [m/s2]
9.81
Steady-state gap between the electromagnet and the ball
y
0 [m]
0.008In this simulation the desired referenceyd(k) was defined to be a sinusoidal signal as is shown in Figure 2. Moreover, the error equation (19) was defined to be(31)e(k+3)-1.1e(k+2)+0.48e(k+1)-0.09e(k)=0which means that(32)z3-1.1z2+0.48z-0.09=0is a Schur polynomial. That is, the characteristic roots (33)z=-0.5z=-0.3±0.3isatisfy the condition z<1.Figure 2
NARMAX model (8) controlled by the feedback solution (24). (a) Output y(k) (solid) and reference input yd(k) (dashed). (b) Tracking error e(k) for the controls u1(k) and u2(k), respectively.
(a)
(b)As was predicted in the last section, the corresponding feedback solutions achieve an asymptotic tracking of the reference trajectory; see Figures2 and 3. A plot of the designed signal controls u1(k) and u2(k) with their corresponding current signals is depicted in Figures 4 and 5, respectively. Note that the issue of the internal dynamic for this work was ignored because of (r=n).Figure 3
System response of the rational NARMAX model (8). (a) State signal x1(k). (b) State signal x2(k).
(a)
(b)Figure 4
Designed controllers for the rational NARMAX model (8). (a) Control signal u1(k). (b) Current signal x3(k) generated by u1(k).
(a)
(b)Figure 5
Designed controllers for the rational NARMAX model (8). (a) Control signal u2(k). (b) Current signal x3(k) generated by u2(k).
(a)
(b)In order to compare our approach with related works, we chose the exact input-output feedback linearization technique (continuous-time) given in [18] and the classical controller design proposed in [19].The methodology used in the study proposed in [18] works with the exact input-output feedback linearization and the pole assignment technique. As is described in this work, the resulting input transformation, the state transformation, and the control law of the form(34)v=-Kx~+Nyrefwith K as the vector of gains, N as feedforward gain, x~ as the new state variable, and yref as the reference input were implemented in Simulink in order to validate these results; see Figure 6. Although the results reported in this work have been successfully validated via simulations, the real implementations will need a discrete version of these results. As was mentioned before, if one uses sampling devices it will destroy important features of the dynamics of this system. For this reason, a direct design strategy is to design discrete-time controllers directly from discrete-time models. In this way, the results presented in our study allow avoiding these inconveniences; see Figure 7.Figure 6
Magnetic levitation system response for the exact input-output feedback linearization technique (continuous-time) given in [18], time (t) in seconds.Figure 7
Response of the discrete-time magnetic levitation system controlled via the feedback solution (24); output y(k) (solid) and reference input yd(k) (dashed). The signal y(k) was plotted with p0=0.1, p1=0.3, and p2=0.5.Alternatively, we compare our approach with the controller proposed in [19]. As can be seen in Figure 8, our approach follows the same step reference given in [19]; see Figure 9. However, the work proposed by Wong becomes unstable for ranges outside of the linearized range. In fact, the allowable tolerance band was found to be ±1 mm around yo. In this way, the results proposed in our work overcome this problem.Figure 8
System step response for the NARMAX model (8) controlled by the feedback solution given by (24). The signal y(k) was plotted with p0=0.1, p1=0.3, and p2=0.5.Figure 9
System step response for the magnetic levitation system reported in [19], time (t) in seconds.


## 5. Conclusions

In this study, a digital-time tracking controller for the nonlinear discrete-time version of a generic magnetic levitations system was designed. Although in general a generic nonlinear input-output equation is not realizable via the classical state space representation, the simplicity of the proposed discrete nonlinear rational model allows finding its corresponding state space representation.As can be seen from the simulation results, the corresponding control signals perform well in the presence of nonlinear behaviors. In this way, these signals are attractive candidates for a real application of a magnetic levitation system.



---

*Source: 360783-2015-03-19.xml*