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
UA & Classic SDK: A couple of questions
August 24, 2022
18:29, EEST
Avatar
Guido Niewerth
Member
Members
Forum Posts: 13
Member Since:
August 23, 2022
sp_UserOfflineSmall Offline

Hi,

I´m currently evaluating the OPC UA & Classic SDK for Delphi v7.5.0 Build 802 using the Embarcadero RAD Studio 10.1 Berlin.
I managed to run a sample OPC UA server, but I have a couple of questions:

– is the “Opc.Ua.NodeSet2.xml” file mandatory? The application throws an exception when I prevent it from loading that file. As far as I understood its content defines the Namespace 0.

– I cannot create a folder in my own namespace. When I call the “CreateFolder” method on my node manager it throws an exception (“NodeFactory: No type definition registered for type: TUaFolderType.”. This is how I call the method:
TUaServer* srv = new TUaServer();
// lots of initialisation
TUaNodeManagerUaNode* mgr = new TUaNodeManagerUaNode();
mgr->Server = srv;
mgr->Namespace = TUaNamespace::Get( “http://mycompany.com” );
srv->AddNodeManager( mgr );

TUaFolderType* folder = mgr->CreateFolder( “Folder1” ); << throws the exception

– how do I search for a node by Name? I need to create a device node by calling "CreateObject()" on the node manager, but if I call the function again with the same name the application throws an exception because there is already a device with that name. I searched the HTML and CodeInsight help for a method that allows me to find a node by its name, or even a list of nodes so I can find it myself, but there seems to be no such functionality, at least none to search by name.

– how do I find the namespace details for a given namespace id? When looking at the variables provided by my OPC UA server with an OPC UA client, the node Ids read "ns=2,s=Variable 1". How do I get the namespace information for namespace with index 2?

Kind regards,
Guido

August 25, 2022
18:24, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Hi, thanks for giving Prosys Sentrol a try and thanks for asking for clarifications.

– Opc.Ua.NodeSet2.xml is definitely mandatory for the server – that’s where it initialises the compulsory contents of the standard namespace that every server must support.

– Your problem with CreateFolder is strange. Can you start the UaCppSampleServer in the SDK samples? It is using the same method and works fine for me.

– Unfortunately there is no way to search nodes by their Name so far. But in fact, the Name doesn’t need to be unique. By default, ‘CreateObject’ actually uses the Name also for the NodeId – and the NodeId must be unique. And you can search for nodes by the NodeId using ‘NodeManager.getNode()’. You can also provide a custom NodeId for ‘CreateObject’ to ensure yourself that they are unique.

– You can use UaServer.NamespaceTable.Namespaces[2] on the server side – or UaClient.NamespaceTable.Namespaces[2] on the client side. Note that we try to avoid using the index within the SDK, since the index is relative and therefore it is better to check the equality using the Namespace object or it’s NamespaceURI instead. But, maybe that’s what you were already after.

And in fact, if you have a TUaNodeId, you will find the Namespace directly from it without going back to the NamespaceTable.

BTW: Make sure you read the OPC UA tutorials for the SDK. They also try to explain these concepts.

August 25, 2022
18:41, EEST
Avatar
Guido Niewerth
Member
Members
Forum Posts: 13
Member Since:
August 23, 2022
sp_UserOfflineSmall Offline

Thanks for your answer, Jouni.

I played around a bit and some things are now clear to me.
I wrapped my own class around TUaServer and added some comfort functions which manage namespaces, variables, devices and folders. Instead of using the built-in functions I implemented my own and almost all my issues are solved.

PS:
The reason for CreateFolder bug was I called it before initializing the server and the default namespace. I make the CreateFolder call after initializing the TUaServer object it works fine.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
18 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: 727

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1525

Posts: 6456

Newest Members:

ernestoportus31, martin123, rickie5305, shaylamaggard4, rickyjuarez140, jonathonmcintyre, fannielima, kristiewinkle8, rust, christamcdowall

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

Administrators: admin: 1