CS452 - Real-Time Programming - Winter 2013

Lecture 16 - Calibration I

Pubilc Service Annoucements

  1. Due date for kernel four.
  2. Serial I/O questions.
  3. Measurement is an activity that is not speeded up by being smart.
  4. Exam: ??

Train Properties

Note. I try to be consistent in distinguishing between two closely related concepts: speed and velocity.

Velocity is controlled by changing the train's speed, BUT, the mapping between speed and velocity is complex.

Important. Some of these effects matter; some don't. It's part of your task to find out which is which.

Furthermore, things can go wrong, such as

Avoiding such failures, or responding sensibly to them, is possible only if you have a `good enough' velocity calibration. (You get a perfect calibration only in the limit t->infinity, and train you are calibrating is dead long before that.) Failures like these also pollute your attempt to acquire reliable data for your calibration.

Factors that might effect a calibration.

In general the velocity of a locomotive may be a function of many variables

  1. which locomotive it is
  2. which speed is set
  3. time since the last speed change
  4. the velocity at which it was travelling before the last speed change
  5. where it is on the track
  6. how long since the track was cleaned
  7. how long since the locomotive was lubricated

Important. Some of these effects are matter; some don't. It's part of your task to find out which is which.


Calibration

Where is it?

A question with two different answers

  1. A location known by the the person who asked the question, a landmark.
  2. A route to the item about which the question was asked, taking the asker into unknown territory. The route contains

Where am I?

The usual answer is a combination of a landmark plus a measurement.

To get the second part of the answer you can

The second of these is called dead reckoning. To know where a train is we use a combination of landmarks, sensors, and dead reckoning, knowing the train's velocity and how long it has been travelling since the landmark.

Philosophy

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

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

1. Calibrating Stopping Distance

The simplest objective:

Sequence of events

  1. Train triggers sensor at t
  2. Application receives report at t 1 = t + Δ 1
  3. You give command at t 2 = t + Δ 1 + Δ 2
  4. Train receives and executes command at t 3 = t + Δ 1 + Δ 2 + Δ 3
  5. Train slows and stops at t 4 = t + Δ 1 + Δ 2 + Δ 3 + Δ 4

Questions you need to answer

Comments

  1. The sequence of events above has a whole lot of small delays that get added together
  2. Knowing where you stop is very important when running the train on routes that require reversing
  3. Clearly, knowing when you stop is equally important.

This is very time-consuming!

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, with or 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 train length or better. However, suppose you want to reverse direction at a switch.

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

    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.

  3. After many measurements you build a table

Using Resources Effectively

The most scarce resources

The most plentiful resource

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.
  2. The values you measure vary randomly.

The values you measure vary systematically

3. Calibrating Acceleration and Deceleration

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.

How Long does it Take the Train to Get up to Speed?


Return to: