date: 2016-05-13T00:00:00+00:00 title: Getting Started with APP4MC
General model content
The purpose of this session is to get familiar with the structure of the AMALTHEA model itself as well as the currently available editor. Therefore, a new model should be created in its own project using the following steps and content.
The following image is a simplified overview of the model that will be created in this session.
General model setup
Create a new general project named org.eclipse.amalthea.training.model
- From the File menu, select the item New > Project...
- On the first page of the wizard, expand the item General and select Project. Then click Next
- On the second page of the wizard fill the Project name field with org.eclipse.amalthea.training.model, then click Finish
- The project created should appear in the Model Explorer view
Create a new folder named “model1” inside the created project
- Select the created project
- In the context menu (right mouse button) select New > Folder
- Fill the text field Folder name with model1, then click Finish
Create a new AMALTHEA model
- Select the folder named model1
- In the context menu, select New > AMALTHEA Model
- In the dialog
- Keep the defaults (ie. folder: “model1”, filename: “default.amxmi”)
- Click Finish to create an empty model
- The model is created and the standard AMALTHEA tree editor is opened on the left side of the workbench.
Adding software structure
Right-click on the AMALTHEA model on the tree editor then select the menu item New Child > Sw Model.
It will add a child node named Software to the model
Create a label named LabelA
- Under the Software item select the Labels item and right-click on New Child > Label.
This will add a new child under Labels by default labeled Label. - Select this Label then click on the Properties tab below the tree editor to display the label properties.
- Click on the cell next to the property named Name and fill it with LabelA.
Press enter. The label item in the tree editor should be renamed LabelA.
Create a label named LabelB
Create a Runnable named Runnable1
- Under the Software item select the Runnables item and right-click on New Child > Runnable.
This will add a new child under Runnables by default labeled Runnable - Select this Runnable then click on the Properties tab below the tree editor to name it Runnable1.
Create 2 additional runnables named respectively Runnable2 and Runnable3.
Expand the runnable named Runnable1
- Create an instance of * instructions (constant) 20 *
- From the context menu under Runnable Items, select New Child > Instructions Constant
- Select the child created then click on the Properties tab above the tree editor.
- Change the value of the Value property to 20
- Create a write access to LabelA
- Create another runnable item by selecting the menu item New Child > Label Access
- Select the child created then click on the Properties tab above the tree editor.
- Select for the Access property the value write
- Select for the Data property the value Label LabelA
Expand the runnable named Runnable2 and, under its runnable items:
- Create a read access to LabelA
- Create a 25 constant instructions
- Create a write access to LabelB
Expand the runnable named Runnable3 and, under its runnable items:
- Create a read access to LabelB
- Create a 10 constant instructions
Create 3 tasks named respectively Task1, Task2 and Task3
- Under the Software item select the Tasks item and right-click on New Child > Task.
It will add a new child by default labeled Task. - Select this Task then click on the Properties tab above the tree editor to name it Task1.
- Repeat these steps to create the 2 other tasks.
Create a CallGraph for the task Task1
- Right-click on the task named Task1 then select the menu item New Child > Call Graph
- Create a Call Sequence CS1
- Expand the task Task1 to visualize its child
- Right-click on the Call Graph child then select the menu item New Child > Graph Entries > Call Sequence
- Name this new call sequence CS1
- Create a Task Runnable Call to Runnable1
- Right-click on the call sequence CS1
then select the menu item New Child > Calls > Task Runnable Call - Select the created child then click on the Properties tab
and set the Runnable property to Runnable Runnable1.
Create a CallGraph for the task Task2
- Right-click on the task named Task2 then select the menu item New Child > Call Graph
- Create a Call Sequence CS1
- Create a Task Runnable Call to Runnable2
Create a CallGraph for the task Task3
- Right-click on the task named Task3 then select the menu item New Child > Call Graph
- Create a Call Sequence CS1
- Create a Task Runnable Call to Runnable3
Add Stimuli to Tasks
Stimuli are describing the activation of Tasks.
Create 3 Stimuli named Stimuli1, Stimuli2, and Stimuli3
- Right-click on the AMALTHEA model on the tree editor then select the menu item New Child > Stimuli Model.
It will add a child node named Stimuli to the model. - Create a Periodic Stimuli named Stimuli1 and set the recurrence to 10ms
- Right-click on the Stimuli Model and select the menu item New Child > Stimuli > Periodic
- Expand the Stimuli node to visualize the created child.
- Select the Child named by default Periodic then rename it Stimuli1
- Right-click on the renamed stimuli and select the menu item New Child > Recurrence
- Select the created Recurrence
- Set the value of the Unit property to ms
- Set the value of the Value property to 10
- Create a seconde Periodic Stimuli named *Stimuli2" and set the recurrence to 30ms
- Create an Inter Process Stimuli named Stimuli3 and set the recurrence to 10ms
- Right-click on the Stimuli Model and select the menu item New Child > Stimuli > Inter Process
- Select the Inter Process node and name it Stimuli3
Add the Stimuli Stimuli1 to the task Task1
- Retrieve and select the task Task1 which is located under the nodes AMALTHEA / Softwares / Tasks.
- On the Properties, click on the button next to the field () to open relationship dialog
- Select the Stimuli Periodic Stimuli1
- Press the Add button
- Press OK to close the dialog.
Add the Stimuli Stimuli2 to the task Task2
Add the Stimuli Stimuli3 to the task Task3
Add an Interprocess Activation from Task2 to Task3
- Expand the Task2,
- Expand its Call Graph node
- Select the call sequence CS1
- Right-click on the node and select the menu item New Child > Calls > Inter Process Activation
- Select the created node and in the Stimuli property, select the Stiuli named Inter Process Stimuli3
Create simple hardware model
In this section we are creating a simple hardware model with 2 cores and 1 global memory.
Right-click on the AMALTHEA model on the tree editor then select the menu item New Child > Hw Model.
It will add a child node named Hardware to the model
Create a new system name DemoSystem
- Select the Hardware node previously created
- Right-click on the item then select the menu item New Child > System.
- Name the created item DemoSystem [PK: Is it expected that there is no type from this System?]
Create a new ECU named Ecu1
- Select the system named DemoSystem
- Right-click on the item then select the menu item New Child > ECU.
- Name the created item Ecu1
Add a microcontroller named MC1 to the ECU Ecu1
- Select the ECU Ecu1
- Right-click on the item then select the menu item New Child > Microcontroller.
- Name the created item MC1
Create a memory type named GlobalMemoryType
- Select the Hardware node under the AMALTHEA model node
- Right-click on the item then select the menu item New Child > Memory type.
- Set the name to GlobalMemoryType
- Set the size of memory to 512 (bytes)
- Set the type of memory to RAM
Add a memory named GlobalMemory to MC1
- Select the microcontroller MC1
- Right-click on the item then select the menu item New Child > Memory
- Name the created item GlobalMemory
- Set the type to Memory Type GlobalMemoryType
Add a quartz “100MHz” to “MC1”
- Select the microcontroller MC1
- Right-click on the item then select the menu item New Child > Quartz
- Name the created item 100MHz
- Set the Frequency property to 100000000
Create a core type named CT1
- Select the Hardware node under the AMALTHEA model node
- Right-click on the item then select the menu item New Child > Core type
- Set the name to CT1
- Set Instructions Per Cycle roperty of the core type to 1
Add a core “Core1” to “MC1”
- Select the microcontroller MC1
- Right-click on the item then select the menu item New Child > Core
- Name the created item Core1
- Set core type of “Core1” to “CT1”
Add a Prescaler named PS1 to Core1
- Select the core Core1
- Right-click on the item then select the menu item New Child > Prescaler
- Name the created item PS1
- Set the Clock Ratio property to 1.0
- Set the Quartz property to “100Mhz”
Add a core “Core2” to “MC1”
- Set core type of “Core2” to “CT1”
Add a Prescaler named PS2 to Core2
- Add prescaler “PS2” to “Core1”
- Set the Clock Ratio property to 2.0
- Set the Quartz property to “100Mhz”
Add a Latency Path from cores to memory
- Create a Latency Access Path named Path1
- Select the Hardware node under the AMALTHEA model node
- Right-click on the item then select the menu item New Child > Access Paths > Latency Access Path
- Name the created item Path1
- Set the Source property to Core Core1
- Set the Target property to Memory GlobalMemory
- Create a Latency Access Path named Path2
- Set the Source property to Core Core1
- Set the Target property to Memory GlobalMemory
- Add a constant latency to “Path1” with access type “RW”, quartz “100Mhz” and value 20
- Select the path Path1
- Right-click on the item then select the menu item New Child > Latencies > Latency Constant
- Select the created item
- Set the Access Type property to RW
- Set the Quartz property to Quartz 100Mhz
- Set the Value property to 20
Optional: Feel free to add more memory elements to represent local memories located at the cores with the proper latency access paths
At this point you should get a contents tree which looks like that:
Create simple OS model
Create a simple OS model, containing schedulers for both cores.
Right-click on the AMALTHEA model on the tree editor then select the menu item New Child > Os Model.
It will add a child node named Operating System to the model
Add a new operating system with name Default
- Select the Operating System node previously created
- Right-click on the item then select the menu item New Child > Operating Systems > Operating System.
- Name the created item Default
Add a Task Scheduler named Scheduler1
- Right-click on the Default operating system then select the menu item New Child > Task Scheduler
- Name the created item Scheduler1
Add scheduling algorithm OSEK to Scheduler1
- Right-click on the Scheduler1 task scheduler then select the menu item New Child > Scheduling Algorithm > OSEK
Add a Scheduling HW Unit to Scheduler1
- Right-click on the Scheduler1 task scheduler then select the menu item New Child > Scheduling Unit > Scheduling HW Unit
Add a Task Scheduler named Scheduler2
Add a scheduling algorithm OSEK to Scheduler2
Add a Scheduling HW Unit to Scheduler2
At this point you should get a contents tree which looks like that:
Add timing requirements for Tasks
Adding some deadline informations to the already created tasks.
Note: Doing this in a separate file, it can easy be reused for other models if the names of the tasks are the same!
Create a new AMALTHEA model “constraints.amxmi” in the same folder as the already created AMALTHEA meta model
- Select the folder model1 created during the paragraph General model setup
- Right-click on the mouse and select the menu item New > AMALTHEA Model
- Press Next to define the associated model file naming it constraints.amxmi
then press on Finish to create an empty model.
Right-click on the AMALTHEA model on the tree editor then select the menu item New Child > Constraints Model.
It will add a child node named Constraints to the model
Add a new Process Requirement named DeadlineTask1
- Select the Constraints item on the tree editor
- Right-click on the mouse and select the menu item New Child > Requirements > Process Requirement
- Name the created item DeadlineTask1
- Set the Process property to the value Task Task1
Add a Time Requirement Limit to “DeadlineTask1” Process Requirement
- Select the Process Requirement named DeadlineTask1 Task1
- Right-click on the mouse and select the menu item New Child > Limit > Time Requirement Limit
- Set the Limit Type property to UpperLimit
- Set the Metric property to ResponseTime
- Add limit to TimeRequirementLimit
- Right-click the mouse on the ResponseTime item and select the menu item New Child > Limit Value
- Set the Unit property of the new item to ms
- Set the Value property to 10
Add a new Process Requirement named DeadlineTask2 and set its Process property to the value Task Task2
Add a Time Requirement Limit to “DeadlineTask2” Process Requirement
- Set the Limit Type property to UpperLimit
- Set the Metric property to ResponseTime
- Add limit to the Time Requirement Limit
- Right-click the mouse on the ResponseTime item and select the menu item New Child > Limit Value
- Set the Unit property of the new item to ms
- Set the Value property to 15
Add a new Process Requirement named DeadlineTask3 and set its Process property to the value Task Task3
Add a Time Requirement Limit to “DeadlineTask3” Process Requirement
- Set the Limit Type property to UpperLimit
- Set the Metric property to ResponseTime
- Add limit to the Time Requirement Limit
- Right-click the mouse on the ResponseTime item and select the menu item New Child > Limit Value
- Set the Unit property of the new item to ms
- Set the Value property to 15
At this point your model should look like this:
Add mapping information of SW elements to hardware
The mapping represents which software elements are mapped to dedicated hardware elements.
Note: The mapping is separated into an extra file, which makes it easier to replace or change a mapping!
Create a new AMALTHEA model “mapping.amxmi” in the same folder as the already created AMALTHEA meta model
Right-click on the AMALTHEA model on the tree editor then select the menu item New Child > Mapping Model.
It will add a child node named Mapping to the model
Add a Task Allocation element to the Mapping
- Right-click the mouse on the Mapping item and select
the menu item New Child > Process Allocation > Task Allocation - Set the Process property to Task Task1
- Set the Scheduler property to Task Scheduler Scheduler1
Add a second Task Allocation element to the Mapping and
set the Process to Task2 and the Scheduler to Scheduler1
Add a third Task Allocation element to the Mapping
and set the Process to Task3 and the Scheduler to Scheduler2
Under the Mapping item add a Core Allocation element
- Right-click the mouse on the Mapping item
and select the menu item New Child > Core Allocation - Set the Core property to Core Core1
- Set the Scheduler property to Task Scheduler Scheduler1
Add a second Core Allocation element and set the Core to Core Core2 and the Scheduler to Scheduler2
Add an Abstract Element Mapping at least for all Labels to map them to GlobalMemory
- Right-click the mouse on the Mapping item and select
the menu item New Child > Mapping > Abstract Element Mapping - Set the Abstract Element property to Label LabelA
- Set the Mem property to Memory GlobalMemory
- Repeat the last 3 steps steps for the Label LabelB
Optional: If more memories are available, make a proper assignment to other memory elements.
At this point your model should look like this:
Solution
The solution for this exercise is available in this plugin: org.eclipse.app4mc.amalthea.solution1