Hi all,
I am trying to find a way to automatically save my PLC program’s retain data in the scenario where if power is lost, PLC fails, etc, then I simply reupload a retain data file so that I don’t have to manually enter data again. I came across the attached forum ( https://forum.plcnext-community.net/t/capture-retain-data-without-plcnext-engineer-backup/9832 ), and it seems that using the C++ API is a way I can do what I am trying to achieve.
I am wondering if
- This is a suitable approach and,
- How do I get started to get this all working together.
I am relatively new to programming in C++. Most of the programs used on the AXC F-2152 controller are Structured-Text based and use version 2024.0.6
Hi,
why aren’t you just using retain variables in the PLCnext Engineer? Normally on a power down event there is not enough time for storing AND downloading the data reliably.
There is also a possibility to configure the system retain handling, storing data in files.
Extended retain handling
Hi Marcel.
I am using the retain values already, however it is not in practice for us to simply manually save the retain values via the cockpit and there are instances where a project with a different name is accidentally loaded in, wiping all the values.
I am trying to automate the process of the saving retain values that would mimic the behaviour of the Save Retain Data button and do so every x amount of time to ensure some sort of backup file of retain data is present.
They are already saved automatically in a rotating manner (10 files in total). On each cold start (e.g. on reboot after a power loss or when downloading and starting a new project) retain data are stored in files under /opt/plcnext/retaining/backups/. Read the link from my first comment for more information.
The API should also work, but in my opinion you just need an application, which uploads the files to kind of a file server, if storing on the device and 10 cold starts ago are not enough.