NivaarExam PrepOfficial exam papers ↗

25-Comp-A6 Software Engineering · December 2014

Question 4 of 10: Embedded Software

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

Notes on this paper

National Exams — December 2014 — 98-Comp-A6 Software Engineering. Three-hour, closed-book exam, no calculator permitted. Format: ten questions, candidates answer any six (all questions equal weight — each question carries 20 marks, so the paper is marked out of 120; only the first six questions as they appear in the answer book are marked). All ten questions are solved below for completeness.

Reference texts: Sommerville, Software Engineering (10th ed., Pearson) — software process models, object-oriented and function-oriented design, real-time systems, software testing, configuration management, dependable/critical systems, reliability engineering, component-based software engineering; Pressman, Software Engineering: A Practitioner's Approach (9th ed.) — supplementary process/testing/quality coverage; IEEE/ISO 12207 — software life-cycle processes; SWEBOK — body-of-knowledge cross-reference.

Question 4: Embedded Software (a) 5, (b) 5, (c) 10 — 20 marks

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.

(a) Real-Time Software Systems, and Soft vs. Hard

A real-time software system is one whose correctness depends not only on the logical result it produces but also on the time at which that result is produced. It must sense and respond to stimuli arising from its physical environment — usually as an embedded component controlling or monitoring hardware — within deadlines that are dictated by that environment rather than chosen by the software designer; a logically correct output delivered after its deadline is, for a real-time system, a failure of the same kind as a logically incorrect output.

In a hard real-time system, missing a deadline constitutes a system failure with unacceptable or catastrophic consequences — the deadline is absolute, and the correctness of the whole system depends on every relevant deadline being met (a flight-control surface command, an engine-ignition timing pulse, an insulin-pump dosing cycle). In a soft real-time system, an occasional missed deadline degrades the quality or usefulness of the result but does not constitute outright failure and does not endanger the system — a late video frame causes a visible glitch, a late audio sample causes an audible click — and the system's acceptability is judged statistically (the proportion of deadlines that may be missed) rather than by an absolute guarantee on every single one.

(b) Stimuli and Responses for a Home Refrigerator Controller

A refrigerator controller is a small, continuously-running reactive system: it never terminates, and every one of its outputs is triggered either by an environmental stimulus or by the passage of time.

StimulusExpected response
Interior temperature sensor reading rises above the set-point (compartment too warm)Turn compressor ON
Interior temperature sensor reading falls to the set-point (compartment cold enough)Turn compressor OFF
Door switch opensTurn interior light ON; if held open beyond a timeout, sound the door-ajar alarm
Door switch closesTurn interior light OFF; cancel any pending door-ajar alarm
Defrost timer elapses (periodic, e.g. every 8 hours of compressor run-time)Suspend cooling, energize the defrost heater for a fixed duration, then resume normal control
Owner adjusts the temperature set-point dialUpdate the stored set-point used by the compressor control loop
Ice-maker water-level/bin-full sensor reports bin not full and tray emptyOpen the fill valve to make a fresh batch of ice
Power failure detected, then power restoredOn restoration, resume the compressor duty cycle from a safe (compressor-off, brief delay) state rather than restarting instantaneously, to protect the compressor motor
Interior temperature sensor reading exceeds a food-safety high limit for longer than a set durationSound a distinct high-temperature warning alarm (safety condition, not routine cycling)
Check
The compressor-restart delay after a power interruption is included because starting a compressor motor against residual system pressure immediately after a power blip can damage it — this is a standard real-world refrigeration control requirement, added here as a reasonable engineering assumption beyond the bare stimulus/response pairs the question names explicitly.

(c) State Machine Model of the Voice Mail System

Idle(on-hook)RingingPlayGreetingListen forDial-In TonesRecordingMessageRemotePlaybackincoming call detectedauto-answer after N ringsgreeting message completeno tones / invalid codevalid owner access codecaller hangs up / max length— count++, update LEDowner hangs up —playback completeFig. Q4(c) — state machine for the voice mail system
Fig. Q4(c) — state machine for the voice mail system; the LED message count is updated only on the transition out of Recording Message.

The machine begins on-hook in Idle. An incoming call moves it to Ringing, and after the configured number of rings it auto-answers into Play Greeting. Once the greeting completes, the machine moves to Listen for Dial-In Tones — this single state serves both the ordinary caller (who says nothing and simply waits) and the phone's owner dialling in remotely (who enters a numeric access code as DTMF tones). If a valid owner code is detected before the listening window expires, the machine transitions to Remote Playback and plays back the stored messages over the phone line; when the owner hangs up or playback finishes, the machine returns directly to Idle with no message count change, since remote access is not itself an incoming message. If no tones arrive, or an invalid code is entered, the machine instead transitions to Recording Message and records the caller's message; when the caller hangs up or the maximum recording length is reached, the machine increments the accepted-message counter, updates the LED display with the new total, and returns to Idle.

Check
This design assumes the remote-access tone sequence is checked once, immediately after the greeting, rather than continuously monitored throughout an in-progress recording — a reasonable simplification for a device of this era, since DTMF tones spoken/played mid-message could otherwise be misread as an access attempt. The LED display is assumed to show the count only (not individual message status), consistent with "display the number of recorded messages" in the question.