LOGICAL CONTROL OF DISCRETE EVENT SYSTEMS AN AUTOMATA BASED APPROACH Jose Eduardo R Cury

Preview:

Citation preview

LOGICAL CONTROL OF

DISCRETE EVENT SYSTEMS

AN AUTOMATA BASED APPROACH

Jose Eduardo R Cury

OUTLINE:

-Preliminaires

-Basic Control Theory

-Extensions: Modular Control;

Partial Observation;

Hierarchical Control;

limitations: computational complexity

1.Preliminaires

Approach introduced by

logical model: related with the logical behavior of the DES (possible state/event sequences)

timed and untimed versions

DES are modelled as generators of formal languages

Ramadge and Wonham (1984)

synthesis-based

Languages

= set of symbols = alphabet

Definition: A language L, defined over analphabet , is a set of strings of symbols in

Example:

={}

L1={

L2={All possible strings of lenght 3 and beginning with}

L3={All possible finite lenght strings and beginning with}

Regular Expressions

• Concatenation of strings:

u = v = conc.: uv =

• Operations on Languages:

Let A and B be 2 languages. We have

a) Concatenation:AB = {w: w=uv, u A, v B}

b) Kleene closure:

A* = n where: A0 = {}An = An-1A

c) Usual operations over sets

n=0

Example:

= {

L1 = L2 =

Then:

L1L2 = {

L1*= {

L2*= {

L1 L2 = L1 L2 = {

Notation: if u and v are stringsu = {u}

(u+v) = {u,v}={u}v}u* = {u,uu,uuu,...}

uv = {uv}

Definition (Regular Expressions):

1) is a regular expression denoting the empty language), is a regular expression denoting {},is a regular expression denoting {},

2) If r and s are regular expressions, then rs, r*, s*, (r+s) are regular expressions;

3) All regular expressions are obtained by applying rules 1 and 2 a finite number of times

Example:

Let = {}be an alphabet; then:

Definition:A regular language is any language which can be represented by a regular expression

Proposition:If L = {u1, u2,...,un} is a finite language,then L is a regular language

Prefix of a string:u * is a prefix of v * if for somew *, v = uw

Prefix-closure of a Language L:

L is the language composed by all prefixes of L:

L = { u / uvL for some v

Prefix-closed Language:

L * is prefix-closed if L =

i.e., if v L and u is a prefix of v thenu L

L

Finite State Automata

Device which accepts a Language according to specific rules.

Definition:A finite state automaton is a 5-tuple (,X,f,x0,F) where:

is a finite alphabet;X is a set of finite states;f is a state transition function,

f: X Xx0 is an initial state, x0X;F is a set of marked states, FX

Transition State Diagrams

Directed graphs where the nodesrepresent states and the labelededges represent state transitions

Example: (,X,f,x0,F) = {} X= {x,y,z}f(x,x, f(x, f(x,z,f(y,x, f(y, f(y,y,f(z,z, f(z, f(z,y,

x y

z

Language accepted by an automaton

Extended transition function:

f: XX

f(x,u) = f(f(x,u),)u

In the above example:

f(x, = f(f(x,),) = f(f(f(x,),f(f(z,f(z,) = y

Definition: A string u is accepted bya finite state automaton (,X,f,xo,F), if f(xo,u) = x, with x F

Definition: The language accepted by a finite state automaton (,X,f,xo,F) is the set of finite strings {u:f(xo,u)F}.If the automaton is denoted by A, then the language accepted by A é denoted L(A).

Example: Let = {} be an alphabet.Define a task as a sequence of 3 eventsbeginning with , followed by or , and then , followed by an arbitrary sequence.

Corresponding language:

5 0 1

2

3

4

L =

Non-Deterministic Finite State Automata

Example:

0 1

f(0,) = {0,1}; f(0,) = f(1,) = f(1,) = {0}

Definition: A Non-Deterministic Finite State is a 5-tuple:

(,X,f,xo,F)with ,X,xo,F as before, and f a transition state function f: XX

It allows for the expression of incompleteknowledge of the system and for the expressionof the physically admissible set of events whichfollows a state x.

Proposition: If L is the language accepted bysome non-deterministic finite state automaton thhen there exists a deterministic finite state automaton which accepts L.

Language accepted by a non-deterministic automaton

Extended transition function:

f(x,u) = {z: zf(y,) para algum estado yf(x,)}

u

Definition: The language accepted by a non-deterministic finite state automaton (,X,f,xo,F) is the set of finite strings {u:f(xo,u)F }.

Example: Let (,X,f,xo,F) be the automatonof the last example. Let us build adeterministic automaton (D,XD,fD,xo

D,FD)which accepts the same language

D = E

XD = {0,1,01, each element of XD corres- ponds to a subset of X)

xoD = xo = 0;FD = {0,01}

0

01

0

01

1

Equivalence between Finite State Automata and Regular Expressions

Theorem: (Kleene, 1950)If a language is regular, then it can beaccepted by some finite state automaton;and if a language is accepted by a finite state automaton , then it is a regular language.

Example of a non-regular language:L = {denoting: n = we haveL={n n , n = 0, 1, 2, ...}

State Agregation in Automata

Definition: Let (,X,f,xo,F) be afinite stateautomaton and R X. R is said to be formedby equivalent states if, for any pair x,y R, x y, and any u *

In general the number of states in an automaton is not minimal

Minimization equals

Identification of equivalent states

f(x,u) F if and only if f(y,u) F

Observações:

a) se x F e y F então x e y não podem ser equivalentes.

b) se f(x,e) = f(y,e) para qualquer e E (ex- ceto ) então x e y são equivalentes.

c) a propriedade acima se mantém se, para alguns eventos, f(x,e)=y e f(y,e)=x.

d) em geral, se R é tal que R F ou R F = então R é constituído de esta- dos equivalentes se f(x,e) = z R implica que f(y,e) = z, para quaisquer x,y R.

e) se F = X então todos os estados são equi- valentes em relação a F.

Example: Detector of the 1,2,3 sequence.

x1 x12 x123

x3 x2

2

31

2

3

1

23

1

23

1 2

3

1x0

x1 x12 x123

xo

3

2

1

2

3

1

231

23

Algoritmo para a Identificação deEstados Equivalentes:

1) Marcar (x,y) para todo xF, y F

2) Para todo par (x,y) não marcado em 1):

2.1) Se (f(x,e),f(y,e)) está marcado paraalgum e E então:

2.1.1) Marcar (x,y)2.1.2) Marcar todos os pares não-mar

cados (w,z) na lista de (x,y). Repetir para cada (w,z) até quenenhuma marcação seja possível

2.2) Se (f(x,e),f(y,e)) não está marcadopara nenhum e E então:

2.2.1) Se f(x,e) f(y,e), então acres-centar (x,y) à lista de (f(x,e),f(y,e))

Generators

Definition: A Generator is a 5-tuple G = (, X, f, xo, F) where , X, xo, F are defined as for the automataand f is a partial function f: X X , defined only for some elements of X (notation: f(x,)!).

Definition fits with the fact that in systemssome transitions are not physically admissible

Notation:(x) set of admissible events after x X

Language Generated by G:

Properties:

• L(G) is prefix-closed;

• An automaton A is a generator with L(A) = *

•Lm(G) L(G)

Marked Language of G:

L(G) = {u E* / f(xo,u)!}

Lm(G) = {u E* / f(xo,u)F)

Example: Three state machine

sf

b

r

I

W D

= { s, f, b, r}

L(G) = (sf + sbr)*( + s + sb)

represents the set of all physically admissiblesequences in the system.

Lm(G) = (sf + sbr)*

represents the set of all completed tasks possible to occur in the system.

Accessibility and Co-accessibilityof a Generator

Accessible state: A state x X is accessible if x = f(xo,u) for some u *.

Accessible Generator: A generator is accessibleif every x X is a reachable state.

Accessible Component of G:

Gac = (Xac, , fac, xo, Fac)

where:Xac : set of accessible states of GFac : XrFfac : f/Xac

If G is accessible then Gac= G

Co-accessible Generator (non-blocking): A generator is co-accessible (non-blocking)if any u L(G) can be completed into a string in Lm(G).

If u L(G), then w * / uw Lm(G)

Trim Generator: A generator is trim if it isaccessible and co-accessible.

Example:

xo x1

x2

x3

x5

x4

x4 : non accessible state;x5 : non co-accessible state (blocking state)

xo x1

x2

x3

xo x1

x2

x3

x5

Gac: accessible component of G

Gt: Trim generator

Property: A generator is co-accessible(nonblocking) if and only if Lm(G) = L(G)

Composing Generators

Synchronous and Shuffle Product

Natural Projection: Let and i be sets of events with i . The natural projection Pi: *i

is definedas:

Pi() =

Pi() =

if i

if i

Pi(u ) = Pi(u) Pi() onde u * ;

The action of Pi over a string corresponds todeleting events not in Ei.

Extending natural projections to languages:

PiL = Li = {ui i* / ui = Piu for some u L}

Inverse Projection:

Pi-1Li = {u * / Piu Li}

Synchronous Produt:Let L1 1

* e L2 2* (with possibly

1 2 ). Let = 1 2. Thesynchronous produt L1 //s L2 * is defined as:

L1 //s L2 = P1-1L1 P2

-1L2

Observe that u L1 //s L2 if and only ifP1(u)L1 and P2(u) L2

Example: 1 = {

G1:

G2:

G = G1 // G2 :

L(G) = L(G1) //s L(G)2

he synchronous product represents a languagegenerated by a generator which is the result of the joint action of two other generators

Intersection of languages:Corresponds to the synchronous productwith since in this case Pi

-1Li = Li

L1 = (

L2 = (

L1 //s L2 = L2

Example:

Corresponds to the synchronous productwith 2 =

The Shuffle Product of two languages L1 and L2

is the language consisting of all possible interleavings of strings of L1 and L2

Language generated by a generator which is the result of the independent or asynchronous action of two other generators

Shuffle Product:

Example: Two independent and assynchronoususers of the same resource

I2

R2 U2

I1

R1 U1

I = idle; R = requiring the resource; U = using the resource

Assynchronous Composition

G = G1 // G2

States: (x,y), xG1, y G2

Transitions: (x,y) (x’,y) or (x,y) (x,y’)

I1I2R1I2 U1I2

I1R2 R1R2 U1R2

I1U2 R1U2U1U2

L(G) = all strings over E1 E2 which correspond to paths in the graph starting in I1I2

Lm(G) = Idem, but ending in I1I2

G is co-accessible : Lm(G) = L(G)

. Limitations

- DES, SPEC., CONTROLLERS finite state machines;

- Algorithms often polynomials in the number of states of DES, which grows exponentially with the number of components

2. Basic Control Theory. The Control

- Some events can be disabled by an external controller

- Events to be disabled depend on the past behavior of the DES

. Methodology

1. Modeling the OPEN LOOP BEHAVIOR

2. Modeling the SPECIFICATIONS:

Safety, Liveness, Fairness

3. Synthesizing the OPTIMAL CONTROL LAW

Control of DES

• Control action some events can be externally disabled

• Measured variablescurrent state or sequence of past events

DES

Controller

state orsequence of eventsControl

Central Idea:

Methodology

1) Specification of the Open-loop behavior.

2) Specification for the Closed-loop behavior.

Typical specifications:• Safeness• Liveness• Fairness

3) Synthesis of the control law satisfaction of specifications in a least restrictive way

Some characteristics of the approach

• The three steps are performed systematically (including automatic synthesis)

• Plant, closed-loop specifications, and controllermust

be modeled by finite state generators.

• Computational complexity

• research issue

• number of states grows exponentially with the number of sub-systems.

• polynomial in the number of states

Partition of :

= c u

c : set of controllable events

u : set of uncontrollable events

Control input:

If then it is allowed by otherwise is disabled by.

Control Structure

can be disabled

can not be disabled

Subset tal que

u uncontrollable events can not be disabled)

Set of possible control inputs: 2

DES with control structure: Generator G and a set of control inputs .

s, f, r, b};2 = {s, f, b};3 = {r, f, b};4 = {f, b}

Control is permissive

It doesn’t force but just enablesor disables events

Events are generated by the plant

sf

b

r

I

W D

Example: Three states machine.

c=s, r} u={f, b}

Controller which switches the control inputs’, ’’, ’’’,... as a function of the measuredsequence of events.

Formally, a function

h: L

which associates to each possible string L a control input = h()

After generating

h() (f(xo,))

Supervisor:

next event is an element of

System under supervision:

The closed-loop behavior of h/G is defined by the language L(h/G) L(G):

• L(h/G)• L(h/G) if and only if

L(h/G), L(G), h()

Closed-loop generated behavior:

Properties:

• {} L(h/G) L(G)• L(h/G) is non-empty and prefix-closed

(closed-loop system)

Notation:

Closed-loop behavior

h/G : G under supervision of h

Closed-loop marked behavior:

Lm(h/G) = L(h/G) Lm(G)

Lm(h/G) is the part of Lm(G) which survivesunder supervision.

Property:Lm(h/G) Lm(G)

Definition: h is nonblocking for G if

Lm(h/G) = L(h/G)

every generated sequence of eventscan be completed into a marked sequence

It may represent the set of tasks which can be performed under supervision.

State realization of h

Let T be an automaton:(,Y,g,yo,Y)

Let be a complete function from Y to : Y

Let h be a supervisor defined for G = (,X,f,xo,F): h:L

(T,) implements the supervisor h if, for every L(h/G):

y(g(yo,)) = h()

In words, h() can be obtained by

The automaton T has its transitionsdriven by the events in G

Generator G

AutomatonT

enabledevents

y

i. applying to the automaton T, leading it to the state y. ii. applying = y such that y = h() .

Realization by a Generator S

Representation of the supervisor by a generator S

• If L(h/G) then L(S), L(S) only if h() or L(G);• If L(h/G), L(G), h()

then L(S)

• transitions disabled by h and physically possible, don’t appear in the transition structure of S.

• transitions enabled by h, and physically possible, must appear in the transition structure of S.

control action over G implicit in the transition structure of S.

In words

S is the generator (,Y,g,yo,Y)

• transitions: driven by events occured in G in accord to g

• control action: once in the state y S disables events L(G), such that(y)

h() (f(xo,)) (g(yo,)) (f(xo h()

G

S

enabledevents

Closed-loop behavior

The behavior of h/G can be representedby the generator corresponding to the composition of S and G (S // G):

h/G = S // G = {, YX, , (yo, xo), Y F}

where: ((y,x),e) = (g(y,e),f(x,e))

if g(y,e)! e f(x,e)!

In the composition S // G only transitions enabled in both generators can occur. If the supervisor disables a transition, it doesn’toccur.

Example: Dinner of two philosophers

P1 P2

M Ee1

m1

G1:

M Ee2

m2

G2:

EE

m2

e2

MM

EM ME

e1

m1e2

m2

m1

e1

G = G1 // G2

c = {e1, e2}

u = {m1, m2}

Control specification: avoid state EE

Let a supervisor be defined by:

In this case it is easy to see that:

L(h/G) = ((e1m1)+(e2m2))*(e1 + e2)

Lm(h/G) = ((e1m1)+(e2m2))*

h[((e1m1)+(e2m2))*e1] = {e1, m1, m2}

h[((e1m1)+(e2m2))*e2] = {e2, m1, m2}

for all other strings L(G), h() = {e1, e2, m1, m2}

and the control specification is attained.

Realization by (T,):

yo

y1 y2

e1

m1e2

m2

e1 e2 m1e1 e2 m2

m1 m2Automaton T:

(yo) = {e1, e2, m1, m2}(y1) = {e1, m1, m2} = h[((e1m1)+(e2m2))*e1](y2) = {e2, m1, m2} = h[((e1m1)+(e2m2))*e2]

* = irrelevants

e1 e2 m1 m2

yo 1 1 1 1

y1 1* 0 1 1

y2 0 1* 1 1

EE

m2e2

MM

EM ME

e1

m1 e2

m2

m1

e1

yo

y1 y2

e1

m1e2

m2

e1 e2 m1e1 e2 m2

m1 m2

e1 e2 m1 m2

yo 1 1 1 1

y1 - 0 1 1

y2 0 - 1 1

Closed-loop system

Realization by a generator S

yo

y1 y2

e1

m1e2

m2

S: Obs.:L(S) = L(h/G)

Closed-loop system: composition of S and G

EEyo

EMy1 MEy2

e1

m1e2

m2

S // G:

L(S//G) = L(h/G)Lm(S//G) = Lm(h/G)

Some questions:

• Some specifications could not be exactly attained

•Which are the conditions for a specification to be exactly attained ?

• If there exist several incomplet solutions which one is the best ?(in the ex., if (yo) = {m1, m2} specification is attained, but the philosophers will eventually die)

• Are there other ways to express specifications than just by forbidden states?

Controllability and

Existence of Supervisors

Given a DES G with generated behavior L(G) and marked behavior Lm(G)), which closed-loopmarked behaviors KLm are possible to be obtained by the action of a nonblockingsupervisor ?

Problem:

Equivalently,

What are the conditions on KLm

under which there exists h such that

Lm(h/G) = K ?

Lm(h/G) = L(h/G)

Illustration: Dinner of philosophers with “sake”

M E Dei

mi

di

fi

Gi: (i = 1,2)

c = {e1, e2}

P1 P2

e1

m1

e2

m2

d1

f1 e2

m2m1

e1f2

d2

m2

e2f1

d1 d2

f2e1

m1

f2

d2

f1

d1

MM

MEEM

MD

DE ED

EE

G = G1 // G2:

DM

DD

Control Specification: avoid state DD

Control Specification:

G’:

One must find h such that:

L(h/G) = L(G’) or Lm(h/G) = Lm(G’)

e1

m1

e2

m2

d1

f1 e2

m2m1

e1f2

d2

m2

e2f1

d1 d2

f2e1

m1

MM

MEEM

MD

DE ED

EEDM

Impossible: observe that e1d1e2 leads toa state where it is impossible to preventthe occurrence of d2

Controllability

A language K* is said to be controlablewith relation to a language L if

u L K

Obs.: , L(G) e * are controllable w.r.t. L(G)

In words, controlability of K implies that anyprefix of a string in K, when followed by anuncontrollable event such that L, mustremain being a prefix of K ( K)

Systemic Interpretation:

If L represents the generated behavior of a DES G, K is controllable if and only if no sequences in G which are prefixes of K, when followed by uncontrollable events in G exit the prefixes of K

Example:

0 1

2

3

a b

c

de

G:

L(G) = (abc + ade)* ( + a + ab + ad)

If K = (abc)* ab

then: K = (abc)* ( + a + ab)

If u = {a, b, c, d, e} and c = { } thenK is not controllable w.r.t. L(G)

since KEu L = (abc)*( + a + ab + ad)

If u = {a, b, c, e} and Ec = {d } thenK is controllable w.r.t. L(G)

since KEu L = (abc)*( + a + ab)

sf

b

r

I

W D

L(G) = (sf + sbr)*( + s + sb)

Example:

G:

For: K = (sbr)* K = (sbr)* ( + s + sb)KEu L = (sbr)* (sf + sb)K is not controllable w.r.t. L(G)

For: K = (sf)* K = (sf)* ( + s)KEu L = (sf)* (+ sb)K is not controllable w.r.t. L(G)

For: K = {sf, sb} K = {, s, sf, sb}KEu L = {sf sb}K is controllable w.r.t. L(G)

No exemplo do almoço dos filósofos,tanto L(S//sG) como Lm(S//sG) são con-troláveis em relação a L(G).

c1m1

c2m2

b1 d1 c2

m2m1

c1d2

b2

m2

c2d1

b1 b2

d2 c1m1

MM

MCCM

BM MBCC

BC CB

No exemplo do almoço dos filósofoscom vinho, tanto L(G’) como Lm(G’)não são controláveis em relação a L(G).

yo

y1 y2

c1

m1c2

m2

c1 c2 m1c1 c2 m2

m1 m2

Objectives of Supervision

Lm(h/G) = K

Given a specification K Lm(G) whichrepresents the tasks we want to be completed under supervision,

find (if possible) a nonblocking supervisor hsuch that the closed loop behavior satisfies

L - closure

Def.: Let K and L be languages withKL *. K is said to be closed w.r.t L or L-closed if

K = K L

i.e., K is L-closed if every one of its prefixes that belong to L, are also contained in K.

Example:

G:

Lm(G) = { }

K1 = {} is Lm-closed since:

K1 Lm = {} Lm = K1

K2 = {} is Lm-closed since:

K2 Lm = {} Lm = K2

K3 = {} is not Lm-closed since:

K3 Lm = {} Lm K3

Existence of Supervisors

Proposition: Given a generator G, with marked language Lm(G), and a specificationK Lm(G), K , there exists a nonblockingsupervisor h, such that Lm(h/G) = K

if and only if

K is Lm- closed and L- controllable.

Example:

L(G) = (abc + ade)*( + a + ab + ad)

Lm(G) = (abc + ade)*(ab + ad)

G is trim (thus open-loop nonblocking) (Lm = L)

Eu = {a, c, e}Ec = {b, d}

xox1

x2

x3

abc

de

G:

K = (abcade)*(ab + abcad) Lm(G)

K Lm(G) = K andK is controllable

Thus there exists a nonblocking h, such that:Lm(h/G) = K

Supervisor synthesis:

A possible solution is S with L(S) = K

a b c a d

eS:

(abcade)*

()*a()*ab()*abc

()*abca()*abcad

h a b c d e

11

1

1

1

1

1

11

1

1

1

1

0

11

1

1

11

0

1

-

--

-

-

-

-

-

which represents any supervisor h of the form:

Not the solution with minimal number of states.

The solution can be represented by any DES S, such that L(S) //s L(G) = K

Another solution is:

yo y1

a

a

d,e b,c

where:L(S) = [(d + e)*a (b + c)*a]*[ + (d + e)* +

+ (d + e)*a + (d + e)*a (b + c)*]

and L(S) //s L(G) = L(S) L(G) = K

The above DES is a representation of:

(abcade)*( + abca + abcad)

(abcade)*(a + ab + abc)

h a b c d e

1

1 1 1 1

1 1 10

0

Supremal Controllable Sub-language(Least restrictrif (optimal) supervisor)

Controllability is necessary for the existence of supervisors

Question: What to do if K is not controllable ?

We will show that there exists a unique bestapproximation of K, the supremal controllable language contained in K (notation: sup C (K))

Under certain conditions this language satisfiesalso the closure conditions which guarantiesthe existence of a supervisor. Such supervisor is the least restrictive or optimal supervisor.

Existence of the supremal controllablesublanguage of K

Let L(G) (generated by a DES G) andK * (closed-loop specification).

C(K) = {J K / J is L controllable i.e. JEuL(G) J}

Proposition: C(K) is non-empty and closedunder the operation of union.In particular, C(K) contains a unique supremalelement denoted sup C(K).

Proposition: Let K Lm(G) be Lm-closed(K = K Lm). Then sup C(K) is Lm-closed.

Corollary: Let G be a DES with generatedbehavior L(G) and marked behavior Lm(G). We have:

• if KLm, K and K = K Lm, there exists a nonblocking supervisor h such that

Lm(h/G) = sup C(K)

Obs.: The above supervisor induces a behaviorwithin the specifications given by K in theleast possible restrictive way. In this sense itis optimal.

Synthesis of supC(K)

Let:K: a regular languageG: a DES with behaviors L(G) and Lm(G)S: a trim generator with Lm(S) = K Lm(G)

Algorithm 1:

1) Compute Co = G // S; make i=0; (Observe that: Lm(Co) = Lm(G)Lm(S) = K)

2) Identify the bad states in Ci; states (x,y) s. t. u(G’)(x) u(Ci)(x,y);

3) Obtain Ci’ by eliminating the bad states in Ci and their associated transitions. Make Ci+1 = trim Ci’

4) If Ci+1 = Ci , stop since sup C(K) = Lm(Ci); otherwise make i = i+1 and go to step 2.

Algorithm 2:

1) as in the above algorithm;

2) Identify bad states in Ci as in 2 of the above algorithm. If there is no bad states, go to 6;

3) Build Ci’ by deleting all transitions which correspond to controllable events in Ci;

4) Determine other bad states, as those which have paths in Ci’ leading to at least an already identified bad state;

5) Modify Ci, by deletingthe bad states identified in steps 3 e 5, and corresponding transitions; make Ci+1 = trim Ci;

6) If Ci+1 = Ci , stop since sup C(K) = Lm(Ci); otherwise make i = i+1 and go to 2.

Example:

xo x1 x2

a,b

c u

a a

G:

u = {u}; L(G) =(a+b)*ca*ua*

K = (ab)*(acu + c)a*

yoy1 y2

y3

a

b

c

c u a

S:

Lm(S) = L(S) = K

sup C(K) = (ab)*acua*

Example:

yo

y1 y2 y3 y4

y5y6

G:

K =

S:

sup C(K) =

xo

x1 x2 x3 x4

x5x6

u = {}

Recommended