CS452 - Real-Time Programming - Spring 2011

Lecture 20 - Trains

Pubilic Service Announcement

  1. Exam: starts 09.00, Thursday, 11 August, 2011; ends 11.30, Friday, 12 August, 2011.
  2. Stopping trains. There is a tricky method that stops a train instantly. You nust not use it. Why?
  3. Doubling segments.

Train Properties

A locomotive travels on the track at a given speed following the path created by directions of turn outs.

How do you know where the locomotive is?

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. 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.

How to Get Started

The simplest objective:

Sequence of events

  1. Train triggers sensor at t
  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

Questions you need to answer

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 without saying so is `academic dishonesty'.

The Essence of Calibration

  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

The Problems You Have to Solve

  1. The table is too big.
  2. The values you measure vary randomly.
  3. The values you measure vary systematically

Return to: