Personal Alarm Device: A Case Study in Component-Based Design of Embedded Real-Time Software Jimmie Wiklander * , Andrey Kruglyak * , Johan Nordlander * and Per Lindgren * * EISLAB, Lule˚ a University of Technology, 971 87 Lule˚ a Email: jimmie.wiklander@me.com, kruglyak@mac.com, johan.nordlander@ltu.se, and per.lindgren@ltu.se Abstract—Designing software for embedded systems is com- plicated by such factors as the tight integration between soft- ware and hardware, scarceness of available resources, and hard real-time requirements. In our earlier work we proposed a component-based approach based on modeling both hard- ware and software using concurrent reactive objects and time- constrained reactions, which should allow us to overcome these difficulties. We also presented a software design methodology for embedded real-time systems. Here we describe a system developed using this methodology and discuss its advantages. The system is a personal alarm device that should be worn at the waist of a person and that should detect his or her fall and send an alarm signal. The implementation of the system was verified using a Simulink- based simulator. The simulation demonstrated that, even though calculation of acceleration was simplified to allow for an efficient execution on a resource-constrained platform, fall detection remained satisfactory. The case study demonstrates the advantages of the proposed software design methodology, including the fact that functional and timing properties of a system model can be preserved during implementation process by means of a seamless transition between a model and an implementation. I. I NTRODUCTION Embedded systems possess certain qualities that turn em- bedded software design into a delicate task. First of all, embed- ded systems typically have limited resources at their disposal (CPU, memory, power, etc.) that have to be utilized efficiently in order to meet system requirements. As a consequence, embedded systems often exhibit a tight integration between software and hardware. This makes it virtually impossible to model and efficiently implement software separately from hardware. Most embedded systems can also be classified as real-time systems. The traditionally used techniques do not have an inherent support to express and model temporal behavior, which makes designing software for such systems a challenging task. Moreover, the ongoing advances in the microprocessor technology leave room for more elaborate software implementations, adding complexity to the design, which requires more mature design methods than those in use today. In [1] we proposed a component-based approach to cope with these difficulties. We presented a modeling framework based on the notions of reactive objects and time- constrained reactions, which facilitates component-based de- sign of embedded real-time systems. Within this framework, functionality of both software and hardware components is defined in terms of reactions to discrete events, and timing requirements are specified for each reaction relative to the event that triggered it. We also presented a detailed software design methodology for embedded real-time systems based on our modeling framework. In this work we describe design of a real-life system developed using this methodology and discuss its advantages. The system in question is a personal alarm device (PAD) and its underlying fall detection concept is based on using an acceleration sensor. In our earlier work [1], this system was used as an example to demonstrate some stages of the design process. Here we present the system design process in full, including the choice of the the fall detection algorithm, system implementation and verification, omitted in [1]. A special focus is given to specification and implementation of timing requirements. An overview of the software design methodology is given in Section II. It is followed by a description of the PAD, including the prescribed fall detection algorithm (Section III). The design of the PAD is discussed in Section IV, with the timing requirements discussed separately in Section V. Section VI deals with the implementation of the PAD in the Timber programming language, while Section VII describes verification of the design and implementation in a Simulink- based simulator. A discussion of related work follows in Section VIII, and Section IX concludes the presentation by discussing the advantages of the methodology as demonstrated by the presented case study. II. METHODOLOGY OVERVIEW Our software design methodology relies on a unified, con- sistent modeling of both hardware and software. The modeling framework is based on the notions of concurrent reactive objects [2] and time-constrained reactions [3]. A more detailed presentation of the methodology and the modeling framework can be found in [1]. A. Modeling Framework The modeling framework supports describing the function- ality of both hardware and software. Interaction between the system and its environment, as well as between components of the system is modeled as discrete events occurring at specific times. Following the reactive approach, the functionality is