Network Protocols Bridge Digital Twin Generation
Network Protocols Bridge (NPB) Digital Twin (DT) is a software component working as a Software-Defined Networking controller that can monitor and configure the NPB at runtime. Technically, a NPB DT is an AAS DT of the NPB. The generation of NPB DT from the AAS model is integrated into the Papyrus4Manufacturing.
Step-by-Step Guide
This section presents three basic steps to generate NPB DT.
Step 1: Generate AAS DT Java Maven project
In the Model Explorer window, right click at the AAS, go to AAS > Generate Asset Administration Shell BaSyx Code (AAS). If the AAS model design is correct, then a new generate code folder will appear in the Project Explorer window and it will show no error (no red star on the project icon).
If there is no new generated folder or a new project is generated with a red star, you should recheck the AAS model design and re-generate it.

Note: The files generated can be different depended on the
featureId.
Step 3: Modifying Java Codes
In general, the generated Java code is ready to use, but you can modify the generated Java codes for further customization. This step requires basic knowledge on Java programming.
In the Model Explorer window, browse the folder src/main/java. This folder includes all of the Java source code related to the AAS DT.
Note: Your new added codes can be overried when you re-generate the AAS project. So you should be careful.
Usage
You can run the NPB DT on the Papyrus4Manufacturing environment: In the Project Explorer, right click at the AASServer.launch file, go to Run As > AASServer.
If the NPB DT boots correctly, it will connect to the NPB and expose a AAS standard HTTP interface to external applications. The interface listens to the endpoint defined in the design.

Note: The NPB must be running before launching the NPB DT. If not, an error will occur.
There are two methods to interact with the NPB DT. First is to use the HTTP REST API as other AAS DTs generated by Papyrus4Manufacturing. To check the API, you can open the README.md file generated in the generated project.
The second method is to use the Graphic User Interface (GUI)
integrated into the NPB DT. Open a web browser, and enter the
NPB DT endpoint with the path /p4m/gui
.
This GUI has a monitoring board that observes
properties and operations of the NPB DT.
A command chat box allowing users to input the command to
interact with the NPB DT.
Some valid commands are log, read, write, call, and reload.

Helpful Tips
This section presents some useful tips to build and run NPB DT.
Backup code
Remember to backup your code to a new folder before re-generating the project. A simple method is to copy and paste the the project in Project Explorer. For the step: right click at the project folder, press Ctrl + C, then press Ctrl + V. In the new appeared window, change the name of new project then click Copy.
Another way to backup code is to use git. Open your terminal and navigate to your project. Using the following commands.
$
git init
$git add .
$git commit -m "SOME IMPORTANT MESSAGE"
Interact with NPB DT's HTTP interface using Postman
Postman is a good tool to create HTTP REST commands and interact with the HTTP interface of the NPB DT. To install and run the standalone version:
$
wget https://dl.pstmn.io/download/latest/linux_64
$tar -xvzf postman-linux-x64.tar.gz
$./Postman/Postman
For more information, check the Postman's tutorial.