Methods, Programs, Services|OPC UA Implementation: Stacks, Tools, and Samples|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
Methods, Programs, Services
Avatar
Aydin Homay
Member
Members
Forum Posts: 22
Member Since:
04/22/2021
sp_UserOfflineSmall Offline
1
06/16/2021 - 07:18
sp_Permalink sp_Print

Hello,

Can anyone explain in a bit more clear way the differences between Service, Method, and Program in OPC UA? Also where to find sample implementation of them? I am aware of the Git source I am asking a bit more specific address than just the entire source code. 

 

Regards,

  Aydin

Avatar
Randy Armstrong
Admin
Forum Posts: 1438
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
2
06/16/2021 - 09:52
sp_Permalink sp_Print

https://reference.opcfoundatio.....Part1/3.2/

3.21 Method

callable software function that is a component of an Object

3.35 Program

executable Object that, when invoked, immediately returns a response to indicate that execution has started, and then returns intermediate and final results through Subscriptions identified by the Client during invocation

3.39 Service

Client-callable operation in a Server

Note 1 to entry: Services are defined in OPC 10000-4. A Service is similar to a method call in a programming language or an operation in a Web services WSDL contract.

Avatar
Aydin Homay
Member
Members
Forum Posts: 22
Member Since:
04/22/2021
sp_UserOfflineSmall Offline
3
06/16/2021 - 14:08
sp_Permalink sp_Print

Hi Randy, thanks for your reply, however, I could read this in the specification as well 😉

I asked these questions here with the hope that I will get a bit more explanation on them by an example. Maybe it is very obvious for you but for someone who just started utilizing the OPC UA specification is a bit confusing. Would it be possible to shed a bit more light with an example for each of them and explain where to use what?

Avatar
Randy Armstrong
Admin
Forum Posts: 1438
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
4
06/16/2021 - 14:21
sp_Permalink sp_Print

How about an analogy to C# or C++.

A "Service" is a base feature of such a "fopen".

A "Method" is function associated with a class.

A "Program" is a class designed execute a state machine. Methods can used to control program execution.

Avatar
Aydin Homay
Member
Members
Forum Posts: 22
Member Since:
04/22/2021
sp_UserOfflineSmall Offline
5
06/16/2021 - 14:36
sp_Permalink sp_Print

Okay now it is a bit more clear, now the question is how to wire a Client to Service, Method, or Program? There must be somehow a mechanism to allow a Client to call a Method in an OPC UA object, the same goes for Service and Program as well. 

Let me tell you my understanding with an example so you can correct me if I misunderstood somewhere: 

Scenario: I need to let my Client invoke a method on the server-side when the temperature exceeds the setpoint.

  1. I use a DataSetMetaData to define the structure of my DataSet that will represent a Node (temperature) OPC UA Publisher Address Space
  2. My defined DataSet will have a timestamp and a float variable to store temperature 
  3. When the value of temperature changed the Publisher will notify the Subscriber and the Subscriber needs to compare the new value with SetPoint and if it is higher than the SetPoint will need to invoke a method that is in the DataSet which is representing the temperature node in the address space. 

Now the question is how to define the method in the DataSet and how to wire it to the Client? The next question would be what if the Client wants to trigger a program to be executed? How this C# Class will be executed? 

Avatar
Randy Armstrong
Admin
Forum Posts: 1438
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
6
06/16/2021 - 15:15
sp_Permalink sp_Print

DataSets and DataSetMetaData are features of PubSub.

PubSub only supports data and event monitoring.

Methods require that the Call service be invoked via Client-Server.

If your client cannot connect using Client-Server you will need to set of reciprocate subscriptions.

i.e. the Publisher subscribes to DataSet. When it receives an update it executes a command based on the contents of the message.

The command would be described by a DataSetMetaData provided by the Subscriber.

Avatar
Aydin Homay
Member
Members
Forum Posts: 22
Member Since:
04/22/2021
sp_UserOfflineSmall Offline
7
06/17/2021 - 01:15
sp_Permalink sp_Print

What I couldn`t understand is this part "If your client cannot connect using Client-Server you will need to set of reciprocate subscriptions." what reciprocate subscriptions means? How to set it of? 

Okay, if invoking Methods requires Client-Server communication model, how about Programs? Does Programs also requires Client-Server communication model or can be done in PubSub as well? 

Avatar
Randy Armstrong
Admin
Forum Posts: 1438
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
8
06/17/2021 - 04:59
sp_Permalink sp_Print

Sorry for the English errors.

If your client cannot connect using Client-Server you will need to set of reciprocal subscriptions.

i.e. both sides are Publishers and Subscribers.

Programs defines an information model which is only visible with Client-Server, however, a Program produces events for state changes which can be published.

The methods used to trigger state changes in a Program require Client Server, however, you could devise a mechanism specific to your application that maps a Method call only to a DataSet.

Avatar
Aydin Homay
Member
Members
Forum Posts: 22
Member Since:
04/22/2021
sp_UserOfflineSmall Offline
9
06/17/2021 - 05:56
sp_Permalink sp_Print sp_EditHistory

1- How to set of reciprocal subscriptions? 

2- So you mean if I use the PubSub communication model neither I can invoke methods nor use of Programs. Right? 

Avatar
Randy Armstrong
Admin
Forum Posts: 1438
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
10
06/17/2021 - 08:51
sp_Permalink sp_Print

1. It just means 2 applications which are both publisher and subscriber and are configured to send messages to each other.

2. No. The Program model has Variables and produces Events. You can have a DataSet that reports values of the Variables or the Events. What you can't do is browse the Program model or call Methods directly. Those features require Client-Server.

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