21.01.2022 Views

Sommerville-Software-Engineering-10ed

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

628 Chapter 21 ■ Real-time software engineering

Voltage

Normal voltage

level

R1 R2 R3 R4

Critical voltage

level

Power switcher

Battery startup

4ms 8ms 12ms 16ms 20ms 24ms 28ms 32ms 36ms 40ms

Time

Figure 21.15

Power failure timing

analysis

power to a battery backup. Figure 21.15 presents a timeline showing the events in

the system:

1. Assume that, after a mains power failure event, it takes 50 milliseconds (ms)

for the supplied voltage to drop to a level where the equipment may be damaged.

The battery backup must therefore be activated and in operation within

50 ms. Usually, you allow for a margin of error, so you should set a shorter

deadline of 40 ms because of physical variations in the equipment. This

means that all equipment must be running on the battery backup power supply

within 40 ms.

2. However, the battery backup system cannot be instantaneously activated. It

takes 16 ms from starting the backup power supply to the supply being fully

operational. This means that the time available to detect the power failure and

start the battery backup system is 24 ms.

3. There is a process that is scheduled to run 250 times per second, that is, every 4 ms.

This process assumes that there is a power supply problem if a significant drop

in voltage occurs between readings and is sustained for three readings. This time

is allowed so that temporary fluctuations do not cause a switch to the battery

backup system.

4. In the above timeline, the power fails immediately after a reading has been

taken. Therefore, reading R1 is the start reading for the power fail check. The

voltage continues to drop for readings R2–R4, so a power failure is assumed.

This is the worst possible case, where a power failure event occurs immediately

after a sensor check, so 16 ms have elapsed since that event.

5. At this stage, the process that switches to the battery backup is started. Because

the battery backup takes 16 ms to become operational, the worst-case execution

time for this process is 8 ms, so that the 40 ms deadline can be reached.

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

Saved successfully!

Ooh no, something went wrong!