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
Custom Node Manager VS Information Model
January 13, 2022
10:55, EET
Avatar
Francesco Zambon
Member
Members
Forum Posts: 83
Member Since:
December 20, 2021
sp_UserOfflineSmall Offline

Good morning,

Please i need clarification regarding the use of custom node managers:

Server Tutorial
Version 4.0.0
5.2.3. Custom Node Manager

Instead of using the NodeManagerUaNode, you can declare a custom node manager that is derived from
NodeManager. You will need to implement all node handling yourself, but you don’t need to instantiate a
UaNode object in the memory for every node. This is especially useful if your OPC UA server is just
wrapping an existing data store and you do not want to replicate all the data in the memory of the
server. Also, if you need to provide access to a large amount of nodes (actual number depending on the
amount of memory available), this may be the only option for you.
See MyBigNodeManager for a complete example of such a node manager.

Could I use custom node only when object nodes are created “manually”?
Example:

Server Tutorial
Version 4.0.0
5.2.2. Adding Nodes

// Folder for my objects
final NodeId myObjectsFolderId = new NodeId(ns, "MyObjectsFolder");
myObjectsFolder = createInstance(FolderTypeNode.class, "MyObjects", myObjectsFolderId);
this.addNodeAndReference(objectsFolder, myObjectsFolder, Identifiers.Organizes);
// My Device Type
// The preferred way to create types is to use Information Models, but this example shows how
// you can do that also with your own code
final NodeId myDeviceTypeId = new NodeId(ns, "MyDeviceType");
UaObjectType myDeviceType = new UaObjectTypeNode(this, myDeviceTypeId,"MyDeviceType", Locale
.ENGLISH);
this.addNodeAndReference(baseObjectType, myDeviceType, Identifiers.HasSubtype);
// My Device
final NodeId myDeviceId = new NodeId(ns, "MyDevice");
myDevice = new UaObjectNode(this, myDeviceId, "MyDevice", Locale.ENGLISH);
myDevice.setTypeDefinition(myDeviceType);
myObjectsFolder.addReference(myDevice, Identifiers.HasComponent, false);
// My Level Type
final NodeId myLevelTypeId = new NodeId(ns, "MyLevelType");
UaType myLevelType = this.addType(myLevelTypeId, "MyLevelType", baseDataVariableType);
// My Level Measurement
final NodeId myLevelId = new NodeId(ns, "MyLevel");
UaType doubleType = getServer().getNodeManagerRoot().getType(Identifiers.Double);
myLevel = new CacheVariable(this, myLevelId, "MyLevel", LocalizedText.NO_LOCALE);
myLevel.setDataType(doubleType);
myLevel.setTypeDefinition(myLevelType);
myDevice.addComponent(myLevel);

I would like to use the classes generated by the codegen tool, but they need the corresponding information model to work.

Thank you,
Francesco

January 13, 2022
11:50, EET
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1026
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

I would need maybe a bit of clarification of ‘what’ you intended to do (or ‘why’), not ‘how’.

But in short the Codegen creates more specialized UaNode implementation and thus need the NodeManager to be at least NodeManagerUaNode (subtypes of that are fine).

So typically it is either the UaNode-style (with or without Codegen) or the MyBigNodeManager-style (in which you do not have UaNodes at all typically in the data model). It is not possible to combine the two.

To a degree you can do stuff like “myNodeManager.getIoManager().addListeners(new MyIoManagerListener());” in the SampleConsoleServer. For example in our ModbusServer we have done so that Writes to nodes are directly (via the listener) pushed to the Modbus devices, which are then polled for the data (and pushed directly to the UaNodes). It doesn’t help with the memory, but does “externalize” the data (the listener on Write intentionally uses the option that the data is not pushed to the node, so that we have a single source of truth; the modbus device).

Preferably in some distant future we could have a way to combine the 2 ways. We have prototyped some in the past, but in short it is hard to do.

January 13, 2022
12:34, EET
Avatar
Francesco Zambon
Member
Members
Forum Posts: 83
Member Since:
December 20, 2021
sp_UserOfflineSmall Offline

Hello Bjarne,

Thanks for your help.

Right now I’m trying to understand all the features made available by the library.

My final goal is to integrate an OPC-UA server into an application that already exposes machine data through a custom binary protocol over TCP:
– current value of the variables
– events / alarms
– historical data

I probably have to do something similar to what you did: I already have a data source that I need to expose using new protocols (OPC UA-UA server client, OPC-UA pubsub).

I like UaNode-style more because it gives me the possibility to work with strongly typed objects

As a first step I would like to define a custom information that represents the current server structure.

Subsequently I would like to associate the objects of my server to the OPC-UA nodes defined by the companion information models (E.g. EUROMAP 83, EUROMAP 82.1, …).

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
9 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: 735

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1523

Posts: 6449

Newest Members:

rust, christamcdowall, redaahern07571, nigelbdhmp, travistimmons, AnnelCib, dalenegettinger, howardkennerley, Thomassnism, biancacraft16

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

Administrators: admin: 1