Automatic code generation for Intelligent Instrumentation M.IMHEMED, B.CONRARD, M.BAYART LAGIS-UMR CNRS Université des Sciences et Technologies de Lille Bât Polytechnique cite Scientifique 59655 Villeneuve d'Ascq Cédex - France Phone: +0320436535, Fax: +0320337189, E-mail: mireille.bayart@univ-lille1.fr Abstract: The aim of this paper is a method for automatic code generation built on external model of smart instrumentation written with an XML code. The proposed tool allows the end-user to develop easily and in safety manner, its application. In the proposal approach, the design of an application is realizing thanks to two steps. The first one consists in modelling the functions of the system according to the external model, by using a XML code. From this model, the second step consists in automatically generation of code in C language. I. Introduction The design of automation system requires more and more flexibility in order to reduce the development time and integers more and more safety constraints. Design tools are an answer to this problem by facilitating the re-use of part already developed and validated, and by automatically generating source code of application from description in descriptive language. Various works [1], [7] have been done to propose tool in the field of smart intelligent. LARII was a tool for design intelligent actuator and sensor from graphic description in bloc functions. It allowed the generation of code for using in microcontrollers. CAPTools [3] generates code in dedicated language from a generic description of intelligent instrument in XML obtained from a graphical modelling. In the paper, we propose a generic approach for modelling an intelligent instrument or an intelligent system. It uses the concept of "Service" as the base element. The method associated to this model proposes a way to formalise a system. It allows generating, automatically, code for system. From a hierarchical decomposition based on external model of the application, a XML file is created and is used to generate the source code file [6]. Firstly, in this formalism, the proposed work aims to establish a generic language that allows the design of system by modelling its functional architecture by means of its services. A second part deals with the automatically code generation. From a model build with the previous language, a tool is proposed to generate the corresponding code in order to be implemented on a real programmable instrument. The example of a mixing/heating tank is given to illustrate the method. II. The external model The external model is defined in an external point of view to the intelligent instrument. It is based on the concept of services. A service is defined as the result of the execution of a treatment (or a whole of treatments), to which one can associate an interpretation in functional terms. The description of a service consists in describing the functional result produced by its execution. Thus, from the user point of view, the realization of a service corresponds to the update of the produced variables, which it performed by a treatment according to a set of consumed variables. A service is thus an entity that produces and/or consumes variables as on figure 1. The execution of a service is started by checking an activation condition, and requires the availability of a certain number of resources. They can be of informative type (variables consumed by the service) or material (treatment unit, pre-actuator, etc). If the whole of the resources used by the service is available, the service can be performed in a nominal way [2], [4]. TRAITEMENTS Variables consumed Variables produced condition of activation resources material TRAITEMENTS Variables consumed Variables produced condition of activation resources material Figure 1: Representation of service The notion of service can be applied as well as to an intelligent instrument, considered as an isolated entity, as well as to a global system. By hierarchical description, it is possible to define services at various levels according to the designer needs. At the lowest level, appear the services associated to the sensors and to the actuators, then services of regulation are obtained by association of services of low level. At the highest level, the main service corresponds to the mission of the system. This interest of this modelization is to allow offering possibilities of extension as well as in software or hardware. It is well known that application evolves during its life cycle, it is sometimes necessary to add software functions, or to implement a new instrument (sensor or actuator). In the proposed organisation rests on services, it is easy to add a new service obtained by combination of services of low level without new