CS452 - Real-Time Programming - Spring 2012

Lecture 25 - Demos, Reservations

Public Service Annoucements

  1. When you will give you demo

Giving a Demo

The notes below assume particular roles: `we' are the prof and TAs, the audience of the demo; `you' are the students giving the demo.

Remember these rules

You may choose

but, if one or the other is not available

Demos are Important

We give two marks for each part of the project

  1. one for the demo, which shows us what you project is doing in reality
  2. one for the documentation, which shows us what your project is doing on paper

Stay in Control

Dead air

Think about how to get back in control

If the train needs to run for a minute to refresh its calibration, spend the time

Know in Advance what You Want to Demo

Make a list, progress from easy things to harder ones

Make your plan really concrete

Tell us what was difficult to achieve in what you're showing

Make your demo easy to do

Write down the details so you don't forget.

Test Everything You Want to Demo

Have at least one older executable available

There are Two of You

Ways to take advantage of it

Be ready for questions

Use Your Hands

For the most part we don't know where the things you're explaining are on the track or the terminal.


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 Ought to 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


A conservative train control system ensures that

For simplicity we assume that

How much clear track does a train need?

You have, no doubt, defined stopping distance in a variety of different ways. Here it is defined as the distance it takes the train to stop from the point where the command is processed at the locomotive.

To be concrete, suppose the train decides what to do next each time it arrives at a sensor. Then,

What if other trains are moving?

Every train needs in front of it an amount of clear track calculated as above.

Head on.

Remember that the distance any train needs diminishes as it slows down.


This suggests that one train can follow another train quite closely, but it assumes that the leading train will not do something unexpected, such as

Is it possible to guarantee that such things won't ever happen?

Return to: