Page 1 of 1
Add new tags at runtime
Posted: Tue Apr 09, 2013 9:56 pm
by abrunsden
Hi
I'm experimenting with a T7B Panel, is it possible to edit existing or add new tags at runtime?
Thanks
Re: Add new tags at runtime
Posted: Wed Apr 10, 2013 8:05 am
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.
Re: Add new tags at runtime
Posted: Wed Apr 10, 2013 1:27 pm
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";
Re: Add new tags at runtime
Posted: Wed Apr 10, 2013 1:48 pm
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.
Re: Add new tags at runtime
Posted: Wed Apr 10, 2013 1:57 pm
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
.)
Re: Add new tags at runtime
Posted: Wed Apr 10, 2013 2:32 pm
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 (28.81 KiB) Viewed 13014 times
- Snap 2013-04-10 at 14.31.17.jpg (41.45 KiB) Viewed 13014 times
Re: Add new tags at runtime
Posted: Wed Apr 10, 2013 4:26 pm
by abrunsden
Thanks Mark,
I think we can utilize the "change controller" object in association with our own code to handle the requirement.
Cheers