Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Using custom types in methods and test it with UaExpert
January 24, 2017
17:15, EET
Avatar
reinhard
Member
Members
Forum Posts: 12
Member Since:
December 6, 2016
sp_UserOfflineSmall Offline

We are using a custom type as InputArgument for a method.
Calling that method programmatically with UaClient perfectly works.

When calling that method with UaExport, the correct DataType (our custom type) is displayed in the DataType column, the Value column shows “Click ‘…’ to display value”. But when we click on the ‘…’ button, the main area of the window popping up is empty instead of showing appropriate formular fields for the attributes of the custom type.

Is this expected to work? Are we doing anything wrong?

Here is the code in the NodeManager:
[..]
final PlainMethod method = new PlainMethod(this,
new NodeId(getNamespaceIndex(), myBrowseName),
myBrowseName, Locale.ENGLISH);
method.setExecutable(true);
method.setUserExecutable(true);

final Argument[] inputs = new Argument[1];
inputs[0] = new Argument();
inputs[0].setName(“MyMethodName”);

inputs[0].setDataType(ourCustomTypeId);
inputs[0].setValueRank(ValueRanks.OneOrMoreDimensions);
inputs[0].setDescription(new LocalizedText(“MyInputArgument”));
inputs[0].setArrayDimensions(new UnsignedInteger[] { new UnsignedInteger(10) });

method.setInputArguments(inputs);

final Argument[] outputs = new Argument[1];
outputs[0] = new Argument();
outputs[0].setName(“MyResult”);
outputs[0].setDataType(myResultTypeId);
outputs[0].setValueRank(ValueRanks.Scalar);
outputs[0].setArrayDimensions(null);

method.setOutputArguments(outputs);

final MethodManagerUaNode methodManager = (MethodManagerUaNode) this.getMethodManager();
methodManager.addCallListener(myCallListener);
parentNode.addComponent(method);
[..]

The referenced data-type (“ourCustomTypeId”) is correctly listed in Types/DataTypes/BaseDataType/Structure.

January 25, 2017
17:32, EET
Avatar
Heikki Tahvanainen
Member
Members
Forum Posts: 402
Member Since:
April 17, 2013
sp_UserOfflineSmall Offline

Hello,

The problem here is that the client application (UaExpert) does not recognize the custom structure value properly. My understanding is that UaExpert should handle the custom structures by reading a datatype dictionary from the server and most likely this datatype recognition should work also when the structure is a method argument. You should contact Unified Automation to find out exact features of UaExpert.

So, it’s possible that the server made with Java SDK doesn’t provide correct values in the type dictionary.

In your own client application made with Java SDK, you are able to access the structure type because you have called UaClient.registerModel method.

Have you created the custom type yourself? If yes, did you use some tool such as UaModeler to do the modeling?

January 26, 2017
10:28, EET
Avatar
reinhard
Member
Members
Forum Posts: 12
Member Since:
December 6, 2016
sp_UserOfflineSmall Offline

Hello Heikki,
thank you for your reply. I will contact Unified Automation as you suggest.

Yes, i created the custom type by myself. Is there a way to add a custom type to the type dictionary programmatically ?

January 26, 2017
10:47, EET
Avatar
Heikki Tahvanainen
Member
Members
Forum Posts: 402
Member Since:
April 17, 2013
sp_UserOfflineSmall Offline

Hello Reinhard,

Just to be clear: this is probably an issue of the Java SDK or your own information model.

What I would like to know about your model is that do you have the typedictionary included in the information model. If you did the modeling with UaModeler, you should have correctly formatted typedictionary. So, that’s why I asked about the tool. You cannot add the type dictionary programmatically, but rather it should be present in the UaNodeSet file representing the information model.

When you connect to the server with UaExpert, do you see the structure types in the type dictionary? The types should be visible when browsing Types/DataTypes/OPC Binary/

Actually, it would be easiest to start solving this if you could send the information model to us for examination. Do you think it’s possible to send the information model to us at uajava-support prosysopc.com mailing list?

January 26, 2017
14:48, EET
Avatar
reinhard
Member
Members
Forum Posts: 12
Member Since:
December 6, 2016
sp_UserOfflineSmall Offline

Hello Heikki,

No, i did not have the type-dictionary included in the information model, as i did only register the generated Java classes via uaServer.registerModel(InformationModel.MODEL).
That is why i asked if the is a way to do that programatically ..

However, i did a short test. I modeled a simple method with with a simple custom type as input argument in UaModeler, exported the xml and generated the classes. I added the information model with getServer().getAddressSpace().loadModel(new File(“…..xml”).toURI());. Now i can see the type in Types/DataTypes/OPC Binary/TypeDictionary.
But the behaviour in UaExpert when calling the method is the same, only an empty window popping up ..

I will send the information-modell to the uajava-support prosysopc.com mailing list.

January 30, 2017
13:22, EET
Avatar
reinhard
Member
Members
Forum Posts: 12
Member Since:
December 6, 2016
sp_UserOfflineSmall Offline

Did you already check if it is an SDK issue?

I suppose it is not an issue of UAExpert, because i checked with the Demo-Server project of the OPCFoundation and UaExpert, custom types are working as expected here.
I do not think it is an issue of the information model either, because it is an really simple model. But maybe I did something wrong? Do you have any working examples with custom types working with UaExpert (or any other client reyling on the type-dictionary)?

If it is an SDK issue, do you plan to fix it?

Thank you for yor answer.

April 19, 2017
12:08, EEST
Avatar
Heikki Tahvanainen
Member
Members
Forum Posts: 402
Member Since:
April 17, 2013
sp_UserOfflineSmall Offline

As a future reference: this issue is now fixed in the release version 2.3.0.

The problem was that when reading TypeDictionaries, the UaExpert does a Read with IndexRange 0:16777215 by default. In the response, Java SDK returned the correct value but set the operation level StatusCode to Bad_IndexRangeNoData. This made the UaExpert skip the value, which was why the TypeDictionary was not recognized. The server side handling of IndexRange was changed in the Java SDK.

May 10, 2017
19:43, EEST
Avatar
Xavier
Member
Members
Forum Posts: 43
Member Since:
March 26, 2014
sp_UserOfflineSmall Offline

Hello,

I’m interrested by this but was not able to make it work even with the 2.3.0 SDK.

I created a model with UaModeler with several custom Structure datatypes. I export it as XML with UaModeler, use the Java CodeGenerator.
When I start the server I use the method registerAndLoadModel(CodegenModel, URI).

Now with UaExpert I still have empty popup when trying to read or write my structures. In Types / DataTypes / OPC Binary I have a variable with the name I configured in UaModeler with a value like this :
3c6f70633a5479706544696374696f6e61727920786d6c6e733a7873693d22687474703a2f2f7777772e77332e6f72672f323030312f584d4c536368656d612d696e7374616e63652220786d6c6e733a746e733d22687474703a2f2f7777772e636c656d657373792e66722f5379636c6f6e1bdb99

I have nothing under this node (only NamespaceUri). In the Opc.Ua node just above I can see a lot of subnodes describing each Datatype. Should I see a subnode for each of my Structure ?

When I export my UaModeler project as XML I have also a BSD and XSD file. They seem to describe my structures but I don’t think I can “give” them to the registerAndLoadModel method. In the XML file itself I can see the definition of my Structure with a “hasEncoding” reference to a “Default Binary”.

Am I missing something?

May 12, 2017
10:34, EEST
Avatar
Xavier
Member
Members
Forum Posts: 43
Member Since:
March 26, 2014
sp_UserOfflineSmall Offline

Ok sorry it seems its coming from my UaModeler project. If I create a new datatype it works, but my old ones have no Types / DataTypes / OPC Binary nodes. I think that’s because I created them with an old version of UaModeler.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
11 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Heikki Tahvanainen: 402

hbrackel: 144

rocket science: 88

pramanj: 86

Francesco Zambon: 83

Ibrahim: 78

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

Member Stats:

Guest Posters: 0

Members: 737

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1524

Posts: 6450

Newest Members:

fannielima, kristiewinkle8, rust, christamcdowall, redaahern07571, nigelbdhmp, travistimmons, AnnelCib, dalenegettinger, howardkennerley

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1026, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0

Administrators: admin: 1