wincc画曲线

有500组xyPLC外部变量,使用FunctionTrendControl控件画曲线,读取外部变量赋值控件,读取速度特别慢,该如何处理呢
For i = 0 To 499
   objTrend.InsertData HMIRuntime.Tags( "X" & i ).Read,HMIRuntime.Tags( "Y" & i ).Read
Next

问题补充:
您好,用group需要将500组1000个变量都add进去吗

最佳答案

可以采用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

提问者对于答案的评价:
确实是比原来快了些,但是读也需要5-7秒,还能再短些吗

最佳答案作者回复:
再快的话,看看此文档,用原始数据类型来读
https://support.industry.siemens.com/cs/cn/zh/view/79544473

原创文章,作者:ximenziask,如若转载,请注明出处:https://www.zhaoplc.com/plc367761.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2021年7月5日 下午2:52
下一篇 2021年7月5日

相关推荐

发表回复

登录后才能评论