State Machines
State Machines
1. Introduction
A state machine is a behavior model. It consists of a finite number of states and is therefore also called
finite-state machine. Based on the current state and a given input the machine performs state transitions
and produces outputs. There are basic types like Mealy and Moore machines and more complex types like
Harel and UML statecharts.
The basic building blocks of a state machine are states and transitions. A state is a situation of a system
depending on previous inputs and causes a reaction on the following inputs. One state is marked as the initial
state; this is where the execution of the machine starts. A state transition defines for which input a state
is changed from one to another. Depending on the state machine type, states and/or transitions produce
outputs.
Consider the simple state machine in figure 1. It consists of two states, Off and On. On is the initial state
here; it is activated when the state machine is executed. The arrows between the states denote the possible
state transitions. They define for which input a state change occurs. Here, the active state is changed from
On to Off for the input button pressed, and back again to On for the same input. [1]
1
Figura 2: Conveyor belt system
This system has the following input and output variables according to figure 2.
Input Variables: m, f1 y f2 .
Output Variables: C1 y C2 .
Then, classifying the variables that control each equation of the automation in:
Conveyor 1 (C1 ):
• Creating variables
m · C2 m pressed and C2 not activated.
C1 P revious C1 state.
• Cancelling variables
f1 f1 activated.
Conveyor 2 (C2 ):
• Creating variables
f1 f1 activated.
C2 P revious C2 state
• Cancelling variables
f2 f2 activated.
Finally the equations for the design of the automation circuit are obtained:
C1 = f1 · m · C2 + C1 (1)
C2 = f2 · (f2 + C2 ) (2)
The circuit implementation is as shown in figure 3.
2
Figura 3: Automation circuit
Referencias
[1] itermis. (s. f.). What is a state machine? Recuperado 22 de agosto de 2021, de https://www.itemis.
com/en/yakindu/state-machine/documentation/user-guide/overview_what_are_state_machines