Non-Linear Control of Mag-Lev System

Felix Blanco Jr.
7 min readApr 9, 2019

--

Maglev systems are not all science fiction, this technology is used in the real world today! From Japanese bullet trains capable of going more than 300mph, to heart pumps that practically never slow down magnetic levitation systems are taking all kinds of forms.

The Future

In this short story we will discuss advanced non-linear controls methods to help control one of the earliest and simple magnetic levitation systems. The non-linear control method we will be analyzing today will be Input-State Linearization. Let’s get started!

WARNING! This post is not for those who are not comfortable with “state-space models”, “linear algebra”, “physics”, and “high level controls”. I’m sorry if I jump over theory, I expect readers to have an understanding of the above concepts.

Magnetic Levitation System

First and for most we need to understand the system defined above. As can be seen from the diagram we have both an electrical system, as well as a mechanical one. Thus, I will be using Kirchoff’s Voltage Law, and Newtonian Dynamics to create my system dynamics equations.

Kirchoffs Voltage Law

Change in current relationship

Newtonian Dynamics

Acceleration of ball relationship

Now, we have our main system dynamics equations. Before we move further, we need to understand from the above equations, what is we want to do? Do we want to keep the current at a constant 2 amps? Do we want the ball to follow some sort of input signal? Defining this very simple question will allow us to start developing “appropriate” control laws for our problem.

Mission Definition

To define what I am trying to do here. I want to control the motion of the ball. I want the ball to “track” a given input. I don’t care if that input is a square wave, a ramp, or a sine wave. I want it to track it and I want it to track it WELL.

Now, with that said the output of my system is obviously the heigh between my solenoid and the ball. The input however, is not exactly defined yet. For right now, I will say that this system will have an input signal in the form of the voltage applied the coil. Now we are ready to control our system. Input — Voltage, output — height of ball!

State Space Model

Variable Change for Simplicity
Differential Equations of State Space

As can be seen from the pictures above we have a state-space model of the system in the form of x_dot = Ax +Bu. This is the form we need our system to be in to be able to perform the Input-State Linearization.

Input-State Linearization

Now that we are ready to control our system lets analyze our differential equations first. As can be seen our systems differential equations are far from linear. X2 has a square term on top and on the bottom of a fraction. Simply put, a linear equation is one where there is only addition and multiplication, and the highest power in the equation is one. This is a very crude explanation of linear equations. With that said Input-State Linearization is a technique where we construct our input ‘u’ to cancel out ALL the non-linearities so our system can be in what is known as Closed Canonical Form. I will not be showing the math done to get to this form but I will show the control law required to get there. If you would like to derive this form simply refer to any non-linear controls text book.

First a change of coordinates is done once more to create the basis for the closed canonical form.

New Coordinates Found After Input-State Linearization

With these new state variables one can take the derivative of each equations, making sure to plug in the equation of the appropriate derivative of each X. After this is done the following differential equations, and state-space is found.

Closed Canonical form Achieved

What this new state represents our system is now a linear open-loop system! We can now use our linear control systems theories to create a desired transient response from the system! We can use methods like “root locus” analysis, and a gain feedback control law to place system poles in desired locations for optimal system performance. Here is the linearization control low needed to cancel out all our system non-linearities.

Linearization Feedback

One not worthy thing to say about this control law is that, we are dividing by x1. This… is VERY important. This means that if the parameter x1 (height) were to be zero, our controller would crap out and our system would become unstable very, VERY quickly! Just a note, don’t let the ball touch the solenoid!!

Linear Control Law

Ok. We have done a lot! We have successfully turned a non-linear system into a linear one woohoo! Now…. now what. Well using our new system state-space model we can see that all our poles are at 0. So, this probably isn’t too good. We need to get those poles onto the left half of our root-locus! To help us with this we will use what is known as a “gain” controller.

Gain Controller Equation

Remember, our equation has two parts now. A linearization feedback, and a linear control law feedback. So in essence we are running a non-linear system in closed-loop such that it becomes an open-loop linear system, AND THEN wrapping around that a closed-loop control law. Wow… thats a lot!

Well, the only way to see if all our theory will work is if we just run it! So to run this system obviously we have to either build it, or run it in simulation. I decided to simulate the system in MATLAB’s Simulink.

We also need to define some of the physical parameters, such as weight of ball, size of ball, resistance of coil, and inductance of coil. Gravity is already known! To do this I use a simple MATLAB script to get us going! I also give my state variables some inital conditions.

MATLAB Parameter Initialization Script
Non-Linear System Dynamics Model
Gain Controller and Linearization Feedback

If we were to simulate this system our gains have still not been found so we would get crap. There are two ways to find the desired gain values needed for your systems stability. One, you can use the second order system equations for overshoot, undershoot, and settling time. Or you can just brute force like I did. Here are the gains I found to work “well”.

Gain Controller Gains
Pole Locations

Simulation TIME!!!

How well do we do tracking a pulse train you may ask?

Pulse Train Tracking

But what about that Controller Effort?

Controller Effort for Pulse Train

Hmm, that controller is working pretty hard! Seems like it might be kinda hard to make a voltage source that can jump up to 150v and -100v in less than .001 seconds! How about tracking a cosine wave?

Cosine Wave Tracking
Control Law Effort

Now that is some mighty fine tracking, and that control law is just a simple sinusoidal form the looks of it! Definitely something more “feasible”. The last thing we should look at is how well it is tracking?

Tracking Error

From the looks of it we are off by +/-.00003 meters so +/-.03 mm. Thats pretty good if you ask me! Very well I say we call it a day!

Conclusion

It is important to note that although input-state linearization allows the system to track inputs there are some cons. First, if we did not get the dynamics of our system we might very well make our system unstable in the real world rather than stable. This is because we are now INPUTING more non-linear terms into our system, with the hopes that those terms cancel our the non-linearities already there. If that is not the case we have now added more non-linearity to the system and thats very bad.

Another point to make is that although we can now control the height of the ball, we are not really using the voltage as our “input” signal. What we are essentially doing is making our “voltage input” cancel out the non-linearities while another signal is inputted into the system as our “tracking” signal. For example to track a pulse train, obviously you need to input the pulse train into the system. Just more to keep in mind.

Alrighty that's it! If you have questions or comments on the actual math used to find our linearization law please leave a comment!

--

--