CS452 - Real-Time Programming - Spring 2012
Lecture 24 - Reservations I
Public Service Annoucements
- Slightly improved p1.pdf.
- How to Give a Demo
- Friday, 29 June, in class.
- 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.
- Route Finding
- How to describe track locations
- Landmark plus XX centimetres
- 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
- the train finds itself
- you give it a destination: a destination is a location on the track
- the train starts travelling toward the destination
- it reaches the destination without colliding with the other train
- both trains move at the same time
- otherwise there is a trivial solution
- it might be worth implementing the trivial solution as a start
Sensor Attribution
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.
You must plan ahead,
- 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
- Train asks despatcher for a route
- Despatcher provides a route that he/she thinks to be conflict free
- Train follows the route, reporting back to the despatcher as landmarks
(sensors) are passed.
- The despatcher gets two reports
- One from the hardware
- 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
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
- One train following another
- Two trains on a collision course
- There are one or more switches in the path
Return to: