CS452 - Real-Time Programming - Spring 2009

Lecture 25 - Calibration

Controlling a Train

Types of Control


Measuring Speed

The easy part

Using a Calibration

The other easy part

Building a Calibration Table

The hard part.

Two things are hard.

  1. Dealing with measurement error
  2. Two strategies for dealing with error
    1. Promotion
      • Segregate data to promote random error into systematic error
    2. Be conservative
      • The further you get in your project the more you will want to relax conservative assumptions
  3. Determining what state is relevant

Dealing with Data


Large collection of data records

Train Speed Section Previous


Time since

speed change


Time since




of track









25 8 31 10 23 76 higher curved 8.9

How to manipulate the data

  1. Code data with lots of values

What to do with the data

  1. Remove the mean
  2. Calculate the remaining variance
  3. Form a linear model
  4. Calculate the optimal values for each factor
  5. Find out which factors matter

The result is a collection of factors and values for each factor

In reality a lot of intuition about the trains goes into the above judgment.




Whatever you do you can't do ANOVA online

Consider this:

  1. You already know the factors and their values
  2. Allocate a value for each
  3. Initialize the value with a pre-estimate
  4. Each time you measure a velocity

Practical Issues

You might want to consider

  1. You are already doing a whole lot of measurements
  2. Average in a circular buffer to get variance estimate
  3. Turn on optimization, but be careful
  4. Size & align calibration tables by size & alignment of cache lines
  5. Slowing and stopping

Return to: