CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Sun Aug 18, 2019 6:03 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 4 posts ] 
Author Message
 Post subject: order of initialization
PostPosted: Wed Jun 19, 2019 4:06 pm 
Offline

Joined: Fri Mar 10, 2017 4:45 am
Posts: 43
I'm trying to put together a list of when variables and function blocks are initialized on bootup, or after a download. I haven't been able to find a single document that outlines everything, but I've been able to figure some of it out from different sources. So far I have the following:

Global Variables (undefined order unless {attribute 'global_init_slot' := '<slot>'} is specified)
(constants first, then other variables)
GVL
PersistentVars (variables not always initialized - not exactly sure how Codesys decides)
GVLs from libraries (not sure in what order)

POUs (in order defined by TASK call, priority, and interval?) - list of tasks appears to be in alphabetical order
VAR_STAT
FB_Init
VAR
constants
other variables
functions marked "call_after_init"


NOT SURE:
visualizations
initialization of properties in function block definition (ex. FB_Instance: TEST_FB:= (Property:= 12345);
parameter lists in libraries

I wonder if we can put together a single list, or if anyone knows of a document that does this already?

Tim


Top
   
PostPosted: Mon Jun 24, 2019 7:32 am 
Offline
Frequent User
Frequent User

Joined: Thu Aug 30, 2018 8:40 am
Posts: 106
Hello Tim,

the visualization uses a range of init slots for different parts of the code.
Anything specifc you are looking for?

Opened an issue to better documente the initialization

Best regards,
Marcel


Top
   
PostPosted: Wed Jun 26, 2019 3:58 pm 
Offline

Joined: Fri Mar 10, 2017 4:45 am
Posts: 43
At this point I'm just trying to understand how it works. Aside from some kind of trial and error method, I'm not sure how to figure out the order of everything, and I'm not even sure that my list is correct. Initialization of properties in function block definitions is what cause me to look into it further. For example, if I define a function block like this: FB_Instance: TEST_FB:= (Property:= SomeVariable); where the property is a reference or pointer to a variable in a different program, I need to ensure that that program is initialized first, otherwise the reference is invalid. It becomes very difficult to troubleshoot, because the download simply fails and the PLC crashes without giving any feedback on where the problem is.


Top
   
PostPosted: Mon Jul 01, 2019 6:28 am 
Offline
Frequent User
Frequent User

Joined: Thu Aug 30, 2018 8:40 am
Posts: 106
Hello Tim,

In short the visualization initializes all the variables/references after the normal initialization.
Then each visu cycle these variables/references get updated again.

Best regards,
Marcel


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 4 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited