Skip to content

Commit

Permalink
Prepare SDK-V-0206.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Albrecht Johannes (DC-AE/ESW1) committed Jul 30, 2024
1 parent 1e8496e commit 8dba09d
Show file tree
Hide file tree
Showing 165 changed files with 2,252 additions and 1,173 deletions.
4 changes: 2 additions & 2 deletions doc/appdevguide_reserved-interfaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ The following ports are blocked and cannot be used by an app.

| Reserved by | Reserved ports |
| --- | --- |
| ctrlX OS | 22, 80, 81, 443, 1338, 1880, 1900, 2069, 2070, 4840, 5355, 5353, 6000, 7878, 8069, 11740, 11741 |
| Other apps | 1884, 2883, 4222, 8000, 8080, 8088, 8142, 8840, 8883, 10123, 16620, 16700, 16701, 16800, 16810, 18500, 47808, 48898, 49250-50250, 56090 |
| ctrlX OS | 22, 80, 81, 443, 1338, 1880, 1900, 2069, 2070, 4840, 5355, 5353, 5858, 6000, 7878, 8069, 11740, 11741 |
| Other apps | 1881, 1884, 1885, 2883, 4222, 6123, 7505, 9230, 9240, 8000, 8080, 8088, 8142, 8840, 8883, 10123, 16620, 16700, 16701, 16800, 16810, 18500, 47808, 48898, 49250-50250, 56090, 58000, 51218 |

****
**Copyright**
Expand Down
476 changes: 476 additions & 0 deletions doc/datalayer.md

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions doc/dotnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,15 @@ Check your Runtime:

dotnet --list-runtimes


### Install the Visual Studio Code Extension from Marketplace
### Install the Visual Studio Code C# extension from Marketplace

We recommend to use __Microsoft Visual Studio Code__ on your host computer as IDE - [see here](vscode.md).

To develop and test .NET application for the ctrlX we have to install the C# extension in the VM.
To develop and test .NET application for the ctrlX we have to install the __C#__ extension in the VM.

* Start Visual Studio Code and connect it with the QEMU VM.
* Select the extension icon in the left side bar and enter c#
* Select this extension and click 'Install in SSH'
* Select the extension icon in the left side bar and enter __c#__
* Select the C# extension and click 'Install in SSH'

![C# extension](images/csharpextension.png)

Expand Down
57 changes: 57 additions & 0 deletions doc/fbs/comm/datalayer/metadata.fbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
include "allowed_operations.fbs";

namespace comm.datalayer;

enum NodeClass : byte {
Node,
Method,
Type,
Variable,
Collection,
Resource,
Program,
Folder,
}
enum DisplayFormat : byte {Auto, Bin, Oct, Dec, Hex}

table Extension {
key: string (key);
value: string (required);
}

table LocaleText {
/// iso 639.1
id: string (key);
text: string (required);
}

table Reference
{
/// nodeid of type "readType", "writeType", "createType", ...
type: string (key);

/// full qualified address of target
targetAddress: string (required);
}

table Metadata {

nodeClass: NodeClass = Node;

operations : AllowedOperations (required);

/// markdown text only
description: string (required);

/// URL to description
descriptionUrl: string (required);
displayName: string;
displayFormat: DisplayFormat = Auto;
unit: string;
extensions : [Extension];
references : [Reference];
descriptions: [LocaleText];
displayNames: [LocaleText];
}

root_type Metadata;
100 changes: 100 additions & 0 deletions doc/fbs2plc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# fbs2plc.exe - Use Flatbuffers in your PLC project

A lot of ctrlX Data Layer nodes contain structured data stored in the [Flatbuffers](https://google.github.io/flatbuffers/) format.

The data structure is defined in a schema file (.fbs file). The FlatBuffers compiler [flatc](https://google.github.io/flatbuffers/flatbuffers_guide_tutorial.html) is able to compile such a .fbs file into code for several programming languages including IEC 61131-3 Structured Text (ST).

This guide describes how one or more fbs files can be compiled into IEC 61131-3 ST code and how this code can be imported and used in your IEC 61131-3 project to handle Flatbuffers.

The described workflow and the tools are currently running __only under Windows 10__.

## Prerequisites

### ctrlX WORKS

Install ctrlX WORKS >= 1.20 with the function 'ctrlX PLC Engineering' and 'App Build Environment'.

We recommend to use __"C:\Program Files\Rexroth\ctrlX WORKS"__ as installation path.
In this case the path to ctrlX PLC Engineering is __"C:\Program Files\Rexroth\ctrlX WORKS\Studio\Common\ctrlX-PLC-Engineering.exe"__

#### ctrlX CORE

* Create a ctrlX CORE<sup>virtual</sup> with __Port Forwarding__ and start it.
* Install the PLC snap.

### ctrlX AUTOMATION SDK

#### On your Windows host

Download the [ctrlX AUTOMATION SDK](https://github.com/boschrexroth/ctrlx-automation-sdk/releases) and extract it to __c:\ctrlx-automation-sdk__

Now two executables are available:

* c:\ctrlx-automation-sdk\bin\oss.flatbuffers\win-msvc-x64\release\flatc.exe
* c:\ctrlx-automation-sdk\bin\fbs2plc\win-x64\fbs2plc.exe

#### On your App Build Environment

* From ctrlX WORKS, create and start an App Build Environment.
* Login into your App Build Environment: ssh -p 10022 boschrexroth@127.0.0.1
* Password is boschrexroth
* Install the ctrlX AUTOMATION SDK

$ ~/scripts/install-sdk.sh

* Build a required snap (here amd64) and install it on the ctrlX CORE<sup>virtual</sup>

$ cd ~/ctrlx-automation-sdk/samples-cpp/datalayer.provider.all-data
$ ../../scripts/build-upload-log-snap.sh -PF

* Open a web browser, login into your ctrlX CORE<sup>virtual</sup>. A Data Layer node __sdk-cpp-alldata/dynamic/fbs__ should exist.

This node later can be read, changed and written by our IEC 61131-3 PLC code.

## Reading and writing a flatbuffers ctrlX Data Layer node in your PLC project

The basic steps are:

1. Create a PLC library which contains the IEC61131 ST code to handle a Flatbuffers variable
2. Create a new PLC project
3. Import the created PLC library and provided sample code into your project
4. Compile the project and log into your ctrl CORE<sup>virtual</sup>

### Create a PLC library

Start cmd.exe and enter these commands:

c:
cd \ctrlx-automation-sdk\samples-fbs2plc\sampleSchema
start.bat

Result:
* The file c:\ctrlx-automation-sdk\samples-cpp\datalayer.provider.all-data\sampleSchema.fbs was compiled into IEC61131 code.
* A new PLC library __fbs-sampleSchema__ was created, using c:\ctrlx-automation-sdk\plc\CXA_fbs_Template.library as template.
* All required standard libraries were imported.
* ctrlX PLC Engineering now has the new library opened.

Store the new library so that you can use it in your PLC project:

* Select File - Save project and install into library repository
* Close the libray
* Keep ctrlX PLC Engineering running

### Create a PLC project

* In ctrlX PLC Engineering create a new PLC project use 'ctrlX CORE x64 Project' as template.
* Select the node Application and delete it.
* Select the node PLC Logic
* Select menu item Project - PLCopenXML import..., select c:\ctrlx-automation-sdk\samples-fbs2plc\sampleSchema\fbs-read-write.xml
* Double click the node library manager
* Add the library CXA_DATALAYER to your project.
* Connect the device of ypur PLC project with the ctrlX CORE<sup>virtual</sup>
* Login into your ctrlX CORE<sup>virtual</sup>

### Check the Flatbuffer Access

* From a web browser login into your ctrlX CORE<sup>virtual</sup> Web UI
* Select Settings - Data Layer
* Expand the Data Layer tree: sdk-cpp-alldata/dynamic/fbs

The values of the x, y, z variables should be changed by our PLC program.
Binary file modified doc/images/csharpextension.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/flatbuffer_compiler.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 3 additions & 24 deletions doc/install-scripts.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,5 @@
The directory __/home/boschrexroth/scripts/__ of an App Build Environment contains a set of important scripts.
The following assumes that ctrlX AUTOMATION SDK has been installed in the __/home/boschrexroth/ctrlx-automation-sdk__ (or simplified __~/ctrlx-automation-sdk__) directory.

In the file `/home/boschrexroth/scripts/README.md` all files are listed and described.
The directory __~/ctrlx-automation-sdk/scripts/__ of an App Build Environment contains a set of important scripts.

__Hint:__ The ctrlX AUTOMATION SDK contains these scripts also in the folder scripts/environment/scripts.

## Some important scripts

### install-sdk.sh

!!! important
Run this script first.

In addition to the ctrlX AUTOMATION SDK, the ctrlx-datalayer debian package, snapcraft and libraries for cross build are installed.

~/scripts/install-sdk.sh

Now the directory ctrlx-automation-sdk/ contains the files of the ctrlX AUTOMATION SDK.

### install-go, -dotnet, -nodejs

These scripts are installing programming language dependend packages to be able to build apps in the according language.

### install-ctrlx-os-dev-tools.sh

This script installs packages needed to build a ctrlX CORE image.
In the file [`~/ctrlx-automation-sdk/scripts/README.md`](https://github.com/boschrexroth/ctrlx-automation-sdk/tree/main/scripts) all files are listed and described.
28 changes: 5 additions & 23 deletions doc/install-sources-from-github.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,18 @@
## Introduction

If you want to contribute the ctrlX AUTOMATION SDK you have to clone the github repository https://github.com/boschrexroth/ctrlx-automation-sdk.git.

After this step you have to merge the runtime content of ths ctrlX AUTOMATION SDKs zip archive into this repo.

These jobs can be initiated by __install-sdk-from-github.sh__ located in the ctrlX AUTOMATION SDK folder __scripts/__

## Installing a Runnable Repository

* Open the github site [https://github.com/boschrexroth/ctrlx-automation-sdk/tree/main/scripts](https://github.com/boschrexroth/ctrlx-automation-sdk/tree/main/scripts)
* Download the script install-sdk-from-github.sh
* Install the script e.g. in the home directory of your App Build Environment
* Create a working directory e.g. ~/github
* Change into this directory and call the script

~/install-sdk-from-github.sh

When the script is finished the ctrlX AUTOMATION SDK is installed into the directory ctrlx-automation-sdk and sample projects can be build at once.
Follow the installation instructions of [ctrlX AUTOMATION SDK](https://github.com/boschrexroth/ctrlx-automation-sdk.git).

## Build Sample Project

To build a sample project do following steps:

Change directory e.g.:

cd ctrlx-automation-sdk/public/samples-cpp/datalayer.provider.all-data

Change directory e.g.:

Build snap:
cd ~/ctrlx-automation-sdk/samples-cpp/datalayer.provider.all-data

build-snap-amd64.sh
Build snap:

./build-snap-amd64.sh

## Troubleshooting

Expand Down
Loading

0 comments on commit 8dba09d

Please sign in to comment.