-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Albrecht Johannes (DC-AE/ESW1)
committed
Jul 30, 2024
1 parent
1e8496e
commit 8dba09d
Showing
165 changed files
with
2,252 additions
and
1,173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.