<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Is Array of Types possible in  Retained memory</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/740eb2b8ce/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/740eb2b8ce/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/740eb2b8ce/</id><updated>2021-05-19T07:52:54.063000Z</updated><subtitle>Recent posts to Is Array of Types possible in  Retained memory</subtitle><entry><title>Is Array of Types possible in  Retained memory</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/740eb2b8ce/?limit=25#e277" rel="alternate"/><published>2021-05-19T07:52:54.063000Z</published><updated>2021-05-19T07:52:54.063000Z</updated><author><name>kzuidberg</name><uri>https://forge.codesys.com/u/kzuidberg/</uri></author><id>https://forge.codesys.com895ee438d693905ecbd5819e00e91dc5feeb976a</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Good morning,&lt;/p&gt;
&lt;p&gt;I searched in this forum for my issue but couldn't find it exactly. Sorry if it was already discussed earlier.&lt;/p&gt;
&lt;p&gt;To build some sort of recipe structure which can survive a power, I declared an array of structs in retained memory.&lt;/p&gt;
&lt;p&gt;The compiler however gives a warning on that:&lt;/p&gt;
&lt;p&gt;'TwinCAT XAE': Retain variable 'PGVL.recipes' not added to retain handler because of local data type 'ARRAY &lt;span&gt;[0..23]&lt;/span&gt; OF ST_RECIPE'               &lt;/p&gt;
&lt;p&gt;First question: Is this a codesys error or something Beckhoff specific? Then I have to rest my case here.&lt;/p&gt;
&lt;p&gt;I thought I solved it by removing a time_t variable from one of the structs but now the type seems to be the problem.&lt;br/&gt;
Unfortunately the help on retain variable doesn't indicate limitation on nested structures.&lt;/p&gt;
&lt;p&gt;Can someone help me out? Thanks in advance. &lt;/p&gt;
&lt;p&gt;For completeness I include the involved code.&lt;/p&gt;
&lt;p&gt;VAR_GLOBAL RETAIN&lt;br/&gt;
    recipes: ARRAY&lt;span&gt;[0..23]&lt;/span&gt; OF ST_RECIPE;&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="nv"&gt;Remember&lt;/span&gt; &lt;span class="nv"&gt;recipe&lt;/span&gt; &lt;span class="nv"&gt;selection&lt;/span&gt; &lt;span class="nv"&gt;between&lt;/span&gt; &lt;span class="nv"&gt;shutdowns&lt;/span&gt;
&lt;span class="nv"&gt;recipe_active_index&lt;/span&gt;: &lt;span class="nv"&gt;INT&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;

&lt;span class="nv"&gt;canary&lt;/span&gt;: &lt;span class="nv"&gt;BOOL&lt;/span&gt;&lt;span class="c1"&gt;; // If this is false, the variables were not retained and should be re-initialized.&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;END_VAR&lt;/p&gt;
&lt;p&gt;TYPE ST_RECIPE :&lt;br/&gt;
STRUCT&lt;br/&gt;
    name: STRING(32);&lt;br/&gt;
    points: ARRAY&lt;span&gt;[0..31]&lt;/span&gt; OF ST_RECIPE_POINT;&lt;br/&gt;
END_STRUCT&lt;br/&gt;
END_TYPE&lt;/p&gt;
&lt;p&gt;TYPE ST_RECIPE_POINT :&lt;br/&gt;
STRUCT&lt;br/&gt;
    tPreheat: REAL;     (was time_t type)&lt;br/&gt;
    tPostheat: REAL;&lt;br/&gt;
    nPosX: DINT;&lt;br/&gt;
    nPosY: DINT;&lt;/p&gt;
&lt;p&gt;END_STRUCT&lt;br/&gt;
END_TYPE&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>