Schedulability issues in complex embedded control systems A. Crespo, P. Albertos, P. Balbastre, M. Vall´ es, M. Lluesma and J. Sim´ o Instituto de Autom´ atica e Inform´ atica Industrial Universidad Polit´ ecnica de Valencia Abstract— The design of embedded control systems should be addressed in both the controller definition and its imple- mentation. While the design of the controller is based on control theory, the implementation is designed by assuming the principle that control loops can be modeled and implemented as periodic activities. Periodic activities that can be organise attending to different implementation criteria. Recently, the authors have introduced the concept of control kernel dealing with the essential control activities to guarantee the safe behaviour of the complete system. For this purpose, we propose a control arrangement in different layers. At the level of the OS, activities to closing the loop and driving the system to a safe position should be included. At the top level, the control system may include several on-line controller options as well as supervising and optimising activities. This part should be independent of both the particular implementation and the resources availability. In this paper we propose an implementation and a scheduling scheme to implement complex control applications. I. I NTRODUCTION Nowadays embedded systems are used in a wide range of industrial sectors requiring appropriate design tools. The main advantages of embedded systems are their reduced price and size, broadening the scope of possible applica- tions, but the main problem for their use is the limited computational capabilities they can offer. So, one of the most important issues is related with the optimal use of their computational resources. From the control point of view, when control algorithms are implemented on these systems, the sharing of resources among different tasks becomes a crucial issue. Other than the inherent RT characteristic of these tasks, the appearance of delays or the cutting of the computational time to reach a better control action may degrade the control performances. The design of embedded control systems should be ad- dressed in both the controller definition and its implementa- tion. While the design of the controller is based on control theory, the implementation is designed by assuming the principle that control loops can be modeled and implemented as periodic activities. The periodic task model has been deeply studied and analysed. This model, by considering either static or dynamic priorities, always introduces some delays during the task execution that can affect the control performance. The relationship between task parameters and control per- formance is not straightforward. Scheduling and networking related parameters such as task periods, deadlines, priorities, protocols, etc., influence the controller task parameters (la- tencies, jitter, etc) in a complex way. Similarly the controller task parameters influence the control performance parameters (e.g., rise time, overshoot, signal variances, etc) in an equally complex way. Recently, some works have been reported ([1], [2], [3], [4], [5], [6], [7]) to define the task parameters taking into account the performance degrading based on the tasks periods. In most computer control applications the control code is written altogether, assuming time and computation re- sources availability at any moment. In embedded systems, changing operating conditions may require changes in the main control parameters, including the sampling periods, the measurements availability or the computation time. Thus, the control task should be split into parts, with some alternatives, requiring different priorities and thus should be scheduled based on the resources availability. Safety is a crucial issue in embedded control systems. The controller must react on the controlled process ensuring the delivering of a control action. Recently, the authors have introduced the concept of control kernel [8], dealing with the essential control activities to guarantee the safe behaviour of the complete system. For this purpose, the control software can be arranged in different layers. At the level of the OS, activities to closing the loop and driving the system to a safe position should be included. At the top level, the control system may include several on-line controller options as well as supervising and optimising activities. This part should be independent of both the particular implementation and the resources availability. An intermediate level, implemented as a middleware, will take care of the interconnection and data exchange between the two others. In order to implement these complex control structures, the scheduling scheme has to provide support to guarantee the timing constraints of the lower levels and offer flexibility for the upper level. In this direction, some work has been published related with the scheduling of optional tasks (upper level) [9]. The control action delivered by the control algo- rithm can be obtained in a first step by a hard real-time task, and if there is enough time, it is refined using the remaining time of the system (by a soft task). That is, these controllers have an initial solution that can be improved iteratively as far as additional computational time is assigned. This means that a solution is available anytime. Systems combining both soft and hard tasks can be im- plemented using optional (imprecise) tasks. A flexible task has been defined in [10] and [11]. Such a task has two parts, the mandatory part that has to be guaranteed and an optional