GE Intelligent Platforms > Support >  KB > KB13885
Accessing Historian Archive Data in CIMPLICITY HMI via ADO Objects
Description

Description

Sometimes when logging to a Historian database, it is desirable to obtain the logged data from the database directly. How to do this via Proficy HMI/SCADA - CIMPLICITY.

Resolution

Historian data in CIMPLICITY is accessed using a standard ADO Interface in conjunction with some scripting in the Basic Control Engine.

Setup

  1. Install the OLEDB from the Historian CD on the CIMPLICITY node running the script. This will allow communication to the Historian database as it installs the driver to communicate.
  2. Use the Event Editor to implement a script to access the historian database. The script should look similar to the following

      Sub Main()
            Set conn = CreateObject("ADODB.Connection")

            Dim strConn As String

            ' Assign the connection string to a variable. Use user id and password as necessary
            strConn = "Provider=ihOLEDB.iHistorian.1;User Id=;Password="

             'Assign the connection string and provider, then open the connection.
             conn.ConnectionString = strConn
             connProvider = "ihOLEDB.iHistorian.1"
             conn.Open strConn

            ' Create a recordset object.
            Set rsPubs = CreateObject("ADODB.Recordset")
            ' Assign the Connection object.
            rsPubs.ActiveConnection = conn
            ' Extract the required records.
            rsPubs.Open "SELECT * FROM ihRawData"

            Dim test As String
            test = rspubs(2)
            ' Tidy up
            conn.Close
            Set rsPubs = Nothing
      End Sub

NOTE:

The SQL syntax is used to define the data to retrieve( rsPubs.Open "SELECT * FROM ihRawData" ). The specific Historian query with need to be configured to acquire the data desired. The example used here grabs every thing from ihRawData. It is possible to go to the Historian node and using the “Historian Interactive SQL” query tool to test the queries and ensure the proper data. Then use that string in the script.

Reference Historian Ebook for more information.

Start->Programs->Proficy Historian 3.1->Historian Electronic Book->Contents(Tab)-> Using the Historian OLE DB Provider-> Guidelines for Working with Clients-> Using the Historian Interactive SQL Application

Start->Programs->Proficy Historian 3.1->Historian Electronic Book->Contents(Tab)-> Using the Historian OLE DB Provider-> Supported SQL Syntax


ProductVersionModule
HMI/SCADA - CIMPLICITY All All
Historian All All


Details
ID: KB13885
Category: Sample Code
Last Updated: 04/03/12
Date Created: 03/31/10
Status: Published
Attachments: No
Language: English
User Group: All


 


Overall Rating: 3 (1 response)
Rate this content record (1=lowest, 5=highest)
5
4
3
2
1
Comment