NivaarExam PrepOfficial exam papers ↗

19-Soft-A4 Real-Time Systems · May 2016

Question 4 of 6: Automotive Collision-Avoidance System — State Diagram and Real-Time Requirements

Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)

Notes on this paper

Paper: National Exams, May 2016, 04-Soft-A4 Real-time Systems, 3 hours, closed book. Any five of the six questions constitute a complete paper (all questions answered below as a full study resource). Reference texts: Liu, Real-Time Systems; Buttazzo, Hard Real-Time Computing Systems; Kopetz, Real-Time Systems: Design Principles for Distributed Embedded Applications; Ogata, Modern Control Engineering.

Question 4: Automotive Collision-Avoidance System — State Diagram and Real-Time Requirements (20%)

Question text not reproduced: the examination questions are © Engineers and Geoscientists BC. Open the official past paper (linked at the top of this page) to read the question, then follow the worked solution below.

Given.

QuantitySymbolValue
Travel speed$v$50 km/h = 13.89 m/s
Warning threshold$d_{\text{warn}}$15 m
Auto-brake threshold$d_{\text{auto}}$10 m
Braking distance$d_{\text{brake}}$6 m
Safe (residual) distance$d_{\text{safe}}$1 m

Find. (1) A state diagram covering both the stationary- and moving-object cases. (2) The real-time latency budget available to the sensor + decision unit + actuator chain. (3) A general formula relating that budget to initial speed and braking distance.

Approach. Model the system as a distance-threshold state machine (the same abstraction covers a stationary object and a slower-moving one, because both reduce to "closing distance falls below a threshold" — only the closing-speed value differs between the two cases); then derive the maximum end-to-end system latency as the time budget left over once the physically-required stopping distance and safety margin are subtracted from the auto-brake trigger range.

  1. State diagram (part 1). Four states suffice for both the stationary- and moving-object cases, because only the closing distance $d$ — not whether the object itself is moving — determines the transitions: Monitoring ($d>15$ m), Warning ($10Auto-Brake ($d\le10$ m, actuator engaged automatically), and Stopped ($v=0$ with $d\ge1$ m remaining). For a stationary object, $d$ decreases at the car's own ground speed $v$; for a moving (slower) object, $d$ decreases at the closing speed $\Delta v = v_{\text{car}}-v_{\text{object}}$ — the state machine itself is unchanged, only the rate at which the guard conditions are reached differs, and a return edge (Warning → Monitoring) covers the case where the lead vehicle accelerates away or the driver brakes enough to open the gap back past 15 m before auto-brake ever triggers.
    Monitoring(d > 15 m)Warning(10 < d <= 15 m)advise manual brakeAuto-Brake(d <= 10 m)actuator engagedStopped(v=0, d >= 1 m)d fallsto <= 15 md fallsto <= 10 mv reaches 0before d < 1 mobject clears /driver resumes ->resetobject recedes,d climbs backabove 15 m
    Figure 2 — collision-avoidance state diagram. The same four states and thresholds apply whether the object ahead is stationary or moving; only the closing-speed value used to reach each threshold differs.
  2. Real-time requirement of the sensor/decision/actuator chain (part 2). Once $d$ crosses the auto-brake threshold $d_{\text{auto}}$, the full chain — radar sample → distance/closing-speed estimate → brake-or-not decision → brake actuator command → physical braking — must complete, and the car must still come to rest, before the closing distance is consumed down to the safety margin. In the time the chain takes to react, the car (at speed $v$, to first order over the short reaction interval) continues closing at essentially constant speed, consuming distance $v\,t_{\text{sys}}$ before braking even begins; braking then consumes the given $d_{\text{brake}}$, and $d_{\text{safe}}$ must remain unconsumed. The requirement is therefore $$d_{\text{auto}} \ge v\,t_{\text{sys}} + d_{\text{brake}} + d_{\text{safe}}$$ $$t_{\text{sys}} \le \frac{d_{\text{auto}} - d_{\text{brake}} - d_{\text{safe}}}{v} = \frac{10-6-1}{13.89} = \boxed{0.216\ \text{s} \approx 216\ \text{ms}}$$ This 216 ms is the total real-time budget shared by the radar sampling interval, the decision-making unit's processing time, and the actuator's mechanical engagement lag — combined, they must not exceed it. As a secondary check, the interval between the Warning and Auto-Brake thresholds gives the driver's own manual-reaction window: $(15-10)/13.89 = 0.36$ s, confirming the automatic path has a substantially tighter deadline than the advisory path, as the design intends (the automatic system is the fallback for exactly the cases where 360 ms of human reaction time is not enough).
  3. General formula (part 3). Generalising the relation above to any initial speed $v$ and any braking distance $d_{\text{brake}}(v)$ (which itself typically scales with $v^2$ for a constant deceleration $a$, i.e. $d_{\text{brake}}=v^2/(2a)$), the maximum tolerable end-to-end system latency is $$\boxed{t_{\text{sys,max}}(v) = \frac{d_{\text{auto}} - d_{\text{brake}}(v) - d_{\text{safe}}}{v} = \frac{d_{\text{auto}}}{v} - \frac{v}{2a} - \frac{d_{\text{safe}}}{v}}$$ For the moving-object case, the same formula applies with the closing speed $\Delta v = v_{\text{car}}-v_{\text{object}}$ in place of $v$ wherever distance is being consumed by relative approach, while $d_{\text{brake}}$ (the ego vehicle's own physical stopping distance) is still governed by the car's absolute speed $v_{\text{car}}$, since a vehicle's brakes only ever act against its own ground speed, not the closing rate — a distinction worth stating explicitly, since conflating the two would understate the available reaction time for a slower-moving lead object.
QuantityValue
Travel speed, $v$13.89 m/s (50 km/h)
Manual-brake reaction window (Warning→Auto-Brake)0.36 s
Max. end-to-end system latency, $t_{\text{sys}}$0.216 s ≈ 216 ms
General formula$t_{\text{sys,max}}(v) = (d_{\text{auto}} - d_{\text{brake}}(v) - d_{\text{safe}})/v$