DEV Community

Winfred Young
Winfred Young

Posted on

An Open-Source, Low-Cost, High-Performance Linux Master Controller Solution for the Processing Industry, Built on Framework RTOnBoot and OpenPLC.

Industrial controllers are an important component of modern industrial control systems, and their performance and stability play a crucial role in industrial control systems.
Currently, there are some mature industrial controller solutions on the market, both domestically and internationally. These are generally not open-source, are expensive, and their real-time performance is not superior. OpenPLC is an open-source industrial controller solution with a good ecosystem, but its real-time performance is poor and needs improvement in many areas.
Chengdu Shian Anxin Technology Co., Ltd. has perfectly integrated its industry-leading multi-core heterogeneous framework RTOnBoot and its Ethercat master station solution based on RTOnBoot with OpenPLC, launching an open-source, low-cost, high-performance Linux master controller solution for the processing industry, built on the multi-core heterogeneous framework RTOnBoot and OpenPLC.
The multi-core heterogeneous framework RTOnBoot has excellent real-time performance. Running the OpenPLC runtime on the real-time core controlled by RTOnBoot will undoubtedly greatly improve the real-time performance of the OpenPLC runtime. Meanwhile, OpenPLC's web server, libmodbus, opendnp3, and libsnap7 run on Linux. This leverages both Linux's network advantages and RTOnBoot's real-time performance advantages, complementing each other to optimize overall system performance without increasing costs.
The current version uses a multi-core version of RTOnBoot, allowing RTOnBoot to control two real-time cores: one running the Ethercat SOEM master station, and the other running the OpenPLC runtime. The Ethercat SOEM master station's synchronization cycle can stably reach 125 microseconds, and the OpenPLC runtime's cycle cycle is also 125 microseconds. The OpenPLC runtime's latency does not affect the Ethercat SOEM master station. Testing on the RK3588 shows that the OpenPLC runtime execution latency is a minimum of 4.592 microseconds, a maximum of 44.198 microseconds, and an average of 9.128 microseconds. This latency includes the time spent waiting for locks; inter-core locking is used to ensure data consistency, demonstrating excellent real-time performance. The Ethercat SOEM master latency remains the same as before: the maximum sleep latency is 11 microseconds, and the maximum execution latency, including packet transmission and reception, is 20 microseconds. The two maximum latencies combined are only slightly over 30 microseconds, leaving a margin of over 90 microseconds from the 125 microsecond threshold.
If the user does not need the Ethercat master or the OpenPLC runtime latency does not affect the real-time performance of the Ethercat master, RTOnBoot can control only one core, which is easy to switch between.
The original OpenPLC solution generated and compiled the OpenPLC runtime on the target machine. Directly copying this approach is not feasible, as we are now cross-compiling, and the runtime runs on Nuttx. Therefore, our solution is to cross-compile the generated program and hardware layer into a Nuttx dynamic link library, and then combine this dynamic link library with the ST source files and some configuration parameters.
Package into a special bin file. This special bin file is generated by a script with one click in the development environment. The original OpenPLC upload of the source file via a webpage has been changed to upload the bin file. An RTOnBoot option has been added to the existing OpenPLC Hardware options, and this is the default setting. In this state, the original OpenPLC compilation process is changed to unpacking this special bin file. Other existing OpenPLC configurations remain unchanged. Of course, we have also improved some imperfections in the original OpenPLC code.
Through these efforts, we have achieved a complete and robust low-cost, high-performance Linux master control industrial controller plus Ethercat master station solution.
Except for a small amount of code in the RTOnBoot framework, all other code related to OpenPLC, PLC runtime, and Ethercat master station is open source. The RTOnBoot framework is simple to program and has undergone thorough verification and testing.

Top comments (0)