Integrate Applications with PHENOM & CinC: Difference between revisions

From PHENOM Portal Knowledgebase
Jump to navigation Jump to search
No edit summary
No edit summary
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''DRAFT DRAFT DRAFT'''
This tutorial will walk a user through the compilation and execution of a CinC-based application.  It builds upon other tutorials in PHENOM.  As such, it uses the same principles as [[Integration Model to CinC Generation]], but the content is different.
This page has not yet been tested.


This tutorial will walk a user through the compilation and execution of a CinC-based application. It builds upon other tutorials in PHENOM.  As such, it uses the same principles as [[Integration Model to CinC Generation]], but the content is different.
{{Info|heading=Windows Subsystem for Linux | 1=This tutorial is written to use Windows Subsystem for Linux (WSL 2) with a Ubuntu distribution. If you need help installing WSL, please follow [https://learn.microsoft.com/en-us/windows/wsl/install this link].}}


{{Info|heading=Windows Subsystem for Linux | 1=This tutorial is written to use Windows Subsystem for Linux (WSL 2) with a Ubuntu distribution.}}
<br>


==Preparing PHENOM==
==Preparing PHENOM==
In this tutorial, you will integrate two software applications.  For the sake of simplicity, they will be integrated into a single executable.  This will allow you to see the result of the integration by running a single file.  This tutorial uses the Integration Model as shown in a previous tutorial.
In this tutorial, you will integrate two software applications, enabling them to communicate with each other.  For the sake of simplicity, they will be integrated into a single executable.  This will allow you to see the result of the integration by running a single file.  This tutorial uses the Integration Model as shown in a previous tutorial.


Start by downloading this data model: [[File:robot_model_with_integration_model.skayl]]
Start by downloading this data model: [{{filepath:Robot_model_with_integration_model.skayl}} Download Robot_model_with_integration_model.skayl file]


{{Info|heading=Skayl File | 1=The FACE Technical Standard only defines the elements of an integration model.  The details of each element are left to integrators.  As a result, such details are not effectively stored in a .face model.  A .skayl file is provided here to maintain this information.}}
{{Info|heading=Skayl File | 1=The FACE Technical Standard only defines the elements of an integration model.  The details of each element are left to integrators.  As a result, such details are not effectively stored in a .face model.  A .skayl file is provided here to maintain this information.}}


If you need help loading the project file, please view this tutorial: [[Creating a Project from an Existing Model]].
Load this model into a new project in PHENOM.  If you need help loading the project file, please view this tutorial: [[Creating a Project from an Existing Model]].


== Export a CinC Package ==
== Export a CinC Package ==
Log into PHENOM and click on the GENERATE icon in the vertical bar on the left-hand side of the screen.
In PHENOM, click on the GENERATE icon in the vertical bar on the left-hand side of the screen.


[[File:Phenom navigation bar 4.png|thumb|none]]
[[File:Phenom navigation bar 4.png|thumb|none]]
Line 26: Line 25:
Please make the following choices:
Please make the following choices:
* '''CinC Artifact''' CinC
* '''CinC Artifact''' CinC
* '''CinC Version''' CinC 2.2.3 (note, other versions may work, this was tested with v2.2.3)
* '''CinC Version''' CinC 2.2.3 (this was also tested with v2.2.1, v2.2.3 and v2.3.1)
* '''FACE Version''' 3.0
* '''FACE Version''' 3.0
* '''Language''' c++
* '''Language''' c++
Line 58: Line 57:
Start your WSL instance, and ensure the proper packages are installed:
Start your WSL instance, and ensure the proper packages are installed:
<pre>
<pre>
apt update
apt install make
apt install make
apt install g++
apt install g++
apt install cmake
apt install cmake
apt install unzip
</pre>
</pre>
Some users have reported the need for slightly different commands.  In some cases, they needed to install <code>sudo</code> which was needed to run <code>cmake</code>.  If <code>apt install</code> does not work, you make need to use <code>apt-get install</code>.  If the build fails, you may also need to run<code>apt install build-essential</code>.


== Setup the Project ==
== Setup the Project ==
Line 69: Line 73:
<pre>
<pre>
username@MachineName:~$ unzip /mnt/c/users/username/downloads/RobotModelProject_face3_cinc_<timestamp>.zip
username@MachineName:~$ unzip /mnt/c/users/username/downloads/RobotModelProject_face3_cinc_<timestamp>.zip
</pre>
If unzip is not installed, run <code>sudo apt install unzip</code>.
== Install Pthread4W (Pthreads for Windows) ==
Obtain a copy of Pthreads4W here: https://github.com/jwinarske/pthreads4w
Unzip the pthreads file and copy the <code>pthreads4w-cmake</code> directory into the <code>cinc-2.2.3</code> directory.
Ensure the tools to build pthreads are installed:
<pre>
sudo apt install automake libtool mingw-w64
</pre>
Then build pthreads from the pthreads folder:
<pre>
autoheader
autoconf
mkdir -p build-win64 && cd build-win64
../configure --host=x86_64-w64-mingw32 --prefix="$PWD/install"
make clean GC
</pre>
</pre>


== Build CinC ==
== Build CinC ==
Return to the main cinc folder <code>cin-2.2.3</code> and run the following commands:
Return to the main cinc folder <code>cinc-2.2.3</code> and run the following commands:


<pre>
<pre>
Line 105: Line 86:
Although you can run your application at this point, it will produce no visible output.   
Although you can run your application at this point, it will produce no visible output.   


Edit <code>Test_System/Config/DemoMain/TSS/TSS_TATS.xml</code> file.
Edit <code>Test_System/Config/Robot_Demo/TSS/TSS_TATS.xml</code> file.


Find the <code>logging_config</code> section of the config.  If it does not exist, add it as the first block inside the 'cinc' configuration.  The final result should look something like the following:
Find the <code>logging_config</code> section of the config.  If it does not exist, add it as the first block inside the 'cinc' configuration.  The final result should look something like the following:

Latest revision as of 14:46, 20 January 2026

This tutorial will walk a user through the compilation and execution of a CinC-based application. It builds upon other tutorials in PHENOM. As such, it uses the same principles as Integration Model to CinC Generation, but the content is different.


Preparing PHENOM

In this tutorial, you will integrate two software applications, enabling them to communicate with each other. For the sake of simplicity, they will be integrated into a single executable. This will allow you to see the result of the integration by running a single file. This tutorial uses the Integration Model as shown in a previous tutorial.

Start by downloading this data model: Download Robot_model_with_integration_model.skayl file

Load this model into a new project in PHENOM. If you need help loading the project file, please view this tutorial: Creating a Project from an Existing Model.

Export a CinC Package

In PHENOM, click on the GENERATE icon in the vertical bar on the left-hand side of the screen.

Select the CINC tab.

Please make the following choices:

  • CinC Artifact CinC
  • CinC Version CinC 2.2.3 (this was also tested with v2.2.1, v2.2.3 and v2.3.1)
  • FACE Version 3.0
  • Language c++
  • Override namespaces? Not Selected
  • System Directory Test_System
  • Include CinC Source? Selected
  • Include Model files? Selected
  • Selection Type Mains and UoPs

There is a prompt to Select your Mains and UoPs. Since the project was setup to have both applications in a single executable, both UoPs are listed under a single main. Ensure all three elements are selected, like this:

Next, select a license. For this tutorial, you should choose Evaluation.

And finally, click GENERATE. PHENOM will start creating your source package and your browser will automatically download it once complete.

Prepare the Environment

In your Windows user folder (typically C:\Users\<username>), create (or edit) the .wslconfig file.

Make sure the file contains the following entries:

[wsl2]
networkingMode=mirrored

[experimental]
hostAddressLoopback=true

Start your WSL instance, and ensure the proper packages are installed:

apt update

apt install make
apt install g++
apt install cmake
apt install unzip

Some users have reported the need for slightly different commands. In some cases, they needed to install sudo which was needed to run cmake. If apt install does not work, you make need to use apt-get install. If the build fails, you may also need to runapt install build-essential.

Setup the Project

Unzip your CinC project in your user home (or other) directory. This will create a subdirectory called cinc-2.2.3.

From the wsl prompt, the command might look something like this:

username@MachineName:~$ unzip /mnt/c/users/username/downloads/RobotModelProject_face3_cinc_<timestamp>.zip

Build CinC

Return to the main cinc folder cinc-2.2.3 and run the following commands:

cmake .
make

Configure the Logger

Although you can run your application at this point, it will produce no visible output.

Edit Test_System/Config/Robot_Demo/TSS/TSS_TATS.xml file.

Find the logging_config section of the config. If it does not exist, add it as the first block inside the 'cinc' configuration. The final result should look something like the following:

<cinc>
    <logging_config>
        ...
        <logger type='uop' level='info' show_source='true' />
    </logging_config>
    ...
</cinc>

Where '...' represents other data that may be present.

Run CinC

From the cinc-2.2.3 directory, start your application using:

./Test_System/Mains/Robot_Demo/Robot_Demo

PHENOM has created a very basic implementation of each UoP. Transmitted data is populated with a constant value (typically pi). The logger indicated that information is being sent. The receiving application decodes the data type and prints the received value. If the application is printing out "3.14" along with some other information, it is working.