Detailed SDL tutorial
OpenGEODE - SDL Tutorial
SDL is a rich language and the complete specifications are available on the ITU-T website : https://www.itu.int/rec/T-REC-Z.100
There are several major revisions of the language:
- SDL88 - the first public version
- SDL92 - major update adding object orientation
- SDL96 - minor update fixing issues of SDL92
- SDL2000 - major update introducing new concepts (agents, exceptions, parallel and nested states)
- SDL2010 - the baseline of the current version (latest version is from 2019)
Check https://www.sdl-forum.org for more information.
In this page we list the features of SDL supported by OpenGEODE and explain how to use them.
SDL scope of OpenGEODE
One important features of SDL is the possibility to describe a system made of components that communicate through messages. This description can be nested: a block can contain other blocks that eventually contain actual state machines.
This is not directly supported by OpenGEODE because it is done in TASTE using the AADL language.
The semantics are nearly similar, with the following differences:
1. SDL does not allow to specify a cyclic message in this view (periodic activation has to be done using timers inside state machines)
However TASTE allows it in the Interface View:
In this example, the interface named "monitor" is cyclic. A period has to be specified for it.
2. In SDL all messages are asynchronous. Direct function calls are possible between two state machines (remote procedure calls) but this communication is hidden from the diagram.
In TASTE, synchronous calls are expressed in the Interface View:
Synchronous calls are immediately executed (blocking calls) and can be either protected (mutual exclusion between messages) or unprotected (executed immediately no matter what).
3. In SDL all active functions are state machines
In TASTE it is possible to implement them in different languages: SDL, but also Simulink, C, C++, Ada, and even VHDL. TASTE generates the glue code between the functions.
4. In SDL, communication is done via messages (called signals) that are defined at system level. This means that a signal name is unique across the system.
When sending a message, it is possible in SDL to specify the recipient in case several can receive the same signal name. Broadcast and multicast are also supported.
In TASTE, the interfaces are defined at function level. Two functions can therefore have the same interface name but with different semantics (different parameters). It is possible to rename the interface at the sender side to avoid ambiguities.
While SDL offers the possibility to specify the recipient when sending a message (OUTPUT message TO sender) there are two things to consider:
a. the state machine's code has to be aware of the system it is connected to, making reuse more difficult in some cases
b. other languages such as C or Ada do not offer such construct
This is how the problem is addressed in TASTE:
5. SDL allows to specify multiple parameters associated to asynchronous signals.
In TASTE however, it is possible to have only one parameter in asynchronous interfaces(one signal = one message). Synchronous interfaces support multiple in or in/out signals.
6. The SDL standard comes with two ways to describe data types: a legacy (yet very powerful) type system, and ASN.1
TASTE only supports a very small subset of the legacy SDL type system, and relies on ASN.1 instead. ASN.1 is an international standard (ISO and ITU-T), supported by multiple tools and used in lots of applications. It is therefore recommended to use it instead of the built-in SDL syntax for data types.
SDL concepts overview
These are the main symbols used in a SDL state machine:
State machines in SDL look like flow diagrams and are read vertically. This is a typical SDL transition diagram:
We will now go in the details of each symbol.
There are three places in a SDL model where a START symbol can be used:
1. At the state machine root diagram: It is mandatory here. A state machine has exactly one start transition.
The start transition is executed at process creation
The start transition
- Sets the initial state - May execute initial actions (initialization of variables)
2. Inside procedures. The start symbol has a slightly different shape, and is triggered when the procedure is called:
3. Inside nested states
There can be more than one Start transition in a nested state. In that case they must be given a name.
The selection of the nested state start transition is done one level above, when entering the nested state, using the via syntax:
State / Nextstate
- Each state has a name
- In a given state, the process is expecting to receive messages
- A state can be composite
Note the following shortcut that allow to save diagram space:
A new state is usually reached at the end of a transition:
A shortcut is the history state, that returns to the most recent state. This is particularly useful when combined with the state shortcuts:
It is also possible to enter a nested state via one of its internal startup transition, as seen above using the via syntax.
- Fires a transition : the transition is executed when the process consumes the signal
- In a given state, the process can expect several signals
- May have parameters (use variables to store their values)
The following shortcuts are available:
- Inputs at level N have priority over inputs at level N-1 (composite states)
- As a consequence, be careful with « asterisk » inputs : if the state is composite, all inner inputs are ignored.
A connection is a transition that is executed when leaving a nested state. It is named in the nested state itself using the exit symbol, like this:
The connection symbol, one level above, allows to trigger a corresponding transition when leaving the state:
Nested states also contain optional entry and exit procedures, that are executed in addition to the start transition and to the connection transitions. See below for details.