Supervisory Control (4CM30) Networks of Automata – Formal definitions & Tool support Michel Reniers [email protected] 2016-2017 Summary previous lecture Networks of automata – Introduction I Synchronization of events I Shared variables Open automata – motivation I reconsider automaton definition: M = (L, V, E, −→, Lm , l0 , v0 ) I only caters for local variables I extend with external variables (only to be read) I disambiguation of variables by prefixing with automaton name queue1.count < 2 q1enter queue1.count := queue1.count + 1 queue1.count = 0 queue1.count > 0 q1leave queue1.count := queue1.count − 1 queue2.count < 2 q2enter queue2.count := queue2.count + 1 queue2.count = 0 queue2.count > 0 q2leave queue2.count := queue2.count − 1 Open automata – definition An open automaton is a 8-tuple (L, V, X, E, −→, Lm , l, v) where I L is a finite set of locations; I V is a finite set of local variables; I X is a finite set of variables (V ⊆ X); I E is a finite set of events; I −→ ⊆ L × G(X) × E × U (V, X) × L is the transition relation; I Lm ⊆ L is a set of marked states; I l ∈ L is the initial location; I v : V −→ Λ is the initial valuation of the local variables. I I I U (V, X) : set of all updates of variables from V where variables from X may be used in the right-hand sides of the updates X \ V : (set of) external variables open automaton with X = V is just an automaton (from Chapter 2) Exercise Provide the formal notation for the following open automata: queue1.count < 2 q1enter queue1.count ≤ queue2.count queue1.count := queue1.count + 1 q1enter queue1.count = 0 queue1.count > 0 queue2.count ≤ queue1.count q2enter q1leave queue1.count := queue1.count − 1 Network of automata Let I be an arbitrary index set. A network of automata is a collection of open automata Mi = (Li , Vi , Xi , Ei , −→i , Lmi , li , vi ) for i ∈ I, with I pairwise disjoint sets of local variables Vi such that S S Vi = Xi I each global / external variable of an open automaton is local to exactly one of the contained open automata i∈I i∈I Example count < 2 q1enter count := count + 1 count = 0 count > 0 q1leave count := count − 1 count < 2 q2enter count := count + 1 queue1.count ≤ queue2.count q1enter count = 0 count > 0 q2leave count := count − 1 queue2.count ≤ queue1.count q2enter I automaton queue1 has local variables {queue1 .count} and no external variables I automaton queue2 has local variables {queue2 .count} and no external variables I automaton customer has no local variables and has variables {queue1 .count, queue2 .count} I each external variable is declared by exactly one automaton Meaning of networks of automata I networks of automata for convenience of modelling I in principle a single automaton is represented I how to obtain a single automaton representing a network of automata? I define synchronous product of two open automata Synchronous product Given Mi = (Li , Vi , Xi , Ei , −→i , Lmi , li , vi ): M1 k M2 = (L, V, X, E, −→, Lm , l, v) where I I L = L1 × L2 V = V1 ∪ V2 −→ is defined as: I I I X = X1 ∪ X2 E = E1 ∪ E2 if σ ∈ E1 ∩ E2 , then ((s1 , s2 ), g1 ∧ g2 , σ, u1 ⊕ u2 , (t1 , t2 )) ∈−→ for each (s1 , g1 , σ, u1 , t1 ) ∈−→1 and (s2 , g2 , σ, u2 , t2 ) ∈−→2 such that u1 (x) = u2 (x) for all x ∈ dom(v1 ) ∩ dom(v2 ) if σ ∈ E1 \ E2 , then ((s1 , s2 ), g1 , σ, u1 , (t1 , s2 )) ∈−→ for each (s1 , g1 , σ, u1 , t1 ) ∈−→1 if σ ∈ E2 \ E1 , then ((s1 , s2 ), g2 , σ, u2 , (s1 , t2 )) ∈−→ for each (s2 , g2 , σ, u2 , t2 ) ∈−→2 I Lm = Lm1 × Lm2 I l = (l1 , l2 ) I v : V →(Λ is defined as follows: v1 (x), for x ∈ dom(v1 ) v(x) = v2 (x) otherwise u1 ⊕ u2 : combination of updates Example produce Producing provide Idle Consuming Idle provide consume Synchronous product: Producing Idle consume Producing Consuming produce Idle Idle provide produce consume Idle Consuming Locations formally: {(Producing, Idle), (Idle, Idle), (Producing, Consuming), (Idle, Consuming)} Example with variables count < 2 q1enter count := count + 1 queue1.count ≤ queue2.count q1enter count = 0 count > 0 q1leave count := count − 1 queue2.count ≤ queue1.count q2enter Synchronous product: queue1.count < 2 ∧ queue1.count ≤ queue2.count q1enter queue1.count := queue1.count + 1 queue1.count = 0 queue2.count ≤ queue1.count q2enter queue1.count > 0 q1leave queue1.count := queue1.count − 1 Tool support in CIF count < 2 q1enter count := count + 1 count = 0 count > 0 q1leave count := count − 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 count < 2 q2enter count := count + 1 queue1.count ≤ queue2.count q1enter count = 0 count > 0 q2leave count := count − 1 queue2.count ≤ queue1.count q2enter event q1enter , q1leave , q2enter , q2leave ; automaton queue1 : disc int count = 0; location l0 : initial ; edge q1enter when count < 2 do count := count + 1; edge q1leave when count > 0 do count := count - 1; end automaton queue2 : disc int count = 0; location l0 : initial ; edge q2enter when count < 2 do count := count + 1; edge q2leave when count > 0 do count := count - 1; end automaton customer : location l0 : initial ; edge q1enter when queue1 . count <= queue2 . count ; edge q2enter when queue2 . count <= queue1 . count ; end Computing synchronous products For automata without variables: I “Apply synchronous product ...” (again the keyword event may not be used and should be replaced by controllable or uncontrollable) For automata with variables the CIF tool set has two functions for replacing a network of automata with a single automaton. Neither of these computes the synchronous product as defined in this chapter. Guided self-study Open automata (Section 3.3) I Pick some automata from examples and exercises and practice writing down formal representations Synchronous composition of automata (Section 3.4) I Exercises 3.22, 3.24 - 3.28 Tool support for networks of automata in CIF (Section 3.5) I Exercises 3.29 - 3.30 Additional modelling exercises (Section 3.6) I Exercises 3.31 - 3.37 I Finish exercises from previous sections
© Copyright 2026 Paperzz