在WINCC界面里设置一个变量,将其与通过PLC传上来的实际数据进行比较,如果不等于就报警. 因为PLC传变量有一定的延迟,请问怎样进行处理?
问题补充:
是延迟大约两秒钟再比较.
最佳答案
Flexible 的,供参考
Dim StartTime, StopTime, i,DelayTime
ShowSystemAlarm "Script is running " & Time
'Definition of local tags - Definition von lokalen Variablen
StartTime = Now
DelayTime = SmartTags("nWait")
StopTime = StartTime + DelayTime/24/3600
'Delay function - Verz?gerungs-Funktion
Do
If i = 0 Then
ShowSystemAlarm "Script is waiting for " & DelayTime & " seconds"
i = i + 1
End If
Loop Until Now >= StopTime
ShowSystemAlarm "Script was terminated " & Time
提问者对于答案的评价:
多谢
原创文章,作者:more0621,如若转载,请注明出处:https://www.zhaoplc.com/plc274064.html