11:19, EET
December 20, 2016
Hi together,
I have following problem:
I created a information model with UaModeler. This means types and instances. Then i created classes with the codegenerator.
On the server i registered the model and I think the second line instantiates the objects:
server.registerModel(informationmodel.server.InformationModel.MODEL);
server.getAddressSpace().loadModel(getClass().getClassLoader().getResource(“lbr.xml”).toURI());
This works! When I access the server with UaExpert, everyhthing is there. Now I want to access the nodes and change their values on the server.
In the sampleserver there is only the way, that just the types are codegenerated and everyhting is instantiated by code. But this makes modeling the instances at UaModeler senseless, when I have to reinstantiate it again.
How can I access those, already instantiated nodes on the server? I can’t find a tutorial for that?!
Thanks a lot!
14:08, EET
April 17, 2013
Hello Manuel,
Thank you for the question. You should access the instance with server.getAddressSpace().getNode and provide the NodeId of the instance as a parameter. I’ll provide an example here how to access and update the value of an example node.
myNode.setValue(1.0);
The “DoubleAnalogItem” node can be accessed in the SampleConsoleServer in Objects -> ComplianceNodes -> AnalogItems -> DoubleAnalogItem.
Please note that this method of fetching nodes is not related to code generated instances especially. The same method can be used to access all the UaNode objects in the server address space. It seems that this is indeed not explained in the server tutorial. Client tutorial chapter “15. Using Node Objects” explains how to access the node objects in the client application which is mostly valid also in the server side.
Just for information: in the future SDK releases there will also be a more convenient version of this same getNode method which will cast the result to given class.
14:38, EET
December 20, 2016
Thanks a lot for your reply! And it worked this way! Also i got a following problem:
The xml I exported from the UaModeler is attached, when i now try to access. lbr.getAxisNode() I get a class Cast exception in the Code generated class. And i completely doesn’t understand why. The UaModeler consistency check says, that everything is ok…
return (AxisNode) getComponent(browseName);
Ok. actually i don’t get, how i can attach a file or insert a code block?
Most Users Ever Online: 1919
Currently Online:
68 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, howardkennerleyModerators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1026, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0
Administrators: admin: 1