|
|
|
[[papyrus_sw_designer_examples]]
|
|
|
|
== Papyrus SW Designer Examples
|
|
|
|
|
|
|
|
Papyrus SW designer comes with a set of examples. All of these can be accessed via File->New->Example and the category Papyrus examples. A hosting project must already exist.
|
|
|
|
|
|
|
|
All examples contain embedded comments. In the sequel, we go through some of the examples, starting with a simple HelloWorld program.
|
|
|
|
|
|
|
|
[[hello_world]]
|
|
|
|
=== Hello World
|
|
|
|
|
|
|
|
In the sequel, we outline a simple hello world example provided by SW designer. Please note that the example
|
| ... | ... | @@ -22,20 +20,17 @@ Please note, that the information above is no longer true for all SW designer ex |
|
|
|
|
|
|
|
In the sequel, we will go through all of these items with a focus on the the definition of the software components.
|
|
|
|
|
|
|
|
[[definition_of_software_components]]
|
|
|
|
==== Definition of software components
|
|
|
|
|
|
|
|
The example consists of two components, detailed below
|
|
|
|
|
|
|
|
[[the_hello_world_component]]
|
|
|
|
===== The hello-world component
|
|
|
|
|
|
|
|
The Hello World example consists of two software components, System and HelloWorld. The former is a component that all SW designer applications use. It represents the software architecture. The HelloWorld components is a _part_ within the system, i.e. the system _has_ or contains a Hello World component. On the UML level, the part is attribute with composite aggregation typed with the HelloWorld component. It is important to separate the composition on the instance level from the definition of components: the component HelloWorld is not defined within the system, its instances can also appear in other composites.
|
|
|
|
|
|
|
|
The hello-world component is shown in the following screen shot.
|
|
|
|
|
|
|
|
image:PapyrusQompass-examples-hw-hello-world.png +
|
|
|
|
The Hello World component
|
|
|
|
image:figs/SWDesigner-examples-hw-hello-world.png[The Hello World component]
|
|
|
|
|
|
|
|
The hello world component inherits from a component called CStart. This is an abstract component defined in the
|
|
|
|
core component model library. It owns a port (called start) that provides the pre-defined interface IStart. This
|
| ... | ... | @@ -48,8 +43,7 @@ can be specified either via activities or by embedding code in a programming lan |
|
|
|
Currently, Designer focuses on the latter,in particular in form of embedded C++ code. A simple C/C++ view allows to enter
|
|
|
|
the code, as shown in the following screenshot (there is ongoing work concerning a CDT editor integration)
|
|
|
|
|
|
|
|
image:PapyrusQompass-examples-c-cpp-view.png +
|
|
|
|
C/C++ view
|
|
|
|
image:figs/SWDesigner-examples-c-cpp-view.png[C/C++ view]
|
|
|
|
|
|
|
|
The code outputs "Hello World" and an additional message that is an attribute of the hello world component. The attribute message
|
|
|
|
is declared as a UML String, but it does not have a particular contents on the level of the component definition. We will
|
| ... | ... | @@ -58,7 +52,7 @@ see in the section explaining deployment plans how this contents can be defined. |
|
|
|
The specific start port enables a component to get the initial control. Its run operation is called at system
|
|
|
|
start-up by a generated boot-loader.
|
|
|
|
|
|
|
|
[[a_system_component]]
|
|
|
|
|
|
|
|
===== A system component
|
|
|
|
|
|
|
|
All SW Designer applications need to define a top-level component, typically called System that aggregates its components,
|
| ... | ... | @@ -69,10 +63,8 @@ instance of a class in the deployment plan below. + |
|
|
|
In our simple hello world example, there is a single component only. Thus, there are no connections between components (so called _assembly_). Take a look at the
|
|
|
|
producer-consumer example to see how the assembly can be done.
|
|
|
|
|
|
|
|
image:PapyrusQompass-examples-hw-system.png +
|
|
|
|
The System component
|
|
|
|
image:figs/SWDesigner-examples-hw-system.png[The System component]
|
|
|
|
|
|
|
|
[[definition_of_an_abstract_hardware_platform]]
|
|
|
|
==== Definition of an abstract hardware platform
|
|
|
|
|
|
|
|
The hardware model has a quite similar structure compared to the software components: A component representing the hardware architecture contains a single node (called MonoNode) on which we want to deploy our Hello World component.
|
| ... | ... | @@ -82,12 +74,10 @@ for the moment only quite basic information about a computational node, such as |
|
|
|
|
|
|
|
The following screenshot defines a platform for the Hello World component. The _HWArchitecture_ class has a similar
|
|
|
|
function for the platform as the System class has for the software: it represents the used notes and their interconnections.
|
|
|
|
In this simple example, the hardware architecture contains a single node. +
|
|
|
|
In this simple example, the hardware architecture contains a single node.
|
|
|
|
|
|
|
|
image:PapyrusQompass-examples-hw-platform.png +
|
|
|
|
A platform for the Hello World component
|
|
|
|
image:figs/SWDesigner-examples-hw-platform.png[A platform for the Hello World component]
|
|
|
|
|
|
|
|
[[definition_of_a_deployment_plan]]
|
|
|
|
==== Definition of a deployment plan
|
|
|
|
|
|
|
|
A deployment plan is a collection of instance specifications, stored within a UML package. It has two objectives. The first is
|
| ... | ... | @@ -99,35 +89,30 @@ dialog that simplifies the configuration of this attribute. The dialog lists ins |
|
|
|
enables the user to provide a value in a text field. On the model level, a corresponding slot and a value specification are
|
|
|
|
produced.
|
|
|
|
|
|
|
|
image:PapyrusQompass-examples-hw-configure-instance.png +
|
|
|
|
configure instance dialog
|
|
|
|
image:figs/SWDesigner-examples-hw-configure-instance.png[configure instance dialog]
|
|
|
|
|
|
|
|
The allocation is also simplified by means of a custom dialog. The instances of a system are shown by means of a tree structure
|
|
|
|
and the user can either allocate leafs or a parent node. In our case, the whole system should be allocated to node "monoNode", as
|
|
|
|
shown in the screenshot below. On the model level, allocation is a MARTE relationship.
|
|
|
|
|
|
|
|
image:PapyrusQompass-examples-hw-allocate.png +
|
|
|
|
Allocation dialog
|
|
|
|
image:figs/SWDesigner-examples-hw-allocate.png[Allocation dialog]
|
|
|
|
|
|
|
|
The last screenshot shows the resulting deployment plan, the package containing two instance specifications and the slots along
|
|
|
|
with the configured values. You also see the allocation of the system component. Note, that the visualization of all instances
|
|
|
|
in a diagram is often not useful for larger applications, since the graphical visualization does not provide additional
|
|
|
|
information compared to the tree structure depicted by the dedicated dialog.
|
|
|
|
|
|
|
|
image:PapyrusQompass-examples-hw-deployment-plan.png +
|
|
|
|
Resulting deployment plan
|
|
|
|
image:figs/SWDesigner-examples-hw-deployment-plan.png[Resulting deployment plan]
|
|
|
|
|
|
|
|
The last step is the code generation which can be executed via the context menu of a deployment plan. The code generation creates an CDT project
|
|
|
|
which can be compiled and executed.
|
|
|
|
|
|
|
|
[[compilation_execution_and_debugging]]
|
|
|
|
==== Compilation, Execution and Debugging
|
|
|
|
|
|
|
|
Use the "Run as->Local C++ application" menu entry to execute the sample application. You should see the text "Hello World: Test message".
|
|
|
|
|
|
|
|
If the compilation run fine and you do not see screen output, have a look at the link:Papyrus/Qompass/designer/troubleshooting[troubleshooting] section.
|
|
|
|
|
|
|
|
[[producer_consumer]]
|
|
|
|
=== Producer Consumer
|
|
|
|
|
|
|
|
The producer consumer example consists of two interacting components that are part of the obligatory system component. These components communicate in a data flow style in two different variants. In the first, the (data) consumer is invoked from the environment to push new data. In the second, the consumer component asks for new data. Therefore, the two different variants are denoted as Push and Pull-Consumer respectively.
|
| ... | ... | |