node-opcua-address-space-for-conformance-testing 2.180.0 → 2.181.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.
- package/dist/address_space_for_conformance_testing.d.ts +12 -2
- package/dist/address_space_for_conformance_testing.js +32 -27
- package/dist/address_space_for_conformance_testing.js.map +1 -1
- package/dist/conformance_testing/alarm_input_nodes.d.ts +2 -0
- package/dist/conformance_testing/alarm_input_nodes.js +102 -0
- package/dist/conformance_testing/alarm_input_nodes.js.map +1 -0
- package/dist/conformance_testing/ctt_folder.d.ts +2 -0
- package/dist/conformance_testing/ctt_folder.js +375 -0
- package/dist/conformance_testing/ctt_folder.js.map +1 -0
- package/dist/conformance_testing/ctt_tree.d.ts +35 -0
- package/dist/conformance_testing/ctt_tree.js +85 -0
- package/dist/conformance_testing/ctt_tree.js.map +1 -0
- package/dist/conformance_testing/custom_extension_object.d.ts +63 -0
- package/dist/conformance_testing/custom_extension_object.js +48 -0
- package/dist/conformance_testing/custom_extension_object.js.map +1 -0
- package/dist/conformance_testing/discrete_variables.js +6 -4
- package/dist/conformance_testing/discrete_variables.js.map +1 -1
- package/dist/conformance_testing/helpers.d.ts +2 -1
- package/dist/conformance_testing/helpers.js +23 -5
- package/dist/conformance_testing/helpers.js.map +1 -1
- package/dist/conformance_testing/mass_variables.d.ts +2 -1
- package/dist/conformance_testing/mass_variables.js +7 -6
- package/dist/conformance_testing/mass_variables.js.map +1 -1
- package/dist/conformance_testing/path_and_large_arrays.d.ts +2 -1
- package/dist/conformance_testing/path_and_large_arrays.js +6 -5
- package/dist/conformance_testing/path_and_large_arrays.js.map +1 -1
- package/dist/conformance_testing/simulation_variables.d.ts +2 -1
- package/dist/conformance_testing/simulation_variables.js +9 -9
- package/dist/conformance_testing/simulation_variables.js.map +1 -1
- package/dist/conformance_testing/static_variables.d.ts +2 -1
- package/dist/conformance_testing/static_variables.js +19 -12
- package/dist/conformance_testing/static_variables.js.map +1 -1
- package/dist/conformance_testing/type_defaults.d.ts +15 -1
- package/dist/conformance_testing/type_defaults.js +30 -1
- package/dist/conformance_testing/type_defaults.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +19 -14
- package/src/address_space_for_conformance_testing.ts +37 -18
- package/src/conformance_testing/alarm_input_nodes.ts +151 -0
- package/src/conformance_testing/ctt_folder.ts +440 -0
- package/src/conformance_testing/ctt_tree.ts +105 -0
- package/src/conformance_testing/custom_extension_object.ts +105 -0
- package/src/conformance_testing/discrete_variables.ts +6 -4
- package/src/conformance_testing/helpers.ts +26 -6
- package/src/conformance_testing/mass_variables.ts +5 -4
- package/src/conformance_testing/path_and_large_arrays.ts +5 -4
- package/src/conformance_testing/simulation_variables.ts +6 -6
- package/src/conformance_testing/static_variables.ts +31 -9
- package/src/conformance_testing/type_defaults.ts +31 -2
- package/src/index.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulation_variables.js","sourceRoot":"","sources":["../../src/conformance_testing/simulation_variables.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"simulation_variables.js","sourceRoot":"","sources":["../../src/conformance_testing/simulation_variables.ts"],"names":[],"mappings":";;AAYA,wDAyHC;AAjID,yDAA2C;AAC3C,mEAAuE;AACvE,2DAAyE;AAEzE,6EAA2F;AAC3F,6CAA+E;AAC/E,yDAAyD;AAEzD,SAAgB,sBAAsB,CAAC,SAAoB,EAAE,YAAsB,EAAE,MAA8B;IAC/G,IAAI,gBAAgB,GAA8E,EAAE,CAAC;IAErG,SAAS,uBAAuB,CAC5B,MAAgB,EAChB,YAAoB,EACpB,YAAqB,EACrB,YAAoB;QAEpB,YAAY,GAAG,YAAY,IAAI,YAAY,CAAC;QAC5C,MAAM,QAAQ,GAAG,IAAA,yBAAY,EAAC,YAAY,CAAC,CAAC;QAC5C,MAAM,UAAU,GAAG,IAAA,iCAAoB,EAAC,QAAQ,EAAE,MAAM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M,EAAC,IAAA,sCAAa,EAAC,OAAO,CAAC,KAAK,CAAC,EAAE,mCAAmC,CAAC,CAAC;QAC1E,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC;QACzB,aAAa,EAAE,CAAC;IACpB,CAAC,CAAC,CAAC;IAEH,MAAM,eAAe,GAAG,SAAS,CAAC,WAAW,CAAC;QAC1C,WAAW,EAAE,UAAU;QACvB,UAAU,EAAE,SAAS;QACrB,WAAW,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE;QAC9C,MAAM,EAAE,6BAA6B;QACrC,QAAQ,EAAE,SAAS;QACnB,KAAK,EAAE,IAAI,4BAAO,CAAC;YACf,QAAQ,EAAE,6BAAQ,CAAC,OAAO;YAC1B,SAAS,EAAE,qCAAgB,CAAC,MAAM;YAClC,KAAK,EAAE,OAAO;SACjB,CAAC;KACL,CAAC,CAAC;IAEH,eAAe,CAAC,EAAE,CAAC,eAAe,EAAE,CAAC,SAAS,CAAC,eAAe,EAAE,EAAE;QAC9D,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC;QAChC,IAAA,0BAAM,EAAC,OAAO,YAAY,4BAAO,CAAC,CAAC;QACnC,IAAA,0BAAM,EAAC,IAAA,uCAAc,EAAC,OAAO,CAAC,KAAK,CAAC,EAAE,mCAAmC,CAAC,CAAC;QAC3E,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC;QACxB,aAAa,EAAE,CAAC;IACpB,CAAC,CAAC,CAAC;IACH,aAAa,EAAE,CAAC;IAEhB,MAAM,YAAY,GAAG,SAAS,CAAC,YAAY,CAAC;IAC5C,YAAY,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import type { Namespace, UAObject } from "node-opcua-address-space";
|
|
2
|
-
|
|
2
|
+
import { type CustomExtensionObject } from "./custom_extension_object.js";
|
|
3
|
+
export declare function addStaticVariables(namespace: Namespace, scalarFolder: UAObject, custom?: CustomExtensionObject): Promise<void>;
|
|
@@ -11,10 +11,15 @@ const node_fs_1 = __importDefault(require("node:fs"));
|
|
|
11
11
|
const node_path_1 = __importDefault(require("node:path"));
|
|
12
12
|
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
13
13
|
const node_opcua_variant_1 = require("node-opcua-variant");
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
14
|
+
const custom_extension_object_js_1 = require("./custom_extension_object.js");
|
|
15
|
+
const helpers_js_1 = require("./helpers.js");
|
|
16
|
+
const type_defaults_js_1 = require("./type_defaults.js");
|
|
17
|
+
const errorLog = (0, node_opcua_debug_1.make_errorLog)("static_variables");
|
|
18
|
+
// The one place this module learns where it sits on disk. `import.meta.dirname`
|
|
19
|
+
// cannot be used while this package emits CommonJS (TS1470), so the ESM migration
|
|
20
|
+
// has this single line to change rather than several scattered uses.
|
|
21
|
+
const here = __dirname;
|
|
22
|
+
async function addStaticVariables(namespace, scalarFolder, custom) {
|
|
18
23
|
const staticScalarFolder = namespace.addObject({
|
|
19
24
|
organizedBy: scalarFolder,
|
|
20
25
|
browseName: "Scalars",
|
|
@@ -22,15 +27,17 @@ async function addStaticVariables(namespace, scalarFolder) {
|
|
|
22
27
|
nodeId: "s=Static_Scalar"
|
|
23
28
|
});
|
|
24
29
|
// Scalar variables
|
|
25
|
-
for (const e of
|
|
30
|
+
for (const e of type_defaults_js_1.typeAndDefaultValue) {
|
|
26
31
|
const dataType = e.type;
|
|
27
32
|
const realType = e.realType || dataType;
|
|
28
|
-
|
|
29
|
-
(0, helpers_1.addScalarVariable)(namespace, staticScalarFolder, dataType, realType, defaultValue, "");
|
|
33
|
+
(0, helpers_js_1.addScalarVariable)(namespace, staticScalarFolder, dataType, realType, (0, custom_extension_object_js_1.initialValueFor)(e, custom), "");
|
|
30
34
|
}
|
|
35
|
+
// The two Description properties View Minimum Continuation Point 01 012 needs
|
|
36
|
+
// now live on the node that actually serves Static/All Profiles/Scalar/Bool -
|
|
37
|
+
// see addBooleanScalarAndArray() in ctt_folder.ts.
|
|
31
38
|
// Load images
|
|
32
39
|
async function setImage(imageType, filename) {
|
|
33
|
-
const fullPath = node_path_1.default.join(
|
|
40
|
+
const fullPath = node_path_1.default.join(here, "../../data", filename);
|
|
34
41
|
const imageNode = namespace.findNode(`s=Static_Scalar_Image${imageType}`);
|
|
35
42
|
try {
|
|
36
43
|
const data = await node_fs_1.default.promises.readFile(fullPath);
|
|
@@ -51,9 +58,9 @@ async function addStaticVariables(namespace, scalarFolder) {
|
|
|
51
58
|
description: "Single dimension, suggested size of 10-elements per array. Unsupported types will be missing from the address-space.",
|
|
52
59
|
nodeId: "s=Static_Array"
|
|
53
60
|
});
|
|
54
|
-
for (const e of
|
|
61
|
+
for (const e of type_defaults_js_1.typeAndDefaultValue) {
|
|
55
62
|
const realType = e.realType || e.type;
|
|
56
|
-
(0,
|
|
63
|
+
(0, helpers_js_1.addArrayVariable)(namespace, staticArraysFolders, e.type, (0, custom_extension_object_js_1.initialValueFor)(e, custom), realType, 10, "");
|
|
57
64
|
}
|
|
58
65
|
// Multi-dimensional array variables
|
|
59
66
|
const staticMultiDimensionalArrays = namespace.addObject({
|
|
@@ -62,9 +69,9 @@ async function addStaticVariables(namespace, scalarFolder) {
|
|
|
62
69
|
description: "Single dimension, suggested size of 10-elements per array. Unsupported types will be missing from the address-space.",
|
|
63
70
|
nodeId: "s=Static_MultiDimensional_Array"
|
|
64
71
|
});
|
|
65
|
-
for (const e of
|
|
72
|
+
for (const e of type_defaults_js_1.typeAndDefaultValue) {
|
|
66
73
|
const realType = e.realType || e.type;
|
|
67
|
-
(0,
|
|
74
|
+
(0, helpers_js_1.addMultiDimensionalArrayVariable)(namespace, staticMultiDimensionalArrays, e.type, (0, custom_extension_object_js_1.initialValueFor)(e, custom), realType, 2, 3, "");
|
|
68
75
|
}
|
|
69
76
|
}
|
|
70
77
|
//# sourceMappingURL=static_variables.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"static_variables.js","sourceRoot":"","sources":["../../src/conformance_testing/static_variables.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"static_variables.js","sourceRoot":"","sources":["../../src/conformance_testing/static_variables.ts"],"names":[],"mappings":";;;;;AAoBA,gDA0EC;AA9FD;;GAEG;AACH,sDAAyB;AACzB,0DAA6B;AAE7B,uDAAiD;AACjD,2DAAuD;AAEvD,6EAA2F;AAC3F,6CAAqG;AACrG,yDAAyD;AAEzD,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,kBAAkB,CAAC,CAAC;AAEnD,gFAAgF;AAChF,kFAAkF;AAClF,qEAAqE;AACrE,MAAM,IAAI,GAAG,SAAS,CAAC;AAEhB,KAAK,UAAU,kBAAkB,CACpC,SAAoB,EACpB,YAAsB,EACtB,MAA8B;IAE9B,MAAM,kBAAkB,GAAG,SAAS,CAAC,SAAS,CAAC;QAC3C,WAAW,EAAE,YAAY;QACzB,UAAU,EAAE,SAAS;QACrB,WAAW,EAAE,4DAA4D;QACzE,MAAM,EAAE,iBAAiB;KAC5B,CAAC,CAAC;IAEH,mBAAmB;IACnB,KAAK,MAAM,CAAC,IAAI,sCAAmB,EAAE,CAAC;QAClC,MAAM,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC;QACxB,MAAM,QAAQ,GAAG,CAAC,CAAC,QAAQ,IAAI,QAAQ,CAAC;QACxC,IAAA,8BAAiB,EAAC,SAAS,EAAE,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAA,4CAAe,EAAC,CAAC,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;IACzG,CAAC;IAED,8EAA8E;IAC9E,8EAA8E;IAC9E,mDAAmD;IAEnD,cAAc;IACd,KAAK,UAAU,QAAQ,CAAC,SAAiB,EAAE,QAAgB;QACvD,MAAM,QAAQ,GAAG,mBAAI,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY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AS,CAAC,SAAS,CAAC;QACrD,WAAW,EAAE,YAAY;QACzB,UAAU,EAAE,0BAA0B;QACtC,WAAW,EACP,sHAAsH;QAC1H,MAAM,EAAE,iCAAiC;KAC5C,CAAC,CAAC;IACH,KAAK,MAAM,CAAC,IAAI,sCAAmB,EAAE,CAAC;QAClC,MAAM,QAAQ,GAAG,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,IAAI,CAAC;QACtC,IAAA,6CAAgC,EAC5B,SAAS,EACT,4BAA4B,EAC5B,CAAC,CAAC,IAAI,EACN,IAAA,4CAAe,EAAC,CAAC,EAAE,MAAM,CAAC,EAC1B,QAAQ,EACR,CAAC,EACD,CAAC,EACD,EAAE,CACL,CAAC;IACN,CAAC;AACL,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Default type/value table shared by static, simulation, mass, and large array builders.
|
|
3
3
|
*/
|
|
4
|
-
import { LocalizedText, QualifiedName } from "node-opcua-data-model";
|
|
4
|
+
import { DiagnosticInfo, LocalizedText, QualifiedName } from "node-opcua-data-model";
|
|
5
|
+
import { DataValue } from "node-opcua-data-value";
|
|
6
|
+
import { Variant } from "node-opcua-variant";
|
|
5
7
|
export declare const typeAndDefaultValue: ({
|
|
6
8
|
type: string;
|
|
7
9
|
defaultValue: boolean;
|
|
@@ -54,4 +56,16 @@ export declare const typeAndDefaultValue: ({
|
|
|
54
56
|
type: string;
|
|
55
57
|
realType: string;
|
|
56
58
|
defaultValue: null;
|
|
59
|
+
} | {
|
|
60
|
+
type: string;
|
|
61
|
+
realType: string;
|
|
62
|
+
defaultValue(): Variant;
|
|
63
|
+
} | {
|
|
64
|
+
type: string;
|
|
65
|
+
defaultValue(): DataValue;
|
|
66
|
+
realType?: undefined;
|
|
67
|
+
} | {
|
|
68
|
+
type: string;
|
|
69
|
+
defaultValue(): DiagnosticInfo;
|
|
70
|
+
realType?: undefined;
|
|
57
71
|
})[];
|
|
@@ -40,7 +40,9 @@ exports.typeAndDefaultValue = void 0;
|
|
|
40
40
|
const ec = __importStar(require("node-opcua-basic-types"));
|
|
41
41
|
const node_opcua_basic_types_1 = require("node-opcua-basic-types");
|
|
42
42
|
const node_opcua_data_model_1 = require("node-opcua-data-model");
|
|
43
|
+
const node_opcua_data_value_1 = require("node-opcua-data-value");
|
|
43
44
|
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
45
|
+
const node_opcua_variant_1 = require("node-opcua-variant");
|
|
44
46
|
exports.typeAndDefaultValue = [
|
|
45
47
|
{ type: "Boolean", defaultValue: false },
|
|
46
48
|
{ type: "ByteString", defaultValue: Buffer.from("OPCUA") },
|
|
@@ -91,6 +93,33 @@ exports.typeAndDefaultValue = [
|
|
|
91
93
|
{ type: "ImageBMP", realType: "ByteString", defaultValue: null },
|
|
92
94
|
{ type: "ImageGIF", realType: "ByteString", defaultValue: null },
|
|
93
95
|
{ type: "ImageJPG", realType: "ByteString", defaultValue: null },
|
|
94
|
-
{ type: "ImagePNG", realType: "ByteString", defaultValue: null }
|
|
96
|
+
{ type: "ImagePNG", realType: "ByteString", defaultValue: null },
|
|
97
|
+
// The last four built-in types. `type` is the browse name *and* the DataType
|
|
98
|
+
// attribute, so it has to be a DataType the address space can resolve, while
|
|
99
|
+
// `realType` names the built-in encoding of the value. Two of them differ:
|
|
100
|
+
// the Variant DataType node is BaseDataType (i=24) and the ExtensionObject
|
|
101
|
+
// one is Structure (i=22) - "Variant" and "ExtensionObject" are encodings,
|
|
102
|
+
// not browse names, and addVariable() rejects them as DataTypes.
|
|
103
|
+
{
|
|
104
|
+
type: "BaseDataType",
|
|
105
|
+
realType: "Variant",
|
|
106
|
+
defaultValue() {
|
|
107
|
+
return new node_opcua_variant_1.Variant({ dataType: node_opcua_variant_1.DataType.Double, value: 0.0 });
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
// a null ExtensionObject: TypeId 0, no body - what an unassigned Structure is
|
|
111
|
+
{ type: "Structure", realType: "ExtensionObject", defaultValue: null },
|
|
112
|
+
{
|
|
113
|
+
type: "DataValue",
|
|
114
|
+
defaultValue() {
|
|
115
|
+
return new node_opcua_data_value_1.DataValue({ value: new node_opcua_variant_1.Variant({ dataType: node_opcua_variant_1.DataType.Double, value: 0.0 }) });
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
type: "DiagnosticInfo",
|
|
120
|
+
defaultValue() {
|
|
121
|
+
return new node_opcua_data_model_1.DiagnosticInfo({});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
95
124
|
];
|
|
96
125
|
//# sourceMappingURL=type_defaults.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type_defaults.js","sourceRoot":"","sources":["../../src/conformance_testing/type_defaults.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2DAA6C;AAC7C,mEAAmD;AACnD,
|
|
1
|
+
{"version":3,"file":"type_defaults.js","sourceRoot":"","sources":["../../src/conformance_testing/type_defaults.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2DAA6C;AAC7C,mEAAmD;AACnD,iEAAqF;AACrF,iEAAkD;AAClD,yDAAiD;AACjD,2DAAuD;AAE1C,QAAA,mBAAmB,GAAG;IAC/B,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE;IACxC,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;IAC1D,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,EAAE,CAAC,eAAe,EAAE,EAAE;IACxD,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,EAAE;IACrC,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE;IACpC,EAAE,IAAI,EAAE,MAAM,EAA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MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;QAC5F,CAAC;KACJ;IACD;QACI,IAAI,EAAE,gBAAgB;QACtB,YAAY;YACR,OAAO,IAAI,sCAAc,CAAC,EAAE,CAAC,CAAC;QAClC,CAAC;KACJ;CACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./address_space_for_conformance_testing";
|
|
1
|
+
export * from "./address_space_for_conformance_testing.js";
|
package/dist/index.js
CHANGED
|
@@ -14,5 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./address_space_for_conformance_testing"), exports);
|
|
17
|
+
__exportStar(require("./address_space_for_conformance_testing.js"), exports);
|
|
18
18
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6EAA2D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-address-space-for-conformance-testing",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.181.1",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - module address-space-for-conformance-testing",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -9,20 +9,21 @@
|
|
|
9
9
|
"lint": "biome check --no-errors-on-unmatched .",
|
|
10
10
|
"format": "biome check --write --no-errors-on-unmatched .",
|
|
11
11
|
"test": "mocha",
|
|
12
|
-
"clean": "npx rimraf -g node_modules dist *.tsbuildinfo"
|
|
12
|
+
"clean": "npx rimraf -g node_modules dist *.tsbuildinfo",
|
|
13
|
+
"test:check": "tsc --noEmit -p test/tsconfig.json"
|
|
13
14
|
},
|
|
14
15
|
"dependencies": {
|
|
15
|
-
"node-opcua-address-space": "2.
|
|
16
|
+
"node-opcua-address-space": "2.181.1",
|
|
16
17
|
"node-opcua-assert": "2.179.0",
|
|
17
|
-
"node-opcua-basic-types": "2.
|
|
18
|
-
"node-opcua-data-access": "2.
|
|
19
|
-
"node-opcua-data-model": "2.
|
|
20
|
-
"node-opcua-data-value": "2.
|
|
21
|
-
"node-opcua-debug": "2.
|
|
22
|
-
"node-opcua-factory": "2.
|
|
23
|
-
"node-opcua-nodeid": "2.
|
|
24
|
-
"node-opcua-status-code": "2.
|
|
25
|
-
"node-opcua-variant": "2.
|
|
18
|
+
"node-opcua-basic-types": "2.181.0",
|
|
19
|
+
"node-opcua-data-access": "2.181.0",
|
|
20
|
+
"node-opcua-data-model": "2.181.0",
|
|
21
|
+
"node-opcua-data-value": "2.181.0",
|
|
22
|
+
"node-opcua-debug": "2.181.0",
|
|
23
|
+
"node-opcua-factory": "2.181.0",
|
|
24
|
+
"node-opcua-nodeid": "2.181.0",
|
|
25
|
+
"node-opcua-status-code": "2.181.0",
|
|
26
|
+
"node-opcua-variant": "2.181.0"
|
|
26
27
|
},
|
|
27
28
|
"author": "Etienne Rossignon",
|
|
28
29
|
"license": "MIT",
|
|
@@ -39,10 +40,14 @@
|
|
|
39
40
|
"internet of things"
|
|
40
41
|
],
|
|
41
42
|
"homepage": "http://node-opcua.github.io/",
|
|
42
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "b3b762ed8259fb8eaec07b8f1e19f920a78e85ca",
|
|
43
44
|
"files": [
|
|
44
45
|
"data",
|
|
45
46
|
"dist",
|
|
46
47
|
"src"
|
|
47
|
-
]
|
|
48
|
+
],
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"node-opcua-nodesets": "2.181.0",
|
|
51
|
+
"should": "^13.2.3"
|
|
52
|
+
}
|
|
48
53
|
}
|
|
@@ -5,32 +5,48 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { AddressSpace, UAObject } from "node-opcua-address-space";
|
|
7
7
|
import { add_eventGeneratorObject } from "node-opcua-address-space/testHelpers";
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { addAccessRightVariables } from "./conformance_testing/access_right_variables.js";
|
|
9
|
+
import { addAnalogDataItems } from "./conformance_testing/analog_data_items.js";
|
|
10
|
+
import { addCttFolder } from "./conformance_testing/ctt_folder.js";
|
|
11
|
+
import { type CustomExtensionObjectOptions, resolveCustomExtensionObject } from "./conformance_testing/custom_extension_object.js";
|
|
11
12
|
import {
|
|
12
13
|
addMultiStateDiscreteVariable,
|
|
13
14
|
addMultiStateValueDiscreteVariables,
|
|
14
15
|
addTwoStateDiscreteVariables
|
|
15
|
-
} from "./conformance_testing/discrete_variables";
|
|
16
|
-
import { addEnumerationVariable } from "./conformance_testing/enumeration_variable";
|
|
17
|
-
import { addMassVariables } from "./conformance_testing/mass_variables";
|
|
18
|
-
import { addNodeWithReferences } from "./conformance_testing/node_with_references";
|
|
19
|
-
import { addObjectWithMethod } from "./conformance_testing/object_with_methods";
|
|
20
|
-
import { addPath10Deep, addVeryLargeArrayVariables } from "./conformance_testing/path_and_large_arrays";
|
|
21
|
-
import { addSampleView } from "./conformance_testing/sample_view";
|
|
22
|
-
import { addSimulationVariables } from "./conformance_testing/simulation_variables";
|
|
23
|
-
import { addStaticVariables } from "./conformance_testing/static_variables";
|
|
24
|
-
import { addTriggerNodes } from "./conformance_testing/trigger_nodes";
|
|
16
|
+
} from "./conformance_testing/discrete_variables.js";
|
|
17
|
+
import { addEnumerationVariable } from "./conformance_testing/enumeration_variable.js";
|
|
18
|
+
import { addMassVariables } from "./conformance_testing/mass_variables.js";
|
|
19
|
+
import { addNodeWithReferences } from "./conformance_testing/node_with_references.js";
|
|
20
|
+
import { addObjectWithMethod } from "./conformance_testing/object_with_methods.js";
|
|
21
|
+
import { addPath10Deep, addVeryLargeArrayVariables } from "./conformance_testing/path_and_large_arrays.js";
|
|
22
|
+
import { addSampleView } from "./conformance_testing/sample_view.js";
|
|
23
|
+
import { addSimulationVariables } from "./conformance_testing/simulation_variables.js";
|
|
24
|
+
import { addStaticVariables } from "./conformance_testing/static_variables.js";
|
|
25
|
+
import { addTriggerNodes } from "./conformance_testing/trigger_nodes.js";
|
|
26
|
+
|
|
27
|
+
export type { CustomExtensionObjectOptions } from "./conformance_testing/custom_extension_object.js";
|
|
28
|
+
|
|
29
|
+
export interface BuildAddressSpaceForConformanceTestingOptions {
|
|
30
|
+
mass_variable?: boolean;
|
|
31
|
+
mass_variables?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* The concrete structure the ExtensionObject variables hold. Namespace zero
|
|
34
|
+
* has none worth exercising, so a caller that has loaded a companion nodeset
|
|
35
|
+
* passes one in; without it those variables keep a null ExtensionObject.
|
|
36
|
+
* See ./conformance_testing/custom_extension_object.ts.
|
|
37
|
+
*/
|
|
38
|
+
extensionObject?: CustomExtensionObjectOptions;
|
|
39
|
+
}
|
|
25
40
|
|
|
26
41
|
export async function build_address_space_for_conformance_testing(
|
|
27
42
|
addressSpace: AddressSpace,
|
|
28
|
-
options?:
|
|
43
|
+
options?: BuildAddressSpaceForConformanceTestingOptions
|
|
29
44
|
): Promise<void> {
|
|
30
45
|
const namespace = addressSpace.registerNamespace("urn://node-opcua-simulator");
|
|
31
46
|
|
|
32
47
|
options = options || {};
|
|
33
48
|
options.mass_variable = options.mass_variable || false;
|
|
49
|
+
const custom = resolveCustomExtensionObject(addressSpace, options.extensionObject);
|
|
34
50
|
|
|
35
51
|
const objectsFolder = addressSpace.findNode("ObjectsFolder") as UAObject;
|
|
36
52
|
|
|
@@ -50,19 +66,19 @@ export async function build_address_space_for_conformance_testing(
|
|
|
50
66
|
});
|
|
51
67
|
|
|
52
68
|
// Scalars/Array/MultiDim array of all sorts
|
|
53
|
-
await addStaticVariables(namespace, allProfileFolder);
|
|
69
|
+
await addStaticVariables(namespace, allProfileFolder, custom);
|
|
54
70
|
|
|
55
71
|
if (options.mass_variables) {
|
|
56
|
-
addMassVariables(namespace, allProfileFolder);
|
|
72
|
+
addMassVariables(namespace, allProfileFolder, custom);
|
|
57
73
|
}
|
|
58
74
|
addAnalogDataItems(namespace, allProfileFolder);
|
|
59
75
|
|
|
60
76
|
const dynamicVariablesFolder = namespace.addFolder(simulationFolder, {
|
|
61
77
|
browseName: "Dynamic"
|
|
62
78
|
});
|
|
63
|
-
addSimulationVariables(namespace, dynamicVariablesFolder);
|
|
79
|
+
addSimulationVariables(namespace, dynamicVariablesFolder, custom);
|
|
64
80
|
|
|
65
|
-
addVeryLargeArrayVariables(namespace, staticVariablesFolder);
|
|
81
|
+
addVeryLargeArrayVariables(namespace, staticVariablesFolder, custom);
|
|
66
82
|
|
|
67
83
|
addPath10Deep(namespace, simulationFolder);
|
|
68
84
|
|
|
@@ -83,4 +99,7 @@ export async function build_address_space_for_conformance_testing(
|
|
|
83
99
|
addMultiStateDiscreteVariable(namespace, simulationFolder);
|
|
84
100
|
|
|
85
101
|
addTriggerNodes(namespace, simulationFolder);
|
|
102
|
+
|
|
103
|
+
// nodes named after the CTT settings the folders above do not serve
|
|
104
|
+
addCttFolder(namespace, objectsFolder);
|
|
86
105
|
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Alarms & Conditions input nodes of the CTT server project.
|
|
3
|
+
*
|
|
4
|
+
* A setting named "<X>Type Input Nodes" wants the *source* Variable an alarm of
|
|
5
|
+
* that type watches, not the alarm itself: the CTT writes to that Variable and
|
|
6
|
+
* expects the alarm to change state and report an event. So each entry here is
|
|
7
|
+
* a writable scalar plus an alarm instantiated on it. The two "Setpoint Source"
|
|
8
|
+
* settings are the odd ones out - they name the setpoint Variable of the
|
|
9
|
+
* matching deviation alarm, which is created alongside its input node.
|
|
10
|
+
*
|
|
11
|
+
* All alarms hang off a single `AlarmSource` object which is an event source of
|
|
12
|
+
* the Server object, so the events reach a client subscribed to Server (i=2253)
|
|
13
|
+
* - which is what the CTT subscribes to. `conditionSource` refuses a node that
|
|
14
|
+
* is not an event source of anything.
|
|
15
|
+
*
|
|
16
|
+
* Not built: `DiscrepancyAlarmType Input Nodes`. DiscrepancyAlarmType derives
|
|
17
|
+
* straight from AlarmConditionType and its mandatory TargetValueNode /
|
|
18
|
+
* ExpectedTime / Tolerance children have no implementation behind them in
|
|
19
|
+
* node-opcua, so an instance would be an inert shell. The two RateOfChange
|
|
20
|
+
* types, by contrast, derive from the two limit alarm types and instantiate
|
|
21
|
+
* through them; they carry no rate-of-change behaviour either, but the CTT's
|
|
22
|
+
* limit-alarm tests exercise them meaningfully.
|
|
23
|
+
*/
|
|
24
|
+
import type { Namespace, UAObject, UAVariable } from "node-opcua-address-space";
|
|
25
|
+
import { DataType, Variant } from "node-opcua-variant";
|
|
26
|
+
|
|
27
|
+
import type { CttFolder } from "./ctt_tree.js";
|
|
28
|
+
|
|
29
|
+
/** where the CTT keeps these settings; outside "Server Test/NodeIds", so the whole path is the key */
|
|
30
|
+
const GROUP = "Server Test/Alarms and Conditions/Supported Condition Types";
|
|
31
|
+
|
|
32
|
+
/** the limits every limit-derived alarm here is given, in the units of a 0..100 input */
|
|
33
|
+
const LIMITS = { lowLowLimit: 10, lowLimit: 25, highLimit: 75, highHighLimit: 90 };
|
|
34
|
+
|
|
35
|
+
const double = (value: number) => new Variant({ dataType: DataType.Double, value });
|
|
36
|
+
const boolean = (value: boolean) => new Variant({ dataType: DataType.Boolean, value });
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The object every alarm is a condition of. It must be an event source of
|
|
40
|
+
* something, or `conditionSource` throws; making it an event source of the
|
|
41
|
+
* Server object is what puts its events on the Server notifier the CTT
|
|
42
|
+
* subscribes to.
|
|
43
|
+
*/
|
|
44
|
+
function addAlarmSource(ctt: CttFolder): UAObject {
|
|
45
|
+
const server = ctt.addressSpace.rootFolder.objects.server;
|
|
46
|
+
return ctt.namespace.addObject({
|
|
47
|
+
browseName: "AlarmSource",
|
|
48
|
+
nodeId: ctt.nodeId("Server Test/Alarms and Conditions/AlarmSource"),
|
|
49
|
+
organizedBy: ctt.folder("Server Test/Alarms and Conditions"),
|
|
50
|
+
description: "condition source of the CTT alarm input nodes",
|
|
51
|
+
eventSourceOf: server
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function addAlarmInputNodes(ctt: CttFolder): void {
|
|
56
|
+
const namespace: Namespace = ctt.namespace;
|
|
57
|
+
const conditionSource = addAlarmSource(ctt);
|
|
58
|
+
|
|
59
|
+
/** the writable Variable a CTT alarm setting points at; 50 sits inside LIMITS, so alarms start inactive */
|
|
60
|
+
const inputNode = (leaf: string, kind: "Double" | "Boolean"): UAVariable =>
|
|
61
|
+
ctt.variable(`${GROUP}/${leaf}`, kind, -1, kind === "Double" ? double(50) : boolean(false), null);
|
|
62
|
+
|
|
63
|
+
/** a deviation setpoint, at 0 so the deviation the alarm evaluates is the input value itself */
|
|
64
|
+
const setpointNode = (leaf: string): UAVariable => ctt.variable(`${GROUP}/${leaf}`, "Double", -1, double(0), null);
|
|
65
|
+
|
|
66
|
+
const alarmOptions = (browseName: string, input: UAVariable) => ({
|
|
67
|
+
browseName,
|
|
68
|
+
nodeId: ctt.nodeId(`Server Test/Alarms and Conditions/${browseName}`),
|
|
69
|
+
conditionSource,
|
|
70
|
+
inputNode: input
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// ── AlarmConditionType ──────────────────────────────────────────────
|
|
74
|
+
// the base type has no sub-state model: the CTT drives ActiveState itself
|
|
75
|
+
namespace.instantiateAlarmCondition(
|
|
76
|
+
"AlarmConditionType",
|
|
77
|
+
alarmOptions("AlarmCondition", inputNode("AlarmConditionType Input Nodes", "Double"))
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
// ── the limit family ────────────────────────────────────────────────
|
|
81
|
+
namespace.instantiateLimitAlarm("LimitAlarmType", {
|
|
82
|
+
...alarmOptions("LimitAlarm", inputNode("LimitAlarmType Input Nodes", "Double")),
|
|
83
|
+
...LIMITS
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
for (const [typeName, leaf] of [
|
|
87
|
+
["ExclusiveLimitAlarmType", "ExclusiveLimitAlarmType Input Nodes"],
|
|
88
|
+
["ExclusiveLevelAlarmType", "ExclusiveLevelAlarmType Input Nodes"],
|
|
89
|
+
["ExclusiveRateOfChangeAlarmType", "ExclusiveRateOfChangeAlarmType Input Nodes"]
|
|
90
|
+
]) {
|
|
91
|
+
namespace.instantiateExclusiveLimitAlarm(typeName, {
|
|
92
|
+
...alarmOptions(typeName.replace(/Type$/, ""), inputNode(leaf, "Double")),
|
|
93
|
+
...LIMITS
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
for (const [typeName, leaf] of [
|
|
98
|
+
["NonExclusiveLimitAlarmType", "NonExclusiveLimitAlarmType Input Nodes"],
|
|
99
|
+
["NonExclusiveLevelAlarmType", "NonExclusiveLevelAlarmType Input Nodes"],
|
|
100
|
+
["NonExclusiveRateOfChangeAlarmType", "NonExclusiveRateOfChangeAlarmType Input Nodes"]
|
|
101
|
+
]) {
|
|
102
|
+
namespace.instantiateNonExclusiveLimitAlarm(typeName, {
|
|
103
|
+
...alarmOptions(typeName.replace(/Type$/, ""), inputNode(leaf, "Double")),
|
|
104
|
+
...LIMITS
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// ── the deviation pairs: the setpoint is a setting of its own ───────
|
|
109
|
+
const exclusiveSetpoint = setpointNode("Exclusive Deviation Setpoint Source");
|
|
110
|
+
namespace.instantiateExclusiveDeviationAlarm({
|
|
111
|
+
...alarmOptions("ExclusiveDeviationAlarm", inputNode("ExclusiveDeviationAlarmType Input Nodes", "Double")),
|
|
112
|
+
...LIMITS,
|
|
113
|
+
setpointNode: exclusiveSetpoint as Parameters<Namespace["instantiateExclusiveDeviationAlarm"]>[0]["setpointNode"]
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
const nonExclusiveSetpoint = setpointNode("NonExclusive Deviation Setpoint Source");
|
|
117
|
+
namespace.instantiateNonExclusiveDeviationAlarm({
|
|
118
|
+
...alarmOptions("NonExclusiveDeviationAlarm", inputNode("NonExclusiveDeviationAlarmType Input Nodes", "Double")),
|
|
119
|
+
...LIMITS,
|
|
120
|
+
setpointNode: nonExclusiveSetpoint as Parameters<Namespace["instantiateNonExclusiveDeviationAlarm"]>[0]["setpointNode"]
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// ── the discrete family ─────────────────────────────────────────────
|
|
124
|
+
namespace.instantiateDiscreteAlarm(
|
|
125
|
+
"DiscreteAlarmType",
|
|
126
|
+
alarmOptions("DiscreteAlarm", inputNode("DiscreteAlarmType Input Nodes", "Boolean"))
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
// OffNormalAlarmType is active while its input differs from NormalState
|
|
130
|
+
const normalState = namespace.addVariable({
|
|
131
|
+
browseName: "OffNormalNormalState",
|
|
132
|
+
nodeId: ctt.nodeId("Server Test/Alarms and Conditions/OffNormalNormalState"),
|
|
133
|
+
componentOf: ctt.folder("Server Test/Alarms and Conditions"),
|
|
134
|
+
description: "the value OffNormalAlarmType considers normal",
|
|
135
|
+
dataType: "Boolean",
|
|
136
|
+
value: boolean(false)
|
|
137
|
+
});
|
|
138
|
+
namespace.instantiateOffNormalAlarm({
|
|
139
|
+
...alarmOptions("OffNormalAlarm", inputNode("OffNormalAlarmType Input Nodes", "Boolean")),
|
|
140
|
+
normalState
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
// `instantiateOffNormalAlarm` is hardwired to OffNormalAlarmType and
|
|
144
|
+
// UASystemOffNormalAlarmImpl is not exported, so the derived type is
|
|
145
|
+
// instantiated generically: the node and its mandatory children exist,
|
|
146
|
+
// the NormalState comparison is not wired.
|
|
147
|
+
namespace.instantiateAlarmCondition(
|
|
148
|
+
"SystemOffNormalAlarmType",
|
|
149
|
+
alarmOptions("SystemOffNormalAlarm", inputNode("SystemOffNormalAlarmType Input Nodes", "Boolean"))
|
|
150
|
+
);
|
|
151
|
+
}
|