CS452 - Real-Time Programming - Spring 2012
Lecture 25 - Demos, Reservations
Public Service Annoucements
- 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.
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
- which track you wish to use,
- which train you wish to use
but, if one or the other is not available
- you should be able to run with a different locomotive or the other
track.,
Demos are Important
We give two marks for each part of the project
- one for the demo, which shows us what you project is doing in
reality
- one for the documentation, which shows us what your project is doing on
paper
Stay in Control
Dead air
- When there is nothing being said in a social situation people feel
awkward.
- They will talk to fill the empty space.
- At a demo they will ask questions.
- One question leads to another.
- You reach the end of the demo with the best things not shown.
Think about how to get back in control
- `Now we want to show you how we do X.'
- It is okay to be quite direct, `It's getting late and we want you to
see Y.'
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
- First the basic parts
- Next the neat extra things you did
Make your plan really concrete
- which locomotive you want to use
- where it starts
- where you will ask it to go
Tell us what was difficult to achieve in what you're showing
Make your demo easy to do
- put the train on the tracks in places that are easy to reach
- stop the train at places that are easy for us to measure
- stop the train in a location that's good for starting the next
part.
- drive the train to where you need it instead of picking it up.
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
- One at the terminal controlling the train, one explaining what is what
is happening
- One at the terminal readying the next part, the other at the train
readying the train part and telling us what we will see next and why it's
important
- Switch roles to give the demo more variety
Be ready for questions
- Explicitly asking us if we have questions to control when they get
asked.
- Put as much information as you can think of onto the terminal.
- how much the idle task is running
- where your calibration thinks the train is
- keep track of this even after you have given the stop
command
- errors in your predictions
- in time (milliseconds) and distance (cm)
Use Your Hands
For the most part we don't know where the things you're explaining are on
the track or the terminal.
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 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
- One train following another
- Two trains on a collision course
- There are one or more switches in the path
Stopping
A conservative train control system ensures that
- At all times
- every train is travelling slowly enough that
- the next time there is an information update
- it can give a stop command
- and stop without running into another train
- or off the end of the track.
For simplicity we assume that
- all trains follow the same set of rules.
How much clear track does a train need?
- The stopping distance? Not enough unless the train starts to stop
immediately.
- The stopping distance plus time for the command to arrive at the train?
Not enough the stop request is given immediately.
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.
- The stopping distance plus the time for the command to arrive at the
train plus the amount of time until the train next decides whether or not
to stop. This is enough if all other trains are stationary..
To be concrete, suppose the train decides what to do next each time it
arrives at a sensor. Then,
- If it just passed sensor n,
- the next time it will decide is when it arrives at sensor
n+1,
- the amount of clear track it needs is the stopping distance part sensor
n+1.
What if other trains are moving?
Every train needs in front of it an amount of clear track calculated as
above.
Head on.
- The train coming at me needs his amount of distance.
- I need my amount of distance.
- We must both start to stop when we are the sum of the distance
apart.
Remember that the distance any train needs diminishes as it slows down.
Following
- If a train and the train it is following, initiate stopping at the same
time
- the inter-train distance changes only by the difference in stopping
distance, which ought to be small.
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
- stalling or
- running into another train.
Is it possible to guarantee that such things won't ever happen?
- Train safety, like everything else in the world, is a trade-off.
Return to: