I am currently working on a project where I was asked to write the software with platform independency in mind. So I should be able to transfer the software or the logic of the program to a different Linux based PLC and it should work with minimal to no changes in the software. Of course the port assignment will always be different from PLC to PLC.
I was thinking of making functionblocks in C++ and using those in PLCnext engineer. But could would it be possible (and sensible) to program entirely in C++ and run that directly from Linux? and would I be able to use libraries like the AXL_ComSerial? Is there C++ code available for that library.
I would like to hear your thoughts on the best way to approach this.
I would be interested to see other opinions, but I think this requirement will be difficult to acheive in practice.
The dream of code portability between PLC vendors has been around for a while, but has never been fully realised (in my opinion). Some things that have made this easier:
The IEC 61131 standards, including file formats like PLCOpen XML
* that are supported by multiple PLC vendors.
* Codesys, which is available on multiple hardware platforms, including PLCnext Control devices.
If vendor-specific PLC runtimes are not required for an application, then it might be possible to write a complete application in C++ using only standard or open-source C++ libraries. That would allow portability to pretty much any open platform, not only industrial control devices. The only adaption then would be for things like device-specific hardware (e.g. Axioline I/O). In that case the application could be designed to isolate device-specific features to small parts of the code.
To answer the specific questions:
would it be possible (and sensible) to program entirely in C++ and run that directly from Linux?
That depends on the application, and the skill set of the people who will be developing and maintaining it.
would I be able to use libraries like the AXL_ComSerial?
No, not in a C++ application.
Is there C++ code available for that library.
Not that I’m aware of, but a version of that PLCnext Engineer library could be written in C++ to use the data interface described in the user manual for the Axioline Serial Communication module.
I am just now porting code which I developed on Horner xl7e platform entirely in 61131 ST
That is likely the most portable scenario in PLC-land
There are lots of loose bits of string needing tying up, and many cats needing herding… in porting to PLCnextEngineer
The way variables are handled
Functions / Function blocks
even basic stuff like TON TOFF R_TRIG F_TRIG need tweaking and twiddling
for “small” appliations, manual code-bashing is likely the most expedient way
For “large” applications, one might choose to analyze the transformations required to convert from one platform
to another. Choose one as the main “source development” platform and transform / hand-tweak the incremental
changes.
I’m not complaining… not wedged or stuck yet… Some features may need to be abandoned…