CS452 - Real-Time Programming - Fall 2010
Lecture 22 - Trains
Public Service Announcements
- Open house, November 9, 2010
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.
- Actually, not quite where it is. There is a time lag.
- Train triggers sensor at t: x(t) = Sn + 0 cm
- Report of sensor is recorded (time-stamped) at t + dt
- At t + \delta: x(t + dt) = Sn + dx
- dx = \int_t^t+dt v(t') dt' ~= v(t) dt
- How fast do trains go? Estimate 20 cm/sec
- If dt is 100 msec you are off by 2 cm.
- What determines the size of dt? Work it out.
- Poll correct sensor.
- Receive response.
How do you know where the locomotive 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.
- `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
Important. Some of these effects are matter; some don't.
It's part of your task to find out which is which.
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
Important. Some of these effects are matter; some don't.
It's part of your task to find out which is which.
How to Get Started
The simplest objective:
- know where the train stops when you give it a command to stop
- restrict the stop commands to just after the train passes a sensor
- only one train moving
Sequence of events
- Train triggers sensor at t
- Application receives report at t + dt1
- You give command at t + dt1 + dt2
- Train receives and executes command at t + dt1 + dt2 + dt3
- Train slows and stops at t + dt1 + dt2 + dt3 + dt4
- train at Sn + y cm
- (You measure y with a tape measure.)
Questions you need to answer
- If you do this again, same sensor, same speed, will you get the same
answer?
- If you do this again, different sensor, same speed, will you get the
same answer?
- If you do this again, same sensor, different speed, will you get the
same answer?
- If you do this again, different sensor, different speed, will you get
the same answer?
Now make a table
|
Sensor 1 |
Sensor 2 |
... |
| Speed 6 |
|
|
|
| Speed 8 |
|
|
|
| ... |
|
|
|
There are enough measurements in each cell of the table that you can
estimate the random error. (Check with other groups to make certain that your
error is not too big.)
Group across cells that have the `same' value.
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: