node-opcua-service-subscription 2.85.0 → 2.86.1

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.
@@ -24,4 +24,4 @@ export declare function isOutsideDeadbandAbsolute(variant1: Variant, variant2: V
24
24
  * @method isOutsideDeadband
25
25
  * @return true if the element is outside deadBand
26
26
  */
27
- export declare function isOutsideDeadbandPercent(variant1: Variant, variant2: Variant, deadbandValue: number, range: PseudoRange): boolean;
27
+ export declare function isOutsideDeadbandPercent(variant1: Variant, variant2: Variant, deadbandValuePercent: number, range: PseudoRange): boolean;
@@ -45,7 +45,10 @@ function _isOutsideDeadbandScalar(value1, value2, dataType, absoluteDeadband) {
45
45
  }
46
46
  function isOutsideDeadbandVariant(v1, v2, absoluteDeadBand) {
47
47
  (0, node_opcua_assert_1.assert)(isFinite(absoluteDeadBand));
48
- if (v1.arrayType === node_opcua_variant_1.VariantArrayType.Array) {
48
+ if (v1.arrayType === node_opcua_variant_1.VariantArrayType.Array || v1.arrayType === node_opcua_variant_1.VariantArrayType.Matrix) {
49
+ // If the Value of the MonitoredItem is an array, then the deadband calculation logic shall be applied to
50
+ // each element of the array. If an element that requires a DataChange is found, then no further
51
+ // deadband checking is necessary and the entire array shall be returned.
49
52
  if (v1.dataType !== v2.dataType) {
50
53
  return true;
51
54
  }
@@ -69,40 +72,46 @@ function isOutsideDeadbandVariant(v1, v2, absoluteDeadBand) {
69
72
  return _isOutsideDeadbandScalar(v1.value, v2.value, v1.dataType, absoluteDeadBand);
70
73
  }
71
74
  }
72
- function isOnEdgeOfRangeScalar(currentValue, newValue, dataType, range) {
73
- if (dataType === node_opcua_variant_1.DataType.UInt64 || dataType === node_opcua_variant_1.DataType.Int64) {
74
- // istanbul ignore next
75
- if (!(currentValue instanceof Array && newValue instanceof Array)) {
76
- throw new Error("Invalid");
77
- }
78
- currentValue = currentValue[1];
79
- newValue = newValue[1];
80
- }
81
- if ( /*currentValue !== range.low && */newValue <= range.low) {
82
- return true;
83
- }
84
- if ( /*currentValue !== range.high && */newValue >= range.high) {
85
- return true;
86
- }
87
- return false;
88
- }
89
- function isOnEdgeOfRange(currentValue, newValue, range) {
90
- if (currentValue.arrayType === node_opcua_variant_1.VariantArrayType.Array) {
91
- const n = currentValue.value.length;
92
- let i = 0;
93
- for (i = 0; i < n; i++) {
94
- if (isOnEdgeOfRangeScalar(currentValue.value[i], newValue.value[i], newValue.dataType, range)) {
95
- return true;
96
- }
97
- }
98
- return false;
99
- }
100
- else {
101
- (0, node_opcua_assert_1.assert)(currentValue.arrayType === node_opcua_variant_1.VariantArrayType.Scalar);
102
- (0, node_opcua_assert_1.assert)(currentValue.dataType === newValue.dataType);
103
- return isOnEdgeOfRangeScalar(currentValue.value, newValue.value, currentValue.dataType, range);
104
- }
105
- }
75
+ // function isOnEdgeOfRangeScalar(
76
+ // currentValue: NumberType,
77
+ // newValue: NumberType,
78
+ // dataType: DataType,
79
+ // range: PseudoRange,
80
+ // deadbandValue: number
81
+ // ): boolean {
82
+ // if (dataType === DataType.UInt64 || dataType === DataType.Int64) {
83
+ // // istanbul ignore next
84
+ // if (!(currentValue instanceof Array && newValue instanceof Array)) {
85
+ // throw new Error("Invalid");
86
+ // }
87
+ // currentValue = currentValue[1];
88
+ // newValue = newValue[1];
89
+ // }
90
+ // if (Array.isArray(newValue)) throw new Error("internal error");
91
+ // if (/*currentValue !== range.low && */ Math.abs(newValue - range.low) < deadbandValue) {
92
+ // return true;
93
+ // }
94
+ // if (/*currentValue !== range.high && */ Math.abs(newValue - range.high) < deadbandValue) {
95
+ // return true;
96
+ // }
97
+ // return false;
98
+ // }
99
+ // function isOnEdgeOfRange(currentValue: Variant, newValue: Variant, range: PseudoRange, deadbandValue: number): boolean {
100
+ // if (currentValue.arrayType === VariantArrayType.Array) {
101
+ // const n = currentValue.value.length;
102
+ // let i = 0;
103
+ // for (i = 0; i < n; i++) {
104
+ // if (isOnEdgeOfRangeScalar(currentValue.value[i], newValue.value[i], newValue.dataType, range, deadbandValue)) {
105
+ // return true;
106
+ // }
107
+ // }
108
+ // return false;
109
+ // } else {
110
+ // assert(currentValue.arrayType === VariantArrayType.Scalar);
111
+ // assert(currentValue.dataType === newValue.dataType);
112
+ // return isOnEdgeOfRangeScalar(currentValue.value, newValue.value, currentValue.dataType, range, deadbandValue);
113
+ // }
114
+ // }
106
115
  /**
107
116
  * @method isOutsideDeadbandNone
108
117
  * @return true if the element is in deadBand
@@ -125,12 +134,7 @@ exports.isOutsideDeadbandAbsolute = isOutsideDeadbandAbsolute;
125
134
  * @method isOutsideDeadband
126
135
  * @return true if the element is outside deadBand
127
136
  */
128
- function isOutsideDeadbandPercent(variant1, variant2, deadbandValue, range) {
129
- // The range of the deadbandValue is from 0.0 to 100.0 Percent.
130
- (0, node_opcua_assert_1.assert)(deadbandValue >= 0 && deadbandValue <= 100);
131
- if (isOnEdgeOfRange(variant1, variant2, range)) {
132
- return true;
133
- }
137
+ function isOutsideDeadbandPercent(variant1, variant2, deadbandValuePercent, range) {
134
138
  // DeadbandType = PercentDeadband
135
139
  // For this type of deadband the deadbandValue is defined as the percentage of the EURange. That is,
136
140
  // it applies only to AnalogItems with an EURange Property that defines the typical value range for the
@@ -140,15 +144,14 @@ function isOutsideDeadbandPercent(variant1, variant2, deadbandValue, range) {
140
144
  // DataChange if (absolute value of (last cached value - current value) >
141
145
  // (deadbandValue/100.0) * ((high-low) of EURange)))
142
146
  //
143
- // Specifying a deadbandValue outside of this range will be rejected and reported with the
144
- // StatusCode BadDeadbandFilterInvalid (see Table 27).
145
- // If the Value of the MonitoredItem is an array, then the deadband calculation logic shall be applied to
146
- // each element of the array. If an element that requires a DataChange is found, then no further
147
- // deadband checking is necessary and the entire array shall be returned.
147
+ // The range of the deadbandValue is from 0.0 to 100.0 Percent.
148
+ (0, node_opcua_assert_1.assert)(deadbandValuePercent >= 0 && deadbandValuePercent <= 100);
148
149
  const valueRange = Math.abs(range.high - range.low);
149
- (0, node_opcua_assert_1.assert)(typeof valueRange === "number");
150
- const value = (deadbandValue / 100) * valueRange;
151
- return isOutsideDeadbandAbsolute(variant1, variant2, value);
150
+ const deadBandValueAbsolute = (deadbandValuePercent / 100.0) * valueRange;
151
+ // if (isOnEdgeOfRange(variant1, variant2, range, deadBandValueAbsolute)) {
152
+ // return true;
153
+ // }
154
+ return isOutsideDeadbandAbsolute(variant1, variant2, deadBandValueAbsolute);
152
155
  }
153
156
  exports.isOutsideDeadbandPercent = isOutsideDeadbandPercent;
154
157
  //# sourceMappingURL=deadband_checker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"deadband_checker.js","sourceRoot":"","sources":["../source/deadband_checker.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,yDAA2C;AAE3C,2DAAyE;AAEzE,IAAY,YAKX;AALD,WAAY,YAAY;IACpB,+CAAW,CAAA;IACX,uDAAe,CAAA;IACf,qDAAc,CAAA;IACd,wDAAgB,CAAA;AACpB,CAAC,EALW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,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;QAC7D,uBAAuB;QACvB,IAAI,CAAC,CAAC,MAAM,YAAY,KAAK,IAAI,MAAM,YAAY,KAAK,CAAC,EAAE;YACvD,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC;SAC9B;QACD,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO;QAC7B,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QACrB,IAAI,EAAE,KAAK,EAAE,EAAE;YACX,IAAI,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,UAAU,CAAC;YAC9B,IAAI,IAAI,CAAC,GA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AK,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;AAtBD,4DAsBC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-opcua-service-subscription",
3
- "version": "2.85.0",
3
+ "version": "2.86.1",
4
4
  "description": "pure nodejs OPCUA SDK - module -service-subscription",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -12,17 +12,17 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "node-opcua-assert": "2.77.0",
15
- "node-opcua-types": "2.85.0",
16
- "node-opcua-variant": "2.85.0"
15
+ "node-opcua-types": "2.86.1",
16
+ "node-opcua-variant": "2.86.1"
17
17
  },
18
18
  "devDependencies": {
19
- "node-opcua-buffer-utils": "2.85.0",
20
- "node-opcua-debug": "2.85.0",
21
- "node-opcua-nodeid": "2.85.0",
22
- "node-opcua-packet-analyzer": "2.85.0",
23
- "node-opcua-secure-channel": "2.85.0",
24
- "node-opcua-service-read": "2.85.0",
25
- "node-opcua-status-code": "2.85.0",
19
+ "node-opcua-buffer-utils": "2.86.0",
20
+ "node-opcua-debug": "2.86.0",
21
+ "node-opcua-nodeid": "2.86.0",
22
+ "node-opcua-packet-analyzer": "2.86.1",
23
+ "node-opcua-secure-channel": "2.86.1",
24
+ "node-opcua-service-read": "2.86.1",
25
+ "node-opcua-status-code": "2.86.1",
26
26
  "should": "^13.2.3"
27
27
  },
28
28
  "author": "Etienne Rossignon",
@@ -40,5 +40,5 @@
40
40
  "internet of things"
41
41
  ],
42
42
  "homepage": "http://node-opcua.github.io/",
43
- "gitHead": "68498fcf7b20ea9f7bd66e8529c546221daf5d52"
43
+ "gitHead": "389ba18585ff4b62f6fee58b69bd871a8e6b0dff"
44
44
  }
@@ -54,7 +54,10 @@ function _isOutsideDeadbandScalar(value1: NumberType, value2: NumberType, dataTy
54
54
  function isOutsideDeadbandVariant(v1: Variant, v2: Variant, absoluteDeadBand: number): boolean {
55
55
  assert(isFinite(absoluteDeadBand));
56
56
 
57
- if (v1.arrayType === VariantArrayType.Array) {
57
+ if (v1.arrayType === VariantArrayType.Array || v1.arrayType === VariantArrayType.Matrix) {
58
+ // If the Value of the MonitoredItem is an array, then the deadband calculation logic shall be applied to
59
+ // each element of the array. If an element that requires a DataChange is found, then no further
60
+ // deadband checking is necessary and the entire array shall be returned.
58
61
  if (v1.dataType !== v2.dataType) {
59
62
  return true;
60
63
  }
@@ -72,46 +75,53 @@ function isOutsideDeadbandVariant(v1: Variant, v2: Variant, absoluteDeadBand: nu
72
75
  return false;
73
76
  } else {
74
77
  assert(v1.arrayType === VariantArrayType.Scalar);
75
- if(v1.dataType !== v2.dataType) {
78
+ if (v1.dataType !== v2.dataType) {
76
79
  return true;
77
80
  }
78
81
  return _isOutsideDeadbandScalar(v1.value, v2.value, v1.dataType, absoluteDeadBand);
79
82
  }
80
83
  }
81
- function isOnEdgeOfRangeScalar(currentValue: NumberType, newValue: NumberType, dataType: DataType, range: PseudoRange): boolean {
82
- if (dataType === DataType.UInt64 || dataType === DataType.Int64) {
83
- // istanbul ignore next
84
- if (!(currentValue instanceof Array && newValue instanceof Array)) {
85
- throw new Error("Invalid");
86
- }
87
- currentValue = currentValue[1];
88
- newValue = newValue[1];
89
- }
90
- if (/*currentValue !== range.low && */ newValue <= range.low) {
91
- return true;
92
- }
93
- if (/*currentValue !== range.high && */ newValue >= range.high) {
94
- return true;
95
- }
96
- return false;
97
- }
84
+ // function isOnEdgeOfRangeScalar(
85
+ // currentValue: NumberType,
86
+ // newValue: NumberType,
87
+ // dataType: DataType,
88
+ // range: PseudoRange,
89
+ // deadbandValue: number
90
+ // ): boolean {
91
+ // if (dataType === DataType.UInt64 || dataType === DataType.Int64) {
92
+ // // istanbul ignore next
93
+ // if (!(currentValue instanceof Array && newValue instanceof Array)) {
94
+ // throw new Error("Invalid");
95
+ // }
96
+ // currentValue = currentValue[1];
97
+ // newValue = newValue[1];
98
+ // }
99
+ // if (Array.isArray(newValue)) throw new Error("internal error");
100
+ // if (/*currentValue !== range.low && */ Math.abs(newValue - range.low) < deadbandValue) {
101
+ // return true;
102
+ // }
103
+ // if (/*currentValue !== range.high && */ Math.abs(newValue - range.high) < deadbandValue) {
104
+ // return true;
105
+ // }
106
+ // return false;
107
+ // }
98
108
 
99
- function isOnEdgeOfRange(currentValue: Variant, newValue: Variant, range: PseudoRange): boolean {
100
- if (currentValue.arrayType === VariantArrayType.Array) {
101
- const n = currentValue.value.length;
102
- let i = 0;
103
- for (i = 0; i < n; i++) {
104
- if (isOnEdgeOfRangeScalar(currentValue.value[i], newValue.value[i], newValue.dataType, range)) {
105
- return true;
106
- }
107
- }
108
- return false;
109
- } else {
110
- assert(currentValue.arrayType === VariantArrayType.Scalar);
111
- assert(currentValue.dataType === newValue.dataType);
112
- return isOnEdgeOfRangeScalar(currentValue.value, newValue.value, currentValue.dataType, range);
113
- }
114
- }
109
+ // function isOnEdgeOfRange(currentValue: Variant, newValue: Variant, range: PseudoRange, deadbandValue: number): boolean {
110
+ // if (currentValue.arrayType === VariantArrayType.Array) {
111
+ // const n = currentValue.value.length;
112
+ // let i = 0;
113
+ // for (i = 0; i < n; i++) {
114
+ // if (isOnEdgeOfRangeScalar(currentValue.value[i], newValue.value[i], newValue.dataType, range, deadbandValue)) {
115
+ // return true;
116
+ // }
117
+ // }
118
+ // return false;
119
+ // } else {
120
+ // assert(currentValue.arrayType === VariantArrayType.Scalar);
121
+ // assert(currentValue.dataType === newValue.dataType);
122
+ // return isOnEdgeOfRangeScalar(currentValue.value, newValue.value, currentValue.dataType, range, deadbandValue);
123
+ // }
124
+ // }
115
125
 
116
126
  /**
117
127
  * @method isOutsideDeadbandNone
@@ -134,14 +144,7 @@ export function isOutsideDeadbandAbsolute(variant1: Variant, variant2: Variant,
134
144
  * @method isOutsideDeadband
135
145
  * @return true if the element is outside deadBand
136
146
  */
137
- export function isOutsideDeadbandPercent(variant1: Variant, variant2: Variant, deadbandValue: number, range: PseudoRange): boolean {
138
- // The range of the deadbandValue is from 0.0 to 100.0 Percent.
139
- assert(deadbandValue >= 0 && deadbandValue <= 100);
140
-
141
- if (isOnEdgeOfRange(variant1, variant2, range)) {
142
- return true;
143
- }
144
-
147
+ export function isOutsideDeadbandPercent(variant1: Variant, variant2: Variant, deadbandValuePercent: number, range: PseudoRange): boolean {
145
148
  // DeadbandType = PercentDeadband
146
149
  // For this type of deadband the deadbandValue is defined as the percentage of the EURange. That is,
147
150
  // it applies only to AnalogItems with an EURange Property that defines the typical value range for the
@@ -151,13 +154,16 @@ export function isOutsideDeadbandPercent(variant1: Variant, variant2: Variant, d
151
154
  // DataChange if (absolute value of (last cached value - current value) >
152
155
  // (deadbandValue/100.0) * ((high-low) of EURange)))
153
156
  //
154
- // Specifying a deadbandValue outside of this range will be rejected and reported with the
155
- // StatusCode BadDeadbandFilterInvalid (see Table 27).
156
- // If the Value of the MonitoredItem is an array, then the deadband calculation logic shall be applied to
157
- // each element of the array. If an element that requires a DataChange is found, then no further
158
- // deadband checking is necessary and the entire array shall be returned.
157
+
158
+ // The range of the deadbandValue is from 0.0 to 100.0 Percent.
159
+ assert(deadbandValuePercent >= 0 && deadbandValuePercent <= 100);
160
+
159
161
  const valueRange = Math.abs(range.high - range.low);
160
- assert(typeof valueRange === "number");
161
- const value = (deadbandValue / 100) * valueRange;
162
- return isOutsideDeadbandAbsolute(variant1, variant2, value);
162
+ const deadBandValueAbsolute = (deadbandValuePercent / 100.0) * valueRange;
163
+
164
+ // if (isOnEdgeOfRange(variant1, variant2, range, deadBandValueAbsolute)) {
165
+ // return true;
166
+ // }
167
+
168
+ return isOutsideDeadbandAbsolute(variant1, variant2, deadBandValueAbsolute);
163
169
  }