CS452 - Real-Time Programming - Spring 2011

Lecture 23 - Calibration, Reservations

Pubilic Service Announcement

  1. Sign up for first milestone demo.
  2. Acceleration/deceleration pdf.

Stage 3. Calibrating Acceleration and Deceleration

Physics of Acceleration and Deceleration

At the core is a relation, (x, t), which is a space-time point. The relation says that as time passes a train takes up successive positions x(t).

Teleportation

The first thing that we rule out is teleportation.

A train having infinite velocity is impossible in practice

No teleportation means that x(t) must be continuous.

Constant Velocity

Suppose you have a train at (x1, t1) and you have to get it to (x2, t2).

Two questions:

  1. Is it possible? If the maximum velocity is vmax, and vmax < (x2 - x1) / (t2 - t1), then it's impossible.
  2. How do you do it? If vmax > (x2 - x1) / (t2 - t1) then you might try
    1. Set v = (x2 - x1) / (t2 - t1) at t1
      • Use your velocity calibration for this!
    2. Set v = 0 at t2.

    Doesn't quite work.

    1. Because of acceleration you arrive at x2 after t2.
    2. Because of deceleration you don't stop until the stopping distance beyond x2.

    You could

    But

    1. It's against the rules, because
    2. Your project would only be interesting to trees, and
    3. You would be unsuccessful because of stalling on curves.

More Fundamental

Infinite acceleration is impossible because the train would be crushed, if not vaporized!

This is true both in theory and in practice.

Constant Acceleration/Deceleration

Intuitively a good idea to minimize acceleration

  1. Accelerate at a from t1 to (t2 + t1) / 2
  2. Decelerate at -a from (t2 + t1) / 2 to t2
  3. At t2

But, what happens at t = t1, (t2 + t1) / 2, t2?

Constant Jerk

Third order curve for position, second order for velocity, linear acceleration. We usually go one better, and try to minimize jerk over the whole journey.

Minimize Jerk

Acceleration/Deceleration is continuous

The result is a fourth order curve in position, third order in velocity, which is what you try to achieve when you drive.

This is all more correctly, more coherently and more readably here.


Is it Worth Having an Explicit Function?

Benefits

  1. You can calculate position explicitly without having to do numerical integration.
  2. You can calculate the parameters of a function with less measurement. How?

    The idea is that the person who programmed acceleration/deceleration into the train was lazy, so there's probably one basic function used over and over again

Drawbacks

  1. You need to check that the functional form you have is the right one, or a right-enough one.
  2. For practical purposes small look-up tables may be perfectly adequate.

Reservations

Somebody has been doing something right for the last century. The answer is reservations.

Two Level Train Control

The two levels are completely independent of one another.

Upper Level

  1. Train asks despatcher for a route
  2. Despatcher provides a route that he/she thinks to be conflict free
  3. Train follows the route, reporting back to the despatcher as landmarks (sensors) are passed.

Lower Level

The lower level is encoded in the coloured lights you see along the track

Here's how it works

  1. Train asks reservation system for several blocks of track
  2. Reservation system grants the blocks if they are available

An Interesting Tit-bit That Doesn't Concern You

Real trains are long and sometimes occupy several blocks at once. How does the engineer know that the end of a train is clear of a switch?

Something Essential that You Must Do

Design your reservation system before coding it.

Before coding your reservation system work it out on paper and make sure that it works for all the generic cases you can think of

  1. One train following another
  2. Two trains on a collision course
  3. There are one or more switches in the path

Return to: