7:38, EEST
June 26, 2012
9:21, EEST
December 21, 2011
It means that you are losing some data changes, most probably due to a communication break.
If you wish to ensure that all your items are up to date, you will need to perform a read call to verify the value of each item. The next version (to be released in the following weeks) will add a method Subscription.readAll() which will help you with this. It will look like the following:
throws ServiceException {
MonitoredItemBase[] itemList = getItems();
ReadValueId[] nodesToRead = new ReadValueId[itemList.length];
for (int i = 0; i < itemList.length; i++)
if (itemList[i] instanceof MonitoredDataItem) {
MonitoredDataItem m = (MonitoredDataItem) itemList[i];
nodesToRead[i] = new ReadValueId(m.getNodeId(),
m.getAttributeId(), m.getIndexRange(),
m.getDataEncoding());
}
return client.read(maxAge, timestamps, nodesToRead).getResults();
}
You will need to synchronize this to your monitored change handling and verify the timestamps whether you are receiving the latest value for the read or for the monitored item.
Another option would be to recreate the subscription in the server by calling UaClient.removeSubscription() & addSubscription().
Unfortunately, the OPC UA specification does not define a better way to refresh the subscription in this kind of situation. They suggest that you try to prevent these situations instead, by reserving long enough resend buffers in the server. See the blog post http://www.prosysopc.com/blog/2012/01/26/jouni/opc-ua-sessions-subscriptions-and-timeouts/ more about the parameters. You may also need to modify the MaxRetransmissionQueueSize (or such) in the server parameters so that the server will keep enough packets to resend in this kind of situation.
7:49, EEST
June 26, 2012
Thank you for your help
Jouni Aro said
It means that you are losing some data changes, most probably due to a communication break.
If you wish to ensure that all your items are up to date, you will need to perform a read call to verify the value of each item. The next version (to be released in the following weeks) will add a method Subscription.readAll() which will help you with this. It will look like the following:
public DataValue[] readAll(Double maxAge, TimestampsToReturn timestamps)
throws ServiceException {
MonitoredItemBase[] itemList = getItems();
ReadValueId[] nodesToRead = new ReadValueId[itemList.length];
for (int i = 0; i < itemList.length; i++)
if (itemList[i] instanceof MonitoredDataItem) {
MonitoredDataItem m = (MonitoredDataItem) itemList[i];
nodesToRead[i] = new ReadValueId(m.getNodeId(),
m.getAttributeId(), m.getIndexRange(),
m.getDataEncoding());
}
return client.read(maxAge, timestamps, nodesToRead).getResults();
}You will need to synchronize this to your monitored change handling and verify the timestamps whether you are receiving the latest value for the read or for the monitored item.
Another option would be to recreate the subscription in the server by calling UaClient.removeSubscription() & addSubscription().
Unfortunately, the OPC UA specification does not define a better way to refresh the subscription in this kind of situation. They suggest that you try to prevent these situations instead, by reserving long enough resend buffers in the server. See the blog post http://www.prosysopc.com/blog/2012/01/26/jouni/opc-ua-sessions-subscriptions-and-timeouts/ more about the parameters. You may also need to modify the MaxRetransmissionQueueSize (or such) in the server parameters so that the server will keep enough packets to resend in this kind of situation.
Most Users Ever Online: 1919
Currently Online:
24 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 144
rocket science: 88
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 735
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1523
Posts: 6449
Newest Members:
rust, christamcdowall, redaahern07571, nigelbdhmp, travistimmons, AnnelCib, dalenegettinger, howardkennerley, Thomassnism, biancacraft16Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1026, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0
Administrators: admin: 1