Proc. Progress 2001 Workshop, Veldhoven, Netherlands, F. Karelse (Ed.), pp. 27-30, ISBN: 90-73461-26-X
On compositional programming for field-bus interconnected embedded control systems *) Jan F. Broenink University of Twente, Cornelis J. Drebbel Institute for Mechatroncis and Control Laboratory, Dept. of Electrical Engineering, P.O.Box 217, NL-7500 AE Enschede, The Netherlands e-mail:
[email protected]
Abstract – The goal of this yet-to-start project is to
investigate the use of CSP-channels for distributed embedded systems. Common industrial field busses such as CAN, USB etc, interconnect the constituting subsystems. The applications, we want to use as test vehicle, are essentially hard real time. They are taken from the field of mechatronics (for example, robot control, production machine control, automotive). First, one field bus will be selected, on which the prototype of our CSP channel library will be ported, and an industrial demonstrator will be built. Performance tests will be done, to catch the peculiarities of the field bus in the context of real-time control. Results may necessitate whether adaptation to really real-time behavior of the field bus, as described by might be needed. In the second half of the project, CSP channels are implemented on the other chosen field busses. After performance tests, we expect to be able to indicate which field bus is best appropriate for a certain application. The paper will explain the plan of the project. I. INTRODUCTION In future, industrial and consumer applications using embedded computer do ask more and more flexibility, whereas size, production costs and time-to-market need to go down to keep, or increase, the competitiveness of the products. Especially, when a family of end products is composed of a clever combination of semi-manufactured parts, the compositional properties are essential for an efficient business management. Typically, the constituting parts of such an modular end product have their own intelligence, i.e. processing element, and mostly are interconnected via some strictly defined interface, like a computer bus or a field bus. Such a bus mostly diminishes the amount of cabling, thus causing *) This research is supported by PROGRESS, the embedded system research program of the Dutch organization for Scientific Research, NWO, the Dutch Ministry of Economic Affairs an the Technology Foundation STW.
a more simpler and probably a more competitive product. Clearly, this bus system should be transparent to let the composition of parts be real plug and play. A kind of Connection Abstraction Layer is needed, which should be such that its latency should be negligible comparing to the processing times of the application. Note that distributing the processing elements give possibilities to tune the processing elements to the computational performance needed by its module. In this project, we will provide for an elegant way of letting work together embedded controllers. Especially on scalability and on the communiation architecture of the software, we can provide a novel way of working. Compositional programming techniques using CSP channels will be used as the Communication Abstraction Layer. As physical connections, industrial field busses are used, either wired or wireless. The software in the different processing elements is described as a set of Communicating Sequential Processes. One or more processes reside on one computing element. Channels, enabling a clear interface, specify the interprocess communication. In the next section, background of the approach to be followed is explained. In section three, the work plan of the project is elaborated. In the final section, some ideas on the expected benefits for the embedded product designer are discussed. II. BACKGROUND Before going into detail on the used paradigms, first an overview of a heterogeneous, distributed embedded control system is given. Figure 1 shows a functional view of an embedded control system in general. Processing elements control I/O elements, to which the appliance (the machine to be controlled) is connected. The border between hard real time and soft real time is somewhere in the processing elements part. The interconnections between the software parts are CSP channels, drawn here as lines. Obviously, the
User Interface
Proc. Progress 2001 Workshop, Veldhoven, Netherlands, F. Karelse (Ed.), pp. 27-30, ISBN: 90-73461-26-X
Supervisory C Sequence C Loop C
I/O
Appliance
Embedded Software
Figure 1: General architecture of an embedded control system As indicated in Figure 1, the processing elements are also involved in the hard real time control loops. Such a loop is explicitly shown in figure 2. This implies that the field bus between the I/O and the particular processing element on which the hard real time control loop runs, must show a hard real time performance. It depends on the timing constraints of the control loop and the hard real time performance of the processing element, whether the timing demands can be met.
Software
I/O
Appliance
Figure 2: Hard real time control loop (dotted line). An example communication structure is presented in Figure 3. The processing elements are distributed all over the system. The interconnections are still channels. Obviously, a field-bus realization can be really efficient. The combination of some appliance part with its controlling processing element can be seen as a component in the sense of Component Based (Software) Development. Thus, designing an embedded system by combining channel-interconnected processes is really compositional programming.
Figure 3: Communication structure.
In such a distributed architecture, hard real time loops can touch different processing elements and thus several field-bus interconnections. Since all mentioned elements of a hard real time loop causes latency, the timing constraints as imposed by the appliance might become really severe. A careful consideration of how the timing budget and processing demands are deployed on the distributed system is therefore necessary for an optimal design. We use the CSP (Comunicating Sequnetial Processes) [1] paradigm for heterogeneous, distributed embedded control systems. It creates a natural addition to object orientation. The method calls for the communication in traditional object-oriented software are replaced by CSP channel communications [2]. The channels offer, besides the data transport, also higher-order multithreading constructs, and are capable of dealing with single- and multi-processor environments. Furthermore, the channels take care of the real-time priority scheduling. For this, the notion of priority and scheduling has been carefully examined and consequently it was reasoned that priority scheduling should be attached to the communicating channels rather than to the processes. Thus, the use of channels hides threads and priority indexing from the user, simplifying the use of priorities for the object-oriented paradigm. Moreover, the notion of scheduling is no longer connected to the operating system but has become part of the application instead. Thus, the parallel & distributed software-writing problem will be alleviated. Another advantage of using CSP principles is that it is possible to reason about the correctness of the software, since CSP is a formal method [3, 4]. Experiences gained in this project will update (sharpen) the methods of developing software for heterogeneous distributed embedded control-computer systems. At this topic, the symbiosis with TES.5224 (just being started) [5] is expected to be significantly fruitful. III. WORK PLAN First, we will investigate which industrial field busses are appropriate to use as first demonstrator. Furthermore, our CTJ library [2] will be implemented on the chosen field bus. By setting up a basic, however industrially relevant, mechatronic demonstrator, the feasibility of the field bus with its channel implementation will be investigated. In the second phase, this first implementation will really be tested: Performance tests and reconfiguration tests are planned, to catch the specific properties of the field bus in the context of real-time control. Thereafter, some more
Proc. Progress 2001 Workshop, Veldhoven, Netherlands, F. Karelse (Ed.), pp. 27-30, ISBN: 90-73461-26-X complex industrial demonstrator will be set up, and of course subject to the same tests as the basic demonstrator. As a result of these tests, adaptation to the real-time behavior of the bus protocol might be necessary. For instance, bringing in Time-Triggered features as was done by Kopetz [6] for the CAN bus. Furthermore, the design methodology of embedded software components will be specialized towards components that are connected via CSP channels implemented on field busses. In the third phase, the other selected field busses are taken care of. After porting our channel library to those field busses, the demonstrators of the previous phase are now tested while equipped with the other field busses. Of course, this work can influence the design methodology and maybe influences also our channel library implementation. In the end, we expect to be able to indicate which field bus is best appropriate for a certain control application. IV. CONCLUDING REMARKS We expect the following benefits for the industrial end user when the use of CSP-channels on embedded control systems interconnected by industrial field busses, appear to be a proper means for compositional programming: • Embedded systems can really be built component wise the embedded software belonging to the hardware parts can as easy be coupled together as the hardware parts can. • The CSP library serves as an efficient Communication Abstraction Layer, which also takes care of synchronization and scheduling. This actually encapsulates thread programming, thus freeing the industrial embedded system integrator from programming threads, while the resulting software is really multithreaded, as is needed for proper embedded system software. Note that at the date of the 2nd Progress workshop, the project as funded by Progress, is not yet started.
V. REFERENCES
[1] C. A. R. Hoare, Communicating Sequential Processes: Prentice Hall, 1985. [2] G. H. Hilderink, A. W. P. Bakkers, and J. F. Broenink, "A distributed Real-Time Java system
[3] [4] [5]
[6]
based on CSP," presented at Proc. Third IEEE Int. Symp. On Object Oriented Real-Time Distributed Computing ISORC'2000, Newport Beach, CA, USA, 2000. A. W. Roscoe, The Theory and Practice of Concurrency: Prentice Hall, 1997. S. Schneider, Concurrent and Real-Time Systems: The CSP approach: Wiley, 2000. D. S. Jovanovic, G. H. Hilderink, and J. F. Broenink, "Integrated Design Tool for Embedded Control Systems," presented at Progress 2001 Workshop, Veldhoven Netherlands, 2001. H. Kopetz, Real-Time Systems: design principles for distributed embedded systems: Kluwer Academic Publishers, 1997.