Lecture 17 - Calibration I

Public Service Annoucements

1. Convocation
2. Exam: 9.00, August 8
3. Flow control when communicating with the train controller.
4. Measurement is an activity that is not speeded up by being smart.

Calibration

Philosophy

You can't do anything until you know where the train is. You accomplish this by

• Knowing the train's location when it arrives at a landmark, and
• Interpolating between landmarks by knowing the train's velocity all the time.

Measurement is costly, and you should squeeze every bit of information you can out of every measurement you make.

• By analogy with human information processing, I recommend that every time you get a sensor report you make a prediction
• Which sensor do you expect to hit next?
• When do you expect to hit it?
• When you hit the next sensor you automatically have an estimate of how fast you travelled between the sensors.
• This estimate is your most recent estimate of the train's velocity on that piece of train, at that speed.
• Using it to improve the calibration tables is what we call dynamic calibration.
• Display the difference between your prediction and your measurement on the terminal,
• in time,
• in distance,
• in velocity

This gives you an ongoing feeling for how your application is working, which is very important for setting effective tolerances.

1. Calibrating Stopping Distance

The simplest objective:

• know where the train stops when you give it a command to stop
• restrict the stop commands to just after the train passes a sensor
• only one train moving

Sequence of events

1. Train triggers sensor at t
• train at Sn + 0 cm
2. Application receives report at t + dt1
3. You give command at t + dt1 + dt2
4. Train receives and executes command at t + dt1 + dt2 + dt3
5. Train slows and stops at t + dt1 + dt2 + dt3 + dt4
• train at Sn + y cm
• (You measure y with a tape measure.)

Questions you need to answer

• If you do this again, same sensor, same speed, will you get the same answer?
• If you do this again, different sensor, same speed, will you get the same answer?
• If you do this again, same sensor, different speed, will you get the same answer?
• If you do this again, different sensor, different speed, will you get the same answer?
• And all the other important ones in the list above.

1. The sequence of events above has a whole lot of small delays that get added together
• Each one has a constant part and a random part. Try to use values that are diffferences of measurements to eliminate the constant parts.
• Some delays can be eliminated a priori because they are extremely small compared to other delays. The more you figure this out in advance the less measurement you have to do.
2. Knowing where you stop is very important when running the train on routes that require reversing
• Why are reversing routes important?
3. Clearly, knowing when you stop is equally important.

This is very time-consuming!

• The only way to reduce the number of measurements is to eliminate factors that are unimportant.
• The only way to know that a factor is always unimportant is to measure. Developing the ability to estimate quickly, and to find the worst case quickly is the main way of being smart in tasks like this one.

Now make a table

 Sensor 1 Sensor 2 ... Speed 6 Speed 8 ...

There are enough measurements in each cell of the table that you can estimate the random error. (Check with other groups to make certain that your error is not too big.)

Based on calibrations I have seen in previous terms you will find substantial variation with speed setting and train, little variation with sensor.

Group across cells that have the `same' value. Maybe all have the same value.

Hint. Interacting with other groups is useful to confirm that you are on track. Of course, simply using another group's calibration without saying so is `academic dishonesty'.

2. Calibrating Constant Velocity

At this point there are a few places on the track where you can stop with a precision of a trainlength or better. However, suppose you want to reverse direction at a switch.

• You want to be close to the switch, clear of the switch, and on the right side of the switch when you stop.
• You want to know when the train has stopped because, until then you cannot give the command to start moving again.

Knowing the Current Velocity

An implicit assumption you are making is that the future will closely resemble the past.

1. You measure the time interval between two adjacent sensor reports.
2. Knowing the distance between the sensors you calculate the velocity of the train
• velocity = distance / time interval
• measured in cm / sec.

Note that on average the lag mentioned above -- waiting for sensor read, time in train controller, time in your system before time stamp -- is unimportant.

• Sensor1 actually hit at t1.
• You record (S1, t1 + dt) as the first event.
• Sensor2 actually hit at t2
• You record (S2, t2 + dt) as the second event
• You compute the velocity as (S2 - S1) / (t2 + dt - (t1 + dt)) = (S2 - S1) / (t2 - t1), which is the correct answer.
• But the variation in dt from measurement to measurement adds noise to the measurement.
3. After many measurements you build a table
• Use the table to determine the current velocity
• Use the time since the last sensor report to calculate the distance beyond the sensor
• distance = velocity * time interval

Using Resources Effectively

The most scarce resources

• Bandwidth to the train controller
• Use of the train itself

The most plentiful resource

• CPU

Any time you can use a plentiful resource to eliminate use of a scarce one you have a win. For example

Practical Problems You Have to Solve

1. The table is too big.
• You need a ton of measurements
2. The values you measure vary randomly.
• You need to average and estimate error.

The values you measure vary systematically

• For example, each time you measure the velocity estimate is slower, presumably because the train is moving towards needing oiling.
• You need to make fewer measurements or use the measurement you make more effectively.

How Long does it Take to Stop?

Try the following exercise.

1. Choose a sensor.
2. Put the train on a course that will cross the sensor.
3. Run the train up to a constant speed.
4. Give the speed zero command at a location that stops the train with its contact on the sensor
5. Calculate the time between when you gave the command and when the sensor triggered.
6. Look for regularities.