Board logo

标题: [问题求助] WINCC VBS脚本 数组 [打印本页]

作者: 星霜荏苒    时间: 2021-1-7 11:44     标题: WINCC VBS脚本 数组

  1. Dim B(100)
  2. B(0) = 1
  3. B(1) = 2
  4. B(2) = 3
  5. B(3) = 4
  6. B(4) = 5
  7. B(5) = 6
  8. B(6) = 7
  9. B(7) = 8
  10. B(8) = 9
  11. B(9) = 10
  12. B(10) = 21
  13. B(11) = 22
  14. B(12) = 23
  15. B(13) = 24
  16. B(14) = 25
  17. B(15) = 26
  18. B(16) = 27
  19. B(17) = 28
  20. B(18) = 29
  21. B(19) = 20
  22. B(20) = 21
  23. B(21) = 22
  24. B(22) = 23
  25. B(23) = 24
  26. B(24) = 25
  27. B(25) = 26
  28. B(26) = 27
  29. B(27) = 28
  30. B(28) = 29
  31. B(29) = 30
  32. B(30) = 31
  33. B(31) = 32
  34. B(32) = 33
  35. B(33) = 34
  36. B(34) = 35
  37. B(35) = 36
  38. B(36) = 37
  39. B(37) = 38
  40. B(38) = 39
  41. B(39) = 40
  42. B(40) = 41
  43. B(41) = 42
  44. B(42) = 43
  45. B(43) = 44
  46. B(44) = 45
  47. Dim P(50)
  48. P(0) = SmartTags("Tag_1")
  49. P(1) = SmartTags("Tag_2")
  50. P(2) = SmartTags("Tag_3")
  51. P(3) = SmartTags("Tag_4")
  52. P(4) = SmartTags("Tag_5")
  53. P(5) = SmartTags("Tag_6")
  54. P(6) = SmartTags("Tag_7")
  55. P(7) = SmartTags("Tag_8")
  56. P(8) = SmartTags("Tag_9")
  57. P(9) = SmartTags("Tag_10")
  58. P(10) = SmartTags("Tag_11")
  59. P(11) = SmartTags("Tag_12")
  60. P(12) = SmartTags("Tag_13")
  61. P(13) = SmartTags("Tag_14")
  62. P(14) = SmartTags("Tag_15")
  63. P(15) = SmartTags("Tag_16")
  64. P(16) = SmartTags("Tag_17")
  65. P(17) = SmartTags("Tag_18")
  66. P(18) = SmartTags("Tag_19")
  67. P(19) = SmartTags("Tag_20")
  68. P(20) = SmartTags("Tag_21")
  69. P(21) = SmartTags("Tag_22")
  70. P(22) = SmartTags("Tag_23")
  71. P(23) = SmartTags("Tag_24")
  72. P(24) = SmartTags("Tag_25")
  73. P(25) = SmartTags("Tag_26")
  74. P(26) = SmartTags("Tag_27")
  75. P(27) = SmartTags("Tag_28")
  76. P(28) = SmartTags("Tag_29")
  77. P(29) = SmartTags("Tag_30")
  78. P(30) = SmartTags("Tag_31")
  79. P(31) = SmartTags("Tag_32")
  80. P(32) = SmartTags("Tag_33")
  81. P(33) = SmartTags("Tag_34")
  82. P(34) = SmartTags("Tag_35")
  83. P(35) = SmartTags("Tag_36")
  84. P(36) = SmartTags("Tag_37")
  85. P(37) = SmartTags("Tag_38")
  86. P(38) = SmartTags("Tag_39")
  87. P(39) = SmartTags("Tag_40")
  88. P(40) = SmartTags("Tag_41")
  89. P(41) = SmartTags("Tag_42")
  90. P(42) = SmartTags("Tag_43")
  91. P(43) = SmartTags("Tag_44")
  92. P(44) = SmartTags("Tag_45")
  93. Dim W(100)
  94. W(0) = SmartTags("盘纸加热温度上限报警计数")
  95. W(1) = SmartTags("融胶器温度上限报警计数")
  96. W(2) = SmartTags("胶管温度上限报警计数")
  97. W(3) = SmartTags("胶泵温度上限报警计数")
  98. W(4) = SmartTags("预加热温度上限报警计数")
  99. W(5) = SmartTags("接缝喷嘴温度上限报警计数")
  100. W(6) = SmartTags("烟枪温度上限报警计数")
  101. W(7) = SmartTags("盘纸加热温度下限报警计数")
  102. W(8) = SmartTags("融胶器温度下限报警计数")
  103. W(9) = SmartTags("胶管温度下限报警计数")
  104. W(10) = SmartTags("胶泵温度下限报警计数")
  105. W(11) = SmartTags("预加热温度下限报警计数")
  106. W(12) = SmartTags("接缝喷嘴温度下限报警计数")
  107. W(13) = SmartTags("烟枪温度下限报警计数")
  108. W(14) = SmartTags("KF紧急停机计数")
  109. W(15) = SmartTags("KF电机过载计数")
  110. W(16) = SmartTags("KF上胶未启动计数")
  111. W(17) = SmartTags("KF空气压力计数")
  112. W(18) = SmartTags("KF冷却风压力计数")
  113. W(19) = SmartTags("KF油压低计数")
  114. W(20) = SmartTags("KF分烟轮联锁计数")
  115. W(21) = SmartTags("KF刀头联锁计数")
  116. W(22) = SmartTags("KF接纸保护计数")
  117. W(23) = SmartTags("AF紧急停机计数")
  118. W(24) = SmartTags("AF电机过载计数")
  119. W(25) = SmartTags("AF橡胶轮安全罩联锁计数")
  120. W(26) = SmartTags("AF增塑剂液位计数")
  121. W(27) = SmartTags("AF电子流量计数")
  122. W(28) = SmartTags("主电机伺服报警计数")
  123. W(29) = SmartTags("1#辊伺服报警计数")
  124. W(30) = SmartTags("2#辊伺服报警计数")
  125. W(31) = SmartTags("3#辊伺服报警计数")
  126. W(32) = SmartTags("计量泵伺服报警计数")
  127. W(33) = SmartTags("跑条计数")
  128. W(34) = SmartTags("飞花选项计数")
  129. W(35) = SmartTags("甘油溢出报警计数")
  130. W(36) = SmartTags("下游机停机计数")
  131. W(37) = SmartTags("有指令不运行计数")
  132. W(38) = SmartTags("出口堵塞计数")
  133. W(39) = SmartTags("盘纸变频报警计数")
  134. W(40) = SmartTags("甘油流量异常计数")
  135. W(41) = SmartTags("电位器置为0计数")
  136. W(42) = SmartTags("甘油高温报警计数")
  137. W(43) = SmartTags("甘油低温报警计数")
  138. W(44) = SmartTags("开合门伺服报警计数")
  139. Dim U(100)
  140. U(0) = SmartTags("盘纸加热温度上限报警时间")
  141. U(1) = SmartTags("融胶器温度上限报警时间")
  142. U(2) = SmartTags("胶管温度上限报警时间")
  143. U(3) = SmartTags("胶泵温度上限报警时间")
  144. U(4) = SmartTags("预加热温度上限报警时间")
  145. U(5) = SmartTags("接缝喷嘴温度上限报警时间")
  146. U(6) = SmartTags("烟枪温度上限报警时间")
  147. U(7) = SmartTags("盘纸加热温度下限报警时间")
  148. U(8) = SmartTags("融胶器温度下限报警时间")
  149. U(9) = SmartTags("胶管温度下限报警时间")
  150. U(10) = SmartTags("胶泵温度下限报警时间")
  151. U(11) = SmartTags("预加热温度下限报警时间")
  152. U(12) = SmartTags("接缝喷嘴温度下限报警时间")
  153. U(13) = SmartTags("烟枪温度下限报警时间")
  154. U(14) = SmartTags("KF紧急停机时间")
  155. U(15) = SmartTags("KF电机过载时间")
  156. U(16) = SmartTags("KF上胶未启动时间")
  157. U(17) = SmartTags("KF空气压力时间")
  158. U(18) = SmartTags("KF冷却风压力时间")
  159. U(19) = SmartTags("KF油压低时间")
  160. U(20) = SmartTags("KF分烟轮联锁时间")
  161. U(21) = SmartTags("KF刀头联锁时间")
  162. U(22) = SmartTags("KF接纸保护时间")
  163. U(23) = SmartTags("AF紧急停机时间")
  164. U(24) = SmartTags("AF电机过载时间")
  165. U(25) = SmartTags("AF橡胶轮安全罩联锁时间")
  166. U(26) = SmartTags("AF增塑剂液位时间")
  167. U(27) = SmartTags("AF电子流量时间")
  168. U(28) = SmartTags("主电机伺服报警时间")
  169. U(29) = SmartTags("1#辊伺服报警时间")
  170. U(30) = SmartTags("2#辊伺服报警时间")
  171. U(31) = SmartTags("3#辊伺服报警时间")
  172. U(32) = SmartTags("计量泵伺服报警时间")
  173. U(33) = SmartTags("跑条时间")
  174. U(34) = SmartTags("飞花选项时间")
  175. U(35) = SmartTags("甘油溢出报警时间")
  176. U(36) = SmartTags("下游机停机时间")
  177. U(37) = SmartTags("有指令不运行时间")
  178. U(38) = SmartTags("出口堵塞时间")
  179. U(39) = SmartTags("盘纸变频报警时间")
  180. U(40) = SmartTags("甘油流量异常时间")
  181. U(41) = SmartTags("电位器置为0时间")
  182. U(42) = SmartTags("甘油高温报警时间")
  183. U(43) = SmartTags("甘油低温报警时间")
  184. U(44) = SmartTags("开合门伺服报警时间")
  185. Dim I
  186. Dim TIME1
  187. Dim TIME2
  188. Dim TIME3
  189. Dim G1
  190. If SmartTags("Mark._160") > 0 Then
  191. I = SmartTags("Mark._160") - 1
  192. End If
  193. If SmartTags("Mark._160") = B(I) Then
  194. P(I) = 1
  195. TIME1 = Timer
  196. W(I) = W(I) + 1
  197. Else
  198. P(I) = 0
  199. End If
  200. If SmartTags("Mark._160") = 0 And B(I) = I + 1 Then
  201. TIME2 = Timer
  202. If TIME2 > TIME1 Then
  203. TIME3 = TIME2 - TIME1
  204. ElseIf TIME2 < 36000 And TIME1 > 79200 Then
  205. TIME3 = TIME2 - TIME1 + 86400
  206. End If
  207. U(I) = U(I) + DateAdd("S" , TIME3 , "00:00:00")
  208. End If
复制代码
新手求助:怎么让我的变量根据后面这段程序来运行
例如:If SmartTags("Mark._160") = B(I) Then
        P(I) = 1
        TIME1 = Timer
        W(I) = W(I) + 1

Else`当Mark._160等于1时,I等于0,使SmartTags("Tag_1")=1,SmartTags("盘纸加热温度上限报警计数")=1




欢迎光临 批处理之家 (http://bathome.net./) Powered by Discuz! 7.2