# CS 452/652 Winter 2020 - Lecture 21

February 28, 2020 prev next

### Train Modelling - Acceleration

• velocity is the derivate of movement
• acceleration is the derivative of velocity
• deceleration is negative acceleration
• kinematic reality:
• velocity is finite → movement must be continuous
• alternative would be teleportation
• acceleration is finite → velocity must be continous
• alternative would be infinite forces tearing train apart
• show with curves: movement, velocity, acceleration
• kinematic model: assume constant acceleration
• approximate as average velocity during acceleration interval
• or approximate as velocity step change in the middle of acceleration interval
• both are ok, if low-quality location estimate is acceptable during acceleration

#### Measurement

• measure similar to velocity
• measure time between two sensors
• change speed level at first sensor
• compute acceleration based on known estimates for velocities
• first detect whether train has reached target velocity at 2nd sensor?
• constant acceleration → average velocity during acceleration = (v1 + v2) / 2

#### Processing

• assume acceleration from known velocity v1 to v2
• experiment changes the speed at a sensor and measures the time to another sensor hit
• measure times and estimate time averages first, as before!
• t: average time; d: distance
• average speed during acceleration: va = (v1 + v2) / 2
• Scenario 1: acceleration complete before 2nd sensor hit (t < d / va)
• split d into two segments
• d1: acceleration, and d2: stable velocity v2
• d = d1 + d2
• t1 = d1 / va
• t2 = d2 / v2
• t = t1 + t2
• can solve for d1, d2, t1, t2
• acceleration: (v2 - v1) / t1
• Scenario 2: acceleration not complete before 2nd sensor hit (t > d / va)
• average velocity during acceleration: vs = d / t
• velocity at 2nd sensor hit: vr = vs + (vs - v1)
• acceleration: (vr - v1) / t

#### Stop Distance

• special case of deceleration
• manual experiment
• send stop command when sensor is triggered
• manually measure stop distance

#### Stop Time

• compute using acceleration model
• experiment by trying to stop right after sensor
• use search algorithm to find right time: could be automated
• stop time + velocity → compute stop distance?
• search algorithm (e.g., binary search) might be brittle and need many experiments

#### Aside: Average Latency?

• using an average to characterize or estimate latencies is often not a good idea
• latency utility curves usually have an S-shape
• when using an average, outliers can offset many values close to the mean
• however, outliers do not increase or decrease aggregate utility significantly!
• how often a train enters a critical section of the track without permission matters more than how much it overshoots

#### Start

• special case of acceleration
• measure based on known estimate for stop time/distance
• stop at known location, then start
• measure time to sensor
• can compute acceleration
• similar caveat as acceleration measurement: did train reach target velocity?

#### Short Moves

• stop before reaching target velocity
• manual experiments with different (short) times between start and stop