Magnetic Levitation Experiment worksheet (.doc version)

advertisement
Magnetic Levitation System
Introduction
For this lab, there are two experiments, with Experiment 1 having two parts, and
Experiment 2 have four parts. In Experiment 1, the sensor and actuator both exhibit
nonlinear characteristics. To implement controllers, an estimation of the nonlinear
behavior must first be known. The first part investigates the nonlinearity of the sensor,
and the second part studies the nonlinearity due to the magnetic field.
In the second experiment, a PD controller is implemented. In Experiment 2a, both the
proportional and derivative gains are set to zero. In 2b, a small proportional gain is added
and compared to the previous test. Next, a larger proportional gain is implemented that
gives a nearly undamped response. Finally, the derivative gain is added and compared to
the previous tests.
Hardware
The ECP Magnetic Levitation (MagLev) design (See Fig. 1) features two 7and high flux
drive coils to provide more than 4 cm. of controlled levitation range. Laser sensors
provide non-contacting position feedback and incorporate proprietary conditioning to
electronics for signal noise reduction and ambient light rejection. The MagLev apparatus
may be quickly transformed into a variety of single input single output (SISO) and multiinput multi-output (MIMO) configurations. By using repulsive force from the lower coil
to levitate a single magnet, a SISO system is created, which is our focus in this
experiment.
Up per
su ppo rt ar m
Ru ler clam p
scr ew (2 pl.)
Glass r od clam p
scr ew (2 pl.)
Pr ote ctive
coil co ver
(2 pl.)
Pr ecis ion glass
gu ide r od
Le vitated
m agne t
Se nso r
condition ing
electr o nics
Lo wer
su ppo rt
arm
Side View
Laser Sens or
(ou t of vie w , 2 pl.)
Coil cur r ent
in dicating L ED
(2 pl.)
0
1 4
1
1 3
2
1 2
3
1 1
4
1 0
5
9
6
8
7
7
8
6
9
5
1 0
4
1 1
3
1 2
2
1 3
1
1 4
0
Con nector
Up per Drive
Coil (Co il #2)
M agn et
he ight ule r
Lo wer Dr ive
Coil (Co il #1)
M agn et
Sto rage
Front View
Figure 1: ECP Magnetic Levitation Experiment
1
Safety
Read the safety information found in Appendix B on the course webpage
Specific to this experiment: select Abort Control immediately after measuring magnet
height to minimize heat buildup in the coil and servo amplifiers.
Hardware/Software Equipment Check
Prior to starting the lab, complete the following steps to ensure that the equipment is
working.
Step 1: With power switched off to the Control Box, enter the ECP program by double
clicking on its icon. Turn on power to the control box. The laser sensors should
illuminate the magnet in a thin red line on both the upper and lower magnet
surfaces.
Step 2: Gently raise the magnet by hand (touch the edges only with clean hands and do
not obstruct the laser beam). Observe a change in the Sensors counts. The
Control Loop Status should indicate "OPEN" and the Drive 1 Status, Drive 2 Status,
and Servo Time Limit should all indicate "OK".
2
Experiment 1: System Identification
Note: Calibration measurements should be taken off the top surface for sensor 1 and from
the bottom surface for sensor 2. This may require that the ruler (on the test rig) be
adjusted such that the height at the zero position is measured as zero on the ruler.
Experiment 1a: Sensor Characteristic
In the first part of the experiment, a polynomial fit of position versus the sensor needs to
be created. In later parts of the lab, this relationship will be used to find the position
accurately by observing the sensor counts and transforming it via your polynomial.
Procedure
1.
Read through Experiment 1 thoroughly before starting. Setup the
mechanism with one magnet only resting on the lower drive coil. Make
certain to have clean hands when touching the magnet - avoid touching
the white surface if possible. Power to the Control Box should be off.
Construct tables similar to of Table 1-1 and Table 1-2, found below to
record data.
2.
Set up the ECP software sensors. Select Abort Control to make sure that
no real-time controller is active. Turn on power to the Control Box.
Observe the laser light beam on the upper and lower magnet surfaces.
Move the magnet manually up and down to verify that the sensor
counts displayed on the Background Screen are changing.
3.
Adjust the ruler. Sight along the top of the magnet and adjust the ruler
height so that the 0 cm. position precisely matches the plane of the top
of the magnet.
4.
Record the raw sensor output at the 0 cm. position as read from the
Sensor 1 display on the Background Screen. Refer to the notes below
regarding moving the magnet to the desired calibration positions and
reading the sensor counts. Manually move the magnet to the 0.50 cm
position and read and record the raw sensor output. Continue moving
and recording the sensor data according for the magnet positions in
Table 1-1.
5.
Notes on taking sensor calibration data:
1)
Hold the magnet only by the edges and do not block the laser light.
2)
Apply light finger pressure radially inward so that the magnet
bushing is snug against one side of the glass rod. This will assure
that the magnet is not cocked relative to the rod and is
approximately horizontal. It should also assure that the magnet
does not move during the measurement. Any movement can lead
to inaccurate results. Further enhancement in the accuracy of
results of this and the next section may be obtained by taping a
3
ruler (cm./mm. graduations) alongside of the upper and lower
sensor/coil support arms with the ruled edge very close to the
magnet travel zone. In this way the magnet height may be more
reliably read.
3)
When the magnet is at the close end of travel relative to the sensor
(at the bottom for sensor #1, at the top for sensor #2) rotate it and
find the clocking position where the sensor output is approximately
the average of the highest and lowest values. There may be as
much as ±1000 counts difference between the highest and lowest
values (if there is more than this, clean the white surface). This
amounts to an equivalent position measurement error of less than 1
mm and becomes much less for positions further away from the
coil. Try to maintain this approximate clocking for the remainder
of the magnet positions when taking sensor data in Step 4 (e.g.
keep the magnet polarity “N” label pointed in the same direction).
There will be some noise in the sensor reading; so “visually
average” the values displayed. The student need only read the
sensor to three significant digits for the purposes here.
Use the following table for calibration data:
Table 1-1 Sensor Calibration/Linearization Data
Magnet Position for Sensor #1 (cm)
Y1 raw (Sensor 1, Counts)
0.00
0.50
1.00
2.00
3.00
4.00
5.00
6.00
Plot the data points of sensor counts vs. magnet position in MATLAB. From the plot,
determine a reasonably simple polynomial function y = f(x) that accurately fit the data
points. Add this polynomial to your plot. (A first or second order polynomial will be
sufficient)
The lab report must include a plot of sensor counts vs. magnet position with the
polynomial fit shown over the data. Also include the fitted polynomial equation including
the coefficients found from MATLAB.
The final report is expected to include:
4
Using Figure 1 above, label the following:
Sensor
Actuator
Describe the following in terms of the physical meaning of each:
Actuator Output
System Output
Reference Input
One (1) MATLAB Plot along with titles, labels and the fitted polynomial equation
printed on the plot
- Plot of Magnet position (x axis) and Sensor 1 (y axis)
One (1) Excel table of the original data
- Table 1-1 of Magnet Position and Sensor 1 data
For all the questions highlighted, the questions should be copied and pasted into the
student’s lab report and explicitly answered immediately thereafter.
Experiment 1b: Actuator Characteristic
Similar to 1a, the actuator (in this case, the electromagnet) also exhibits non-linear
behavior. A polynomial fit of the control effort compared to position needs to be created.
The mechanism should be in the same configuration as in the last section. Assure that the
north pole of the magnet is facing upward. The ruler should again be adjusted to measure
off the upper surface of the magnet when it is resting in its lowermost position.
Follow the procedure in Experiment 1b below to gather the data needed to complete the
table, also shown below. Use a simple user-defined control algorithm of the type:
begin
control_effort1 = 5000
end
Procedure
1.
Input the code. Write a simple real-time algorithm to activate actuator
coil #1 (i.e. put control effort values on the DAC) with a constant
control effort of 5000 counts.1 Review the algorithm with the instructor
or laboratory supervisor before proceeding to the next step.
1
These counts are converted to a voltage via a digital-to-analog converter (DAC), then to a current via the
servo amplifier, to a magnetic field via the coil, and finally to a force by repulsion of the magnet’s
magnetic field. The scaling of all of these transformations affects the system gain and will be examined in
5
2.
Enter Setup Control Algorithm via the Setup menu. Select Edit Algorithm.
This opens up the control algorithm editor. Type required codes in the
editor window. Then click File on the menu bar and choose Save
changes and quit. A dialogue window will pop up, asking you to enter
file name to save these codes. Once you name the file, click Save and
the file will be stored on the designated directory. In addition, both the
dialogue window and editor window will disappear and you will return
to the Setup Control Algorithm window. Then click Implement
Algorithm, codes you just entered will be implemented. If you wish to
use other codes stored on computer, you can choose Load from disk…
to select the program file you want load. If the above steps do not work,
please refer to Reference in the end of this manual.
3.
Record the height of the magnet corresponding to 5000 counts in a table
similar to Table 1-2. Spin the magnet (again touching only its edge) to
reduce the effects of friction so that the true equilibrium height is
observed.
4.
Follow the step 2j) to reduce the control effort to 4000 counts and
implement. Notice the magnet height becomes lower. Record the
magnet height.
5.
Repeat step 4 to find the control effort value at which the magnet is
lifted only a very slight amount above the support pads (i.e. the 0+
position). Again, spin the magnet to reduce the effects of friction.
6.
Repeat step 4 for the remaining control effort values of Table 1-2.
Select Abort Control immediately after measuring magnet height to
minimize heat build-up in the coil and servo amplifiers during exposure
to the higher control effort values (those greater than 10,000 counts)
Do not exceed 22,000 counts of control effort.
Table 1-2. Actuator Calibration / Linearization Data
more detail in the sections that follow. See also Chapter 4 for a description of the control hardware and
software functionality.
6
Magnet Position (cm)
u1raw (Uncompensated Control Effort, counts)
0.00
4000
5000
6000
8000
10000
12000
14000
18000
22000
The final report is expected to include:
One (1) MATLAB Plot along with titles, labels and the polynomial fit on the plot
- Plot of Magnet position (y axis) and Control Effort (x axis)
One (1) Excel table of the original data
- Table 1-2, Magnet Position and Control Effort
Briefly describe the trend of the nonlinear behavior of the magnet position as the control
effort increases. In the text of the report, briefly describe possible reasons why the system
is nonlinear (what are the physical dynamics causing the nonlinearity?)
For all the questions highlighted, the questions should be copied and pasted into the
student’s lab report and explicitly answered immediately thereafter.
Experiment 2: PD Control of the system to an equilibrium
point
This section will explore the control of a nonlinear system using a simple linear
proportional and derivative (PD) controller:
C(s) = kp+kds
where kp is the proportional control gain and kd the derivative control gain.
The student will use and modify the control program given below to conduct the
experiment. Again, the boxed code shown earlier is a starting point that can be loaded in
and modify according to various steps of the experiment.
7
Note that the student needs to determine a value for the variable, y1rawo, in the program.
;******************DECLARE VARIABLES*******************
#define y1cal q2
#define y1rawo q3
#define kp q4
#define kd q5
#define kdd q6
#define Ts q7
#define y1str q8
#define pos_last q15
#define u1str q16
#define u1o q17
#define u1 q18
;************************INITIALIZE***********************
Ts = 0.000884 ;must also set Ts in dialog box.
control_effort1 = 0
control_effort2 = 0
;Specify Parameters
u1o = 5000 ;gravity feedforward (u_bar in linearization
analysis)
y1rawo = ##### ;sensor#1 value at static equilibrium
corresponding to u10 value above (y_bar in linearization
analysis). You need to fill this in before implementing
control.
;Figure out a value of the sensor counts above using
;the magnet position in Table 6.1-2 along with y = f(x)
obtained from Table 6.1-1 data.
kp = 0 ;proportional control gain
kd = 0 ;derivative control gain
kdd = kd/Ts
;*************BEGIN REAL-TIME ALGORITHM**************
begin
y1str = y1rawo- sensor1_pos ;position error
u1str = -kp*(y1str) -kdd*(y1str-pos_last) ;CONTROL LAW
pos_last = y1str
u1 = u1str + u1o ;add gravity offset
control_effort1 = u1
q10 = -y1str ;reverse polarity for plotting
q11 = -cmd_pos ;reverse polarity for plotting
end
Experiment 2a: kp = kd = 0
In this first experiment, there are no gains used to control the system and thus the control
effort is set to zero.
8
Procedure:
1. Set kp and kd to zero and control effort u1o to 5,000 in the program. Run the program
to observe the disk to reach its equilibrium position. Press the disk down to the
bottom (or raise it up) and then let go a couple of time to feel and observe how the
system responds. Fill the observed equilibrium position in at the spot provided in the
algorithm code above.
2. Rotate the magnetic disk slightly to free it up from possible static friction that may
prevent it from reaching its equilibrium. Then take the following readings from the
PC and include it in the report:
a. Use the data acquisition of the PC system to record and plot two seconds of the
motion of the disk with the disk pressed down against the bottom plate to begin
with:
b. To set the data acquisition, go to Data and then Setup Data Acquisition. Select
Sensor 1 Position. Click okay. Then, go to Command, Trajectory 1. Select Step, and
input a step of 0 counts, dwell time of 2000 ms, and 1 rep. Click Okay twice.
c. Use MATLAB to create the plots and to accurately determine the settling time and
frequency response. Hint; use the Data cursor tool in the plot window in MATLAB
The final report is expected to include:
One (1) MATLAB Plot along with titles and labels. Be sure to include Data Cursor points
if determining the frequency.
- Plot of the disk response
Calculations or clearly indicate for the following quantities. Be sure to include units for
ALL values:
- Disk equilibrium position from the top of the plate
- Disk equilibrium Sensor 1 Counts
- Disk equilibrium Control effort 1 voltage
- Time to settle into equilibrium
- Frequency of the response
Experiment 2b: Undamped free vibration (limit cycle)
For 2b, the gain is increased to create a nearly undamped system.
Procedure:
By trial and error with the program, determine the maximum value of kp to make the
system vibrates up and down like an undamped free vibration when the disk is pressed
down (or lifted up) and let go. You should observe that, for any perturbation, the system
will vibrate up and down at the same amplitude indefinitely. A system that exhibits this
type of behavior is said to be displaying a limit cycle. A larger kp than this would make
the system unstable, which causes the disk rapidly striking the bottom plate (light hits are
9
OK). In this setting, since there in inevitably a damping coefficient from the friction
between the disk and the glass tube a perfectly undamped system is unachievable. The
students should instead look for a kp value that causes the disk to steadily oscillate for at
least 8 seconds. Try kp starting from 0.5. Do NOT let the disk hit the bottom hard. Use
the data acquisition of the PC system to record two seconds of the free vibration with the
disk pressed down against the bottom plate to begin with.

k p k sy s 1+k 1'
n =
m

=
k dk sy s 1
2m n
Where ksys1 = 100 N/m, k1’= 0.053, and m = 120 g as given by ECP.
Use MATLAB to create the plots and to accurately determine the frequency of the
response. Hint, use the Data cursor tool in the plot window in MATLAB.
In the lab report, you will need to derive the equations above for the natural frequency
and damping ratio above. To start, you have a nonlinear system represented by the
following:
Fw
Figure . Block Diagram of SISO System Showing Nonlinear Elements
The force out of the actuator is nonlinear, hence the dotted line showing that y enters
the equation, but does not multiply through the equation. The force equation for the
magnetic field nonlinearity is given by:
u1 test
Fw =
a y 1 +b 4
By linearizing the above equation in terms of perturbations in u and y, show that the
above diagram simplifies to the diagram below. You need to show the linearization
10
process from an FBD of the puck all the way to the final, linear differential equation.
Here you are supposed to use a and b to express ksys1 and k‫׳‬1.
Figure. Reduction of System to Linearized Form
In the case of a PD control law, assume that the system becomes:
u*1 (s)
r(s)
kp


ksys
–
–
PD
Controlle r
1
ms2 + k'1
y*1 raw(s)
Li neari ze d
Pla nt
kds
a) Low
er Sensor/Actuator
Locationsimplifies to:
Using block diagram algebra,
show
that the above
*
y 1 raw(s)
k p k s ys1 /m
y*2 raw(s)
r(s)
u*2(s)
=
1
'
r(s)
kp

sys s + k k
s2 + k k k/m
2+k /m
–
–
d s ys1
PD
p s ms
ys1 - k1'2
Li neari ze d
Controlle
And from this, show
that rthe damping ratio equations
Pla ntand natural frequency equations
‫׳‬
above are correct. Here you
kds are supposed to use kp, ksys1, kd and k 1 to express ωn and ζ.
Calculate the frequency ofb)the
response based on the equation above and using your plot
Uppe r Sensor/Actuator Loca tion
from Matlab. Compare the two results.
The final report is expected to include:
One (1) MATLAB Plot along with titles and labels. Be sure to include Data Cursor points
if determining the frequency.
- Plot of the “undamped” response
Calculations or clearly indicate for the following quantities. Be sure to include units for
ALL values:
- Experimental value of kp used
- Experimental value of the frequency
- Calculated value of the frequency
11
Experiment 2c: Creating an unstable system
In this experiment we will experimentally determine a kp that induces an unstable
response. Remember: a system that, for any small perturbation, gains amplitude with
each subsequent oscillation is exhibiting unstable behavior.
Procedure:
By trial and error with the program, determine the minimum value of kp to make the
system vibrate out of control for any small perturbation. Set up your data acquisition
so that you are using a step response with a step size of 0 counts, dwell of 2000
milliseconds and 1 rep. For each value of kp start by pressing execute under
command; make sure normal data sampling is selected and only execute trajectory
one. Move the disk approximately 500 counts from its equilibrium position press run
and then release the disk and observe its response. Use the data acquisition of the PC
system to record two seconds of the free vibration with the disk pressed down against
the bottom plate to begin with.
Use MATLAB to create the plot.
Determine the frequency of the system for the first half of data sampling and compare it
to the frequency of the latter half.
Knowing that this system is unstable in conjunction with your knowledge of the s-plane,
where would you say the eigenvalues of this system fall on the s-plane?
The final report is expected to include:
One (1) MATLAB Plot along with titles and labels. Be sure to include Data Cursor points
if determining the frequency.
- Plot of the “unstable” response
Calculations or clearly indicate for the following quantities. Be sure to include units for
ALL values:
- Experimental value of kp used
- Experimental value of the frequency of the first half of response
- Experimental value of the frequency of the second half of response
Experiment 2d Adding damping to the system
The last test now includes damping, which can create a system that has a very quick
settling time, compared to the near infinite settling time of 2c.
Procedure:
12
Finally, explore how the addition of the derivative control component may stabilize
and damp out the free vibration observed in the last step of proportional control alone.
Try a small positive value for kd such as 0.0001 to begin with and observe its effect
on the free vibration when the students press down or raise up the disk. Then increase
the kd value to a point where the free vibration will damp out most quickly and reach
the equilibrium fairly fast. If too large a kd value is used, it would cause the control
effort to go over the limit. Experiment this and determine the best kd value for the
stabilization. Your goal should be to have the fastest possible settling time. Use data
acquisition to record the damped response with the disk pressed down against the
bottom plate to begin with.
Determine the damping gain necessary to achieve an “optimal damping ratio” of
0.707. Compare the response associated with this Kd value to the response obtained
from your “guess” above.
Extra Credit: 0.707 is not the damping ratio that gives the fastest settling time, even
though it is often considered “optimal damping.” Calculate the damping ratio that
achieves a 5% maximum overshoot, and implement the resulting Kd value. If you
show this calculation and get a correct answer, you will receive 5 extra credit
points.
Use MATLAB to create the plots and to accurately determine the settling time and
frequency response. Hint; use the Data cursor tool in the plot window in MATLAB
Note the difference of the settling time from that in Experiment 2a: Does it take more
or less time to settle. Why?
Explain the difference of the frequency from that in Experiment 2c. Is it higher, lower
or no change? Why?
The final report is expected to include:
Two (2) MATLAB Plot along with titles and labels. Be sure to include Data Cursor
points if determining the frequency.
- Plot of the damped response by guessing
- Plot of the damped response by calculations
Calculations or clearly indicate for the following quantities. Be sure to include units for
ALL values:
- Guessed value of kd
- If measurable, the frequency from the plots
- Settling time for both plots
For all the questions highlighted, the questions should be copied and pasted into the
student’s lab report and explicitly answered immediately thereafter.
13
Reference: Procedure to implement control algorithm if algorithm
editor does not work.
a) Enter Setup Control Algorithm via the Setup menu. Select Edit Algorithm.
This opens up the control algorithm editor.
b) Click ‘File’ on the menu bar and select ‘New’ under ‘File’.
c) If a dialog box opens up, click ‘Sure’; otherwise, go to the next step.
d) Go to menu bar and click ‘File’ again. This time, click ‘Save As’ and save this
file in your personal folder that you have.
e) Go to your personal folder and find your control algorithm file. The file should
has the suffix -- .alg. Double click it to open this file.
f) If a dialog box saying ‘Windows can’t open this file’ opens up, then choose
‘Select a program from a list of installed programs’ and click ‘OK’. Then
choose Notepad to open this file.
g) Input your control algorithm and save it.
h) Go back to ECP software. In the Control Algorithm Window, click ‘Load from
disk…’ and choose the file you just edited and click OK.
i) You will see the Control Algorithm window showing that your file has been
successfully loaded. Then your algorithm is ready to use. If you click
Implement, then this algorithm will be executed on your apparatus.
j) If you want to edit your control algorithm, click ‘Cancel’ to exit from Control
Algorithm window. You have to make sure that behind ‘User Code:’, ECP
shows ‘(no file selected)’ because ECP sometimes does not overwrite the
previously loaded programs when a new program is loaded. In that case, exit
ECP and launch it again. Find the .alg file and edit it. Save it and load it in
ECP. Then ECP has a new control algorithm to use.
14
Download