CS452 - Real-Time Programming - Fall 2009
Lecture 23 - Trains
Reminders
Assignments
1. Tracking & Route Finding
What you are expected to do
- One locomotive on the track:
- Give the locomotive a destination & speed at the terminal.
- Train finds the shortest route to the destination and travels to
it.
- Your application knows where the train is at all times.
- This should be robust against malfunctioning sensors and switches
- To do this you need
- Calibration
- Route creation. In route creation routes in which the lomotive
changes direction seem more clever.
2. Avoiding
What you are expected to do
- Two or three locomotives on the track:
- Give each locomotive a destination & speed at the terminal.
- They find non-conflicting routes to their destinations and travel
to them.
- Your application knows where the trains are at all times.
- This should be robust against malfunctioning sensors and switches
- Locomotives should not collide
- Locomotives should not fuse into one when they get too close
together
- To do this you need
- Adaptive route finding
- A track reservation system
Projects
1. Train style
Give trains roles and objectives. For example,
- Passenger train travels on a repetitive route meeting a schedule.
- Freight train travels to random destinations as fast as possible.
- Objective is to deliver as much freight as possible while keeping a
passenger train on time.
Another example,
- Trains are taxis.
- When a load appears they race to see if they can get it
2. Game style
The track is a graph.
- Several different ways to choose vertices and edges
Many games are played on graphs
- Checkers, snakes & ladders, maze games, etc.
- Implement a graph game played on the track graph.
- E.g. watchmen and bandit.
Train Properties
A locomotive travels on the track at a given speed following the path
created by directions of turn outs.
- As it travels it triggers sensors that give you feedback as to where it
is.
Things can go wrong, such as
- A turn out switches while a locomotive is on top of it.
- Locomotives run off the ends of sidings.
- Locomotives stall because they pass over difficult parts of the track
too slowly.
- Sensors fail to trigger, or trigger in the absence of a locomotive
The mapping between speed controls and train velocity is complex
- Velocity changes are not instantaneous. After the speed is changed the
train speeds up and slows down gradually.
- After the speed is changed the train speeds up and slows down
gradually.
- `Tricks' that make the train stop instantly are not acceptable
because they wear out the trains.
- The velocity decreases when travelling over turn outs or around curves.
- The smaller the radius of curvature the slower the velocity.
- Different locomotives travel at different velocities when set to the
same speed.
- Velocity of a given locomotive decreases over time
- As the track gets dirty.
- As the time since the locomotive's last lubrication increases
In general the speed of a locomotive may be a function of many
variables
- which locomotive you have
- which speed you set
- time since the last speed change
- the speed it was travelling at before the last speed change
- where it is on the track
- possibly on what type of track it is on
- how long since the track was cleaned
- how long since the locomotive was lubricated
The Essence of Calibration
- You measure the time interval between two adjacent sensor reports.
- You calculate the velocity of the train
- velocity = distance / time interval
- measured in cm / sec.
- After many measurements you build a table
- Use the table to determine the current velocity
- Use the time since the last sensor report to calculate the distance
beyond the sensor
- distance = velocity * time interval
The Problems You Have to Solve
- The table is too big.
- You need a ton of measurements
- The values you measure vary.
- You need to average and estimate error.
Return to:
Return to: