Problem with placing a monitored item with indexrange

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

Moderator: uasdkcpp

Post Reply
toni.kalajainen
Sr. Member
Sr. Member
Posts: 11
Joined: 02 Jan 2017, 12:34

Problem with placing a monitored item with indexrange

Post by toni.kalajainen »

Hi,

Let's say there is an array variable with 10 elements. I can place a monitored item to indexrange "7:9". But if monitor is placed on indices that the variable does not have at the time, for example "10:12", StatusCode = BadIndexRangeNoData is returned.

However it possible to place monitored item first to existing indices then shrink the array.

Shouldn't it be possible to place a monitor on indices that do not exist at the time of creation? What do you think?

-Toni

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

Re: Problem with placing a monitored item with indexrange

Post by Support Team »

Hello Toni,

the specification states:
"If the ArrayDimensions have a fixed length that cannot change and no data exists
within the range of indexes specified, Bad_IndexRangeNoData is returned in
CreateMonitoredItems. Otherwise if the length of the array is dynamic, the Server shall
return this status in a Publish response for the MonitoredItem if no data exists within the
range."

Since the SDK has no knowledge if the length of the array is dynamic the SDK always accepts the CreateMonitoredItemsRequest and sends that error in the PublishResponse.
Best regards
Unified Automation Support Team

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

Re: Problem with placing a monitored item with indexrange

Post by Support Team »

Hello Toni,

Your post implies that CreateMonitoredItems fails if the current value is outside the requested range (BadIndexRangeNoData).

But we verified this and in our tests, the CreateMonitoredItems succeeds and the first DataChange sends BadIndexRangeNoData for the item.
If the value of the variable is changed to a larger array, the monitored item delivers the value inside the range.

Can you confirm this behavior or does CreateMonitoredItems fails in your test?
It it fails, please provide more details on what kind of implementation you are using to provide the variable value.
Best regards
Unified Automation Support Team

Post Reply