Petri nets based approach to software development for real-time control P. Cofrancesco A. C r istoforetti R. Scattolini Indexing terms: Software development, Petri nets, Real-time control Abstract: An approach to software development for real-time control is presented. The Petri nets formalism is used in the specification phase to describe the concurrency and synchronisation aspects of the software environment. Then the resulting Petri net model is implemented by means of a data driven architecture and can be based on any standard high-level language. The software development procedure described has been followed by a number of users for the rapid production, debugging, testing and prototyping of software modules. 1 Introduction In spite of its fundamental role in the transfer of advanced control techniques from theory to applications, as well as its increasing economical relevance, software production for digital control and simulation is often still more an art or a craft than an industrial-type activity. It is therefore necessary to support software development with effective tools which ease the building and testing of high quality control software [l]. In the systematic design of control software, two fun- damental phases have to be dealt with, namely its formal specification and subsequent rapid prototyping. The specification phase is required to (i) provide a clear and concise description of the dynamic and logic structure of the control system being considered (ii) associate the main functions supplied by the control software to well defined and autonomous pro- cesses (iii) describe all the aspects concerning concurrency, synchronisation and transmission of data among the tasks composing the control software (iv) validate the overall system requirements to check for the presence of possible incongruities in the design. Several languages supporting the specification phase have been described in the literature, e.g. SADT [2], PLS/PSA [3], PAISLey [4]. However, most of them are general purpose tools which do not cope with the specific fea- Paper 8159D (C7), first received 15th June 1990 and in revised form 28th March 1991 P. Cofrancesco is with the Dipartimento di Fisica ‘A. Volta’, Via Bassi 6, 27100 Pavia, Italy A. Cristoforetti is with CEFRIEL, Via Emanueli 15, 20126 Milano, Italy R. Scattolini is with the Dipartimento di Elettronica, Politecnico di Milano, Piazza Leonard0 da Vinci 32, 20133 Milano, Italy 474 tures of control software or are not suitable to automatic realisation in a standard programming language. The aim of this work is to present an approach to the design of software for real-time control which eases the passage from the specification phase to realisation. The specification phase relies on the rigorous, and easy to learn, formalism of Petri nets (PN). Petri nets are a useful tool for describing distributed systems with their related concurrency and synchronisation aspects; as such they appear an efficient way to meet the requirements of (ixiii). As for item (iv), once the PN model of the soft- ware structure to be implemented has been derived, a number of well established techniques are available to analyse its properties [SI. It is then easy to verify the correctness of the structure at hand, as well as its reach- ability or the presence of dead locks and traps. With specific reference to control problems, PN have already been used by a number of authors [6-81. In Ref- erence 6 an extension of PN, called PROT nets, has been developed with the aim of facilitating the modelling task. Reference 6 then shows how PROT nets can be trans- lated into Ada* program structures to speed up pro- totyping of systems for simulation purposes. In Reference 7 a general approach to event-related process control with PN is presented, with particular emphasis on the modelling aspects. Reference 8 deals with the application of PN to the analysis and computer-aided design of logical sequence controllers. More generally, a procedure language called XL/1 for the processing and simulation of PN has been presented in Reference 9. In this paper the PN formalism is first used to give a description of the control structure to be realised. Then, the translation of the PN model into executable pro- grams is dealt with. The suggested practical implementa- tion can be based on any standard high-level language and relies on a data driven architecture. In particular, synchronisation is achieved by suitably managing the exchange of data among tasks. The proposed approach allows the user to easily generate a shell to be subse- quently equipped with the appropriate algorithms. The presence of some ‘system tasks’, namely those managing the monitor, the graphical data display and the command interpreter, can also be considered to ease soft- ware development. In this paper attention focuses on the PN implementation aspects, and no emphasis is given to the validation phase. Hence, the correctness of the PN model to be realised is here assumed to be verified a priori by the user. The paper is organised as follows. Section 2 is devoted to showing how PN can be applied to the process of * Ada is a registered trademark of the US Dept of Defense. IEE PROCEEDINGS-D, Vol. 138, NO. 5, SEPTEMBER 1991