node-opcua-address-space 2.74.0 → 2.75.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/source/helpers/argument_list.js +1 -0
- package/dist/source/helpers/argument_list.js.map +1 -1
- package/dist/source/helpers/multiform_func.js +4 -2
- package/dist/source/helpers/multiform_func.js.map +1 -1
- package/dist/source/index.d.ts +0 -2
- package/dist/source/index.js +1 -5
- package/dist/source/index.js.map +1 -1
- package/dist/source/interfaces/alarms_and_conditions/condition_snapshot.d.ts +5 -11
- package/dist/source/interfaces/alarms_and_conditions/condition_snapshot.js +0 -7
- package/dist/source/interfaces/alarms_and_conditions/condition_snapshot.js.map +1 -1
- package/dist/source/interfaces/alarms_and_conditions/deviation_stuff.d.ts +4 -6
- package/dist/source/interfaces/alarms_and_conditions/install_setpoint_options.d.ts +4 -0
- package/dist/source/interfaces/alarms_and_conditions/instantiate_exclusive_deviation_alarm_options.d.ts +4 -0
- package/dist/source/interfaces/alarms_and_conditions/instantiate_exclusive_deviation_alarm_options.js +3 -0
- package/dist/source/interfaces/alarms_and_conditions/instantiate_exclusive_deviation_alarm_options.js.map +1 -0
- package/dist/source/interfaces/alarms_and_conditions/instantiate_limit_alarm_options.d.ts +2 -2
- package/dist/source/interfaces/alarms_and_conditions/instantiate_non_exclusive_deviation_alarm_options.d.ts +4 -0
- package/dist/source/interfaces/alarms_and_conditions/instantiate_non_exclusive_deviation_alarm_options.js +3 -0
- package/dist/source/interfaces/alarms_and_conditions/instantiate_non_exclusive_deviation_alarm_options.js.map +1 -0
- package/dist/source/interfaces/alarms_and_conditions/instantiate_non_exclusive_limit_alarm_options.d.ts +4 -0
- package/dist/source/interfaces/alarms_and_conditions/instantiate_non_exclusive_limit_alarm_options.js +3 -0
- package/dist/source/interfaces/alarms_and_conditions/instantiate_non_exclusive_limit_alarm_options.js.map +1 -0
- package/dist/source/interfaces/alarms_and_conditions/instantiate_off_normal_alarm_options.d.ts +16 -1
- package/dist/source/interfaces/alarms_and_conditions/ua_exclusive_deviation_alarm_ex.d.ts +1 -1
- package/dist/source/interfaces/alarms_and_conditions/ua_non_exclusive_deviation_alarm_ex.d.ts +2 -4
- package/dist/source/namespace_alarm_and_condition.d.ts +19 -11
- package/dist/src/address_space.js +17 -12
- package/dist/src/address_space.js.map +1 -1
- package/dist/src/alarms_and_conditions/condition.js +1 -1
- package/dist/src/alarms_and_conditions/condition_snapshot_impl.d.ts +3 -12
- package/dist/src/alarms_and_conditions/condition_snapshot_impl.js +84 -93
- package/dist/src/alarms_and_conditions/condition_snapshot_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/deviation_alarm_helper.d.ts +3 -2
- package/dist/src/alarms_and_conditions/deviation_alarm_helper.js +27 -12
- package/dist/src/alarms_and_conditions/deviation_alarm_helper.js.map +1 -1
- package/dist/src/alarms_and_conditions/index.d.ts +0 -2
- package/dist/src/alarms_and_conditions/index.js +0 -2
- package/dist/src/alarms_and_conditions/index.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_condition_impl.js +5 -5
- package/dist/src/alarms_and_conditions/ua_condition_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.d.ts +4 -6
- package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_limit_alarm_impl.d.ts +13 -13
- package/dist/src/alarms_and_conditions/ua_limit_alarm_impl.js +15 -15
- package/dist/src/alarms_and_conditions/ua_limit_alarm_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.d.ts +3 -3
- package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.js +18 -13
- package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.js.map +1 -1
- package/dist/src/event_data.d.ts +22 -17
- package/dist/src/event_data.js +33 -64
- package/dist/src/event_data.js.map +1 -1
- package/dist/src/index_current.d.ts +0 -1
- package/dist/src/index_current.js +0 -1
- package/dist/src/index_current.js.map +1 -1
- package/dist/src/namespace_impl.d.ts +14 -11
- package/dist/src/namespace_impl.js.map +1 -1
- package/dist/src/state_machine/ua_two_state_variable.js +1 -1
- package/dist/src/state_machine/ua_two_state_variable.js.map +1 -1
- package/dist/src/ua_object_impl.js +0 -1
- package/dist/src/ua_object_impl.js.map +1 -1
- package/dist/src/ua_reference_type_impl.d.ts +1 -1
- package/distHelpers/alarms_and_conditions_demo.js +2 -1
- package/distHelpers/alarms_and_conditions_demo.js.map +1 -1
- package/package.json +22 -22
- package/source/helpers/argument_list.ts +2 -0
- package/source/helpers/multiform_func.ts +5 -3
- package/source/index.ts +0 -2
- package/source/interfaces/alarms_and_conditions/condition_snapshot.ts +12 -30
- package/source/interfaces/alarms_and_conditions/deviation_stuff.ts +8 -6
- package/source/interfaces/alarms_and_conditions/install_setpoint_options.ts +9 -0
- package/source/interfaces/alarms_and_conditions/instantiate_exclusive_deviation_alarm_options.ts +4 -0
- package/source/interfaces/alarms_and_conditions/instantiate_limit_alarm_options.ts +2 -2
- package/source/interfaces/alarms_and_conditions/instantiate_non_exclusive_deviation_alarm_options.ts +4 -0
- package/source/interfaces/alarms_and_conditions/instantiate_non_exclusive_limit_alarm_options.ts +4 -0
- package/source/interfaces/alarms_and_conditions/instantiate_off_normal_alarm_options.ts +16 -1
- package/source/interfaces/alarms_and_conditions/ua_exclusive_deviation_alarm_ex.ts +1 -0
- package/source/interfaces/alarms_and_conditions/ua_non_exclusive_deviation_alarm_ex.ts +1 -2
- package/source/namespace_alarm_and_condition.ts +48 -23
- package/src/address_space.ts +22 -16
- package/src/alarms_and_conditions/condition.ts +1 -1
- package/src/alarms_and_conditions/condition_snapshot_impl.ts +95 -102
- package/src/alarms_and_conditions/deviation_alarm_helper.ts +33 -18
- package/src/alarms_and_conditions/index.ts +0 -2
- package/src/alarms_and_conditions/ua_condition_impl.ts +5 -5
- package/src/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.ts +5 -6
- package/src/alarms_and_conditions/ua_limit_alarm_impl.ts +6 -8
- package/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.ts +5 -3
- package/src/alarms_and_conditions/ua_off_normal_alarm_impl.ts +18 -16
- package/src/event_data.ts +47 -77
- package/src/index_current.ts +0 -1
- package/src/namespace_impl.ts +47 -26
- package/src/state_machine/ua_two_state_variable.ts +1 -1
- package/src/ua_object_impl.ts +1 -2
- package/test_helpers/alarms_and_conditions_demo.ts +4 -1
- package/source/helpers/check_event_clause.ts +0 -55
- package/src/alarms_and_conditions/check_where_clause.ts +0 -147
- package/src/alarms_and_conditions/extract_event_fields.ts +0 -103
|
@@ -14,9 +14,7 @@ import { UAShelvedStateMachineEx } from "../../source";
|
|
|
14
14
|
import { InstantiateLimitAlarmOptions } from "../../source/interfaces/alarms_and_conditions/instantiate_limit_alarm_options";
|
|
15
15
|
import { UALimitAlarmEx } from "../../source/interfaces/alarms_and_conditions/ua_limit_alarm_ex";
|
|
16
16
|
import { NamespacePrivate } from "../namespace_private";
|
|
17
|
-
import {
|
|
18
|
-
UAAlarmConditionImpl
|
|
19
|
-
} from "./ua_alarm_condition_impl";
|
|
17
|
+
import { UAAlarmConditionImpl } from "./ua_alarm_condition_impl";
|
|
20
18
|
|
|
21
19
|
const warningLog = make_warningLog("AlarmsAndConditions");
|
|
22
20
|
|
|
@@ -35,11 +33,11 @@ const uaLimitAlarmInputSupportedDataType: DataType[] = [
|
|
|
35
33
|
DataType.UInt32
|
|
36
34
|
];
|
|
37
35
|
|
|
38
|
-
export interface UALimitAlarmImpl extends UALimitAlarmEx
|
|
36
|
+
export interface UALimitAlarmImpl extends UALimitAlarmEx {
|
|
39
37
|
shelvingState?: UAShelvedStateMachineEx;
|
|
40
38
|
}
|
|
41
39
|
export class UALimitAlarmImpl extends UAAlarmConditionImpl implements UALimitAlarmEx {
|
|
42
|
-
|
|
40
|
+
/**
|
|
43
41
|
* @method (static)UALimitAlarm.instantiate
|
|
44
42
|
* @param namespace {INamespace}
|
|
45
43
|
* @param limitAlarmTypeId
|
|
@@ -127,8 +125,8 @@ export class UALimitAlarmImpl extends UAAlarmConditionImpl implements UALimitAla
|
|
|
127
125
|
throw new Error(message);
|
|
128
126
|
}
|
|
129
127
|
|
|
130
|
-
if (Object.prototype.hasOwnProperty.call(options, "highHighLimit")) {
|
|
131
|
-
alarmNode.setHighHighLimit(options.highHighLimit);
|
|
128
|
+
if (Object.prototype.hasOwnProperty.call(options, "highHighLimit") && options.highHighLimit !== undefined) {
|
|
129
|
+
alarmNode.setHighHighLimit(options.highHighLimit!);
|
|
132
130
|
}
|
|
133
131
|
if (Object.prototype.hasOwnProperty.call(options, "highLimit")) {
|
|
134
132
|
alarmNode.setHighLimit(options.highLimit);
|
|
@@ -136,7 +134,7 @@ export class UALimitAlarmImpl extends UAAlarmConditionImpl implements UALimitAla
|
|
|
136
134
|
if (Object.prototype.hasOwnProperty.call(options, "lowLimit")) {
|
|
137
135
|
alarmNode.setLowLimit(options.lowLimit);
|
|
138
136
|
}
|
|
139
|
-
if (Object.prototype.hasOwnProperty.call(options, "lowLowLimit")) {
|
|
137
|
+
if (Object.prototype.hasOwnProperty.call(options, "lowLowLimit") && options.lowLowLimit != undefined) {
|
|
140
138
|
alarmNode.setLowLowLimit(options.lowLowLimit);
|
|
141
139
|
}
|
|
142
140
|
|
|
@@ -6,8 +6,8 @@ import { assert } from "node-opcua-assert";
|
|
|
6
6
|
|
|
7
7
|
import { DataValue } from "node-opcua-data-value";
|
|
8
8
|
import { NodeId } from "node-opcua-nodeid";
|
|
9
|
-
import { VariantOptions } from "node-opcua-variant";
|
|
10
|
-
import { UAVariable } from "node-opcua-address-space-base";
|
|
9
|
+
import { DataType, VariantOptions } from "node-opcua-variant";
|
|
10
|
+
import { UAVariable, UAVariableT } from "node-opcua-address-space-base";
|
|
11
11
|
import { NamespacePrivate } from "../namespace_private";
|
|
12
12
|
import { AddressSpace } from "../address_space";
|
|
13
13
|
import { InstantiateLimitAlarmOptions } from "../../source/interfaces/alarms_and_conditions/instantiate_limit_alarm_options";
|
|
@@ -20,6 +20,8 @@ import {
|
|
|
20
20
|
} from "./deviation_alarm_helper";
|
|
21
21
|
import { UALimitAlarmImpl } from "./ua_limit_alarm_impl";
|
|
22
22
|
import { UANonExclusiveLimitAlarmImpl } from "./ua_non_exclusive_limit_alarm_impl";
|
|
23
|
+
|
|
24
|
+
|
|
23
25
|
export declare interface UANonExclusiveDeviationAlarmImpl extends UANonExclusiveLimitAlarmImpl, UANonExclusiveDeviationAlarmEx {
|
|
24
26
|
on(eventName: string, eventHandler: any): this;
|
|
25
27
|
get addressSpace(): AddressSpace;
|
|
@@ -63,7 +65,7 @@ export class UANonExclusiveDeviationAlarmImpl extends UANonExclusiveLimitAlarmIm
|
|
|
63
65
|
super._setStateBasedOnInputValue(value - setpointValue);
|
|
64
66
|
}
|
|
65
67
|
|
|
66
|
-
public getSetpointNodeNode():
|
|
68
|
+
public getSetpointNodeNode(): UAVariableT<number, DataType.Double> | UAVariableT<number, DataType.Float> | undefined {
|
|
67
69
|
return DeviationAlarmHelper_getSetpointNodeNode.call(this);
|
|
68
70
|
}
|
|
69
71
|
|
|
@@ -12,7 +12,7 @@ import { DataType, VariantOptions } from "node-opcua-variant";
|
|
|
12
12
|
import { InstantiateOffNormalAlarmOptions } from "../../source/interfaces/alarms_and_conditions/instantiate_off_normal_alarm_options";
|
|
13
13
|
import { UADiscreteAlarmEx } from "../../source/interfaces/alarms_and_conditions/ua_discrete_alarm_ex";
|
|
14
14
|
import { AddressSpacePrivate } from "../address_space_private";
|
|
15
|
-
import {
|
|
15
|
+
import { UADiscreteAlarmImpl } from "./ua_discrete_alarm_impl";
|
|
16
16
|
|
|
17
17
|
function isEqual(value1: any, value2: any) {
|
|
18
18
|
return value1 === value2;
|
|
@@ -39,7 +39,6 @@ export declare interface UAOffNormalAlarmEx
|
|
|
39
39
|
setNormalStateValue(value: any): void;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
|
|
43
42
|
export declare interface UAOffNormalAlarmImpl extends UAOffNormalAlarmEx, UADiscreteAlarmImpl {
|
|
44
43
|
on(eventName: string, eventHandler: any): this;
|
|
45
44
|
}
|
|
@@ -103,21 +102,24 @@ export class UAOffNormalAlarmImpl extends UADiscreteAlarmImpl implements UAOffNo
|
|
|
103
102
|
* If this Variable is not in the AddressSpace, a NULL NodeId shall be provided.
|
|
104
103
|
*
|
|
105
104
|
*/
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
if (normalState) {
|
|
117
|
-
// install normalState monitoring for change
|
|
118
|
-
normalState.on("value_changed", (newDataValue: DataValue /*, oldDataValue: DataValue*/) => {
|
|
119
|
-
alarmNode._onNormalStateDataValueChange(newDataValue);
|
|
105
|
+
if (options.normalState) {
|
|
106
|
+
const normalState = addressSpace._coerceNode(options.normalState) as UAVariable | null;
|
|
107
|
+
const normalStateNodeId = normalState ? normalState.nodeId : new NodeId();
|
|
108
|
+
alarmNode.normalState.setValueFromSource({ dataType: DataType.NodeId, value: normalStateNodeId });
|
|
109
|
+
alarmNode.normalState.on("value_changed", (newDataValue: DataValue /*, oldDataValue: DataValue*/) => {
|
|
110
|
+
// The node that contains the normalState value has changed.
|
|
111
|
+
// we must remove the listener on current normalState and replace
|
|
112
|
+
// normalState with the new one and set listener again
|
|
113
|
+
// to do:
|
|
120
114
|
});
|
|
115
|
+
if (normalState) {
|
|
116
|
+
// install normalState monitoring for change
|
|
117
|
+
normalState.on("value_changed", (newDataValue: DataValue /*, oldDataValue: DataValue*/) => {
|
|
118
|
+
alarmNode._onNormalStateDataValueChange(newDataValue);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
} else {
|
|
122
|
+
alarmNode.normalState.setValueFromSource({ dataType: DataType.NodeId, value: NodeId.nullNodeId });
|
|
121
123
|
}
|
|
122
124
|
|
|
123
125
|
alarmNode._mayBe_updateAlarmState();
|
package/src/event_data.ts
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
* @module node-opcua-address-space.Private
|
|
3
3
|
*/
|
|
4
4
|
import { assert } from "node-opcua-assert";
|
|
5
|
-
import {
|
|
6
|
-
import { DataValue } from "node-opcua-data-value";
|
|
7
|
-
import { NodeId } from "node-opcua-nodeid";
|
|
8
|
-
import { constructBrowsePathFromQualifiedName } from "node-opcua-service-translate-browse-path";
|
|
5
|
+
import { coerceExpandedNodeId, NodeId, sameNodeId } from "node-opcua-nodeid";
|
|
9
6
|
import { StatusCodes } from "node-opcua-status-code";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
7
|
+
import { BrowsePath, BrowsePathResult } from "node-opcua-types";
|
|
8
|
+
import { Variant, VariantLike } from "node-opcua-variant";
|
|
12
9
|
|
|
13
|
-
import {
|
|
10
|
+
import { BaseNode, IEventData } from "node-opcua-address-space-base";
|
|
11
|
+
import { lowerFirstLetter } from "node-opcua-utils";
|
|
14
12
|
|
|
13
|
+
type NodeIdString = string;
|
|
14
|
+
type FullBrowsePath = string;
|
|
15
15
|
/**
|
|
16
16
|
* @class EventData
|
|
17
17
|
* @param eventTypeNode {BaseNode}
|
|
@@ -21,91 +21,61 @@ export class EventData implements IEventData {
|
|
|
21
21
|
public eventId: NodeId;
|
|
22
22
|
public $eventDataSource: BaseNode;
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
public $cache: {
|
|
25
|
+
__values: { [key: NodeIdString]: Variant };
|
|
26
|
+
__nodeIdToNode: { [key: NodeIdString]: BaseNode };
|
|
27
|
+
__pathToNodeId: { [key: FullBrowsePath]: NodeId };
|
|
28
|
+
__nodeIdToFullPath: { [key: NodeIdString]: FullBrowsePath };
|
|
29
|
+
};
|
|
25
30
|
|
|
26
31
|
constructor(eventTypeNode: BaseNode) {
|
|
27
|
-
this
|
|
32
|
+
this.$cache = {
|
|
33
|
+
__values: {},
|
|
34
|
+
__nodeIdToNode: {},
|
|
35
|
+
__pathToNodeId: {},
|
|
36
|
+
__nodeIdToFullPath: {}
|
|
37
|
+
};
|
|
38
|
+
|
|
28
39
|
this.eventId = new NodeId();
|
|
29
40
|
this.$eventDataSource = eventTypeNode;
|
|
30
41
|
}
|
|
31
42
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
* @return {NodeId|null}
|
|
36
|
-
*/
|
|
37
|
-
public resolveSelectClause(selectClause: SimpleAttributeOperand): NodeId | null {
|
|
38
|
-
assert(selectClause instanceof SimpleAttributeOperand);
|
|
39
|
-
const addressSpace = this.$eventDataSource.addressSpace;
|
|
40
|
-
|
|
41
|
-
if (selectClause.browsePath!.length === 0 && selectClause.attributeId === AttributeIds.NodeId) {
|
|
42
|
-
assert(!"Cannot use resolveSelectClause on this selectClause as it has no browsePath");
|
|
43
|
-
}
|
|
44
|
-
// navigate to the innerNode specified by the browsePath [ QualifiedName]
|
|
45
|
-
const browsePath = constructBrowsePathFromQualifiedName(this.$eventDataSource, selectClause.browsePath);
|
|
43
|
+
public _createValue(fullBrowsePath: string, node: BaseNode, variant: VariantLike): void {
|
|
44
|
+
const eventData = this as any;
|
|
45
|
+
assert(!eventData[fullBrowsePath], "already exists " + fullBrowsePath);
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
// xx console.log("xx browse Path", browsePath.toString());
|
|
47
|
+
const lowerName = fullBrowsePath.split(".").map(lowerFirstLetter).join(".");
|
|
49
48
|
|
|
50
|
-
|
|
49
|
+
eventData[lowerName] = Variant.coerce(variant);
|
|
51
50
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
this.$cache.__pathToNodeId[fullBrowsePath] = node.nodeId;
|
|
52
|
+
this.$cache.__nodeIdToNode[node.nodeId.toString()] = node;
|
|
53
|
+
this.$cache.__nodeIdToFullPath[node.nodeId.toString()] = fullBrowsePath;
|
|
54
|
+
this.$cache.__values[node.nodeId.toString()] = eventData[lowerName];
|
|
55
|
+
}
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
if (!browsePathResult.targets) {
|
|
57
|
+
public _browse(browsePath: BrowsePath): BrowsePathResult | null {
|
|
58
|
+
if (!sameNodeId(browsePath.startingNode, this.$eventDataSource.nodeId)) {
|
|
61
59
|
return null;
|
|
62
60
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
61
|
+
const fullBrowsePath = (browsePath.relativePath.elements || []).map((b=>b.targetName.toString())).join(".");
|
|
62
|
+
const nodeId = this.$cache.__pathToNodeId[fullBrowsePath];
|
|
63
|
+
if (!nodeId) return null;
|
|
64
|
+
return new BrowsePathResult({
|
|
65
|
+
statusCode: StatusCodes.Good,
|
|
66
|
+
targets: [{
|
|
67
|
+
remainingPathIndex: 0,
|
|
68
|
+
targetId: coerceExpandedNodeId(nodeId),
|
|
69
|
+
}]
|
|
70
|
+
})
|
|
70
71
|
}
|
|
71
72
|
|
|
72
|
-
public
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
eventData.__nodes[node.nodeId.toString()] = eventData[lowerName];
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* @method readValue
|
|
79
|
-
* @param nodeId {NodeId}
|
|
80
|
-
* @param selectClause {SimpleAttributeOperand}
|
|
81
|
-
* @return {Variant}
|
|
82
|
-
*/
|
|
83
|
-
public readValue(sessionContext: ISessionContext, nodeId: NodeId, selectClause: SimpleAttributeOperand): Variant {
|
|
84
|
-
assert(nodeId instanceof NodeId);
|
|
85
|
-
assert(selectClause instanceof SimpleAttributeOperand);
|
|
86
|
-
assert(nodeId instanceof NodeId);
|
|
87
|
-
const addressSpace = this.$eventDataSource.addressSpace;
|
|
88
|
-
|
|
89
|
-
const node = addressSpace.findNode(nodeId)!;
|
|
90
|
-
const key = node.nodeId.toString();
|
|
91
|
-
|
|
92
|
-
// if the value exists in cache ... we read it from cache...
|
|
93
|
-
const cached_value = this.__nodes[key];
|
|
73
|
+
public _readValue(nodeId: NodeId): Variant | null {
|
|
74
|
+
const key = nodeId.toString();
|
|
75
|
+
const cached_value = this.$cache.__values[key];
|
|
94
76
|
if (cached_value) {
|
|
95
77
|
return cached_value;
|
|
96
78
|
}
|
|
97
|
-
|
|
98
|
-
if (node.nodeClass === NodeClass.Variable && selectClause.attributeId === AttributeIds.Value) {
|
|
99
|
-
const nodeVariable = node as UAVariable;
|
|
100
|
-
return prepare(nodeVariable.readValue(sessionContext, selectClause.indexRange));
|
|
101
|
-
}
|
|
102
|
-
return prepare(node.readAttribute(sessionContext, selectClause.attributeId));
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function prepare(dataValue: DataValue): Variant {
|
|
107
|
-
if (dataValue.statusCode === StatusCodes.Good) {
|
|
108
|
-
return dataValue.value;
|
|
79
|
+
return null;
|
|
109
80
|
}
|
|
110
|
-
|
|
111
|
-
}
|
|
81
|
+
}
|
package/src/index_current.ts
CHANGED
|
@@ -7,7 +7,6 @@ export * from "../source/helpers/dump_tools";
|
|
|
7
7
|
export * from "../source/helpers/adjust_browse_direction";
|
|
8
8
|
export * from "../source/pseudo_session";
|
|
9
9
|
export * from "../source/helpers/make_optionals_map";
|
|
10
|
-
export * from "../source/helpers/check_event_clause";
|
|
11
10
|
export * from "../source/helpers/argument_list";
|
|
12
11
|
export * from "../source/helpers/call_helpers";
|
|
13
12
|
export * from "../source/helpers/ensure_secure_access";
|
package/src/namespace_impl.ts
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
RolePermissionTypeOptions
|
|
29
29
|
} from "node-opcua-types";
|
|
30
30
|
import * as utils from "node-opcua-utils";
|
|
31
|
-
import { DataType, Variant, VariantArrayType, verifyRankAndDimensions } from "node-opcua-variant";
|
|
31
|
+
import { DataType, Variant, VariantArrayType, VariantOptions, verifyRankAndDimensions } from "node-opcua-variant";
|
|
32
32
|
import {
|
|
33
33
|
AddBaseNodeOptions,
|
|
34
34
|
AddEnumerationTypeOptions,
|
|
@@ -67,7 +67,14 @@ import {
|
|
|
67
67
|
} from "../source/address_space_ts";
|
|
68
68
|
import { UAStateMachineEx } from "../source/interfaces/state_machine/ua_state_machine_type";
|
|
69
69
|
import { UATransitionEx } from "../source/interfaces/state_machine/ua_transition_ex";
|
|
70
|
-
import {
|
|
70
|
+
import {
|
|
71
|
+
InstantiateAlarmConditionOptions,
|
|
72
|
+
InstantiateExclusiveLimitAlarmOptions,
|
|
73
|
+
InstantiateLimitAlarmOptions,
|
|
74
|
+
InstantiateOffNormalAlarmOptions,
|
|
75
|
+
UATwoStateDiscreteEx,
|
|
76
|
+
UAYArrayItemEx
|
|
77
|
+
} from "../source";
|
|
71
78
|
import { AddAnalogDataItemOptions, AddDataItemOptions } from "../source/namespace_data_access";
|
|
72
79
|
import { UATwoStateVariableEx } from "../source/ua_two_state_variable_ex";
|
|
73
80
|
import { UAMultiStateValueDiscreteEx } from "../source/interfaces/data_access/ua_multistate_value_discrete_ex";
|
|
@@ -79,22 +86,19 @@ import { UALimitAlarmEx } from "../source/interfaces/alarms_and_conditions/ua_li
|
|
|
79
86
|
import { UANonExclusiveDeviationAlarmEx } from "../source/interfaces/alarms_and_conditions/ua_non_exclusive_deviation_alarm_ex";
|
|
80
87
|
import { UANonExclusiveLimitAlarmEx } from "../source/interfaces/alarms_and_conditions/ua_non_exclusive_limit_alarm_ex";
|
|
81
88
|
import { UAConditionEx } from "../source/interfaces/alarms_and_conditions/ua_condition_ex";
|
|
89
|
+
import { InstantiateExclusiveDeviationAlarmOptions } from "../source/interfaces/alarms_and_conditions/instantiate_exclusive_deviation_alarm_options";
|
|
90
|
+
import { InstantiateNonExclusiveLimitAlarmOptions } from "../source/interfaces/alarms_and_conditions/instantiate_non_exclusive_limit_alarm_options";
|
|
91
|
+
import { InstantiateNonExclusiveDeviationAlarmOptions } from "../source/interfaces/alarms_and_conditions/instantiate_non_exclusive_deviation_alarm_options";
|
|
82
92
|
|
|
83
93
|
import { _handle_delete_node_model_change_event, _handle_model_change_event } from "./address_space_change_event_tools";
|
|
84
94
|
import { AddressSpacePrivate } from "./address_space_private";
|
|
85
95
|
import { UAConditionImpl } from "./alarms_and_conditions/ua_condition_impl";
|
|
86
96
|
import { UADiscreteAlarmImpl } from "./alarms_and_conditions/ua_discrete_alarm_impl";
|
|
87
|
-
import {
|
|
88
|
-
|
|
89
|
-
} from "./alarms_and_conditions/
|
|
90
|
-
import {
|
|
91
|
-
import {
|
|
92
|
-
import {
|
|
93
|
-
UANonExclusiveDeviationAlarmImpl
|
|
94
|
-
} from "./alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl";
|
|
95
|
-
import {
|
|
96
|
-
UANonExclusiveLimitAlarmImpl
|
|
97
|
-
} from "./alarms_and_conditions/ua_non_exclusive_limit_alarm_impl";
|
|
97
|
+
import { UAExclusiveDeviationAlarmImpl } from "./alarms_and_conditions/ua_exclusive_deviation_alarm_impl";
|
|
98
|
+
import { UAExclusiveLimitAlarmImpl } from "./alarms_and_conditions/ua_exclusive_limit_alarm_impl";
|
|
99
|
+
import { UALimitAlarmImpl } from "./alarms_and_conditions/ua_limit_alarm_impl";
|
|
100
|
+
import { UANonExclusiveDeviationAlarmImpl } from "./alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl";
|
|
101
|
+
import { UANonExclusiveLimitAlarmImpl } from "./alarms_and_conditions/ua_non_exclusive_limit_alarm_impl";
|
|
98
102
|
import { UAAcknowledgeableConditionImpl, UAAlarmConditionImpl } from "./alarms_and_conditions";
|
|
99
103
|
import { UAOffNormalAlarmEx, UAOffNormalAlarmImpl } from "./alarms_and_conditions/ua_off_normal_alarm_impl";
|
|
100
104
|
import { add_dataItem_stuff } from "./data_access/add_dataItem_stuff";
|
|
@@ -1541,52 +1545,69 @@ export class NamespaceImpl implements NamespacePrivate {
|
|
|
1541
1545
|
|
|
1542
1546
|
public instantiateAcknowledgeableCondition(
|
|
1543
1547
|
conditionTypeId: UAEventType | NodeId | string,
|
|
1544
|
-
options:
|
|
1545
|
-
data
|
|
1548
|
+
options: InstantiateAlarmConditionOptions,
|
|
1549
|
+
data?: Record<string, VariantOptions>
|
|
1546
1550
|
): UAAcknowledgeableConditionImpl {
|
|
1547
1551
|
return UAAcknowledgeableConditionImpl.instantiate(this, conditionTypeId, options, data);
|
|
1548
1552
|
}
|
|
1549
1553
|
|
|
1550
1554
|
public instantiateAlarmCondition(
|
|
1551
1555
|
alarmConditionTypeId: UAEventType | NodeId | string,
|
|
1552
|
-
options:
|
|
1553
|
-
data
|
|
1556
|
+
options: InstantiateAlarmConditionOptions,
|
|
1557
|
+
data?: Record<string, VariantOptions>
|
|
1554
1558
|
): UAAlarmConditionEx {
|
|
1555
1559
|
return UAAlarmConditionImpl.instantiate(this, alarmConditionTypeId, options, data);
|
|
1556
1560
|
}
|
|
1557
1561
|
|
|
1558
|
-
public instantiateLimitAlarm(
|
|
1562
|
+
public instantiateLimitAlarm(
|
|
1563
|
+
limitAlarmTypeId: UAEventType | NodeId | string,
|
|
1564
|
+
options: InstantiateLimitAlarmOptions,
|
|
1565
|
+
data?: Record<string, VariantOptions>
|
|
1566
|
+
): UALimitAlarmEx {
|
|
1559
1567
|
return UALimitAlarmImpl.instantiate(this, limitAlarmTypeId, options, data);
|
|
1560
1568
|
}
|
|
1561
1569
|
|
|
1562
1570
|
public instantiateExclusiveLimitAlarm(
|
|
1563
1571
|
exclusiveLimitAlarmTypeId: UAEventType | NodeId | string,
|
|
1564
|
-
options:
|
|
1565
|
-
data
|
|
1572
|
+
options: InstantiateLimitAlarmOptions,
|
|
1573
|
+
data?: Record<string, VariantOptions>
|
|
1566
1574
|
): UAExclusiveLimitAlarmEx {
|
|
1567
1575
|
return UAExclusiveLimitAlarmImpl.instantiate(this, exclusiveLimitAlarmTypeId, options, data);
|
|
1568
1576
|
}
|
|
1569
1577
|
|
|
1570
|
-
public instantiateExclusiveDeviationAlarm(
|
|
1578
|
+
public instantiateExclusiveDeviationAlarm(
|
|
1579
|
+
options: InstantiateExclusiveDeviationAlarmOptions,
|
|
1580
|
+
data?: Record<string, VariantOptions>
|
|
1581
|
+
): UAExclusiveDeviationAlarmEx {
|
|
1571
1582
|
return UAExclusiveDeviationAlarmImpl.instantiate(this, "ExclusiveDeviationAlarmType", options, data);
|
|
1572
1583
|
}
|
|
1573
1584
|
|
|
1574
1585
|
public instantiateNonExclusiveLimitAlarm(
|
|
1575
1586
|
nonExclusiveLimitAlarmTypeId: UAEventType | NodeId | string,
|
|
1576
|
-
options:
|
|
1577
|
-
data
|
|
1587
|
+
options: InstantiateNonExclusiveLimitAlarmOptions,
|
|
1588
|
+
data?: Record<string, VariantOptions>
|
|
1578
1589
|
): UANonExclusiveLimitAlarmEx {
|
|
1579
1590
|
return UANonExclusiveLimitAlarmImpl.instantiate(this, nonExclusiveLimitAlarmTypeId, options, data);
|
|
1580
1591
|
}
|
|
1581
1592
|
|
|
1582
|
-
public instantiateNonExclusiveDeviationAlarm(
|
|
1593
|
+
public instantiateNonExclusiveDeviationAlarm(
|
|
1594
|
+
options: InstantiateNonExclusiveDeviationAlarmOptions,
|
|
1595
|
+
data?: Record<string, VariantOptions>
|
|
1596
|
+
): UANonExclusiveDeviationAlarmEx {
|
|
1583
1597
|
return UANonExclusiveDeviationAlarmImpl.instantiate(this, "NonExclusiveDeviationAlarmType", options, data);
|
|
1584
1598
|
}
|
|
1585
1599
|
|
|
1586
|
-
public instantiateDiscreteAlarm(
|
|
1600
|
+
public instantiateDiscreteAlarm(
|
|
1601
|
+
discreteAlarmType: UAEventType | NodeId | string,
|
|
1602
|
+
options: InstantiateAlarmConditionOptions,
|
|
1603
|
+
data?: Record<string, VariantOptions>
|
|
1604
|
+
): UADiscreteAlarmEx {
|
|
1587
1605
|
return UADiscreteAlarmImpl.instantiate(this, discreteAlarmType, options, data);
|
|
1588
1606
|
}
|
|
1589
|
-
public instantiateOffNormalAlarm(
|
|
1607
|
+
public instantiateOffNormalAlarm(
|
|
1608
|
+
options: InstantiateOffNormalAlarmOptions,
|
|
1609
|
+
data?: Record<string, VariantOptions>
|
|
1610
|
+
): UAOffNormalAlarmEx {
|
|
1590
1611
|
return UAOffNormalAlarmImpl.instantiate(this, "OffNormalAlarmType", options, data);
|
|
1591
1612
|
}
|
|
1592
1613
|
|
|
@@ -297,7 +297,7 @@ export class UATwoStateVariableImpl extends UAVariableImplT<LocalizedText, DataT
|
|
|
297
297
|
// for which state or sub-state should be used. It is up to the Server and will depend on the
|
|
298
298
|
// semantics of the StateMachineType
|
|
299
299
|
//
|
|
300
|
-
// EffectiveDisplayName will be constructed by adding the
|
|
300
|
+
// EffectiveDisplayName will be constructed by adding the EnabledState
|
|
301
301
|
// and the State of the addTrue state
|
|
302
302
|
if (this.effectiveDisplayName) {
|
|
303
303
|
this.id.on("value_changed", () => {
|
package/src/ua_object_impl.ts
CHANGED
|
@@ -156,8 +156,7 @@ export class UAObjectImpl extends BaseNodeImpl implements UAObject {
|
|
|
156
156
|
// coerce EventType
|
|
157
157
|
eventTypeNode = addressSpace.findEventType(eventType as UAEventType) as UAEventType;
|
|
158
158
|
const baseEventType = addressSpace.findEventType("BaseEventType")!;
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
|
|
161
160
|
data.$eventDataSource = eventTypeNode;
|
|
162
161
|
data.sourceNode = data.sourceNode || { dataType: DataType.NodeId, value: this.nodeId };
|
|
163
162
|
|
|
@@ -69,7 +69,10 @@ export function construct_demo_alarm_in_address_space(test: IAlarmTestData, addr
|
|
|
69
69
|
optionals: [
|
|
70
70
|
"ConfirmedState",
|
|
71
71
|
"Confirm" // confirm state and confirm Method
|
|
72
|
-
]
|
|
72
|
+
],
|
|
73
|
+
|
|
74
|
+
setpointNode: null,
|
|
75
|
+
|
|
73
76
|
}) as UAExclusiveLimitAlarmEx;
|
|
74
77
|
|
|
75
78
|
assert(tankLevelCondition.browseName.toString() === "1:TankLevelCondition");
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module node-opcua-address-space
|
|
3
|
-
*/
|
|
4
|
-
// tslint:disable:no-console
|
|
5
|
-
import { NodeClass } from "node-opcua-data-model";
|
|
6
|
-
import { SimpleAttributeOperand } from "node-opcua-service-filter";
|
|
7
|
-
import { constructBrowsePathFromQualifiedName } from "node-opcua-service-translate-browse-path";
|
|
8
|
-
import { StatusCode, StatusCodes } from "node-opcua-status-code";
|
|
9
|
-
import { BaseNode, UAObjectType } from "node-opcua-address-space-base";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @method checkSelectClause
|
|
13
|
-
* @param parentNode
|
|
14
|
-
* @param selectClause
|
|
15
|
-
* @return {Array<StatusCode>}
|
|
16
|
-
*/
|
|
17
|
-
export function checkSelectClause(parentNode: BaseNode, selectClause: SimpleAttributeOperand): StatusCode {
|
|
18
|
-
//
|
|
19
|
-
const addressSpace = parentNode.addressSpace;
|
|
20
|
-
|
|
21
|
-
// istanbul ignore next
|
|
22
|
-
if (selectClause.typeDefinitionId.isEmpty()) {
|
|
23
|
-
return StatusCodes.Good;
|
|
24
|
-
}
|
|
25
|
-
const eventTypeNode = addressSpace.findEventType(selectClause.typeDefinitionId)!;
|
|
26
|
-
|
|
27
|
-
if (!eventTypeNode || !(eventTypeNode.nodeClass === NodeClass.ObjectType)) {
|
|
28
|
-
// xx console.log("eventTypeNode = ",selectClause.typeDefinitionId.toString());
|
|
29
|
-
// xx console.log("eventTypeNode = ",eventTypeNode);
|
|
30
|
-
// istanbul ignore next
|
|
31
|
-
if (eventTypeNode) {
|
|
32
|
-
console.log(eventTypeNode.toString());
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// istanbul ignore next
|
|
37
|
-
if (eventTypeNode.nodeClass !== NodeClass.ObjectType) {
|
|
38
|
-
throw new Error("Expecting a ObjectType");
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// navigate to the innerNode specified by the browsePath [ QualifiedName]
|
|
42
|
-
const browsePath = constructBrowsePathFromQualifiedName(eventTypeNode, selectClause.browsePath);
|
|
43
|
-
const browsePathResult = addressSpace.browsePath(browsePath);
|
|
44
|
-
return browsePathResult.statusCode;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* @method checkSelectClauses
|
|
49
|
-
* @param eventTypeNode
|
|
50
|
-
* @param selectClauses
|
|
51
|
-
* @return an array of StatusCode
|
|
52
|
-
*/
|
|
53
|
-
export function checkSelectClauses(eventTypeNode: UAObjectType, selectClauses: SimpleAttributeOperand[]): StatusCode[] {
|
|
54
|
-
return selectClauses.map(checkSelectClause.bind(null, eventTypeNode));
|
|
55
|
-
}
|