FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
Dear Community User! We are updating our platform to a new
system.
Read more: Important
information on the platform change.
10-15-2024 10:20 AM
Hello,
I have seen the several existing topics on PLC retain/persistent memory. I am trying to clarify the following:
1. How to check total Retain only and Persistent data is within limits whilst developing application offline (before having hardware to check memory usage). I understand the configurable PLC Persistent/retain limit on the core to be maximum 115(118)kB for both Persistent and Retain data. However the application compiles OK when having 115kB PERSISTENT RETAIN and 115kB RETAIN only (e.g. 230kB in total). I assume when you download application to the core you will then get an out of memory error. Is there anyway to check total retain only and persistent will be within hardware limits in your offline PLC project?
2. A colleague has asked for support on similar topic... With project below if only 624 bytes of retain data are used why is this shown as nearly 95% (5% spare space)? Similarly with the persistent data if onlt 256 bytes then why does this take so much memory (37% (63% spare))?
Many Thanks
4 weeks ago
Hi,
on the ctrlX CORE there is only one physical NVRAM (Non Volatile RAM) available. For X3 the size is 128 kB, for X5/X7 it is 2 MB. Because of administration issues of the ctrlX operating system, not all the size is available for the applications running on the ctrlX CORE. Each app is allowed to reserve NVRAM to handle its application(s). So does the PLC app, too.
Using the dialogue in the PLC Web UI you can reserve NVRAM for the PLC app. We defined values up to 118000 for X3 and 2000000 for X7. Please notice, that setting these values can fail, if other apps have already reserved memory for their applications. That's why the default values are lower than the maximum ones.
When creating a PLC project, the user is able to define one or multiple applications. Each application defines splitted memory areas (area 0, area 1, area 2 and area 3). The individual content and it's calculated size can be seen in the window Messages when compiling the application.
Memory areas 0 and 3 are located in the RAM, area 1 and 3 must be located in the NVRAM.
When downloading a PLC application the required memory size is allocated in the corresponding memory area.
Please note: To handle memory descriptors and online changes an additional offset is allocated inside these areas based on the size, that was reckoned by compiling the project in ctrlX PLC Engineering.
The defined value for area 0 and area 3 is 30% and for area 1 und area 2 it is 5%.
Example: The reckoned size of an application for area 0 or area 3 is 10000 bytes. Then 13000 bytes are allocated. If the same value is required for retain data (area 1 ), then the allocated size is 10500 bytes.
Additionally there are values for the minimum size of each area, too:
The defined value for area 0 and area 3 is 64 kB and for area 1 und area 2 it is 256 Byte.
Doing online changes dues to the fact that there will be memory gaps inside the areas. If the memory area is so fragmented, that an online change is not possible any longer, the program must be cleaned, compiled and downloaded again.
If there are multiple PLC applications defined in the ctrlX PLC Engineering project under the same device, each of them has an area 0, area 1, area 2, area 3. So the setting of the right value depends on the number of the PLC applications, too.
Coming back to your questions:
1. To identify the right setting for the value in the dialogue
Compile all the PLC applications in your project that shall run on the same controller and sum up all the calculated sizes for the corresponding area 1 and area 2. This must be the minimum value.
2. The PLC application requires 590 bytes of retain data. This value is higher than the minimum size of 256 byte. The additional offset is 5% (30 byte). As a consequence 590 + 30 bytes, are allocated on the controller. I can't explain why 4 byte more are allocated. maybe it's the alogorithm. But that shouldn't matter.
On the other hand the calculated memory for retain persistent data is lower than the minimum value of 256 bytes then 256 bytes are allocated.
I hope this answers your questions.
Kind regards