Chapter 1 Example 1: algorithm, architecture, and adequation
1.1 The main algorithm
Figure 1.1: Algorithm / New Algorithm Window |
From the principal window,
choose the File / Save as option
and save your first application under a new folder
(e.g. my_tutorial)
with the name example1.
Choose Algorithm / New Algorithm Window
(cf. figure 1.1).
It opens the edition window for algorithm definitions.
1.1.1 Definition of a sensor
Figure 1.2: Define Sensor |
Figure 1.3: Name of the new sensor |
Figure 1.4: Sensor definition window |
Figure 1.5: Contextual menu → Add port |
Figure 1.7: Sensor definition window after output port created |
To create an input sensor definition:
- from the algorithm window, click on the + green button.
It opens a dialog window, check Sensor
(cf. figure 1.2).
Type the sensor name and optionally a list of parameters for the sensor.
For example type input,
then click OK
(cf. figure 1.3).
It creates the definition of the input sensor.
To open it in definition mode,
double click on input in the Definition list
(cf. figure 1.4);
- in input definition mode,
right click on the background and select
Add port
(cf. figure 1.5).
It opens a dialog window
for the port’s direction, type, name and optionally its size.
For example type ! int o,
then click OK
(cf. figure 1.6).
It creates the integer output port o
(cf. figure 1.7)
in the sensor definition window.
1.1.2 Definition of an actuator
To create an output actuator definition:
- from the algorithm window, click on the + green button
→ dialog window: check Actuator
then type output
and click OK;
- double click on output
in the Definition list.
Then right click on its background and select Add port
→ dialog window: ? int i.
Click OK.
It creates the integer input port i
in the sensor definition window.
1.1.3 Definition of a function
To create a computation function definition:
- from the algorithm window, click on the + green button
→ dialog window: check Function
then type computation
and click OK;
- double click on computation
in the Definition list.
Thenright click on its background and select Add port
→ dialog window: ? int a ? int b ! int o.
Click OK.
It creates the integer ports
a, b, and o
in the function definition window.
1.1.4 Definition of the main algorithm
Figure 1.8: Contextual menu → Set As Main Definition |
Figure 1.9: Drag and drop input definition |
Figure 1.10: Create References to input |
Figure 1.11: Main algorithm after references to sensor created |
Figure 1.12: Main algorithm of the Example 1 |
To create an AlgorithmMain function definition:
- from the algorithm window, click on the + green button
→ dialog window: check Function
then type AlgorithmMain
and click OK;
- double click on AlgorithmMain
in the Definition list.
Then right click on its background and select Set As Main Definition
(cf. figure 1.8);
- in its definition mode,
- to create references
to the sensor input,
drag and drop the sensor definition
from the Definition list
to the AlgorithmMain definition window
(cf. figure 1.9)
→ dialog window: in1 in2
(cf. figure 1.10).
The main algorithm looks like the figure 1.11,
- to create references
to the actuator output,
drag and drop the actuator definition
from the Definition list
to the AlgorithmMain definition window
→ dialog window: out1 out2 out3,
- to create a reference
to the function computation,
drag and drop its definition
→ dialog window: calc,
- from the AlgorithmMain definition window,
to create a data dependence
between in1 and calc,
point the cursor on the output port o
of the in1 operation,
middle click,
and drag to the input port a
of the calc operation.
It draws an arrow between these target ports.
After creating the other data dependences,
the main algorithm looks like the figure 1.12.
1.2 An architecture with one operator
1.2.1 Definition of an operator
Figure 1.13: Operator definition window |
To create an Uinout operator definition:
- from the principal window, choose Architecture / Define Operator.
It opens a dialog window, type Uinout
and click OK.
It opens the operator definition window
(cf. figure 1.13);
- from the Uinout definition window:
1.2.2 Definition of the main architecture
Figure 1.14: Architecture / Define Architecture |
Figure 1.15: Edit / Reference Operator |
Figure 1.16: Architecture with one operator |
To create an ArchiOneOperator architecture definition:
- from the principal window: Architecture / Define Architecture
(cf. figure 1.14)
→ dialog window: type ArchiOneOperator
then click OK → definition window;
- from the ArchiOneOperator definition window:
- to create a reference
to the operator Uinout,
Edit / Reference Operator
(cf. figure 1.15)
→ dialog window: click user,
double click Uinout
→ dialog window: u1,
- to define the operator as main,
right click on its reference and select Set As Main Operator.
The architecture looks like the figure 1.16.
1.3 An architecture with a SAM point-to-point comunication medium
1.3.1 Definition of operators
To create Uin and Uout definitions:
- from the principal window:
Architecture / Define Operator
→ dialog window: Uin, click OK
→ definition window;
- from the Uin definition window:
- from the principal window: Architecture / Define Operator
→ dialog window: Uout, click OK
→ definition window;
- from the Uout definition window:
1.3.2 Definition of a medium
Figure 1.17: Type of a communication medium |
To create a MediumSamPointToPoint medium definition:
- from the principal window:
Architecture / Define Medium
→ dialog window: MediumSamPointToPoint,
click OK
→ definition window;
- from the MediumSamPointToPoint definition window:
1.3.3 Definition of the main architecture
To create an ArchiSamPointToPoint architecture definition:
- from the principal window: Architecture / Define Architecture
(cf. figure 1.14)
→ dialog window
ArchiSamPointToPoint
→ definition window; - from the ArchiSamPointToPoint definition window,
create references u1 and u2
to the operators Uin and Uout;
- from the ArchiSamPointToPoint definition window:
Edit / Reference Medium
→ dialog window: click user,
select MediumSamPointToPoint
→ dialog window: type medium_sampp;
- define the operator u1 as main.
1.3.4 Connections between the operators and the medium
Figure 1.18: Architecture with two operators
and a SAM point-to-point communication medium |
In the main architecture window,
to create a connection
between the u1 operator
and the medium_sampp medium,
point the cursor on the port x
of the operator, middle click,
and drag it to the communication medium.
It draws an edge between the operator and the communication medium.
After creating the other connection,
the main architecture looks like the figure 1.18.
1.4 An architecture with a SAM multipoint medium
To create an ArchiSamMultiPoint architecture definition:
The architecture looks like the figure 1.19
Figure 1.19: Architecture with three operators
and a SAM multipoint communication medium |
1.5 An architecture with a RAM medium
To create the ArchiRam architecture definition:
Figure 1.20: Architecture with three operators
and a RAM comunication medium |
The architecture looks like the figure 1.20.
1.6 The adequation
1.6.1 Without constraint
Define the architecture with three operators and a medium
of type SAM MultiPoint
(cf. 1.4)
as main architecture
(Edit / Set As Main Architecture).
From the principal window, choose Adequation / Launch Adequation,
then choose Adequation / Display schedule.
It opens the schedule window
(cf. figure 1.21)
in which you can see the schedule of the algorithm on the architecture
and the schedule of the different inter-operator communications
on the medium.
1.6.2 With constraints
To contraint the ArchiSamMultiPoint architecture:
From the principal window,
choose File / Close.
In the dialog window, click on the Save button.