Hi all,
I just thought to ask the community to see if anyone came up with a solid way to do cross-referencing?
Let's say I have a DP called xyz1.xyz2.xyz3 and I want to find ALL places where it might be used.
The only strategy I came up over years is to:
1. Use either internal WinCC OA search to look for *xyz3 in all panels and scripts. Alternatively, use external text-search tool to look in "panel" and "scripts" folders.
2. Do a full PARA dump into dpl file and text-search there.
The problem with item 1 is if "xyz3" is relatively common text, you get loads of results. But searching for xyz1.xyz2.xyz3 is quite problematic because ofter xyz1 or xyz2 might be formed dynamically with $-parameters and search won't find anything.
Had anyone came up with any better ideas and can share?
Cross-referencing
- RudiKreiner
- Posts:198
- Joined: Mon May 16, 2011 2:10 pm
Re: Cross-referencing
I understand that this might be of interest, sometimes I would like to know that too.
I've been working with WinCC for years now too and can't really offer you any good solution.
I would suspect that the event manager keeps a list of which managers each datapoint is connected to, but I don't not how to access this list.
This list is also of no help if the datapoints are just accessed using dpGet() or dpSet().
Since there are no other replies, it seems like no one has a really clean solution, so I will propose a quick and dirty way.
If you either delete or rename the data point element in para, then run your application, then you should get error messages in the log viewer (dp does not exist ...) from managers that try to access that datapoint.
This approach has the following weaknesses:
- your project has to run through all cases where dpConnect gets called, which probably means opening all panels at least once and depending on your application, also doing everything that needs to be done to call all dpConnect() functions.
- if you use the dpNames() functions then cross referencing is a very dynamic affair. For example if you also have an element named xxz3 besides your xyz3 and you do a dpNames("**.x?z3") then the function will just return less datapoints but you will not get an error.
When writing scripts or other managers, I find it good practice to check if all datapoints that I need really exist during the initialiation, even if I don't need them right away. If I need no dpConnect() or dpGet() or dpSet() in the initialization routine anyway, then I just end my application if dpExists() returns false for any datapoint that I need.
Maybe that would be of some help to you as well.
I've been working with WinCC for years now too and can't really offer you any good solution.
I would suspect that the event manager keeps a list of which managers each datapoint is connected to, but I don't not how to access this list.
This list is also of no help if the datapoints are just accessed using dpGet() or dpSet().
Since there are no other replies, it seems like no one has a really clean solution, so I will propose a quick and dirty way.
If you either delete or rename the data point element in para, then run your application, then you should get error messages in the log viewer (dp does not exist ...) from managers that try to access that datapoint.
This approach has the following weaknesses:
- your project has to run through all cases where dpConnect gets called, which probably means opening all panels at least once and depending on your application, also doing everything that needs to be done to call all dpConnect() functions.
- if you use the dpNames() functions then cross referencing is a very dynamic affair. For example if you also have an element named xxz3 besides your xyz3 and you do a dpNames("**.x?z3") then the function will just return less datapoints but you will not get an error.
When writing scripts or other managers, I find it good practice to check if all datapoints that I need really exist during the initialiation, even if I don't need them right away. If I need no dpConnect() or dpGet() or dpSet() in the initialization routine anyway, then I just end my application if dpExists() returns false for any datapoint that I need.
Maybe that would be of some help to you as well.
- NikolayLevchenko
- Posts:74
- Joined: Wed May 10, 2017 3:34 pm
Re: Cross-referencing
Thanks for some pointers, Rudi. It appears that (as I suspected) there is really no silver bullet and a lot depends on good code style
- leoknipp
- Posts:2928
- Joined: Tue Aug 24, 2010 7:28 pm
Re: Cross-referencing
The _connect attribute contains the information if a dp element is connected at the moment.
It only works if a dpConnect is used. There is no information returned if a dpQueryConnectSingle/dpQueryConnectAll is used.
Best Regards
Leopold Knipp
Senior Support Specialist
It only works if a dpConnect is used. There is no information returned if a dpQueryConnectSingle/dpQueryConnectAll is used.
Best Regards
Leopold Knipp
Senior Support Specialist
- NikolayLevchenko
- Posts:74
- Joined: Wed May 10, 2017 3:34 pm
Re: Cross-referencing
I assume it also won't tell me if there's dpSet or dpGet somewhere that uses this datapoint once a month, right?
- leoknipp
- Posts:2928
- Joined: Tue Aug 24, 2010 7:28 pm
Re: Cross-referencing
Yes, you are right.
You cannot get the information if somewhere in the project a dpSet/dpGet is used for a specific dp element.
Best Regards
Leopold Knipp
Senior Support Specialist
You cannot get the information if somewhere in the project a dpSet/dpGet is used for a specific dp element.
Best Regards
Leopold Knipp
Senior Support Specialist
- NikolayLevchenko
- Posts:74
- Joined: Wed May 10, 2017 3:34 pm
Re: Cross-referencing
That's pretty unfortunate but I suspected as much. Thanks for the confirmation
- RudiKreiner
- Posts:198
- Joined: Mon May 16, 2011 2:10 pm
Re: Cross-referencing
Still the _connect attribute is great for finding out which managers are connected to which datapoints. I didn't know that it existed.
It seems to be well hidden, because it cannot be accessed quickly using
WCCOAascii -get ExampleDP_Arg1.:_connect.._dpids -log +stderr
I get this error message
[warning: cannot handle variable of type 2228224]
but it can be seen with functions as described in the _connect section of the WinCC OA Online Help
For more debugging comfort it would be nice if this information also appeared in the para tool.
Are there any more such "attributes" of datapoint elements that we should know about?
In the Online Help para contents section only the "configs" are listed, but there is nothing there about _connect or any other "attributes"
It seems to be well hidden, because it cannot be accessed quickly using
WCCOAascii -get ExampleDP_Arg1.:_connect.._dpids -log +stderr
I get this error message
[warning: cannot handle variable of type 2228224]
but it can be seen with functions as described in the _connect section of the WinCC OA Online Help
For more debugging comfort it would be nice if this information also appeared in the para tool.
Are there any more such "attributes" of datapoint elements that we should know about?
In the Online Help para contents section only the "configs" are listed, but there is nothing there about _connect or any other "attributes"
- leoknipp
- Posts:2928
- Joined: Tue Aug 24, 2010 7:28 pm
Re: Cross-referencing
It looks like that ASCII manager cannot handle dyn_dyn variables when using the -get option.
The error is related to the datatype and to a specific dp element.
A list of all configs and its attributes can be found in the WinCC OA documentation at Reference tables --> Data point configs.
If a datapoint is renamed in the Para module you have the option to start a cross reference search in panels/scripts for the hardcoded string.
Best Regards
Leopold Knipp
Senior Support Specialist
The error is related to the datatype and to a specific dp element.
A list of all configs and its attributes can be found in the WinCC OA documentation at Reference tables --> Data point configs.
If a datapoint is renamed in the Para module you have the option to start a cross reference search in panels/scripts for the hardcoded string.
Best Regards
Leopold Knipp
Senior Support Specialist
- NikolayLevchenko
- Posts:74
- Joined: Wed May 10, 2017 3:34 pm
Re: Cross-referencing
Leopold Knipp wrote:
I assume this would only find the DP if it used as dpGet(xyz1.xyz2.xyz3) and not if it's used like dpGet(sArea + "." + sSubArea + "." + "xyz3")?If a datapoint is renamed in the Para module you have the option to start a cross reference search in panels/scripts for the hardcoded string.