- Open Access
- Total Downloads : 229
- Authors : Jung-Ho Moon, Myunggon Yoon
- Paper ID : IJERTV5IS080329
- Volume & Issue : Volume 05, Issue 08 (August 2016)
- Published (First Online): 22-08-2016
- ISSN (Online) : 2278-0181
- Publisher Name : IJERT
- License: This work is licensed under a Creative Commons Attribution 4.0 International License
Design and Implementation of a Digital Compensator for a Magnetic Levitation Kit
Jung-Ho Moon Department of Electrical Engineering Gangneung-Wonju National University
South Korea
Myunggon Yoon
Department of Precision Mechanical Engineering Gangneung-Wonju National University
South Korea
AbstractThis paper discusses the problem of designing and implementing a digital compensator for a magnetic levitation kit. Magnetic levitation systems are inherently unstable and therefore the frequency-domain design techniques based upon Bode plots cannot be used for controller design. We show the necessity of a phase-lead compensator for the stabilization of the magnetic levitation system using the Nyquist stability criterion and design a phase-lead compensator using the Nyquist plot. We implement the obtained compensator digitally on a 32-bit microcontroller and monitor signals related to control status in real-time using a serial monitoring program developed for this purpose. The monitoring program runs on a PC and communicates with the microcontroller via an asynchronous communication interface and enables the real-time observation of control status.
Keywords Magnetic levitation; digital compensator; Nyquist stability criterion
-
INTRODUCTION
Magnetic levitation systems are a popular plant widely used in control engineering education. The problem of designing a stabilizing controller for them has been dealt with in control engineering literature. The fact that magnetic levitation systems are inherently unstable and highly nonlinear makes the control system design considerably challenging. As described in [1], it is impossible to stabilize them with simple proportional control. In [1], a PD controller was employed for the stabilization of a simple experimental kit and implemented with analog circuit components. Several advanced control
digital controllers are employed in most commercial products that require control systems.
This paper deals with the design and implementation of a digital compensator for the same levitation kit considered in [1]. Although considering the same plant, we take a different approach to the stability analysis and controller design. We show the necessity of phase-lead compensation for stabilizing the closed-loop system based on the Nyquist stability criterion and design a phase-lead compensator also using the Nyquist plot. The obtained continuous-time compensator is discretized using the bilinear transform and implemented digitally on a 32-bit microcontroller. In digital control systems, many signals are processed only within the microcontroller, and as a result, difficult or impossible to monitor using an oscilloscope. We use a program running on a PC to monitor signals of interest in real time. The program communicates with the microcontroller via an asynchronous serial interface using a communication protocol specially defined for the purpose.
-
CONTROLLER DESIGN
We consider the same magnetic levitation kit used as the target plant in [1]. Fig. 1 shows the block diagram of the magnetic levitation system, where C(s), G(s), H(s) denote the controller, the electromagnet, and the Hall effect sensor, respectively. Signals r and z denote the reference input voltage and the Hall effect sensor output voltage, respectively. The open loop transfer function with the controller C(s) set to 1 was derived in [1] and expressed as
techniques as well as PID control were demonstrated in [2].
Every magnetic levitation system requires a sensor to
31.94 2 + 1888
()()() = 3 + 173 2 108.4 18750 ,
(1)
detect the position of a levitating object. Optical sensors or Hall effect sensors are commonly used for the purpose. Optical sensors are not affected by magnetic fields generated by electromagnets and provide high-accuracy position measurement but generally require additional structures to install them. Hall effect sensors are a less expensive alternative. Since Hall effect sensors are inexpensive and simple to mount, they are frequently adopted in low-cost experimental kits such as the systems considered in [1] and [3]. In [1], a linearized mathematical model of a commercial magnetic levitation kit was derived based upon the parameters
which has a pole in the right-half s-plane. Fig. 2 shows the Nyquist plot of the open-loop transfer function (1). Because C(s)G(s)H(s) has one pole in the right-half s-plane, there must be one counterclockwise encirclement of -1 in the Nyquist plot thereof for the closed-loop system to be stable.
As shown in Fig. 2, the Nyquist plot does not encircle the critical point, which indicates that the closed-loop system is not stable with a unity-gain proportional controller. If we increase the gain of C(s) from unity, the Nyquist plot will expand and eventually touch -1. With a proper gain greater
given in [4] and a stabilizing PD controller was designed using the root locus technique. The designed PD controller was implemented using analog circuit elements. Although analog controllers are easy to understand and simple to
+ e
r
r
_
C(s) G(s) d
implement, they are not flexible in that the structure and parameters thereof cannot be easily modified. Nowadays,
z H(s)
Fig. 1. Block diagram of the levitation kit.
Fig. 2. The Nyquist plot of the open-loop transfer function with a unity- gain proportional controller.
Fig. 3. A portion of the Nyquist plot in low frequencies.
Fig. 4. The Bode plot of the open-loop transfer function with a unity- gain proportional controller.
Fig. 5. The Nyquist plot of the open-loop transfer function with a phase- lead compensator.
than 1, therefore, we can make the Nyquist plot encircle the critical point. Fig. 3 shows a portion of the Nyquist plot in low frequencies. As is evident in the figure, the encirclement is in the clockwise direction and therefore the resulting closed-loop system is still unstable. This observation leads to a conclusion that proportional controllers cannot stabilize the closed-loop system because they do not affect the phase angles of the transfer function and thus cannot change the direction of the encirclement.
Fig. 4 shows the Bode plot of the open-loop transfer function with C(s) set to 1. The phase angles in the frequencies below 1 Hz are less than -180, which explains the reason the Nyquist plot in Fig. 3 remains in the fourth quadrant in the positive low frequencies. To create a counterclockwise encirclement, the portion of the Nyquist plot in the positive low frequency range must be moved to the third quadrant, which indicates the phase delays in the range must be no more than 180. The modification can be obtained if we provide sufficient phase lead in the frequency range of importance. The fact implies that a PD controller or a phase- lead compensator can be a candidate for solving the
stabilization problem because it provides positive phase angles in all frequencies.
Fig. 5 shows the Nyquist plot of the open-loop transfer function with a phase-lead compensator expressed as
() = 0.066 + 1 , (2)
0.022 + 1
where K is the DC gain of the compensator and set to 9.95.
Unlike the plot in Fig. 2, this one shows a counterclockwise encirclement of -1 in the low frequency range. The closed- loop system is not yet stable since the Nyquist plot touches the critical point. If we increase K above 9.95, the plot expands and encircles the critical point, which means that the closed- loop system can be stabilized with the phase-lead compensator
-
if te DC gain K is set to greater than 9.95. After inspecting the step responses of the magnetic levitation kit using simulations, the gain was set to 30.
-
-
CONTROLLER IMPLEMENTATION AND EXPERIMENTS
The obtained continuous-time compensator was discretized using the bilinear transform with a sampling rate of 1 KHz, which yields a discrete-time compensator
() =
88.67 87.331
1 0.95561 .
(3)
u[k]
+
p[k]
b0
y[k]
+
C(z) was implemented on a 32-bit microcontroller STM32F103 as the direct form II as shown in Fig. 6 [5]. In fixed-point implementations, the selection of a realization form is of great importance since it considerably affects the computational accuracy. In the floating-point implementations, however, the computational accuracy hardly depends on the selected realization form. The microcontroller used in the experiment does not have a floating-point unit but is sufficiently fast for computing the output of C(z) at a sampling rate of 1 KHz. The output of the Hall effect sensor was converted into digital values using an on-chip 12-bit A/D converter. The computed control input was applied to a current driver FET as a PWM signal.
Fig. 7 illustrates the experimental setup. The levitation kit comes with a circuit board on which an 8-bit microcontroller is mounted. We replaced the microcontroller with a STM32F103 microcontroller on which the digital phase-lead compensator (3) is implemented. Also, we constructed another circuit board for interfacing the Hall effect sensor output to the ADC of the microcontroller and PWM output generated from the microcontroller to the FET current driver. The levitating object shown in Fig. 7 is a permanent magnet, which is intended to reduce the electrical current for driving the electromagnet. The electromagnet cannot repel the levitating object because the circuit is designed such that the FET driver allows electrical current to flow only in one direction. Consequently, the control system fails, if the reference position is set too close to the electromagnet.
Digital control systems have many advantages over their analog counterpart but also have drawbacks. All signals in an analog control system can be easily observed with an instrument such as an oscilloscope. It is not straightforward, however, to inspect signals in a digital control system. Some sensors have digital interfaces, which facilitates the system integration. In this case, the sensor output cannot be simply observed by an oscilloscope. Similarly, it is not easy to monitor the control input computed by a microprocessor if it is applied as a PWM signal. Moreover, it is almost impossible to inspect intermediate signals stored in a memory without some special debugging tools.
To ease the difficulty associated with the signal monitoring, we used the serial monitoring program introduced in [6]. The monitoring program runs on a PC and communicates with the microcontroller via an asynchronous serial communication interface. Any signal or data processed in the microcontroller can be viewed in real time with the monitoring program. The bitrate of the asynchronous communication interface is usually low compared to that of synchronous communication interface such as SPI and therefore not appropriate for high-speed communication. In this case, however, the sampling rate is only 1 KHz and the asynchronous communication is acceptable for the monitoring task. For the real-time monitoring of signals, an overhead on the microcontroller for transmitting data is unavoidable, but incomparable to the computational burden and hardly affects the control performance.
Fig. 8 shows a snapshot of the monitoring program, where the hall sensor signal, the error signal, and the control input
z-1
a1 b1
Fig. 6. Direct form II realization.
Fig. 7. The experimental setup.
Fig. 8. A snapshot of the monitoring system.
are displayed in the order shown from top to bottom. The error signal and control input are signals computed internally in the microcontroller. It is seen that all the signals are subject to digital noise to some extent. The noise is caused by the pulse width modulation and can be reduced if all the components including the FET and the microcontroller are mounted on the same PCB and the wiring between the PWM output and the FET is maintained as short as possible. The error signal shows a DC offset, which means that the position of the levitation object deviates somewhat from the reference position. The steady-state error can be reduced if the DC gain K of the compensator is increased but the gain increase may deteriorate the transient response. The pole and zero of the compensator
-
besides its DC gain need more adjustment in consideration for both the steady-state error and the transient response.
In addition to the function of real-time monitoring, the monitoring program allows the control parameters such as controller coefficients and reference input to be transmitted to the microcontroller so that the microcontroller can change the control parameters in real time, which makes it possible to tune the controller parameters easily without the need for building the source code each time the parameters are changed.
-
-
CONCLUSIONS
This paper considered the problem of designing a stabilizing controller for a commercial magnetic levitation kit and the digital implementation of the designed controller. We showed phase lead compensation is inevitable for the stabilization of the closed-loop system from the viewpoint of the Nyquist stability criterion and obtained a stabilizing compensator also using the Nyquist plot. The compensator was implemented digitally on a 32-bit microcontroller and demonstrated to work as designed. Some important signals
including the control error and control input were monitored in real time by means of a monitoring program that runs on a PC. For the monitoring task, a protocol for the data exchange between the microcontroller and the monitoring program was also implemented on the microcontroller.
REFERENCES
-
M. Yoon and J.-H. Moon, A simple analog controller for a magnetic levitation kit, Internation Journal of Engineering Research and Technology , vol 5, no. 3, pp. 94-97, 2016.
-
W. Yu and X. Li, A Magnetic Levitation System for Advanced Control Education, 19th IFAC World Congress, South Africa, August 24-29, 2014.
-
Kent H. Lundberg, Katie A. Lilienkamp, and Guy Marsden. "Low-Cost Magnetic Levitation Project Kits." IEEE Control Systems Magazine, pp. 65-69, October, 2004.
-
Zeltom, Electromagnetic Levitation System Mathematical Model, private communication, 2009.
-
K. Ogata, Discrete-Time Control Systems. Prentice Hall, 1994.
-
J.-H. Moon and L.-J. Park, Development of a serial signal monitoring program for educational purposes, WASET International Journal of Electronics and Communication Engineering, vol. 9, no. 12, pp. 1251- 1255, 2015.