Prerequisites
ctrlX OS (Version 3.6 or higher)
ctrlX OS - Node-RED App installed (Version 3.6 or higher)
crtlX OS - PLC App installed (Version 3.6 or higher)
ctrlX PLC Engineering installed
Introduction
Do you have different end types or bus systems, but want to keep your application unchanged.
You can use the Data Layer to create a defined path for your application and use aliases to map this path to other variables within the Data Layer.
Provide RT-Data to ctrlX Data Layer
First of all, we need a Data Layer struct we can read out in our application.
Create a ctrlX Data Layer provider in an application (e.g. C++ or PLC)
Open ctrlX PLC Engineering and create a Global Variable List (GVL) where you define the necessary variables. This GVL will serve as the structure we want to read in our application.
Create GVL Create Real-Time (RT) Data Layer variables using the automatic code generator.
Provide PLC RT-Data as IEC-Code Call the generated code in e.g. PlcProg.
Call the generated Code If you finally run the program, a new Data Layer entry can be found on your system.
RT-Data in ctrlX Data Layer
Now you have new RT-data available on your Data Layer. This data can be utilized in other applications, such as Node-RED.
Problem
If the address of the Data Layer node changes (e.g. because of a renaming of the application or the struct name), the address will not be present anymore.
Solution - Use "ctrlX Data Layer - aliases"
You can use aliases to create a new Data Layer entry that "re-routes" to another target within the Data Layer.
Create a new "alias-route"
Create new Alias Route Configure alias-route A new entry in the Data Layer will be visible now.
ctrlX Data Layer after configuring alias-route successfully You can use this address to read out the variable in your application.
Node-RED flow that reads address via. alias-route Furthermore, you can use the REST "Put"-method to modify your Data Layer/alias. This will help to build applications that are independent from the original address of your data source.
Modify ctrlX Data Layer / alias
Key Advantage of using "ctrlX Data Layer - aliases"
Even if the source of the variables and the address is changed, you can modify your Data Layer-/alias-route and don't have to change any configurations in your application.