APPLICATION OF CONCURRENT PROGRAMMING TO SPECIFICATION OF INDUSTRIAL SYSTEMS J.M. van de Mortel-Fronczak and J.E. Rooda Eindhoven University of Technology, Department of Mechanical Engineering, P.O. Box 513, 5600 MB Eindhoven, The Netherlands, E-mail: fvdmortel,
[email protected]
Abstract. Because of the growing complexity, the design of and reasoning about
modern industrial systems become increasingly dicult. To understand and estimate the dynamic system behaviour, appropriate models should be used. Since industrial systems exhibit concurrency, computer science formalisms developed to reason about concurrent systems are also suited for developing models in this speci c application area. Models can be expressed, for instance, in terms of Petri nets or in terms of concurrent programs. This paper presents a simple modular approach to the speci cation of (discrete) industrial systems based on concurrent programming. As an illustration, a job-shop model is considered.
Keywords. Industrial production systems; modelling; concurrent systems; real time. 1. INTRODUCTION Modern industrial systems become increasingly complex. Because of this complexity, such systems are dicult to design and it is also dicult to estimate their temporal behaviour. One way to tackle the design and analysis problem is to construct a model that can be validated by means of computer simulation. In the sequel, the attention is restricted to discrete industrial systems such as ow-shop, jobshop, and exible manufacturing systems. Industrial systems are typical examples of concurrent systems that already for a long time belong to important subjects of research in computer science. Many formalisms for modelling and analysis of concurrent systems have been developed and, more recently, some of them found many applications in the area of manufacturing systems. Among those formalisms, Petri nets are probably most often used (numerous applications are surveyed in (Silva and Valette, 1990)). Petri net models usually depend
on the product recipe: for dierent recipes dierent models must be constructed (see for instance (Van Brussel et al, 1993) and (Reddy et al, 1993)). The speci cation language ExSpect of (Van Hee et al, 1989) built upon the Petri net theory and developed for distributed information systems, oers more exibility in this respect. An application of ExSpect in the area of manufacturing systems can be found in (Verkoulen and De Brouwer, 1990). The purpose of this paper is to illustrate the use of an alternative formalism: real-time concurrent programming. Concurrent programming can be used for speci cation, simulation, and control of discreteevent systems. It is based on a view of a system as a collection of active, interacting with each other, components. The paper concentrates on the speci cation (modelling) phase. According to the approach described, every component of the system is modelled by a sequential process. Interaction among components is modelled by send and receive actions along xed communication channels. An introduc-
tion to concurrent programming principles can be found in (Burns and Davies, 1993). In modelling, this view of discrete-event systems is an important and convenient abstraction. It can be seen as a rst step towards a standard simulation environment as discussed in (Tanir and Sevinc, 1994). Models resulting from this approach abstract from the underlying simulation algorithm and are therefore easier to grasp than models explicitly using techniques known as activity scanning, event scheduling, and process interaction. Although it is not discussed in this paper, de ning complex data structures and operations on them is also possible. Using a formal framework, such as Petri nets or real-time concurrent programming, as a basis for modelling allows also for calculational derivation of certain static properties of models (for example, the presence of deadlocks). The paper shows how a real-time concurrent programming language can be used for speci cation of discrete industrial systems. At Eindhoven University of Technology, Department of Mechanical Engineering, a limited version of the set of basic concepts of this language, implemented in Smalltalk80, was for the last ve years successfully applied to a number of complex problems in the area of manufacturing systems. A couple of representative examples are: the design of a tire manufacturing factory (Arentsen, 1989) and the design of a control for an IC manufacturing system (Smit, 1992). The design and analysis of models were supported by a software tool of (Wortmann, 1991). A comparable approach based on a dierent language is presented in (Koster, 1993): the time aspects are treated in a similar way and it is also essentially based on CSP of (Hoare, 1985) except for the fact that a system is viewed as a collection of sequential components that operate concurrently (there is no parallel composition among the program statements in the approach presented). Other examples of related speci cation languages (accompanied by supporting software tools such as editors and simulators) are Lotos (ISO 8807, 1989) and PSF (Mauw and Veltink, 1990) where, however, no explicit notion of time is incorporated. The paper is organized as follows. In Section 2, the speci cation language is introduced along with a few illustrative examples. A model of a simple job-shop manufacturing system is presented in Section 3. Section 4 contains a few conclusions. 2. SPECIFICATION LANGUAGE A system is modelled by a nite set of processes and a nite set of channels used for communication
Table 1. The syntax of the language TC ::= r j c!e j c?x j c G ::= [GB ] j [GC ] GB ::= b ?! S j GB be GB GC ::= b ; TC ?! S j GC be GC S ::= j x := e j TC j S ; S j G j skip
G j nG
or synchronization among the processes. Processes model components of the system and channels model the connections among them. In the sequel, such sets of processes are called systems for short. A process is speci ed by a program in a CSPlike programming language preceded by declarations of local variables. For communication, synchronous message-passing is used. If c is a channel between two processes, by executing for instance c!e in one process and c?x in the other, a distributed assignment of the value of e to variable x is realized. Processes do not share variables | they interact exclusively by using the communication and synchronization primitives. Every process is sequential. Processes in a system can execute concurrently between synchronization points. The language used to denote programs (that specify the behaviour of components) is adopted from (Hooman, 1991) and is similar to Occam (INMOS, 1988) | a CSP-like programming language. As opposed to (Hooman, 1991), multiple timeouts (an example of this is shown in Section 3) and besides inputs also outputs are allowed in guarded commands. Moreover, a special variable () is introduced to represent the current time (of a process), which may be used in expressions. The language consists of: assignment, selection (nondeterministic choice), repetition, sequential composition, communication and synchronization primitives, time passing and selective waiting. Its syntax is given by Table 1. In the de nition, n stands for a natural number (n 0), r for a real expression, c for a channel name, b for a boolean expression, x for a variable name, and e for an expression (of the same type as x). Expressions r, b, and e may explicitly refer to . Sequences of capitals denote nonterminal symbols of the grammar. The expressions b and b ; ( belongs to the category TC) appearing before the arrows are called guards. A guard is open if it evaluates to true or, in the case of guards with interactions, if its boolean part evaluates to true. The statements (S) have the following informal meaning. skip terminates without in uencing the program state. x := e denotes the assignment of the value of e to the variable x. r denotes time passing: the value of is in-
otherwise, the statement terminates without in uencing the program state. Communication statements c!e and c?x are used to send the value of e along channel c and assign it to x. The communication takes place as soon as both communication partners are ready for it (the value of variable in both processes is set to the maximum of the corresponding -values before the communication). Execution of the synchronization statement c by two processes is similar to the communication except that no value is passed. S1 ; S2 denotes sequential composition of two statements: S1 is executed rst and if it terminates S2 is executed next. Guarded command [GB] denotes nondeterministic choice. It terminates if there are no open guards. Otherwise, a statement associated with an open guard is nondeterministically chosen for execution. Guarded command [GC] denotes selective waiting. It terminates immediately if there are no open guards. Otherwise, the execution proceeds as soon as an interaction (communication or synchronization) associated with an open guard is possible. After the execution of the (possibly nondeterministically chosen) interaction (the value of variable in both processes changes accordingly), the corresponding statement is performed. If [GC] contains time-outs (r) in open guards and no interaction is possible within the period determined by the smallest value of all time-outs, then the value of is increased by this smallest time-out value and a statement associated with a time-out that evaluates to this value is chosen for execution. Otherwise, only the interactions that are possible within the smallest time-out are considered as above. If the smallest time-out value is negative the execution of the statement associated with it starts immediately | the value of does not change, G denotes repetition: it terminates if none of the guards is open. nG denotes iteration: guarded command G is executed n times (n 0). The repetition [true ?! S] may be abbreviated to [S]. Commands guarded by interactions or timeouts of the form true ; ?! S may be abbreviated to ?! S. Commands guarded by interactions or time-outs of the form b ; ?! skip may be abbreviated to b ; . If b is syntactically equal to true this
can be replaced by . Informally, the speci cation of a process has the following general form: proc name (parameter list) = j[ declarations j S ]j. All channels have to be listed as process parameters. If a channel is used for passing values of some type, this type must be associated with the channel and is in the sequel referred to as the channel type. Informally, the speci cation of a system has the following general form: syst name (parameter list) = j[ channel declarations j P1 k P2 k : : : k P ]j, where n 1 and P , for 1 i n, is an instance of a process or of a (sub)system. For a system holds that channels used in only one process instance have to be listed as system parameters. The types of all channels used in two process instances have to be declared. Except for channel parameters, processes and systems can have value parameters as shown in the examples. The speci cation language is illustrated by a couple of small examples. In the sequel, the following notations are used: [1; 2; 3] denotes the list of three numbers: 1, 2, and 3; [ ] denotes the empty list, b ++ [a] denotes the list constructed by appending element a to list b, hd b denotes the rst element of list b, tl b denotes the list that results from removing the rst element of list b. n
i
Example 1
The rst example describes a model of a simple system that consists of two components: the producer (P) and the consumer (C). The producer produces, for instance, boxes which are subsequently used by the consumer. The production time of each box (in seconds) is drawn from a continuous uniform distribution over the interval between 5 and 10. When a box has been produced it is passed to the consumer. Passing a box is modelled by a synchronization on channel pc. The consumer needs 7.5 seconds to manipulate a box. The speci cation of P looks as follows: proc P (pc : ) =
j[ : dist j := cun 5 10 ; [ sample ; pc ] ]j,
where sample denotes drawing a number from the continuous uniform distribution between 5 and 10 (cun 5 10). The speci cation of C looks as follows: proc C (pc : ) = j[ [ pc ; 7:5 ] ]j. The producer-consumer system, graphically presented in Figure 1, is speci ed by: syst PC = j[ pc : j P(pc) k C(pc) ]j.
Example 2
As an illustration of the selective-waiting construct, an in nite buer (B) is presented. It describes a component which receives and returns objects of type T in a rst-in rst-out fashion. The type of objects is a (type) parameter of the process describing the buer. If the buer is empty, the only possible action is to put an object into it. If it is not empty, either an object can be put into it or an object can be retrieved from it. The contents of the buer is modelled by a list of objects (xs of type T ), and list operations model putting and retrieving values. The buer is speci ed by: proc B (T : type, r : ?T; s : !T) = j[ x : T; xs : T j xs := [ ] ; [ r?x ?! xs := xs ++ [x] be xs 6= [ ] ; s! hd xs ?! xs := tl xs ] ]j. Buers are often used to eliminate unnecessary waiting in producer-consumer systems like the one described in the previous example, where the consumer is not able to keep pace with the peak rate of production but it can cope with the average rate. The buer simply accumulates items if the production rate is too high for the consumer. If the production rate becomes lower, the consumer can proceed working on the accumulated items. The buer is used in Section 3.
Example 3
In this example, the use of the selective-waitingwith-time-out construct is illustrated. The followP
pc
C
Fig. 1. The producer-consumer system
ing process (program) models a conveyor (C) that can move objects from one end of the belt to the other end. This activity takes seconds per object ( is a value parameter of the process describing the conveyor). An empty conveyor can only accept an object. Every accepted object is modelled by a real number representing the moment in time at which the object leaves the conveyor and which is equal to the acceptance time increased by . To represent the objects that stay on the belt, a list c of real numbers is introduced. In the speci cation below, variable represents the current time of the process. The rst object on the belt, represented by hd c, leaves the conveyor when = hd c. As long as < hd c, the conveyor can only accept new objects. proc C (r : ; s : ; : real) = j[ c : real j c := [ ] ; [ r ?! c := c ++ [ + ] be c 6= [ ] ; (hd c ? ) ?! s ; c := tl c ] ]j. The speci cation of the conveyor is used in the following section. 3. JOB-SHOP MANUFACTURING SYSTEM In this section, a hierarchical speci cation of a simple job-shop production system is presented. Consider a manufacturing cell with three workstations, each performing a dierent task, and one robot (R), distributing parts that have to be transformed among the workstations, or more precisely, among the buers associated with them. A workstation (WS) and a buer (B) form a subsystem called a workunit (WU). The number of parts in the manufacturing cell is constant and equal to N (N 1), which is a value parameter in the model. The time a workstation needs to process a part is uniformly distributed between 1 and 3 minutes. Every workstation can fail and the next failure time is uniformly distributed between 6000 and 12000 minutes. The repair time after the failure is 60 minutes. In the model, the part being transformed when the workstation failed is rejected. This is modelled by assigning a special mark with the part so that the robot can put it in the store containing rejected parts (an instance of SO). To simplify the description, it is assumed that the robot gets a part and a list determining the order in which the part should be processed by the workstations from a store (SI). The nished products are transported on a conveyor to another
store (an instance of SO). The time needed by the conveyor for the transport of a product is a value parameter in the model. In the sequel, \tasks" is the type f0; 1; 2; 3g. This type consists of nite lists containing elements with values 0, 1, 2, or 3. In the model, only lists of the length of at most 3 are used and 0 is only used to mark parts that are rejected. The robot R is speci ed as follows: proc R (pi; ai; bi; ci : ?tasks, ao; bo; co : !tasks, po; r : ; N : int) = j[ w : tasks j N[ pi?w ; IF ] ; [ [ai?w be bi?w be ci?w] ; [ w = [ ] ?! po ; pi?w be w = [0] ?! r ; pi?w ]; ]
IF
]j, where IF stands for the selection: [ hd w = 1 ?! ao!w be hd w = 2 ?! bo!w be hd w = 3 ?! co!w ]. A workstation is speci ed by: proc W S (p : ?tasks, q : !tasks) = j[ w : tasks, f : real, ; ' : dist j := cun 1 3 ; ' := cun 6000 12000 ; f := sample ' ; [ p?w ; [ sample ?! q!tl w be (f ? ) ?! 60 ; f := + sample ' ; q![0] ] ] ]j. The following process speci es the store containing the parts: proc S I (mo : !tasks) = j[ 1; 2; 3 : dist j 1 := dun 1 3 ; 2 := dun 1 3 ; 3 := dun 1 3 ; [ mo![ sample 1; sample 2; sample 3 ] ] ]j, where dun 1 3 stands for the discrete uniform distribution between 1 and 3.
The store containing nished products or rejected parts is speci ed by: proc S O (pi : ) = j[ [ pi ] ]j. The subsystem modelling a workunit (Figure 2) is speci ed by: syst W U (p : ?tasks, q : !tasks) = j[ b : tasks j B(tasks, p; b) k W S(b; q) ]j, where B is de ned in Example 2. The system specifying the manufacturing cell with the stores is de ned by: syst M C (N : int, : real) = j[ pi; ai; bi; ci; ao; bo; co : tasks, po; d; r : j S I(pi) k R(pi; ai; bi; ci; ao; bo; co; po; r;N) k W U(ao; ai) k W U(bo; bi) k W U(co; ci) k C(po; d; ) k S O(d) k S O(r) ]j, where C is de ned in Example 2. The MC system has two value parameters: the number N of parts under transformation and the time needed by the conveyor to transport a product. It is a closed system: all of its channels are internal. The above speci cation can be also presented graphically as in Figure 3. The model presented can be used for simulation experiments to estimate the essential system characteristics such as: the size of buers, and capacity and throughput time as a function of N (the amount of work in progress). 4. CONCLUDING REMARKS In this paper, the application of a real-time concurrent programming language to the speci cation of discrete industrial systems is illustrated. Although only simple examples are presented, the language WS
q
b
B
Fig. 2. The workunit
p
ACKNOWLEDGEMENT WU
bo
bi
WU
5. REFERENCES Arentsen, J.H.A. (1989). Factory Control Architecture. A System Approach. Ph.D. Thesis, Department of Mechanical Engineering, Eindhoven University of Technology. Burns, A. and G. Davies (1993). Concurrent Programming. International Computer Science Series. Addison-Wesley. Hoare, C.A.R. (1985). Communicating Sequential Processes. Prentice Hall, New York. Hooman, J. (1991). Speci cation and Compositional Veri cation of Real-Time Systems. SpringerVerlag. INMOS Limited (1988). Occam 2 Reference Manual. ISO 8807 (1989). Information processing systems |
r
R
ao
ci
pi
SI
The authors thank M. Rem, A. Kaldewaij, and D.A. van Beek for comments on the draft versions of this paper and helpful suggestions.
co
ai WU
SO
po
C
d
SO
Fig. 3. The job-shop can be equally well used to specify complex systems, as it is shown in (Arentsen, 1989) and (Smit, 1992) using a similar approach. Concurrent programming approach is suitable for the speci cation of industrial systems. It supports modularity and allows separate descriptions of the structure and of the component behaviour. The descriptions of component behaviours are concise and comprehensible, and they are suited for reuse. The de nition of the structure of a system is well suited for a graphical representation. The speci cation language together with the graphical structure representation supports well reasoning about models of production processes. The formal meaning of speci cations can be de ned by means of an operational semantics that respects concurrency and that is based on the notion of transition systems. The behaviour of speci ed systems can be analysed by means of sequential or distributed simulation (comparable to, for instance, the ones discussed in (Koster, 1993) or in (Misra, 1986)). For the veri cation of the communication behaviour embedded in a model, the underlying formal framework of CSP can be used. A software tool supporting speci cation activities based on the presented language is under development. The purpose of this tool is to facilitate a direct transition from speci cations to implementations (as described in (Overwater and Rooda, 1989) for a dierent speci cation language). The goal is to use the executable speci cation of the control part of the validated model directly in the industrial system. In this way, the development time of the control system can be shortened and its correctness with respect to the speci cation can be guaranteed.
Open systems interconnection | LOTOS | A formal description technique based on the temporal ordering of observational behaviour. Koster, J. (1993). Modelling Industrial Systems: Theory and Applications. Ph.D. Thesis, De-
partment of Mathematics and Computing Science, Eindhoven University of Technology. Mauw, S. and G.J. Veltink (1990). A Process Speci cation Formalism. Fundamenta Informaticae 13, pp. 85 { 139. Misra, J. (1986). Distributed Discrete-Event Simulation. Computing Surveys 18 (1), pp. 39{65. Overwater, R. and J.E. Rooda (1989). Developing Industrial Systems According to the Process Interaction Approach. In Preprints of the IFAC Symposium on Information Control Problems in Manufacturing Technology (E.A. Puente,
Ed.), pp. 171{176. Reddy, G.B., S.S.N. Murty, and K. Ghosh (1993). Timed Petri Net: An Expeditious Tool for Modelling and Analysis of Manufacturing Systems. Mathematical Computer Modelling 18 (9), pp. 17 { 30. Silva, M. and R. Valette (1990). Petri Nets and Flexible Manufacturing Systems. In Advances in Petri Nets (G. Rozenberg, Ed.), LNCS 424, Springer-Verlag, pp. 374 { 417. Smit, G.H. (1992). A Hierarchical Control Architecture for Job-shop Manufacturing Systems.
Ph.D. Thesis, Department of Mechanical Engineering, Eindhoven University of Technology.
Tanir, O. and S. Sevinc (1994). De ning Requirements for a Standard Simulation Environment. Computer 27 (2), pp. 28 { 34. Van Brussel, H., Y. Peng, and P. Valckenaers (1993). Modelling Flexible Manufacturing Systems Based on Petri Nets. Annals of the CIRP 42 (1), pp. 479 { 484. Van Hee, K.M., L.J. Somers, and M. Voorhoeve (1989). Executable Speci cations for Distributed Information Systems. In Information System Concepts: An In-depth Analysis (E.D. Falkenberg and P. Lindgreen, Ed.), NorthHolland. Verkoulen, P.A.C. and M.M. de Brouwer (1990). Two Case Studies in ExSpect. Computing Science Notes, 90/19, Eindhoven University of Technology. Wortmann, A.M. (1991). Modelling and Simulation of Industrial Systems. Ph.D. Thesis, Department of Mechanical Engineering, Eindhoven University of Technology.