展开查看
有500组xyPLC外部变量,使用FunctionTrendControl控件画曲线,读取外部变量赋值控件,读取速度特别慢,该如何处理呢
For i = 0 To 499
objTrend.InsertData HMIRuntime.Tags( "X" & i ).Read,HMIRuntime.Tags( "Y" & i ).Read
Next
提问者:娇
可以采用group方式读取,以提高性能
vbs脚本示例:
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
group.Add "Motor1"
group.Add "Motor2"
group.Read
HMIRuntime.Trace "Motor1: " & group("Motor1").Value & vbNewLine
HMIRuntime.Trace "Motor2: " & group("Motor2").Value & vbNewLine
c脚本参考:
https://support.industry.siemens.com/cs/cn/zh/view/26710242
补充:
是的,例如
For i = 0 To 499
group.Add "X" & i
group.Add "Y" & i
Next
有500组xyPLC外部变量,使用FunctionTrendControl控件画曲线,读取外部变量赋值控件,读取速度特别慢,该如何处理呢
For i = 0 To 499
objTrend.InsertData HMIRuntime.Tags( "X" & i ).Read,HMIRuntime.Tags( "Y" & i ).Read
Next
使用了group100组数据读取的时间大概在7秒8秒的样子,还能再快些吗
vbs脚本示例:
Dim group1,group2
Set group1 = HMIRuntime.Tags.CreateTagSet
Set group2 = HMIRuntime.Tags.CreateTagSet
For i = 0 To 499
group1.Add "X" & i
group2.Add "Y" & i
Next