lecture 9 petri net reaction tank – an application example

73
Lecture 9 Petri Net Reaction tank – an application example

Upload: marcus-sanders

Post on 20-Jan-2016

276 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lecture 9 Petri Net Reaction tank – an application example

Lecture 9

Petri Net

Reaction tank – an application example

Page 2: Lecture 9 Petri Net Reaction tank – an application example

Petri Net

9.1 Petri Net - introduction9.2 Petri Net - history9.3 Petri Net and state diagram9.4 Petri Net and PLC in Industrial Control9.5 Petri Net - terminology9.6 Petri Net - formal definition9.7 Petri Net - types9.8 Petri Net - primitive structures9.9 Petri Net - properties9.10 Petri Net - interpretation for Industrial Control

Page 3: Lecture 9 Petri Net Reaction tank – an application example

Reaction tank -scheme

Steam for heating

Product

Water for cooling

Raw material

Page 4: Lecture 9 Petri Net Reaction tank – an application example

Reaction tank – an application example

Reaction tank – problem

Reaction tank - scheme

Technological conditions

Variables list

Petri net for reaction tank control – places and transitions

Petri net for reaction tank control

Page 5: Lecture 9 Petri Net Reaction tank – an application example

P1

T1

P2

T5 T2T7

T6 T3

T4

P3 P4

P5

P6

Reaction tank control - Petri net

Page 6: Lecture 9 Petri Net Reaction tank – an application example

Reaction tank control - Petri net

P1,…….P5 places (circle)T1,…….T6 transitions (rectangle)

oriented connection - edge (line,arc) token, mark (filled point)

• Static character – structure of the net

• Dynamic charecter – movement of the mark through the net

Page 7: Lecture 9 Petri Net Reaction tank – an application example

9.1 Petri Net - introduction• Mathematical tool suitable for analysis

and modelling of discrete events systems

• Grafical tool (comprehensive)

• Very helpful and favourite tool both for

theoretical research

and for practical design of control systems

Page 8: Lecture 9 Petri Net Reaction tank – an application example

Petri Net - introduction - 2

• PN – Petri Net

• SIPN – „Steuerung Interpretierte Petri

Netz“ (Germany)

• It is possible to simply express and model – Parallel behaviour– Resource sharing– Real time relationships

Page 9: Lecture 9 Petri Net Reaction tank – an application example

Petri Net – introduction - 3

• This introduction deals with the graphical aspect of Petri Net for system description, not the algebra of Petri Net.

• While the mathematical properties of Petri Net are interesting and useful, the beginner will find that a good approach is to learn to model systems by constructing them graphically, aided in construction and analysis by computer software for simulation and analysis of Petri Nets.

Page 10: Lecture 9 Petri Net Reaction tank – an application example

10.2 Petri Net - history

• Author: Carl Adam Petri – Ph.D. dissertation thesis in 1962 on the topic Formal methods in dicrete events modelling (communication betweeen sequential machines - automatons)

• See Ref. [1]• Further development at MIT – Massachusets

Institute of Technology (seventies of the previous century)

Page 11: Lecture 9 Petri Net Reaction tank – an application example

Petri Net - history - 2

• Since then, Petri Nets and their concepts have been extended and developed, and applied in a variety of areas:

Office automation, work-flows, flexible manufacturing, programming languages, protocols and networks, hardware structures, real-time systems, performance evaluation, operations research, embedded systems, defence systems, telecommunications, Internet, e-commerce and trading, railway networks, biological systems…… !

Page 12: Lecture 9 Petri Net Reaction tank – an application example

9.3 Petri Net and state diagram

• State diagram suitable for typical sequential systems (one event following another event in clear order, only a few alternative pathes, no paralell pathes)

• Petri nets suitable for parallel processes and communications

• SW for Petri net applications makes possible to create and run model in modular way

Page 13: Lecture 9 Petri Net Reaction tank – an application example

9.4 Petri Net and PLC in Industrial Control

• There are very efficient graphical tools (languages) at disposal today for PLC programming which are very similar to the Petri Nets formalism (they are based on it)

• Two terms directly onnected with Petri Nets:• GRAFCET (Graphe Fonctionenel de Connexion

Etapes Transitions - France, origin: 1975-1977) – since 1987 International standard (IEC 848)

• SFC (Sequential Function Chart) – according to the international standard IEC 1131-3 (standard for PLC programming)

Page 14: Lecture 9 Petri Net Reaction tank – an application example

9.5 Petri Net - terminology

• A Petri Net is a collection of directed arcs connecting places and transitions. Places may hold tokens.

• The state or marking of a net is its assignment of tokens to places.

• Here is a simple net containing all components of a Petri Net:

Page 15: Lecture 9 Petri Net Reaction tank – an application example

Petri Net - terminology - 2

Simple net

weight

Page 16: Lecture 9 Petri Net Reaction tank – an application example

Petri Net - terminology - 3

• Arcs have capacity (weight) 1 by default; if other than 1, the capacity is marked on the arc.

• Places have infinite capacity by default.• Transitions have no capacity, and cannot store

tokens at all.• With the rule that arcs can only connect places

to transitions and vice versa, we have all we need to begin using Petri Nets.

• A few other features and considerations will be added as we need them.

Page 17: Lecture 9 Petri Net Reaction tank – an application example

Petri Net – terminology - 4

Petri net models consist of two parts:

1. the net structure that represents the static part of the system

2. a marking that represents the overall state on the structure. State can change - this represents dynamic behavior of the system.

Page 18: Lecture 9 Petri Net Reaction tank – an application example

Petri Net - terminology - 5

The token distribution among the places of a Petri net is called its marking.

When one or more tokens reside in a place, the place is said to be marked, otherwise it is unmarked.

The number of tokens at a place represents the local state of the place.

The marking of the net represents the overall state of the system.

Page 19: Lecture 9 Petri Net Reaction tank – an application example

Petri Net - terminology - 6

• A transition is enabled when the number of tokens in each of its input places is at least equal to the arc weight going from the place to the transition.

• An enabled transition may fire at any time. When fired, the tokens in the input places are moved to output places, according to arc weights and place capacities. This results in a new marking of the net, a state description of all places.

Page 20: Lecture 9 Petri Net Reaction tank – an application example

Petri Net - terminology - 7

Example

This Petri net has:• 2 places: p1, p2• 1 transition: t1• p1 has one token: f(p1) = 1• p2 has 0 tokens: f(p2) = 0

Page 21: Lecture 9 Petri Net Reaction tank – an application example

Petri Net - terminology - 8

Firing a Transition

When a transition tj fires

• Each pi that has an edge from pi to tj removes a token from pi

• Each pj that has an edge from tj to pj adds a token to pj

Page 22: Lecture 9 Petri Net Reaction tank – an application example

Petri Net - terminology - 9

Petri net before t1 fires: Petri net after t1 fires:

Page 23: Lecture 9 Petri Net Reaction tank – an application example

Petri Net - terminology - 10

A transition must be enabled before it fires:

There is a token in each pi that has an edge

to the transition

• An enabled transition may or may not fire

(it can be another condition asociated with the transition)

Page 24: Lecture 9 Petri Net Reaction tank – an application example

Petri Net – terminology - 11

Petri net before t1 fires: Petri net after t1 fires:

Page 25: Lecture 9 Petri Net Reaction tank – an application example

Petri Net - terminology - 12• A place can contain non-negative whole

number of marks

• At the moment of transition firing (activation, skipping) the marks are withdrawn from input places and added to the output places of the transition

• Oriented edges connect places and transitions

Page 26: Lecture 9 Petri Net Reaction tank – an application example

Petri Net - terminology - 13

• initial marking (marks displacement in the places before the first skip) describes the initial state of the system

• system development is represented by transfer of the marks in the net on the basis of activating of the transitions (skip)

• every new marking of the system represents a new state of the system

Page 27: Lecture 9 Petri Net Reaction tank – an application example

Petri Net - terminology - 14 Transition enabling - example

car

wheelsmotorcar body

• weight of the P9 - T3 edge is 4

• place P9 contains only 3 3 tokens

• transition T3 is not enabled (for one car we need four wheels)

• transition T3 cannot be fired

T3

4

P11

P8

P9P10

Page 28: Lecture 9 Petri Net Reaction tank – an application example

9.6 Petri Net - formal definitionA Petri Net is a 5 tuple PN = (P,T,F,W,M0),where

Page 29: Lecture 9 Petri Net Reaction tank – an application example

9.7 Petri Net - types

Original Petri Nets• Only 1 token can be removed/added from a

place when a transition fires (i.e., the weight is always 1)Weighted Petri Nets• Generalized the original Petri net to allow

multiple tokens to be added/removed when a transition fires.

• The edges are labeled with the weight (i.e., number of tokens)

• If there is no label, then the default value is 1

Page 30: Lecture 9 Petri Net Reaction tank – an application example

Petri Net - types - 2

Weighted Petri net before t1 fires:

Weighted Petri net

after t1 fires:

Page 31: Lecture 9 Petri Net Reaction tank – an application example

Petri Net - types - 3

Other Types of Petri Net

Petri nets have been extended over the years in many directions including time,data, and hierarchy.

Time Extended Petri Nets

Coloured Petri Nets

Hierarchical Petri Nets

Page 32: Lecture 9 Petri Net Reaction tank – an application example

Time Extended Petri Net

First developed in the mid 1970s• For real systems it is often important to describe the

temporal behavior of the system, i.e., we need to model durations and delays.

• There are 3 basic ways to introduce time into the Petri net. Time can be associated with:– tokens– places– transitions

The first introduction of time in Petri nets is in the Timed Petri net model

C. Ramchandani, “Analysis of Asynchronous concurrent systems by timed petri nets”, MIT MAC-TR-120, 1974. In this model, a time duration is associated with each transition.

Page 33: Lecture 9 Petri Net Reaction tank – an application example

Time Extended Petri Net - 2

• The firing rules in this model are that the transition must fire as soon as it is enabled, and firing a transition takes a fixed, finite amount of time.

• The notion of instantaneous firing of transitions is not preserved in the Timed Petri net model.

• When a transition becomes enabled, the tokens are immediately removed from its input places.

• After the time delay, tokens are deposited in the output places.

• The result is that the state of the system is not always clearly represented during the process.

• // Note. There are many other extensions to Petri Nets that consider time.

Page 34: Lecture 9 Petri Net Reaction tank – an application example

Coloured Petri Net

Developed in the Late 1970s ( K. Jensen, “Colored Petri nets and the invariant method”, Theoretical Computer Science, volume 14, 1981, pp. 317-336.)

• Tokens often represent objects (e.g. resources, goods, humans) in the modeled system

• To represent attributes of these objects, the Petri net model is extended with coloured or typed tokens.

each token has a value often referred to as `colour'.

• Transitions use the values of the consumed tokens to determine the values of the produced tokens

a transition describes the relation between the values of the `input tokens‚ and the values of the `output tokens'

• It is also possible to specify `preconditions' which take the colours of tokens to be consumed into account.

Page 35: Lecture 9 Petri Net Reaction tank – an application example

Hierarchical Petri Nets -1

Developed in the Late 1980s

• Specifications for real systems have a tendency to become large and complex

• An abstraction mechanism, hierarchical structuring, is used to make constructing, reviewing, and modifying the model easier

• The hierarchy construct is called a subnet

Page 36: Lecture 9 Petri Net Reaction tank – an application example

Hierarchical Petri Net - 2

• A subnet is an aggregate of a number of places, transitions, and subsystems

• Such a construct can be used to structure large processes

• At one level we want to give a simple description of the process (without having to consider all the details).

• At another level we want to specify a more detailed behavior.

• Each subnet is represented with a rectangular box that encapsulates part of the Petri Net model

Page 37: Lecture 9 Petri Net Reaction tank – an application example

Hierarchical Petri Net - 3

• Each subnet is represented with a rectangular box that encapsulates part of the Petri Net model

Page 38: Lecture 9 Petri Net Reaction tank – an application example

9.8 Petri Net - Primitive structures

Page 39: Lecture 9 Petri Net Reaction tank – an application example

Primitive structures - 2

• Sequence is obvious - several things happen in order.

• Conflict is not so obvious. The token in P4 enables three transitions; but when one of them fires, the token is removed, leaving the remaining two disabled. Unless we can control the timing of firing, we don't know how this net is resolved.

Page 40: Lecture 9 Petri Net Reaction tank – an application example

Primitive structures - 3

• Concurrency, again, is obvious; many systems operate with concurrent activities, and this models it well.

• Synchronization is also modeled well using Petri Nets; when the processes leading into P8, P9 and P10 are finished, all three are synchronized by starting P11.

Page 41: Lecture 9 Petri Net Reaction tank – an application example

Primitive structures - 4

• Confusion is another not so obvious construct. It is a combination of conflict and concurrency. P12 enables both T11 and T12, but if T11 fires, T12 is no longer enabled.

• Merging is not quite the same as synchronization, since there is nothing requiring that the three transitions fire at the same time, or that all three fire before T17; this simply merges three parallel processes.

• The priority/inhibit construct uses the inhibit arc to control T19; as long as P16 has a token, T19 cannot fire.

Page 42: Lecture 9 Petri Net Reaction tank – an application example

Primitive structures - 5

hungry human B

P2

T1 T2

P1 P3

P4 P5 P6

hungry human A dinner

full human A dirty dishes full human B

Example:

Enabling and activation - effective conflict between transitions T1a T2

Page 43: Lecture 9 Petri Net Reaction tank – an application example

Primitive structures - 6

hungry human B

P2

T1 T2

P1 P3

P4 P5 P6

hungry human A dinner

filling human A dirty dishes filling human B

Conflict development between transitions T1 and T2 –version A

Page 44: Lecture 9 Petri Net Reaction tank – an application example

Primitive structures - 7

hungry human B

P2

T1 T2

P1 P3

P4 P5 P6

hungry human A dinner

filling human A dirty dishes filling human B

Conflict development between transitions T1 and T2 –version B

Page 45: Lecture 9 Petri Net Reaction tank – an application example

10.9 Petri Net- properties

We can ask some interesting questions about the Petri Nets (i.e., we can ask interesting questions about the models of a particular system)

Some properties of interest include:• Terminate

Does the Petri Net terminate?• Immediately Reachable

Is a state reachable when a transition fires?

• ReachableIs a state eventually reachable?

Page 46: Lecture 9 Petri Net Reaction tank – an application example

Petri Net- properties -2

• LiveIn all states, is there at least one

transition that can fire?• Partial deadlock

Is there a state in which at least one transition that can never fire?

• DeadlockIs there a state in which none of the

transitions can fire?

Page 47: Lecture 9 Petri Net Reaction tank – an application example

Petri Net- properties -3

• SafeIn all states, does each place contain

at most one token?• Bounded

In all states, is there a limit to the number of tokens that can be in one place?

• ConservativeIs the total number of tokens in the

Petri Net constant?

Page 48: Lecture 9 Petri Net Reaction tank – an application example

9.10 Petri Net - interpretation for Industrial Control

• Petri net can expres the desired control system behaviour (SIPN)

• Another condition must be fulfilled before transition firing, e.g.: some event asociated with the transition must occurePlaces ……actions of the control system

(outputs of PLC)

Transitions …conditions (e.g. from sensors, inputs of PLC)

Page 49: Lecture 9 Petri Net Reaction tank – an application example

Reaction tank - problem

• typical partial task from food industry or chemical industry

• analogue variables, e.g. temperature, level, pressure, are monitored via binary sensors (only limit values of this analogue variables - it is cheaper

• concurency of activities in technological process

• SIPN application

Page 50: Lecture 9 Petri Net Reaction tank – an application example

Reaction tank -scheme

Steam for heating

Product

Water for cooling

Raw material

Page 51: Lecture 9 Petri Net Reaction tank – an application example

Technological conditions for control system (e.g. PLC)

Specific reaction is to be run in the reaction tank at the temperature hold between <T1,T2>. Steam is used for heating (double cover of the tank). Cold water is used for cooling (radiator tube inside of the tank). The liquid is mixed with the mixer during the reaction.

In the initial state: all valves are closed, both heating, cooling and mixing do not work.

Page 52: Lecture 9 Petri Net Reaction tank – an application example

Technological conditions - 2

• Start of the process via Start button

• The tank is filled up to the high level sensor and the mixer is started

• The mixer is running until the reaction is fulfilled

• According to the comming raw material temperature steam heating or water coolling is starting up

Page 53: Lecture 9 Petri Net Reaction tank – an application example

Technological conditions - 3

• If the comming raw material temperature matches the desired interval <T1,T2>, neither heating nor cooling is started

• If the desired temperature is reached when heating or cooling, the heating or cooling is shut down. The reaction is completed.

• The liquid from the tank is drained (low level sensor)

Page 54: Lecture 9 Petri Net Reaction tank – an application example

Variables list inputs (of PLC)

• STA…….Starting button (the reaction is to start má začít: STA=1)

• H_LS….. High level of the raw material sensor (the level is above the high sensor: H_LS=1)

• L_TS….. Low temperature of the raw material (T<=low limit T1 : L_TS=1)

• H_TS….. High temperature of the raw material (T>=high limit T2 : H_TS=1)

• L_LS….. Low level of the raw material sensor (the level is under the low sensor: L_LS=1)

Page 55: Lecture 9 Petri Net Reaction tank – an application example

Variables list outpus (of PLC)

• V1_S….. Valve for raw material input (V1_S=1: open the valve)

• M……... Mixer motor

(M=1: start the mixer)• V2_TP… valve for heating steam input

(V2_TP=1: open the valve)• V3_P….. Valve for product output

(V3_P=1: open the valve)• V3_CHV..Valve for cooling water input

(V3_CHV=1: open the valve)

Page 56: Lecture 9 Petri Net Reaction tank – an application example

Limit values identification

• Analogue variables are often monitored via binary sensors (cheaper)

• There are two types of limit values in industrial processes control – operating and critical

• operating:H - High

L- Low• critical: HH - High High

LL - LowLow• These limits are highlighted on the operator

panel (for better overview )

Page 57: Lecture 9 Petri Net Reaction tank – an application example

Petri Net (PN) for reaction tank control -

places - and output variables values• P1 (standstill): V1_S=0, V2_TP=0, V2_TP=0,

V3_P =0, V3_CHV =0, M=0• P2 (filling): V1_S=1• P3 (coolling): V3_CHV=1• P4 (heating): V2_TP=1• P5 (draining): V3_P=1• P6 (mixing): M=1

Page 58: Lecture 9 Petri Net Reaction tank – an application example

Petri Net for reaction tank control - transitions - and input variables

values • STA, (start): T1• H_LS.NotL_TS , (filled, cool): T2• L_TS, (low temperature of the raw material): T3• L_LP, (low level of the product ): T4• H_LS.H_TS, (filled, warm): T5• NotH_TS, (not enough high temperature of the raw

material T6• H_LS.NotH_TS.L_TS, (filled, temperature between

<T1,T2> T7

Page 59: Lecture 9 Petri Net Reaction tank – an application example

PN for reaction tank control -1

P1

T1

P2

T5 T2T7

T6 T3

T4

P3 P4

P5

P6

Page 60: Lecture 9 Petri Net Reaction tank – an application example

PN for reaction tank control -2

P1

T1

P2

T5 T2T7

T6 T3

T4

P3 P4

P5

P6

Page 61: Lecture 9 Petri Net Reaction tank – an application example

PN for reaction tank control - 3

P1

T1

P2

T5 T2T7

T6 T3

T4

P3 P4

P5

P6

Page 62: Lecture 9 Petri Net Reaction tank – an application example

PN for reaction tank control - 4

P1

T1

P2

T5 T2T7

T6 T3

T4

P3 P4

P5

P6

Page 63: Lecture 9 Petri Net Reaction tank – an application example

PN for reaction tank control - 5

P1

T1

P2

T5 T2T7

T6 T3

T4

P3 P4

P5

P6

Page 64: Lecture 9 Petri Net Reaction tank – an application example

PN for reaction tank control - 6

P1

T1

P2

T5 T2T7

T6 T3

T4

P3 P4

P5

P6

Page 65: Lecture 9 Petri Net Reaction tank – an application example

PN for reaction tank control -7

P1

T1

P2

T5 T2T7

T6 T3

T4

P3 P4

P5

P6

Page 66: Lecture 9 Petri Net Reaction tank – an application example

PN for reaction tank control - 8

P1

T1

P2

T5 T2T7

T6 T3

T4

P3 P4

P5

P6

Page 67: Lecture 9 Petri Net Reaction tank – an application example

PN for reaction tank control - 9

P1

T1

P2

T5 T2T7

T6 T3

T4

P3 P4

P5

P6

Page 68: Lecture 9 Petri Net Reaction tank – an application example

PN for reaction tank control -10

P1

T1

P2

T5 T2T7

T6 T3

T4

P3 P4

P5

P6

Page 69: Lecture 9 Petri Net Reaction tank – an application example

PN for reaction tank control - 11

P1

T1

P2

T5 T2T7

T6 T3

T4

P3 P4

P5

P6

Page 70: Lecture 9 Petri Net Reaction tank – an application example

PN for reaction tank control -12

P1

T1

P2

T5 T2T7

T6 T3

T4

P3 P4

P5

P6

Page 71: Lecture 9 Petri Net Reaction tank – an application example

Reference

[1] Petri, C.A., Kommunikation mit Automaten. Petri, C.A., Bonn: Institut für Instrumentelle Mathematik, Schriften des IIM Nr. 2, 1962, Second Edition:, New York: Griffiss Air Force Base, Technical Report RADC-TR-65--377, Vol.1, 1966, Pages: Suppl. 1, English translation

Page 73: Lecture 9 Petri Net Reaction tank – an application example