Server impl - several questions

260 views
Skip to first unread message

Stefa...@yahoo.de

unread,
Nov 15, 2016, 7:45:14 AM11/15/16
to open62541
Hello

I´m pretty new to OPC UA, so I have some questions I did not find out myself so far. I have very Little experience with old opc some years ago.

1) When i create a var node (UA_Server_addVariableNode), I can store in the Attribute the adress of a variabel. Is this pointer given up inside of opc after copying the Initial value or can I update the variable Content later just by modifieng the pointer target outside, without calling UA_Server_writeValue? If it is persistent, how do I Trigger opc to transmit (I suppose no auto-listener is available?)

2) What is the real difference between allocation of node id string and just put in something with local scope? It is copied anyway somewhere right? Why use

UA_NODEID_STRING_ALLOC?


3) A node ID must be unique, so what is the sense? I can use only auto-increments somehow. If I have multiple objects of same type (say, 5 sensors), I can not put in same node ID together with different parent id, right?

Is there an Option to autogenerate an id together with the parentid  (e.g. "threshold" togehter with parent "modul1.transport" would give "modul1.transport.threshold" ? )

What is the purpose of outNewNodeID? Can I put in null and get an autogenerated one ??


4) How can I set the state of a var or object to valid or invalid. E.g an object has 10 vars, 5 are not active or not measured for the Moment, so how can I invalidate them for the Clients?


5) As I aim at a high load System, I want to Keep Network traffic as low as possible. That means i want to update values without being updated in the Clients automatically. So how can I control as SERVER what is updated at what time for the Clients.

As far as I understood, whenever I UA_Server_writeValue, the Content is updated also for the Clients?

So what would be a good concept to :

- set the data but surpess an immediate client update

- after Setting all data of an object Signal the Client that he can read the whole object (all vars, subnodes...)

- thus: transmit all (modified) object data in one rush with least Network load


Thank you

Stefan




Julius Pfrommer

unread,
Nov 16, 2016, 6:02:03 AM11/16/16
to open62541, Stefa...@yahoo.de
Hello Stefan,

welcome in this list! I have little time. But I will try to give you some indication on the mechanisms at play.

 
1) When i create a var node (UA_Server_addVariableNode), I can store in the Attribute the adress of a variabel. Is this pointer given up inside of opc after copying the Initial value or can I update the variable Content later just by modifieng the pointer target outside, without calling UA_Server_writeValue? If it is persistent, how do I Trigger opc to transmit (I suppose no auto-listener is available?)

It is advised that you use the "normal" write service to replace the value attribute. Usually, you cannot access the nodes directly, also not within the server SDK,
You can set variables to use a DataSource callback method for retrieving the value. http://open62541.org/doc/current/server.html#callback-mechanisms

We do have "auto-listener". These are called MonitoredItem and have a sampling interval to look for changes. Notifications are then "pushed" to clients via a subscription.
 
2) What is the real difference between allocation of node id string and just put in something with local scope? It is copied anyway somewhere right? Why use

UA_NODEID_STRING_ALLOC?


UA_NODEID_STRING does not copy the char-array you give it. UA_NODEID_STRING_ALLOC does copy.
The server SDK usually makes a copy internally if required. When a method takes a const UA_NodeId, there is no need for external allocation.
 

3) A node ID must be unique, so what is the sense? I can use only auto-increments somehow. If I have multiple objects of same type (say, 5 sensors), I can not put in same node ID together with different parent id, right?

Is there an Option to autogenerate an id together with the parentid  (e.g. "threshold" togehter with parent "modul1.transport" would give "modul1.transport.threshold" ? )

What is the purpose of outNewNodeID? Can I put in null and get an autogenerated one ??


The documentation says: When passing numeric NodeIds with a numeric identifier 0, the stack evaluates this as “select a randome free NodeId in that namespace”. To find out which NodeId was actually assigned to the new node, you may pass a pointer outNewNodeId, which will (after a successfull node insertion) contain the nodeId of the new node.
http://open62541.org/doc/current/server.html#node-addition-and-deletion
 

4) How can I set the state of a var or object to valid or invalid. E.g an object has 10 vars, 5 are not active or not measured for the Moment, so how can I invalidate them for the Clients?


You mean the variables have a boolean value for valid or invalid?
Every value is wrapped in a DataValue type and comes with a statuscode. Maybe you could use that mechanism.
 

5) As I aim at a high load System, I want to Keep Network traffic as low as possible. That means i want to update values without being updated in the Clients automatically. So how can I control as SERVER what is updated at what time for the Clients.

As far as I understood, whenever I UA_Server_writeValue, the Content is updated also for the Clients?

So what would be a good concept to :

- set the data but surpess an immediate client update

- after Setting all data of an object Signal the Client that he can read the whole object (all vars, subnodes...)

- thus: transmit all (modified) object data in one rush with least Network load


You could use a DataSource callback for the variables. Then you can "switch" all values at the same time in your custom implementation.
Since the Subscriptions have a publication interval, changes occuring at the same time are usually queued up and sent in a single packet.

I hope I could help you out. Do not hesitate to ask if you have more questions.

Best regards,
Julius

Stefa...@yahoo.de

unread,
Nov 17, 2016, 5:58:50 AM11/17/16
to open62541, Stefa...@yahoo.de

Hello Julius

Thank you for getting me started.

Just to clarify: If i write into a variable, it is NOT automatically updated immediatly at Client side , correct or not?

About monitored items: In opc ua part 1 fig. 5 the Monitoring and subscription is in the Server, but all code I see do it in the Client. So it is not possible for the Server to create and offer monitored items (Groups?) , which can be queried by the Client so they have only to subscribe?

I don´t see polling as a good conecpt, generally. I would prefer to notify the Client by an Event ("Result ready") , but I don´t find info how to do. Can you Point me to some examples or doku please?

If i use one datasource callback (still not sure how it is triggered, lets say by a Client poll and I can sync it to my data, that means i update only if all real objects states are updated for a given cylce), is there any other Option to mark all data belonging to a cycle except for the timestamp? E.G. can I assign every value a unique ID, so datasets for one real object can be collected and assigned from different(!) Servers, where one particular real world object was processed at different times?

What would happen if one value has NOT changed, but i set in a datasource callback a new timestamp. Will it be transmitted, so the Client can identify the new timestamp as a Kind of cylce identifier?

Some question about callbacks:
When  I Register a datasource callback and a Value Callback for same node, will they be called both in what order in a read and write condition?

Thank you & Best regards
Stefan

Julius Pfrommer

unread,
Nov 17, 2016, 6:11:56 AM11/17/16
to open62541, Stefa...@yahoo.de
Hey Stefan,


Just to clarify: If i write into a variable, it is NOT automatically updated immediatly at Client side , correct or not?

Only if the client has a MonitoredItem on the value. Otherwise, the client has to send a read request.
 
About monitored items: In opc ua part 1 fig. 5 the Monitoring and subscription is in the Server, but all code I see do it in the Client. So it is not possible for the Server to create and offer monitored items (Groups?) , which can be queried by the Client so they have only to subscribe?

Clients can create a MonitoredItem on any node attribute. For example the value of a variable node.
The server-side code is in /src/server/ua_subscriptions.c and /src/server/ua_services_subscription.c.

I don´t see polling as a good conecpt, generally. I would prefer to notify the Client by an Event ("Result ready") , but I don´t find info how to do. Can you Point me to some examples or doku please?

MonitoredItems can be defined for data changes and for events. Currently, we only support data changes but not events.
MonitoredItems are push-notifications (sent out via Subscriptions), not polling. Checking for data changes however requires a cyclic check for changes (within the server).
 
If i use one datasource callback (still not sure how it is triggered, lets say by a Client poll and I can sync it to my data, that means i update only if all real objects states are updated for a given cylce), is there any other Option to mark all data belonging to a cycle except for the timestamp? E.G. can I assign every value a unique ID, so datasets for one real object can be collected and assigned from different(!) Servers, where one particular real world object was processed at different times?

The datasource is triggered whenever somebody reads the value. That can be a read request from a client *or* an internal read by a MonitoredItem.
 
What would happen if one value has NOT changed, but i set in a datasource callback a new timestamp. Will it be transmitted, so the Client can identify the new timestamp as a Kind of cylce identifier?

MonitoredItems have a trigger. You can set the trigger to take into account both the value and the timestamp.
 
Some question about callbacks:
When  I Register a datasource callback and a Value Callback for same node, will they be called both in what order in a read and write condition?
 
Value callbacks are used when there is no DataSource. They are mutually exclusive.
The idea is to store data within the node, but to notify userland before every read and after every write. So you can react accordingly (e.g. change the value before the read occurs).
See here for the internal definition of UA_VariableNode:
http://open62541.org/doc/current/information_modelling.html#variablenode

Best regards,
Julius

Stefa...@yahoo.de

unread,
Nov 17, 2016, 10:17:35 AM11/17/16
to open62541, Stefa...@yahoo.de

I slowly begin to understand.


I tried to implement a datasource callback according to the example and set up a Monitoring item in uaexpert. But the value and type does not Show up in the DataAccess pane. However, the node attributes can be read.
Is there a known incompatibillity to Uaexpert ? I read some BadServiceUnsupported Errors.

I also got the datasource example compilling in vs2015 (both using the  AMALGAMATION files). The Output says:

[11/17/2016 15:10:52.838] info/server   Client requested a subscription, but those are not enabled in the build. The message will be skipped

[11/17/2016 15:10:52.838] info/network  Message on Connection 372 was not entire ly processed. Arrived at position 28, skip after the announced length to position 96

what must be done to get it working?
Thank you
Stefan

Julius Pfrommer

unread,
Nov 17, 2016, 11:16:56 AM11/17/16
to open62541, Stefa...@yahoo.de
Hey Stefan,

I tried to implement a datasource callback according to the example and set up a Monitoring item in uaexpert. But the value and type does not Show up in the DataAccess pane. However, the node attributes can be read.
Is there a known incompatibillity to Uaexpert ? I read some BadServiceUnsupported Errors.

what must be done to get it working?

Use the current 0.2 branch or the 0.2-rc1 release.

Also, in order to save binary space, subscriptions can be deactivated.
Check how your version was built from the source (see the documentation on how the build process works).

Best regards,
Julius

Stefa...@yahoo.de

unread,
Nov 18, 2016, 4:31:16 AM11/18/16
to open62541, Stefa...@yahoo.de
Hmm I hope this becomes last answer, I cant reply to last posting

Anyway: cmake, I really don´t want to use in the long run. I want to work with a .h, .lib and .dll, shouldn´t be so difficult to provide for win32/64 with full funcionallity.

But ok I tried, and as expected it did not work. The vs2015 projects fail all to compile
File "E:/opc/SrcOpen62541/open62541-0.2/tools/generate_datatypes.py", line 6, in <module>
1>      from collections import OrderedDict

I have Py30 installed since a long time, that works

thx for help - or pls supply full working .h, .cpp thank you
Stefan

Julius Pfrommer

unread,
Nov 18, 2016, 5:11:56 AM11/18/16
to open62541, Stefa...@yahoo.de
We make (and test) VS2015 builds for every commit.
This is from the recent 0.2 branch, that will become the next stable release:

https://ci.appveyor.com/project/Stasik0/open62541/build/1954/artifacts

It contains the .lib, .h, and so on.

Best regards,
Julius

Stefa...@yahoo.de

unread,
Nov 18, 2016, 12:57:09 PM11/18/16
to open62541, Stefa...@yahoo.de

Hallo nochmal


Es läuft, Danke.

noch ein paar grundlegende Fragen wo ich bisher keine Info gefunden habe.

- Was ist das kleinste theoretisch mögliche Sampling und Reporting Intervall in einem Windows System? Die Windows-Zeitscheibe?
- Gibt es Erfahrungswerte wie viele (geänderte) simple type werte (sagen wir int32) in einem einfachen Adressraum mit einer 100mBit Leitung etwa pro Sekunde übertragen werden können? Ist der Flaschenhals eher die Leitung oder das encoden/decoden im Server/Client wenn man mal davon ausgeht dass das Übertragen der Werte in den Adressraum im Server praktisch nur eine einfache Kopierfunktion ist (s. Datasource example) ?

- Ist das Monitoring Sampling asynchron oder synchron? D.h befinde ich mich in dem Thread wo der Server aufgemacht wurde, und ich arbeite NICHT mit Datasource sondern schreibe aktiv in den Wert (Event getrieben in der Applikation), kann das Monitoring da dazwischenfunken wenn der Wert beobachtet wird? Wenn ja, gibt es da einen vorgegebenen Syncmechanismus?

Mit Datasource sollte das Monitoring ja keine SyncProbleme haben da es ja aktiv vom Monitoring ausgelöst wird.
- Muss man immer im Datasource callback den Wert neu kopieren auch wenn er sich nicht geändert hat? Oder kann man auch mit einer Art "notchanged" quittieren um zeit zu sparen? Oder einfach mit OK rausgehen?

- Unterstützt  das Monitoring gelinkte triggered items, d.h. das SubItems wird dann erst reported werden wenn ein gelinkter node getriggert ist, ansonsten werden sie nur gesampelt? (SetTriggering Service)
Das wäre nämlich sehr interessant, ich könnte alle Werte nur sampeln und linken zu einem Masterattrib, wenn ich den dann final umdrehe wenn alles andere gesetzt ist geht alles andere in einem Rutsch raus bestenfalls.

Gruß
Stefan
 
Reply all
Reply to author
Forward
0 new messages