The server seems to transmit only data changes

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

Moderator: uasdkcpp

Post Reply
FKiesel
Jr. Member
Jr. Member
Posts: 2
Joined: 06 Mar 2012, 15:22

The server seems to transmit only data changes

Post by FKiesel »

On the server side I'm setting the values of a variable with Method
UaVariable::setValue (because the data is delivered through an event based
mechanism).

The client uses a subscription with reasonable
PublishingInterval/SamplingInterval/QueueSize.

Everything works fine, but when the data delivered by the event based
mechanism contains duplicated values the client does not receive the
duplicated values.

E.g.: Calling setValue() on the server side with values 1, 2, 3, 3, 4, 5
results in receiving values 1, 2, 3, 4, 5 on the client side.

Is it possible to receive the second 3 in the example above on the client side?

Regards,

FKiesel

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

Re:The server seems to transmit only data changes

Post by Support Team »

Hello,

The described behaviour is the standard OPC / OPC UA behaviour. If an OPC client is monitoring data changes of variables, only changed values are sent to the client.

But OPC UA provides a solution for your requirement. In CreateMonitoredItems, a client can specify a different filter than the default data change filter. The filter in the monitoring parameters can be used to set either a dead band filter or to change the behaviour for sending data changes not only on value changes but also on timestamp changes.

The default trigger in the DataChangeFilter is set to STATUS_VALUE. You can change the trigger to STATUS_VALUE_TIMESTAMP. If either StatusCode, value or the SourceTimestamp changes the server reports a notification with this setting.

The SourceTimestamp must be set and updated in the server when calling setValue() on UaVariable.

See next post for sample code to create the DataChangeFilter with the C++ client SDK.

Best Regards,
Unified Automation Support Team
Best regards
Unified Automation Support Team

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

Re:The server seems to transmit only data changes

Post by Support Team »

Code: Select all

// Initialize monitored items to create
for ( i=0; i<count; i++ )
{
    tempNode.copyTo(&monitoredItemCreateRequests[i].ItemToMonitor.NodeId);
    monitoredItemCreateRequests[i].ItemToMonitor.AttributeId = OpcUa_Attributes_Value;
    monitoredItemCreateRequests[i].MonitoringMode = OpcUa_MonitoringMode_Reporting;
    monitoredItemCreateRequests[i].RequestedParameters.ClientHandle = i+1;
    monitoredItemCreateRequests[i].RequestedParameters.SamplingInterval = 1000;
    monitoredItemCreateRequests[i].RequestedParameters.QueueSize = 1;
    monitoredItemCreateRequests[i].RequestedParameters.DiscardOldest = OpcUa_True;

    // Create and set data change filter
    OpcUa_DataChangeFilter* pDataChangeFilter = NULL;
    OpcUa_EncodeableObject_CreateExtension(
        &OpcUa_DataChangeFilter_EncodeableType,
        &monitoredItemCreateRequests[i].RequestedParameters.Filter,
        (OpcUa_Void**)&pDataChangeFilter);
    if ( pDataChangeFilter ) 
    {
        pDataChangeFilter->DeadbandType = OpcUa_DeadbandType_None;
        pDataChangeFilter->Trigger      = OpcUa_DataChangeTrigger_StatusValueTimestamp;
    }
}
// Call createMonitoredItems
Best regards
Unified Automation Support Team

FKiesel
Jr. Member
Jr. Member
Posts: 2
Joined: 06 Mar 2012, 15:22

Re:The server seems to transmit only data changes

Post by FKiesel »

Hello,

that's exactly the solution I've searched for. It works.
Thank you very much.

Unfortunately I haven't found it in the documentation. Is it part of the OPC UA stack? Where can I find documentation about such features?

Best regards,

FKiesel

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

Re:The server seems to transmit only data changes

Post by Support Team »

Hello,

It is difficult do document all features of OPC UA. The feature you requested is just one setting in the OPC UA defined service parameters. They are defined in OPC UA Part 4.

The OPC UA specifications are now available as public download. You just need to create an account on the OPC Foundation web site.

https://www.opcfoundation.org/
-> Downloads
-> Specifications

There are two versions, the released one available for non members and the next release candidate only available for OPC Foundation members.

Best Regards
Unified Automation Support Team
Best regards
Unified Automation Support Team

Post Reply