Modeling and Simulation of a Magnetic LevitationSystem Using Real Time Windows

Call for Papers Engineering Journal, May 2019

Download Full-Text PDF Cite this Publication

Text Only Version

Modeling and Simulation of a Magnetic LevitationSystem Using Real Time Windows

Modeling and Simulation of a Magnetic

LevitationSystem Using Real Time Windows

Binson V A

Jikki Jose

Vinayakumar B

Assistant Professor

Assistant Professor

Assistant Professor

Department of AEI

Department of ISE

Department of AEI

Saintgits College of Engineering

City Engineering College

Saintgits College of Engineering

Kottayam, India

Bangalore, India

Kottayam, India




AbstractThe purpose of this paper is to modela magnetic levitationsystemand to investigate the issue of real time simulations using MATLAB as a tool.Real-time systems are loosely defined as the class of computer systems that interactin a time frame defined by the external world. It is an environment where a single computeris a host and a target. After creating a model and simulating it with simulink in normalmode we can generate executable codes with real time workshop. The control goal of a magnetic levitation system is to suspend asteel sphere by means of a magnetic field counteracting the force of gravity and to be able to apply a controlled disturbance to force the sphere to follow a predetermined trajectory.The control to be applied is the voltage, which is converted into a current via internalcircuitry in the controller located in the mechanical unit. The current passes through andan electromagnet which creates a magnetic field in its vicinity. The sphere is placed alongthe vertical axis of the electromagnet after the control system is started in the software. Inthis way a approach towards real time workshop is analyzed and applied.

Keywords:Magnetic levitation, Electromagnet, Modeling, Matlab.



    AGNETIC levitation systems are electromechanical devices that suspend ferromagnetic materials using electromagnetism. Maglev technology has been receiving increasing attention since it eliminates energy losses due to friction. Centered on friction reduction, maglev systems have wide engineering applications such as magnetic bearings, high-precision positioning platforms, aerospace shuttles, and

    fast maglev trains.

    The magnetic levitation system is an open-loop unstable and nonlinear in electromechanical dynamics. Therefore, it is aninteresting and impressive system for engineers and researchers. It is important to develop an effective controller that is also robust to system parameter perturbation. In general, the electromechanical dynamics of a magnetic levitation apparatusis represented by a non-linear model consisting of the state variables of position, velocity, and mass, coilcurrent, and input voltage.The maglev controller design can be classified into two categories based on the type of controllable input. They are current-controlled systems and voltage-controlled

    systems. The current feedback power amplifier is used to generate the desired current in a very short time for current- controlled systems. As the current feedback power amplifier is employed in the control circuit, the currentin the coil can be seen as the controllable input of the system, thus the whole system is reduced to a two-order nonlinear system.


    The magnetic levitation systems control problem is of considerable scientific interest because the system is open-loop unstable and highly non-linear, and the systems parameters are uncertain. The design of a controller keeping a steel ball suspended in the air. In the ideal situation, the magnetic force produced by current from an electromagnet will counteract the weight of the steel ball. Nevertheless, the fixed electromagnetic force is very sensitive, and there is noise that creates acceleration forces on the steel ball, causing the ball to move into the unbalanced region.Magnetic Levitation model may be considered as a closed loop feedback control system, whose basic block diagram is illustrated in Fig 1.

    Fig 1. Block diagram of magnetic ball levitation control system

    The plants output is the balls vertical displacement which is sensed by an optical sensor. Current produced by the sensor is converted to a proportional voltage, commonly referred to as

    the sensor voltage, by means of a current to voltage converter. The setpoint voltage (a known reference) is subtracted from the sensor voltage to generate an error signal which is acted upon by the PID controller.

    The actuator is simply a voltage to current converter that producescurrent proportional to the controllers output voltage. Magnitude of this current decides themagnetic field strength and, hence, the upward force with which the ferromagnetic ball isattracted. The fundamental elements of the magnetic levitation system are

    1. Plant

      The electromagnet along with the suspended metallic ball may be collectively termed as the plant. Input to the plant is the current flowing in the electromagnets coil.The plants output is thevertical displacement of the suspended ball.It is worth mentioning that is not possible to control the plant while it operates in open loop. Thereason being its highly unstable nature.

    2. Sensor

      The sensor used is a photovoltaic cell whose short circuit current (Isc) varieslinearly with light intensity. As the metallic ball is attracted upwards by the electromagnet it partially covers the sensor, bringing about a change in its surface area exposed to the lightsource.

    3. Current to voltage convertor

      The current to voltage converter is an operational amplifier based circuit that converts the photovoltaic cells short circuit current (Isc) to a proportional voltage (Vsensor).

    4. PID Controller

      The PID controller acts upon the error signal generated by subtracting the set point voltage (V set point) from the sensor voltage (Vsensor). Proportional control ensures that the controller output is proportional to the amount of error. Integral control takes into account the error signals time duration as well as magnitudeand completely eliminates steady state offset. Derivative control ensures that the corrective action taken by the controller is proportionalto the rate of change of error. Hence, an early corrective action is initiated.

    5. Actuator

    The actuator is a voltage to current converter that receives an input voltage from the PID controller and converts it to a proportional current, which excites the electromagnet. Figure 3 gives an overview of the hardware details and fundamental componentsof the levitation system.

    Fig 2: Hardware schematic of magnetic levitation system


    The magnetic suspension system is a magnetic ball suspension system which is used to levitate a ball on air by the electromagnetic force generated by a voltage-controlled magnetic field. Only the vertical motion is considered. The objective is to keep the ball at a prescribed reference level. The schematic diagram of the system is shown in fig1. The magnetic force, applied by the electromagnet is opposite to gravity and maintains the suspended steel ball levitated.

    Fig 3:The physical system of the magnetic suspension

    and mass of the steel ball. x(t) is the distance between the seel ball and the electromagnet. x0 is the reference position or it is the proper levitation distance. The electromagnetic force f(i,x), acts the ball, which can be expressed as the following dynamic formula in up ward direction according to Newtons law

    2 ()

    2 = , (4)

    After linearization the control force is given by

    2 ()

    2 = 1 (5)


    = 20

    1 02




    C is the force constant and expressed asC = 00


    , L0 is

    theincremental inductance with the ball and I0 equals the current of the coil when the ball is at x0.

    For the electrical equation, we assume that the electromagnet coil is adequately modeled as a series resistor- inductor combination. The voltage-current relationship for the coil is given by

    = +


    Fig 5: Magnetic levitation detailed non-linear model

    The displacement of the ball is measured by the Hall-effect sensor and the output can be formulated as

    = = (7)

    where is the sensor gain

    The overall transfer function G(s) between the coil input voltage V(s) and ball sensor output voltage VX(s) is given by

    The closed loop control system shown in figure 1 was simulated in MATLAB and the results closelyanalysed. The objective of this simulation was to get a better understanding of PID control andthe individual effects of proportional, integral and derivative terms.

    When Kp=1, Ki=10 and Kd=0.03, then the output would be like this and the ball will move between two ends smoothly.When Kp value is increased to 5,Ki to 15 and Kd to

    0.5 then there will be increase in transients and the ball starts to fluctuate. So as we go on increasing the PID parameters value

    = 3

    + 4 (2 5 )



    theunstability increases. Therefore it is suggested to keep it between this limit. This is shown in the figures 6 and 7 respectively.





    3 =

    1 , 4 = 1 , 5 = , 1 =

    0 2 2 =



    The Magnetic Levitation system is meant to demonstrate control problems associated with nonlinearand unstable systems. It comprises of a position sensor connected to an A/D converter, tosense the steel balls vertical position. The coil is driven by a power amplifier interfaced with aD/A converter. The magnetic levitation model and sub blocks are shown in the figures.

    Fig 4: Magnetic levitation model

    Fig 6: Output of the controller

    Fig 7: Output of the controller


The control goal of suspending a steel sphere by means of a magnetic field counteracting theforce of gravity, and to be able to apply a controlled disturbance to force the sphere to follow apredetermined trajectory is achieved using Real time Matlab Simulink tool. In operation thecontrol output from the I/O board in the PC is a voltage, but the magnetic levitation unit containsinbuilt voltage to current converter circuitry. The electromagnetic is therefore driven with a currentoutput source and the system avoids the problems associated with the high impedance of theelectromagnet coil and the consequent large phase difference between voltage and current. RTWT combines the powerful functionality of MATLAB, Simulink and Real-Time Workshop andallows users to implement any kind of control algorithm.It also suggests the value of the PID design for proper operation.


  1. H. H. Woodson and J. R. Melcher, Electromechanical Dynamics, pt. 1. New York: Wiley, 1968.

  2. T. H. Wong, Design of a magnetic levitation control systemAn undergraduate project, IEEE Trans. Educ., vol. E-29, pp. 196200, Nov. 1986.

  3. K. Oguchi and Y. Tomigashi, Digital control for a magnetic

    Suspension system as an undergraduate project, Int. J. Elec. Eng. Educ., vol. 27, no. 3, pp. 226236, July 1990.

  4. J. Cicon, Building a magnetic ball levitator, PopularElectronics, vol. 13, no. 5, May 1996, pp. 4852, 78.

  5. D.L. Trumper, Magnetic suspension techniques for precision motion control, PhD Thesis, MIT, 1990.

  6. B.V. Jayawant. Electromagnetic Levitation and Suspension Techniques. London: Edward Arnold, 1981.

  7. Shiakolas,P.S, Piyabongkarn. On the development of a real-time digital control system using x PC-Target and a magnetic levitation device,Decision and Control, 2001.Proceedings of the 40th IEEE Conference on Volume 2, Issue , 2001

Leave a Reply

Your email address will not be published. Required fields are marked *