I am using a Beckhoff PLC (CX9010 series) for a batching process control.
There are a lot of parameters (scale factors, preset, setpoints etc) that are criticial to the control logic which I need to store in the PLC.
These variables that I wish to retain have been declared as VAR_PERSISTENT in the PLC.
My problem is that under certain circumstances the data that had been declared as persistent will lose its values and go back to defaults.
After doing some digging I have found out a few things related to the persistent data but there is still a lot of holes in my knowledge.
My understanding is this:
- The variables that are declared as VAR_PERSISTENT get stored on the Bechkoff as a file named TCPLC_T_1.wbp in the TwinCAT\Boot\ directory
- This TCPLC_T_1.wbp file is created everytime TwinCAT is placed into Configure mode OR when the WritePersistentData function block is called in the PLC program.
- When TwinCAT is placed into Run mode, the TCPLC_T_1.wbp is read and renamed to TCPLC_T_1.wb~ (which is suppose to be a backup copy).
Now, as far as I have been able to establish. If the PLC is power cycled with only the backup file (TCPLC_T_1.wb~) in the directory, the persistent data will be lost.
Here comes the question:
How is this persistent data file actually linked to the PLC program?
There must be a way the PLC program links/maps tags to that file.
Now, if I made a change to the PLC program that required a program download (not online change). Does that mean the persistent data file is no longer valid and will not load?
I have noticed that when I did a program download any of the 3 possible things could happen:
- all my persistent data are retained
- all my persistent data goes back to default values
- some of my persistent data goes back to default values and some are retained
As a side question:
When/How does PLC Control decide a full download is required and when an online change is permitted?
When/How does PLC Control decide the offline project does not match the code on the PLC and hence require a full download to go online?
There has been times that I swear I have the latest copy of the code and yet PLC Control refuses to let me go online without a full downloads (which means I risk losing my persistent data).
I personally do not like Windows/PC based control. The concept of the PLC code running as an app in a multi-purpose operating system with the data being stored as files in directories.
There are a lot of parameters (scale factors, preset, setpoints etc) that are criticial to the control logic which I need to store in the PLC.
These variables that I wish to retain have been declared as VAR_PERSISTENT in the PLC.
My problem is that under certain circumstances the data that had been declared as persistent will lose its values and go back to defaults.
After doing some digging I have found out a few things related to the persistent data but there is still a lot of holes in my knowledge.
My understanding is this:
- The variables that are declared as VAR_PERSISTENT get stored on the Bechkoff as a file named TCPLC_T_1.wbp in the TwinCAT\Boot\ directory
- This TCPLC_T_1.wbp file is created everytime TwinCAT is placed into Configure mode OR when the WritePersistentData function block is called in the PLC program.
- When TwinCAT is placed into Run mode, the TCPLC_T_1.wbp is read and renamed to TCPLC_T_1.wb~ (which is suppose to be a backup copy).
Now, as far as I have been able to establish. If the PLC is power cycled with only the backup file (TCPLC_T_1.wb~) in the directory, the persistent data will be lost.
Here comes the question:
How is this persistent data file actually linked to the PLC program?
There must be a way the PLC program links/maps tags to that file.
Now, if I made a change to the PLC program that required a program download (not online change). Does that mean the persistent data file is no longer valid and will not load?
I have noticed that when I did a program download any of the 3 possible things could happen:
- all my persistent data are retained
- all my persistent data goes back to default values
- some of my persistent data goes back to default values and some are retained
As a side question:
When/How does PLC Control decide a full download is required and when an online change is permitted?
When/How does PLC Control decide the offline project does not match the code on the PLC and hence require a full download to go online?
There has been times that I swear I have the latest copy of the code and yet PLC Control refuses to let me go online without a full downloads (which means I risk losing my persistent data).
I personally do not like Windows/PC based control. The concept of the PLC code running as an app in a multi-purpose operating system with the data being stored as files in directories.