Invoke opcua methodcalls from a client using mqtt|OPC UA Standard|Forum|OPC Foundation

Avatar
Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
Lost password?
sp_Feed sp_PrintTopic sp_TopicIcon
Invoke opcua methodcalls from a client using mqtt
Avatar
Jacky Bek
Member
Members
Forum Posts: 21
Member Since:
12/13/2020
sp_UserOfflineSmall Offline
1
01/07/2021 - 18:28
sp_Permalink sp_Print sp_EditHistory

I like to check with you if this is possible :

  1. Currently i successfully implemented opcua pubsub of a set of variables to a mqtt broker.  I can inspect the data on the broker as it is encoded using json.
  2. Now I want to do the reverse:

2a.  A new opcua client will publish a request to invoke opcua methodcalls via mqtt.

2b.  The opcua server will listen (subscribed) for this request; when it receives the subscribed request it will invoke the corresponding methodcalls and return the result back to the broker by publishing to it;

 Based on the sample codes in open62541.org that implements opcua-mqtt subscriber, it seemed to me that the architecture supported by opcua-mqtt pubsub is as follows:

opcserver1 (publisher) —> mqtt —> opcserver2 (subscriber) <- opcclient 

All data published to the mqtt has to be populated into opcserver2 as nodes.

for methodcalls involved by opcclient, it will read off from opcserver2 without going to opcserver1. Reason is opcserver1 would have published all the metadata and sent to opcserver2.

Please confirm if my understanding is correct.

 

  1. The opcua client in turns subscribe to this results
Avatar
Randy Armstrong
Admin
Forum Posts: 1438
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
2
01/08/2021 - 20:52
sp_Permalink sp_Print

The mapping to variables in the OPC UA server is an optional feature.

A server could do anything it wants with the message including reporting an event containing the dataset.

You could implement a method call with by subscribing to the variables but you could never really when the method is "called" since you could receive updates at slightly different times for each variable or never get an update at all if the current parameters are the same as the previous parameters.

The only reliable to way to implement this is with an event rather than variables.

The same problem exists for returning the response. Writing to multiple variables cannot guarantee that the values will be sent in the same message. You would need a method on opcserver2 to guarantee that the response is sent correctly.

Avatar
Jacky Bek
Member
Members
Forum Posts: 21
Member Since:
12/13/2020
sp_UserOfflineSmall Offline
3
02/17/2021 - 05:31
sp_Permalink sp_Print

Hi Randy

do you mean this:

1. App1 (as a opcua client) makes a methodcall@opcuaserver1 eg shutdown(machine 1)

2. Method@opcuaserver1 generates an event and sends it across the wire via mqtt.

3. Opcclient2 (at the same location of opcuaserver1) subscribes for this event.

4. Opcclient2 processes the event (eg calling a sensor api => machine1::shutdown)

Avatar
Randy Armstrong
Admin
Forum Posts: 1438
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
4
02/17/2021 - 07:38
sp_Permalink sp_Print

Yes that model works with the disconnected nature of MQTT.

A PubSub DataSet could have the semantics of a "method call".

All subscribers would decide if it applies to them.

Those that do react send another PubSub DataSet with the semantics of a "method call result".

All subscribers to "method call result" which get the results.

The WG is developing an extension to PubSub that formalizes methods over pubsub.

Avatar
Jacky Bek
Member
Members
Forum Posts: 21
Member Since:
12/13/2020
sp_UserOfflineSmall Offline
5
03/28/2021 - 21:46
sp_Permalink sp_Print

Hi Randy,

I want to implement the Events subscriptions of OPCUA based on your suggestion above.

Currently in open62541 ccmake options, i configureUA_NAMESPACE = Minimal, UA_FILE_NS01 = OFF.  My OPCUA Server code runs normally.

However, when i configure ccmake options as UA_NAMESPACE = FULL, UA_FILE_NS01 = ON, the same program caused segmentation fault when trying to execute the following statement:

UA_UInt16 namespaceIndex=1;

UA_Server_addVariableNode(uaServer, UA_NODEID_NUMERIC(namespaceIndex, 10001),
r1_airgardroot_Id,
UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY),
UA_QUALIFIEDNAME(namespaceIndex, "Software Version"),
UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE),
vSoftwareVersionAttr, NULL, NULL);

I already perform the following:

a. git submodule_update --init --recursive

b. export open62541_NODESET_DIR = "/home/pi/open62541/deps/ua_nodeset/Schema"

So far, compiling and running under UA_NAMESPACE = MINIMAL has no issues.  But when i want to implement Events subscriptions, open62541 insists that I use UA_NAMESPACE=FULL.

Can i know what is the difference between UA_NAMESPACE = Minimal and UA_NAMESPACE = FULL?

What additional configuration i need to do when UA_NAMESPACE = FULL?

Thanks.

Jacky

Avatar
Randy Armstrong
Admin
Forum Posts: 1438
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
6
03/28/2021 - 22:14
sp_Permalink sp_Print

You will need to post on the open62541 forum for questions about that codebase.

I would assume setting UA_NAMESPACE = FULL includes a large number of additional nodes that are not needed for the basic features. It is possible that less testing has been done with this option.

Forum Timezone: America/Phoenix
Most Users Ever Online: 510
Currently Online: Dennis Lin
Guest(s) 37
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Forum Stats:
Groups: 2
Forums: 10
Topics: 1341
Posts: 4545