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.
Part (1) — state-transition diagram. Figure 5 models the controller as six states: Idle/Load → Ready (lid closed, start pressed) → Fill (inlet valve open) → Wash (agitate) → Drain → Spin → back to Idle, plus a safety exception edge from Spin directly to Drain.
Part (2) — transition conditions. Each normal edge fires on a distinct sensed condition:
| Transition | Condition |
|---|---|
| Idle → Ready | Lid closed AND start button pressed |
| Ready → Fill | (immediate, sequence entry) |
| Fill → Wash | Water-level sensor reaches set point → inlet valve commanded closed |
| Wash → Drain | Wash-cycle timer expires |
| Drain → Spin | Water-level sensor reads empty |
| Spin → Idle | Spin timer expires (cycle complete) |
| Spin → Drain (exception) | Lid-open sensor trips while the drum is spinning |
Part (3) — sensors needed. An embedded real-time controller for this machine needs: a lid-closed/open switch (safety interlock); a water-level sensor (pressure or float switch, to detect both "full" and "empty"); a door/lid lock-solenoid feedback sensor (confirms the lid is mechanically locked before spin, not just closed); a motor tachometer or Hall-effect speed sensor (confirms actual drum speed, needed to know when it is safe to unlock the lid); a temperature sensor if the model heats water; and a real-time clock/timer source driving each state's dwell time (wash duration, spin duration).
Part (4) — chosen condition: lid opened while spinning. This is the safety-critical exception in Figure 5. The controller's response, in strict order and within a bounded worst-case time: