使用VBA从PI DataLink中提取数据 [英] Pulling data from PI DataLink using VBA

查看:102
本文介绍了使用VBA从PI DataLink中提取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用VBA从PI Server中提取大量数据.我正在使用以下代码:

I am pulling huge amount of data from PI Server using VBA. I am using the following code:

**Dim myValues As PIValues

Set myValues = PIMath.GetInterpolatedValues_Point(inputPIPoint,
    PIMath.StringToPITimeFormat(StartDate),
    PIMath.StringToPITimeFormat(NextDate), "10s")**

将MyValues中存储的所有值复制到工作表中的列的最快方法是什么?我正在使用For Loop:

What is the fastest way to copy all the values stored in MyValues to a column in a worksheet? I am using For Loop:

For k = 1 To myValues.Count

Worksheets("Sheet6").Cells(k, 2).value = myValues(k)

但是当我使用多个PI Tag并将时间间隔更改为5秒时,这会极大地减慢该过程.

But it is extremely slowing down the process as I use multiple PI Tags and change time interval to 5 seconds.

此外,如何在每个完整循环结束时将 myValues 设置为空?这就是我想要做的:

Also, how can I set myValues to empty at the end of every full loop? This is what I am trying to do:

  1. MyValues 包含从日期1st到2nd的数据
  2. 应清除 MyValues 中的所有PI点
  3. MyValues 包含从日期2nd到3rd的数据
  1. MyValues contains the data from Date 1st to 2nd
  2. All the PI points in MyValues should be cleared
  3. MyValues contains the data from Date 2nd to 3rd

推荐答案

类似的东西

Worksheets("Sheet6").Range("B1").Resize(UBound(myValues)+1,1).Value = _
                                       Application.Transpose(myValues)

这篇关于使用VBA从PI DataLink中提取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆