Introduction:
The SOFIA telescope uses powerful torque
motors, sensitive photo arrays, gyroscopic
sensors and a complex control program to
acquire and track stars in three dimensions
(elevation, cross elevation and
line-of-sight). All of this is necessary to
allow high resolution infrared observations.
The sensors, torque generators and control
program we are using on the beam system are
much simpler and less accurate, but they
demonstrate the fundamentals required for one
dimensional acquisition and tracking control.
These experiments rely upon what you have
learned in the first six experiments as well
as the components and development work to
provide the meter-stick beam with fans,
platforms, balancing weights, wiring, sensors,
etc. along with the understanding of the Handy
board and its Interactive C programming
environment. All we are adding here are some
basic concepts of feedback control, and some
design direction based upon linear
differential system analysis, which is really
beyond the scope of these experiments.
Objective:
1. To provide a simple control system
example using optical sensors, real-time
digital signal processing, and
electromechanical interfaces.
2. To demonstrate similar control to track
an optical source with the same sensors
where the system physical dynamics must be
factored into feedback control design.
3. To provide an experimental environment
where the student can understand the
design parameters by adjusting the
conditions and experiencing the results
directly.
Procedure:
When using the sensors designed for
detecting the angular direction to a point a
system toward a light, the control method,
and design difficulty depends upon the
system dynamics and the actuator used for
adjusting the angle. Two systems are
compared:
1. To control the servo as used in the
sensor test jig, (‘aim7.c’ in experiment
6) the design of a feedback control loop is
straight forward. No change has to be made
from the physical configuration used to
calibrate the sensors, only the program is
changed to provide feedback control. Refer
to figure A for the physical configuration.
The feedback function for tracking uses the
difference value obtained by subtracting the
bottom sensor reading from the top one.
Remembering that a large value means a low
signal, if the difference is positive (the
top one reading larger) the servo increments
up, otherwise the servo decrements down.
(Try to visualize how this control works,
because it assumes that an increasing servo
angle is going up; if your test jig is
configured such that increasing angles go
down, you will have to change the polarity
of the servo output, or switch sensors to
make it work. How does the servo dynamics
effect the control? (What happens if the
delay in the tracking loop is reduced? Why?)
The program has two important subfunctions:
a tracker function, called
"track()", and an acquisition
function, called "lost()".
Lost(pos) guides the servo to the position,
"pos", within the calibrated range
for the sensors and then turns over control
to the tracker. Guidance assumes that the
maximum servo angle is 120˚ and the
minimum is 40˚ as it searches. If
track() finds a signal greater than 200, the
calibration range, (if sensor a & b are
both not sensing the lamp) it returns the
control to lost(), thus the program should
provide very robust pointing control.*
* The style of programming in ‘aim7.c’
makes use of the rule that C functions can
be nested and do not execute until they
have their input parameters; this leads to
the very compact notation using only one
line in the main program to describe how
the lost() and track() objects interact.
Programming enthusiasts should study the
notation, and experiment with ways to
simplify the code.
2. To control the Meter-stick &
Fans Beam System is a little more
difficult. Unlike the test jig system,
where the servo directly controls the
angle, the fans only control the
acceleration of the angle for the Beam
system. Furthermore, the Beam system
only has gravity to control the angle
position when the fans are off.
Returning to what we learned about
center-of-mass (Cm) and
moment-of-inertia (Im), in experiments
1 & 2, we can describe the Beam
system as a pendulum those dynamics
are based upon these properties.
Although it is a non-linear system in
general, the pendulum dynamics can be
approximated by a "linear 2nd
order differential equation" for
the small angular changes that we are
controling. This may sound rather
imposing, but because it has been
characterized for years by system
analysis, we can define its features
almost by inspection. The basic
equation of pendulum motion is
Im*ø(t)" +
D*ø(t)' + k*ø(t) = T(t)
where T(t) is driving torque from the
fans,
ø(t) is the angular position with
time,
ø(t)' & ø(t)" are the
1st and 2nd derivatives of ø with
respect to time,
and Im, D, and k are constants
related to the properties of the
pendulum:
Im is the moment of inertia, D
is the damping force per
angular rate,
k is the restoring force or
"spring constant"
related to the angular
position.
The main problem with
controlling this pendulum, or
any pendulum, is its natural
oscillatory mode; there is no
physical source for damping
its motion. In terms of the
equation the ‘D’ term is
very small. As long as the Cm
is kept close to the Cr, k can
be kept less than the fan
torque and neglected.
The program ‘aimfan7.c’
, which provides the
feedback control, has very
few lines of code but may
seem quite mysterious. It
must feedback to the fans
a correction based upon
both the angular error
(a-b) and a damping
component, representing
the 1st dervative of the
angle or the angular
velosity. Without the
damping component the
pointing error would
oscillate with a large,
unacceptable amplitude.
The a damping component is
labeled ‘diff’, and
contains the value of the
difference between a-b
since it was last sampled
multiplied by a large
number. Can you explain
how diff is proportional
to the angular velosity?
Hint: How does the time
between samples effect
diff?
Even as written, there
is some oscillatory
error about the
direction of the lamp.
(Engineering enthusiasts
can try to reduce that
error, either with
physical or programming
additions or
corrections.)
/*aimfan7
Kevan Anderson,
8/99 -r*/
/*
This program runs the
tracking process which
controls the
beam
and keeps it pointed at
the light.
it begins with a
push of
the
stop button which begins
the main program.
The fans are
initialized
to a speed of 4 and the
program waits for the
start
button
to begin tracking.
The tracking
program runs in a loop
until
the board is shut off.*/
void
main(){
while(!(stop_button())){}
run(0,4);
run(1,4);
printf("begin?\n");
while(!(start_button())){}
/* wait for start button
*/
sleep(1.);
track();
}
/*
Will track a light
source up and down. The
program initializes
variables
a and b to represent the
sensor input from the
bottom
and top sensors
respectively.
The terms diff1,
diff2, and diff are
created
to monitor the speed of
the beams approach towards
the
light.
A gain factor is
multiplied times
diff1-diff2 to create diff
which
will ensure proper
tracking.
The gain factor may
be
changed
from 150 to 275 with
different results.
The while loop
within
'while(1)' checks to make
sure the beam is within
tracking
range.
The if statments
provide direct control of
the fans and
integrate
the diff into the decision
making process*/
void
track(){
int
a; int b;int diff1; int
diff2=0;int diff;
printf("tracking\n");
while
(1){
a=
analog(0);
b=
analog(1);
diff1=(a-b);
diff=225*(diff1-diff2);
while((a>200)&&(b>200)){
a=
analog(0);
b=
analog(1);
run(0,1);run(1,1);
sleep(.5);
}
if
(((a-b)+diff)>0){
run(1,7);run(0,2);
}
if
(((a-b)+diff)<0){
run(1,2);run(0,7);
}
diff2=diff1;
if(stop_button()){
/* stop tracking, wait for
start button */
run(0,1);run(1,1);
while(!start_button()){}
}
}
}
/*
Converts int speed into
fan per cent voltage and
runs the fan.
The
speed-to-voltage per
centage conversion
represented
here
may have different
threshold values and
should be
adjusted
to meet the conditions of
your fan.*/
void
run(int fan, int speed){
int
a;
if
(speed==0){a=5;}
if
(speed==1){a=20;}
if
(speed==2){a=30;}
if
(speed==3){a=45;}
if
(speed==4){a=55;}
if
(speed==5){a=75;}
if
(speed==6){a=85;}
if
(speed==7){a=100;}
motor(fan,a);
}
