@machinemetrics/io-adapter-lib 2.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. package/.circleci/config.yml +141 -0
  2. package/.eslintrc.json +36 -0
  3. package/.gitattributes +12 -0
  4. package/CHANGELOG.md +544 -0
  5. package/README.md +2 -0
  6. package/index.js +17 -0
  7. package/lib/config/adapterConfig.js +535 -0
  8. package/lib/config/common/allowDenyList.js +58 -0
  9. package/lib/config/common/jsonPath.js +44 -0
  10. package/lib/config/common/labjackU3T4Common.js +227 -0
  11. package/lib/config/common/validations.js +142 -0
  12. package/lib/config/configError.js +32 -0
  13. package/lib/config/device/adam-6052Config.js +103 -0
  14. package/lib/config/device/brotherHTTPConfig.js +215 -0
  15. package/lib/config/device/ethernetIPConfig.js +191 -0
  16. package/lib/config/device/ifmIotConfig.js +245 -0
  17. package/lib/config/device/jsonHttpConfig.js +76 -0
  18. package/lib/config/device/labjackT4Config.js +39 -0
  19. package/lib/config/device/labjackT7Config.js +192 -0
  20. package/lib/config/device/labjackU3Config.js +32 -0
  21. package/lib/config/device/modbusTcpConfig.js +336 -0
  22. package/lib/config/device/mqttBaseConfig.js +70 -0
  23. package/lib/config/device/mqttConfig.js +113 -0
  24. package/lib/config/device/mqttLincolnConfig.js +62 -0
  25. package/lib/config/device/mtconnectAdapterConfig.js +42 -0
  26. package/lib/config/device/mtconnectBaseConfig.js +136 -0
  27. package/lib/config/device/mtconnectConfig.js +52 -0
  28. package/lib/config/device/mtconnectHaasConfig.js +15 -0
  29. package/lib/config/device/nullConfig.js +81 -0
  30. package/lib/config/device/opcuaConfig.js +205 -0
  31. package/lib/config/device/pcccConfig.js +88 -0
  32. package/lib/config/engineConfigV1.js +382 -0
  33. package/lib/config/engineConfigV2.js +106 -0
  34. package/lib/config/generator/counterGenConfig.js +15 -0
  35. package/lib/config/generator/cronGenConfig.js +33 -0
  36. package/lib/config/generator/dateTimeGenConfig.js +33 -0
  37. package/lib/config/index.js +339 -0
  38. package/lib/config/transformConfigUtil.js +296 -0
  39. package/lib/engine/dataOutput.js +357 -0
  40. package/lib/engine/deviceOutput.js +186 -0
  41. package/lib/engine/engineV1.js +480 -0
  42. package/lib/engine/engineV2.js +719 -0
  43. package/lib/engine/index.js +34 -0
  44. package/lib/engine/transformBuilderV1.js +111 -0
  45. package/lib/engine/transformBuilderV2.js +74 -0
  46. package/lib/expressionService.js +330 -0
  47. package/lib/math.js +142 -0
  48. package/lib/transform/accumulate.js +98 -0
  49. package/lib/transform/average.js +56 -0
  50. package/lib/transform/debounce.js +152 -0
  51. package/lib/transform/downsample.js +69 -0
  52. package/lib/transform/edge.js +34 -0
  53. package/lib/transform/expression.js +91 -0
  54. package/lib/transform/fallingEdge.js +70 -0
  55. package/lib/transform/fromBuffer.js +89 -0
  56. package/lib/transform/hash.js +41 -0
  57. package/lib/transform/ignoreValue.js +118 -0
  58. package/lib/transform/index.js +93 -0
  59. package/lib/transform/invert.js +25 -0
  60. package/lib/transform/latch.js +99 -0
  61. package/lib/transform/latchValue.js +115 -0
  62. package/lib/transform/logicAnd.js +67 -0
  63. package/lib/transform/logicOr.js +67 -0
  64. package/lib/transform/map.js +115 -0
  65. package/lib/transform/max.js +57 -0
  66. package/lib/transform/maxLength.js +39 -0
  67. package/lib/transform/min.js +57 -0
  68. package/lib/transform/minDelta.js +40 -0
  69. package/lib/transform/offDelay.js +89 -0
  70. package/lib/transform/onDelay.js +89 -0
  71. package/lib/transform/patternEscape.js +24 -0
  72. package/lib/transform/patternMatch.js +194 -0
  73. package/lib/transform/patternReplace.js +170 -0
  74. package/lib/transform/patternTest.js +85 -0
  75. package/lib/transform/rateOfChange.js +56 -0
  76. package/lib/transform/reject.js +115 -0
  77. package/lib/transform/resample.js +96 -0
  78. package/lib/transform/risingEdge.js +90 -0
  79. package/lib/transform/risingEdgeCounter.js +179 -0
  80. package/lib/transform/sampleInterval.js +12 -0
  81. package/lib/transform/source.js +116 -0
  82. package/lib/transform/state.js +201 -0
  83. package/lib/transform/threshold.js +52 -0
  84. package/lib/transform/toBuffer.js +159 -0
  85. package/lib/transform/toggle.js +118 -0
  86. package/lib/transform/transformState.js +193 -0
  87. package/lib/transform/trim.js +27 -0
  88. package/lib/transform/util/chainSource.js +96 -0
  89. package/lib/transform/util/ringBuffer.js +34 -0
  90. package/lib/transform/valueChange.js +34 -0
  91. package/lib/transform/valueDecrease.js +38 -0
  92. package/lib/transform/valueIncrease.js +38 -0
  93. package/lib/transform/valueIncreaseDiff.js +66 -0
  94. package/lib/transform/whenUnavailable.js +73 -0
  95. package/lib/transform/windowCount.js +86 -0
  96. package/lib/util/fileUtil.js +44 -0
  97. package/package.json +38 -0
  98. package/test/.eslintrc.json +15 -0
  99. package/test/chainedTransform.test.js +88 -0
  100. package/test/conditions.test.js +118 -0
  101. package/test/config/ab-pccc.test.js +41 -0
  102. package/test/config/adam-6052.test.js +16 -0
  103. package/test/config/adapter.test.js +109 -0
  104. package/test/config/brother-http.test.js +19 -0
  105. package/test/config/ethernet-ip.test.js +19 -0
  106. package/test/config/ifm-iot.test.js +20 -0
  107. package/test/config/json-http.test.js +47 -0
  108. package/test/config/labjack-t4.test.js +78 -0
  109. package/test/config/labjack-t7.test.js +18 -0
  110. package/test/config/labjack-u3.test.js +17 -0
  111. package/test/config/modbusTcp.test.js +87 -0
  112. package/test/config/mqtt.test.js +19 -0
  113. package/test/config/mqttLincoln.test.js +29 -0
  114. package/test/config/mtconnect.test.js +63 -0
  115. package/test/config/mtconnectAdapter.test.js +124 -0
  116. package/test/config/mtconnectHaas.test.js +15 -0
  117. package/test/config/null.test.js +16 -0
  118. package/test/config/opcua.test.js +97 -0
  119. package/test/config-tests.js +102 -0
  120. package/test/configFiles/conditions.yml +37 -0
  121. package/test/configFiles/data-items-legacy.yml +24 -0
  122. package/test/configFiles/data-items-shorthand.yml +14 -0
  123. package/test/configFiles/data-items.yml +12 -0
  124. package/test/configFiles/device/ab-pccc-default.yml +3 -0
  125. package/test/configFiles/device/ab-pccc-full.yml +13 -0
  126. package/test/configFiles/device/adam-6052-default.yml +2 -0
  127. package/test/configFiles/device/brother-http-default.yml +3 -0
  128. package/test/configFiles/device/ethernet-ip-default.yml +2 -0
  129. package/test/configFiles/device/ifm-iot-default.yml +2 -0
  130. package/test/configFiles/device/json-http-bad-prop.yml +13 -0
  131. package/test/configFiles/device/json-http-bad-prop2.yml +13 -0
  132. package/test/configFiles/device/json-http-default.yml +3 -0
  133. package/test/configFiles/device/json-http-std.yml +13 -0
  134. package/test/configFiles/device/labjack-t4-condition-exprs.yaml +46 -0
  135. package/test/configFiles/device/labjack-t4-default.yml +3 -0
  136. package/test/configFiles/device/labjack-t4-pins-alt.yaml +41 -0
  137. package/test/configFiles/device/labjack-t4-pins.yaml +40 -0
  138. package/test/configFiles/device/labjack-t4-v1.yaml +29 -0
  139. package/test/configFiles/device/labjack-t7-default.yml +2 -0
  140. package/test/configFiles/device/labjack-u3-default.yml +2 -0
  141. package/test/configFiles/device/modbus-partial.yml +4 -0
  142. package/test/configFiles/device/modbus-std-extended.yaml +23 -0
  143. package/test/configFiles/device/modbus-std.yaml +34 -0
  144. package/test/configFiles/device/modbus-tcp-default.yml +3 -0
  145. package/test/configFiles/device/mqtt-default.yml +2 -0
  146. package/test/configFiles/device/mqtt-lincoln-default.yml +3 -0
  147. package/test/configFiles/device/mqtt-lincoln-full.yml +7 -0
  148. package/test/configFiles/device/mtconnect-adapter-default.yml +3 -0
  149. package/test/configFiles/device/mtconnect-adapter-keys.yaml +18 -0
  150. package/test/configFiles/device/mtconnect-complex-keys.yaml +17 -0
  151. package/test/configFiles/device/mtconnect-default.yml +3 -0
  152. package/test/configFiles/device/mtconnect-duplicate-allow-keys.yaml +10 -0
  153. package/test/configFiles/device/mtconnect-duplicate-declare-keys.yaml +8 -0
  154. package/test/configFiles/device/mtconnect-duplicate-deny-keys.yaml +10 -0
  155. package/test/configFiles/device/mtconnect-haas-default.yml +3 -0
  156. package/test/configFiles/device/mtconnect-std.yaml +18 -0
  157. package/test/configFiles/device/null-default.yml +1 -0
  158. package/test/configFiles/device/opcua-bad-tag.yml +18 -0
  159. package/test/configFiles/device/opcua-bad-tag2.yml +18 -0
  160. package/test/configFiles/device/opcua-default.yml +3 -0
  161. package/test/configFiles/device/opcua-std.yml +18 -0
  162. package/test/configFiles/dump-test.yml +11 -0
  163. package/test/configFiles/expressionCond.yml +46 -0
  164. package/test/configFiles/min-config-t4.yaml +4 -0
  165. package/test/configFiles/min-config-u3.yaml +3 -0
  166. package/test/configFiles/missing-device.yaml +2 -0
  167. package/test/configFiles/parse-error1.yml +9 -0
  168. package/test/configFiles/parse-error2.yml +9 -0
  169. package/test/configFiles/repro/buffer-convert-repro.yml +15 -0
  170. package/test/configFiles/repro/chained-delay-timing-repro.yml +13 -0
  171. package/test/configFiles/repro/count-init-repro.yml +45 -0
  172. package/test/configFiles/repro/cycle-break-repro.yml +44 -0
  173. package/test/configFiles/repro/debounce-repro.yml +46 -0
  174. package/test/configFiles/repro/diff-count-repro.yml +34 -0
  175. package/test/configFiles/repro/engine-hang-repro.yml +9 -0
  176. package/test/configFiles/repro/latch-apm-repro.yml +26 -0
  177. package/test/configFiles/repro/lockout-count-repro.yml +33 -0
  178. package/test/configFiles/repro/program-extract-repro.yml +38 -0
  179. package/test/configFiles/repro/state-latch-repro.yml +47 -0
  180. package/test/configFiles/repro/ternary-repro.yml +26 -0
  181. package/test/configFiles/transform/debounce.yml +12 -0
  182. package/test/configFiles/transform/expression.yml +34 -0
  183. package/test/configFiles/transform/ignoreValue.yml +31 -0
  184. package/test/configFiles/transform/latch.yml +11 -0
  185. package/test/configFiles/transform/latchValue.yml +31 -0
  186. package/test/configFiles/transform/logicAnd.yml +14 -0
  187. package/test/configFiles/transform/logicOr.yml +14 -0
  188. package/test/configFiles/transform/map.yml +19 -0
  189. package/test/configFiles/transform/maxLength.yml +13 -0
  190. package/test/configFiles/transform/offDelay.yml +12 -0
  191. package/test/configFiles/transform/pattern-escape.yml +10 -0
  192. package/test/configFiles/transform/pattern-match.yml +57 -0
  193. package/test/configFiles/transform/pattern-replace.yml +34 -0
  194. package/test/configFiles/transform/pattern-test.yml +25 -0
  195. package/test/configFiles/transform/reject.yml +24 -0
  196. package/test/configFiles/transform/risingEdgeCounter.yml +36 -0
  197. package/test/configFiles/transform/source.yml +20 -0
  198. package/test/configFiles/transform/state.yml +56 -0
  199. package/test/configFiles/transform/toggle.yml +19 -0
  200. package/test/configFiles/transform/whenUnavailable.yml +19 -0
  201. package/test/dataFiles/noisy-pulse.txt +11330 -0
  202. package/test/dataItems.test.js +140 -0
  203. package/test/engine-v1-tests.js +418 -0
  204. package/test/engine-v2-tests.js +284 -0
  205. package/test/expression-tests.js +171 -0
  206. package/test/expressionService.test.js +154 -0
  207. package/test/expressionServiceCondition.test.js +130 -0
  208. package/test/repro/buffer-convert-repro.test.js +38 -0
  209. package/test/repro/chained-delay-timing-repro.test.js +34 -0
  210. package/test/repro/count-init-repro.test.js +46 -0
  211. package/test/repro/cylce-break-repro.test.js +57 -0
  212. package/test/repro/debounce-repro.test.js +65 -0
  213. package/test/repro/diff-count-repro.test.js +79 -0
  214. package/test/repro/engine-hang-repro.test.js +38 -0
  215. package/test/repro/latch-apm-repro.test.js +119 -0
  216. package/test/repro/lockout-count-repro.test.js +84 -0
  217. package/test/repro/program-extract-repro.test.js +40 -0
  218. package/test/repro/state-latch-repro.test.js +63 -0
  219. package/test/repro/ternary-repro.test.js +43 -0
  220. package/test/transform/accumulte.test.js +18 -0
  221. package/test/transform/average.test.js +22 -0
  222. package/test/transform/debounce.test.js +70 -0
  223. package/test/transform/downsample.test.js +30 -0
  224. package/test/transform/edge.test.js +27 -0
  225. package/test/transform/expression.test.js +189 -0
  226. package/test/transform/fallingEdge.test.js +59 -0
  227. package/test/transform/fromBuffer.test.js +60 -0
  228. package/test/transform/hash.test.js +34 -0
  229. package/test/transform/ignoreValue.test.js +123 -0
  230. package/test/transform/invert.test.js +26 -0
  231. package/test/transform/latch.test.js +33 -0
  232. package/test/transform/latchValue.test.js +126 -0
  233. package/test/transform/logicAnd.test.js +80 -0
  234. package/test/transform/logicOr.test.js +80 -0
  235. package/test/transform/map.test.js +42 -0
  236. package/test/transform/max.test.js +30 -0
  237. package/test/transform/maxLength.test.js +32 -0
  238. package/test/transform/min.test.js +30 -0
  239. package/test/transform/minDelta.test.js +14 -0
  240. package/test/transform/offDelay.test.js +123 -0
  241. package/test/transform/onDelay.test.js +105 -0
  242. package/test/transform/patternEscape.test.js +18 -0
  243. package/test/transform/patternMatch.test.js +177 -0
  244. package/test/transform/patternReplace.test.js +95 -0
  245. package/test/transform/patternTest.test.js +105 -0
  246. package/test/transform/rateOfChange.test.js +34 -0
  247. package/test/transform/reject.test.js +56 -0
  248. package/test/transform/resample.test.js +193 -0
  249. package/test/transform/risingEdge.test.js +60 -0
  250. package/test/transform/risingEdgeCounter.test.js +227 -0
  251. package/test/transform/sampleInterval.test.js +22 -0
  252. package/test/transform/source.test.js +137 -0
  253. package/test/transform/state.test.js +248 -0
  254. package/test/transform/threshold.test.js +78 -0
  255. package/test/transform/toBuffer.test.js +60 -0
  256. package/test/transform/toggle.test.js +92 -0
  257. package/test/transform/trim.test.js +30 -0
  258. package/test/transform/valueChange.test.js +14 -0
  259. package/test/transform/valueDecrease.test.js +32 -0
  260. package/test/transform/valueIncrease.test.js +32 -0
  261. package/test/transform/valueIncreaseDiff.test.js +32 -0
  262. package/test/transform/whenUnavailable.test.js +93 -0
  263. package/test/transform/windowCount.test.js +26 -0
  264. package/test/util/testUtils.js +405 -0
@@ -0,0 +1,38 @@
1
+ skip-validate: true
2
+ version: 2
3
+ mtconnect-passthrough: false
4
+ device: mtconnect-adapter
5
+ endpoint: 192.168.1.1
6
+ mtconnect-port: 8001
7
+ declare-keys:
8
+ - program_comment
9
+ - part_variant
10
+ - avail
11
+ variables:
12
+ extract:
13
+ - source: program_comment
14
+ - pattern-match:
15
+ pattern: /\(DNCI[^)]*\)[^)]*(?:\([^0-9)]*\)[^(]*?)?\(([^)]*?[0-9-]{4,}[^)]*?)\)/
16
+ group: 1
17
+ part_name_template:
18
+ - source: extract
19
+ - pattern-match:
20
+ pattern: /^(?:ALPHATEC-SPINE-|(?:[A-Za-z]+(?:[\s\-_&]?[A-Za-z2]*)*(?:[\s*_]|--))?)#?((?:[A-Za-z][A-Za-z\d]*-?)?[\dXKMLV]*(?:(?:[\-\/+._]|\sTHRU\s)[\dXKML]+)*)/
21
+ group: 1
22
+ range_pattern:
23
+ - source: part_name_template
24
+ - pattern-match:
25
+ pattern: /(?<=-)(X{2,3}|\d{1,3}[\/+_]\d{1,3}|\d*\sTHRU\s.*$)/
26
+ group: 1
27
+ character_count:
28
+ - source: range_pattern
29
+ - pattern-match:
30
+ pattern: /(?:^|[\/+_-])([X\d]+)$/
31
+ group: 1
32
+ - expression: size(this)
33
+ part_name:
34
+ - source: 'range_pattern == "" ? part_name_template : replace(part_name_template, range_pattern, lpad(part_variant, character_count, "0"))'
35
+ data-items:
36
+ - avail
37
+ - part_name_template
38
+ - part_name
@@ -0,0 +1,47 @@
1
+ version: 2
2
+ device: labjack-t4
3
+ host: 192.168.0.108
4
+ variables:
5
+ trigger-1:
6
+ - source: AIN0
7
+ - threshold: 5
8
+ - rising-edge
9
+ - off-delay: 0.1
10
+ trigger-2:
11
+ - source: AIN1
12
+ - threshold: 5
13
+ - rising-edge
14
+ - off-delay: 0.1
15
+ trigger-3:
16
+ - source: AIN2
17
+ - threshold: 5
18
+ - rising-edge
19
+ - off-delay: 0.1
20
+ trigger-4:
21
+ - source: AIN3
22
+ - threshold: 5
23
+ - rising-edge
24
+ - off-delay: 0.1
25
+ trigger-reset:
26
+ - source: trigger-1 or trigger-2 or trigger-3 or trigger-4
27
+ - off-delay: 10
28
+ - falling-edge
29
+ - off-delay: 0.1
30
+ counter-switch:
31
+ - state:
32
+ - TR1: trigger-1
33
+ - TR2: trigger-2
34
+ - TR3: trigger-3
35
+ - TR4: trigger-4
36
+ - IDLE: true
37
+ - latch-value:
38
+ reset: trigger-reset
39
+ reset-value: IDLE
40
+ latch-on-change: true
41
+ part-count:
42
+ - source: trigger-1 and counter-switch == "TR1"
43
+ - or: trigger-2 and counter-switch == "TR2"
44
+ - or: trigger-3 and counter-switch == "TR3"
45
+ - or: trigger-4 and counter-switch == "TR4"
46
+ - rising-edge
47
+ - count
@@ -0,0 +1,26 @@
1
+ version: 2
2
+ device: mtconnect-adapter
3
+ endpoint: 192.168.1.1
4
+ mtconnect-passthrough: false
5
+ mtconnect-port: 8001
6
+ declare-keys:
7
+ - program_comment
8
+ variables:
9
+ parsed_program1:
10
+ - source: program_comment
11
+ - pattern-match:
12
+ pattern: /\s*PART# ([^.)]*)/
13
+ parsed_program2:
14
+ - source: program_comment
15
+ - pattern-match:
16
+ pattern: /\(([^.)]*)/
17
+ group: 1
18
+ parsed_program:
19
+ - source: parsed_program1 == '' ? parsed_program2:parsed_program1
20
+ data-items:
21
+ operation_name:
22
+ value: parsed_program
23
+ temp_name1:
24
+ value: parsed_program1
25
+ temp_name2:
26
+ value: parsed_program2
@@ -0,0 +1,12 @@
1
+ version: 2
2
+ device: mtconnect-adapter
3
+ endpoint: localhost:8001
4
+ mtconnect-port: 8002
5
+ mtconnect-passthrough: false
6
+ declare-keys:
7
+ - active
8
+ - counter
9
+ variables:
10
+ var1:
11
+ - source: active
12
+ - debounce: 5
@@ -0,0 +1,34 @@
1
+ version: 2
2
+ device: mtconnect-adapter
3
+ endpoint: localhost:8001
4
+ mtconnect-port: 8002
5
+ declare-keys:
6
+ - xact
7
+ - counter
8
+ - data1
9
+ - data2
10
+ - data3
11
+ variables:
12
+ var1:
13
+ - source: xact
14
+ - expression: this + 5
15
+ var2:
16
+ - source: xact
17
+ - expression: "this > 5 ? 0 : this + counter"
18
+ var3:
19
+ - source: xact
20
+ - expression: counter + 10
21
+ var4:
22
+ - expression: xact + 5
23
+ var5:
24
+ - expression: this + xact + 5
25
+ var6:
26
+ - source: data1
27
+ - expression: this.foo + 5
28
+ var7:
29
+ - source: data2
30
+ - expression: this.foo.bar + 5
31
+ var8:
32
+ - source: data3
33
+ - expression: this.foo
34
+ - expression: this.bar + 5
@@ -0,0 +1,31 @@
1
+ version: 2
2
+ device: mtconnect-adapter
3
+ endpoint: localhost:8001
4
+ mtconnect-port: 8002
5
+ declare-keys:
6
+ - program
7
+ - pmode
8
+ variables:
9
+ test1:
10
+ - source: program
11
+ - ignore-value: warmup
12
+ test2:
13
+ - source: program
14
+ - ignore-value: ""
15
+ test3:
16
+ - source: program
17
+ - ignore-value:
18
+ pattern: /warmup\d*/
19
+ test4:
20
+ - source: program
21
+ - ignore-value:
22
+ expression: this == "warmup"
23
+ test5:
24
+ - source: program
25
+ - ignore-value:
26
+ expression: pmode == 5
27
+ test6:
28
+ - source: program
29
+ - ignore-value:
30
+ value: warmup
31
+ default: null
@@ -0,0 +1,11 @@
1
+ version: 2
2
+ device: mtconnect-adapter
3
+ endpoint: localhost:8001
4
+ mtconnect-port: 8002
5
+ declare-keys:
6
+ - counter
7
+ - execution
8
+ variables:
9
+ var1:
10
+ - source: counter
11
+ - latch: execution != 'ACTIVE'
@@ -0,0 +1,31 @@
1
+ version: 2
2
+ device: mtconnect-adapter
3
+ endpoint: localhost:8001
4
+ mtconnect-port: 8002
5
+ declare-keys:
6
+ - program
7
+ - pmode
8
+ variables:
9
+ test1:
10
+ - source: program
11
+ - latch-value
12
+ test2:
13
+ - source: program
14
+ - latch-value:
15
+ reset: pmode == 5
16
+ test3:
17
+ - source: program
18
+ - latch-value:
19
+ reset: pmode == 5
20
+ latch-on-change: true
21
+ test4:
22
+ - source: program
23
+ - latch-value:
24
+ reset: pmode == 5
25
+ reset-value: O0000
26
+ test5:
27
+ - source: program
28
+ - latch-value:
29
+ reset: pmode == 5
30
+ reset-value: O0000
31
+ latch-on-change: true
@@ -0,0 +1,14 @@
1
+ version: 2
2
+ device: mtconnect-adapter
3
+ endpoint: localhost:8001
4
+ mtconnect-port: 8002
5
+ declare-keys:
6
+ - active
7
+ - counter
8
+ variables:
9
+ var1:
10
+ - source: active
11
+ - and: counter > 0
12
+ var2:
13
+ - source: active
14
+ - and: true
@@ -0,0 +1,14 @@
1
+ version: 2
2
+ device: mtconnect-adapter
3
+ endpoint: localhost:8001
4
+ mtconnect-port: 8002
5
+ declare-keys:
6
+ - active
7
+ - counter
8
+ variables:
9
+ var1:
10
+ - source: active
11
+ - or: counter > 0
12
+ var2:
13
+ - source: active
14
+ - or: false
@@ -0,0 +1,19 @@
1
+ version: 2
2
+ device: mtconnect-adapter
3
+ endpoint: localhost:8001
4
+ mtconnect-port: 8002
5
+ declare-keys:
6
+ - active
7
+ - counter
8
+ - program
9
+ - complex
10
+ variables:
11
+ var1:
12
+ - source: counter
13
+ - map:
14
+ - value-increase
15
+ - count
16
+ var2:
17
+ - source: complex
18
+ - map:
19
+ - expression: this.subkey
@@ -0,0 +1,13 @@
1
+ version: 2
2
+ device: mtconnect-adapter
3
+ endpoint: localhost:8001
4
+ mtconnect-port: 8002
5
+ declare-keys:
6
+ - program
7
+ variables:
8
+ test1:
9
+ - source: program
10
+ - max-length: 7
11
+ test2:
12
+ - source: program
13
+ - max-length: 3
@@ -0,0 +1,12 @@
1
+ version: 2
2
+ device: mtconnect-adapter
3
+ endpoint: localhost:8001
4
+ mtconnect-port: 8002
5
+ mtconnect-passthrough: false
6
+ declare-keys:
7
+ - active
8
+ - counter
9
+ variables:
10
+ var1:
11
+ - source: active
12
+ - off-delay: 5
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ device: mtconnect-adapter
3
+ endpoint: localhost:8001
4
+ mtconnect-port: 8002
5
+ declare-keys:
6
+ - program
7
+ variables:
8
+ test1:
9
+ - source: program
10
+ - pattern-escape
@@ -0,0 +1,57 @@
1
+ version: 2
2
+ device: mtconnect-adapter
3
+ endpoint: localhost:8001
4
+ mtconnect-port: 8002
5
+ declare-keys:
6
+ - program
7
+ - program8
8
+ - program9
9
+ - pat1
10
+ variables:
11
+ match1:
12
+ - source: program
13
+ - pattern-match: /test\d+/i
14
+ match2:
15
+ - source: program
16
+ - pattern-match: "test\\d+"
17
+ match3:
18
+ - source: program
19
+ - pattern-match:
20
+ pattern: /test(\d+)/i
21
+ group: 1
22
+ else: NOMATCH
23
+ match4:
24
+ - source: program
25
+ - pattern-match: /test${pat1}/i
26
+ match5:
27
+ - source: program
28
+ - pattern-match:
29
+ pattern: /test(${pat1})/i
30
+ group: 1
31
+ else: no match ${this}
32
+ match6:
33
+ - source: program
34
+ - pattern-match:
35
+ pattern: /[\w.-]+/
36
+ index: 1
37
+ match7:
38
+ - source: program
39
+ - pattern-match:
40
+ pattern: /([\w.-]+)\./
41
+ group: 1
42
+ index: 1
43
+ match8:
44
+ - source: program8
45
+ - pattern-match:
46
+ pattern: /([\w.-]+)\./g
47
+ match9:
48
+ - source: program9
49
+ - pattern-match:
50
+ pattern: /([\w.-]+)\./g
51
+ group: 1
52
+ match10:
53
+ - source: program
54
+ - pattern-match:
55
+ pattern: /test(\d+)/i
56
+ group: 1
57
+ else: 0
@@ -0,0 +1,34 @@
1
+ version: 2
2
+ device: mtconnect-adapter
3
+ endpoint: localhost:8001
4
+ mtconnect-port: 8002
5
+ declare-keys:
6
+ - program
7
+ - xact
8
+ - yact
9
+ - pat1
10
+ - pat2
11
+ variables:
12
+ replace1:
13
+ - source: program
14
+ - pattern-replace:
15
+ pattern: /test\d+/
16
+ with: heck
17
+ replace2:
18
+ - source: program
19
+ - pattern-replace:
20
+ pattern: /test(\d+)/i
21
+ with: foo$1
22
+ else: NOMATCH
23
+ replace3:
24
+ - source: program
25
+ - pattern-replace:
26
+ pattern: /test${pat1}+/
27
+ with: heck ${xact}
28
+ else: coord ${xact},${yact} (${this})
29
+ replace4:
30
+ - source: program
31
+ - pattern-replace:
32
+ pattern: ${pat2}
33
+ with: ${xact * yact}
34
+ else: ${xact + yact}
@@ -0,0 +1,25 @@
1
+ version: 2
2
+ device: mtconnect-adapter
3
+ endpoint: localhost:8001
4
+ mtconnect-port: 8002
5
+ declare-keys:
6
+ - program
7
+ - pat1
8
+ variables:
9
+ test1:
10
+ - source: program
11
+ - pattern-test: /test\d+/
12
+ test2:
13
+ - source: program
14
+ - pattern-test: "test\\d+"
15
+ test3:
16
+ - source: program
17
+ - pattern-test:
18
+ pattern: /test(\d+)/i
19
+ test4:
20
+ - source: program
21
+ - pattern-test: /test${pat1}/
22
+ test5:
23
+ - source: program
24
+ - pattern-test:
25
+ pattern: /test(${pat1})/i
@@ -0,0 +1,24 @@
1
+ version: 2
2
+ device: mtconnect-adapter
3
+ endpoint: localhost:8001
4
+ mtconnect-port: 8002
5
+ declare-keys:
6
+ - program
7
+ variables:
8
+ test1:
9
+ - source: program
10
+ - reject: warmup
11
+ test2:
12
+ - source: program
13
+ - reject: ""
14
+ test3:
15
+ - source: program
16
+ - reject: null
17
+ test4:
18
+ - source: program
19
+ - reject:
20
+ pattern: /warmup\d*/
21
+ test5:
22
+ - source: program
23
+ - reject:
24
+ expression: this == "warmup"
@@ -0,0 +1,36 @@
1
+ version: 2
2
+ device: mtconnect-adapter
3
+ endpoint: localhost:8001
4
+ mtconnect-port: 8002
5
+ declare-keys:
6
+ - active
7
+ - counter
8
+ - program
9
+ - ppc
10
+ variables:
11
+ var1:
12
+ - source: active
13
+ - count
14
+ var2:
15
+ - source: active
16
+ - count:
17
+ reset: program == 10
18
+ var3:
19
+ - source: active
20
+ - count:
21
+ reset: this >= 3
22
+ var4:
23
+ - source: active
24
+ - count: 5
25
+ var5:
26
+ - source: active
27
+ - count:
28
+ amount: 5
29
+ reset: this > 10
30
+ var6:
31
+ - source: active
32
+ - count:
33
+ merge-window: 3
34
+ var7:
35
+ - source: active
36
+ - count: ppc
@@ -0,0 +1,20 @@
1
+ version: 2
2
+ device: mtconnect-adapter
3
+ endpoint: localhost:8001
4
+ mtconnect-port: 8002
5
+ declare-keys:
6
+ - xact
7
+ - yact
8
+ - execution
9
+ variables:
10
+ var1:
11
+ - source: xact
12
+ var2:
13
+ - source: xact + 10
14
+ var3:
15
+ - source: xact + yact
16
+ var4:
17
+ - source: xact
18
+ - expression: this + yact
19
+ var5:
20
+ - source: execution != 'MANUAL'
@@ -0,0 +1,56 @@
1
+ version: 2
2
+ device: mtconnect-adapter
3
+ endpoint: localhost:8001
4
+ mtconnect-port: 8002
5
+ declare-keys:
6
+ - is-running
7
+ - exec
8
+ - in-fault
9
+ variables:
10
+ test1:
11
+ - source: exec
12
+ - state:
13
+ - ACTIVE: this == 'ACTIVE' and not in-fault
14
+ - STOPPED: this == 'ACTIVE' and in-fault
15
+ test2:
16
+ - source: exec
17
+ - state:
18
+ - STOPPED: this == 'ACTIVE' and in-fault
19
+ test3:
20
+ - source: is-running
21
+ - state:
22
+ - ACTIVE: this
23
+ - READY: true
24
+ test4:
25
+ - source: exec
26
+ - state:
27
+ - select: This is a long active message
28
+ when: this == 'ACTIVE' and not in-fault
29
+ - select: This is a long stop message
30
+ when: this == 'ACTIVE' and in-fault
31
+ - select: This is a default message
32
+ when: true
33
+ test5:
34
+ - source: true
35
+ - state:
36
+ - ACTIVE: exec == 'ACTIVE' and not in-fault
37
+ - STOPPED: exec == 'ACTIVE' and in-fault
38
+ - READY: true
39
+ test6:
40
+ - state:
41
+ - ACTIVE: exec == 'ACTIVE' and not in-fault
42
+ - STOPPED: exec == 'ACTIVE' and in-fault
43
+ - READY: true
44
+ test7:
45
+ - state:
46
+ - ACTIVE: this == 'ACTIVE' and not in-fault
47
+ - STOPPED: this == 'ACTIVE' and in-fault
48
+ - READY: true
49
+ test8:
50
+ - state:
51
+ - ACTIVE: is-running
52
+ test9:
53
+ - state:
54
+ - 10: not in-fault
55
+ - 20: in-fault
56
+ - expression: this + exec
@@ -0,0 +1,19 @@
1
+ version: 2
2
+ device: mtconnect-adapter
3
+ endpoint: localhost:8001
4
+ mtconnect-port: 8002
5
+ declare-keys:
6
+ - active
7
+ - program
8
+ variables:
9
+ var1:
10
+ - source: active
11
+ - toggle
12
+ var2:
13
+ - source: active
14
+ - toggle:
15
+ default: true
16
+ var3:
17
+ - source: active
18
+ - toggle:
19
+ reset: program == 10
@@ -0,0 +1,19 @@
1
+ version: 2
2
+ device: mtconnect-adapter
3
+ endpoint: localhost:8001
4
+ mtconnect-port: 8002
5
+ declare-keys:
6
+ - active
7
+ - counter
8
+ variables:
9
+ var1:
10
+ - source: active
11
+ - when-unavailable: false
12
+ var2:
13
+ - source: active
14
+ - when-unavailable: counter
15
+ var3:
16
+ - source: active
17
+ - when-unavailable: false
18
+ - falling-edge
19
+ - count