Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
OPC Ua History Data
February 1, 2018
16:10, EET
Avatar
AlGor
Member
Members
Forum Posts: 4
Member Since:
February 1, 2018
sp_UserOfflineSmall Offline

Hello,
Could you please help me with the following issue I have:
I am trying to get the historycal data from an ASNEG OPC UA server on an android device. I am not completely sure how to do it correctly, because I am not able to do it successfully.
I have tried the following
try {
node = new NodeId(0, 60057);
long start = 1517302800000L;
long end = 1517306400000L;

DataValue[] result = client.historyReadRaw(node, DateTime.fromMillis(start), DateTime.fromMillis(end), UnsignedInteger.MAX_VALUE, true, null, TimestampsToReturn.Source);

String res = result.toString();

} catch (Exception e) {
errorString = e.toString();
}

The exception that I get is org.opcfoundation.ua.builtintypes.ExtenstionObject@b5b0f224

If i do it with
client.historyReadRaw(node, DateTime.MIN_VALUE, DateTime.MAX_VALUE,UnsignedInteger.MAX_VALUE, true, null, TimestampsToReturn.Source);
I recieve similar Exception.

When i try to use the Prosys Android OPC UA Client App, and set the Time Period (for which i want to recieve the historical data) from a given date to the current time, the OPC UA server crashes too. I guess the issue is in the server. The only case when I am able to recieve the data from the server is with the Prosys app, when I set starting date and ending date + time for which I want to recieve the historical data.

Thank you very much
Al.

February 1, 2018
17:30, EET
Avatar
Heikki Tahvanainen
Moderator
Members

Moderators
Forum Posts: 402
Member Since:
April 17, 2013
sp_UserOfflineSmall Offline

Hello,

The printing “org.opcfoundation.ua.builtintypes.ExtensionObject” means that the client received an unknown structure from the server. So, it seems like the client is trying to access structure values that it doesn’t know how to decode.

Main question now is: what is the datatype of these values?

Also, when you read the history successfully with Prosys Android Client, are you reading the exactly same node? It’s interesting if the Android Client knows how to decode the values but your own client made with the same SDK doesn’t.

P.s. The NodeId definition new NodeId(0, 60057) looks strange as the namespace index 0 is the standardised OPC UA namespace and there should not be a node with NodeId 60057 in it.

P.p.s The “result” variable should always be DataValue[] and printing out result.toString() shows something like [Lorg.opcfoundation.ua.builtintypes.DataValue;@5d20e46. If you want to print out the DataValue Array in a human readable format, use

Arrays.toString(result);
February 1, 2018
18:05, EET
Avatar
AlGor
Member
Members
Forum Posts: 4
Member Since:
February 1, 2018
sp_UserOfflineSmall Offline

Hello Heikki,
Thank you for the response.

The DataType of the node is Float.

In UaExpert ,when i request the historical data with specified start and end time i recieve information in the following format:

Source Timestamp Server Timestamp Value
2018-01-30 10:15:46.592 2018-01-30 10:15:46.592 Value=14.57,SourceTime=20180130T091546.592902,ServerTime=20180130T091546.592902

In the Prosys App i have NodeId i=60057
I am able to read historical data only when I set the start time and end time in the custom field. If i set the end time to current – server crashes and i have to restart the server.

The NodeId, definitions is shown with integer numbers in the UaExpert, In my app I am using similar definition (integer numbers) to subscribe to the nodes, it works fine.
I ajusted my function :
DataValue[] result = client.historyReadRaw(node,
DateTime.fromMillis(start), DateTime.fromMillis(end),
UnsignedInteger.MAX_VALUE, true, null, TimestampsToReturn.Source);

String data = Arrays.toString(result);

I get the followin notification:
E/Auth: [GoogleAccountDataServiceImpl] getToken() -> BAD_AUTHENTICATION.
Account: , App: com.android.vending, Service: androidmarket
fbl: Long live credential not available.

February 2, 2018
10:25, EET
Avatar
Heikki Tahvanainen
Moderator
Members

Moderators
Forum Posts: 402
Member Since:
April 17, 2013
sp_UserOfflineSmall Offline

It seems I slightly misunderstood your first post. I missed the fact that you’re actually receiving an Exception.

To understand the situation better, we’ll need to see the full Exception message. Seeing the Exception.toString() output would be helpful, but actually the best information including a full stack trace is available if you do

e.printStackTrace();

and provide the stack trace to us.

The new error BAD_AUTHENTICATION seems pretty clear: there’s some authentication error which is probably not even related to OPC UA. However, the history read issue probably will persist after the authentication is sorted out.

Both UaExpert and Prosys OPC UA Android Client should make similar HistoryReadRequests with similar kind of ReadRawModifiedDetails parameter. There’s some minor differences in the parameters such as UaExpert using NumValuesPerNode=10000 by default. However, it’s interesting to note that using the ‘now’ timestamp causes the server to crash. This is pretty clearly a server side issue.

As a summary, there’s now multiple different issues in question which may or may not be linked together:

1) You currently receive some kind of Exception with message “BAD_AUTHENTICATION” when trying to call the UaClient.historyReadRaw method. Please check any authentication settings that the server in question requires.

2) In your original message, you mentioned that you receive an Exception (probably a DecodingException) when calling UaClient.historyReadRaw. Please provide the stack trace of this Exception so we can inspect further.

3) The server crashes if a certain kind of HistoryReadRequests is made with our Prosys OPC UA Android Client. According to my understaing, this is quite clearly a server issue and you should report this to the server vendor so that they can fix the implementation.

February 2, 2018
13:47, EET
Avatar
Heikki Tahvanainen
Moderator
Members

Moderators
Forum Posts: 402
Member Since:
April 17, 2013
sp_UserOfflineSmall Offline

And to continue a little bit:

The report “if i set the end time to current – server crashes” sounds like the server crashes only with certain time parameters. And the ‘now’ parameter suggests to believe that the server crashes if the EndTime parameter is too recent. If this is the case, you should be able to reproduce the same issue also with UaExpert by setting the EndTime to the future.

February 2, 2018
16:06, EET
Avatar
AlGor
Member
Members
Forum Posts: 4
Member Since:
February 1, 2018
sp_UserOfflineSmall Offline

Hello Heikki,

Thank you very much for your support. So I was able to recieve similar data with historyReadRaw() to the data I get with the Prosys App.
My implementation is

long start = 1517302800000L; // Tue Jan 30 2018 10:00:00
long end = 1517306400000L; // Tue Jan 30 2018 11:00:00
DataValue[] result = client.historyReadRaw(node, DateTime.fromMillis(start), DateTime.fromMillis(end), UnsignedInteger.MAX_VALUE, true, null, TimestampsToReturn.Source);
String data = Arrays.toString(result);

The issues with giving broader time period leading to crashes of the server continue to occur. I am observing crashes / or I dont recieve any data / in the UaExpert under similar conditions too.
I have contacted the vendor.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online:
22 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

rocket science: 77

Ibrahim: 76

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

fred: 41

Member Stats:

Guest Posters: 0

Members: 681

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1467

Posts: 6261

Newest Members:

graciela2073, sagarchau, elviralangwell4, Donnavek, Eddiefauth, DonaldPooma, fidelduke938316, Jan-Pfizer, DavidROunc, fen.pang@woodside.com

Moderators: Jouni Aro: 1010, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 983, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 26, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 321, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1