Lecture 24 - Reservations I

Public Service Annoucements

1. Slightly improved p1.pdf.
2. How to Give a Demo
• Friday, 29 June, in class.
3. When you will give you demo
• Tuesday, 3 July.
• I will put a sign-up schedule in the lab with fifteen minute slots at different times on Tuesday morning. Choose which is the most convenient for you.
4. Route Finding
• First demo
• Afterwards
5. How to describe track locations
• Landmark plus XX centimetres
6. Measurement procedures
• A landmark's position needs strong conventions about its local origin.

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.

• 'Exactly' means within a tolerance that you know.

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
• otherwise there is a trivial solution
• it might be worth implementing the trivial solution as a start

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

• As long as the trains are sufficiently far apart this is not too hard.
• What is the meaning of `sufficiently' in practice?
• Sensor attribution must function correctly in the face of single failures,
• of sensors, or
• of turn-outs.

Collision Avoidance

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

• at least as long as it takes the two trains to stop

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

• N trains start running.
• Then, after a while they get frozen and won't move.
• Each is waiting for another to move.
• If N is large freezing usually occurs because the route finder can't find a route for any train.

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?

• The code is simple.
• Each task has a well-defined role. E.g.
• Track monitor knows the current state of the track.
• Route planner uses track monitor input to provide a feasible route.
• Train driver gets a route and follows it switching turn-outs ahead of itself as it drives.
• Protocols for inter-task communication arise naturally from the roles.
• The solutions usually scale well, as long as the track length grows at least linearly with the number of trains.

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.

• On heavily used sections of track the lower level is done completely by hardware with no possibility (almost) of human intervention

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.
• The despatcher gets two reports
1. One from the hardware
2. One from the engineer
• It is up to the despatcher to make certain that they do not conflict.
• What is to come on the route is communicated to the train driver by the lights along the track

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.

• Everything is rigidly enforced by hardware
• The human enters the loop only in that the lights tell the engineer what he/she is allowed to do
• The engineer loses his licence, FOREVER, if he/she ever goes through a red light.
• If the system detects a violation of its rules or a state that should never occur it enters a failsafe mode
• All lights go red.

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