F. Wagner November 2013

StateWORKS: TrafficLight2


To simplify the specification of state machines requiring complex transition or input action conditions, the StateWORKS editor has so far allowed defining Complex Input Names in a form of a so called complex condition or complex expression. A Complex Input Name has been defined as an AND of OR expressions. Thus a virtual name was hiding some potentially very complex conditions. Of course, the StateWORKS run-time system could interpret Complex Input Names. This feature had been introduced to simplify expression conditions in the Master that define a complex situation in Slave state machines, and its usage has been limited to VFSM objects.

The introduction of a complement control value had made the complex condition redundant, and so we abandoned that feature [2] in StateWORKS Studio version 7.0.

The project “TrafficLight” in the book [1] uses this complex condition in the state machine TrafficLight. This technical note shows the alternate solution TrafficLight2, with a state machine that does not use complex expressions.


The state transition diagram of the TrafficLight2 is shown in Figure 1 and the entire specification of the TrafficLight project can be displayed by opening the get as PDFTrafficLight2 document. Note that only the TrafficLight state machine has been replaced by the new TrafficLight2 state machine. The other two state machines: Light and Flash are the same as they were presented in the book.

Figure 1: TrafficLight2: the state transition diagram
Figure 1: TrafficLight2: the state transition diagram


This technical note updates the design of the TrafficLight state machine as presented in the book [1], in order to avoid the use of complex expressions. The state-less design in the book might be an interesting variant but it has been possible only with the use of Complex Input Names. Considering complexity, the design presented above is comparable with the original one in the book.


[1] Wagner, F. et al., Modeling Software with Finite State Machines – A Practical Approach, Auerbach Publications, New York, 2006.

[2] Wagner F.: Technical Note: “Complement control values in the VFSM concept”,November, 2007.

get as PDFdownload PDF version