Finite State Machines

Finite State Machines are used in uCANca to:

  • Describe in a formal way the desired functionalities to be satisfied by the systems.
  • Implement a functionality (or part of it) in a system.

The best case possible is to use the functionality description to automatically generate source code, and this is often possible with uCANca (it depends, mainly, to the fact that the FSM is defined totally on software data magnitudes or software mechanism can be invented to make magnitude acquisition/synthesis and manipulation transparent to the user).

We can navigate from LowBeam Lights function to an state machine describing the behaviour of this function by clicking on “SubSystem Function” CULowBeam Item:

Here we can find the following information:

  • Left column:
    • Function Sub System properties.
    • State machine list.
  • Right column:
    • State machine conditions:
    • State machine actions.

As we can see, state machine conditions and state machine actions are in a level above the state machine. This make possible to use same conditions on several state machines. Same with actions. Sometimes a Function has two state machines: one for definition and another for implementation. For instance, in definition we could be using float numbers and, in an hypothetical 8 bit microcontroller development, common sense will force us to rewrite same state machine using integer number algorithms.

We can navigate to the state machine by clicking on the corresponding link:

and here we can see the following information:

  • Left column:
    • State machine visualization properties that control de automatically generated graph on the right column.
    • State machine states list. Each state contains the transitions and actions.
  • Right column:
    • State machine preview graph.
    • Submachine list: A submachine is a FSM that is activated and executes when a state of the current state machine is active. We can say that the submachine is inside an state of the super machine that contains it. In this example there is no submachine.
    • St mach sys maps list: Is a mapping between this state machine and the subsystems. In this case, there is one mapping between it and the CU_lights_lowbeams subsystem. If we click in the subtitle (CU_lights_lowbeam) we will see that the current state machine should be implemented inside the software of the leaf system we visited in chapter 4.

So we have closed the circle: Functions→Flows→SubSystem→State Machine→Functions.

In next chapters we will comment the ability of uCANca to not only generate source code but generate FSM CodeDesigner RAD project files, Scilab/XCos project skeletons, LabView VI project skeletons, etc...