magnetic levitation-edited.docx

Download Magnetic Levitation-edited.docx

Post on 08-Jul-2018




0 download

Embed Size (px)


  • 8/19/2019 Magnetic Levitation-edited.docx


    American University of Sharjah

    Department of Electrical Engineering

    Department of Mechanical Engineering 

    ELE 353L


    PID Control for Magnetic Levitation System


    1. To learn about the operation of magnetic levitation system and its application.

    2. To apply PID control for magnetic levitation system and assess the system


    3. To utilize Matlab eal!time interface to run the magnetic levitation system.


    The Magnetic Levitation System MLS is an ideal tool for demonstration of magnetic levitation

     phenomena. This is a classic control problem used in many practical applications such as

    transportation ! magnetic levitated trains" using both analogue and digital solutions to maintain a

    metallic ball in an electromagnetic field.  MLS consists of the electro!magnet" the suspended

    hollo# steel sphere" the sphere position sensors" computer interface board and drivers" a signal

    conditioning unit" connecting cables" and real time control toolbo$ running on M%T&%' (see

    )igure 1*.

    M&+ is a single degree of freedom system, it-s also a nonlinear" open!loop unstable and time

    varying dynamical system.The basic principle of M&+ operation is to apply the voltage to an electromagnet to eep a

    ferromagnetic ob/ect levitated. The ob/ect position is determined through a sensor. %dditionally

    the coil current is measured to e$plore identification and multi loop or nonlinear control

    strategies. To levitate the sphere a real!time controller is re0uired. The e0uilibrium stage of t#o

    forces (the gravitational and electro!magnetic* has to be maintained by this controller to eep the

    sphere in a desired distance from the magnet. The position of the sphere may be ad/usted using

    the set!point control and the stability may be varied using the gain control.

    PID ontrol.


  • 8/19/2019 Magnetic Levitation-edited.docx


    Figure 1: Magnetic levitation system (MLS)

    The magnetic levitation system consists of the follo#ing components

    • lectromagnet

    • )erromagnetic ob/ects

    • Position sensor 

    • urrent sensor 

    • Po#er interface

    TD%45PI measurement and control I56 board

    • Personal computer (P*

    System Model Parameters

     The behavior of the magnetic levitation system (See Fig. 2) can be described by aset of dierential equations.


  • 8/19/2019 Magnetic Levitation-edited.docx


  • 8/19/2019 Magnetic Levitation-edited.docx


    The electromagnetic force vs. position diagram is sho#n in )ig. 3 and the electromagnetic force

    vs. coil current diagram is sho#n respectively in )ig. 4.

    Figure 3: lectromagnetic force vs. position. The gravity force of the ball (dashed horizontal line* is crossing the

    curve at the 8.889 m distance from the electromagnet


  • 8/19/2019 Magnetic Levitation-edited.docx


    )igure 4 lectromagnetic force vs. coil current. The gravity force of the big ball (Dashed horizontal line* iscrossing the curve at the 8.934: % coil current.

    The electromagnetic force depends on t#o variables the ball distance from the electromagnetand the current in the electromagnetic coil. This is clearly presented in )ig. 3 and )ig. 4.

    7e can sho# these dependencies in three dimensional space (see )ig. :*. The ball is stabilized at

    ;$1" $2" $3< = col(9.18!3" 8" 9.34:.18!1* It means that the ball velocity remains e0ual to zero. The

     ball is levitating ept at the 9 mm distance from the bottom of the electromagnet. The 8.934: %

    current flo#ing through the magnetic coil is the appropriate value to balance the gravity force of 

    the ball.

    Figure 5: lectromagnetic force vs. coil current and distance from the electromagnet.

    In the )ig. > belo# the f i ( x1* diagram is sho#n.


  • 8/19/2019 Magnetic Levitation-edited.docx


    Figure 6

    M& is a highly nonlinear model. It can be appro$imated in an e0uilibrium point by a linear 


    The linear model can be described by three linear differential e0uations of the first order in the


     x= Ax+Bu




    The elements of the % matri$ are e$pressed by the nonlinear model parameters in the follo#ing



  • 8/19/2019 Magnetic Levitation-edited.docx


    The vector elements correspond to an applied controller. )or e$ample" The PID controller sho#n in the ne$t subsection re0uires in the form


    • Magnetic &evitation +ystem

    Personal omputer ()or M%T&%' program*


    The e$periment is divided into the follo#ing parts

    a. )inding the linear mathematical model for the position servo system using the +urface


     b. Designing lead compensator for the linear model of the system.

    c. ?erify the simulation results of the system #ith and #ithout lead compensator.d. Implement the compensator on the actual system and verify the system response.

    e. ompare bet#een simulation and real!time responses" and comment on the differences.

    Part A: Calibration of Optical Sensor 

    1. #n your $%! Start &atlab 2''.

    2. #en a ord document *le and use it to save rint screen shots of bloc+

    diagrams and grahs you create in Simulin+. ,ou can also save the *gures

    as matlab or -cell format.


  • 8/19/2019 Magnetic Levitation-edited.docx


    3. n the &atlab %ommand /indo tye0 ML_Main

    4.  @otice that Magnetic Levitation Main #indo# opens (see )ig. A*.

    Figure 7

    ! under Tools! double clic+ identi*cation! )our identification steps have been


    "! clic the +ensor button the follo#ing #indo# opens (see )ig. B*

    Figure 8

    The follo#ing procedure is re0uired to identify the characteristics.

    #! +cre# in the scre# bolt into the seat.

    8 +cre# in the ed sphere and loc it by the butterfly nut. @otice that t!e s"!ere is #i$e% to

    t!e #rame&

    9. Turn round the scre# so the sphere is in touch #ith the bottom of the electromagnet.

    18. +#itch on the po#er supply and the light source.

    11. +tart the measuring and registration procedure. It consists of the follo#ing steps

    12. lic the Measure button C the voltage from the position sensor is stored and displayed as

    Measured value [V]. 6ne can correct this value by measuring it again.

    13. Push the Add button C the measured value is added to the list. % rotation number value is

    automatically enlarged by one (see )ig. 9*.


  • 8/19/2019 Magnetic Levitation-edited.docx


    Figure '

    14. Manually mae one full rotation of the scre#.

    1:.  @ote that the values recorded should be decreasing in volt as you increase distance by


    1>. epeat three last 3 steps so many times as none change in the voltage vs. position

    characteristics is observed.

    1A. Push the Export Data button C the data are #ritten to the disc (see )ig. 18*. Data are stored

    in the ML_Sensormat file as the SensorData structure #ith the follo#ing signals

     Distance_mm" Distance_m and Sensor_V .

    Figure 1

    In the +imulin real!time models the above characteristics is used as a &oo!p!Table model.

    The bloc named !osition scaling is located inside the device driver bloc of M&+ (see )ig. 11*.


  • 8/19/2019 Magnetic Levitation-edited.docx


    Figure 11

     @otice" that the characteristics sho#s meters vs. ?olts. In )ig. B there #ere sho#n ?olts vs.

    meters. It is obvious that #e re0uire the inverse characteristics because #e need to define the

    output as the position in meters.

    If #e clic the !osition Scaling  bloc the #indo# sho#n in )ig. 12 opens. %ny time you lie to

    modify the sensor characteristics you can introduce ne# data related to the voltage measured by

    the sensor. The voltage corresponds to the distance of the sphere set by a user #hile the

    identification procedure is performed. The sensor characteristics are loaded from the

    M& _sensordat file #hich has been created during the identification procedure. If the curve of the

     !osition scaling bloc is not visible please load the file #ith data.

    Figure 12

    Part $: Act%ator static &ode:

    In this subsection #e e$amine static features of the actuator i.e. the electromagnet.

     @otice" that t!e s"!ere is not "resentE

    '(! lic the Actuator static mode button and the #indo# sho#n in )ig. 13 opens

    Figure 13

    ')! @o#" #e can perform button by button the operations depicted in )ig. 13. 7e begin from the

     "uild model for data ac#uisition button. The #indo# of the real!time tas sho#n in )ig. 14opens and the T7 build command is e$ecuted (the e$ecutable code is created*.


  • 8/19/2019 Magnetic Levitation-edited.docx


    Figure 14

    *+!lic the Set control gain button. It results in activation of the model #indo# and the

    follo#ing message is displayed (see )ig. 1:*

    Figure 15

    In )ig. 12 one can notice the $ontrol signal bloc. In fact the control signal increases linearly.

    7e can modify the slope of this signal changing the $ontrol %ain value.

    21. lic the Data ac#uisition button. 7ithin 18 seconds data are ac0uired and stored in the


    **!lic the Data analysis button. The collected values of the coil current are displayed in )ig.

    Figure 16

    The characteristic is linear e$cept a small interval at the beginning. 7e can locate the cursor at

    the point #here a ne# line slope starts (see the red line in the picture*. 7e can move the cursor in

    t#o #ays by #riting do#n a value into the edition #indo# or by drugging the slider. In this #ay

    the current characteristics is prepared to be analyzed in the ne$t step. The line is divided into t#o

    intervals the first C from the beginning of measurements to the cursor and the second C from the

    cursor to the end of measurements.


  • 8/19/2019 Magnetic Levitation-edited.docx


    23. %fter setting the cursor position" conse0uently" clic the Analy&e button. The follo#ing

    message (see )ig. 1A* appears.

    Figure 17

    *,!7e obtain the dead zone values corresponding to the control and current. The constants a and

    ' of the linear part are the parameters of the line e0uation i(u* = a u + ' .

    These parameters" namely u M() = ***+,-. x/M() 0 **/--+.  i= 23143 and ci= 8.8243 are going to

     be used in the simulation model in section 2.3.1 (see the differential e0uations parameters in


    *!)ind these parameters from your test results

    u M() = −−−−−−−−  x/M() 0 −−−−−−−−

     i= −−−−−−−− ci= −−−−−−−−

    Part C: Mini&al Control

    In this subsection #e e$amine the minimal control to cause a forced motion of the sphere from

    the supporting structure (tablet* to#ard the electromagnet against the gravity force. @otice" that

    in this e$periment t!e s"!ere is not levitatingE It is ept nearby the electromagnet by the

    supporting structure (position the ball by rotating the stand at appro$imately half the calibrated


    *"!lic the Minimal control button and the #indo# sho#n in )ig. 1B opens.

    Figure 18

    *#!lic the "uild model for data ac#uisition button. The #indo# of the real!time tas sho#n in

    )ig. 19 opens.


  • 8/19/2019 Magnetic Levitation-edited.docx


    Figure 1'

    *(!lic the Set control gain button. It results in activation of the model #indo# and the

    follo#ing message is displayed (see )ig. 28*.

    Figure 2

    It means that #e can set a duty cycle of the control P7M signal. The sphere is located on the

    support and the e$periment starts.

    *)!lic the  Data ac#uisition  button. % forced motion of the ball to#ard the electromagnet


    -+!lic the Data analysis button. The collected values of the ball position are displayed in )ig.

    Figure 21

    The sphere motion is visible. 7e can locate the cursor at the point slightly before a position /ump

    occurs (taes place* (see the red line in the picture*. 7e can move the cursor in t#o #ays by

    #riting do#n a value into the edition #indo# or by drugging the slider. The line is divided into

    t#o intervals the first C from the beginning of 

    measurements to the cursor and the second C from the cursor to the end of measurements. In this

    #ay the ac0uired data are prepared to be analyzed in the ne$t step.


  • 8/19/2019 Magnetic Levitation-edited.docx


    -'!%fter setting the cursor position" conse0uently" clic the Analy&e button. The follo#ing

    message (see )ig. 24* appears.

    Figure 22

    This information means that the sphere located 1:.B2 mm from the electromagnet begins to

    move to#ard it #hen the P7M control over!crosses the 8.494B: duty cycle value.

    -*!ecord the values you obtain

    Position (m*= !!!!!!!!!!!!!!!!! urrent (%*= !!!!!!!!!!!!!!!!!!

    Part D: Act%ator Mode:

    In this subsection #e e$amine dynamic features of the actuator i.e. the electromagnet. It means

    that the moving sphere generates an electromotive force (M)*. M) diminishes the current in

    the electromagnet coil.

    --!lic the Actuator static mode button and the #indo# sho#n in )ig. 23 opens.

    Figure 23

    -,!% user should perform three e$periments #ithout the sphere (5it6out 'all *" #ith the sphereon the supported structure ( "all on t6e ta'let * and #ith the sphere fi$ed to the rigid scre#

    ( "all fixed *.


  • 8/19/2019 Magnetic Levitation-edited.docx


    Part E: PID Control Action:

    -!Fo the M& Main #indo# and double clic the levitation button" the follo#ing #indo# opens

    (see )ig. 24*.

    Figure 24

    -"!Double clic the PID button. The real!time PID controller opens (see )ig. 24*.

    Figure 25


  • 8/19/2019 Magnetic Levitation-edited.docx


    -#!Double clic GPIDH bloc and set the gains to the follo#ing values

    /p /i /d

    130 500 6

    -(!'uild" &in and un the +imulin model.

    -)!se the s#itch to toggle the setpoint bet#een GDesired PositionH and G+ignal FeneratorH.

    ,+!Try to change the setpoint and observe the tracing of the ball position.

    ,'!Try the triangular and the s0uare #ave in the signal generator.

    ,*!Typical results of the real!time e$periment are sho#n in )ig. 2:" )ig. 2> and )ig. 2A.

    Figure 26: constant set"oint

    Figure 27: sine ave set"oint


  • 8/19/2019 Magnetic Levitation-edited.docx


    Figure 28: s*uare ave set"oint


    The student should include all plotted graphs and +imulin models in Matlab.


    The student has to comment on all the results taen and discuss the sensor calibration" actuator 

    testing and PID controller performance.