Tour state machines » History » Version 1

Txinto Vaz, 12/19/2013 04:19 AM

1 1 Txinto Vaz
h1. Finite State Machines
2 1 Txinto Vaz
3 1 Txinto Vaz
Finite State Machines are used in uCANca to:
4 1 Txinto Vaz
5 1 Txinto Vaz
* Describe in a formal way the desired functionalities to be satisfied by the systems.
6 1 Txinto Vaz
* Implement a functionality (or part of it) in a system.
7 1 Txinto Vaz
8 1 Txinto Vaz
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).
9 1 Txinto Vaz
10 1 Txinto Vaz
We can navigate from LowBeam Lights function to an state machine describing the behaviour of this function by clicking on "SubSystem Function" CULowBeam Item:
11 1 Txinto Vaz
12 1 Txinto Vaz
http://ucanca.gatatac.org/function_sub_systems/1-culowbeam
13 1 Txinto Vaz
14 1 Txinto Vaz
{{iframe(http://ucanca.gatatac.org/function_sub_systems/1-culowbeam,1200,400,yes)}}
15 1 Txinto Vaz
16 1 Txinto Vaz
Here we can find the following information:
17 1 Txinto Vaz
18 1 Txinto Vaz
* Left column:
19 1 Txinto Vaz
** Function Sub System properties.
20 1 Txinto Vaz
** State machine list.
21 1 Txinto Vaz
* Right column:
22 1 Txinto Vaz
** State machine conditions:
23 1 Txinto Vaz
** State machine actions.
24 1 Txinto Vaz
25 1 Txinto Vaz
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.
26 1 Txinto Vaz
27 1 Txinto Vaz
We can navigate to the state machine by clicking on the corresponding link:
28 1 Txinto Vaz
29 1 Txinto Vaz
http://ucanca.gatatac.org/state_machines/1-lowbeamlights
30 1 Txinto Vaz
31 1 Txinto Vaz
{{iframe(http://ucanca.gatatac.org/state_machines/1-lowbeamlights,1200,400,yes)}}
32 1 Txinto Vaz
33 1 Txinto Vaz
and here we can see the following information:
34 1 Txinto Vaz
35 1 Txinto Vaz
* Left column:
36 1 Txinto Vaz
** State machine visualization properties that control de automatically generated graph on the right column.
37 1 Txinto Vaz
** State machine states list.  Each state contains the transitions and actions.
38 1 Txinto Vaz
* Right column:
39 1 Txinto Vaz
** State machine preview graph.
40 1 Txinto Vaz
** 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.
41 1 Txinto Vaz
** 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.  
42 1 Txinto Vaz
43 1 Txinto Vaz
So we have closed the circle: Functions->Flows->SubSystem->State Machine->Functions.
44 1 Txinto Vaz
45 1 Txinto Vaz
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...