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
createInstance won't create variables of UaObject
December 11, 2017
12:29, EET
Avatar
Max Braun
New Member
Members
Forum Posts: 1
Member Since:
December 11, 2017
sp_UserOfflineSmall Offline

Hello,

in my UaServer application I create a UaTypeNode as follows:

int ns = nodeManager.getNamespaceIndex();
NodeId ordersTypeId = new NodeId(ns, 1000);
UaObjectTypeNode ordersType = new UaObjectTypeNode(nodeManager, ordersTypeId, “OrderType”, Locale.ENGLISH);

and add variables like this

NodeId priorityId = new NodeId(ns, 108);
CacheVariable priority = new CacheVariable(nodeManager, priorityId, “Priority”, Locale.ENGLISH);
priority.setDataType(int32Type);
priority.setTypeDefinition(dataItemType);
priority.updateValue(new Variant(0));
ordersType.addComponent(priority);

there are more but they are all created and added in the same way. Then I add the created type as a subtype to baseObjectType

nodeManager.addNodeAndReference(baseObjectType, ordersType, Identifiers.HasSubtype);

My problem is, when I create a UaInstance with createInstance() like this

UaInstance order = nodeManager.createInstance(ordersType.getNodeId(), “Name”, nodeId);

it creates a UaNode with “HasTypeDefinition” set to “OrderType” but it does not create the variables as components which are defined in ordersType. So I get an “empty” UaNode object. Can someone please explain what I’m doing wrong?

Kind regards,
Max

December 11, 2017
14:02, EET
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 983
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

Since your code does not show them, I would expect the components are missing a HasModellingRule reference. Nodes that do not have a HasModellingRule are not considered part of the type that would be instantiated (they are just extra nodes that are part only of the type node itself, e.g. a “static” Method).

I recommend that you add a Mandatory modellingrule to your components. There is also Optional, but those has to be configured for instantiation and are by default not part of the instances.

node.addReference(Identifiers.ModellingRule_Mandatory, Identifiers.HasModellingRule, false);

– Bjarne

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online:
31 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

rocket science: 77

Ibrahim: 76

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

TimK: 41

Member Stats:

Guest Posters: 0

Members: 681

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1467

Posts: 6261

Newest Members:

graciela2073, sagarchau, elviralangwell4, Donnavek, Eddiefauth, DonaldPooma, fidelduke938316, Jan-Pfizer, DavidROunc, fen.pang@woodside.com

Moderators: Jouni Aro: 1010, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 983, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 26, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 321, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1