Marginal Maglev Part A: Simplified Model
Please Log In for full access to the web site.
Note that this link will take you to an external site (https://shimmer.mit.edu) to authenticate, and then you will be redirected back to this page.
Quick Reference
Serial Plotter Send Window Indices and offsets
Links
Task Summary
- Assemble your maglev system.
- Learn about your system using proportional gain only (Checkoff 1).
- Determine a PD controller that works "sort of" (Checkoff 2).
- Invert the optical sensor nonlinearity (Checkoff 3).
- Determine the parameters for a model of the maglev system (Checkoff 4).
- Design a CT lead controller and implement it in DT on the Teensy (Checkoff 5).
At the right is a video of this term's maglev system, in which the field produced by a three-coil electromagnet is being controlled to toggle the seperation distance to a floating permanent-magnet-cube "umbrella". For part A of this lab, you will use trial and error to determine a PD controller that keeps a "magnetic umbrella" floating one and a half centimeters below your electromagnet. You will then try toggling the seperation distance to the umbrella, to investigate the stability of your controller. And finally, you will "invert" the nonlinearity of the optical sensor, and show that you can take much larger seperation distance steps with the more linear system.
After spring break, you will finish this lab by taking a more-principled frequency domain approach to designing a FAR MORE EFFECTIVE lead-based controller. The approach will, as always, require a model of the maglev system, a model that you will start developing this week.
The above video shows this term's magnetic levitation system in action (we've improved this system every year, and this term's three-coil electromagnet plus sensor nonlinearity inversion is the best ever). You can see two of the three coils for the electromagnet (blue cylinders that surround cores of highly permeable steel), which attracts or repels a cube permanent-magnet (orange) that is part of a floating "umbrella".
Above is a detailed picture of the electromagnet and the floating "umbrella". The "umbrella" is a plastic-coat rare-earth cube magnet (orange) that holds together a steel-backed white plastic disk and a threaded rod with lock-nut ends. The white plastic disk is a diffuse IR reflector, which makes the distance sensing less sensitive to umbrella tilting. The disk's steel backing has a mirrored surface that is a more efficient reflector, but also more directional, and makes the distance sensing too sensitive to umbrella tilt. The threaded rod with lock-nut ends acts as a tilt stabilizer, much like the tail on a kite.
The electromagnet is driven by a feedback control system that senses the distance between the umbrella and the electromagnet, and adjusts the electromagnet's field to hold the umbrella "floating" about a half inch beneath the electromagnet.
In this lab you are going to put together this electromagnet, attach an optical distance sensor, calibrate your setup, model your levitation system, and then design the controller that holds the "umbrella" floating in space.
Technically, calling this task "Maglev" is a misnomer. This is not magnetic levitation, as we are not causing the object to "rise", but rather, the object is "hanging". But there is no combination of magnet and hang that sounds as cool as Maglev. Please forgive us our trespasses.
We've used a number of different coil magnet arrangements for this magnetic levitation lab, but regardless of the implementation details, the issue of determining a nominal command (using the potentiometer) has required some experience. In this first video (using an earlier term's electromagnet), we give you some hints about how to adjust the potentiometer while trying to float the magnet. It can be a little tricky, as the "blooper" video shows. The other videos are just for fun, and show a few other magnet topologies.
DO NOT TRY AT HOME. Rare earth magnets are dangerous! They are brittle, and when they slam into each other, they send shards of metal flying. We give you the small disc magnets for a reason!
Please start assembling the maglev using the assembly guide, DO NOT SKIP THE VERIFICATION STEPS AT THE END OF THE ASSEMBLY GUIDE. DO NOT SKIP THE VERIFICATION STEPS AT THE END OF THE ASSEMBLY GUIDE. The first checkoff for today is to get your maglev system working like the last video in the assembly guide.
You will find a comprehensive assembly guide by going to the Resources pull-down menu and clicking on the "Maglev Assembly Guide" link. Or click here. You should also be able to find staff setups if you look around the 38-530 (our lab area).
In our magnetic levitation system, a plastic-coated rare-earth magnet is "floating" about half an inch below the bottom pole of the electromagnet. A diagram of the electromagnet/permanent magnet system, with the forces noted, is shown in the figure below.
In the above diagram, a magnet is "floating" at a position y_{eq} beneath the bottom pole of an electromagnet, and our job will be to adjust the field produced by the electromagnet (by adjusting voltage across the electromagnet's coil, c(t)) so that the magnet is held stable at that position.
To design the controller, we could start by developing a model of the net force, a sum of a position-independent gravity force, f_g, and the position dependent forces of attraction: the force of attraction between the floating magnet and the electromagnet's iron core (in our case a steel bolt), f_{fe}, and the force due to the electromagnet's field, f_b. After determining analytic expressions for each of the individual forces as a function of position, y, we could derive a formula for the total force, f(y) = f_g + f_{fe}(y) + f_{b}(y). Then armed with f(y), we could find the force-balance equilibrium position, y_{eq} such that f(y_{eq}) = 0. Finally, we could determine how to drive the electromagnet, as a function of the perturbation from equilibrium, \Delta y shown in the above figure, so that the magnet is pushed back to y_{eq}.
The physical modeling is possible, but a few measurements will get us the information we need. Assume the magnet starts at y_{eq}, and the zero net force is perturbed by some \Delta f. Then the net force on the magnet is no longer balanced, and the magnet will accelerate away from equilibrium. That is, the perturbation in force can be related to the perturbation in position by
Now, what could perturb the force? If the magnet's position is perturbed, moving it either closer to, or further from, the electromagnet and its iron core, then both magnetic forces, f_{fe} and f_b, will be perturbed. We can also perturb how we drive the electromagnet, which will produce a perturbation in the electromagnet's measured field, \Delta b, and in turn, perturb f_b, the force on the floating magnet. If the perturbations are small enough, we can linearize the relation between force perturbation and perturbations in position and electromagnet field
Combining the two relations, we arrive at an equation of motion about the equilibrium point y_{eq},
Similarly,
It may seem unimportant to establish relationships between constants whose values you are unlikely to learn. Nevertheless, we have learned the form of the transfer function relating the perturbation in position to the perturbation in electromagnet field,
For now, let us see if we can estimate \gamma_{da/dy} for our system. Suppose you held a disk magnet underneath the electromagnet, and that you are setting the electromagnet's field to a fixed value. Perhaps you could adjust things so that the upward pull of the total magnetic attractive forces is nearly equal to downward pull of gravity. If you then increased the electromagnet's field a little bit, and let go of the disk magnet, what would happen? What does that tell you about the sign and order of magnitude of \gamma_{da/dy} ? Answering the following question may help you better understand what will happen.
Note: you must enter the answer as a Python list for grading to work, and please use j=\sqrt {-1} and enter decimal representations in place of fractions wherever necessary. For example, \frac{7}{8}+\frac{1}{2}j is entered as 0.875+0.5j, and a value for \gamma followed by two natural frequencies would be [17.6, 0.875+0.5j, 0.875-0.5j]. Finally, if you want to enter -j or +j, please enter -1j and 1j.
As a first step in designing the controller, we will determine a proportional feedback gain, K_p, that is large enough so that the electromagnet is driven to repel the disk or cube magnet when too close, and attract when too far away. We will use the potentiometer to generate a nominal field that approximately cancels gravity when the (really a desired sensor voltage) to your maglev system, and will then determine if the proportional feedback gain that is high enough. The feedback system with just proportional gain is unstable, but unlike the open-loop system above, its behavior should be oscillatory (see the video at the end of the assembly guide). You should note the behavior, mostly qualitatively, as it can provide some insight into a useful model of the system.
The end of the assembly guide shows how to calibrate and test your maglev system. Please be sure to test that the optical distance sensor has the correct range and offset, that the three electromagnets are aligned, and to check the sign of, and effect of, the proportional gain.
Once you have tested your system, watch the last video in the assembly guide and try to get your system to oscillate by finding a good K_p and a good setting for the nominal command.
Once you have determined a sufficiently high gain to produce oscillation, you can try analyzing the feedback system. Unlike the propeller arm, you will not be able to get a completely calibrated model, but you can learn enough to constrain your search for a good controller.
To begin, lets simplify the problem by assuming we can directly measure the perturbation in separation distance, \delta y(t), and directly control the perturbations in the electromagnet's field, \delta b(t). Assuming the coil field changes instantly with changes in controller command is analogous to the instant thrust model we used with the propeller arm. When we include a model for the dynamics relating the controller command to the generated force (either thrust or magnetic attraction/replusion), we often refer to including the "electronic pole".
For now, we will ignore the electronic pole, and model the levitation system as
Can you determine the closed-loop transfer function from \Delta Y_d to \Delta Y for this simplified model of the proportional-gain feedback system? And based on your experiment, where are the closed-loop poles (are they real, imaginary or complex)? What can you say about the sign of
YOU SHOULD BE ABLE TO ANSWER ALL THE CHECKOFF QUESTIONS IN ORDER TO GET THE CHECKOFF!!!
For this second checkoff, we would like you to find a value for K_p and K_d, a PD controller, so that the umbrella remains suspended beneath the electromagnet. You should also be able to track a \frac{1}{2} hertz square wave for an amplitude of at least 0.02, and probably almost 0.1 (set using send window, "5 0.5", "6 0.1"). But, don't expect to follow the step exactly, or to hang on for long, as shown in video from the assembly guide below.
YOU SHOULD BE ABLE TO ANSWER ALL THE CHECKOFF QUESTIONS IN ORDER TO GET THE CHECKOFF!!!
As the picture below makes clear, the optical sensor quite nonlinear. Starting with the umbrella in the zero position (as set by the spacer), the sensor reading is more than eight times more negative as the umbrella moves 1.5 centimeters closer to the sensor than when it moves 1.5 centimeters further away.
Examine line 176 in the sketch,
float dist = SensorOffset - SensorScale*sensVal;
where dist
is the distance in centimeters (the plotter scales by ten thousand to convert centimeters to microns). Is the above formula the best way to convert the sensor reading to distance? Wouldn't one expect the sensor value to be inversely proportional to distance, suggesting the following:
float dist = SensorOffset + SensorScale/sensVal;
Of course, the values for SensorOffset
and SensorScale
will be completely different, can you determine how to calibrate these values?
We know that the sensor value is nonlinearly related to reflector distance, and we know that linearizing a nonlinearity about a nominal point can interfere with linear control (unless changes are all vanishingly small). But if we know the nonlinearity, as we do in the case of the optical sensor, we can remove it rather than linearizing it. Try implementing and calibrating the
And what about your PD controller? Do you expect it will perform better for small steps? Larger steps? Try it and see!