Search code examples
plctwincat

Deploying config files to PLC


Is it possible include arbitrary files (in this case a .csv) from a TwinCAT project direct to the Boot directory of a PLC?

By using PATH_BOOTPATH in the file open/read FBs it is possible to load files from this directory in a convenient manner regardless of whether using a CE or Windows deployment, However deployment of files to this location seems to be the sticking point.

I know that a copy of the project code is included within the CurrentConfig<Project>.tpzip file, but this file is not easily accessible from code, or updateable.

I've found the 'Additional Files' section within the system configuration, but it makes little sense.

  • Adding a file from inside the project as a 'Relative' path doesn't seem to do anything
  • Adding a file from inside the project as an external path includes the file (via symbolic links?) in the 'CurrentConfig.tszip' file, which has the same issues as the .tpzip
  • Adding an external file as an external path again includes the file inside of the .tszip. Setup of the system "Additional files"

I'm willing to accept that this might not be possible, but it just feels odd that the PATH_BOOTPRJ and PATH_BOOTPATH roots are there and not accessing useful paths.


Solution

  • Deployment

    To quote Beckhoff:

    Deployment is used to set up commands that are to be executed during the installation and startup of an application.

    Beckhoff example deployment


    The event types are essentially at what stage of the deployment process the command is performed, where the command can either be copying a file or execution of a script/program.

    Haven't performed extensive testing but between absolute/relative pathing and execution this should solve nearly all issues with deployment configuration.