## Introduction

The magnetic levitation (maglev) system is a classical controls problem. The system is composed of an electromagnet, a ferromagnetic mass, and a sensor to provide position feedback of the mass. In this blog post, we will derive a system of equations for the maglev system and develop a linearized model.

## System Dynamics

The dynamics of the maglev system is described by the electrodynamics of the electromagnet and the forces acting upon the steel ball (magnetic + gravity). The electromagnet can be easily modeled as a series RL circuit.

where

• R = DC resistance of the electromagnet
• L = inductance of the electromagnet
• M = mass of the steel ball
• C = magnetic force constant
• g = acceleration due to gravity
• e(t) = voltage applied across electromagnet
• i(t) = current through electromagnet
• y(t) = distance between end of electromagnet and center of steel ball

The equations which define the system are

$M \frac{d^2 y}{dt^2} = M g - C \frac{i^2}{y^2}$

$e = R i + L \frac{di}{dt}$

To make matters difficult, the first equation is nonlinear. While it is possible to develop a nonlinear control system, it is much simpler and (for most applications) completely acceptable to linearize the system and use linear control techniques. This is preferable as there are far more tools at our disposal for designing and analyzing linear control systems than nonlinear control systems.

## State Space Representation

The first step in developing the control for the maglev system is converting the system dynamics to a state space representation. The state variables are chosen as follows: $x_1 = y(t), x_2 = \dot{y}(t), x_3 = i(t)$. The system input $u(t)$ will be $e(t)$.

Expressing the system dynamics in terms of the state variables yields the following equations

$\dot{x}_1 = x_2(t)$

$\dot{x}_2 = g - \frac{C}{M} \Big( \frac{x_3}{x_1} \Big)^2$

$\dot{x}_3 = \frac{1}{L} (u - R x_3)$

with $\textbf{f} = [\dot{x}_1, \dot{x}_2, \dot{x}_3]^T$ and $\textbf{x} = [x_1, x_2, x_3]^T$.

### Determining the Equilibrium Point

As mentioned previously, the system dynamics are non-linear. Rather than resorting to complicated non-linear control methods, it is preferable to linearize the system about an equilibrium point. The control action will be applied based on the deviation of the system from the equilibrium point

The equilibrium points of a system are found by setting $\textbf{f} = \textbf{0}$ and solving for $x_1, x_2, x_3, u$. Since there are four variables to solve for and only three equations, the system is underdetermined. This can be remedied by setting $x_1(t) = d$, where d is the height set point. Inclusion of this parameter will allow the distance between the magnet and the steel ball to be easily modified.

Solving for the variables yields the following equilibrium point (Note: we are interested in the equilibrium point corresponding to levitation of the steel ball. The equilibrium point corresponding to $x_3 = 0$ is not of interest since this implies the electromagnet is turned off).

$x_{1,e} = d$

$x_{2,e} = 0$

$x_{3,e} = d \sqrt{\frac{M g}{C}}$

$u_e = d R \sqrt{\frac{M g}{C}}$

with $\textbf{x}_e = [x_{1,e}, x_{2,e}, x_{3,e}]^T$.

### Linearizing the System Dynamics

The linearized system describes the system dynamics relative to the equilibrium point. We define $\delta \textbf{x} = \textbf{x} - \textbf{x}_e$ and $\delta \textbf{u} = u - u_e$ as the deviations of the state and control from the equilibrium point, respectively. The linearized system dynamics are given by

$\delta \dot{\textbf{x}} = \tilde{A} \delta \textbf{x} + \tilde{B} \delta \textbf{u}$.

where $\tilde{A} = d\textbf{f} / d\textbf{x}$ is the Jacobian of the state matrix and $\tilde{B} = d\textbf{u} / d\textbf{x}$ is the Jacobian of the  input matrix, both evaluated at the equilibrium point $[\textbf{x}_e, u_e]$.

Computation of  $\tilde{A}$ and  $\tilde{B}$ yields the following linear system

$\delta \dot{\textbf{x}} = \left(\begin{array}{ccc}0 & 1 & 0\\ \frac{2g}{d} & 0 & -2\sqrt{\frac{Cg}{M}}\\ 0 & 0 & -\frac{R}{L} \end{array}\right) \delta \textbf{x} + \left(\begin{array}{c} 0 \\ 0 \\ \frac{1}{L} \end{array}\right) \delta \textbf{u}$