This Loupe UX Json server processes read and write requests from Lux clients* and processes the requests with a PLC. In other words, it acts as a middleman or gateway, translating the highlevel JSON requests into platform-specific data access.
At the present time, this server is capable of connection to Beckhoff PLCs, using TwinCAT 3's built-in ADS server. In the future, additional connection types may be added.
* for more information on creating a Lux client for user interfaces, see here.
-
Twincat 3
- The ADS binaries that this Loupe UX Json server uses should be found to be located at
C:\TwinCAT\AdsApi\TcAdsDll
- The ADS binaries that this Loupe UX Json server uses should be found to be located at
-
CMake >= V3.27.1
- Overview: CMake is a system for building C++ projects through whichever compiler you wish.
- Install Recommendation: Add cmake to PATH so that
cmake
can be called from the command line
-
(Optional) Visual Studio Community 2019. If this is not installed, you will need to modify the below commands to select the generator you wish to use.
- Change directory to the following folder within the repo
cd <path_to_repo>/src/LuxServer
- Optionally, you can output a list of available generators in cmake. Note which generator you would like to use. Here we will use "Visual Studio 16 2019".
cmake --help
- Generate
cmakebuild
files for desired generator. The-G
flag specifies which generator to use,-S
specifies where the top level CMakeLists.txt file is located (should be in current directory),-B
specifes where to put the generator files, and-A
specifies the architecture of the output (32-bit is necessary here for compatibility with the ADS binaries). NOTE: This could take a few minutes to complete.
cmake -G "Visual Studio 16 2019" -S . -B ./cmakebuild -A win32
- Finally, build the executable
cmake --build ./cmakebuild --config Release --target server
- Once building is complete with no errors, the executable is located at:
.\cmakebuild\src\server\Release\server.exe
- Open
configuration.json
. It should be located in the current working directory (<path_to_repo>/src/LuxServer/
) - Modify the JSON contents as necessary, setting netID of your PLC and ADS Port number. NOTE: By default, the Twincat ADS server will listen on port 851.
- Run the the server with:
.\cmakebuild\src\server\Release\server.exe
If everything has been set up correctly, your Lux client should now be able to interface with your Beckhoff TwinCat PLC.
The repo includes an example Lux client and a TwinCat PLC project that can be used to test the server
-
Open the TwinCAT 3 project, located in
<repo>/example/TwinCat/
-
Set Target System to
Local
and Activate Configuration.
-
Work through the steps in the Getting Started section of this README.
-
Adapt the
configuration.json
file to point to the PLC (if running locally, netID should be127.0.0.1.1.1
) -
Upon running
server.exe
, you should see evidence that connection has occurred. If not, check that the TwinCAT PLC is running locally.
Follow the instructions in the README file in <repo>/example/HMI/
If everything has been set up correctly, the Lux client will be able to read and write variables located on the TwinCAT PLC.
Tagging any branch and pushing that tag to the origin will trigger a release. The release will have the name 'Release ' + what ever text is in your tag name. Example: If you push a tag with the name 'v0.0.1' the release's name will be 'Release v0.0.1'.
A release will include a .zip file named 'luxserver.zip' with the executable for the server and configuration.json file. The source code for Linux and Windows are also included.