Welcome back to our Data Storage Deep Dive series, where we have been exploring the possibilities of integrating our variety of industrial automation software solutions with historians to allow for a deeper understanding of trends within your data. In our previous installment, Software Toolbox Helps You Fly Higher with Canary Historian, we demonstrated how TOP Server, OmniServer and DataHub can collect data from unique sources with different communication needs to Canary Data Historian for aggregation and analysis. Today, we are going to look at how OPC Router can be used to extract the historical data and expose it in an intuitive format for any OPC UA Client to consume.
This is yet another example of “the Software Toolbox Way”, which includes our commitment to work well with other suppliers, like Canary, and their clients, even when we did not provide those other software solutions.
Connecting to the REST API
OPC Router can pass data between many different web services, making it an optimal tool for transforming data from REST APIs such as the one provided with the Canary Data Historian. Please refer to the Canary documentation for this service.
The historian supports token authentication for secure data retrieval, which can be implemented in OPC Router using a global variable, which updates on a 5-minute trigger:
With the necessary credentials, we can now construct the payload for the /getTagData endpoint, to request the tags in the historian:
Request Only the Data You Need with OPC UA Methods
Now that we can retrieve the data from Canary Data Historian, we can create a gateway to OPC UA clients using methods. This implementation allows for the clients to specify the parameters to use in the REST call. In this case, we’ll define time interval parameters as the input arguments to return aggregate data over a specific timespan:
Now, OPC UA clients can request specific ranges of data depending on what needs to be processed by invoking this method. When a client calls on the method, this triggers the entire connection in OPC Router, and the data is immediately retrieved from the REST call and provided back to the client through the output parameters. And with the use of OPC Router’s templates feature, this model can be quickly replicated to expose many tags as their own endpoints:
Conclusion
The flexibility of OPC Router’s configuration interface means that we can turn any parameter in the REST call into a method input. Data can be exposed in whatever way best fits the needs of the client applications that are consuming the historical data.
Outside of the OPC UA server, OPC Router connects many other interfaces including SAP, ERP web services, and databases for further integrating historical data across systems. Our video tutorial Round Trip PLC/HMI to SAP Integration demonstrates an example application of this time of connection. The variety of plug-ins and modular configuration makes it simple re-use logic, to swap out data sources and destinations, and add onto existing data flows.
If you are interested in a solution for extracting data from a historian with a web API like Canary Data Historian, our support team is available to discuss OPC Router as an option for you. Feel free to reach out with any questions as well, and stay tuned for the continuation of our Data Storage Deep Dive and more useful content by subscribing to our blog.