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 transferred by a mapping function to real world signals. The execution model of a VFSM is based on the logic algebra completed by a Complement control value.
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 by:
- Digital input (
DI
) which can beTrue
orFalse
, - Timer (
TI
) which canRun
, beStopped
orOver
, - Analog input (
NI
) which can beInRange
,TooLow
,TooHigh
, - Other state machines (
VFSM
) which can be in one of their states.
By giving names to the relevant input values (input control properties) the set of input names of the virtual environment is created. For instance:
- For
DI
which controls door position one can define the input namesDoor_Open
andDoor_Closed
, - For
TI
which determines a timeout one can define the input nameTimeout_Over
, - For
NI
which represents a temperature one can define the input namesTemp_OK
,Temp_TooLow
,Temp_TooHigh
, - For other
VFSM
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
VFSM Execution model
A subset of the set of all defined input names, present in a certain situation, is called virtual input. For instance the door position can be either Door_Open
or Door_Closed
, never both at the same time. The virtual output is defined in the same way. Similar to this only one state, for each state machine, of its set of defined state names can be present at the same time.
Together with the given behavior specification there is a VFSM execution model defined. Based on this model, a VFSM executor is given.
VFSM Executor Flowchart
The VFSM executor is triggered by several events:
- An input action: generate a virtual output based on certain virtual input, e.g. if the names
Door_Closed
andTemp_TooHigh
are valid execute actionOpen_Door
- An entry action: generate a virtual output when entering a certain state
- An exit action: generate a virtual output when exiting a certain state
- or simply change the state when certain virtual input is given (transition condition)
The VFSM executor behaves exactly as defined for finite state machines. The condition expressions built out of the input names are based on the theory of the logic algebra completed by a complement control value.
Logic algebra completed by a Complement control value
Using the input names transition and input action conditions can be expressed by boolean, 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 we use a Complement control value. This is done because usually the result of a negation of an input name is not definite. For instance what does NOT Temp_TooHigh
mean? Is it Temp_TooLow
or Temp_OK
? The actual answer to this question is {Temp_TooLow, Temp_OK}
that is a Complement of Temp_TooHigh
.
For more information about the logic algebra used, refer to “The Virtual Environment” and to learn more about the Complement control value, refer to “Complement control values in the VFSM concept”.