overwrite subscription / monitored item settings

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

Moderator: uasdknet

Post Reply
martenbyebye
Hero Member
Hero Member
Posts: 21
Joined: 03 Mar 2017, 16:08

overwrite subscription / monitored item settings

Post by martenbyebye »

Hi,

I would like to prevent the client from setting up too high sampling and publishing rates. Where in the framework should the server define the actual subscription settings / monitored item settings?

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

Re: overwrite subscription / monitored item settings

Post by Support Team »

Hello martenbyebye,

you can set the limits for the publishing interval in the server configuration.
see here:
http://documentation.unified-automation ... chema.html

The place where you can set the minimum SamplingInterval depends on which level of the SDK you add your implementation (SDK layer or Toolkit layer). See here for overview:
http://documentation.unified-automation ... ction.html

1) On Toolkit level (your NodeManager is a subclass of BaseNodeManager):
override StartDataMonitoring and set the SamplingInterval. e.g.

Code: Select all

    if (settings.RequestedParameters.SamplingInterval < 2000)
    {
        settings.RequestedParameters.SamplingInterval = 2000;
    }
2) On SDK Level (your implementation inherits / implements IIOManager):
You call StartDataMonitoringCompleteEventHandler in your implementatio and set the RevidedSamplingInterval there.
Best regards
Unified Automation Support Team

martenbyebye
Hero Member
Hero Member
Posts: 21
Joined: 03 Mar 2017, 16:08

Re: overwrite subscription / monitored item settings

Post by martenbyebye »

Thank you Support Team,

I am now successfully changing the properties, i.e. using UaExpert I can see the revised settings :) . But my test code seems to be wrong.

Where is the revised SamplingInterval?

Code: Select all

var monitoredItems = new List<MonitoredItem>
{
    new DataMonitoredItem(nodeId) { SamplingInterval = desiredSamplingInterval }
};

var statusCodes = this.subscription.CreateMonitoredItems(
    monitoredItems,
    new RequestSettings { OperationTimeout = 10000, MaxOperationsPerRequest = ushort.MaxValue, });

foreach (var monitoredItem in this.subscription.MonitoredItems)
{
    monitoredItem.SamplingInterval.ShouldBe(correctRevisedSamplingInterval); // This fails. 
}

pkrawal
Full Member
Full Member
Posts: 5
Joined: 24 Sep 2019, 07:43

Re: overwrite subscription / monitored item settings

Post by pkrawal »

Can you please give an example for overriding StartDataMonitoring() method in example GettingStarted.Lesson3 ?

Post Reply