Reading Historical Data / Using AQL

ARDI uses its own query language named AQL to ask for information.

It returns JSON information that you should be able to use in a variety of applications.

When you're asking for historical information (using the AQL GETHISTORY function for example), there are also special functions to return a Complete Dataframe of that information in Pandas.

Creating a Query

Once you're connected to the ARDI server, you'll need to create an AQLQuery

query = ardi.AQLQuery(server)

Executing the Query

You execute the query using the Execute function, passing the actual AQL query you'd like to run.

The response comes back as a parsed JSON object.

query = ardi.AQLQuery(server)

Process the Response

Now you can process the response however you like.

In the example below, send a query asking for every point that uses the property 'Temperature'.

We then go through that list and display each of those temperatures.

Complete Code

import ardi
import sys

#Setup ARDI Connection
svr = ardi.Server("localhost","cr")

#Connect to ARDI Server
connected = False
try:
    connected = svr.Connect()
except:
    pass

if connected == False:
    print("Unable to Connect to ARDI Server")
    sys.exit(-1)

query = ardi.AQLQuery(svr)
data = query.Execute("'Temperature' PROPERTY ALLPOINTS")

for r in data['results'][0]['value']:
    print(r['name'] + " " + r['propname'] + ": " + str(r['value']))