**3.2. Modelling of production activities**

Here we present a method of describing the production-system activities with timed Petri nets using the holding-duration representation of time. The places represent resources and jobs/operations, and the transitions represent decisions or rules for resources assignment/release and for starting/ending jobs.

To make a product, a set of operations has to be performed. We can think of an operation as a set of events and activities. Using a timed PN, events are represented by transitions and activity is associated with the presence of a token in a place.

An 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 event that starts the operation occurs, *t*1. This transition also determines the processing time of an operation. During that time the created token is unavailable in place *p*<sup>2</sup> and the operation is being executed. After that time the condition for ending the operation is being satisfied and *t*<sup>2</sup> can be fired. Place *p*<sup>1</sup> is not a part of the operation, it determines the input condition, e.g. the availability of the input material.

**Figure 1.** Operation described with timed Petri net.

4 Will-be-set-by-IN-TECH

Different management systems (*ERP*) can be applied for different types of production systems to plan the production process activities. We are assuming here a management system that can provide plan for both, discrete and batch process. The system generates work orders that interfere with the demands for the desired products. Different jobs/procedures are needed to produce a desired product. Set of operations needed to produce one item represent a job. In general, more operations have to be performed using different resources in order to complete a specific job. To complete a specific product, more sub-products may be needed. To list these components 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 this way the general scheduling problem is defined that can be applied both in discrete or batch

• each operation can be processed on (more) different sets of resources *Sjkl* ∈ *R*; *l* determines

• Each resource can process a limited number of operations. This limitation is defined by the

• When an operation is performed, it is desirable to free the resources so that they can become available as soon as possible. Intermediate buffers between processes are common solutions. It is common for batch processes that successive operations need to be performed on the same resource as predecessor. In this case the resource is free when

• Work orders define the quantity of desired products and the starting times. Orders that are

Here we present a method of describing the production-system activities with timed Petri nets using the holding-duration representation of time. The places represent resources and jobs/operations, and the transitions represent decisions or rules for resources

To make a product, a set of operations has to be performed. We can think of an operation as a set of events and activities. Using a timed PN, events are represented by transitions and

• the processing time of each operation *ojkl*, using resource set *Sjkl*, is defined with *Tjkl*, • precedence constraints are used to define that some operations within one job has to be

production environment and can be given as:

the number of different sets,

capacity of resources.

• Operations are non pre-emptive.

the last operation is finished.

• *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*,

Using this definition, the following assumptions have to be considered:

performed before a set of operations in another job.

• Resources are always available and never break down.

• Processing times are deterministic and known in advance.

synchronised in time are considered jointly.

assignment/release and for starting/ending jobs.

activity is associated with the presence of a token in a place.

**3.2. Modelling of production activities**

When parallel activities need to be described the Petri-net structure presented in Figure 2 is used. Transition *t*<sup>0</sup> sets the input conditions for the parallel execution of two operations. In places *p*<sup>01</sup> and *p*<sup>02</sup> operations can wait for the available resource(s). The time delays of the transitions *t*11*in* and *t*12*in* define the duration of each operation. An available token in place *p*<sup>11</sup> (*p*12) indicates that operation is finished. Transition *t*<sup>1</sup> is used to synchronise both operations.

**Figure 2.** Two parallel operations.

An operation might need resources, usually with a limited capacity, to be executed; this is illustrated in Figure 3. Place *pR*<sup>1</sup> is used to model a resource *R*1. Its capacity is defined with the initial marking of that place. The resource is available to process the operation if there are enough available tokens in it. When the resource is used at the start of the operation the unavailable token appears in place *p*1*o p*. After the time defined by transition *t*1*in* the token becomes available, *t*1*out* is fired, and the resource becomes free to operate on the next job. For this reason zero time needs to be assigned to the transition *t*1*out*. An additional place *p*<sup>1</sup> models the control flow. When the token is present in this place, the next operation can begin.

**Figure 3.** Operation that uses a resource with finite capacity.

A particular operation can often be done on more different (sets of) resources with different availability, and the time duration can be different on each set of resources. An example where

#### 6 Will-be-set-by-IN-TECH 8 Petri Nets – Manufacturing and Computer Science Automated Petri-Net Modelling for Batch Production Scheduling <sup>7</sup>

an operation can be executed on two different sets of resources is shown in Figure 4. If the operation chooses resource *R*3, its time duration is determined with the transition *f*(*t*2*in*) = *td*2. Otherwise the set of resources, composed of *R*<sup>1</sup> and *R*2, is being selected and its operation time is defined with *f*(*t*1*in*) = *td*1.

p01

t 1in

t 3in

**Op3**

td3

td1

n

p1op p1

t 1out

**Op1 Op2**

ppr1

<sup>t</sup> <sup>p</sup> 3out 3op

p3

process. Work orders are used to determine which and how many of finished products have

The Bill of materials (BOM) is a listing or description of the raw materials and items that make up a product, along with the required quantity of each. In batch manufacturing other terms

• *q* : *E* → IN is the function that defines the quantities for each sub-item *ei*. **q** represents an

• *pre* : (*E* × *E*) → {0, 1} is a precedence-constraints function. It defines the precedence-constraints matrix **pre**, where **pre**(*i*, *j*) = 1 indicates that the *i*-th item precedes

*R* is a root item and represents the product that is composed of sub-items described with *ei* ∈ *E*. The number of required sub-items is determined with the vector **q**. When any sub-item has to be produced before another, the precedence function *pre* is used to define it. All the sub-items have to be finished before the operation for the subsequent sub-items can begin. A required property of **pre** is that only zero values can be on its diagonal, i.e. a sub-item cannot precede itself. An item is never allowed to become (indirectly) a component of itself. In other words, 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 definition is used to describe its dependencies. The items at the highest level of this structure represent a finished product, and those at the lower level represent raw materials. The items that

Table 1 shows an example of a BOM describing the production of product *I*, which is composed of three components, i.e., three items of *J*, one item of *K* and and two items of

t 2in

td2

p2

<sup>t</sup> <sup>p</sup> 2out 2op

Automated Petri-Net Modelling for Batch Production Scheduling 9

p03

**Figure 6.** Precedence constraint.

*3.3.1. Bill of materials (Formula)*

are used instead, i.e. Formula.

*BOM* = (*R*, *E*, *q*, *pre*), where:

• *R* = {*r*1} is a root item.

The BOM used in this work is defined as:

• *E* = {*e*1, ...,*ei*} is a finite set of sub-items,

represent raw materials do not have a BOM.

*i* × 1 column vector whose *i*th entry is *q*(*ei*).

the *j*-th item. It can also be interpreted as a directed graph.

to be produced.

**Figure 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., an automated guided vehicle (AGV) in a manufacturing system or a mixing reactor in a batch system. This can be modelled as shown in Figure 5.

**Figure 5.** Shared resource.

Precedence constraints are used to define technological limitations and the sequence of operations. An example of two successive operations is shown in Figure 6, depicted as *Op*1 and *Op*2. In this figure an example of technological limitations is also shown. Here, the situation where operation *Op*1 precedes operation *Op*3 is considered. For this purpose an additional place *ppr*<sup>1</sup> is inserted between the transition *t*1*out* (ending *Op*1) and the transition *t*3*in* (starting *Op*3). The weight *n* of the arc, which connects *ppr*<sup>1</sup> to *t*3*in*, prescribes how many items need to be produced by the first operation before the second operation can begin.

#### **3.3. Modelling using the data from production-management systems**

The most widely used production-management information system in practice are MRP II and ERP. Data stored in those systems can be used to build up a detailed model of the production system 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 production

**Figure 6.** Precedence constraint.

6 Will-be-set-by-IN-TECH

an operation can be executed on two different sets of resources is shown in Figure 4. If the operation chooses resource *R*3, its time duration is determined with the transition *f*(*t*2*in*) = *td*2. Otherwise the set of resources, composed of *R*<sup>1</sup> and *R*2, is being selected and its operation

p1

t1out

pR2

t 2out <sup>p</sup>2op

pR3

pR1

Precedence constraints are used to define technological limitations and the sequence of operations. An example of two successive operations is shown in Figure 6, depicted as *Op*1 and *Op*2. In this figure an example of technological limitations is also shown. Here, the situation where operation *Op*1 precedes operation *Op*3 is considered. For this purpose an additional place *ppr*<sup>1</sup> is inserted between the transition *t*1*out* (ending *Op*1) and the transition *t*3*in* (starting *Op*3). The weight *n* of the arc, which connects *ppr*<sup>1</sup> to *t*3*in*, prescribes how many items need to be produced by the first operation before the second operation can begin.

The most widely used production-management information system in practice are MRP II and ERP. Data stored in those systems can be used to build up a detailed model of the production system 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 production

<sup>t</sup> <sup>p</sup> 2out 2op

p1op p1

t 1out

p2

There are common situations where more operations use the same resource, e.g., an automated guided vehicle (AGV) in a manufacturing system or a mixing reactor in a batch

p0 td1 p1op

td2

t 1in

t 2in

td2

**3.3. Modelling using the data from production-management systems**

td1

**Figure 4.** Operation that can be performed on two different sets of resources.

system. This can be modelled as shown in Figure 5.

**Figure 5.** Shared resource.

p01

p02

2in t

pR1 1in t

time is defined with *f*(*t*1*in*) = *td*1.

process. Work orders are used to determine which and how many of finished products have to 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 make up a product, along with the required quantity of each. In batch manufacturing other terms are used instead, i.e. Formula.

The BOM used in this work is defined as:

*BOM* = (*R*, *E*, *q*, *pre*), where:


*R* is a root item and represents the product that is composed of sub-items described with *ei* ∈ *E*. The number of required sub-items is determined with the vector **q**. When any sub-item has to be produced before another, the precedence function *pre* is used to define it. All the sub-items have to be finished before the operation for the subsequent sub-items can begin. A required property of **pre** is that only zero values can be on its diagonal, i.e. a sub-item cannot precede itself. An item is never allowed to become (indirectly) a component of itself. In other words, 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 definition is used to describe its dependencies. The items at the highest level of this structure represent a finished product, and those at the lower level represent raw materials. The items that represent raw materials do not have a BOM.

Table 1 shows an example of a BOM describing the production of product *I*, which is composed of three components, i.e., three items of *J*, one item of *K* and and two items of


**Table 1.** Example of the BOM structure.

*L*. From the precedence-constraint matrix it is clear that all of the items *J* has to be completed before the production of item *K* can begin.

The mathematical representation of the BOM of item *I* would be represented as:

$$BOM = (R, E, \mathbf{q}, \mathbf{pre}), \text{ where } R = \{I\}'$$

$$E = \{I \to L\}, \quad \mathbf{q} = \begin{bmatrix} 3 \ 1 \ 2 \end{bmatrix} \quad \text{and} \quad \mathbf{pre} = \begin{bmatrix} 0 \ 1 \ 0 \\ 0 \ 0 \ 0 \\ 0 \ 0 \ 0 \end{bmatrix}.$$

t Jin pJop

q0 q0

t Kin p Kop <sup>p</sup> <sup>t</sup>

3

Rin pRin <sup>t</sup>

*3.3.2. Routings (Recipe)*

*R*2)/(*R*1, 3 × *R*3).

**Table 2.** Routing of product *K*.

**Item I**

2

3

operations are described. For each operation one line is used.

• Remove the place *pXop* and its input/output arcs.

precedence constraints are considered here.

transitions are merged with the existing ones.

**Figure 8.** BOM structure defined by PN.

pIinJ pIoutJ

For each item that can appear in production process, and does not represent a raw material, a routing is defined. It defines a job with sequence of operations, each requiring processing by a particular resource for a certain processing time, which are needed for transforming raw material into the (sub)product. This information are provided by routing tables in discrete manufacturing, and by recipes in batch manufacturing industries. The table contains a header, where the item that is being composed is defined and the lines where all the required

As an example, the routing table for item *K* is given as presented in Table 2. Three operations are needed to produce this item; the first of these operations can be done on two different resources. Similar notation is used for other possible cases, e.g. an operation that needs three resources *R*<sup>1</sup> and two *R*2, or one resource *R*<sup>1</sup> and three *R*<sup>3</sup> would be presented by (3 × *R*1, 2 ×

> Operations Duration Resources Op10 10s/9s R1/R3 Op20 20s R2 Op30 12s R1

• Define a PN structure for the sub-components, as it is defined with routing data. Also

• Place *pXop* is replaced with the sub-net defined in previous step, where input and output

Function that defines PN structure for every sub-component yields the corresponding sequence of production operations from the routing table and for each operation a timed Petri net is built as defined in section 3.3.1. All the placed operations are connected as prescribed

The implementation of the routing data in one item of a BOM is defined as follows:

pPr

<sup>t</sup> Lin <sup>p</sup>Lop pIinL pIoutL

tJout

**Item J**

3

2

Automated Petri-Net Modelling for Batch Production Scheduling 11

Iin pIinK pIoutK tIout <sup>t</sup> Rout Rout

tKout

**Item K**

**Item L** t Lout

To start with building a model, let us assume that, for each item from the BOM, only one operation is needed. As stated before, each operation can be represented with one place and two transitions (Figure 1). To be able to prescribe how many of each item is required the transition *tRin* and the place *pRin* are added in front, and *pRout* and *tRout* are added behind this operation. The weight of the arcs that connect *tRin* with *pRin* and *pRout* with *tRout* are determined by the quantity *q*<sup>0</sup> of the required items. In this way an item *I* is represented with a Petri net as defined in Figure 7.

**Figure 7.** PN structure representing one item in the BOM.

As finished product is defined with a structure of BOMs, the construction of the overall Petri net is an iterative procedure that starts with the root of the BOM and continues until all the items have been considered. If the item requires any more sub-assemblies (i.e., items from a lower level) the operation, the framed area of the PN structure presented in Figure 7, is substituted with lower-level items. If there are more than one sub-items, they are given as parallel activities.

The substitution of an item with sub-items is defined as follows:


The result of building the PN model of this example (Table 1) is given in Figure 8, where item *I* is composed of three subitems: *J*, *K* and *L*.

**Figure 8.** BOM structure defined by PN.

#### *3.3.2. Routings (Recipe)*

8 Will-be-set-by-IN-TECH

Item Sub-item Quantity Precedence constraints *I J* 3 010 *K* 1 000 *L* 2 000

*L*. From the precedence-constraint matrix it is clear that all of the items *J* has to be completed

To start with building a model, let us assume that, for each item from the BOM, only one operation is needed. As stated before, each operation can be represented with one place and two transitions (Figure 1). To be able to prescribe how many of each item is required the transition *tRin* and the place *pRin* are added in front, and *pRout* and *tRout* are added behind this operation. The weight of the arcs that connect *tRin* with *pRin* and *pRout* with *tRout* are determined by the quantity *q*<sup>0</sup> of the required items. In this way an item *I* is represented with

As finished product is defined with a structure of BOMs, the construction of the overall Petri net is an iterative procedure that starts with the root of the BOM and continues until all the items have been considered. If the item requires any more sub-assemblies (i.e., items from a lower level) the operation, the framed area of the PN structure presented in Figure 7, is substituted with lower-level items. If there are more than one sub-items, they are given as

• Define the PN structure for sub-components, as it is defined with a BOM. Consider the

• Replace the removed place *pIop* by the sub-net defined in the previous step. The input and

The result of building the PN model of this example (Table 1) is given in Figure 8, where item

312� and **pre** =

Iin <sup>p</sup>Iop pRout t

*I* � ,

> ⎡ ⎣

010 000 000

> t Rout

q0

⎤ ⎦ .

The mathematical representation of the BOM of item *I* would be represented as:

, **q** = �

**Item I**

Iout <sup>t</sup>

t

pRin

The substitution of an item with sub-items is defined as follows:

output transitions are merged with the existing ones.

*BOM* = (*R*, *E*, **q**, **pre**), where *R* = �

**Table 1.** Example of the BOM structure.

a Petri net as defined in Figure 7.

parallel activities.

precedence constraints.

before the production of item *K* can begin.

*E* = �

Rin

q0

**Figure 7.** PN structure representing one item in the BOM.

• Remove the place *pIop* and its input/output arcs.

*I* is composed of three subitems: *J*, *K* and *L*.

*JKL*�

For each item that can appear in production process, and does not represent a raw material, a routing is defined. It defines a job with sequence of operations, each requiring processing by a particular resource for a certain processing time, which are needed for transforming raw material into the (sub)product. This information are provided by routing tables in discrete manufacturing, and by recipes in batch manufacturing industries. The table contains a header, where the item that is being composed is defined and the lines where all the required operations 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 operations are needed to produce this item; the first of these operations can be done on two different resources. Similar notation is used for other possible cases, e.g. an operation that needs three resources *R*<sup>1</sup> and two *R*2, or one resource *R*<sup>1</sup> and three *R*<sup>3</sup> would be presented by (3 × *R*1, 2 × *R*2)/(*R*1, 3 × *R*3).


**Table 2.** Routing of product *K*.

The implementation of the routing data in one item of a BOM is defined as follows:


Function that defines PN structure for every sub-component yields the corresponding sequence of production operations from the routing table and for each operation a timed Petri net is built as defined in section 3.3.1. All the placed operations are connected as prescribed

#### 10 Will-be-set-by-IN-TECH 12 Petri Nets – Manufacturing and Computer Science Automated Petri-Net Modelling for Batch Production Scheduling <sup>11</sup>

by the required technological sequence, and each operation is assigned to the required places representing appropriate resources.

p2 pin <sup>p</sup>

are not used only to define interdependencies between different (finished) items, but also for interdependencies between job operations of various items that are defined with recipes. In

Definition of a sub-items set *E* is extended in a way that it contain also the information about

Further also a precedence-constraint function *pre* is extended in order to include information about how many operations are needed for every item. As defined in 3.1, set of operations needed to produce *j*-th item is given as *Oj* = {*ojk*}, where *k* = 1, ..., *nj*. Size of the matrix is therefore defined with [*m* × *m*], where *m* = ∑ *nj*, *j* = 1...*n*. Here *n* is number of items that make up a product. In this way we can define an extended precedence-constraints function *pre* as *pre* : ((*E* × *O*) × (*E* × *O*)) → {0, 1}. Element from constraint matrix *pre*(*pij*, *pkl*) = 1 indicates that the *j*-th operation from *i*-th item precedes *l*-th operation from *k*-th item. Here index *pij* in a matrix **pre** presents *j*-th operation of *i*-th item and *pkl l*-th operation of *k*-th item.

With WO demands for product to be finished are passed. For each WO a Petri net model has

First, the data about the WO are read. The products that are needed to be produced are given in *R*; in vector **q** the quantities of the desired products are passed; and vector **st** is used to determine the starting time of each product. For each product the Petri-net structure, shown in Figure 10, is determined and placed on the model. The step when the *routing*() is called is

First, the routing and the BOM data are read from the database (functions *readRouting()* and *readBOM()*). For each operation that comprises the routing, the algorithm checks whether it is made up of sub-item(s) or this is an operation. In the first case, the function *placePN()* is used to determine the PN structure of the given structure BOM. Precedence constraints are added

to be defined. The modelling procedure can be summarised in the Algorithm 1.

PRin <sup>t</sup>

t

Product

pPRop <sup>p</sup>

PRout

t1

t2

tn **Figure 10.** Petri net structure of a work order.

q1

q2

qn

this situations the definition of BOM (Formula) has to be extended.

operations that produce that item: *E* = {(*e*1, *o*1*k*), ...(*ei*, *oinj*

**3.5. Procedure for building the PN model**

PN = *placePN*(R(i), E, q(i), [ ], st(i), x0, y0)

described in more detail with algorithm 2.

**Algorithm 1** Read BOM [R, q, st] = *readWO*() **For** i=1 **to** *length*(R) E = *readBOM*(R(i))

**end**

PN = *routing*(PN, R(i))

p1

pn

end

tout

Automated Petri-Net Modelling for Batch Production Scheduling 13

q0

out

)}.

**Figure 9.** Routing of product *K* modelled with timed Petri net.

The PN structure in Figure 9 is achieved if the sequence of operations described with a routing table (Table 2) is modelled. The resulting PN structure is inserted into the main PN model, on the place where item *K* (*pKop*) was.

The routings/recipes are submodels that are inserted (by substitution, as defined previously) into the main model defined with the BOM structure. However, some activities of any sub-item may also be described with a BOM, i.e., in the case they are composed of semi-products. The construction of the overall Petri-net model can be achieved by combining all of the intermediate steps.

#### *3.3.3. Work order*

The work order (*WO* = [*R*, *q*0,*st*]) determines which and how many of the finished products have to be produced. Each product (*R*) can be represented with a Petri-net model, shown in Figure 7, where one place is added in front and one at the end of the structure to determine the start and end of the work. As usually more products are produced at one time (one product is represented with one batch), the weight of the arc that connects *tRin* and *pRin* are used to determine the number of required batches (*q*0). To be able to consider different starting times for different quantities of one product the general structure shown in Figure 10 is used. *q*<sup>0</sup> determines the number of products to be finished. Orders for products which should start with the production at the same time are merged and every group of products with the same starting time is modelled with places *p*1, *p*2, ...*pn* and with tokens located in them. The timestamps, which are assigned to these tokens determine the starting time of every group of products. Wights *q*1, *q*2, ...*qn* determine the number of products, where *q*<sup>1</sup> + *q*<sup>2</sup> + ... + *qn* is equal to *q*0. The token in the place *pend* implies that WO is finished.

#### **3.4. Specifics of batch production processes**

In previous sections (3.3.1 – 3.3.3) we present methods to represent formula, recipe and work orders with Petri nets. As given so far these elements can be equally used for discrete and batch process environments. However, as mentioned in 3.1 there are some specifics in batch production processes.

Actually batch production is more complicated and formula and recipe are more connected as are BOM and routings [7]. There are common situations where precedence constraints

**Figure 10.** Petri net structure of a work order.

10 Will-be-set-by-IN-TECH

by the required technological sequence, and each operation is assigned to the required places

t t

tKin tKout

pK2op

The PN structure in Figure 9 is achieved if the sequence of operations described with a routing table (Table 2) is modelled. The resulting PN structure is inserted into the main PN model, on

The routings/recipes are submodels that are inserted (by substitution, as defined previously) into the main model defined with the BOM structure. However, some activities of any sub-item may also be described with a BOM, i.e., in the case they are composed of semi-products. The construction of the overall Petri-net model can be achieved by combining

The work order (*WO* = [*R*, *q*0,*st*]) determines which and how many of the finished products have to be produced. Each product (*R*) can be represented with a Petri-net model, shown in Figure 7, where one place is added in front and one at the end of the structure to determine the start and end of the work. As usually more products are produced at one time (one product is represented with one batch), the weight of the arc that connects *tRin* and *pRin* are used to determine the number of required batches (*q*0). To be able to consider different starting times for different quantities of one product the general structure shown in Figure 10 is used. *q*<sup>0</sup> determines the number of products to be finished. Orders for products which should start with the production at the same time are merged and every group of products with the same starting time is modelled with places *p*1, *p*2, ...*pn* and with tokens located in them. The timestamps, which are assigned to these tokens determine the starting time of every group of products. Wights *q*1, *q*2, ...*qn* determine the number of products, where *q*<sup>1</sup> + *q*<sup>2</sup> + ... + *qn* is

In previous sections (3.3.1 – 3.3.3) we present methods to represent formula, recipe and work orders with Petri nets. As given so far these elements can be equally used for discrete and batch process environments. However, as mentioned in 3.1 there are some specifics in batch

Actually batch production is more complicated and formula and recipe are more connected as are BOM and routings [7]. There are common situations where precedence constraints

PR2

**Op20 Op30**

20 12

pK2 pK3op

K2in K2out K3in K3out

t t

pK3

representing appropriate resources.

K11in

10

K12in

the place where item *K* (*pKop*) was.

all of the intermediate steps.

*3.3.3. Work order*

production processes.

9

t t

pK1\_1op

pK12op

<sup>t</sup> <sup>t</sup> <sup>p</sup>K1

<sup>P</sup> **Op10** R1

K11out

K12out

PR3

**Figure 9.** Routing of product *K* modelled with timed Petri net.

equal to *q*0. The token in the place *pend* implies that WO is finished.

**3.4. Specifics of batch production processes**

pK10

**Item K**

are not used only to define interdependencies between different (finished) items, but also for interdependencies between job operations of various items that are defined with recipes. In this situations the definition of BOM (Formula) has to be extended.

Definition of a sub-items set *E* is extended in a way that it contain also the information about operations that produce that item: *E* = {(*e*1, *o*1*k*), ...(*ei*, *oinj* )}.

Further also a precedence-constraint function *pre* is extended in order to include information about how many operations are needed for every item. As defined in 3.1, set of operations needed to produce *j*-th item is given as *Oj* = {*ojk*}, where *k* = 1, ..., *nj*. Size of the matrix is therefore defined with [*m* × *m*], where *m* = ∑ *nj*, *j* = 1...*n*. Here *n* is number of items that make up a product. In this way we can define an extended precedence-constraints function *pre* as *pre* : ((*E* × *O*) × (*E* × *O*)) → {0, 1}. Element from constraint matrix *pre*(*pij*, *pkl*) = 1 indicates that the *j*-th operation from *i*-th item precedes *l*-th operation from *k*-th item. Here index *pij* in a matrix **pre** presents *j*-th operation of *i*-th item and *pkl l*-th operation of *k*-th item.

### **3.5. Procedure for building the PN model**

With WO demands for product to be finished are passed. For each WO a Petri net model has to be defined. The modelling procedure can be summarised in the Algorithm 1.


First, the data about the WO are read. The products that are needed to be produced are given in *R*; in vector **q** the quantities of the desired products are passed; and vector **st** is used to determine the starting time of each product. For each product the Petri-net structure, shown in Figure 10, is determined and placed on the model. The step when the *routing*() is called is described in more detail with algorithm 2.

First, the routing and the BOM data are read from the database (functions *readRouting()* and *readBOM()*). For each operation that comprises the routing, the algorithm checks whether it is made up of sub-item(s) or this is an operation. In the first case, the function *placePN()* is used to determine the PN structure of the given structure BOM. Precedence constraints are added

12 Will-be-set-by-IN-TECH 14 Petri Nets – Manufacturing and Computer Science Automated Petri-Net Modelling for Batch Production Scheduling <sup>13</sup>

```
Algorithm 2 Read Routing
```

```
function PN = routing(PN, R)
datRoute = readRouting(R)
[E, q, pre] = readBOM(R)
for i=1 to length(datRoute.Op)
    if datRoute.Resources ==BOM
      PN1 = placePN(R, E, q, pre, [ ])
      PN = insertPN(PN, PN1)
      for j=1 to length(E)
         PN1 = routing(PN1, E(j))
      end
    else
      PN = constructPN(PN, datRoute(i))
      PN = insertPN(PN, PN1)
    end
  end
```
if they exist. With the function *insertPN()* the resulting subnet is inserted into the main PN structure. If the operation represents the production operation, the function *constructPN*() is called. With it, basic elements (Figures 1–6) are recognised, joined together and placed in the model, again using the function *insertPN()*. All the data about resources and time durations are acquired from the routing table. The described algorithm has been implemented in Matlab. problem 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 job operation requires a specified processing time. The problems differ in restrictions on the job

Automated Petri-Net Modelling for Batch Production Scheduling 15

The scheduling problems related to batch plants possess a more complicated structure compared to standard scheduling problems. Batch plants are flexible and alternative resources can be used for conveying recipe operations. There may be different operation processing time assignments based on which equipment is used for processing and there may be specific requests on precedences or allowable intermediate storage time. This significantly complicates the problem of operations scheduling in batch processes. A comprehensive review of the state-of-the art of short-term batch scheduling is presented in [12]. Different types of batch scheduling problems are specified and the types of optimization models are reviewed. The presented models result in a formulation of MILP optimization problem and

Petri nets can be used to effectively model all standard deterministic scheduling problem classes. Furthermore, the modelling power of Petri nets allows for derivation of models also for problems, which do not have standard problem structure but are closer to real process specifics. This is typical e.g. in batch systems where complex interconnections among process equipment are possible and vary considerably with used batch recipes. Even when the models are not as general as the above mentioned MILP problem representations, Petri nets can be used to model main model components of a two stage batch scheduling approach as defined in [12]. In contrast to monolithic approach the two stage approach assumes that the number of batches of each size is known in advance. The scheduling stage therefore concentrates on the allocation of processing resources to the batches while the plant work load is determined

To derive a feasible schedule, the obtained Petri net model can be simulated by an appropriate simulation algorithm. During the simulation, the occurring conflicts are resolved 'on the fly', e.g. by randomly choosing a transition in conflict that should fire. Instead, heuristic dispatching rules [5], such as Shortest Processing Time (SPT), can be introduced when solving the conflicting situations. The schedule of process operations can be determined by observing the marking evolution of the net. Depending on the given scheduling problem a convenient rule should be chosen. Usually, different rules are needed to improve different predefined production objectives (makespan, throughput, production rates, and

A more extensive exploration of the reachability tree is possible by PN-based heuristic search method 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 chosen transition firing sequence corresponds to a schedule, and by evaluating a number of sequences a (sub)optimal schedule can be determined. The method is further investigated in [22], where a modified heuristic function is proposed and tested on a number of benchmark tests. The problems of the approach are in the complexity of the reachability tree, which can generally not be completely explored. The search has to be limited to predefined maximum tree size in order to complete in a reasonable time. In addition to that, the heuristic function used within the search has to be chosen such that the search is directed more into the depth of the tree,

**4.1. Petri net based derivation of optimal or sub-optimal schedules**

routings.

its solution yields an optimal schedule.

in a previous stage.

other temporal quantities).

The resulting model is stored in a XML-based format employing Petri Net Markup Language (PNML) [6].
