CS452 - Real-Time Programming - Spring 2012

Lecture 24 - Reservations I

Public Service Annoucements

  1. Slightly improved p1.pdf.
  2. How to Give a Demo
  3. When you will give you demo
  4. Route Finding
  5. How to describe track locations
  6. Measurement procedures

Multi-Train Control

By the end of the week-end you should be able to drive one train on the track, knowing exactly where it is.

By the following milestone you will be able to control two trains at the same time. For each train

  1. the train finds itself
  2. you give it a destination: a destination is a location on the track
  3. the train starts travelling toward the destination
  4. it reaches the destination without colliding with the other train
  5. both trains move at the same time

Sensor Attribution

The first hard problem occurs when you receive a sensor report. Which train triggered the sensor?

Collision Avoidance

This would not be too hard if the trains stopped instantaneously, but they don't.

You must plan ahead,

It is usually your method of collision avoidance that limits the number of trains that can run simultaneously.

I like distributed solutions, where each train operates -- plans, drives, make decisions, etc -- as though there are no other trains on the track. Why do I like this?


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. In cases of conflict between the upper and lower levels, the lower level wins.

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: