LQR state feedback controller with precompensator for magnetic levitation system

Magnetic levitation system (MLS) is a nonlinear system that attracts the attention of many researchers, especially control engineers. It has wide range of application such as robotics, high-speed transportation, and many more. Unfortunately, it is not a simple task to control it. Here, we utilize state feedback controller with Linear-Quadratic Regulator (LQR) to regulate the position of a steel-ball in MLS. In addition, we also introduce the precompensator to nullify the steady-state errors. The linearized model, controller, and precompensator are simulated using Matlab. The results and simulation verify that the state feedback controller and precompensator succeed to stabilize the position of steel-ball at the equilibrium for 0.1766 seconds and no steady-state errors.


Introduction
Technically, magnetic levitation system or simply MLS, is a realization of electromechanical coupling that can provide contactless motion and levitation of an object using a magnetic field. This is possible when the magnetic force is greater than the gravitational force. The magnetic field is generated from the electromagnetic coil and the current in the coil, which controls the magnitude of the magnetic force.
MLS has been widely applied in various fields, such as high-speed magnetic levitation trains [1], bearingless motor [2], robotics [3], and wind turbine [4]. It provides many advantages such as less frictional movement, high speed, environmental isolation, as well as relatively lower maintenance costs. Unfortunately, modeling and controlling this system is not easy. It is due to the nonlinear characteristics of MLS, which causes the system to become unstable. Many researchers, especially in the field of control engineering, have tried to overcome this problem by applying the feedback-linearization [5], PID controller [6], fuzzy logic controller [7], and sliding mode controller [8].
There are several components that necessary for MLS, such as controller, driver, electromagnet, and sensor [5]. In this paper, the model of MLS with 1-Degree-of-Freedom (1-DoF) is considered as depicted in Figure 1.
We present nonlinear dynamic model of MLS which is linearized to the operating point. The model of MLS is developed by investigating both electrical and mechanical parts. Furthermore, we utilize a precompensator to the reference of MLS. It is necessary, since the precompensator is expected to nullify the steady-state errors.  Figure 1. Model of a magnetic levitation system.
After introducing MLS, let us elaborate the organization of this paper. The model of MLS is briefly explained in Section 2. Later, in Section 3, the design of the controller and the precompensator are discussed. The results and analysis of this research can be found in Section 4. Last but not the least, the conclusion of this paper is explained in Section 5.

Model of Magnetic Levitation System
There are two main topics that will be explained in this section. First, in Subsection 2.1, we discuss the nonlinear model of magnetic levitation system. Later, the linearization of magnetic levitation system is presented in Subsection 2.2.

Nonlinear Equations
Let us consider the equation of motion of the steel-ball such as where respectively m, x, g, F g , F m , I, and K c denote the mass of the steel-ball, its position, gravity constant, gravitational force, magnetic force, applied driving current, and force constant of electromagnet respectively. Based on equation (1), we can define a nonlinear function as Meanwhile, the dynamics of applied driving current can be denoted aṡ where consecutively R, L, and V are the resistance, inductance, and operating voltage. Usually, the nonlinear system is expected to operate at an equilibrium point. In our case, we expect thatẍ = 0,ẋ = 0, andİ = 0. Sinceẍ andİ are zeros, it indicates that the magnetic and gravitational force are equal. Hence, the steel-ball can be levitated at an equilibrium position.
Take a look back at equation (1), since F g = F m , we can calculate the applied driving current at the equilibrium as where respectively I e and x e are the applied driving current and position of the steel-ball at the equilibrium point. Furthermore, we can obtain the voltage at equilibrium point, V e , as

Linearization
We can obtain the linearized model of MLS by applying Taylor Series Expansion as where and Let the input u be the operating voltage V e , then we can define the state space aṡ where the state vector be The state variables are x 1 , x 2 , and x 3 that respectively denote the position of the steel-ball, its velocity, and drive current. Meanwhile, the output can be defined as

Controller Design and Precompensator
In this part, we will discuss about the design of control law and precompensator for magnetic levitation system. It exists a problem of parameterization to find a stable controller [9,10,11].
Here, we utilize LQR to obtain a stable controller. A brief explanation of LQR is presented in Subsection 3.1. Meanwhile, the precompensator is elaborated in Subsection 3.2.

Linear-Quadratic Regulator
Linear-Quadratic Regulator (LQR) is an optimal control that can be implemented either for Single-Input Single-Output or Multi-Input Multi-Output system. It offers not only a good stability, but it can guarantee the stability margin of the system [12]. It is worth to be mentioned that LQR can give us a better optimal energy consumption compared againsts PID and fuzzy controller [13]. We can see the block diagram of a full-state feedback controller using LQR as depicted in Figure 2.  Figure 2. Block diagram of a LQR full-state feedback controller.
In general, LQR has an objective function such as that must be minimized. In this research, MLS has three states and one input, therefore Q ∈ R 3×3 , a 3-by-3 matrix. On the other hand, we have R ∈ R, as a scalar. Both parameters, Q and R, affect differently towards gain feedback K. If we expect a larger gain feedback K, we can increase Q. On the contrary, if we have a larger R, then we can obtain a smaller gain feedback K [14]. Next, we need to calculate the auxiliary matrix S by solving this Algebraic Ricatti Equation (ARE) where It is necessary to determine the gain feedback K such as

Precompensator
The precompensatorN is needed to handle the steady-state error. Here, the steady-state errors are expected to be zeros, where we can utilize a new value as the reference. In practice, the reference r is multiplied byN to obtain the new reference. The whole block diagram of state feedback controller with precompensator can be seen in Figure 3. There are some steps in order to calculate the precompensator. First, we need to find N as where where α ∈ R 3×1 is a column vector, meanwhile β ∈ R is a scalar. Eventually, the precompensator can be calculated asN = Kα + β.

Results and Discussion
Here we present the results of this research, including the necessary parameters. In Subsection 4.1, the parameters of magnetic levitation system is discussed. Later, in Subsection 4.2, we will explain the system response with state feedback controller and precompensator.

System Parameters
Before stepping any further, it is necessary to define the parameters of MLS that used in this research. Those parameters can be seen in Table 1. In the meantime, we also decide the equilibrium point for the position of the steel-ball x e = 0.01 m. Now, we can determine the equlibrium point for the driving current by substituting those values into equation (4), which is I e = 0.3375 A. Moreover, the operating voltage at equlibrium can be obtained using equation (5) as V e = 0.8538 V.

Simulation and Analysis
After defining the parameters, we can investigate the stability of the open-loop system. First, let us substitute those parameters on Table 1 and with the gravity constant g = 9.8 m s −2 into state matrix A and input vector B, then we have  Next, we can investigate either the system is controllable or not. It can be done by calculating the rank of controllability matrix. Here, the controllability matrix Co can be defined as where Co is a 3-by-3 matrix, which corresponds to the number of state variables. Hence, by utilizing Matlab, we can determine the rank of controllability matrix, which is 3. Since its rank is equal to the number of state variables, we can conclude that the system is controllable. Now we can design the controller using LQR, where we need to determine the parameters, which are and Those values are chosen to get a quick response of the closed-loop system [14].
Since the parameters of C, B, Q, and R, have been determined, we can solve the Algebraic Ricatti Equation in equation (13) using Matlab. Therefore, we obtain the auxiliary matrix as Eventually, the equation (14) can be solved and the feedback gain be  Figure 4. The response is quickly converge to the desired position, which can be verified by computing the rise time and settling time. It has a rise time of 0.097 seconds, and the settling time is 0.1766 seconds, without overshoot. Another thing worth to be noted that it provides no steady-state errors. Furthermore, we can analyze the dynamics of the states as depicted in Figure 5.
Based on Figure 5, we have x 1 , x 2 , and x 3 that consecutively correspond to x e ,ẋ e , and I e . Since x 1 is already explained, then we will analyze the rests. Initially the steel-ball is stand still, then after the operating voltage is being applied, it will start levitating. We can see that x 2 start increasing until x 1 ≈ x e . Hence, in order to keep x 1 = x e , then x 2 must be zero. In the meantime, after the operating voltage being applied, the driving current x 3 is flowing. We can see that x 3 is rising until it reaches the equilibrium I e . It also indicates that the equilibrium for x e has been met, since the driving current is proportional to the position of the steel-ball.

Conclusion
The modeling of magnetic levitation system and the design of state feedback controller using LQR are elaborated in this paper. The model magnetic levitation system is linearized at equilibrium points, which is necessary for designing the controller. We also implement a precompensator to nullify the steady-state errors. The model, controller, and precompensator are simulated using Matlab. It has 0.097 seconds of rise time and without overshoot. Meanwhile, the settling time is 0.1766 seconds. Additionally, the precompensator prevails to guarantee zero steady-state errors. The results and simulation verify that the state feedback controller with precompensator can give us a quick response without steady-state errors neither overshoot.