Retrieving Data from a Citadel Database

Überblick

Through the LabVIEW Data and Supervisory Control (DSC) Module, data can be logged in an NI Citadel or a relational database. If data is logged to an existing relational database infrastructure the information technology group managing the databases should be consulted in order to build reporting/querying tools. In contrast, with NI Citadel this data can be retrieved for trending and analysis in various interactive and programmatic methods. This tutorial provides an overview of these different methods to retrieve logged data from a Citadel Database.

Contents

Interactive Data Retrieval

In order to retrieve data without programming queries, Citadel historical database provides access to data through the Historical Data Viewer (HDV), NI DIAdem as well as in NI LabVIEW through the HyperTrend control.

Historical Data Viewer in MAX

NI’s Measurement & Automation Explorer (MAX) contains a basic interface for organizing, viewing and exporting Citadel data on a per channel, also called a trace, basis through its Historical Data Viewer.  The viewer allows the overlay of multiple traces in the same window with the ability through configuration windows to change the time increment selected as well as each trace’s line properties such as color and type. Once the configuration of the trace view has been established it can be exported to a standard XML formatted file and for future reference or distribution to other machines. The Historical Data Viewer also allows for export of data to a simple text file for use in third party software. However this export function should only be used for small data sets as large data sets can be more efficiently transferred to NI DIAdem or third party software using other methods discussed later in this tutorial.

Figure 1: Historical Data Viewer

NI DIAdem

NI DIAdem provides an efficient tool to complete post logging analysis and reporting. The tool ships with a data store plug-in allowing for the direct import of Citadel data so that DIAdem’s powerful configuration based algorithms, such as signal analysis, statistics and curve fitting, can be applied. The raw data and resulted then can be inserted into standard or custom report templates and published in common file formats such as PDF.

Learn more about Transferring Data from Citadel to NI DIAdem for Analysis and Reporting.

 

HyperTrend Control

The Historical Data Viewer in MAX, which was discussed previously in this document, can also be added to a LabVIEW application as an ActiveX control. The viewer properties available in MAX are also available through configuration dialogs for the control for manual adjustments. If run-time changes are required, these properties are also available programmatically through ActiveX property and method nodes.

Figure 2: NI HyperTrend ActiveX Control

Programmatic Based Data Retrieval

If more flexibility is needed in order to customize or automate the retrieval process, you can programmatically access the trace data in Citadel through a LabVIEW API, ODBC driver and web services.

LabVIEW DSC Module

The LabVIEW Datalogging and Supervisory Control (DSC) Module includes VIs to read historical data from Citadel.  It also makes available run-time retrieval selections by providing VIs to return the available databases and traces that can be polled for data. After retrieving the logged data, you can use LabVIEW’s processing tools to manipulate trace data, compute statistics, query alarm and events, or convert the data into spreadsheet format.

Figure 3: Using LabVIEW's DSC Historical VIs

Citadel ODBC Driver

To facilitate sharing data, Citadel includes an ODBC driver that enables you execute data retrieval directly into  third-party applications. The Citadel 5 ODBC driver is compliant with SQL 92 and ODBC 2.5 standards therefore any third-party client software that follows these standards can retrieve data from a Citadel database.

In addition, ADO clients can use the ODBC driver through the Microsoft OLE DB Provider for ODBC Drivers to access the Citadel 5.2 and later databases.

An example of using the ODBC driver with Microsoft Excel is implemented in the tutorial: Accessing Citadel 5 Data with Microsoft Excel 2007.

Citadel Web Services

If the data access is needed across long distances Citadel exposes web services to allow for more open and standard way to communicate over the Web. Through the structure of the URL calls to the server hosting Citadel’s web services, a user can retrieval information about the available databases and traces as well as pull trace data. It is important to note that web programming language knowledge is required to successfully build an interface to visualize the data retrieved from Citadel through a web service.

For more detailed information about the web services Citadel provides refer to the LabVIEW Help: Accessing the Citadel Web Service.

Learn more about web services and how they can be created in LabVIEW: Web Services in LabVIEW.

Summary

In applications that require long-term data logging, a database infrastructure is an important organizational tool to manage and structure the historical data. As long-term databases can often grow to large sizes it is also important that the historical database has an efficient means to query and retrieve data. NI Citadel provides both configuration based interactive and programmatic methods to do this querying within MAX, LabVIEW and DIAdem. In order to integrate into existing infrastructure it also conforms with the ODBC driver standards for access in third-party applications. The method that is implemented will depend on the application and may be a hybrid; however, Citadel provides the flexibility to create such a solution.