petri nets manufacturing

502

Upload: bentchikou-moh

Post on 28-Apr-2015

103 views

Category:

Documents


2 download

TRANSCRIPT

PETRI NETS MANUFACTURING AND COMPUTER SCIENCE Edited by Pawel Pawlewski Petri Nets Manufacturing and Computer Science http://dx.doi.org/10.5772/2578 Edited by Pawel Pawlewski Contributors Dejan Gradiar, Gaper Mui, Belhassen Mazigh, Abdeljalil Abbas-Turki, Yen-Liang Pan, Genichi Yasuda, Tiago Facchin, Miguel Afonso Sellitto, Chongyi Yuan, Liangbing Feng, Masanao Obayashi, Takashi Kuremoto, Kunikazu Kobayashi, Iwona Grobelna, Ivo Martink, Pece Mitrevski, Zoran Kotevski, Razib Hayat Khan, Poul E. Heegaard, Kazi Wali Ullah, Hussein Karam Hussein Abd El-Sattar, Wlodek M. Zuberek, Gustavo Callou, Paulo Maciel, Dietmar Tutsch, Julian Arajo, Joo Ferreira, Rafael Souza, J. Dassow, G. Mavlankulov, M. Othman, S. Turaev, M.H. Selamat, R. Stiebe, Jos Reinaldo Silva, Pedro M. G. del Foyo, Sangita Kansal, Mukti Acharya, Gajendra Pratap Singh, Samir Hamaci, Karim Labadi, A. Moumen Darcherif, Gi Bum Lee, Han Zandong, Jin S. Lee, Parisa Heidari, Hanifa Boucheneb, Taha Benarbia Published by InTech Janeza Trdine 9, 51000 Rijeka, Croatia Copyright 2012 InTech All chapters are Open Access distributed under the Creative Commons Attribution 3.0 license, which allows users to download, copy and build upon published articles even for commercial purposes, as long as the author and publisher are properly credited, which ensures maximum dissemination and a wider impact of our publications. After this work has been published by InTech, authors have the right to republish it, in whole or part, in any publication of which they are the author, and to make other personal use of the work. Any republication, referencing or personal use of the work must explicitly identify the original source. Notice Statements and opinions expressed in the chapters are these of the individual contributors and not necessarily those of the editors or publisher. No responsibility is accepted for the accuracy of information contained in the published chapters. The publisher assumes no responsibility for any damage or injury to persons or property arising out of the use of any materials, instructions, methods or ideas contained in the book. Publishing Process Manager Marina Jozipovic Typesetting InTech Prepress, Novi Sad Cover InTech Design Team First published August, 2012 Printed in Croatia A free online edition of this book is available at www.intechopen.com Additional hard copies can be obtained from [email protected] Petri Nets Manufacturing and Computer Science, Edited by Pawel Pawlewski p. cm. ISBN 978-953-51-0700-2 Contents Preface IX Section 1 Manufacturing 1 Chapter 1 Automated Petri-Net Modelling for Batch Production Scheduling 3 Dejan Gradiar and Gaper Mui Chapter 2 Specifying and Verifying Holonic Multi-Agent Systems Using Stochastic Petri Net and Object-Z: Application to Industrial Maintenance Organizations 27 Belhassen Mazigh and Abdeljalil Abbas-Turki Chapter 3 A Computationally Improved Optimal Solution for Deadlocked Problems of Flexible Manufacturing Systems Using Theory of Regions 51 Yen-Liang Pan Chapter 4 Implementation of Distributed Control Architecture for Multiple Robot Systems Using Petri Nets 75 Genichi Yasuda Chapter 5 Measurement of Work-in-Process and Manufacturing Lead Time by Petri Nets Modeling and Throughput Diagram 95 Tiago Facchin and Miguel Afonso Sellitto Chapter 6 Workflow Modelling Based on Synchrony 107 Chongyi Yuan Chapter 7 Construction and Application of Learning Petri Net 143 Liangbing Feng, Masanao Obayashi, Takashi Kuremoto and Kunikazu Kobayashi Chapter 8 Control Interpreted Petri Nets Model Checking and Synthesis 177 Iwona Grobelna VI Contents Section 2 Computer Science 193 Chapter 9 Sequential Object Petri Nets and the Modeling of Multithreading Object-Oriented Programming Systems 195 Ivo Martink Chapter 10 Fluid Stochastic Petri Nets: From Fluid Atoms in ILP Processor Pipelines to Fluid Atoms in P2P Streaming Networks 225 Pece Mitrevski and Zoran Kotevski Chapter 11 Performance Evaluation of Distributed System Using SPN 257 Razib Hayat Khan, Poul E. Heegaard and Kazi Wali Ullah Chapter 12 State of the Art in Interactive Storytelling Technology: An Approach Based on Petri Nets 283 Hussein Karam Hussein Abd El-Sattar Chapter 13 Timed Petri Nets in Performance Exploration of Simultaneous Multithreading 299 Wlodek M. Zuberek Chapter 14 A Petri Net-Based Approach to the Quantification of Data Center Dependability 313 Gustavo Callou, Paulo Maciel, Dietmar Tutsch, Julian Arajo, Joo Ferreira and Rafael Souza Chapter 15 Grammars Controlled by Petri Nets 337 J. Dassow, G. Mavlankulov, M. Othman, S. Turaev, M.H. Selamat and R. Stiebe Chapter 16 Timed Petri Nets 359 Jos Reinaldo Silva and Pedro M. G. del Foyo Section 3 Theory 379 Chapter 17 Boolean Petri Nets 381 Sangita Kansal, Mukti Acharya and Gajendra Pratap Singh Chapter 18 Performance Evaluation of Timed Petri Nets in Dioid Algebra 407 Samir Hamaci, Karim Labadi and A. Moumen Darcherif Chapter 19 Reachability Criterion with Sufficient Test Space for Ordinary Petri Net 423 Gi Bum Lee, Han Zandong and Jin S. Lee Contents VII Chapter 20 A Forward On-The-Fly Approach in Controller Synthesis of Time Petri Nets 439 Parisa Heidari and Hanifa Boucheneb Section 4 Other 463 Chapter 21 Petri Nets Models for Analysis and Control of Public Bicycle-Sharing Systems 465 Karim Labadi, Taha Benarbia, Samir Hamaci and A-Moumen Darcherif Preface Manufacturing and Computer Science these are major usage fields for applications using Petri Nets, which are the subject of the present monograph. Manufacturing, i.e. producing goods, is one of the realms of human activity which has greatly affected the development of civilization. Over centuries, the large-scale manufacturing of goods changed the social relations, created new lifestyles and contributed to the improvement of life conditions of whole societies. The economic development has become an objective realized by states and commonwealths of states. It includes both quantitative changes referring to the growth in production, employment, investments, the scale of operating capital, incomes, consumption as well as other economic values describing the quantitative character of the economy (economic growth) and qualitative changes (changes in the organization of society). The improvement of life standards, the increase in production, a better social situation and greater public security are the basic benefits resulting from economic growth and development. Nowadays, owing to the increasingly complex products and technologies, the manufacturing still strongly stimulates development. It considerably affects other fields, e.g. computer science, as it creates new challenges. The role of production in the world is still crucial. When comparing the crisis in the automotive industry with the IT companies crisis (the so-called dot-com bubble burst), we can see that the first one had a more widespread effect over the world. The growing role of China, the leader in the scale and growth of production, changes the global distribution of power. Pawel Pawlewski Department of Management Engineering, Poznan University of Technology, Poznan, Poland Section 1 Manufacturing Chapter 0Automated Petri-Net Modelling forBatch Production SchedulingDejan Gradiar and Gaper MuicAdditional information is available at the end of the chapterhttp://dx.doi.org/10.5772/484671. IntroductionProduction scheduling is a fundamental function in production control. It has an immediateand considerable impact on the efciency of related manufacturing processes and signicantlyinuences the overall production performance.The primary characteristic of batch production is that the output of the process appears inquantities of materials or lots called batches. All components are completed at a workstationbefore they move to the next one. These kinds of production environments appear in chemical,pharmaceutical, food and similar industries.The control of batch processes poses difcult issues as these processes are neither continuousnor discrete, but have the characteristics of both. ISA society introduced a multi-part S88standard where the rst part [1] denes the models and terminology for batch plants andcontrol systems. S88 provides a framework for the development of technologies that notonly support control activities of batch processes but also management activities, such asscheduling. This is illustrated in [14] where a generic framework is dened for interpreting amulti-purpose/product batch plant in terms of S88 constructs for scheduling purposes.In order to cope with the behaviour of a batch production process an appropriatemathematical model is needed. When the behaviour is described by such a model, formalmethods can be used, which usually improve the understanding of systems, allow theiranalysis and help in implementation. MILP based formulations of batch process features aretypically used as shown in [12]. Nevertheless, Petri nets have also been applied in differentaspects of modelling, qualitative and quantitative analysis, control, planning and schedulingof batch processes [4]. Independently of the chosen framework, the modelled behaviour isoften extremely complex. Within the changing production environment the effectiveness ofbatch production modelling is, therefore, a prerequisite for the effective design and operationof batch systems.To determine a model, data from different existing information systems could be used. Fromproduction management systems, such as Manufacturing Resource Planning (MRP II) andEnterprise Resource Planning (ERP), data about the needs, product structure and processChapter 12 Will-be-set-by-IN-TECHstructure could be gained [21]. On the other hand, data from the production process couldbe used to determine the actual resource availability. MRP II and ERP systems are commonlyused in discrete manufacturing for upper level production control, such as productionplanning. Standard production management tools, such as MRP, are also used in batchproduction environment [20]. As dened with standard S88.01 the required raw materialsand their quantities are determined froma dedicated data structure named Formula. This waythe formula can be linked to standard Bill of Materials (BOM) used within MRP II concept [7].While in a discrete manufacturing processes BOM are used to determine process materialsand their quantities needed for production of nished products, in batch production processesthese data are given with Formula. The same is with information that denes a sequence ofoperations requiredto produce an item. In discrete manufacturing processes these are denedwith Routing, and Manufacturing recipes are used in batch production.These two groups of data items, together with the given resource units, form the basicelements of the production process. These data can be effectively used to build up a model ofthe batch production system with timed Petri nets. An algorithm will be introduced, whichbuilds a Petri-net model from the existing data. The model is built directly in a top-downmanner, starting from the Formula (BOM) and the Manufacturing recipes (routings) [21].First a class of Petri nets used is presented in a formal manner with detailed discussion on timerepresentation. Next a method to describe a Formula with Petri net structure is given. Rootitem, representing the product, is composed of sub-items (sub-processes). Later a methodof describing the basic production activities with timed Petri net is presented. The obtainedmodel is applied in optimisation of batch scheduling problem.2. Timed PNIn the Petri net literature, three basic ways of representing time in Petri nets are used [2]:ring durations (FD), holding durations (HD) and enabling durations (ED). When using FDprinciple the transition ring has duration [23]. In contrast, when using HD principle, aring has no duration but a created token is considered unavailable for the time assignedto transition that created the token, which has the same effect. With ED principle, the ringof the transitions has no duration while the time delays are represented by forcing transitionsthat are enabled to stay so for a specied period of time before they can re. This is a moregeneral concept since it allows for modelling of task interruption. Some authors use an evenmore general concept, which assigns delays to individual arcs, either inputs or outputs of atransition [10].When modelling several performance optimisation problems, e.g. scheduling problems, sucha general framework is not needed. It is natural to use HD when modelling most schedulingprocesses as operations are considered non-preemptive. The timed version of CPNs denedby [9] uses a HD equivalent principle, where the unavailability of the tokens is denedimplicitly through the corresponding time stamps. While CPNs allow the assignment ofdelays both to transition and to output arcs, we further simplify this by allowing time delayinscriptions to transitions only. This is sufcient for the type of examples investigated here,and can be generalised if necessary.To include a time attribute of the marking tokens, which determines their availability andunavailability, the notation of timed CPN will be adopted. Tokens are accompanied with atimestamp, which is written next to the token number and separated from the number by @.E.g., two tokens with time stamp 10 are denoted 2@10. A collection of tokens with different4 Petri Nets Manufacturing and Computer ScienceAutomated Petri-Net Modelling for Batch Production Scheduling 3time stamps is dened as a multiset, and written as a sum (union) of sets of timestampedtokens. E.g., two tokens with time stamp 10 and three tokens with timestamp 12 are writtenas 2@10 +3@12. The timestamp of a token denes the time from which the token is available.Time stamps are elements of a time set TS, which is dened as a set of numeric values. In manysoftware implementations the time values are integer, i.e., TS = N, but will be here admittedto take any positive real value including 0, i.e., TS = R+0 . Timed markings are representedas collections of time stamps and are multisets over TS : TSMS. By using HD principle theformal representation of a P/T timed Petri net is dened as follows. TPN = (N, M0) is atimed Petri net system, where: N = (P, T, Pre, Post, f ) is a Timed Petri net structure, P ={p1, p2, ..., pk}, k > 0 is a nite set of places, T = {t1, t2, ..., tl}, l > 0 is a nite set of transitions.Pre : (P T) N is the input arc function. If there exists an arc with weight k connectingp to t, then Pre(p, t) = k, otherwise Pre(p, t) = 0. Post : (P T) N is the output arcfunction. If there exists an arc with weight k connecting t to p, then Post(p, t) = k, otherwisePost(p, t) = 0. f : T TS is the function that assigns a non-negative deterministic time delayto every t T. M : P TSMS is the timed marking, M0 is the initial marking of a timed Petrinet.To determine the availability and unavailability of tokens, two functions on the set ofmarkings are dened. The set of markings is denoted by M. Given a marking and modeltime, m : P MTS Ndenes the number of available tokens, and n : P MTS Nthe number of unavailable tokens for each place of a TPN at a given time k. Note that modeltime also belongs to time set TS, k TS.Using the above denitions, addition and subtraction of timed markings, and the TPN ringrule can be dened. Given a marked TPN = (N, M), a transition t is time enabled at timek, denoted M[tk iff m(p, M, k) Pre(p, t), p t. An enabled transition can re, andas a result removes tokens from input places and creates tokens in output places. The newlycreated tokens are accompanied by timestamps depending on the model time and the delayof transition that created the tokens. If marking M2 is reached from M1 by ring t at time k,this is denoted by M1[tkM2. The set of markings of TPN N reachable from M is denoted byR(N, M).3. Modelling procedurePetri nets are a family of tools that provide a framework, which can be used for variousproblems that appear during the life-cycle of a production system [18]. In this sectionwe present the modelling of production system using timed Petri nets for the purpose ofperformance control. When timed Petri nets are used, it is possible to derive performancemeasures such as makespan, throughput, production rates, and other temporal quantities.The Petri net model is built based on the data stored in production management informationsystems, i.e., ERP system.3.1. The class of production systemsWith the method presented here several scheduling problems that appear in variousproduction systems can be solved. In a discrete manufacturing different jobs are neededto produce a nal product that is composed of several components. Similarly in batchproduction different activities have to be performed in order to produce a nal product.However, here the resultant product is produced with some irreversible change, e.g. productsare mixed from quantities of ingredients.5 Automated Petri-Net Modelling for Batch Production Scheduling4 Will-be-set-by-IN-TECHDifferent management systems (ERP) can be applied for different types of production systemsto plan the production process activities. We are assuming here a management system thatcan provide plan for both, discrete and batch process. The system generates work orders thatinterfere with the demands for the desired products. Different jobs/procedures are needed toproduce a desired product. Set of operations needed to produce one item represent a job. Ingeneral, more operations have to be performed using different resources in order to completea specic job. To complete a specic product, more sub-products may be needed. To list thesecomponents a BOM is used in discrete manufacturing and formulas in batch manufacturing.These components determine sub-jobs that are needed to manufacture a parent item. In thisway the general scheduling problem is dened that can be applied both in discrete or batchproduction environment and can be given as: n jobs are to be processed: J = {Jj}, j = 1, ..., n, r resources are available: M = {Mi}, i = 1, ..., r, each job Ji is composed of nj operations: Oj = {ojk}, k = 1, ..., nj, each operation can be processed on (more) different sets of resources Sjkl R; l determinesthe number of different sets, the processing time of each operation ojkl, using resource set Sjkl, is dened with Tjkl, precedence constraints are used to dene that some operations within one job has to beperformed before a set of operations in another job.Using this denition, the following assumptions have to be considered: Resources are always available and never break down. Each resource can process a limited number of operations. This limitation is dened by thecapacity of resources. Operations are non pre-emptive. When an operation is performed, it is desirable to free the resources so that they canbecome available as soon as possible. Intermediate buffers between processes are commonsolutions. It is common for batch processes that successive operations need to beperformed on the same resource as predecessor. In this case the resource is free whenthe last operation is nished. Processing times are deterministic and known in advance. Work orders dene the quantity of desired products and the starting times. Orders that aresynchronised in time are considered jointly.3.2. Modelling of production activitiesHere we present a method of describing the production-system activities with timedPetri nets using the holding-duration representation of time. The places representresources and jobs/operations, and the transitions represent decisions or rules for resourcesassignment/release and for starting/ending jobs.To make a product, a set of operations has to be performed. We can think of an operation asa set of events and activities. Using a timed PN, events are represented by transitions andactivity is associated with the presence of a token in a place.6 Petri Nets Manufacturing and Computer ScienceAutomated Petri-Net Modelling for Batch Production Scheduling 5An elementary operation can be described with one place and two transitions, see Figure 1.When all the input conditions are met (raw material and resources are available) the eventthat starts the operation occurs, t1. This transition also determines the processing time of anoperation. During that time the created token is unavailable in place p2 and the operation isbeing executed. After that time the condition for ending the operation is being satised andt2 can be red. Place p1 is not a part of the operation, it determines the input condition, e.g.the availability of the input material.p1p1 p2 t2p1p1 p2t1 t2p1p1 p2 t2tdt1tdt1tdt t t +tf f d < t t < f t t +t f dFigure 1. Operation described with timed Petri net.When parallel activities need to be described the Petri-net structure presented in Figure 2is used. Transition t0 sets the input conditions for the parallel execution of two operations.In places p01 and p02 operations can wait for the available resource(s). The time delays of thetransitions t11in and t12in dene the duration of each operation. An available token in place p11(p12) indicates that operation is nished. Transition t1 is used to synchronise both operations.p01p02t11int12inp11opp11p12t11outt12outp12opt1t0td2td1Figure 2. Two parallel operations.An operation might need resources, usually with a limited capacity, to be executed; this isillustrated in Figure 3. Place pR1 is used to model a resource R1. Its capacity is dened withthe initial marking of that place. The resource is available to process the operation if thereare enough available tokens in it. When the resource is used at the start of the operation theunavailable token appears in place p1op. After the time dened by transition t1in the tokenbecomes available, t1out is red, and the resource becomes free to operate on the next job.For this reason zero time needs to be assigned to the transition t1out. An additional place p1models the control ow. When the token is present in this place, the next operation can begin.p0t1in p1opp1pR1t1outtdFigure 3. Operation that uses a resource with nite capacity.A particular operation can often be done on more different (sets of) resources with differentavailability, and the time duration can be different on each set of resources. An example where7 Automated Petri-Net Modelling for Batch Production Scheduling6 Will-be-set-by-IN-TECHan operation can be executed on two different sets of resources is shown in Figure 4. If theoperation chooses resource R3, its time duration is determined with the transition f (t2in) =td2. Otherwise the set of resources, composed of R1 and R2, is being selected and its operationtime is dened with f (t1in) = td1.p0 td1 p1opp1t1outt2outp2oppR11inttd22intpR2pR3Figure 4. Operation that can be performed on two different sets of resources.There are common situations where more operations use the same resource, e.g., anautomated guided vehicle (AGV) in a manufacturing system or a mixing reactor in a batchsystem. This can be modelled as shown in Figure 5.p01p02p1opp1p2pR1t1outt2outp2opt1int2intd2td1Figure 5. Shared resource.Precedence constraints are used to dene technological limitations and the sequence ofoperations. An example of two successive operations is shown in Figure 6, depicted as Op1and Op2. In this gure an example of technological limitations is also shown. Here, thesituation where operation Op1 precedes operation Op3 is considered. For this purpose anadditional place ppr1 is inserted between the transition t1out (ending Op1) and the transitiont3in (starting Op3). The weight n of the arc, which connects ppr1 to t3in, prescribes how manyitems need to be produced by the rst operation before the second operation can begin.3.3. Modelling using the data from production-management systemsThe most widely usedproduction-management information systemin practice are MRP II andERP. Data stored in those systems can be used to build up a detailed model of the productionsystem with Petri nets. In discrete manufacturing these data are bills of material and routing,while in batch manufacturing master formula and recipe are used to determine the production8 Petri Nets Manufacturing and Computer ScienceAutomated Petri-Net Modelling for Batch Production Scheduling 7p01p03p1opp1p3ppr1t1outt3outp3opt1int3intd3td1p2t2outp2opt2intd2Op3Op1 Op2nFigure 6. Precedence constraint.process. Work orders are used to determine which and how many of nished products haveto be produced.3.3.1. Bill of materials (Formula)The Bill of materials (BOM) is a listing or description of the raw materials and items that makeup a product, along with the required quantity of each. In batch manufacturing other termsare used instead, i.e. Formula.The BOM used in this work is dened as:BOM = (R, E, q, pre), where: R = {r1} is a root item. E = {e1, ..., ei} is a nite set of sub-items, q : E IN is the function that denes the quantities for each sub-item ei. q represents ani 1 column vector whose ith entry is q(ei). pre : (E E) {0, 1} is a precedence-constraints function. It denes theprecedence-constraints matrix pre, where pre(i, j) = 1 indicates that the i-th itemprecedesthe j-th item. It can also be interpreted as a directed graph.R is a root item and represents the product that is composed of sub-items described withei E. The number of requiredsub-items is determined with the vector q. When any sub-itemhas to be produced before another, the precedence function pre is used to dene it. All thesub-items have to be nished before the operation for the subsequent sub-items can begin. Arequired property of pre is that only zero values can be on its diagonal, i.e. a sub-item cannotprecede itself. An item is never allowed to become (indirectly) a component of itself. In otherwords, if the BOM structure is seen as a directed graph, this graph should be cycle-free [21].If any of the sub-items ei are composed of any other sub-items, the same BOM denition isused to describe its dependencies. The items at the highest level of this structure representa nished product, and those at the lower level represent raw materials. The items thatrepresent raw materials do not have a BOM.Table 1 shows an example of a BOM describing the production of product I, which iscomposed of three components, i.e., three items of J, one item of K and and two items of9 Automated Petri-Net Modelling for Batch Production Scheduling8 Will-be-set-by-IN-TECHItem Sub-item Quantity Precedence constraintsI J 3 0 1 0K 1 0 0 0L 2 0 0 0Table 1. Example of the BOM structure.L. From the precedence-constraint matrix it is clear that all of the items J has to be completedbefore the production of item K can begin.The mathematical representation of the BOM of item I would be represented as:BOM = (R, E, q, pre), where R =

I

,E =

J K L

, q =

3 1 2

and pre =0 1 00 0 00 0 0.To start with building a model, let us assume that, for each item from the BOM, only oneoperation is needed. As stated before, each operation can be represented with one place andtwo transitions (Figure 1). To be able to prescribe how many of each item is required thetransition tRin and the place pRin are added in front, and pRout and tRout are added behindthis operation. The weight of the arcs that connect tRin with pRin and pRout with tRout aredetermined by the quantity q0 of the required items. In this way an item I is represented witha Petri net as dened in Figure 7.Item IpRintIin pIoppRouttIouttRinq0tRoutq0Figure 7. PN structure representing one item in the BOM.As nished product is dened with a structure of BOMs, the construction of the overall Petrinet is an iterative procedure that starts with the root of the BOM and continues until all theitems have been considered. If the item requires any more sub-assemblies (i.e., items froma lower level) the operation, the framed area of the PN structure presented in Figure 7, issubstituted with lower-level items. If there are more than one sub-items, they are given asparallel activities.The substitution of an item with sub-items is dened as follows: Remove the place pIop and its input/output arcs. Dene the PN structure for sub-components, as it is dened with a BOM. Consider theprecedence constraints. Replace the removed place pIop by the sub-net dened in the previous step. The input andoutput transitions are merged with the existing ones.The result of building the PN model of this example (Table 1) is given in Figure 8, where itemI is composed of three subitems: J, K and L.10 Petri Nets Manufacturing and Computer ScienceAutomated Petri-Net Modelling for Batch Production Scheduling 9tJin pJoppIinJpIoutJtJoutt Kin pKopptRin pRin tIin pIinK pIoutK tIout tRout Routq0 q032Item JItem KItem I32t KoutpPrt Lin pLoppIinL pIoutLItem Lt Lout3Figure 8. BOM structure dened by PN.3.3.2. Routings (Recipe)For each item that can appear in production process, and does not represent a raw material, arouting is dened. It denes a job with sequence of operations, each requiring processingby a particular resource for a certain processing time, which are needed for transformingraw material into the (sub)product. This information are provided by routing tables indiscrete manufacturing, and by recipes in batch manufacturing industries. The table containsa header, where the itemthat is being composed is dened and the lines where all the requiredoperations are described. For each operation one line is used.As an example, the routing table for item K is given as presented in Table 2. Three operationsare needed to produce this item; the rst of these operations can be done on two differentresources. Similar notation is used for other possible cases, e.g. an operation that needs threeresources R1 and two R2, or one resource R1 and three R3 would be presented by (3 R1, 2 R2)/(R1, 3 R3).Operations Duration ResourcesOp10 10s/9s R1/R3Op20 20s R2Op30 12s R1Table 2. Routing of product K.The implementation of the routing data in one item of a BOM is dened as follows: Remove the place pXop and its input/output arcs. Dene a PN structure for the sub-components, as it is dened with routing data. Alsoprecedence constraints are considered here. Place pXop is replaced with the sub-net dened in previous step, where input and outputtransitions are merged with the existing ones.Function that denes PN structure for every sub-component yields the correspondingsequence of production operations fromthe routing table and for each operation a timed Petrinet is built as dened in section 3.3.1. All the placed operations are connected as prescribed11 Automated Petri-Net Modelling for Batch Production Scheduling10 Will-be-set-by-IN-TECHby the required technological sequence, and each operation is assigned to the required placesrepresenting appropriate resources.pK10t tpK1_1oppK12optt pK1t tpK2 pK3opt tpK3PR3PR2PR1Op10Op20 Op30tKin tKoutItem KK11inK12inK11outK12outK2in K2out K3in K3outpK2op10920 12Figure 9. Routing of product K modelled with timed Petri net.The PNstructure in Figure 9 is achieved if the sequence of operations described with a routingtable (Table 2) is modelled. The resulting PN structure is inserted into the main PN model, onthe place where item K (pKop) was.The routings/recipes are submodels that are inserted (by substitution, as dened previously)into the main model dened with the BOM structure. However, some activities of anysub-item may also be described with a BOM, i.e., in the case they are composed ofsemi-products. The construction of the overall Petri-net model can be achieved by combiningall of the intermediate steps.3.3.3. Work orderThe work order (WO = [R, q0, st]) determines which and how many of the nished productshave to be produced. Each product (R) can be represented with a Petri-net model, shown inFigure 7, where one place is added in front and one at the end of the structure to determine thestart and end of the work. As usually more products are produced at one time (one productis represented with one batch), the weight of the arc that connects tRin and pRin are used todetermine the number of required batches (q0). To be able to consider different starting timesfor different quantities of one product the general structure shown in Figure 10 is used. q0determines the number of products to be nished. Orders for products which should startwith the production at the same time are merged and every group of products with thesame starting time is modelled with places p1, p2, ...pn and with tokens located in them. Thetimestamps, which are assigned to these tokens determine the starting time of every groupof products. Wights q1, q2, ...qn determine the number of products, where q1 + q2 + ... + qn isequal to q0. The token in the place pend implies that WO is nished.3.4. Specics of batch production processesIn previous sections (3.3.1 3.3.3) we present methods to represent formula, recipe and workorders with Petri nets. As given so far these elements can be equally used for discrete andbatch process environments. However, as mentioned in 3.1 there are some specics in batchproduction processes.Actually batch production is more complicated and formula and recipe are more connectedas are BOM and routings [7]. There are common situations where precedence constraints12 Petri Nets Manufacturing and Computer ScienceAutomated Petri-Net Modelling for Batch Production Scheduling 11p2 pin pendt1toutp1pnq1q2qnq0pPRop ptPRin tPRoutoutProductt2tnFigure 10. Petri net structure of a work order.are not used only to dene interdependencies between different (nished) items, but also forinterdependencies between job operations of various items that are dened with recipes. Inthis situations the denition of BOM (Formula) has to be extended.Denition of a sub-items set E is extended in a way that it contain also the information aboutoperations that produce that item: E = {(e1, o1k), ...(ei, oinj)}.Further also a precedence-constraint function pre is extended in order to include informationabout how many operations are needed for every item. As dened in 3.1, set of operationsneeded to produce j-th item is given as Oj = {ojk}, where k = 1, ..., nj. Size of the matrix istherefore dened with [m m], where m = nj, j = 1...n. Here n is number of items thatmake up a product. In this way we can dene an extended precedence-constraints functionpre as pre : ((E O) (E O)) {0, 1}. Element from constraint matrix pre(pij, pkl) = 1indicates that the j-th operation from i-th item precedes l-th operation from k-th item. Hereindex pij in a matrix pre presents j-th operation of i-th itemand pkl l-th operation of k-th item.3.5. Procedure for building the PN modelWith WO demands for product to be nished are passed. For each WO a Petri net model hasto be dened. The modelling procedure can be summarised in the Algorithm 1.Algorithm 1 Read BOM[R, q, st] = readWO()For i = 1 to length(R)E = readBOM(R(i))PN = placePN(R(i), E, q(i), [ ], st(i), x0, y0)PN = routing(PN, R(i))endFirst, the data about the WO are read. The products that are needed to be produced are givenin R; in vector q the quantities of the desired products are passed; and vector st is used todetermine the starting time of each product. For each product the Petri-net structure, shownin Figure 10, is determined and placed on the model. The step when the routing() is called isdescribed in more detail with algorithm 2.First, the routing and the BOM data are read from the database (functions readRouting() andreadBOM()). For each operation that comprises the routing, the algorithm checks whether it ismade up of sub-item(s) or this is an operation. In the rst case, the function placePN() is usedto determine the PN structure of the given structure BOM. Precedence constraints are added13 Automated Petri-Net Modelling for Batch Production Scheduling12 Will-be-set-by-IN-TECHAlgorithm 2 Read Routingfunction PN = routing(PN, R)datRoute = readRouting(R)[E, q, pre] = readBOM(R)for i = 1 to length(datRoute.Op)if datRoute.Resources ==BOMPN1 = placePN(R, E, q, pre, [ ])PN = insertPN(PN, PN1)for j = 1 to length(E)PN1 = routing(PN1, E(j))endelsePN = constructPN(PN, datRoute(i))PN = insertPN(PN, PN1)endendif they exist. With the function insertPN() the resulting subnet is inserted into the main PNstructure. If the operation represents the production operation, the function constructPN() iscalled. With it, basic elements (Figures 16) are recognised, joined together and placed in themodel, again using the function insertPN(). All the data about resources and time durationsare acquiredfromthe routing table. The describedalgorithmhas been implementedin Matlab.The resulting model is stored in a XML-based format employing Petri Net Markup Language(PNML) [6].3.6. VericationWhen the model is built up, it should be veried to see whether it reects the systemoperationas dened with data about the production process. Some interesting properties of the modelcan be checked with the P-invariant analysis. Several P-invariants can be identied in themodel. Their number is dened with the sum of all the resources, the number of productroutes and the number of all precedences that are present in the model. It can be stated thatthe weighted sum of tokens that belongs to every P-invariant, which is a consequence of aresource, is equal to the capacity of that resource. The weighted sum of all other invariants isdened with the common number of batches of demanded product.If possible, the model is later simplied in a way, that eliminated nodes do not inuence themodel behaviour.4. SchedulingScheduling is one of the most important management functions and is a fundamental problemin the control of any resource-sharing organisation. Scheduling problems are very complexand many have been proven to be NP hard [8].Literature on deterministic scheduling classies the manufacturing scheduling problemsaccording to machine environment structure, processing characteristics and constraints, andobjectives. Standard machine environment structures lead to standard scheduling problems,e.g., open shop, ow shop and job shop problems, which are commonly studied. All three14 Petri Nets Manufacturing and Computer ScienceAutomated Petri-Net Modelling for Batch Production Scheduling 13problem classes address a problem of sequencing n jobs (tasks) through a set of r machines(resources) where every job has to be processed once on every machine and every such joboperation requires a specied processing time. The problems differ in restrictions on the jobroutings.The scheduling problems related to batch plants possess a more complicated structurecompared to standard scheduling problems. Batch plants are exible and alternative resourcescan be used for conveying recipe operations. There may be different operation processingtime assignments based on which equipment is used for processing and there may bespecic requests on precedences or allowable intermediate storage time. This signicantlycomplicates the problem of operations scheduling in batch processes. A comprehensivereview of the state-of-the art of short-term batch scheduling is presented in [12]. Differenttypes of batch scheduling problems are specied and the types of optimization models arereviewed. The presented models result in a formulation of MILP optimization problem andits solution yields an optimal schedule.Petri nets can be used to effectively model all standard deterministic scheduling problemclasses. Furthermore, the modelling power of Petri nets allows for derivation of models alsofor problems, which do not have standard problem structure but are closer to real processspecics. This is typical e.g. in batch systems where complex interconnections among processequipment are possible and vary considerably with used batch recipes. Even when the modelsare not as general as the above mentioned MILP problem representations, Petri nets can beused to model main model components of a two stage batch scheduling approach as denedin [12]. In contrast to monolithic approach the two stage approach assumes that the numberof batches of each size is known in advance. The scheduling stage therefore concentrates onthe allocation of processing resources to the batches while the plant work load is determinedin a previous stage.4.1. Petri net based derivation of optimal or sub-optimal schedulesTo derive a feasible schedule, the obtained Petri net model can be simulated by an appropriatesimulation algorithm. During the simulation, the occurring conicts are resolved on they, e.g. by randomly choosing a transition in conict that should re. Instead, heuristicdispatching rules [5], such as Shortest Processing Time (SPT), can be introduced whensolving the conicting situations. The schedule of process operations can be determinedby observing the marking evolution of the net. Depending on the given schedulingproblem a convenient rule should be chosen. Usually, different rules are needed to improvedifferent predened production objectives (makespan, throughput, production rates, andother temporal quantities).A more extensive exploration of the reachability tree is possible by PN-based heuristic searchmethod proposed by [11]. It is based on generating parts of the Petri net reachability tree,where the branches are weighted by the time of the corresponding operations. The chosentransition ring sequence corresponds to a schedule, and by evaluating a number of sequencesa (sub)optimal schedule can be determined. The method is further investigated in [22], wherea modied heuristic function is proposed and tested on a number of benchmark tests. Theproblems of the approach are in the complexity of the reachability tree, which can generallynot be completely explored. The search has to be limited to predened maximum tree size inorder to complete in a reasonable time. In addition to that, the heuristic function used withinthe search has to be chosen such that the search is directed more into the depth of the tree,15 Automated Petri-Net Modelling for Batch Production Scheduling14 Will-be-set-by-IN-TECHwhich makes the obtained solution very sensitive to decisions taken at initial levels of the treeand in many cases the quality of the obtained solutions is rather low.Recent reports in scheduling literature showan increasedinterest in the use of meta-heuristics,such as genetic algorithms (GA), simulated annealing (SA), and tabu search (TS).Meta-heuristics have also been combined with Petri net modelling framework to solvecomplex scheduling problems [19]. With such an approach, the modelling power of Petrinets can be employed, and relatively good solutions of scheduling problems can be foundwith a reasonable computational effort, although the convergence to the optimum can not beguaranteed. Compared to reachability tree based search methods, meta-heuristics require lessmemory.The problem is that these methods require a sort of neghbouring solution generation strategy.This is easily accomplished for well structured problems, e.g. standard scheduling problems,but may be problematic for general models. In contrast, reachability tree methods as well aspriority rule based methods can be used with any type of Petri net model. This motivates theinvestigation of combined methods, such as the combination of dispatching rules and localsearch [13].Dispatching rules, however, do not always enable to reach the optimumeven if combined withoptimization methods. Using the rule based conict resolution strategy the solution space isexplored in a time driven manner where a transition is red whenever at least one transitionis enabled. In contrast, the reachability tree based methods enable to explore the solutionspace in an event driven manner. It is possible that a chosen ring sequence imposes one ormore intervals of idle time between transitions, i.e. some transitions are enabled but do notre due to waiting for enablement of another transition in accordance to the chosen sequence.The difference is important in cases when the optimal solution can be missed unless someidle time is included in the schedule as shown in [15]. In other words, the optimal solutiongenerally belongs to the class of semi-active schedules [16]. The schedules generated by anevent-driven reachability tree search are semi-active schedules.4.2. Algorithmically generated Petri net models and schedulesIn contrast to academic investigation of static scheduling problems the real manufacturingenvironment is far more dynamic. Planned work orders are often changing, priority ordersare inserted, planned resources may become unavailable. A fast derivation of models thatadequately represent the current situation in the process is therefore of extreme importancefor a usable scheduling system. The above described automatic generation of Petri net modelscan be effectively used for these purposes.The proposed algorithm also allows for specic process sequence structures typical for batchprocesses. E.g., the scheduling literature typically addresses a type of problems where aresource required by an operation is released as soon as the operation is nished. This istypical in the discrete industry, where intermediate products are stored in buffer zones inbetween machines. In batch processes the situation is different in the sense that a resource,e.g. a reactor is used both for processing and intermediate storage. The resource can beoccupied by a number of successive operations, which can be easily modelled by Petri nets.Furthermore, the use of timestamped tokens provides a convenient representation of the timestatus of the processed work orders.16 Petri Nets Manufacturing and Computer ScienceAutomated Petri-Net Modelling for Batch Production Scheduling 154.3. Evaluation of schedulesAs the majority of commonly used scheduling objective functions are based on completiontimes of the jobs or work orders and due dates, the timed Petri net modelling frameworkyields a possibility to use the same kind of model with an objective function tailored to theneeds of the particular production scenario.In the eld of deterministic scheduling the objective to be minimised is always a functionof the completion times of the jobs or work orders [16]. This ts well in the timed Petri netscheduling framework where the time evolution of the net marking depends on timestampsassociated with the tokens. If the schedule is modelled properly, the work order completiontimes can be read from the timestamps of tokens in the nal marking obtained by timed Petrinet simulation.Let oji denote the i-th operation of work order j. Let Cji denote the completion time of theoperation oji. The completion time of the work order, i.e. the completion of the last operationof the work order is denoted by Cj.During the timed Petri net marking evolution, start of oji corresponds to triggering of a relatedtransition tji. Associated delay f (tji) corresponds to duration of oji. Following the ring rule,the transition output places are marked with tokens whose time attribute is set to @(ji +f (tji)) if ji denotes the moment of transition ring, i.e., the release time of oji. The generatedtimestamp equals the completion time of oji: Cji = ji + f (tji).Assuming the timed Petri net model of scheduling problem as described above, letpWO_j_end P denote the j-th work order end place, i.e. the place that holds a tokenrepresenting nished status of the work order. Let Mf denote the nal marking reached afterall the operations had been nished. If a token in pWO_j_end corresponds to nishing the lastoperation of work order WOj then Mf (pWO_j_end) = 1@Cj. Therefore the completion timescan be read from Mf (pWO_j_end): Cj = Mf (pWO_j_end) TSMS.4.3.1. MakespanMakespan Cmax is equivalent to the completion time of the last nished work order: Cmax =max(C1, . . . , Cn). Considering the above notationCmax = max(Mf (pWO_j_end)), j = 1 . . . n (1)4.3.2. Total weighted completion timeThe sum of weighted completion times gives an indication of the inventory costs related to aschedule [16]. Given a nal marking Mf the cost can be calculated aswjCj =nj=1wjMf (pWO_j_end) (2)4.3.3. TardinessIf a set of due dates dj is adjoined to the work orders, the tardiness of a work order is denedas the difference Cjdj if positive, and 0 otherwise:17 Automated Petri-Net Modelling for Batch Production Scheduling16 Will-be-set-by-IN-TECHTj = max(Mf (pWO_j_end) dj, 0) (3)In contrast to objective measures, which are related to nal marking, the initial marking canbe used to specify release dates of work orders. If a token in pWO_j_st corresponds to the initialrequest of work order WOj, and rj is a corresponding release date then M0(pWO_j_st) shouldcontain a token [email protected]. A case study: Multiproduct batch plantThe applicability of our approach will be demonstrated on the model of a multiproduct batchplant designed and built at the Process Control Laboratory of the University of Dortmund.The demonstration plant is relatively simple compared to industrial-scale plants, but posescomplex control tasks. A detailed description of the plant can be found in [17].In the following a brief description of the plant will be given. From the data given inproduction management systems a timed Petri-net model is built. With the help of asimulator/scheduler using different scheduling rules, different schedules can be achieved.At the end the results for the given problem are presented and compared with the resultsachieved with other techniques.5.1. Description of the plantThe process under consideration is a batch process that produces two liquid substances, oneblue, one green, from three liquid raw materials. The rst is coloured yellow, the second redand the third is colourless. The colourless sodiumhydroxide (NaOH) will be referredto belowas white. The chemical reaction behind the change of colours is the neutralisation of dilutedhydrochloric acid (HCl) with diluted NaOH. The diluted HCl acid is mixed with two differentpHindicators to make the acid look yellowif it is mixed with the rst one and red when mixedwith the second one. During the neutralisation reaction the pH indicators change their colourwhen the pH value reaches approximately 7. The rst indicator changes from yellow to blue,and the second from red to green.The plant consists of three different layers, see Figure 11. The rst layer consists of thebuffering tanks B11, B12 and B13, which are used for holding the raw materials "Yellow","Red" and "White". The middle layer consists of three stirred tank reactors, R21, R22 and R23.Each reactor can be lled from any raw-material buffer tank. The production involves llingthe reactor with one batch of "Yellow" or "Red" and then neutralising it with one batch of"White". The lower layer consists of two buffer tanks, B31 and B32, in which the products arecollected fromthe middle layer. Each of themis used exclusively for "Blue" or "Green" and cancontain three batches of product. The processing times of the plant are presented in Table 3.The system can be inuenced through different inputs, pumps P1-P5 and valves V111-V311.5.2. The scheduling problemThe plant provides a variety of scheduling problems. In our case we are dealing with aproblem, where we have a demand to produce a certain amount of nished products. Alsothe starting times of every work order are given. Our task is to determine when raw materialsmust be available and when the overall production process will be nished. Our goal is tonish the production in the shortest time.18 Petri Nets Manufacturing and Computer ScienceAutomated Petri-Net Modelling for Batch Production Scheduling 17B11R22B32B31R23 R21B13 B12V113V111 V112V131V121 V123V212V122V221 V222V231V133V132V211V232P4V312 V311P3 P2 P1P5Figure 11. Multiproduct batch plant.Process Time(s)Pumping 1 batch "Yellow" into B11 12Pumping 1 batch "Red" into B12 12Pumping 1 batch "White" into B13 12Draining 1 batch "Yellow" into R21 15Draining 1 batch "Red" into R21 11Draining 1 batch "White" into R21 10Draining 1 batch "Yellow" into R22 12Draining 1 batch "Red" into R22 13Draining 1 batch "White" into R22 9Draining 1 batch "Yellow" into R23 12Draining 1 batch "Red" into R23 14Draining 1 batch "White" into R23 13Draining 1 batch "Blue" from R21 into B31 12Draining 1 batch "Green" from R21 into B32 13Draining 1 batch "Blue" from R22 into B31 12Draining 1 batch "Green" from R22 into B32 12Draining 1 batch "Blue" from R23 into B31 12Draining 1 batch "Green" from R23 into B32 12Pumping 3 batches "Red" out of B31 30Pumping 3 batches "Green" out of B32 30Table 3. Processing times.Work orders, given in table 4, illustrate the problem, where six batches of "Blue" (PB) and sixbatches of "Green" (PG) products have to be produced. It follows that we need six batches of"Yellow" and "Red" raw materials and twelve batches of "White" raw material.19 Automated Petri-Net Modelling for Batch Production Scheduling18 Will-be-set-by-IN-TECHProduct Code Amount Starting timeBlue PB 6 0Green PG 6 0Table 4. Work orders.5.3. Structure of the production facility given in production management systemData about the production process and its structure can be obtained from the productionmanagement information systems. These data can be presented in a form of a recipe andthe formula as described in chapter 3.4.There are two recipes available, which are specifying a sequence of operations needed toproduce product "PB" and product "PG". They are given with tables 5 and 6.Operation Duration ResourcesPB Op10 BOM_BOp20 draining R2x in B31 12/12/12 [R_1](R21/R22/R23), B31Op30 pumping from B31 30 (3 1)B31Y Op10 pumping Y in B11 12 [BY_1](B11)Op20 draining B11 in R2x 15/12/12 [R_3](R21/R22/R23), [BY_2](B11)WB Op10 pumping W in B13 12 [BW_1](B13)Op20 draining B13 in R2x 10/9/13 [R_2](R21/R22/R23), [BW_2](B13)Table 5. Recipe of a product "PB".Operation Duration ResourcesPG Op10 BOM_ GOp20 draining R2x in B32 13/12/12 [R_ 1](R21/R22/R23), B32Op30 pumping from B32 30 (3 1)B32R Op10 pumping Y in B12 12 [BR_ 1](B12)Op20 draining B12 in R2x 11/13/14 [R_ 3](R21/R22/R23), [BR_ 2](B12)WG Op10 pumping W in B13 12 [BW_ 1](B13)Op20 draining B13 v R2x 10/9/13 [R_ 2](R21/R22/R23), [BW_ 2](B13)Table 6. Recipe of a product "PG".To produce Blue product ("PB"), rstly operation Op10 has to be carried out. This operationdetermines only that a sub-product, dened with formula "B", is needed. When thissub-product is ready, two more operations are needed. Op20 gives information about drainingthe product into the buffer tank B31 and Op30 about pumping the nal product out of thatbuffer tank. The fact, that buffer tank could not be emptied before three batches of sub-product"B" are poured in it, is described with this notation: (3 1) B31.In batch manufacturing situations when one task has to be executed with a (group of)resource(s), that were used to execute a previous task already are common. These resourcesare in our case labelled with an additional mark, i.e. code with serial number in squarebrackets is added in front of this resource(s). For example, this occurs in our case when oneof the reactor is being used. Code [R_1] is assigned to the reactor (from a group of reactorsR2x) which is needed for operation Op20 when producing product "B" and indicates that thisresource can now be released. Note, that this resource was assigned with an operation wherecode [R_3] was used already (Op10 of a sub-product "Y").20 Petri Nets Manufacturing and Computer ScienceAutomated Petri-Net Modelling for Batch Production Scheduling 19Formula given in Table 7 lists the rawmaterials needed to produce items "B" and "G". Item "B"represents a sub-product that is needed for operation Op10 of a recipe "PB". The productionof one item "B" requires one "Yellow" ("Y") and one "White" ("WB") batches (items). Each ofthese two items are produced with two operations. Note that some batch-specic precedenceconstraints exists. Operation Op20 of item "Y" precede operation Op20 of item "WB". Thestructure of item "G" is given in a similar way.Item Sub-item Quantity Preced. constr.B Y, Op10 1 0 0 0 0Y, Op20 0 0 0 1WB, Op10 1 0 0 0 0WB, Op20 0 0 0 0G R, Op10 1 0 0 0 0R, Op20 0 0 0 1WG, Op10 1 0 0 0 0WG, Op20 0 0 0 0Table 7. Formula for the items "B" and "G".5.4. ModellingIn this subchapter production process described previously is modelled with timed Petri nets.To build a model the algorithm from Chapter 3.5 is used. This model can later be used toschedule all the tasks, that are necessary to produce as much nal products as required bywork orders.From work orders, given in table 4 it is recognised which and how much of each products arerequired. Let start with the procedure on building the Blue product ("PB"). When applyingthe rst step of our algorithm, the PN structure shown in gure 12 is achieved.pWOPBst pWOPBinpPBop pWOPBoutpWOPBendtWOPBin tPBin tPBouttWOPBout6 6PBFigure 12. PN model of PB product.In the second step, additional information are added into this model (framed part of gure 12).Data about all the details are gathered from recipe list of product "PB" (table 5). Informationabout emptying the buffer tank B31 (Op30) and draining the reactor R2x (Op20) are added.As operation (Op20) needs resources, that are used by previous operations, not all details areadded yet at this place. A model, shown in Figure 13 is achieved.tPBinptPB1opB3133330 XPB1outBtPB2 tPB3pPB2op pPB3optPBoutFigure 13. PN model of PB product.21 Automated Petri-Net Modelling for Batch Production Scheduling20 Will-be-set-by-IN-TECHOperation Op10 (place PPB1op) is dened with formula for item "B" (see table 7). It representsa mixing operation of two raw materials "Y" and "WB". Both sub-items are described withtwo operations, where precedence constraints are included as given with formula. Figure 14shows how this formula information is modelled with Petri nets.prWB, Op.1Y, Op.1 Y, Op.2WB, Op.2tY_2pY_2optWB_2pWB_2optY_1pY_1optWB_1pWB_1optPB1outtPBinFigure 14. PN model of PB product with inserted BOM information.In gure 15 some parts of a model given in gure 14 are simplied and information about theusage of rectors R2x is added.prR2xB31XWB, Op.1Y, Op.1 Y, Op.2WB, Op.2 =tPB2 pPB2optY_2pY_2optWB_2pWB_2optY_1pY_1optWB_1pWB_1optPB1outtPBinFigure 15. PN model of PB product.As there are three possible reactors (R21, R22 or R23) that can be used to perform theseoperations this model is extended with the structure given in gure 16.With this procedure a detailed timed Petri-net model of the production of the blue product("PB") is obtained. The same procedure was performed to model also the production of greenproduct ("PG"), and a Petri net model given in gure 17 is achieved.5.5. ResultsThe resulting model was at the end veried using P-invariant analysis. We can nd out elevenP-invariant, where eight of them refer to resources and three of them to the production routes.In this way a Petri net model of a multiproduct batch plant was achieved on which differentscheduling algorithms can be performed in order to obtain the most effective production.Petri-net simulation was used to evaluate different schedules of tasks that are needed toproduce the desired amount of nal products. Makespan was the performance measure ofinterest. The schedule allows an easy visualisation of the process and ensures that sufcientraw materials ("Yellow", "Red" and "White" batches) are available at the right time. It respects22 Petri Nets Manufacturing and Computer ScienceAutomated Petri-Net Modelling for Batch Production Scheduling 21pr2R22B31pr3R23pr1R2112121291310121512WB, Op.1Y, Op.1tPB2_3pPB 2 _ _3optY_1pY_1optWB_1pWB_1optY_2_1pY_2_1optWB_2_1pWB_2_1optY_ _3 2pY_2_3optWB_2_3pWB_2_3optY_2_2pY_2_2optWB_2_2pWB_2_2optPB2_2pPB2_2optPB2_1pPB2_1optPBinFigure 16. PN model of PB product.all the production constraints and the duration of the whole process can be identied. Aschedule of the batch process using SPT priority rule is given with Gantt chart (gure 18).The results were compared with the results obtained using various algorithms and arepresented in table 8.Algorithm MakespanSPT rule 315sLPT rule 331sBranch and Bound ([17]) 323sMS Project ([3]) 329sTable 8. Results.23 Automated Petri-Net Modelling for Batch Production Scheduling22 Will-be-set-by-IN-TECHpB11B12R21R22R23B32B13B32p3333336pt6ttPB3p6tWOPGout61212121215129101313111412129101312123030WOPBstWOPBppWOPGstWOPGWOPBoutPB3opppWOoutPGWOendPGtWOPBoutpWOPBendtPB2_2pPB2op_212tPB2_1pPB2op_1tPB2_3pPB2op_3tPG2_2pPG2op_213tPG2_1pPG2op_1tPG2_3pPG2op_3tPG3pPG3optWG_2_2pWG_2op_2tWG_2_1pWG_2op_1tWG_2_3pWG_2op_3tR_2_2pR_2_2optR_2_1pR_2_1optR_2_3pR_2_3optWB_2_2pWB_2op_2tWB_2_1pWB_2op_1tWB_2_3pWB_2op_3tY_2_2pY_2_2optY_2_1pY_2_1optY_2_3pY_2_3optWB_1pWB_1optY_1pY_1optR_1pR_1opWOPBinWOPGinFigure 17. PN model of the production plant.24 Petri Nets Manufacturing and Computer ScienceAutomated Petri-Net Modelling for Batch Production Scheduling 23Figure 18. Production schedule.6. ConclusionA procedure for using existing data from production management systems to build thePetri-net model was developed. Timed Petri nets with the holding-duration principle oftime implementation were used to model basic production activities. For the purposes ofscheduling, different heuristic rules can be used within Petri net simulation. The applicabilityof the proposed approach was illustrated on a practical scheduling problem, where the dataabout the production facility is given with the formula and recipe. The model achieved withthe proposed method was used to determine a schedule for production operations. Theproposed method is an effective way to get an adequate model of the production process,which can be used to develop different analyses of the treated system, e.g. schedules.AcknowledgementsThe work was done in the frame of the Competence Centre for Advanced ControlTechnologies. Operation is partly nanced by the Republic of Slovenia, Ministry of Education,Science, Culture and Sport and European Union (EU) - European Regional DevelopmentFund.Author detailsDejan GradiarJoef Stefan Institute, SloveniaGaper Mui cFaculty of Electrical Engineering, University of Ljubljana, Slovenia25 Automated Petri-Net Modelling for Batch Production Scheduling24 Will-be-set-by-IN-TECH7. References[1] ANSI/ISA [1995]. ANSI/ISA-88.01-1995 Batch Control Part 1: Models and Terminology(Formerly ANSI/ISA-S88.01-1995), ANSI/ISA.[2] Bowden, F. D. J. [2000]. A brief survey and synthesis of the roles of time in Petri nets,Mathematical and Computer Modelling 31(10-12): 5568.[3] Gradiar, D. & Mui c, G. [2004]. Scheduling production activities using project planningtool, Electrotechnical Review 71(3): 8388.[4] Gu, T. & Bahri, P. A. [2002]. A survey of Petri net applications in batch processes,Computers in Industry 47(1): 99111.[5] Haupt, R. [1989]. A survey of priority rule-based scheduling, OR Spectrum 11(1): 316.[6] Hillah, L., Kindler, E., Kordon, F., Petrucci, L. & Treves, N. [2009]. A primer on the Petrinet markup language and ISO/IEC 15909-2, Petri Net Newsletter 76: 928.[7] ISA [2008]. ISA-TR88.95.01 Using ISA-88 and ISA-95 Together, ISA.[8] Jain, A. & Meeran, S. [1999]. Deterministic job-shop scheduling: Past, present and future,European Journal of Operational Research 113(2): 390434.[9] Jensen, K. [1997]. Coloured Petri nets. Basic concepts, analysis methods and practical use,Springer-Verlag, Berlin.[10] Lakos, C. & Petrucci, L. [2007]. Modular state space exploration for timed Petri nets,International Journal on Software Tools for Technology Transfer 9: 393411.[11] Lee, D. &DiCesare, F. [1994]. Scheduling exible manufacturing systems using Petri netsand heuristic search, IEEE Trans. on Robotics and Automation 10(2): 123132.[12] Mndez, C., Cerd, J., Grossmann, I. E., Harjunkoski, I. & Fahl, M. [2006]. State-of-the-artreview of optimization methods for short-term scheduling of batch processes, Computers& Chemical Engineering 30(6-7): 913946.[13] Mui c, G. [2009]. Petri net base scheduling approach combining dispatching rules andlocal search, 21st European Modeling & Simulation Symposium, Vol. 2, Puerto de La Cruz,Tenerife, Spain, pp. 2732.[14] Nortcliffe, A. L., Thompson, M., Shaw, K. J., Love, J. &Fleming, P. J. [2001]. A frameworkfor modelling in S88 constructs for scheduling purposes, ISA Transactions 40(3): 295305.[15] Piera, M. A. &Mui c, G. [2011]. Coloured Petri net scheduling models: Timed state spaceexploration shortages, Math.Comput.Simul. 82: 428441.[16] Pinedo, M. L. [2008]. Scheduling: Theory, Algorithms, and Systems, 3rd edn, SpringerPublishing Company.[17] Poto cnik, B., Bemporad, A., Torrisi, F., Mui c, G. & Zupan ci c, B. [2004]. Hybridmodelling and optimal control of a multi product bach plant, Control Engineering Practice12(9): 11271137.[18] Silva, M. & Teruel, E. [1997]. Petri nets for the design and operation of manufacturingsystems, European Journal of Control 3(3): 182199.[19] Tuncel, G. & Bayhan, G. [2007]. Applications of petri nets in production scheduling: areview, The International Journal of Advanced Manufacturing Technology 34(7-8): 762773.[20] Wijngaard, J. & Zijlstra, P. [1992]. MRP application the batch process industry, ProductionPlanning & Control 3(3): 264270.[21] Wortmann, H. [1995]. Comparison of information systems for engineer-to-order andmake-to-stock situations, Computers in Industry 26(3): 261271.[22] Yu, H., Reyes, A., Cang, S. & Lloyd, S. [2003]. Combined Petri net modelling andAI based heuristic hybrid search for exible manufacturing systems-part II: Heuristichybrid search, Computers and Industrial Engineering 44(4): 545566.[23] Zuberek, W. M. [1991]. Timed petri nets: denitions, properties and applications,Microelectronics and Reliability 31(4): 627644.26 Petri Nets Manufacturing and Computer ScienceChapter 0Specifying and Verifying Holonic Multi-AgentSystems Using Stochastic Petri Net and Object-Z:Application to Industrial MaintenanceOrganizationsBelhassen Mazigh and Abdeljalil Abbas-TurkiAdditional information is available at the end of the chapterhttp://dx.doi.org/10.5772/502291. IntroductionIn Industrial Maintenance Company (IMC) a vast number of entities interact and the globalbehaviour of this system is made of several emergent phenomena resulting from theseinteractions. The characteristics of this system have increased both in size and complexityand are expected to be distributed, open and highly dynamic. Multi-Agent Systems (MAS)are well adapted to handle this type of systems. Indeed, the agent abstraction facilitates theconception and analysis of distributed microscopic models [9]. Using any holonic perspective,the designer can model a system with entities of different granularities. It is then possibleto recursively model subcomponents of a complex system until the requested tasks aremanageable by atomic easy-to-implement entities. In multi-agent systems, the vision ofholons is someway closer to the one that MAS researchers have of Recursive or Composedagents. A holon constitutes a way to gather local and global, individual and collectivepoints of view. A holon is a self-similar structure composed of holons as sub-structures. Ahierarchical structure composed of holons is called a holarchy. Aholon can be seen, dependingon the level of observation, either as an autonomous atomic entity or as an organisation ofholons (this is often called the Janus effect [12]). Holonic systems have already been used tomodel a wide range of systems, manufacturing systems [15, 16, 33], health organizations [32],transportation [2], etc. The different organisations which make up an IMC must collaboratein order to nd and put in place various strategies to maintain different production sites.In order to honour its contracts, the IMC should handle the whole of its resources (humanand material), ensure the follow up in real time the equipment in different production sitesand plan actions to be executed. A part of the maintenance could be remotely achieved(tele-maintenance and/or tele-assistance [17], e-maintenance [13], etc.). Several constraintsshould be integrated in the process of strategy search and decision making before mobilizingoperation teams. Concretely, the search for an efcient maintenance strategy should beChapter 22 Will-be-set-by-IN-TECHfound while taking into account the following constraints: (a) The urgency level of themaintenance task requested by a given production site, (b) A distance between mobile teamsand production sites, (c) The estimated intervention duration, (d) The respect of the legal dailyworking time of maintenance crew, (e) Verication of the availability of the stored spare parts,(f) The reconstitution of new teams in view of the mentioned constraints.To satisfy some of these constraints, we propose a formal holonic approach for modellingand analysis all the entities that constitutes an IMC. We use Holonic Multi-Agent Systems(HMAS) in which holons are agents that may be composed of agents for developing complexsystems. To this end, we use an Agent-oriented Software Process for Engineering ComplexSystems called ASPECS [8]. The process is considered by their authors as an evolution of thePASSI [3] process for modelling HMAS and it also collects experiences about holon designcoming from the RIO (Role, Interaction and Organization) approach [11]. It is sufcient tosay that the denition of the MAS meta-model adopted by the new process has been therst step and from this element all the others (activities, guidelines and workow) havebeen built according to this guideline [4, 30, 31]. This meta-model denes the underlyingconcepts. A step-by-step guide from requirements to code allows the modelling of a systemat different levels of details. Going from each level to the next consists in a renement ofthe meta-model concepts. The objective of this work consists in consolidating the ASPECSmethodology by using a formal specication and analysis of the various organizations andthe interactions between them. This phase will facilitate the code production of organizations,roles and holons. In addition, it will be possible to test each organization, their roles and eachholons independently. This type of analysis, will allow checking certain qualitative propertiessuch as invariants and deadlock, as well as a quantitative analysis to measure the indicatorsof performance (cost of maintenances, average duration of the interventions, average timeto reach a site of production, etc). In this chapter, our extended approach will be used tomodel and analyze an Industrial Maintenance Company (IMC). After a brief presentation ofthe framework, the maintenance activities in a distributed context are presented. ASPECSprocess and modelling approach will be introduced in section 3. Analysis and conceptionphase of this process and their associated activities are then described in order to identifythe holonic IMC organisation. In section 4, rst we present our specication formalism andsecond we assign an operational semantics to it. Additionally, we illustrate how to use theoperational semantics as a basis for verication purposes. The specication formalism weintend to present combines two formal languages: Stochastic Petri Nets and Object-Z. Finally,Section 5 summarises the results of the chapter and describes some future work directions.2. Industrial maintenance company distributed contextFor economic and/or efcacy reasons, many companies are being implanted in geographicallywide spread areas. Hence, many IMC are compelled to represent their organisations so as tomeet efciently the demands of their clients. Therefore this activity is among those witnessinga rise on the word market in spite of the economic moroseness (particularly large scale andmultiple competence maintenance companies). In this distributed context, the maintenanceactivities are divided on two following structures: (a) Central Maintenance Teams (CMT)which realizes the process of reparation - corrective maintenance, (b) Mobile MaintenanceTeams (MMT) which carries out inspections, replacement and several other actions on thevarious production sites.To ensure the maintenance of several production sites, many teams specialized in variouscompetence elds should be mobilized. Those in charge of handling these resources should28 Petri Nets Manufacturing and Computer ScienceSpecifying and Verifying Holonic Multi-Agent Systems Using Stochastic Petri Net and Object-Z: Application to Industrial Maintenance Organizations 3overcome complex logistical problems thereby the need to develop aiding methods and toolsfor decision making to efciently manage this type of organizations. Among the servicesproposed by an IMC, we can mention: (a) On site intervention, (b) Technical assistancevia telephone or distance intervention, (c) The study and improvement of equipment, (d)Organisation and engineering, (e) Formation in industrial maintenance, (f) The search forand the development of new maintenance methods. The focus in this research is to ndan efcient maintenance policies taking into account multiples alias. We propose a formalapproach, based on the paradigm HMAS, to specify and analyze an efcient and adaptiveIMC. As such, a specication approach based on HMAS to be a promising approach todeal with the unpredictable request of maintenance due to their decentralization, autonomy,cooperation features and their hierarchical ability to react to unexpected situation. For thisspecication, we use ASPECS methodology to identify holonic organization of a steadysystem and we combine two formal languages: Object-Z and Petri Nets for modeling andanalysis specication of an IMC.3. A holonic specication approach of an IMC3.1. A quick overview of ASPECS processThe ASPECS process structure is based on the Software Process Engineering Metamodel(SPEM) specication proposed by OMG [25]. This specication is based on the idea that asoftware development process is collaboration between abstract active entities, called Rolesthat performoperations, called Activities, on concrete, tangible entities, called Work Products.Such as it was proposed by [4], ASPECS is a step-by-step requirement to code softwareengineering process based on a metamodel, which denes the main concepts for the proposedHMAS analysis, design and development. The target scope for the proposed approachcan be found in complex systems and especially hierarchical complex systems. The mainvocation of ASPECS is towards the development of societies of holonic (as well as not-holonic)multi-agent systems. ASPECS has been built by adopting the Model Driven Architecture(MDA) [25]. In [5] they label the three meta-models "domains" thus maintaining the link withthe PASSI meta-model. The three denite elds are: (a) The Problem Domain. It provides theorganisational description of the problem independently of a specic solution. The conceptsintroduced in this domain are mainly used during the analysis phase and at the beginning ofthe design phase, (b) The Agency Domain. It introduces agent-related concepts and providesa description of the holonic, multi-agent solution resulting from a renement of the ProblemDomain elements, (c) The Solution Domain is related to the implementation of the solutionon a specic platform. This domain is thus dependent on a particular implementation anddeployment platform.Our contribution will relate to the consolidation of the Problem Domain and the AgencyDomain. We propose a formal specication approach for analysis the various organizationsand the interactions between them facilitating therefore the Solution Domain.3.2. Requirements analysisThe analysis phase needs to provide a complete description of the problem based on theabstractions dened in the metamodel problemdomain CRIO(Capacity, Role, Interaction andOrganization). All the activities that make up this rst phase and their main products can beidentied. Indeed, this phase shows the different steps that can be used for the requirements29Specifying and Verifying Holonic Multi-Agent Systems Using Stochastic Petri Net and Object-Z: Application to Industrial Maintenance Organizations4 Will-be-set-by-IN-TECHsince the description of the eld requirements to capacities identication. It also shows howdocuments and UML diagrams must be constructed for each step. In the following, we presentobjective, description and diagrams for each step used in the requirements analysis phase.3.2.1. Requirements domain descriptionThe aim of this phase is to develop a rst description of the application context and itsfunctionalities. This activity aims to identify, classify and organize in hierarchy all functionaland non functional requirements of different project actors. It must also provide a rstestimated scope of the application as well as its size and complexity. In this work, the analysisapproach adopted is based on the use case UML diagrams. To facilitate the analysis andreduce the complexity of the system studied, we decomposed the system studied into threemodules: Mobile Maintenance Teams (MMT), Maintenance Policies (MP) and MaintenanceMediation (MM) which plays the role of mediator between the rst two as shown in Figure 1.Let us now explain the role of each part of the system. The objective of "Mobile MaintenanceFigure 1. Set parts associated to the IMCTeams" (MMT) is: (a) Receive maintenance requests from "Mediation Maintenance", (b)Planning for maintenance actions, (c) Execute maintenance tasks, (d) Generate maintenancereport. The role of "Mediation Maintenance" (MM) is: (a) Receive maintenance requests ofdifferent production sites, (b) Diagnosing problems, (c) Classify problems, (d) Respondingto customers, (e) Send request maintenance to MMT or MP, (f) Receive execution plans ofmaintenance from MT or MP if necessary. The objective of "Maintenance Policies" (MP) is: (a)Receive maintenance requests from "Mediation Maintenance", (b) Scheduling maintenancetasks, (c) Execute maintenance tasks, (d) Generate maintenance report, (e) Send report tomaintenance "Mediation service", (f) Develop newmaintenance methods, (g) Provide trainingmaintenance.As an example, well just show the use case diagram of different scenarios associated to theMMT (Figure 2.). Similarly, we can use identical approach to describe other roles and establishtheir use case diagrams.3.2.2. Problem ontology descriptionFirst, problem ontology provides a denition of the application context and specic domainvocabulary. It aims to deeper understanding the problem, completing requirements analysisand use cases, with the description of the concepts that make up the problem domain andtheir relationships. Ontology plays a crucial role in ASPECS process development. Indeed, itsstructure will be a determining factor for identifying organizations. The ontology is describedhere in terms of concepts, actions and predicates. It is represented using a specic prole forUML class diagrams. The ontology of the IMC is described in Figure 3.This ontology represents the knowledge related to the Mobile Maintenance Teams, MediationMaintenance, Maintenance Policies, the different concepts that compose and the relationshipsbetween these components.30 Petri Nets Manufacturing and Computer ScienceSpecifying and Verifying Holonic Multi-Agent Systems Using Stochastic Petri Net and Object-Z: Application to Industrial Maintenance Organizations 5Figure 2. Use case diagram of Mobile Maintenance Teams3.2.3. Identifying organizationsThis action must establish a decomposition of the organizational system and dene theobjectives of each organization. Every needs identied in the rst activity, has an associatedorganization incarnating the global behavior in charge to satisfy or to realize. Identiedorganizations are added directly to the use case diagram, in the form of packages includingstereotyped use cases diagram that are responsible to satisfy. The Mobile Maintenance Teamsorganization can be decomposed into three sub-organizations: MMT Forwarding, TasksPlanning and Tasks Execution as shown in Figure 4.The same process can be used to describe Mediation and Mobile Maintenance Teamsorganization. According to this decomposition, we can obtain organizational hierarchy ofthe IMC (Figure 5).In this hierarchy, MMT Forwarder serves as an intermediary between Mediation Maintenanceand Mobile Maintenance Teams. Similarly, CMT Forwarding is directly linked to bothorganizations Mediation Maintenance and Maintenance Policies.3.2.4. Identication of roles and interactionsThe context and objectives of each organization are now identied. The identication of rolesand interactions aims to decompose the global behavior incarnated by an organization intoa set of interacting roles. This activity must also describe the responsibilities of each role insatisfying the needs associated with their respective organizations. Each role is associatedwith a set of concepts in the ontology and generally a subset of those associated with hisorganization. Roles and interactions that constitute each organization are added to theirclass diagrams as described in Figure 6. A role is represented by a stereotyped class, andan interaction between two roles is represented by an association between classes of roles.Note also that in this gure, the link "Contributes to" means that an organization contributesin part to the behavior of a role at a higher level of abstraction.3.2.5. Description of interaction scenariosThe objective of this activity is to specify the interactions between roles to induce higher levelbehavior. This activity describes the interactions between the roles dened within a given31Specifying and Verifying Holonic Multi-Agent Systems Using Stochastic Petri Net and Object-Z: Application to Industrial Maintenance Organizations6 Will-be-set-by-IN-TECHFigure 3. Ontology of the IMC system32 Petri Nets Manufacturing and Computer ScienceSpecifying and Verifying Holonic Multi-Agent Systems Using Stochastic Petri Net and Object-Z: Application to Industrial Maintenance Organizations 7Figure 4. Mobile Maintenance Teams Organizationorganization and species the means of coordination between them to meet the objectivesof their organization. Consequently, each organization is associated with at least onescenario and it may involve dened roles in different organizations. Indeed, an organizationusually requires information from other organizations at different level of abstraction. Thescenarios detail the sequence of arrival or transfer of such information. Describing interactionscenarios is supported by a set of UML sequence diagrams. An example of interactionscenario associated with the organization IMC system is shown in Figure 7. This diagramabove describes possible scenarios within the organization "Mobile Maintenance Teams".For each received request, "Planning Tasks" will schedule maintenance tasks and "TasksExecution" executes maintenance tasks and nally generates a maintenance report. Scenariosof "Mediation Maintenance" and "Maintenance Policies" organization are not complicated andare not represented here.3.2.6. Behavioral roles plans of organizationsThe description of the behavior plans of roles specify the behavior of each role adapted withthe objectives assigned to it and interactions in which it is implicated. Each plan describes thecombination of behavior and sequencing of interactions, external events and tasks that makeup the behavior of each role. Figure 8 shows the behavior plans of the roles that constitute theIMC organizations.3.2.7. Identication of capacitiesThis activity aims to increase the generic behavior of roles by separate clearly the denitionof these behaviors of their external dependencies organizations. It is particularly to rene thebehavior of roles, to abstract the architecture of the entities that will play them, and ensuring33Specifying and Verifying Holonic Multi-Agent Systems Using Stochastic Petri Net and Object-Z: Application to Industrial Maintenance Organizations8 Will-be-set-by-IN-TECHFigure 5. Organizational hierarchy of the IMC34 Petri Nets Manufacturing and Computer ScienceSpecifying and Verifying Holonic Multi-Agent Systems Using Stochastic Petri Net and Object-Z: Application to Industrial Maintenance Organizations 9Figure 6. Description of a few roles and interactions of the IMC organization35Specifying and Verifying Holonic Multi-Agent Systems Using Stochastic Petri Net and Object-Z: Application to Industrial Maintenance Organizations10 Will-be-set-by-IN-TECHFigure 7. Description of interaction scenarios for MMTFigure 8. Behavioral roles plans description of the IMC organizationtheir independence from any external element not associated to them. The identication ofcapacity needs to determine the competences set required for each role. Capacities are addedas stereotyped classes in UML class diagrams of the organizations concerned. In our case, wewill identify the capacities required by the roles of the IMC organization (Figure 9).36 Petri Nets Manufacturing and Computer ScienceSpecifying and Verifying Holonic Multi-Agent Systems Using Stochastic Petri Net and Object-Z: Application to Industrial Maintenance Organizations 11Figure 9. Identication of capacities required by the roles of the IMC organization3.3. Holarchies designAt this stage of the process, all system organizations, their roles and associatedcommunications are now fully described and specied. Holarchies design is the last activityof the design phase. It performs a global synthesis in which the results of all previous workare summarized and combined in one product. It is devoted to the agentication of theorganizational hierarchy and the denition of the entities in charge of running it. Its objectiveis to dene holons system and deduce the holarchy structure. To build the holarchy of thesystem, the organizations that compose the system are instantiated as groups. A set of holonsis then created at each level, each playing one or more roles in one or more groups in thesame level. Composition relations between super-holons and sub-holons are then speciedin accordance with the contributions from the organizations dened in the organizationalhierarchy. The organizational hierarchy is directly associated with the hierarchy of holons(or holarchy). The dynamics governing rules of holons, and the types of governance of eachcomposed holon, ar