19-Soft-A4 Real-Time Systems · May 2013
Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)
National Exams — May 2013 — 04-Soft-A4 Real-Time Systems. Three-hour, closed-book exam (Casio or Sharp approved calculators only). Format: six questions of equal value (20% each); any five constitute a complete paper and only the first five as they appear in the answer book are marked. All six are solved below for completeness. Where a doubt exists as to interpretation, the candidate is expected to state assumptions — engineering assumptions used below are flagged in check callouts.
Reference texts: Jane W. S. Liu, Real-Time Systems (Prentice Hall, 2000) — task models, timing requirements, FCFS and EDF scheduling; Giorgio C. Buttazzo, Hard Real-Time Computing Systems: Predictable Scheduling Algorithms and Applications (Springer, 3rd ed.) — preemptive dynamic-priority scheduling and the optimality of EDF; Hermann Kopetz, Real-Time Systems: Design Principles for Distributed Embedded Applications (Springer, 2nd ed.) — distributed real-time control, network-induced delay and time-triggered protocols; Katsuhiko Ogata, Modern Control Engineering (Pearson, 5th ed.) — frequency-domain stability, phase margin and delay margin; Ian Sommerville, Software Engineering (Pearson, 10th ed.) — general software-engineering process context.
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. Standard two-phase signalized intersection (North–South approach vs. East–West approach); pedestrian crossing time $t_{\text{ped}} = 20\ \text{s}$; vehicle stopping time $t_{\text{veh}} = 30\ \text{s}$.
Find. (1) A finite-state model of the controller. (2) A design (state timings) that keeps both pedestrians and vehicles safe through every phase change.
Approach. The controller must never present a green (or walk) indication to one direction while the other direction still has traffic legally entering or clearing the intersection, so between every "one direction green" state and the next there must be a dedicated all-red clearance state whose duration is at least the longest time any road user already committed to the intersection needs to clear it safely.
Part (1) — finite-state model. The controller is modelled as a six-state cycle (Figure 4): NS-Green/EW-Red → NS-Yellow/EW-Red → All-Red clearance → EW-Green/NS-Red → EW-Yellow/NS-Red → All-Red clearance → back to NS-Green. Every transition except the two green-timer expiries is triggered by a hardware timer, not by traffic; this makes the controller a deterministic, periodic real-time task in its own right, with each state's dwell time itself a hard deadline (the state must advance exactly when its timer expires, no sooner and no later).
Part (2) — design for pedestrian and vehicle safety. Three timing rules make the design safe: (i) the yellow (caution) interval before each all-red must be at least as long as it takes a vehicle already at the stop line when the light changes to either stop safely or clear the intersection at the speed limit — a short fixed value (e.g. 3–4 s) calibrated to approach speed, distinct from the clearance interval; (ii) the all-red clearance interval that follows must be the full 30 s computed above, so that a pedestrian who stepped off the curb just before the "don't walk" indication, or a vehicle that entered on yellow, is guaranteed to be clear before the opposing direction receives green; (iii) the WALK indication for pedestrians must not begin until its own direction has green, and must switch to a flashing "don't walk" with at least the 20 s crossing allowance before that direction's yellow begins — i.e. the pedestrian phase is nested strictly inside the vehicle green phase, never overlapping the clearance interval of rule (ii).
| Quantity | Result |
|---|---|
| Governing clearance interval, $t_{\text{clear}}$ | 30 s (governed by vehicle stopping time, not pedestrian walk time) |
| FSM states | 6 (2 green, 2 yellow, 2 all-red clearance) |