12-02-2021 03:42 PM
Hello,
Did anyone had this problem before, to run out of retain memory, for a Control Plus project ?
Is it possible to change the allocated memory, in TwinCat? If yes, how can I do this, and how can I check, if by increasing this memory size I'm not overlapping a different part of the memory? And last thing, is it recommended to change it, or I should find a workaround?
Thanks!
Solved! Go to Solution.
12-03-2021 11:41 AM - edited 12-03-2021 11:44 AM
Is the variable declared as RETAIN or as PERSISTENT (or even both)? TwinCAT behaves different than CoDeSys (or IndraLogic) concerning these keywords. With all TwinCAT target systems supported by Control plus, it is never necessary to declare a variable as RETAIN. With TwinCAT, RETAIN variables are linked to a NOVRAM hardware memory. Instead, just use PERSISTENT and the variables will be persisted on the Windows file system.
12-03-2021 01:18 PM
Hi. They are declared both as persistent and retain. So this must be the problem. I will use only persistent, and I will test next week. I will comeback with a feedback, once I will test your solution. Thank you! You're the best! 😁😎
12-03-2021 04:33 PM - edited 12-06-2021 03:24 PM
Short answer:
Do not use RETAIN in Control plus, only use PERSISTENT. It covers all cases to keep the values (execpt Reset Origin).
[December 2021]
Long answer:
RETAIN saves the variables in the NVRAM / NOVRAM. The Beckhoff target systems supported by Control plus do not have/need a NOVRAM. An example with included NOVRAM would be the CX9020.
This NOVRAM is limited in its size and causes your error.
In TwinCAT the declaration with RETAIN is not enough (whereas in IndraLogic/ctrlX/CODESYS it should be enough). In TwinCAT you additionally have to link the RETAIN variables like IO variables with the NOVRAM:
Overview of the behaviour in Control plus:
Command | VAR | VAR RETAIN | VAR PERSISTENT |
---|---|---|---|
Reset warm (not available in TwinCAT) |
x | x | |
Reset cold |
x | ||
Reset origin | |||
Download | x | ||
Online change | x | x | x |
In ctrlX there is a special case (task-local GVL) where you even must not use RETAIN and PERSISTENT together: Link
General documentations:
ctrlX (quite extensive)
12-06-2021 09:24 AM
Thanks Steffen! very useful information! 😁