EE 5322: Intelligent Control Systems

40 downloads 141 Views 434KB Size Report
EE 5322: Intelligent Control Systems. Prepared by: Aaron Halverson, Rich Otten. Petri-Nets. Introduction: • Petri nets were developed in the early 1960s by C.A. ...
EE 5322: Intelligent Control Systems Prepared by: Aaron Halverson, Rich Otten

Petri-Nets Introduction: • •

Petri nets were developed in the early 1960s by C.A. Petri in his Ph.D. dissertation. C.A. Petri. Kommunikation mit Automaten. PhD thesis, Institut für instrumentelle Mathematik, Bonn, 1962. [1] They are useful for modeling concurrent, distributed, asynchronous behaviors in a system. [1]

Petri Net is a 5 tuple [2]

* Token

Place

Transaction

Flow

Parts of a Petri Net system

p2

p1

This Petri Net has: 2 places: p1, p2 1 transition: t1 p1 has one token: M(p1) = 1 p2 has 0 tokens: M(p2) = 0

t1 Petri Net [1]

1

1. A Transition is enabled when all places inputting to the transition have a token. Once a transition is enabled, it may fire. Upon firing, the token is removed from the input places and a token is moved to the output place based on the weights. Only 1 token is removed or added to a place if the weight is 1.

p1

p1

p3

p2

p3

p2 t1

t1 Petri Net after T1 fires [1]

Petri Net before T1 fires [1]

2. A weighted Petri Net requires multiple tokens to enable a transition or moves multiple tokens to the output place. The weight value is placed on the edge of the transition.

p1

2

p1

2

p3

p3

p2

4

p2

4

t1

t1

Weighted Petri Net before transition T1 fires [1]

Weighted Petri Net after transition T1 fires [1]

Transition Equations: M1 (P8)

** T1 P1

T2

T3

P2

P3

T4 P4

P5

** R1 (P6)

R2 (P7)

*

*

The Petri Net is a five element vector. It is comprised of a Places Vector, Transitions Vector, Incident (input) Matrix, Output Matrix and Marking Vector. The Places vector is comprised of Places and Resources. Places are on the job path and resources are off the job path. Blocking occurs when there are not enough Tokens in the initial loop to enable a Transition.

2

P = vector of Places

=

P1, P2, P3 ….Pn

T

T = vector of Transitions

=

T1, T2, T3 ….Tm

T

Incident Matrix

Output Matrix

(1 indicates Place tied to Transition) P1 P2 P3 .

.

.

.

Pn

T1 T2 .

Resource

.

Tn

Job

ow Fl

ow Fl

Job

.

b Jo

P1 P2 O = P3 . . . . . . Pn

b Jo

T1 T2 . I= . . Tn

(1 indicates Place link to Transition)

Resource

The Petri Net Transition Equation provides the location of the tokens after the transition fires. M is the Incident Matrix which is a fixed matrix based on the configuration of the Petri Net.

M=OT-I

I

1 0 0 0 0 1 0 0

0 0 0 0

0 1 0 0 0 0 0 1

1 0 0 0

0 0 1 0 0 0 1 0

0 1 0 0

0 0 0 1 0 0 0 0

0 0 1 0

O

0 0 0 1 0 1 0 0 0 0 0 1

T O

M

1 1 M=

0 0 1 0

I

0

0 0

1 0

0 0 1

0

0

1 1

0

0

1 1 0 0

1 1

0

0

0

1

1 1 0

3

0

1 0

The Petri Net Marking Transition Equation can produce the next marking vector if the firing transition vector X is known. Marking Vector m = [m1, m2, m3, m4,… mm]T

mi+1=mi+MTXi+1 Where Xk=Xi+1

Where mk=m i+1 2

1 Xk

Fire T at time 1

0

0

0

0 mi

0

1

0

1

0 1

mk

T mi M . Xk

0 mk =

1 2

0 0 0 1 2

Petri Net flow example: Initial Condition (Pl = 2 tokens (Red and Blue), R1 = 1 token, R2 = 1 token, M1 = 2 token) 2

M1 (P8)

1

** Xk T1 P1

T2 P2

T3 P4

P3

0

0 0

T4

Fire T at time 1

0

0 mi

P5

1

0 1

**

1

0 mk

T mi M . Xk

0 mk =

1 2 R1 (P6)

R2 (P7)

*

*

0 0 0 1 2

Post Fire t=1 M1 (P8)

1 0

** Xk T1 P1

T2 P2

*

T3

T4 P4

P3

P5

0

0 0

Fire T at time 2

1

1 mi =

*

1

0

0

0 0

mk

T mi M . Xk

1 mk =

1 2 R1 (P6)

0 0

R2 (P7)

1

*

1 1

Post Fire t=2 M1 (P8)

1 1

* Xk T1 P1

T2 P2

*

T3 P3

T4 P4

P5

*

1

1 0

Fire T at time 3

0

0 mi =

0

0

1

0 1 1 1

mk

T mi M . Xk

0 mk =

1 0

R1 (P6)

R2 (P7)

0

*

*

0 2

4

Post Fire t=3 M1 (P8)

0 0

** Xk T1 P1

T2 P2

T3

T4 P4

P3

*

0

0 1

P5

Fire T at time 4

1

1 mi =

*

0

1

0

0 0

mk

T mi M . Xk

1 mk =

0 2 R1 (P6)

0 1 1

R2 (P7)

1 1

Post Fire t=4 0

M1 (P8)

0

* Xk T1 P1

T2 P2

T3 P4

P3

1

1 0

T4

mi =

P5

*

Fire T at time 5

0

0

0

1 1

*

0

0 mk

T mi M . Xk

0 mk =

1 1

1 1 1

R1 (P6)

R2 (P7)

*

*

0 2

Post Fire t=5 0

M1 (P8)

0

** Xk T1 P1

T2 P2

T3 P3

P4

P5

*

*

0

0 1

T4

mi =

1 0

T mi M . Xk

0 mk =

0 2

2

M1 (P8)

** T2 P2

mk

1

Post Fire t=6

T1

0

1

1

R2 (P7)

*

P1

0

1

2 R1 (P6)

Fire T at time 6

0

0

T3 P3

T4 P4

P5

** R1 (P6)

R2 (P7)

*

*

5

In this example the Transition firing vector input was manual operation. The Marking Transition equation accounts for the dynamics of the Petri Net. In order to successfully simulate the Petri Net as a discrete event system, the firing vector must be calculated. The firing vector address the possibility of single or multiple transition firings at any given time. This is further discussed later in the lecture.

Firing Vector (Xi) equation [2]

Robot Example: A Petri Net can be used to model the control commands using IF / THEN logic as depicted below.

Robot Control Command Nodes [3]

Robot Sensor Configuration [3]

Using the two command structures and the sensor inputs, the Petri Nets below represents the flow for Wall Tracking and Robot Tracking through the command control network. In Wall Tracking the command structure is; if the robot approaches walls, execute a left turning motion. If the robot moves away from the walls, execute a right turning motion. If walls are located on the left side of the robot, stop quickly and execute a slow right turning motion. If sensors do not detect the wall, go forward. [3]

6

Wall Tracking Petri Net [3]

Simulation Results for Wall Tracking [3]

7

In Robot Tracking, one robot travels in parallel with the other. The Robot does not exactly know its current position or the position, velocity and moving direction of the other robot. Therefore it must infer the state of the other robot through local sensor information. [3]

Place Table Robot Tracking Task [3]

Petri Net Robot Tracking Task [3]

8

Neural Network and Fuzzy Logic Control: Using a weighted Petri Net a Neural Network can be simulated. The Neural Network conversion to Petri Net uses a weighted transition as the hardlim function with standard inputs places and transitions.

McCullock-Pits NN model (top) and Adaptive Neural Processor (bottom) [4]

A Fuzzy Logic controller can be designed using Petri Nets. The hardware implementation of the controller is based on the Petri Net design. In the following example the Fuzzy Logic Controller for a Concrete Production Device is designed using Petri Nets. The hardware to implement the Fuzzy Logic Controller is designed from the Petri Net.

Concrete Production Example [5] 1) The action sequence arrangements.

The concrete production device includes conveyor belts T1 and T2 which transport cement and aggregate to the scales, water container and cement mixer (left). The action sequence essential for the concrete production is as follows.. • aggregate weighing; • emptying the scales; • cement weighing; • emptying the scales; • water batching; • ingredients mixing in the cement mixer; • emptying the cement mixer. The concrete production device should work with maximum efficiency, i.e., as many actions as possible should be performed simultaneously. For example, while mixing the ingredients together, a new portion of aggregate should be weighed. 2) Description of the control algorithm using Petri Net. The Petri net which describes the control algorithm of the concrete production device is shown below. The transitions described by “1” are unconditioned ones.

9

3) Transformation of the Petri Net to the Logic Circuit. Application of the proposed method leads to the logic circuit of this net, based on JK flipflops of the type SA or SB, as shown in Fig. 11. Analogously, one can transform the Petri Net to the logic scheme containing the fuzzy JK flip-flops of the type AA or AB.

Figure 1 - Petri Net for a Fuzzy Logic Controller [5]

Hardware implementation of the fuzzy Petri Net using JK flip-flops type SA or SB [5]

10

Matrix Discrete Event Model: Fv is Steward’s Task Sequencing Matrix (Jobs Complete) Fr is Kusiak’s Resource Requirements Matrix Bill of Materials (Resources Available) Sv is Next Job Conditions fulfilled (Transition) Sr is Released Resource Conditions fulfilled (Transition)

Basic Concept Matrix Formulation of Discrete Event Systems [2]

The Petri-net can easily be derived from the from the discrete event matrix of a flexible manufacturing system. The discrete event matrix is formed by using engineering data. The Bill of Materials which is an integral part of a manufacturing process can be described as a matrix in which the (i,j) entry is equal to the number of parts type j needed to fabricate one assembled part of type i. [6] In the Job Sequencing Matrix, jobs are indicated by the columns & rows. A “1” in the matrix shows that job j is a prerequisite for job i. The Job Sequencing Matrix can represent an array of parts needed in a manufacturing process sequence.[6] The available resources required for a process is used to generate the Resources Requirements Matrix. The rows relate to jobs, and the columns correspond to resources (i.e.. tooling, machines…etc). A “1” in the Resources Requirements Matrix indicates that resource j is required for job i. The Resources Requirements Matrix is easily modified as resources change.[6] To allow assembly, job sequencing, addition of resources, deadlock analysis & avoidance, and facilities dispatching design, a rule-based discrete event matrix model is needed. The model yields a framework for a rigorous analysis of a flexible manufacturing system. The model can be simulated on a computer. Job sequencing, resource assignment, and resource release are represented in the model.[6]

11

Matrix Model of Petri Net [2]

12

“Logical” Equations for Discrete Event Model: Matrix DE Model Equation: Start Equation:

x = Fv vc + Fr rc + Fu u + FD u D

Vs = S v x

Resource Release Equation: rs = S r x Product Output Equation:

y = Syx

Addition = logical “or” Multiplication = logical “and” Overbar = “negation”

Firing Vector equation [2]

Controller based on a Matrix Formulation: X is the State vector Fv is the Job Sequencing Matrix, Fv (i,j)=1 if job j is required as a precursor to job i. Fr is the Resource Requirements Matrix, Fr(i,j)=1 if resource j is required for job i. Sv is the Start Matrix, Sv(i,j)=1 if job i must be stated when all requirements of Xj are satisfied, so that Xj has been set high. This matrix has multiple 1’s in the same column, which correspond to job routing decisions. Sr is the Resource Release Matrix, Sr(i,j)=1 if resource i should be released when Xj is set high. Work Cell Inputs (Plant Commands): Pin is the parts entering the cell. y is the tasks complete. Vs is the jobs to be started, part of the work cell dynamics. Rs is the resources to be released, part of the work cell dynamics. Work Cell Outputs (Plant Status): u is parts present at the cell. Pout is products leaving the cell. Vc is the completed jobs, part of the work cell state outputs. Rc is the resources currently available, part of the work cell state outputs.

13

The Discrete Event model monitors state outputs, and checks the conditions required for performing the next function in a manufacturing process. State vector X stores the conditions, Sv computes which jobs may start, Sr computes which resources should be released due to completed jobs Vc. The Discrete event model commands the workcell dynamics. [6]

uc Dispatching rules

Rule-Based Real-Time Controller Controller state monitoring logic x = Fv ⊗ v ⊕ Fr ⊗ r ⊕ Fu ⊗ u ⊕ Fuc ⊗ uC

.. .

Job start logic v S = SV ⊗ x

Resource release logic

rS = S r ⊗ x

Task complete logic

y = Sy ⊗ x

Parts present u

Parts in pin Start tasks vs

Work Cell

Tasks completed vc Resource released r c

Start resource release rs

Products pout

Output y Plant commands

Plant status

Controller based on Matrix Formulation [7]

14

Application Example[7]: Application- Intelligent Material Handling

Machine 1

Machine 2

12 Sensors!!

Layout of the IMH Cell IBM robot R1

Conveyor bidirectional B3

Conveyor unidirectional

X1 X9 A

B

A

B1

B

X8 X2

X3

M2

ADEPT robot R3

M1

X4

machine X7

R2

machine

X5

X6 B2

conveyor

15

PUMA robot

PART B OUT

PART A

PART A OUT A(1)R2

A(1)R1

CRS ROBOT 1

PART B

PUMA

B(1)R1

B(1)R2

ROBOT 2

A(2)R1 B(2)R1 A(2)R2

Machine 1 ADEPT B(1)R3

ROBOT 3

Machine 2

A(1)R3

B(2)R3

Petri-net Flow Chart: B1AA

PAI

X1

R1U1

X2 B1AS

X3

R2U1 X4

B3AA

B2AA

M1A

M1P

X5

R2U3

X6

B2AS

X10 PAO

X8

B3AS

X9

R1U3

X17 R3U3 X18

B3BS

X19

R1U4 X20

X7

R3U1

R3A R2A R1A

PBI

X11 R1U2 X12

B1BA

B1BS

X13 R2U2 X14

B2BS

X15

R3U2 X16

M2A

B2BA

16

M2P

B3BA

PBO

PC with High Level Controller Rule -Based Real -Time Controller Controller state monitoring logic x = Fv ⊗ v ⊕ Fr ⊗ r ⊕ Fu ⊗ u ⊕ FD ⊗ u D ⊕ Fu ⊗ u C

uc

C

Start tasks/jobs

Dispatching rules To Generate uc

Job start logic vS =S v ⊗ x Resource release logic rs = S r ⊗ x

Task complete logic y =S y ⊗ x

Tasks: v SA Medium Level Tasks Controllers Robot 1 Task 4 Task 3 Task 2 Task 1

Robot 2 Task 3 Task 2 Task 1

Robot 3

v~SA

Task 3 Task 2 Task 1

Workcell data gathering

u v r p Parts out ~ p in , ~ rS , v~SB

DAQ -card RS232 - 1

RS232 -2

RS232-3

Analog & digital I/0

Jobs

vSB rSB Low level PD & PID controllers CRS controller

Puma 560 controller

vSB

ADEPT One controller

rSA, pin

Machines Sensors Robots

Error!c.f. Saridis Jim Albus

17

LabVIEW diagram of Controller

LabVIEW Controller's interface:

Fr

Fv

18

Simulation sites: a tool for synthesis of Petri Nets and asynchronous circuits Petri-Nets Demo- http://www.utdallas.edu/~kcooper/teaching/2305/PN_Demo.doc Petrify (Tool for Petri-Net synthesis) - http://www.lsi.upc.es/~jordic/petrify/petrify.html Petri-Nets Simulation for Windows - http://www.fi.ru/os/petri.php3 Petri-Nets Deign Simulation - http://www.elyros.com/PNSim/

Reference: 1. UTDallas SE 2370 course notes by Kendra Cooper Fall 2004. Petri Nets. 2. UTA EE4315/5325 Lecture by Jose Mireles Jr, Fall 2002. Petri Nets for simulation/control of Discrete Event Systems: introduction & matrix representation. 3. Kyung No Lee, Doo Yong Lee. 1998. An Approach to Control Design for Cooperative Multiple Mobile Robots. Department of Mechanical Engineering, Korea Advanced Institute of Science and Technology. 4. Syed I. Ahson. 1995. Petri Net Models of Fuzzy Neural Networks. IEEE Transactions on systems, man, and cybernetics. Vol. 25, No. 6 pp 926 – 927 5. Leslaw Gniewek, Jack Kluska. 2004, Hardware Implementation of Fuzzy Petri Net as a Controller. IEEE Transactions on systems, man, and cybernetics – part B: Cybernetics. Vol. 34, No. 3 pp 1315 – 1324 6. Diego A Tacconi, F.L Lewis. 1997. A new Matrix Model for Discrete Event Systems: Application to Simulation. IEEE Control Systems. pp 62-71 7. F.L. Lewis, Wireless Sensor Networks for Monitoring Machinery, Human Biofunctions, and BCW Agents

Other Sources: 1. Class Notes from UTA EE5322 (Fall 2004) 2. Class Notes from UTA EE5325 (Fall 2002)

19