The present invention concerns a method which works upon an abstract operational and structural model of the control of one or more sets of state machines, named assemblages, by means of other state machines, named controllers. According to the model, such controllers may be further grouped into assemblages themselves and be controlled, on their turn, by other controllers, and so on.
The method is based on state constraints, which are propositions about the global state of an assemblage and enforces safety in a state based design, that is it checks that such constraints are always verified, that is when the controller is in a given state the controlled machines in the assemblage do not violate the constraint of such state. It moreover shows how to ensure that a reactive behavior is correctly implemented, that is when the assemblages moves, in an uncontrollable way, to a global state which violates the constraint of the current state of the controller, then there is a transition in the controller that is triggered and move the control out of the violated state. The method enforces also liveness in a state based design, by checking that any part of the constraint of a given state may be reached by the global state of the assemblage.
State machines
State machines as referred to in this invention are used in the control of physical machines. Such physical entities have a behavior, which is a sequence of physical states. In order to observe and control such a behavior, and therefore the machine itself, each of the physical states of the machine is converted into a logical state through a special device named sensor.
Conversely, given a set of logical states, a physical machine may be forced to move to a specific physical state corresponding to a given logical state, through a special device named actuator, that converts logical commands of a state machine into physical commands acting on a physical machine. It is also possible that a physical machine changes its state spontaneously.
The transition among the logical states is referred to as state transition. A transition among logical states in a logical machine corresponds therefore to a transition among physical states in the physical machine.
Sensor and actuators act therefore as an interface between a physical device and a computer, which manipulates indeed logical symbols. Since, as observed, there is a direct and given correspondence among physical and logical states, with related transitions among them, it is possible to use the term state machine to denote both the symbolic behavior of a device, as well as its physical counterpart.
State machines play a twofold role in a control model, since they have to represent both the behavior to be controlled as well as the behavior which exercises control over other state machines. Additionally, the two roles have to coexist in a single state machine, since controllers may be further grouped into assemblages which are controlled on their turn. The behavior of a state machine is represented by a succession of states and state transitions, originating from an initial state q0. At each time the state machine is found in a state, named current state. State transitions take the state machine from one current state to another state and are triggered, that is activated, by either:
A state machine consists of an interface, which allows an external controller to observe and control the behaviour of the machine and of an implementation, which allows the machine acting as a controller to observe and control, in turn, the behavior of other state machines through their interfaces.
A state machine interface consists of:
The interface of a state machine is therefore formally given by:
It is useful to define the inverse of the transition labelling function trigger−1:E→2T, such that, for any e∈E, trigger−1(e) denotes the set of state transitions which are labelled by event e,
Input transitions are controllable through the interface, that is their activation can be requested by the controller. In any case such a request is not mandatory, that is any transition request by the controller may either succeed or not. Output transitions are instead not controllable through the interface: as such, they will also be called automatic state transitions, in the sense that they happen with no intervention from the controller. We distinguish finally a subfamily of automatic state transitions, that is (automatic) instantaneous state transition, which are taken, as their name suggests, as soon as possible.
By convention, state transitions departing from the initial state q0 have to be automatic instantaneous state transitions and do not have to be labelled by any output event.
It is useful to group state machines into assemblages A={c1,c2, . . . cM}, which are finite set of state machines, each univocally identified within the assemblage by the distinct identifiers c1,c2, . . . cM.
State machines within an assemblage have to exhibit a global coordinated behavior. Each state machine within an assemblage makes visible only its interface, hiding other details. We will refer to each of the ci∈A as assemblage component, or more simply to as component. Components may be additionally partitioned into two classes: asynchronous and synchronous devices. Such a distinction which will have an effect on the behavior of the state machine during its interaction with a controller. Synchrony issues are discussed more thoroughly here below.
Each state machine Ci belonging to an assemblage A will be found, at any time, in a state belonging to its own set of states qc
Since the behavior of an assemblage has to be controlled and sensed as a whole by means of a controller, we will refer to the state transitions and to the event symbols of its component machines through unique identifiers within the assemblage. We build such a set of assemblage global identifiers by prefixing with the assemblage component name ci each event symbol e∈Ec
Both the univocally identifiable event symbol c.e and transition c.t will be referred to as assemblage commands. Commands are additionally classified into the sets IA and OA, respectively of input and output commands depending whether the original event symbol or transition identifier belongs to the set of, respectively, input or output events and transitions, in the original component machine.
The implementation details of a state machine consist of additional features associated to state transitions:
The implementation features of a state machine are given formally by:
A state machine description may be succinctly written by a tuple:
S=
q
0
Q,T,δ,E,event, I,O, trigger, actions, guard
An object of the present invention is to provide a method for ensuring that an assemblage of state machines does not reach a global configuration of states which may be harmful.
According to the present invention there is provided a method for controlling a physical machine or an assemblage of physical machines for ensuring safety and liveness rules in a state based design of said physical machine or assemblage of physical machines, characterized in that it comprises associating at least one logical state to at least one physical state said physical machine or assemblage of physical machines may assume, providing state constraints for said logical states, checking that a physical state assumed by said physical machine or assemblage of physical machines is associated to a logical state complying with said state constraints.
The invention will now be described, only by way of non-limitative examples, with reference to the attached drawings in which:
In
Input events are underlined. State transition identifiers are drawn close to the beginning of the arrow, while input and output events are drawn instead near the middle of the arrow. The initial state q0 is finally drawn as a black dot.
The meaning of boolean algebra operators and expressions used in the rest of this description is explained at paragraph “The boolean algebra of assemblage expressions” and subsequent paragraphs here below.
Referring to
The two traffic lights are placed on the crossing of two roads, one running from North to South and the other from East to West. The controller has four states: state NS, which means that the road traffic is enabled from North to South and vice versa, state W1, which means that traffic is being stopped in such a road, state EW, which means that the road traffic is enabled from East to West and vice versa and finally state W2, which means, as in the other case, that traffic is being stopped in such a road. The basic cycles happens automatically. A different working mode, corresponding to state Night (both the roads have yellow flashing light), may be reached by issuing a command through the input event night when the state machine is in any state of the basic cycle. From the night mode it is possible to restart the basic cycle starting from the NS state, by issuing a command through the input event day.
The controller starts on the Main state, meaning that the traffic on the main road is enabled to flow and the farm road is stopped, and it rests on such state until a command is issued to the controller through the event farm. The controller then moves automatically to state W1, where the main road is stopping and the farm road is still blocked, then to the state Farm, where the traffic on the farm road is enabled to flow and the main road is stopped. After some fixed time interval the controller moves automatically to state VV1, where the farm road is stopping and the main road is still blocked, and to the Main state again, where it rests waiting for the next command.
The following graphical conventions are adopted: state machines are drawn as directed graphs and retain all the details of the interface.
Guard conditions are enclosed in square brackets and drawn near the beginning of the arrow, internal triggers are underlined and command lists are enclosed in angular brackets. The default state proposition guard ANYA is by convention not drawn.
Actions in the action list which are directed towards assemblage synchronous components are distinguished by postponing an upper arrow to the command.
Finally, when it is shown, the controlled assemblage is drawn by reporting the component state machines above a dotted line, each identified by the assemblage identifier and separated by a solid line (as in
Internal and external features of state transitions can not be arbitrarily mixed. The following rules must be followed, dictated by the rationale that it is not possible to specify both an internal trigger and an external trigger for a single state transition.
State transitions can be thus classified into three families:
internally triggerable state transitions, which have an internal trigger, instantaneous state transitions, which have no triggers at all and externally triggerable state transitions, which have an external trigger; such a classification very easily maps to the interface distinction amongst controllable and automatic (non controllable) transitions:
Internally triggerable state transitions are those which react to changes in the controlled machines. An example is given in
Instantaneous state transitions are those which do not specify any trigger, hence are taken as soon as their guard condition becomes true. An example is given in
Externally triggerable state transitions are those which react to commands sent to the interface of the machines. An example is given in
By comparing the interface of the controller in
The method that is the object of the present invention will now be described in detail.
It is important to ensure that an assemblage of state machines does not reach a global configuration of states which it may be harmful.
The problem regards in general having full knowledge about the configuration of states which an assemblage of state machine can assume. According to the method of the present invention it is possible to design a controller in such a way that the controlled assemblage is always under such a control. By this method it is possible both to ensure that an assemblage of state machine does not reach a forbidden configuration as well as that any allowed configuration of states may be reached by the assemblage.
The method according to the invention works by first associating to each state S of the controller an assemblage state proposition, which is a formula which denotes the exact set of states that the modeler wants to be assumed by the assemblage when the controller is in a state S. Such a state proposition is named state constraint and denoted by vinc(S).
State transitions denote a set of global states in which the assemblage must be found in order for the state transition to be taken. Such set of states is denoted by a state proposition which is called precondition semantics. It can be computed according to the features of the transition and to the different typologies in which it may be classified:
pre(t)=guard(t)⊙vinc(S)
(a) In the former case we know that such a state transition happened and therefore the state proposition vinc(S) has been transformed into transf(vinc(S),c,t), where transf(vinc(S),c,t) is a state proposition p′ which means “the assemblage was in a state p and a state transition t happened. The precondition semantics pre(.) is therefore in this case given by:
pre(t)=guard(t)⊙transf(vinc(S),c,t) (2)
(b) In the latter case we know that a command of the kind c.e may have triggered any of the transitions which have e as input trigger. We have therefore that the state proposition vinc(S) has been transformed into transfE(vinc(S),c.e), where
T being the set of transitions that are triggerable by event e in component c, in symbols T=trigger−1 (e).
The precondition semantics pre(.) is therefore in this case given by:
pre(t)=guard(t)⊙transfE(vinc(S),c.e) (3)
It may be observed that a state transition such that pre(t)=NONEA will never be executed, hence it may be removed from the state diagram. It may be further observed that, necessary condition in order to have at most one external transition chosen for execution on the receipt of a triggering event e, if T(e,S)is the set of external transitions having S as starting state and e as trigger, for any t1,t2∈T(e,S) than pre(t1) and pre(t2) must be disjoint. We observe, finally, that, in order to have exactly one external transition taken on the receipt of e, the set of the transition preconditions in T(e,S) must form a partition of C(S).
In this example the semantic precondition of the transitions of the two versions the traffic light controller implementation shown in
1. First controller (
A constraint is first assigned to each of the four states of the controller:
(a) vinc(q0)=ON=I1⊙Off=I2⊙Off=I3⊙TOut=t
(b) vinc(R)=On=I1⊙Off=I2⊙Off=I3⊙TOut=t
(c) vinc(G)=Off=I1⊙Off=I2⊙On=I3⊙TIn=t
(d) vinc(Y)=Off=I1⊙On=I2⊙Off=I3⊙TIn=t
We have that t1 is an instantaneous transition starting from Q0: we have therefore to compute its precondition according to Equation (1):
pre(t1)=vinc(q0)⊙guard (t0)=On=I1⊙Off=I2⊙Off=I3⊙TOut=t
We have that t2 is an externally triggered transition, hence its precondition is again calculated through Equation (1):
pre(t2)=vinc(R)⊙guard (t0)=On=I1⊙Off=I2⊙Off=I3⊙TOut=t
The next three transitions are instead internally triggered by an assemblage state transition, hence, it is necessary to calculate the transformation induced on the respective starting state constraint by such transition. We have then that their precondition semantics is therefore given by Equation (2):
pre(t3)=transf(vinc(G),t,tout)⊙guard(t3)=Off=I1⊙Off=I2⊙On=I3⊙TOut=t
pre(t4)=transf(vinc(Y),t,tout)⊙guard (t3)=Off=I1⊙On=I2⊙Off=I3⊙TOut=t
2. Second controller (
We assign first a constraint to each of the four states of the controller:
(a) vinc(q0)=On=I1⊙Off=I2⊙Off=I3⊙TOut=t
(b) vinc(R)=On=I1⊙Off=I2⊙Off=I3⊙TOut=t
(c) vinc(G)=Off=I1⊙Off=I2⊙On=I3⊙TOut=t
(d) vinc(Y)=Off=I1⊙On=I2⊙Off=I3⊙TIn=t
We have then that t1 is an instantaneous transition starting from q0: we have therefore to compute its precondition according to Equation (1):
pre(t1)=vinc(q0)⊙guard(t0)=On=I1⊙Off=I2⊙Off=I3⊙TOut=t
We have that, in this case, both t2 and t3 are externally triggered transition, hence its precondition is again calculated through Equation (1):
pre(t2)=vinc(R)⊙guard(t0)=On=I1⊙Off=I2⊙Off=I3⊙TOut=t
pre(t3)=vinc(G)⊙guard(t0)=Off=I1⊙Off =I2⊙On=I3⊙TOut=t
The last transition is instead internally triggered by an assemblage state transition, hence, it is necessary to calculate the transformation induced on the respective starting state constraint by such transition. We have then that its precondition semantics is given by Equation (2):
pre(t4)=transf(vinc(Y),t,tout)⊙guard(t3)=Off=I1⊙On=I2⊙Off=I3⊙TOut=t
Let t be a transition in the controller having a list of associated actions l=actions(t). When the transitions is started, the assemblage is in any global state Q which satisfies pre(t). When the state transition is executed, each action directed towards a synchronous component of the assemblage modifies such a state q before the state transition ends its execution. Let Q′ be the state of the assemblage after the last action is executed. When the state transition is terminated the assemblage is therefore found in a global state q′, which satisfies the state proposition originating from the precondition pre(t) of the transition transformed by the occurrence of the list of actions, let it be called postcondition semantics post(,) then given by:
post(t)=transfL(pre(t),ls) (4)
Where ls is the sublist of l containing only actions directed towards synchronous components and transfL(•,•) is the function which transforms a state proposition according to a list of actions, which will be defined later.
Referring now to )=On=I1⊙Off=I2⊙Off=I3⊙TOut=t where the precondition semantics is: pre(t1)=On=I1⊙Off=I2⊙Off=I3⊙TOut=t In other words, since state transition t1 is labelled with no commands, post and precondition semantics are the same.
post (t2)=transfL(pre(t2),1.off↑,I3.on↑,t.setT1|
)=Off=I1⊙Off=I2⊙On=I3⊙TIn=t
where pre(t2)=On=I1⊙Off=I2⊙Off=I3⊙TOut=t
In other words the effect of the commands I1.off↑, I3.on↑ and t.SetT1↑is, respectively, to turn off lamp I1, to turn on lamp I3 and to set the timer t1 to state Tin. Since the three commands are synchronous, their effect is achieved before the end of the controller transition. We calculate accordingly the semantics of the last two state transitions:
post(t3)=transfL(pre(t3),3.off↑,I2.on↑,t.set T2↑
)=Off=I1⊙On=I2⊙Off=I3⊙TIn=t
where pre(t3)=Off=I1⊙Off=I2⊙On=I3⊙TOut=t;
post(t4)=transfL(pre(t4),I1.on↑,I2.off↑
)=On=I1⊙Off=I2⊙Off=I3⊙Tout=1 where
pre(t4)=Off=I1⊙On=I2⊙Off=I3⊙TOut=t.
A state transition t ending in a state T of the controller is said to be semantically safe iff:
post(t)εAvinc(t) (8)
It can be easily checked that in all four cases the postcondition semantics for the four transitions of the example presented in
The feasible transitions associated to a state proposition C are the set of transitions that can be taken by the component machines of the assemblage when the system is in any global state that satisfies C and can be found by Algorithm 1 shown here below, which examines all the state transitions in all the state machine of the assemblage, determines for each of such transitions the respective starting state, then checks the proposition which states that the assemblage is in such starting state and at the same time in C: if such proposition is true the transition is added to the set of feasible transitions.
The set of feasible state transitions F can be further partitioned into two sets, F0 and F1, respectively of output and input feasible transitions, by trivially examining whether they belong, respectively, to the set T0 or T1 of output and input transitions of the state machine to which they belong. F0 is called also the set of feasible non controllable transitions associated to C.
We write (X, Y) for the state proposition X=c1⊙Y=c2 which denotes a single global state, once the assemblage having components C1 and C2 is known from the context.
Let Cross be an assemblage composed by a pair of a traffic light of the kind depicted in q0=tI2)⊕(R=tI1⊙R=tI2))⊕(Y=tI1⊙Y=tI2)). State proposition C can be easily shown to be satisfied by any of the global states depicted as round squares in
Given a state proposition C, there exist subpropositions of C such that, when the assemblage is within one of such subpropositions, there are non controllable transitions such that, if and when taken, move the assemblage to a global state such that C is no more satisfied. Such subpropositions are called “exit subpropositions” and play an important role in detecting when a state constraint may be violated. Given in fact a proposition C, we are interested in finding all the couples (p,t), where p is an exit subproposition and t is the non controllable transition, named “exit transition”, that takes the assemblage out of C when the assemblage is in p. Algorithm 2 shown here below finds all the exit zones associated to a state proposition C given the set F0 of feasible non controllable transitions associated to C. The algorithm works by forming, for each state transition t in F0, the state proposition pre=“state machine c is in the start state of t and satisfies C”, then transform it according to the transition t. The resulting state proposition, named post=“state machine c was in the start state of t and satisfied C then state transition t happened”, may be only partially outside of the original proposition C, then it is trimmed, that is the state predicate postTrimmed=“the assemblage satisfies post and does not satisfy C” is calculated. By reversing the direction of state transition t and by transforming postTrimmed according to such reversed transition, we found the proposition preTrimmed, which is the larger subproposition of pre such that: the assemblage is in a global state which satisfies pre and the happening of t brings the assemblage in a global state such that C is no more satisfied.
C;
An exit zone (p,tk) associated to a state constraint C of a state S of the controller is said to be covered iff there exists in the controller a set of internally triggerable state transition TS such that each transition t in TS has state S as start state, is triggered by tk and the set of preconditions of the transitions in TS forms a partition of p.
The method ensures that, if all the state transitions in the controller are semantically safe and if each exit zone in the diagram has been covered by a state transition set in the controller then the following proposition holds:
When the controller is in any state S, the assemblage is in a state q which satisfies vinc(S).
The truth of the proposition above can be inductively checked by ensuring that
Given any current state q of the assemblage A it is possible to form the state proposition “assemblage A is in global state q”. Such a state proposition is called the atomic state proposition associated to global state q. When it is clear form the context and no ambiguity arises, we use the notation q to denote both the assemblage global state as well as the associated atomic proposition.
Given two assemblage atomic state propositions p and q, we say that they are connected iff there exist an assemblage transition, say c.t, such that p is transformed in q by c.t, in symbol q=transf (p, c, t)
By state liveness we mean that:
1. any state in the controller must be externally reachable, that is there must be a path of state transitions from the initial state qo to any state S in the controller;
2. any atomic subproposition p of the state semantics vinc(S) of each externally reachable state S of the controller must in turn be internally reachable by the global state of the assemblage, that is, there must exists a path of assemblage state transitions from any subproposition of post(t) to subproposition p, where t is one of the incoming transitions to state S.
A state proposition is made of parts, that is subpropositions of the main state proposition, which are in general not connected, that is it does not exist any assemblage transition, either controllable or not, such that the assemblage current state will move from a subproposition to another. That means that some parts of the state constraint may not be reachable, and therefore, even if the state constraint is not violated, some expected properties may not be satisfied (safety and liveness are indeed orthogonal concepts).
In order to ensure that any part of a state proposition be reachable, control to each isolated part must be brought directly by different state transition of the controller. It may be observed that the state semantics vinc(S) may be viewed as a set of directed graphs made of subproposition arranged as Strongly Connected Components (SCC). Any atomic proposition within a SCC is such that it is reachable by any other atomic proposition within the same SCC. An atomic subproposition is itself a SCC. SCCs may be connected, and in such a case the resulting graph is acyclic, since if there were a cycle among two directed SCCA, then any atomic proposition in the former will be reachable from atomic proposition in the latter, and the two SCCs will become, by definition, a single SCC. Any state proposition can be therefore seen as a set of directed graphs having SCCs as nodes and assemblage state transitions as arcs. Any direct graph has one or more sources, that is elements of the digraph such that that there are not incoming arcs. Starting from the sources of a graph it is possible to reach any other part of the graph.
In order therefore to reach all the subpropositions of a state proposition, like the semantics vinc(S) of a state S in the controller, we have therefore to ensure that all the sources in any graph associated to such a proposition be reachable by at least one transition in the controller. As observed, each state transition denotes a set of states, named transition postcondition semantics, such that the assemblage is in one of such states when the transition is completed. If t is a transition in the controller such that its ending state is S, by checking that post(t) εAs, for any source SCC s of any directed graphs associated to vinc(S) ensures that all the subproposition of the state semantics are reachable.
It is possible to express logical propositions, that is statements which are either true or false, with respect to the state of a single device in the assemblage as well as propositions with respect to the global state of the entire assemblage. The former kind of propositions will be named state machine propositions, while the latter will be named assemblage state propositions. They will be collectively referred to as state propositions.
State machine and assemblage propositions are employed both to formulate operational aspects of the controller (like transition guard conditions) as well as to express constraints on the global behavior of the assemblage during the process of verification.
State machine and assemblage propositions will be denoted by symbolic expressions, named state machine and assemblage expressions.
Let “light1” be a traffic light device, whose behavior can be depicted by a state machine, which in turn can be found in state “Red”, “Yellow” or “Green”. Then “light1 is in state Red”, “light1 is in state Yellow” and “light1 is in state Green” are state machine propositions, which are true or false depending on the state of the device. Other state machine propositions can be built from simpler ones by ordinary propositional connectives, such as “light1 is in state Red and (or) light1 is in state Green”, as well as “light1 is not in state Red”.
Let “light1” and “light2 ” be traffic light devices within an assemblage, such that each traffic light may be in state “Red”, “Yellow” or “Green”. Then “light1 is in state Red and light2 is in state Green” is an example of an assemblage state propositions, which is either true or false depending on the global state of the assemblage. Observe that any state machine proposition is also an assemblage proposition. Assemblage state propositions can be built from simpler ones by ordinary propositional connectives, such as “light1 is in state Red and light2 is in state Green (or) light2 is in state Red”.
Let d∈A be any state machine of the assemblage A. We define basic state machine expressions the union of constant and atomic state machine expressions, defined as:
Let “light1” and “light2” be traffic light devices within an assemblage, such that each traffic light may be in state “Red”, “Yellow” or “Green”. Constant state machine expression any=light1 denotes the state proposition which always holds, that is the proposition that “says” that device “light1” may be found in state “Red”, “Yellow” or “Green”. Conversely, constant device expression none=light1 denote the state proposition which never holds. In other words, in “any state of the world”, that is in any global state of the assemblage, the first proposition is always true and the latter is always false.
Let “light1” and “light2” be the traffic light devices within the assemblage of the example above. Then examples of atomic expressions are Red=light1, Red=light2 and Green=light1, which denote, respectively, the propositions which hold, respectively, when traffic light “light1” is in state “Red”, when traffic light “light2” is in state “Red” and when traffic light “light1” is in state “Green”.
Assemblage expressions
Assemblage expressions are built starting from state machine expressions and special assemblage constant expressions, which are combined, by means of the operators ⊙, ⊕ and into more complex assemblage expressions.
1. Any state machine expression is also an assemblage expressions;
2. If A is a device assemblage, then ANYA and NONEA are assemblage expressions, named assemblage constant expressions;
3. If e1,e2 are assemblage expressions, then e1⊙e2, e1⊕e2 and e1 are assemblage expressions, named assemblage compound expressions.
If e1 and e2 are expressions which denote state propositions, then the compound state expression e1⊙e2 denotes the conjunction of the two state propositions, that is the state proposition that holds when both the original state propositions hold.
In the same way, the expression e1⊕e2 denotes the disjunction of the two state propositions, that is the state proposition that holds when at least one of the original state propositions holds.
Finally, if e is an expression which denotes a state proposition, then the expression e denotes correspondingly the negation of the state proposition, that is the proposition which does not hold iff the original proposition holds.
Let e1 be the expression Red=light1. Then e1 denotes the state proposition which holds if and only if the device “light1” within an assemblage is in the state “Red”. If, moreover, e2 is the expression Green=light2, then the expression Red=light1⊙Green=light2 denotes the compound state proposition which holds iff device “light1” is in state “Red” and device “light2” is in state “Green”. Similarly the expression Red=light1⊕Green=light2 denotes the compound state proposition which holds iff either device “light1” is in state “Red” or device “light2” is in state “Green”. Expression Red=light1 denotes finally the proposition which does not hold if device “light1” is in state “Red” and holds in all the other states.
Given any state machine d∈A, and given any state q in which state machine d can be found, there exists a method for telling whether the proposition denoted by any device expression holds or does not hold.
There exists indeed a boolean valued function [[e]]boot:Qd→{true,false}, where Qd is the set of states of the device, which assigns a truth value to any state machine expression e depending on the current state of the state machine. Such a boolean valued function represents the boolean semantics of device expressions and is recursively defined as follows:
For any device d∈A and for any choice of states q,S∈Qd:
1. Constant state machine expressions:
[[none=c]]boot(q)=true and [[any=c]]boot(q)=false for any q∈Qc
2. Atomic state machine expressions:
[[S=c]]boot(q) is true if and only if q=S.
The semantics of an assemblage expression e is a boolean valued function [[e]]boot:QA→{true,false}, where QA is the set of global states of the assemblage A, which assigns a truth value to any assemblage expression e depending on the global states of the assemblage. Such a boolean valued function represents the boolean semantics of state machine expressions and is recursively defined as follows:
1. if e is a state machine expression then: [[e]]boot(q)=[[e]]boot(q), where q is the component of the global state q corresponding to the state machine to which expression e is referred to;
2. [[S=c⊙T=c]]boot(q)=false if S≠T, where c is any state machine of the assemblage;
3. [[e1⊙e2]]boot(q)=[[e1]]boot(q)e2]]boot(q) otherwise;
4. [[e1⊕e2]]boot(q)=[[e1]]boot(q)[[e2]]boot(q)
e1]]boot(q) is true iff[[e1]]boot(q) is false;
where and
are the usual boolean logical operators.
It may be observed that:
It may be shown that the set of assemblage expressions form a Boolean Algebra, and as such it enjoys the related theorems. By analogy, we name the three operators as their boolean algebra counterparts, that is conjunction (⊙), disjunction (⊕) and negation . We define also a minimal and a maximal element, respectively given by the expressions NONEA and ANYA.
We define a containment relationship among assemblage expressions, written as εA, as follows: for any e1,e2∈εA, we say that e1 is contained within e2, in symbols e1
εA e2 iff e1⊙e2=e1 or iff e1⊕e2=e2. We also define ad equivalence relationship ≡ε
ε
ε
Deciding whether any assemblage expression is contained within any other any assemblage expression will be carried out by:
Given an assemblage state proposition p and given a state transition t in a component c of the assemblage A, we say that p is transformed by transition t of component c into the state proposition p′ after the only transition t happened, in symbols p′=transf(p, c, t). State proposition p′ is the state proposition which means “the assemblage was in state p and the state transition t happened”.
Given an assemblage state proposition p and given a transition request e directed towards a component c of the assemblage, namely, a command c.e, we say that, once such a transition request has been successfully accomplished, the assemblage is found in a state transfE (p, c.e). In general there are different transitions which are labelled by the same input event e in component c; let T be the set of such transitions. We define:
where T is the set of transitions which are triggerable by event e in component c, in symbols T=trigger−1(e).
Let l be a list of actions, let , according to the usual notation be the empty list, let head(l) be the first element of the list and let tail(l) be the list containing the remaining elements when head(l) is removed from l. Then the transformation induced by l on an assemblage state proposition p is given by transfL(p,l), which is computed recursively as follows:
Let A={m1,m2, . . . mN} be an assemblage of state machines. A sum of products is a canonical form which is given by the join (that is, the OR of the algebra of state propositions) of a finite number of terms πi, called products:
s=π
1⊕π2⊕. . . ⊕πM
where each product
π1=b1(m1)⊙b2(m2)⊙bN(mN)
is the meet (that is, the AND of the algebra of state propositions) of exactly N state machine propositions bi(mi), which is a basic state machine proposition related to state machine mi∈A.
Sums of products are a canonical form of the algebra of state propositions. A sum of product is a special expression which denotes a state proposition. An effective method for transforming any state expression into a sop expression is described in paragraph Containment Among Products (see below); in the paragraph The Boolean Algebra of Sum of Products (see below) it is observed that sum of products form a boolean algebra themselves.
It is possible moreover to describe effective algorithms for computing basic operations in the algebra of sum of products (sop algebra) as well as to decide whether one expression is contained within another. It is therefore possible to compute any operation or make any comparison among state propositions by:
Let “light1” and “light2” be traffic light devices within an assemblage, such that each traffic light may be in state “Red”, “Yellow” or “Green”. It is then possible to write, among the others, the following products:
π1=Red=light1⊙Red=light2;
π2=Red=light1⊙Green=light2;
π3=Red=light1⊙any=light2;
In order to improve readability:
Finally, products which are equivalent to the empty state proposition NONEA can be omitted from a sum s, yielding a sum s′ which can be easily proven equivalent to the original one.
The products of the example 11 above may then be written as:
A sum containing the three products above then may be written as
Sum of products form a Boolean algebra which is isomorphic to the algebra of state propositions. It can be observed that:
1. for any operator of the algebra of state propositions there exists a correspondent operator in the algebra of sum of products:
2. there exist two special sums of products which act as the zero and unity elements of the algebra:
It is possible to transform any assemblage expression e denoting a state proposition into a sum of products SOp(e) by the following recursive algorithm:
Algorithm 3 computes the sum of products corresponding to any assemblage expression e by recursive calls to itself (SOp(e), Algorithm 3) as well as by calls to Algorithms which calculate the meet (meetSums, Algorithm 6), the join (joinSums, Algorithm 5) and the complement (complementSum, Algorithm 7) of sums.
Algorithm 3 works by assuming that the sum of products corresponding to the meet of two expressions e1, e2 is the meet of the sums of the two operand expressions e1, e2; the sum of products corresponding to the join of two expressions e1, e2 is the join of the sums of the two operand expressions e1, e2 and finally the sum of products corresponding to the complement of an expressions e is the complement of the sum of the operand expression e. The base case is given by the assemblage expression which consists only of a state machine expression d about component machine m: in this case sop(d) returns a sum {πd} containing a single product πd, which is built as a meet of the state machine expression d and of a constant state machine expression any=c for any other component c different from m.
e1 or e=d, where d is a state machine
e1 then
Suppose we want to transform the compound expression
(RedtI1⊙(Green=TI1⊕Red=tI2))
into a sum of products. Then:
1. We take the complement of the sum obtained by transforming the expression (Red=tI1⊙(Green=tI1⊕Red=tI2)) into a sum (see step 2) below); let such a sum be s1;
2. transforming the expression Red=tI1⊙(Green=tI1⊕Red=TI2) into a sum involves transforming the operands Red=TI1 and (Green=tI1⊕Red=tI2) into the corresponding sums and then taking their intersection (see steps 3 and 4 below): let such a sum be s2;
3. the expression Red=tI1 is a device expressions and then it is transformed into the sum s3={[Red=tI1]}
4 . transforming the expression Green=tI1⊕Red=tI2 into a sum, requires to transform the operands Green=tI1 and Red=tI2 into the corresponding sums and then taking their union (see steps 5 and 6 below) : let such a sum be s4;
5. the expression Green=tI1 is a device expressions and then itnsformed into the sum s5={[Green=TI1]};
6. the expression Red=tI2 is a device expressions and then it is transformed into the sum s6={[Red=tI2]};
We have therefore that
We then take the meet of the product in the first sum and the first product of the second sum
Sum s2 will contain only product π2 since product π1 denotes the empty state proposition: s2={[Red=tI1,Red=tI2]}
Finally: s1=′s2={[Green=tI2],[Green=tI1],[Yellow=tI2],[Yellow=tI1]}
Given a sum s and a product π′ we want to obtain the sum s′ such that s′ denotes the state proposition which is equivalent to the state proposition s⊕π′. See Algorithm 4.
εAπ′ then
εAhead(s) then
head(s) and head(s)
π′ then
The products in the two sums are added sequentially, by Algorithm 4, to a sum s′ initially empty. See Algorithm 5.
For any pair of products in the two sum a new product is created, through Algorithm 9, then such product is added, by Algorithm 4, to a sum s initially empty. See Algorithm 6.
For each product πi in sum s we compute the sum s which denotes the negation of the product through Algorithm 10 and add each product πj in s to the sum s′ through Algorithm 4. See Algorithm 7.
We compare for containment each product πi in the first sum with each product πj in the second sum through Algorithm 11. It returns true iff any comparison for containment among products πi and πj is true. See Algorithm 8.
Let bm(π) be the operand of a product which is the state machine proposition related to state machine m, given an assemblage A. The meet of two products is then given by the product which has the state machine proposition given by the meet of the two state propositions related to state machine m in the two operand products. See Algorithm 9.
See Algorithm 10.
Let π1 Red=light1⊙Green=light2. Its negation π1 is then computed by taking the sum resulting from the negation of the basic device expressions Red=light1 and Green=light2. In the former case we have that sl=Yellow=light1⊕Green=light1, while the latter results in the sum s2=Yellow=light2⊕Red=light2. The final sum is then given by s=s1⊕s2=Yellow=light1⊕Green=light1⊕Yellow=light2⊕Red=light2.
See Algorithm 11.
We take each state machine expression in the product and we transform it . The result is a sum. Let π1=⊙m∈Ab1(m) where b1(m) is the basic state machine expression corresponding to the component m of the assemblage A. Then, π1 is transformed by the transition t of component c into the sum s as follows : let sc be the sum corresponding to the transformation of the state machine expression b1(c) induced by transition t of component c. Let sc=⊕i=1 . . . Nπi. Then the transformation is given by the sum sc=⊕i=1 . . . Nπ′i where each product π′i=⊙m∈Ab′(m) is obtained by the corresponding product πi=⊙m∈Ab(m) of sc by the rules: b′(m)=b(m) if c=m and b′(m)=b1(m) if c≠m.
The algorithm is expressed in tabular form as shown below; p and q are distinct states belonging to state machine having rolename r.
The algorithm is expressed in tabular form as shown below; p and q are distinct states belonging to state machine having rolename r.
The control model provides two very general models of synchrony.
3.
In the asynchronous model each machine is driven by a separate thread (by using a software oriented language) or a separate processor (by using an hardware oriented language). The communication medium is again driven by one or more (different) threads or processors. The three main entities of the control model (controller and controlled machines, communication medium) are therefore behaviorally independent and synchronize only through communication ports. A communication port is a block of memory which is shared among the different processes. The processes read and write control signals by a typical producer consumer pattern of execution. To prevent processes from reading or writing the shared data at the same time, one or more mutex or read-write locks are employed. Finally, the shared block of memory can be structured as a FIFO list, in order to have the producer not to stop in case a new control signal is produced before a previously produced control message has been consumed.
In the synchronous model both the controller and the controlled state machines, as well as the communication medium, are driven by a unique thread or processor. By using the software oriented language, that means that while executing its internal cycle, the controller state machine stops and starts executing both computations of the communication medium as well as, sequentially, the internal cycle of each controlled machine. By using an hardware oriented language, either the controlled machines are part of the processor and execute in its main cycle, or some sort of time driven, or master-slave synchronization is implemented through different processors.
The control model will be able not only to provide both kinds of synchronization, but also to host a mix of them. In other words, given a controller state machine and a set of controlled state machines, it may be the case that some machines in the set are controlled through the asynchronous model, and the others through the synchronous one. As an example, the same computer processor may control other machines asynchronously through a field bus and, at the same time control other internal state machines synchronously, like timers or adders, by the internal motherboard communication bus.
Finally, a simple, yet abstract, way of differentiating the two models independently of implementation issues, consist in contrasting them by comparing execution times:
Each state machine is equipped with an array of symbols, each denoting the currently known state of a component machine of the assemblage under control of the machine.
Such an array of symbol is kept up to date with the current state of the component machines as part of the workflow of the state machine and of the communication medium, by means of the messages exchanged, as explained below in paragraph Current State Array and Incoming Event Computation (see below).
Each state machine is equipped with a variable holding the event symbol (if any) associated to the last transition which took place in a component machine. The content of such variable is kept up to date as part of the workflow of the state machine and of the communication medium, by means of the messages exchanged, as explained below in paragraph Current State Array and Incoming Event Computation.
Each state machine is equipped with a variable, which coincides with the CMO port of paragraph CMOP Communication Medium Output Port (see below), holding the symbol which denotes the last transition which happened within the assemblage in the form of a TCIC signal (see below paragraph TCIC—Transition Completed in Component).
Control signals are used in order to coordinate the joint behavior of the assemblage and of the controller. They are generated by either one of the assemblage components or by the controller, and processed by the communication medium.
A transition completed signal is generated by a component state machine in order to notify that a specific transition happened within the machine. It consists of the bare transition identifier and is sent to the communication medium.
A TCIC signal identifies univocally a transition within the whole assemblage of components. A TCIC signal is generated by the communication medium as part of its workaround: once a TC signal t generated by a state machine c is received by the communication medium, the TCIC signal (c, t) is sent to the controller.
This signal, which will be referred to as command, is generated by the controller in order to ask a specific component state machine to undertake some state transition labelled by a specific input event. A command consists of the identifier of the machine plus an event symbol belonging to the machine input events. For example, by sending the command (c, e) the controller asks the state machine c to undertake a state transition, if any, departing from the current state of c and labeled by the input event e. Such a transition t is such that event (t)=e.
We distinguish the different kinds of ports by the typology of message exchanged and by the producer and the consumer of such signals.
This port is placed between a component state machine and the communication medium and hosts a queue of TC signals, which are produced by the component state machine and consumed by the communication medium.
This port is placed between the communication medium and the controller and hosts a queue of TCIC signals, which are produced by the communication medium and consumed by the controller.
This port is placed between the communication medium and the component state machine and hosts a queue of event signals, which are produced by the communication medium and consumed by the component state machine.
This port is placed between the communication medium and the controller and hosts a queue of ERIC signals, which are produced by the controller and consumed by the communication medium.
By communication architecture we mean the global arrangement of component and controller state machine and of the communication medium by means of communication ports.
A typical communication architecture involving an assemblage of component state machines A={C1,C2, . . . Cn} and a controller state machine C is shown in
It is also possible to have a multilevel arrangement of component and controller state machines, since each controller can be attached to another communication medium as if it were a component on its turn. A typical case of multilevel arrangement is shown in
Controller state machines Cl and C2 are moreover attached on their turn to a third communication medium M3, and as such they become component of a third assemblage A3={C1,C2}. The communication medium M3 is finally connected to the controller C by a communication medium input (CMI) and output (CMO) port.
It is possible to observe that state machines may be grouped into different typologies, depending on the control they exercise upon other machines or, vice versa, the control other machines exercise upon them:
The communication between the controller and the controlled state machines happens through a communication medium which is an operating entity whose aim is to bring control signals from the components to the controller and vice versa. We present an abstract operational model of the behavior (whose main tasks are depicted in
When a TRIC signal c.t is dispatched to the state machine, the state machine updates the array of the current states and the incoming output event variable, as shown in
Given the current state s of a state machine, the current state array, a current internal incoming event (if any), a current external incoming event (if any) and the array of current component states, we say that a (possibly empty) set of state transitions is selected for being executed iff for each state transition in such a set the following conditions are verified:
Given a state transition belonging to a state machine the state transition is executed when:
The behavior of a state machine consists in performing an initialization phase, then in repeating indefinitely an execution cycle.
In the initialization phase:
2. a subset of the automatic state transitions which have the initial state as initial state are selected for execution and the first transition in the subset is chosen for execution.
The execution cycle consists of the alternate fetch of signals coming from both the components and the controller and on the execution of either the transitions which have those signals as triggers or are automatic:
(TCIC) signal is present, it is fetched and removed from the port, then the current state array and the current event are updated;
2. the communication medium input (CMI) port is looked up;
Filing Document | Filing Date | Country | Kind | 371c Date |
---|---|---|---|---|
PCT/EP2008/051300 | 2/1/2008 | WO | 00 | 11/16/2010 |