Middleware for Control Kernel Implementation in Embedded Control Systems A. Fernández*, M. Vallés**, A. Crespo**, P. Albertos **, J. Simó ** *Departamento de Automática y Computación, Instituto Superior Politécnico José Antonio Echevarría, La Habana, Cuba (e-mail: adel@electrica.cujae.edu.cu) ** Instituto Automática e Informática Industrial Universidad Politécnica de Valencia, Valencia, Spain. P.O.Box 22012 E-46071 (e-mail: mvalles, pedro@isa.upv.es ; alfons,jsimo@disca.upv.es) Abstract: Control tasks require a number of activities, not all of them with the same relevance and priority. The critical subtasks constitute what is denoted as the control kernel. The design of ECS should be structured, with a kernel unit providing the most basic features. Most of these activities, such as data acquisition or control action delivering, are common to a number of control loops implemented in the same CPU. In this paper, the architecture of a middleware (MW) for essential control activities to ensure economic, safe and reliable operation is discussed. It is specially designed for control purposes, interacting with the peripherals (sensors, actuators and communication channels), with the OS, and exchanging information with the bunch of control algorithm implemented in the application area. As part of the facilities of the middleware, some issues for improving in a transparent manner these characteristics are considered. Finally, an example of controller implementation by using this middleware is presented. 1. INTRODUCTION Embedded Control Systems operate under highly changeable and uncertain environments with strong resource constraints. Control tasks require a number of activities, not all of them with the same relevance and priority. They are RT tasks of reactive nature, delivering control actions at prescheduled time instants. The critical subtasks constitute what is denoted as the control kernel. Most of these activities, such as data acquisition (ADQ) or control action delivering (CAD), are common to a number of control loops implemented in the same CPU. Moreover, classical CPU operation implies a sequential behaviour. Thus, in order to save resources and to be as fast as possible, some basic actions should be implemented at a very low level (close to the OS), with high priority. Control kernel activities have been discussed in previous papers (Albertos et al., 2007), and different options for its implementation have been also presented (Albertos et al., 2006). One of them is to establish a middleware specially designed for control purposes and interacting with the peripherals (sensors, actuators and communication channels), with the OS, and exchanging information with the bunch of the control algorithm implemented in the application area. The paper is structured as follows: first, the main features of the ECS as well as the facilities linked to the control kernel are reviewed. Then, the priorities of the control subtasks and their interaction are discussed. Their implementation in a middleware area is then presented. Some alternatives to guarantee the safe operation of the control are proposed. In particular, special attention is paid to the local control structure, to guarantee the control action delivering in the event of resources shortage: computation time, data availability or emergency operation. Finally, these concepts are applied to the control of a robot with a flexible joint. 2. EMBEDDED CONTROL SYSTEMS The strong increasing presence of embedded systems (ES) in products and services creates huge opportunities for the future in different areas such as industrial control systems, avionics, health care, environment, security, mechanics, … (Chinook, 2004). Thus, there is a growing scientific interest on conceptual and practical tools for their development (Dreamteach, 2002). In particular, their use in control applications is becoming very popular. RT control applications on ES require the best use of the available computation resources. Among the main advantages they offer are the reduced price and size, broadening the scope of possible applications: mass- production systems due to the cost reduction and specific accurate applications for their reduced size and high performances. But the most important problem is the limited computational capabilities they can use because it is well known that, in general, short sampling periods and non- delayed control actions allow for better control performances. So, one of the most important issues related with ES in control applications are related with the reliable and optimal use of their computational resources and what the resource shortage involves in the design and implementation of the Proceedings of the 17th World Congress The International Federation of Automatic Control Seoul, Korea, July 6-11, 2008 978-1-1234-7890-2/08/$20.00 © 2008 IFAC 8475 10.3182/20080706-5-KR-1001.2512