Add new tags at runtime

A forum devoted to the discussion of all topics having to do with scripting and other advanced programming using iX Developer.
Post Reply
abrunsden
Posts: 2
Joined: Tue Apr 09, 2013 9:48 pm

Add new tags at runtime

Post by abrunsden »

Hi
I'm experimenting with a T7B Panel, is it possible to edit existing or add new tags at runtime?

Thanks

mark.monroe
Posts: 824
Joined: Tue Mar 13, 2012 9:53 am

Re: Add new tags at runtime

Post by mark.monroe »

No, you can not add new tags easily at runtime, nor do not know why you would want to. A tag is a variable with a global scope in iX Developer. You can use C# variables for things like for loops.
Best Regards,
Mark Monroe

Beijer Electronics, Inc. | Applications Engineer

Jwphilippi
Posts: 13
Joined: Mon Mar 11, 2013 8:48 am

Re: Add new tags at runtime

Post by Jwphilippi »

What about if you were to edit a Tag's Item ID in real time to result in a different location in your controller for a value?

(i.e. I have a controller A that has point a: 1,1,1 and I one to dynamically switch to point b: 1,2,1 to get the value from point b instead of point a).

SFP_DATA1.GlobalDataSubItems[0].DataItems[0].ItemID = "98," + Globals.Tags.sys_SFP_Selection.Value.String + ",1";

mark.monroe
Posts: 824
Joined: Tue Mar 13, 2012 9:53 am

Re: Add new tags at runtime

Post by mark.monroe »

That would over complicate the project. Why not just have multiple tags and have them all mapped to different memory addresses? The issue with dynamically changing tag<->PLC register mappings is that it is not easy to know which tag is mapped to which register during runtime.

You can use screen aliasing to switch which tags a particular screen is using at any one time.

If you have lots of tags and are worried about polling your PLC to much I could see wanting to change the tag<->PLC register mapping. Since iX dev only polls tags that are set to Always Active or on a screen, PLC data transfer is normally not an issue.
Best Regards,
Mark Monroe

Beijer Electronics, Inc. | Applications Engineer

Jwphilippi
Posts: 13
Joined: Mon Mar 11, 2013 8:48 am

Re: Add new tags at runtime

Post by Jwphilippi »

Well primarily the main purpose was to create a set of tags for a particular set of data points that could be dynamically readdressed. This would allow for generating something that could be more universal across multiple controllers of varying type where point addresses are structured the same but are located in different aspects of a controller hierarchy. (Yup I know, clear as mud ;) .)

mark.monroe
Posts: 824
Joined: Tue Mar 13, 2012 9:53 am

Re: Add new tags at runtime

Post by mark.monroe »

To do that, I would create a project with multiple controllers. You can then assign a memory address to each controller in the Tag screen. The active control's mapping will be used. Then by changing the active controller, you will change the mappings.
Snap 2013-04-10 at 14.31.01.jpg
Snap 2013-04-10 at 14.31.01.jpg (28.81 KiB) Viewed 13009 times
Snap 2013-04-10 at 14.31.17.jpg
Snap 2013-04-10 at 14.31.17.jpg (41.45 KiB) Viewed 13009 times
Best Regards,
Mark Monroe

Beijer Electronics, Inc. | Applications Engineer

abrunsden
Posts: 2
Joined: Tue Apr 09, 2013 9:48 pm

Re: Add new tags at runtime

Post by abrunsden »

Thanks Mark,
I think we can utilize the "change controller" object in association with our own code to handle the requirement.

Cheers

Post Reply