本文介绍了AspenTech InfoPlus 21-如何连接和查询数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将获得访问AspenTech InfoPlus 21端点的权限,但是这些系统似乎是很旧的,并且没有(很好地)记录在案.我将需要查询一些数据(即浏览数据库中的内容).关于连接和查询InfoPlus 21历史学家,我有几个问题.

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. 如何连接到InfoPlus 21服务器(最好是以编程方式)?我主要使用mac,可以通过VM使用linux和Windows.的确,欢迎提供可行的解决方案的想法.

  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.

如何查询InfoPlus 21中的数据(以打赌方式进行编程),数据是什么样的?任何指针等都将非常有帮助.

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.

我在使用NoSQL(mongodb)和SQL(postgres和mysql)数据库方面有一些经验,但是在Web上找不到任何对aspentech infoplus 21有用的东西.任何帮助将不胜感激.

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.

推荐答案

我可能响应迟了,但我想与Python共享查询代码.此Python代码以5分钟的时间间隔从Aspen IP21提取数据.考虑当前时间减去2天.显然,您可以根据需要编辑此代码.但是我没有找到任何将实时视为参考的代码来修改您的查询.希望对Python爱好者有帮助:""

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!

这篇关于AspenTech InfoPlus 21-如何连接和查询数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-26 21:17