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 Tue Feb 18, 2020 7:20 am

All times are UTC+01:00




Post new topic  Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Fri Aug 05, 2016 5:33 pm 
Offline
User avatar

Joined: Tue Jun 28, 2016 2:45 pm
Posts: 65
Dear community,

i'm using VAR_GLOBAL CONSTANTS in an Library to define upper and lowerbound of an array. All VAR_GLOBAL CONSTANTS, have an predefined init value.

Now i want to predefine the init value from my Project, where i'm using the Library. I tried to override the VAR_GLOBAL CONSTANTS in the Library from the project, but it doesn't work.

Is there any solution or work arround?

Thank you in advance!


Top
   
PostPosted: Fri Aug 05, 2016 8:30 pm 
Offline

Joined: Sat Apr 16, 2016 5:23 pm
Posts: 64
You may find this thread of some use
viewtopic.php?f=11&t=6971

_________________
Rick


Top
   
PostPosted: Fri Aug 05, 2016 10:06 pm 
Offline
Frequent User
Frequent User

Joined: Fri Sep 02, 2011 8:02 pm
Posts: 312
For libraries, add a library "Parameter list" object (screenshot below). This will allow you to define a constant that can be changed when the library is used in a project. The online help should give more information - topic parameter list and then sub-subject GVL.

Attachment:
lib-props.png


You do not have the required permissions to view the files attached to this post.

_________________
Scott Cunningham
KEB America, Inc.
www.kebblog.com
www.kebamerica.com


Top
   
PostPosted: Sat Aug 06, 2016 8:59 am 
Offline
User avatar

Joined: Tue Jun 28, 2016 2:45 pm
Posts: 65
Hello scott,

thank you for the fast reply.

I added an Parameter list "Param_XY" in the library:
Code:
VAR_GLOBAL CONSTANT
   // Array Param
   gc_UpBound : INT := 10;
   gc_Length     : INT := 100;
   
   // Timeout Param
   gc_TimeOut    :TIME := T#10S;
END_VAR


FB in Library with Array

Code:
 
VAR_INPUT
   arrTest : ARRAY [0..gc_UpBound] OF STRING(gc_Length);
END_VAR


PRG in Project:
Code:
VAR
   arrXXX: ARRAY [0..gc_UpBound] OF STRING(gc_Length);
END_VAR


In the PRG i fill the arrXXX (within the range) and then i call the FB in the library and use the declared arrXXX as Input. This works all fine.

But I can't change the CONSTANT Vars in the Paramter List "Param_XY".


I tried to add an GVL in the Project:

Code:
VAR_GLOBAL CONSTANT
   // Array Param
   {attribute 'const_replaced'}
   gc_UpBound : INT := 20;
   {attribute 'const_replaced'}
   gc_Length     : INT := 200;
   
   // Timeout Param
   {attribute 'const_replaced'}
   gc_TimeOut    :TIME := T#50S;
END_VAR


but it doesnt override the paramters in the library and it allways use the parameters from the lib.

I can't find anything in the help file about that topic expect the attribute 'const_replaced'.

What I'm doing wrong?

Thank you in advance.

_________________
Building & Process Automation with HVAC Library for CODESYS© - www.hvac-automation.com


Top
   
PostPosted: Sun Aug 07, 2016 2:22 pm 
Offline
Frequent User
Frequent User

Joined: Fri Sep 02, 2011 8:02 pm
Posts: 312
Everything was good until your last step. Don't define the variable again in your main project. Instead, from your project, open the library object (like you are going to add a library to your project) and then highlight your library and look at the available objects - you will see you "parameters" and you can insert the value you want.

_________________
Scott Cunningham
KEB America, Inc.
www.kebblog.com
www.kebamerica.com


Top
   
PostPosted: Mon Aug 08, 2016 10:25 am 
Offline
User avatar

Joined: Tue Jun 28, 2016 2:45 pm
Posts: 65
Scott - thank you so much for your support!

This was exactly the right thing what I was looking for.

Have a nice day!

cheers

_________________
Building & Process Automation with HVAC Library for CODESYS© - www.hvac-automation.com


Top
   
PostPosted: Fri Jan 03, 2020 12:05 am 
Offline

Joined: Thu May 12, 2011 7:27 pm
Posts: 4
scott_cunningham wrote:
For libraries, add a library "Parameter list" object (screenshot below). This will allow you to define a constant that can be changed when the library is used in a project. The online help should give more information - topic parameter list and then sub-subject GVL.

lib-props.png


Hi guys,
I'm doing a library where i need to be able to change the library constants from the project where the library is used. I simply can not find anywhere where it is possible to add this "Parameter list". Also I find no reference in the help to such a parameter list? Any surgestions on how to achieve changing library constants from project (In 2.3 you simply declared a variable with the same name in the project)

It seems that "Parameter list" is removed in 3.5.15.x as well as support for libraries pre. version 3 (2.3 libraries)


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

All times are UTC+01:00


Who is online

Users browsing this forum: Andreas Kehrer 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