7:03, EET
January 26, 2023
I tried to read the simulation data history, but unfortunately sourceTimestamp always shows null or 01/01/01 00:00:01.0000000 GMT value
but MyObjects>MyDevices>MyLevel works fine
Code
———-
HistoryReadResult[] results = uaClient.historyRead(details, TimestampsToReturn.Source, false, ids);
ExtensionObject historyDataObject = results[0].getHistoryData();
Output
———
MyObjects>MyDevices>MyLevel – HistoryData [DataValues=”[DataValue(value=1.0, statusCode=GOOD (0x00000000) “The operation succeeded.”,
sourceTimestamp=01/26/23 04:10:11.6570000 GMT, sourcePicoseconds=0, serverTimestamp=01/26/23 04:10:11.6570000 GMT, serverPicoseconds=0)
Objects>Simulation>Random – HistoryData [DataValues=”[DataValue(value=10.0, statusCode=GOOD (0x00000000) “The operation succeeded.”,
sourceTimestamp=01/01/01 00:00:00.0000000 GMT, sourcePicoseconds=0, serverTimestamp=01/01/01 00:00:00.0000000 GMT, serverPicoseconds=0),
13:50, EET
Moderators
February 11, 2020
Hello,
Where are you attempting to read the history from? Prosys OPC UA Historian is a product for collecting History from Source Servers. Have you configured it to collect history from MyLevel of SampleConsoleServer or Simulation Server and then attempted to read history with your OPC UA Client via Historian’s OPC UA Server? Or did you post this message on a wrong subforum and Historian is not involved in the reading process at all?
The call to read history looks correct, which suggests that there is error in either the timestamps provided by a Server or how they’re processed after they’ve been read. Would it be possible for you to provide the code that outputs the sourceTimestamp to confirm that there are no errors there?
Also, would it be possible to use Wireshark to capture traffic between the applications and sent the logs to us so that we can check the sourceTimestamps returned by the Server? See https://www.prosysopc.com/blog/opc-ua-wireshark/ for instructions on how to capture OPC UA communication with Wireshark. If you’re running the applications on the same host, remember to select “Support loopback traffic” option when installing Wireshark.
You can send the code and Wireshark capture logs to uajava-support@prosysopc.com
9:04, EET
January 26, 2023
Thanks, Matti Siponen for your reply.
I downloaded and installed the trial version of the OPC UA Simulation Server and tried to read using a sample JAVA application (prosys-opc-ua-sdk-for-java-4.10.0-58-evaluation)
I tried to do several readings at once using uaClient.historyRead() method.
HistoryReadDetails details = new ReadRawModifiedDetails(false, DateTime.MIN_VALUE, DateTime.currentTime(), UnsignedInteger.valueOf(DATA_BATCH_SIZE), true);
HistoryReadResult[] results = uaClient.historyRead(details, TimestampsToReturn.Source, false, ids);
ExtensionObject historyDataObject = results[0].getHistoryData();
HistoryData data = historyDataObject.decode(uaClient.getEncoderContext());
DataValue[] values = data.getDataValues();
9:45, EET
Moderators
February 11, 2020
Hello,
Knowing that the Server you’re reading from is Simulation Server and that you’re using a recent version of the SDK (the latest version is 4.10.2), there should be no problem with reading the source timestamps. However, now that I can see your ReadRawModifiedDetails, it seems that you’re reading history from DateTime.MIN_VALUE to DateTime.currentTime(). Effectively this means that you’re reading from 1.1.1601 00:00:00 UTC to now so over 400 hundred years of history. Since Simulation Server is able to generate simulated history for simulated Values such as Random, this means that there actually will be that much history available. Unless you really need to read such old Values, I would recommend testing with shorter and more recent intervals and checking if there are still errors in the source timestamps of Random.
Though, I tried to do some read some data starting from 1.1.1601 00:00:00 UTC and while there were some errors in timestamps (they were all off by fixed duration), they were not null or the minimum value. Thus the question remains, how exactly does your code output the timestamps to console and/or log?
Most Users Ever Online: 1919
Currently Online:
26 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: 734
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1523
Posts: 6449
Newest Members:
christamcdowall, redaahern07571, nigelbdhmp, travistimmons, AnnelCib, dalenegettinger, howardkennerley, Thomassnism, biancacraft16, edgardo3518Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1026, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0
Administrators: admin: 1