I have several libraries which contain values that should be saved on a PLC. As apparently no Persistent Variable List is available within Libraries, I use the Persistence Manager to create a Persistence Channel in the Project which imports the library. I then specify the persistence channel in the library using the {attribute 'ac_persist':='PersistenceChannel_CT'} specifier. This generally works very well and gives me exactly the properties I require. However, it came to my attention that the (alphabetially) first value from the library is not saved in the created ASCII file. When checking the content of the Persistence Channel, it shows all the variables as defined in the library. But the created file does not contain the first value and it is not restored after restart or reset. (see attached picture)
I disabled Periodic Saving and set xSaveOnChange to TRUE and so the file usually updates immediately after changing one of the values. When changing the first value, it does not update which is consistent with this value not being saved.
I also created a sample project and library from scratch which shows the same issue both using a Raspberry Pi and using a Linux machine.
Does someone know what the reason for this could be or did someone make similar experiences? Looking forward to hearing your suggestions.
After some more digging I realized that I get an error on the PLC Logger saying PersistenceChannel: 150 (invalid type in data: SimpleLibrary). I suppose the issue could be found in the ConfigData, which is automatically generated and which looks like this:
Perhaps the fact that the variable is stored within a library confused the compiler? I tried changing the PersistenceChannel parameters to xCompressTags := FALSE which changed the entry in the data file from _xCompressTags BOOL:TRUE_xCompressTags BOOL:FALSE but the actual content of the data file and also the config data did not change.
Last edit: manuknecht 2023-10-17
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have several libraries which contain values that should be saved on a PLC. As apparently no Persistent Variable List is available within Libraries, I use the Persistence Manager to create a Persistence Channel in the Project which imports the library. I then specify the persistence channel in the library using the {attribute 'ac_persist':='PersistenceChannel_CT'} specifier. This generally works very well and gives me exactly the properties I require. However, it came to my attention that the (alphabetially) first value from the library is not saved in the created ASCII file. When checking the content of the Persistence Channel, it shows all the variables as defined in the library. But the created file does not contain the first value and it is not restored after restart or reset. (see attached picture)
I disabled Periodic Saving and set xSaveOnChange to TRUE and so the file usually updates immediately after changing one of the values. When changing the first value, it does not update which is consistent with this value not being saved.
I also created a sample project and library from scratch which shows the same issue both using a Raspberry Pi and using a Linux machine.
Does someone know what the reason for this could be or did someone make similar experiences? Looking forward to hearing your suggestions.
Thanks in advance and best wishes
Manuel
After some more digging I realized that I get an error on the PLC Logger saying PersistenceChannel: 150 (invalid type in data: SimpleLibrary). I suppose the issue could be found in the ConfigData, which is automatically generated and which looks like this:
1
9##83
SimpleLibrary#GVL.aMoreZeros.[1]#0#64512#15#0
<[2]#0#64520#15#0
<[3]#0#64528#15#0
<[4]#0#64536#15#0
<#0#64544#15#0
<[6]#0#64552#15#0
<<lrVar#0#64560#15#0
<strVar#0#64428#16#80
<uiDummy#0#64370#11#0
Perhaps the fact that the variable is stored within a library confused the compiler? I tried changing the PersistenceChannel parameters to xCompressTags := FALSE which changed the entry in the data file from _xCompressTags BOOL:TRUE _xCompressTags BOOL:FALSE but the actual content of the data file and also the config data did not change.
Last edit: manuknecht 2023-10-17