Skip to content

TrafficLight2

Introduction

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.

TrafficLight2

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 TrafficLight2.pdf 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.

1_TrafficLight2_state_transition_diagram

Figure 1: TrafficLight2 - the state transition diagram

Conclusions

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.

References

[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.


The article was originally written by author F. Wagner in November 2013.
Here you can view the unedited file directly from the author: PDF