Search code examples
sqlsql-serverhistorianaspen

AspenTech InfoPlus 21 - How to connect and query data


I will be given access to an AspenTech InfoPlus 21 endpoint, but the systems seems to be quite legacy and not very well (publicly) documented. I will need to query some data (i.e. explore what is in the database). I had a few questions regarding connecting and querying InfoPlus 21 historians.

  1. How can I connect to the InfoPlus 21 server (in the best case programmatically)? I am mostly using mac, can use linux and windows through a VM. Really, and ideas for working solutions are welcome.

  2. How can I query data from InfoPlus 21 (in the bet case programmatically) and what does the data look like? Any pointers etc. would be very helpful.

I have some experience using NoSQL (mongodb) and SQL (postgres and mysql) databases, but couldn't really find anything useful for aspentech infoplus 21 on the web. Any help would be greatly appreciated.


Solution

  • I may be responding late but i thought to share query code with Python. This Python code fetches data from Aspen IP21 with time interval of 5 minutes & considers current time minus 2 days. Obviously you may edit this code as per your requirement. But i didnt found any code which considers real time as refernece to modify your query. Hope it will help Python enthusiast-: """

    import pandas as pd
    import pyodbc
    from datetime import datetime
    from datetime import timedelta
    #---- Connect to IP21
    conn = pyodbc.connect("DRIVER={AspenTech SQLplus};HOST=10.XXX;PORT=10014")
    #---- Query string
    tag = 'TI1XXX/DACB.PV'
    end = datetime.now()
    start = end-timedelta (days=2)
    end = end.strftime("%Y-%m-%d %H:%M:%S")
    start=start.strftime("%Y-%m-%d %H:%M:%S")
    sql = "select TS,VALUE from HISTORY "\
            "where NAME='%s'"\
            "and PERIOD = 300*10"\
            "and REQUEST = 2"\
            "and REQUEST=2 and TS between TIMESTAMP'%s' and TIMESTAMP'%s'" % (tag, start, end)
    data = pd.read_sql(sql,conn) # Pandas DataFrame with your data!