node-opcua-service-subscription 2.170.1 → 2.172.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.
package/dist/deadband_checker.js
CHANGED
|
@@ -23,7 +23,7 @@ function _isOutsideDeadbandScalar(value1, value2, dataType, absoluteDeadband) {
|
|
|
23
23
|
let diff;
|
|
24
24
|
if (dataType === node_opcua_variant_1.DataType.UInt64 || dataType === node_opcua_variant_1.DataType.Int64) {
|
|
25
25
|
// c8 ignore next
|
|
26
|
-
if (!(value1
|
|
26
|
+
if (!(Array.isArray(value1) && Array.isArray(value2))) {
|
|
27
27
|
throw new Error("Invalid");
|
|
28
28
|
}
|
|
29
29
|
const h1 = value1[0]; // high
|
|
@@ -35,19 +35,19 @@ function _isOutsideDeadbandScalar(value1, value2, dataType, absoluteDeadband) {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
diff = value1[1] - value2[1];
|
|
38
|
-
(0, node_opcua_assert_1.assert)(typeof diff === "number" && isFinite(diff));
|
|
38
|
+
(0, node_opcua_assert_1.assert)(typeof diff === "number" && Number.isFinite(diff));
|
|
39
39
|
return Math.abs(diff) > absoluteDeadband;
|
|
40
40
|
}
|
|
41
41
|
// c8 ignore next
|
|
42
42
|
if (!(typeof value1 === "number" && typeof value2 === "number")) {
|
|
43
|
-
throw new Error(
|
|
43
|
+
throw new Error(`Invalid value in _isOutsideDeadbandScalar > expecting number only but got ${typeof value1} ${typeof value2}`);
|
|
44
44
|
}
|
|
45
45
|
diff = value2 - value1;
|
|
46
|
-
(0, node_opcua_assert_1.assert)(typeof diff === "number" && isFinite(diff));
|
|
46
|
+
(0, node_opcua_assert_1.assert)(typeof diff === "number" && Number.isFinite(diff));
|
|
47
47
|
return Math.abs(diff) > absoluteDeadband;
|
|
48
48
|
}
|
|
49
49
|
function isOutsideDeadbandVariant(v1, v2, absoluteDeadBand) {
|
|
50
|
-
(0, node_opcua_assert_1.assert)(isFinite(absoluteDeadBand));
|
|
50
|
+
(0, node_opcua_assert_1.assert)(Number.isFinite(absoluteDeadBand));
|
|
51
51
|
if (v1.arrayType === node_opcua_variant_1.VariantArrayType.Array || v1.arrayType === node_opcua_variant_1.VariantArrayType.Matrix) {
|
|
52
52
|
// If the Value of the MonitoredItem is an array, then the deadband calculation logic shall be applied to
|
|
53
53
|
// each element of the array. If an element that requires a DataChange is found, then no further
|
|
@@ -84,7 +84,7 @@ function isOutsideDeadbandVariant(v1, v2, absoluteDeadBand) {
|
|
|
84
84
|
// ): boolean {
|
|
85
85
|
// if (dataType === DataType.UInt64 || dataType === DataType.Int64) {
|
|
86
86
|
// // c8 ignore next
|
|
87
|
-
// if (!(currentValue
|
|
87
|
+
// if (!(Array.isArray(currentValue) && Array.isArray(newValue))) {
|
|
88
88
|
// throw new Error("Invalid");
|
|
89
89
|
// }
|
|
90
90
|
// currentValue = currentValue[1];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deadband_checker.js","sourceRoot":"","sources":["../source/deadband_checker.ts"],"names":[],"mappings":";;;AAiIA,sDAGC;AAKD,8DAGC;AAMD,
|
|
1
|
+
{"version":3,"file":"deadband_checker.js","sourceRoot":"","sources":["../source/deadband_checker.ts"],"names":[],"mappings":";;;AAiIA,sDAGC;AAKD,8DAGC;AAMD,4DA2BC;AA7KD;;GAEG;AACH,yDAA2C;AAE3C,2DAA8E;AAE9E,IAAY,YAKX;AALD,WAAY,YAAY;IACpB,+CAAW,CAAA;IACX,uDAAe,CAAA;IACf,qDAAc,CAAA;IACd,wDAAgB,CAAA;AACpB,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB;AASD;;GAEG;AACH,SAAS,wBAAwB,CAAC,MAAkB,EAAE,MAAkB,EAAE,QAAkB,EAAE,gBAAwB;IAClH,IAAI,IAAI,CAAC;IACT,IAAI,QAAQ,KAAK,6BAAQ,CAAC,MAAM,IAAI,QAAQ,KAAK,6BAAQ,CAAC,KAAK,EAAE,CAAC;QAC9D,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AAC,oBAAoB,IAAI,CAAC,IAAI,oBAAoB,IAAI,GAAG,CAAC,CAAC;IAEjE,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;IACpD,MAAM,qBAAqB,GAAG,CAAC,oBAAoB,GAAG,KAAK,CAAC,GAAG,UAAU,CAAC;IAE1E,2EAA2E;IAC3E,mBAAmB;IACnB,IAAI;IAEJ,OAAO,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,EAAE,qBAAqB,CAAC,CAAC;AAChF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-service-subscription",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.172.0",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - module service-subscription",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -13,17 +13,17 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"node-opcua-assert": "2.164.0",
|
|
16
|
-
"node-opcua-types": "2.
|
|
17
|
-
"node-opcua-variant": "2.
|
|
16
|
+
"node-opcua-types": "2.172.0",
|
|
17
|
+
"node-opcua-variant": "2.172.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"node-opcua-buffer-utils": "2.
|
|
21
|
-
"node-opcua-debug": "2.
|
|
22
|
-
"node-opcua-nodeid": "2.
|
|
23
|
-
"node-opcua-packet-analyzer": "2.
|
|
24
|
-
"node-opcua-secure-channel": "2.
|
|
25
|
-
"node-opcua-service-read": "2.
|
|
26
|
-
"node-opcua-status-code": "2.
|
|
20
|
+
"node-opcua-buffer-utils": "2.172.0",
|
|
21
|
+
"node-opcua-debug": "2.172.0",
|
|
22
|
+
"node-opcua-nodeid": "2.172.0",
|
|
23
|
+
"node-opcua-packet-analyzer": "2.172.0",
|
|
24
|
+
"node-opcua-secure-channel": "2.172.0",
|
|
25
|
+
"node-opcua-service-read": "2.172.0",
|
|
26
|
+
"node-opcua-status-code": "2.172.0"
|
|
27
27
|
},
|
|
28
28
|
"author": "Etienne Rossignon",
|
|
29
29
|
"license": "MIT",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"internet of things"
|
|
41
41
|
],
|
|
42
42
|
"homepage": "http://node-opcua.github.io/",
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "dfe9993a93b5c3897825e898b5f07b25952c7f45",
|
|
44
44
|
"files": [
|
|
45
45
|
"dist",
|
|
46
46
|
"source"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { assert } from "node-opcua-assert";
|
|
5
5
|
|
|
6
|
-
import { DataType, Variant, VariantArrayType } from "node-opcua-variant";
|
|
6
|
+
import { DataType, type Variant, VariantArrayType } from "node-opcua-variant";
|
|
7
7
|
|
|
8
8
|
export enum DeadbandType {
|
|
9
9
|
None = 0x00,
|
|
@@ -26,7 +26,7 @@ function _isOutsideDeadbandScalar(value1: NumberType, value2: NumberType, dataTy
|
|
|
26
26
|
let diff;
|
|
27
27
|
if (dataType === DataType.UInt64 || dataType === DataType.Int64) {
|
|
28
28
|
// c8 ignore next
|
|
29
|
-
if (!(value1
|
|
29
|
+
if (!(Array.isArray(value1) && Array.isArray(value2))) {
|
|
30
30
|
throw new Error("Invalid");
|
|
31
31
|
}
|
|
32
32
|
const h1 = value1[0]; // high
|
|
@@ -38,21 +38,21 @@ function _isOutsideDeadbandScalar(value1: NumberType, value2: NumberType, dataTy
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
diff = value1[1] - value2[1];
|
|
41
|
-
assert(typeof diff === "number" && isFinite(diff));
|
|
41
|
+
assert(typeof diff === "number" && Number.isFinite(diff));
|
|
42
42
|
return Math.abs(diff) > absoluteDeadband;
|
|
43
43
|
}
|
|
44
44
|
// c8 ignore next
|
|
45
45
|
if (!(typeof value1 === "number" && typeof value2 === "number")) {
|
|
46
46
|
throw new Error(
|
|
47
|
-
|
|
47
|
+
`Invalid value in _isOutsideDeadbandScalar > expecting number only but got ${typeof value1} ${typeof value2}`
|
|
48
48
|
);
|
|
49
49
|
}
|
|
50
50
|
diff = value2 - value1;
|
|
51
|
-
assert(typeof diff === "number" && isFinite(diff));
|
|
51
|
+
assert(typeof diff === "number" && Number.isFinite(diff));
|
|
52
52
|
return Math.abs(diff) > absoluteDeadband;
|
|
53
53
|
}
|
|
54
54
|
function isOutsideDeadbandVariant(v1: Variant, v2: Variant, absoluteDeadBand: number): boolean {
|
|
55
|
-
assert(isFinite(absoluteDeadBand));
|
|
55
|
+
assert(Number.isFinite(absoluteDeadBand));
|
|
56
56
|
|
|
57
57
|
if (v1.arrayType === VariantArrayType.Array || v1.arrayType === VariantArrayType.Matrix) {
|
|
58
58
|
// If the Value of the MonitoredItem is an array, then the deadband calculation logic shall be applied to
|
|
@@ -90,7 +90,7 @@ function isOutsideDeadbandVariant(v1: Variant, v2: Variant, absoluteDeadBand: nu
|
|
|
90
90
|
// ): boolean {
|
|
91
91
|
// if (dataType === DataType.UInt64 || dataType === DataType.Int64) {
|
|
92
92
|
// // c8 ignore next
|
|
93
|
-
// if (!(currentValue
|
|
93
|
+
// if (!(Array.isArray(currentValue) && Array.isArray(newValue))) {
|
|
94
94
|
// throw new Error("Invalid");
|
|
95
95
|
// }
|
|
96
96
|
// currentValue = currentValue[1];
|
|
@@ -144,7 +144,12 @@ export function isOutsideDeadbandAbsolute(variant1: Variant, variant2: Variant,
|
|
|
144
144
|
|
|
145
145
|
* @return true if the element is outside deadBand
|
|
146
146
|
*/
|
|
147
|
-
export function isOutsideDeadbandPercent(
|
|
147
|
+
export function isOutsideDeadbandPercent(
|
|
148
|
+
variant1: Variant,
|
|
149
|
+
variant2: Variant,
|
|
150
|
+
deadbandValuePercent: number,
|
|
151
|
+
range: PseudoRange
|
|
152
|
+
): boolean {
|
|
148
153
|
// DeadbandType = PercentDeadband
|
|
149
154
|
// For this type of deadband the deadbandValue is defined as the percentage of the EURange. That is,
|
|
150
155
|
// it applies only to AnalogItems with an EURange Property that defines the typical value range for the
|