首页 > 解决方案 > 如何将 txt 文件中的数据查询到 AspenTech IP21 Historian?

问题描述

我在 txt 文件中有这种格式的过程数据。

测试标签 testTag2

10 18

6 15

7 15

9 19

请帮助我构建一个 SQLPlus 脚本,以便每 5 秒后,这些值中的一个值应按顺序更新 testTag 和 testTag2 的 IP_INPUT_VALUE 字段。

可以在每 5 秒后重新安排查询的选项,以备不时之需。

请帮忙。

标签: sqlplushistorianaspen

解决方案


多次尝试后,我自己解决了这个问题。我所要做的就是将 txt 格式更改为以下格式并运行查询

      A                  B
    NAME               VALUE
 ----------------------------------------

 testTag        10      6       7       9


 testTag2       18      15      15      19

SQLPLus 查询:

local tagname char(24);
local value real;
local x,y integer;


y=2;

for x = y to 5 do

wait 00:00:05.00;

for (select line as ln from 'c:\data\Data.txt') do

tagname = substring(1 of ln between'    ');

value = substring (x of ln between '    ');

UPDATE ip_analogdef SET IP_INPUT_VALUE = value,
QSTATUS(IP_INPUT_VALUE) = 'Good'
where name=tagname;

y=y+1;

end;
end;

推荐阅读