I’m working with a Beckhoff PLC running Twincat 3 and communicating to it using an Ubuntu client with Pyads. Is there any way to upload a project configuration to Twincat using Python, Bash, or something similar?
My goal is to have multiple Python projects each with specific Twincat projects, and running one Python project will upload the corresponding Twincat project to the PLC. As far as I can tell, the only way to upload a configuration is by clicking the button on the Twincat software.
2
Answers
There are a few steps to do what you want but it is theoretically possible (in that the toolchain exists, but I’ve not tested it)
The first element that you are missing with your understanding is the Automation Interface(AI) vs the Automation Device Specification(ADS).
The ADS is intended as a method for accessing data that is available on the controller, and possibly implementing commands to a running controller, but provides little to no functionality for configuration and deployment.
The AI is the tool that you are looking for regarding scripted development and deployment of code. Specifically the AI method ITcSysManager::ActivateConfiguration should do what you want in terms of deploying to a remote controller.
The second complication is that the AI is implemented via .NET, which is intended to be natively implemented in a windows environment. However using IronPython it should be possible to implement the basis of the .NET implementation, however this is still intended to interface to visual studio so it will likely not be possible to work through this in an entirely unix environment.
The actual project and configuration is stored in PLC :
C:TwinCAT3.1Boot
So this is quite easy. You just need to have script which is copy requested configuration into this directory and restart the TwinCat or PC. This can be done by simply cmd or via ADS command