# Stabilization of the Magnetic Levitation System
## 3 Weighted PID Controller Design  
As it is possible to see, the transfer function describing the ball movement (1) is unstable. The first step in designing the controller is to stabilize the system. Its desired closed-loop behavior can be expressed using the second order transfer function  
\[M(s)=\frac{1}{\beta(\tau_{1}s+1)(\tau_{2}s+1)} \tag{2}\]  
The considered structure of the control scheme is shown in Figure 3.  
The transfer function \(C_{1}(s)\) represents a controller providing stabilizing feedback  
\[C_{1}(s)=\frac{1}{M(s)}-\frac{1}{G(s)} \tag{3}\]  
that for (2) can be written in general form  
\[C_{1}(s)=a_{2}s^{2}+a_{1}s+a_{0} \tag{4}\]  
Considering \(a_{2}=0\), we get a PD controller, whereby the parameter \(\beta\) can be expressed as  
\[\beta=\frac{T^{2}}{K\tau_{1}\tau_{2}} \tag{5}\]  
Transfer function \(M(s)\) can be reduced to the 1 st order by the suitable choice of time constants \(\tau_{2}\ll\tau_{1}\), when  
\[M(s)\approx\frac{1}{\beta(\tau_{1}s+1)} \tag{6}\]  
Figure 3: Weighted pld control structure.  
Figure 2: Input–output steady state characteristics (measured values—blue color, calculated values—red color).  
This can be achieved, e.g., by defining \(\tau_{1}=\rho T\) and \(\tau_{2}=T/\rho\) where \(\rho\) is a sufficiently big value. Then,  
\[\beta =\frac{1}{K} \tag{7}\] \[a_{0} =\beta+\frac{1}{K}=\frac{2}{K}\] (8) \[a_{1} =\frac{T}{K}\frac{\rho^{2}+1}{\rho} \tag{9}\]  
After stabilizing the system, it is possible to proceed to the design of the controller \(C_{2}(s)\), which will ensure the required behavior of the entire control structure under impact of disturbances.  
Since the transfer function (6) is first order, the desired closed loop transfer function \(F(s)\) can also be selected as a first order function  
\[F(s)=\frac{1}{\lambda s+1} \tag{10}\]  
Correspondingly, in such a model-based design, the transfer function of the controller  
\[C_{2}(s)=\frac{F(s)}{1-F(s)}\;\frac{1}{M(s)} \tag{11}\]  
remains feasible. Considering (10) a (6),  
\[C_{2}(s)=\frac{\rho T}{K\lambda}+\frac{1}{K\lambda s}=\frac{\rho T}{K\lambda} \bigg{(}1+\frac{1}{\rho T\,s}\bigg{)} \tag{12}\]  
It is obvious that this is the structure of the PI controller  
\[C_{2}(s)=K_{\rm C}\bigg{(}1+\frac{1}{T_{I}\,s}\bigg{)};\;K_{\rm C}=\frac{\rho T }{K\lambda};\;T_{I}=\rho T \tag{13}\]  
the gain of which can be influenced by the choice of \(\lambda\). For \(\lambda=\rho T\) je \(K_{\rm C}=1/K\).  
The considered control structure (Figure 3) still contains one block and it is the first order filter \(Q(s)\)  
\[Q(s)=\frac{1}{T_{f}s+1} \tag{14}\]  
Its aim is to ensure filtering of the measured signal.  
Experimental Results  
The whole design was accomplished considering parameters in Table 1.  
These parameters lead to the following values \(\beta=0.588\), \(a_{0}=1.177\) a, \(a_{1}=0.027\) s. For \(\lambda=\rho T=0.036\) s, the controller parameters are \(K_{\rm C}=0.588\) a, \(T_{I}=0.036\). In the experiment, the sampling period was 1 ms and the time constant of the filter \(Q(s)\) was equal to the sampling period. A corresponding transient and control signal is shown in Figure 4.  
\begin{table}
\begin{tabular}{l c c c} \hline \hline  & **Variable** & **Value** & **Unit** \\ \hline Gain of the model & \(K\) & 1.7 & - \\ Time constant of the model & \(T\) & 0.018 & \(s\) \\ Controller parameter & \(\rho\) & 2 & - \\ \hline \hline \end{tabular}
\end{table}
Table 1: Model and controller parameters.  
The advantages of this approach are its simplicity, high robustness, and low sensitivity to measurement noise.