Skip to content

Virtual Finite State Machine

A virtual finite state machine (VFSM) is a finite state machine defined in a virtual environment. The virtual environment is created by three sets of names: input names, output names, and state names. The input and output names can be mapped to real-world signals using a mapping function. The execution model of a VFSM is based on logic algebra extended with a Complement control value.

A software application performs several tasks. A part of the application—the control system—is responsible for its behavior. The functioning of the control system is determined by its inputs, for instance:

  • Digital input (DI), which can be True or False,
  • Timer (TI), which can be Running, Stopped, or Over,
  • Analog input (NI), which can be InRange, TooLow, or TooHigh,
  • Other state machines (VFSM), which can be in one of their states.

By assigning names to the relevant input values (input control properties), the set of input names of the virtual environment is created. For instance:

  • For a DI controlling door position, one can define the input names Door_Open and Door_Closed,
  • For a TI that determines a timeout, one can define the input name Timeout_Over,
  • For a NI representing temperature, one can define the input names Temp_OK, Temp_TooLow, Temp_TooHigh,
  • For other VFSMs, one can define input names based on their state names, for instance Idle, Busy, Done, etc.

In the same way, output names can be created.

virtual_environment

VFSM Execution model

A subset of all defined input names present in a given situation is called the virtual input. For instance, the door position can be either Door_Open or Door_Closed, but never both at the same time. The virtual output is defined in the same way. Similarly, only one state from each state machine’s set of defined state names can be present at any given time.

Together with the given behavior specification, a VFSM execution model is defined. Based on this model, a VFSM executor is provided.

VFSM Executor Flowchart

VFSM Executor Flowchart

The VFSM executor is triggered by several events:

  • An input action: generates a virtual output based on certain virtual inputs, e.g., if Door_Closed and Temp_TooHigh are valid, execute action Open_Door
  • An entry action: generates a virtual output when entering a certain state
  • An exit action: generates a virtual output when exiting a certain state
  • Or simply changes the state when certain virtual inputs are given (transition condition)

The VFSM executor behaves exactly as defined for finite state machines. The condition expressions, built from input names, are based on logic algebra extended with a complement control value.

Logic algebra completed by a Complement control value

Section titled “Logic algebra completed by a Complement control value”

Using input names, transition and input action conditions can be expressed using Boolean logic, for instance:

  • Door_Closed
  • Door_Open OR Timeout_Over
  • Temp_OK AND Done
  • (Door_Open OR Temp_OK) AND Done

The Boolean operator NOT is not used; instead, a complement control value is used. This is because the result of negating an input name is often not definite. For instance, what does NOT Temp_TooHigh mean? Is it Temp_TooLow or Temp_OK? The actual answer is {Temp_TooLow, Temp_OK}, which represents the complement of Temp_TooHigh.