CS452 - Real-Time Programming - Spring 2011

Lecture 25 - Reservation Bugs

Pubilic Service Announcement

  1. Project proposals.
  2. Train availability.
  3. Second train control demo. `I must have been insane.'


A Typical Reservation System

Hard Conditions

  1. **Every train must have a reservation for the block it occupies.
  2. **Every train must travel at a low enough velocity that it can stop before the end of the blocks it has reserved.
  3. **Every train should reserve enough to handle single sensor or (exclusive) single switch errors.
  4. Trains can switch turn-outs only on track they have reserved.
  5. Possibly, trains can query sensors only on track they have reserved.
  6. Every train must release blocks it no longer occupies and will not occupy in the immediate future

(** failsafe conditions)

Who enforces these conditions?

There is a situation in which these conditions cannot be enforced?

Here's how it works

  1. Train gets a route from the route finder, and looks ahead along the route.
  2. Train asks reservation system for several blocks of track. How many?
  3. Reservation system grants the blocks if they are available

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

Problems I Have Seen More than Once

Common Multi-train Tracking Problems

  1. Two trains waiting on the same sensor report
  2. Spurious sensor report that a train is actually expecting.
  3. Permanently malfunctioning turn outs
  4. Permanently malfunctioning sensors
  5. Finding the trains at the beginning

Useful debugging aids

  1. Alter the track graph from the prompt.
  2. Simulate sensor-triggering from the prompt.

Common Reservation System Problems

  1. System freezes
  2. Reservations are not released.
  3. Reservation leap-frogging

Useful debugging aids

  1. Insert/remove reservations by hand from the prompt
  2. Query reservations (and who holds them) from the prompt
  3. Track map showing reservations in real-time.
  4. Trains can get sensor reports only for sensors with the reservations they hold.
  5. Enforce in the reservation server that all reservations must be contiguous.

Common Route-Finding/Following Bugs

  1. Train derails on turn-out after train changes direction
  2. Train derails on turn-out after turn-out changes direction
  3. Switch switches too late

Useful debugging aids

  1. Add/subtract switches, sections of track from graph by hand from the prompt

Return to: