Using Finite State Automata to Model Manufacturing Systems R. Wysk.

45
Using Finite State Automata to Model Manufacturing Systems R. Wysk

Transcript of Using Finite State Automata to Model Manufacturing Systems R. Wysk.

Page 1: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

Using Finite State Automata to Model Manufacturing Systems

R. Wysk

Page 2: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

Agenda – Systems Theory according to Wysk

• Typical manufacturing systems

• Modeling a manufacturing system as a state machine

• What is a finite state machine?

• Notation and variables

• Examples

Page 3: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

Basic types of systems

• Continuous– Normally modeled as differential state based

entities

• Discrete (DES)– Not adequately modeled as differential or

difference entities– Checkers, chess, many manufacturing

systems

Page 4: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

How about Starbucks?

Page 5: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

The Concept of a Language

• Every DES has an underlying event set, E associated with it.

• The set E is thought of as the “alphabet” of a language.

• The event sequences for a DES are thought of as “words” in the language.

• Different modeling prospective can be taken for most DES

Page 6: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

Examples - chess

• Model with respect to one piece

• Model with respect to one color

• Model with respect to all pieces

Page 7: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

Examples - manufacturing

• Model with respect to a part

• Model with respect to a machine

• Model with respect to all resources

8

2

34 5

6

71Machine

1 M1Machine

2 M2R

L UL

Page 8: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

How about our machine?

Page 9: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

Examples – Highway systems

• Model with respect to one car (like a GPS)

• Model with respect to one highway

• Model with respect to all highways and cars

Page 10: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

How about driving to Crabtree Valley Mall?

Page 11: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

Intent

• Show what a finite state automata (FSA) is

• Show how to formally model an FSA

• Illustrate some uses for FSAs

• Discuss “discrete event systems” modeling

Page 12: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

Part Flow Through the Shop

E nterS hop

D eliver toW ks tn

P ut onEq uip P rocess

R efix tu reP ick fromE qu ip

R em ove fromW k stn

E xitS hop

P ut onEq uip

D e live r toW ks tn

Page 13: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

Finite state view to IllustrateControl Simulation Requirements

TaskNumber

TaskName

1 Pick L2 Put M13 Process 14 Pick M15 Put M26 Process 27 Pick M28 Put UL

8

2

34 5

6

71Machine 1

M1Machine 2

M2R

L UL

Page 14: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

Physical Model - Processing Workstation

S

po rt_ a rr ive

port_p ickport_depart

bs_p ick bs_put

port_put

E

P o rt M H

B S

m p_pickm p_put

M P

m p_pick

m p_put

MP

Process

Process

Page 15: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

Some Observations about this Perspective

• Generic -- applies to any system

• Other application specifics– Parts

• Number• Routing• Buffers (none in our system)

Page 16: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

Finite State Automata (FSA)

• Consist of– Nodes – X– Events – E– Transition maps – f(m,n,e)

– Starting state – q0

– Event transitions – F(X1, e) = X2

Page 17: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

Modeling a state graph• States/nodes - X ( x , y, z )• Events/transistions - E ( a , b, g )• Graph construction

– F (x , a ) = x– F (y , a ) = x

– F (z , b ) = z

– F (x , b ) = F (x , g ) = z

– F (y , b ) = F (y , g ) = y

– F (z , a ) = F (z , g ) = y

Page 18: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

The Graph looks like

x y

z

Page 19: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

So FSAs

• Formal way to model discrete systems• Can symbolically build complex systems • Capture lots of system detail• Provide the grain for modeling a system

• So what about a DC?

Page 20: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

Deterministic Automaton

• A Deterministic Automaton, denoted by G, is a six-tupleG = (X,E, f, Γ, x0,Xm)

where:X is the set of states

E is the finite set of events associated with G

f : X × E → X is the transition function: f(x, e) = y means that there is a transition

labeled by event e from state x to state y; in general, f is a partial function on its

domain

Γ : X → 2E is the active event function (or feasible event function); Γ(x) is the set of

all events e for which f(x, e) is defined and it is called the active event set (or feasible

event set) of G at x

x0 is the initial state

Xm X ⊆ is the set of marked states.

Page 21: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

• The words state machine and generator (which explains the notation G) are also often used to describe the above object.

• If X is a finite set, we call G a deterministic finite-state automaton, often abbreviated as DFA.

• The functions f and Γ are completely described by the state transition diagram of the automaton.

• The automaton is said to be deterministic because f is a function from X × E to X, namely, there cannot be two transitions with the same event label out of a state.

• In contrast, the transition structure of a nondeterministic automaton is defined by means of a function from X × E to 2X; in this case, there can be multiple transitions with the same event label out of a state. Note that by default, the word automaton will refer to deterministic automaton.

• The fact that we allow the transition function f to be partially defined over its domain X × E is a variation over the usual definition of automaton in the computer science literature that is quite important in DES theory.

Page 22: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

Planning, Scheduling, and Execution

• PlanningDetermining what tasks thesystem needs to perform

• SchedulingSequencing planned tasks

• ExecutionPerforming the scheduledtasks at the appropriatetime

S ystem O p era tio n

P lann in g

S ch ed u lin g

E x ecu tio n

P hysica lS ys tem

P lann ed ta sk s

S ched u led ta sk s

T ask s

Page 23: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

Shop Floor Controller Structure

ProductionR equirem ents

C ontro lle r

PhysicalSystem

I/O C hanne ls

P lanner S cheduler Ex ecuto r

TaskL ist

I/O C hannel

System M odel

PhysicalM odel

SystemSta tus

PhysicalConfigura tion

Page 24: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

Gate House

1 2 3

Dock 3

Yard Example

We can treat the Gate

House as the “material handler”

Queue of

trucks

Page 25: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

System Model for the Yard

Yard Gate House

Dock 1

Dock 2

Dock 3

Depart

Truck Arrival

Request

Go to 1

Go to 2

Go to 3

Page 26: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

Build a formal model of the state graph

• X (Yard, Gate, Docki)

• E(Depart/Balk, Gate_serve,Traveli, Leave to gate, Return to yard)

• You finish the FSA modeling

Page 27: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

Some things not considered

• Queue discipline– FIFO, SPT, …

• Rules for assigning trucks to docks– Due date, SPT, …

Page 28: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

A – Inbound truck load (pallets) Ip – Pallet in buffer area p B – Inbound truck load (cases) Jk – Pallet at outbound dock k Ci – Cases in bulk dock i Ko – Pallet at case picking rack o (level 1) Di – Pallets at inbound dock i L – Re-work area Ej – Pallet in forklift j – TRM algorithm Mp – New pallet in buffer area p Fl – Complete pallets in drive-in rack l Np – Wrapped pallet in buffer area p Gm – Partial pallets in single-deep rack m Oq – Pallet in pallet jack q Hn – Pallet at case picking rack n (level 2) P – Cases in truck load

Page 29: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

A communicating automata

• An FSA that interacts with a decision maker– Decision maker can be a person, algorithm, …

• Messages create changes in the graph– Go_to_Dock #1 equivalent to the controller telling a

driver to proceed to dock #1

• Input and Output messages– Input messages update the status of the graph– Output messages signal the start of an event

Page 30: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

Deterministic and non-deterministic FSAs

Yard Gate House

Dock 1

Dock 2

Dock 3

Depart

Truck Arrival

Request

Go to 1

Go to 2

Go to 3

Page 31: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

A – Inbound truck load (pallets) Ip – Pallet in buffer area p B – Inbound truck load (cases) Jk – Pallet at outbound dock k Ci – Cases in bulk dock i Ko – Pallet at case picking rack o (level 1) Di – Pallets at inbound dock i L – Re-work area Ej – Pallet in forklift j – TRM algorithm Mp – New pallet in buffer area p Fl – Complete pallets in drive-in rack l Np – Wrapped pallet in buffer area p Gm – Partial pallets in single-deep rack m Oq – Pallet in pallet jack q Hn – Pallet at case picking rack n (level 2) P – Cases in truck load

Page 32: Using Finite State Automata to Model Manufacturing Systems R. Wysk.
Page 33: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

• Generic -- applies to any discrete system

• Other application specifics– Parts

• Number• Routing• Buffers (none in our system)

Some Observations about this Perspective

Page 34: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

RapidCIM Model

• Message-based part state graph (MPSG)– Execution formalism based on finite automata– Mimic controller behavior from part point of

view– Explicitly separate scheduling from execution– reference: Smith and Joshi, 1992– web site:

http://www.engr.psu.edu/cim/control.html

Page 35: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

Generated FSA Execution model -- based on the rules, but manual yet

1

1

1

R

M2

M3

AS

1

Due to limited space, these two arrows are

expanded in this figure

part_enter@1_sb rm_asrs@1_sb rm@1_bk at_loc@1_kb

pick_ns#1@1_sb.......return_ok@1_bs

I I O I

II

at_loc@1_bs

O

pick_ns#1@1_br

O

mv_to_asrs@1_sb arrive@1_bk arrive_ok@1_kb loc_ok@1_bs

put_ns#1@1_sbput_ns#1@1_brclear_ok#1@1_rbput_ok#1@1_bs.......

I O I O

IOIO

T

delete@1

Robots IndexR 1

Stations IndexAS 1M1 2M2 3M3 4

Blocking attributes are set

to 1: must be blocked

M1

Page 36: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

RapidCIM Project

• Built formal models for shop floor control (MPSG)

• Developed a compiler to automatically generate code for control

• Created Arena RT messaging

• Used process plans to define part routes

Page 37: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

Message-based Part State Graph (MPSG)

• An MPSG is a deterministic finite automaton representing the processing protocol for a part.

• An MPSG state provides information about the current processing state of the part that is needed to determine the behavior on subsequent events.

• State transitions are caused by receiving messages about the part and by performing functions specified by the scheduler.

Page 38: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

• A Mealy machine is essentially a finite automaton with output. Formally, a Mealy machine M defined as follows:

So, a Mealy machine is a finite automaton in which an output (defined by and ) is generated during state transitions.

Mealy Machine

M Q q

Q q

Q

, , , , , ,

, , , ,

,

:

0

0

where

and are as is in a finite automaton,

is an output alphabet and

is an output transition function.

Page 39: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

MPSG Definition

function.nsition action tra controller a is )(:

functionn transitiostate a is )(:

false.or truereturns which predicate a is

each e,Furthermor . ingcorrespond a is there,each for that so

dpartitione is actions. controllerfor onspreconditi physical ofset finite a is

action controller some performswhich

function executablean is whereactions controller ofset finite a is

taskscontroller ofset a is

messagesoutput ofset a is

messagesinput ofset a is

and events, ofset finite a is )(

states acceptingor final ofset a is

statestart or initial theis

states ofset finite a is

:Where

),,,,,,,(=MPSG

0

0

TO

TOI

T

O

I

TOI

Q

QQ

QF

Qq

Q

FqQ

Page 40: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

MPSG for Generic MP Equipment

assign _w e t_assign @ loc_ew

@ loc_ns_ew

grasp_we t_grasp grasp_ok_ew clear_ok_we

m p_ put

1 2 3 4 5 6 70

proc esst_sta rt

t_s top

t_dnld

fin ish_de done_ew

t_sta rt

t_dn ld

done_ew

7 8 9 10

re lea se_ok_ew@ loc_ew

@ loc_ns_ew

clear_ok_werem ove_w e t_rem ove re lease_w e t_re lease

m p_ p ick

10 11 12 13 14 15 16 17

Page 41: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

MPSG Characteristics

• Explicitly separate scheduling from execution.• Extensible at multiple levels to facilitate

software development– Generic MPSG can be used unmodified.

– Extraneous transitions can be removed.

– Specified messages and tasks can be rearranged.

– New messages and tasks can be specified.

• Execution portion of the control software is automatically generated from the MPSG description.

Page 42: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

Simulation-based SFCS

ARENA: real-time(Shop floor controller)

Big Executor (Shop Level)Big Executor (Shop Level)

Equipment Controllers

SL-20SL-20Hass VF 0E

Hass VF 0E

M1M1ABB 240

ABB 240

AGVSAGVSKardexKardex

TaskOutput Queue

TaskOutput Queue

Database Scheduler

TaskInput Queue

TaskInput Queue

ABB140

ABB140

Page 43: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

Equipment-level Device Interaction

robot clear

execute programto close fixture

fixture closed

execute partprogram

clear to load part ?

execute programto load partclose fixture

execute program to release part and

move away

clear

mp_put

Page 44: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

Uses of FSAs

• Can generate controllers automatically– Software can be created directly from this formal

model

• Can be used to define resources and events in a discrete system – Bernie Zeigler won the IEEE Gold Metal for his work

on DEVS (2002)

• Can be used to automatically generate simulation model – Son created both software controllers as well as

simulation for messaging

Page 45: Using Finite State Automata to Model Manufacturing Systems R. Wysk.

Summary - Process a part

part_enter_sb remove_kardex_sb pick_ns_sb return_sb

put_sb

move_to_mach_sb

move_to_kardex_sb

put_

ns_s

b

move_to_mach_sb

0 1 2 3

456

process_sbpick_sb

7

8 9return_sb