Questions regarding the use of the C++ SDK for Server or Client development or integration into customer products ...
- Jr. Member
- Posts: 1
- Joined: 05 Dec 2021, 18:17
The documentation has a lesson on creating a connection to the server and reading data from it. But there is no example of how to get the data of a specific tag or nodeid. I would like to see an example of how to get historical data for a period of time using an existing tag. The documentation only describes the technical properties, but the logic of using these tools is absolutely not clear. Is it possible to provide an example of obtaining such data?
I have this data structure.
The example from the 1st lesson is being executed. I connect to the server and read the time from it.
But I would like to get the historical data of a certain tag (TNPZ.P_NEFT.R1.M
). What do I need to do?
Code: Select all
nodeToRead.AttributeId = OpcUa_Attributes_Value;
nodeToRead.NodeId.Identifier.Numeric = OpcUaId_Server_ServerStatus_CurrentTime;
result = m_pSession->read(
printf("ServerStatusCurrentTime: %s\n", UaVariant(values.Value).toString().toUtf8());
printf("Read failed for item with status %s\n", UaStatus(values.StatusCode).toString().toUtf8());
printf("Read failed with status %s\n", result.toString().toUtf8());
- Hero Member
- Posts: 2714
- Joined: 18 Mar 2011, 15:09
there is a lot of example code in the full client example, which should guide you to the solution.
You should look into the code provided with the SDK:
Read historical data on a variable (methods historyReadDataRaw, historyReadDataProcessed, historyReadDataAtTime)
Unified Automation Support Team