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
How to add new properties into existing custom structure datatype on opcua server?
January 7, 2020
7:30, EEST
Avatar
c70015@gmail.com
Member
Members
Forum Posts: 6
Member Since:
January 7, 2020
sp_UserOfflineSmall Offline

Is it possible to add new properties into custom structure datatype dynamically after starting opcua server?
I have tried many way but it doesn’t work.

January 8, 2020
10:11, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 545
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

Preferably that should never be done in my opinion even if the specification technically would allow it. Clients need to be specifically aware of that and even so could possibly cause data loss of any values that are of the “previous version” of the Structure type.

IF you have Structure types that would change their fields all the time and you only need to read these from a client, consider using an array of KeyValuePair Structures as the field of the Structure (or directly as the value) as “extensionfields”.

The binary encoding for the Structures (ExtensionObject) does only include the NodeId for the Encoding Id of the DataType, there is no practical version information. After that it is each field sequentially in their binary forms (as defined by the specification part 6). It is important to note that it is just the values of the fields in order, the ExtensionObject does not contain any other metadata than just the NodeId.

Clients will read either DataTypeDictionaries or in OPC UA version 1.04 possibly DataTypeDefinitions in order to obtain information how to decode that binary blob (keyed on the encoding nodeid). Once they are aware of that they can decode the ExtensionObject to a Structure.

If any modifications would be made for the type, clients would need to detect that and re-read the metadata. However at this point any old values cannot no longer be decoded (unless the clients will keep track of all old versions of the metadata and try them all until the ExtensionObject decoded and also have not missed any update as only the latest metadata information is available from the server).

For custom Structure types that are codegenerated and used via the generated classes in the SDK no modifications cannot be done (outside of runtime class bytecode manipulations).

In the SDK for non-codegenerated Structures the metadata is held in StructureSpecification objects and class DynamicStructure is used to represent any custom Structure. DynamicStructures are created from a StructureSpecification thus fields cannot be added/removed/modified to it as that would break the binary encoding. However you can create a new StructureSpecification that has the same encodings ids and thus could replace an existing type. It should be noted that this scenario is not tested in practice (and probably not many clients can handle that anyway..).

Additionally the StructureSpecification must be added to the UaServer.getEncoderContext().addStructureSpecification(…). in order to update the DataTypeDefinition Attribute value for the type. After this is done you need to ensure no DynamicStructure that are made with the old version is available to a client in any way (e.g. Value Attribute).

Additionally if the type was originally loaded from a NodeSet2 file and modified 2 things should be noted. 1) Any other place where that NodeSet was used now has the “wrong” encoding thus this shouldn’t be done in these cases 2) If the NodeSet contains a DataTypeDictionary (if it was made with a proper tool e.g. UaModeler it most likely contains one), you will need to edit that as well, since that is how pre UA 1.04 clients will try to read the metadata. How to do so is outside the scope of normal support, but the dictionary nodes are in Root/DataTypes/OPC Binary/* and each is a serialized XML documend as per OPC UA Specification 1.04 Part 5 Annex E “OPC Binary Type Description System”.

July 29, 2020
10:30, EEST
Avatar
anhy123
New Member
Members
Forum Posts: 2
Member Since:
April 7, 2020
sp_UserOfflineSmall Offline

Hi ,
I am trying to write value on server but I am getting following exception.

Exception in thread “main” com.prosysopc.ua.StatusException: Bad_NotWritable (0x803B0000) “The access level does not allow writing to the Node.” StatusCode=Bad_NotWritable (0x803B0000) “The access level does not allow writing to the Node.”

Getting exception on following line –

client.writeValue(Identifiers.Server_ServerStatus_State,25);

As i can see error is related to access level then how can i change that access level and where on server side or at client side..?

July 29, 2020
11:01, EEST
Avatar
Matti Siponen
Moderator
Members

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

Hello,

First of all, please add new topics for your questions instead of posting them to an unreleted existing topic.

In Prosys OPC UA SDK for Java, the AccessLevel of a Node can be configured on the code of the Server application. This is done by calling setAccessLevel and setUserAccessLevel methods of UaVariable instances. See ComplianceNodeManager class of SampleConsoleServer for an example on how to use these methods.

Some Server applications might allow you to configure AccessLevels in the application’s UI, but naturally this depends on the application. The AccessLevels of Nodes on a Server’s AddressSpace shouldn’t be configurable from Client applications.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 267

Currently Online:
8 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 103

pramanj: 86

ibrahim: 70

kapsl: 57

gjevremovic: 49

TimK: 41

Fransua33: 39

fred: 38

Rainer Versteeg: 32

Thomas Reuther: 31

Member Stats:

Guest Posters: 0

Members: 1105

Moderators: 14

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1009

Posts: 4268

Newest Members:

user1290, gregp, mariohetheringto, normagalindo47, aurelia27u, isobel41d356980, michaeldegli, gqbdolores, kez1399, jaclynmcvay358

Moderators: Jouni Aro: 851, Otso Palonen: 32, Tuomas Hiltunen: 5, janimakela: 0, Pyry: 1, Terho: 0, Petri: 0, Bjarne Boström: 545, Heikki Tahvanainen: 402, Jukka Asikainen: 1, Teppo Uimonen: 20, Markus Johansson: 19, Matti Siponen: 53, Lusetti: 0

Administrators: admin: 0