Clarification on OPC UA Read for Registered Nodes

Questions regarding the use of the C++ SDK for Server or Client development or integration into customer products ...

Moderator: uasdkcpp

Post Reply
Antoni Raj
Hero Member
Hero Member
Posts: 33
Joined: 25 Oct 2013, 05:26

Clarification on OPC UA Read for Registered Nodes

Post by Antoni Raj »

Hi Support Team,
We are using Unified Automation UA SDK C++ Server Professional 1.6.3 in our OPC UA server. We use visual studio 2015 for our development.
We are following sample server “server_com_da_migration” for our OPC server development.
We have our own NodeManager implementation.

Below is code snippet in the executeRead() method. We want to perform OPV UA read for registered nodes using UaExpert performance view.

void OPCUAIOManagerJob::executeRead()
{

UaDataValue dataValue;
------
-----
----

dataValue.setServerTimestamp(UaDateTime::now());
m_pTransactionContext->m_pCallback->finishRead(
m_pTransactionContext->m_hTransaction,
m_pTransactionContext->m_arrCallbackHandles,
dataValue,
OpcUa_True,
OpcUa_True);

VariantClear(&pValues);

-----
-----
}

Question:
1. We understand that the executeMonitorStop() has the RemoveItems() call

hr = m_availableGroups[groupIndex].m_pGroup->RemoveItems(
count,
pServerHandles,
&pErrors);

I think we need do the same for read and write also. But the executeRead() from “server_com_da_migration” sample server does not call RemoveItems() method.
How this is handled in SDK?


Please help us on this.Thanks in advance for the help.

Thanks
Antoni

Antoni Raj
Hero Member
Hero Member
Posts: 33
Joined: 25 Oct 2013, 05:26

Re: Clarification on OPC UA Read for Registered Nodes

Post by Antoni Raj »

Hi Team,
Do we have any update on this?


Thanks
Antoni

User avatar
Support Team
Hero Member
Hero Member
Posts: 2521
Joined: 18 Mar 2011, 15:09

Re: Clarification on OPC UA Read for Registered Nodes

Post by Support Team »

Hello Antoni,

yes you are right - for each call to AddItems there should be a corresponding call to RemoveItems. For monitoring this concept is clear.
When StartMonitoring is called --> add the item.
When StopMonitoring is called --> remove the item.

For Read and write there are 2 possible strategies:
1. Whenever Read / Write is called Add the item, execute the operation, remove the item. This is easy to implement but the overhead to add and remove will have some impact on the performance.
2. Add the Item on first access and keep it. Just execute Read / Write with the item that is already there.

The example server_com_da_migration is supposed to use approach 2 - however I must confess that the logic to reuse and delete the item is not complete here.
Best regards
Unified Automation Support Team

Antoni Raj
Hero Member
Hero Member
Posts: 33
Joined: 25 Oct 2013, 05:26

Re: Clarification on OPC UA Read and Write for Registered Nodes

Post by Antoni Raj »

Dear Support Team
Thank you for the reply .

Yes. Agreed . we will use option 2 to implement the OPC UA Read/write as per your suggestion . Thank you.





Thanks
Antoni

Post Reply