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.
Virtual Environment
Section titled “Virtual Environment”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 beTrueorFalse, - Timer (
TI), which can beRunning,Stopped, orOver, - Analog input (
NI), which can beInRange,TooLow, orTooHigh, - 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
DIcontrolling door position, one can define the input namesDoor_OpenandDoor_Closed, - For a
TIthat determines a timeout, one can define the input nameTimeout_Over, - For a
NIrepresenting temperature, one can define the input namesTemp_OK,Temp_TooLow,Temp_TooHigh, - For other
VFSMs, one can define input names based on their state names, for instanceIdle,Busy,Done, etc.
In the same way, output names can be created.
VFSM Execution model
Section titled “VFSM Execution model”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
The VFSM executor is triggered by several events:
- An input action: generates a virtual output based on certain virtual inputs, e.g., if
Door_ClosedandTemp_TooHighare valid, execute actionOpen_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_ClosedDoor_Open OR Timeout_OverTemp_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.