21.01.2022 Views

Sommerville-Software-Engineering-10ed

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

21.3 ■ Timing analysis 629

Figure 21.16

Timing requirements

for the burglar

alarm system

Stimulus/Response

Audible alarm

Communications

Door alarm

Lights switch

Movement detector

Power failure

Voice synthesizer

Window alarm

Timing requirements

The audible alarm should be switched on within half a

second of an alarm being raised by a sensor.

The call to the police should be started within

2 seconds of an alarm being raised by a sensor.

Each door alarm should be polled twice per second.

The lights should be switched on within half a second

of an alarm being raised by a sensor.

Each movement detector should be polled twice per

second.

The switch to backup power must be completed within

a deadline of 50 ms.

A synthesized message should be available within

2 seconds of an alarm being raised by a sensor.

Each window alarm should be polled twice per second.

The starting point for timing analysis in a real-time system is the timing requirements,

which should set out the deadlines for each required response in the system.

Figure 21.16 shows possible timing requirements for the office building burglar

alarm system discussed in Section 21.2.1. To simplify this example, let us ignore

stimuli generated by system testing procedures and external signals to reset the system

in the event of a false alarm. This means there are only two types of stimulus

processed by the system:

1. Power failure is detected by observing a voltage drop of more than 20%. The

required response is to switch the circuit to backup power by signaling an electronic

power-switching device that switches the mains power to battery backup.

2. Intruder alarm is a stimulus generated by one of the system sensors. The

response to this stimulus is to compute the room number of the active sensor, set

up a call to the police, initiate the voice synthesizer to manage the call, and

switch on the audible intruder alarm and building lights in the area.

As shown in Figure 21.16, you should list the timing constraints for each class of

sensor separately, even when (as in this case) they are the same. By considering

them separately, you leave scope for future change and make it easier to compute the

number of times the controlling process has to be executed each second.

Allocating the system functions to concurrent processes is the next design stage.

Four types of sensors must be polled periodically, each with an associated process:

the voltage sensor, door sensors, window sensors, and movement detectors.

Normally, the processes associated with the sensor will execute very quickly as all

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!