Home > Enterprise >  Is it possible to remotely upload a configuration to Twincat i.e. from a Python script?
Is it possible to remotely upload a configuration to Twincat i.e. from a Python script?

Time:08-24

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.

CodePudding user response:

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.

CodePudding user response:

If it is just a standard TwinCAT PLC project then this is held in C:\TwinCAT\3.1\Boot

You could just swap out the files in here while TwinCAT is in Config mode then ask TwinCAT to go in to run. Triggering TwinCAT Run/Config is available on ADS. You can then just do the file transfer using another method.

Boot folder shown here. https://infosys.beckhoff.com/english.php?content=../content/1033/machineupdate/6137494027.html

  • Related