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
Question regarding the Device Information models bundled with the Java SDK
January 31, 2021
22:25, EET
Avatar
AnttiMatik
Member
Members
Forum Posts: 9
Member Since:
January 31, 2021
sp_UserOfflineSmall Offline

Greetings, I am a student at the Aalto University of Technology working on my master’s thesis using the OPC UA Java SDK. Part of my work involves defining the address space models for a variety of devices. Everywhere i’ve read references that the DI-model should be bundled in with the SDK however I am unable to import it. Attempting to import both it and the PLC-model rom “com.prosysopc.ua.types.di.server.DiServerInformationModel” and “com.prosysopc.ua.types.plc.server.PlcServerInformationModel” results in errors. There’re also no references to either in the javadoc.

I feel as if I missed something incredibly obvious.

February 1, 2021
8:48, EET
Avatar
Matti Siponen
Moderator
Members

Moderators
Forum Posts: 319
Member Since:
February 11, 2020
sp_UserOfflineSmall Offline

Hello,

Can you be more specific about the errors? Have you used Code Generator to generate code from those models and included that code to your project’s build path?

February 1, 2021
10:00, EET
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 982
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

Sorry, you probably saw something historical (or something we might have not updated..). Also note that this post got kind long (my usually do), but the info hopefully is useful both for you and anyone else reading this.

I assuming here that you are using SDK version 4 (preferably the latest, but anyway, this applies to whole 4.x).

We used to generate them to be directly part of the SDK, but in SDK version 4.0.0-> (https://downloads.prosysopc.com/opcua/Prosys_OPC_UA_SDK_for_Java_4_Release_Notes.html#version-4-0-0) we no longer do that. If you need the DI/ADI/PLCOpen models you must generate them with the bundled Codegen. See the codegen/commandline/configexamples/di_adi_plcopen.xml in the distribution zip. We ship with _some_ versions of the models, but please check e.g. https://github.com/OPCFoundation/UA-Nodeset for potentially more up-to-date-ones (in practice they tend to evolve faster than we can keep track of).

This change allowed SDK users to only include the generated code if needed while also allowing easier updates of the DI model (if I recall, a version 1.02 of it was on the way when we were making the change). In addition, SDK didn’t do any manual changes to the generated output, thus users generating them would give the same result (with the overhead of needing to run the codegen). But also opened options to implement e.g. methods or anything needed to potentially utilize the models better (plus any updates to the model itself might have rendered our pre-generated classes useless if the generation might have been needed anyway on an updated model).

Thus SDK only generates the base/standard model (+GDS model, though that is mainly for client usage since we do not have any out-of-the-box-support for the server side yet), which also does mean updating that one must in practice be made by us (which was sort of problematic with OPC UA 1.04 Amendments updating it a bit faster than we were used to). Hopefully some day we can make also the base model to be updateable by SDK users, but that might be somewhat complicated if even doable (in a practical way that is).

P.S.
Also I guess I should mention that nowadays we are quite good in loading the models even without codegen, there are few edge cases where it wont work or the end result is not 100% perfect, e.g. if you have a Value tag defining a Value Attribute of a node and the value (as XML encoded; Binary would work; long story) contains a custom Structure whose field is a custom Structure it will not load, unless you have codegenerated the model defining said Structure. So depending how you need to manipulate/instantiate the loaded nodes/types, you might be good to go by just loading the NodeSet2 XMLs of the models.

P.S.2.
The number of models out there has skyrocketed, this is our (most-up-to-date) current knowledge what works: https://www.prosysopc.com/blog/nodeset-file-importing/ (the NodeSet2 XML schema is not enough to validate an OPC UA rules conforming model by itself, some models may have errors, some might need a bit of configuration due to name clashes and SDK current design). Though it should be noted that as long as the model itself loads, everything codegen is “addon” on top of that and everything the codegen uses can also be done with the base UaNode API (and StructureSpecification/DynamicStructure/EnumerationSpecification/DynamicEnumeration for custom Structure/Enumerations).

February 1, 2021
19:07, EET
Avatar
AnttiMatik
Member
Members
Forum Posts: 9
Member Since:
January 31, 2021
sp_UserOfflineSmall Offline

Ah, that would most likely be the cause. I was looking at a post from 2018 or so if I recall correctly. I’ll look into the CodeGen. Thank you for your swift reply and assistance.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online:
22 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

rocket science: 75

ibrahim: 75

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

fred: 41

Member Stats:

Guest Posters: 0

Members: 709

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1465

Posts: 6252

Newest Members:

christi10l, ahamad1, Flores Frederick, ellenmoss, harriettscherer, shanonhumphreys, KupimotoblokfuB, tamhollander5, paulinafcf, bridgette18l

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

Administrators: admin: 1