Changing _address config from a script

Find and share HowTos to various installations / configurations!
5 posts • Page 1 of 1
tgdannemiller
Posts:23
Joined: Thu Apr 21, 2016 3:29 pm

Changing _address config from a script

Post by tgdannemiller »

I have a script to change the io address of a DPE between one of two different brands of PLCs. A standard OPC client is used to access one of the PLCs, and an OPCUA client is used to access the other. Thus the script can change the io address config from “OPCCLIENT” to “OPCUA”, or vice-versa. The script changes between them by deleting the existing _distrib/_address configs and then writing new _distrib/_address configs of the other type. This works, except for one problem, which I am unable to solve.

If a DPE is configured for a standard OPCCLIENT driver, and my script is used to change it to OPCUA, the _distrib and _address configs will both show the correct values for an OPCUA driver. However, if I right-click in PARA on the DPE so as to edit the config parameters, PARA shows that the peripheral config is still an OPCCLIENT type. Vice-versa is true as well.

I’m not sure if it is relevant, but the DPE is within a DP for which the DP type has a master DP. The script not only changes the _distrib and _address configs of the DPE of the actual DP being changed, but also does the same for the same DPE of the master DP.

It seems that my script must be missing some additional operation(s) required to indicate that the DPE _address config has changed, but I can find no information about it in the help or on this forum. I will probably start looking through the PARA scripts to see what PARA does when changing io address drivers, but I’m hoping someone will know how to do it and save me [perhaps considerable] time by posting a response with that information.

fmulder
Posts:330
Joined: Wed Feb 03, 2010 9:46 am

Re: Changing _address config from a script

Post by fmulder »

My guess would be that the para panel is doing some tricks to speed up performance by caching some information.

1) Close the para panel and reopen. Is it now ok ? Then there must be some variables in the scopelib of the para panel
2) Close the Gedi completely and re-open. Is it now ok ? Then there must be some global variables in a script library

I found similar problems some time ago in the alarm screen and found that the panel uses dpGetCache() instead of dpGet(). You might try to clear this cache. Look at the source for dpGetCache() and look at the global variable that they use for the cache. dpGetCache() is a nce technique to speed up your panels but you have to know when to clear the cache

What you could do to find out is the following:

2) Open the para and select the right dp element
2) Enable the debug flag '-dbg 29' for your gedi
3) Now manualy delete your adres config and look at the script code that scrolls by. You'll see how the para panel does it ! (you might see a dpGetCache() scrolling by !)

tgdannemiller
Posts:23
Joined: Thu Apr 21, 2016 3:29 pm

Re: Changing _address config from a script

Post by tgdannemiller »

I tried closing and reopening PARA, then GEDI, then the whole project but the problem didn't change. I will enable the debug trace on PARA and see what it is doing as you suggest.

fmulder
Posts:330
Joined: Wed Feb 03, 2010 9:46 am

Re: Changing _address config from a script

Post by fmulder »

Please look at the internal datapoint type _DynamicDatapoints. This is how the para knows what configs were assigned to the master. I'd guess that that is where your problem lies.

1) You have change the configs on your instances
2) But your master datapoint stil refers to the 'wrong' config type (according to the _DynamicDatapoints)

tgdannemiller
Posts:23
Joined: Thu Apr 21, 2016 3:29 pm

Re: Changing _address config from a script

Post by tgdannemiller »

I just wanted to post a follow-up: Thank you for the suggestion, the problem was indeed with the associated internal DynamicDatapoints DP. It must be updated whenever a master data point _address config is added, deleted or the driver type is changed.

5 posts • Page 1 of 1