11:14, EEST
May 24, 2018
Hi,
There is a issue I’m facing at the moment. The description is as follows…
“MethodSet” is an optional Node from the TopologyElementType. In my “SubType”d DeviceType node I have overridden this “MethodSet” object and added my methods as mandatory nodes because these methods are expected for my devicetypes.
While creating the device, in the nodebuilderconfiguration, I added the optional components namely the “ParameterSet”(which is also overridden to hold the respective device parameters) and “MethodSet”.
After the device is created, I do see all the expected parameters under the ParameterSet and the methods under MethodSet, except that the nodeIds of the methods under the MethodSet are the same as that of the methods under the type definition. I prefer not to add these method nodes manually and hence have made them mandatory nodes under the overridden MethodSet.
Is this the expected behavior or am I doing something wrong? Because the same procedure for ParameterSet works and that is confusing me.
this is how I’m creating the device..
NodeBuilderConfiguration nodeBuilderConfiguration = new NodeBuilderConfiguration();
nodeBuilderConfiguration.addOptional(UaQualifiedName.from(DiIds.TopologyElementType_ParameterSet.getNamespaceUri(), TopologyElementType.PARAMETER_SET).toQualifiedName(getNamespaceTable()));
nodeBuilderConfiguration.addOptional(UaQualifiedName.from(DiIds.TopologyElementType_MethodSet.getNamespaceUri(), TopologyElementType.METHOD_SET).toQualifiedName(getNamespaceTable()));
UaQualifiedName.from(DiIds.TopologyElementType_ParameterSet.getNamespaceUri(), TopologyElementType.PARAMETER_SET)));
UaQualifiedName.from(DiIds.TopologyElementType_MethodSet.getNamespaceUri(), TopologyElementType.METHOD_SET)));
setNodeBuilderConfiguration(nodeBuilderConfiguration);
ProfibusInterfaceBoxDeviceTypeNode pibDeviceTypeNode = createInstance(ProfibusInterfaceBoxDeviceTypeNode.class, “PBI ” + pib.getDeviceName());
Thanks,
Ashwin
13:32, EEST
April 17, 2013
Hello,
Based on the above description, the actual issue seems to be that “the nodeIds of the methods under the MethodSet are the same as that of the methods under the type definition”. This is a feature called instantiation strategy and different strategies can be selected when creating the instances.
To create the methods as their own instances, you’ll need to use the PlainMethodInstantiationStrategy. In short, what you need to do is to call nodeBuilderConfiguration.setInstantiationStrategy and provide correct parameters.
Please see the following example which shows how to modify the instantiation logic of the methods under a FileType. Without the call to nodeBuilderConfiguration.setInstantiationStrategy, the “Close” method nodeid will be the standard i=11583. When this instantiation strategy is set, the nodeid will show up as “ns=index;s=MyFile/0:Close”. This is totally unrelated to your use case, but this example is very easy to reproduce as the FileType is a standard type. Hopefully this example answers your question, if not please ask for more details.
NodeBuilderConfiguration nodeBuilderConfiguration = new NodeBuilderConfiguration();
nodeBuilderConfiguration.setInstantiationStrategy(Identifiers.FileType_Close, new PlainMethodInstantiationStrategy());
this.setNodeBuilderConfiguration(nodeBuilderConfiguration);
FileTypeNodeBase myFile = (FileTypeNodeBase) this.createInstance(Identifiers.FileType, "MyFile");
objectsFolder.addComponent(myFile);
10:24, EEST
May 24, 2018
13:55, EEST
April 17, 2013
13:45, EEST
April 3, 2012
Hi,
I have 4 additional remarks.
1. In your subtype you should be able to override the Optional ‘ParameterSet’ and ‘MethodSet’ nodes as Mandatory in the model to avoid the need to mark them.
2. In your original post for your question, “Is this the expected behavior or am I doing something wrong?”, it should be noted that it is allowed by the specification for instances to refer Method nodes that are defined in the types and therefore the behaviour is expected, since the SDK by default makes all Method nodes as “shared” (as there is usually no reason for them to have own nodes, unless you would need for some reason to have different Attribute value in some instances).
3. In SDK 3.x there is another way in addition, you can use the TypeDefinitionBasedNodeBuilderConfiguration.builder(MethodInstantiationLogic.UNIQUE) to create new method nodes instead of the SHARED default, see MyNodeManager.createAlarmNode method in the SampleConsoleServer
4. As additional note, since it is the DI model, remember that (DI spec 1.01 section 5.2): “Since Methods are components of the MethodSet Object, Clients have to specify the NodeId of the MethodSet instance in the objectId argument of the Call Service.”
And yes the documentation for this feature unfortunately is quite lacking and we hope to improve that in the future. I can answer to specific questions here in the forum if needed.
Most Users Ever Online: 1919
Currently Online:
14 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: 730
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1529
Posts: 6471
Newest Members:
rondawolinski7, Marypof5711, roycedelargie91, kourtneyquisenbe, ellis87832073466, zkxwilliemae, gabriellabachus, Deakin, KTP25Zof, Wojciech KubalaModerators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1032, Jimmy Ni: 26, Matti Siponen: 349, Lusetti: 0
Administrators: admin: 1