node-opcua-aggregates 2.55.0 → 2.58.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/.mocharc.yml +7 -7
- package/LICENSE +20 -20
- package/bin/sample_aggregate_server.js +14 -14
- package/dist/aggregates.js +2 -2
- package/dist/aggregates.js.map +1 -1
- package/dist/average.js +6 -5
- package/dist/average.js.map +1 -1
- package/dist/common.js +12 -2
- package/dist/common.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/interpolate.d.ts +1 -1
- package/dist/interpolate.js +8 -12
- package/dist/interpolate.js.map +1 -1
- package/dist/minmax.js +3 -2
- package/dist/minmax.js.map +1 -1
- package/dist/read_processed_details.d.ts +2 -2
- package/dist/read_processed_details.js +41 -38
- package/dist/read_processed_details.js.map +1 -1
- package/nyc.config.js +16 -16
- package/package.json +15 -13
- package/source/aggregates.ts +284 -277
- package/source/average.ts +71 -74
- package/source/common.ts +23 -10
- package/source/index.ts +11 -17
- package/source/interpolate.ts +14 -20
- package/source/interval.ts +3 -3
- package/source/minmax.ts +231 -231
- package/source/read_processed_details.ts +149 -139
package/source/aggregates.ts
CHANGED
|
@@ -1,277 +1,284 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module node-opcua-aggregates
|
|
3
|
-
*/
|
|
4
|
-
import { AggregateFunction } from "node-opcua-constants";
|
|
5
|
-
import { makeNodeId } from "node-opcua-nodeid";
|
|
6
|
-
import * as utils from "node-opcua-utils";
|
|
7
|
-
import { DataType } from "node-opcua-variant";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
HasProperty Variable
|
|
25
|
-
HasProperty Variable
|
|
26
|
-
HasProperty Variable
|
|
27
|
-
HasProperty Variable
|
|
28
|
-
HasProperty Variable
|
|
29
|
-
HasProperty Variable
|
|
30
|
-
HasProperty Variable
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
/* istanbul ignore next */
|
|
58
|
-
if (
|
|
59
|
-
throw new Error("
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
/* istanbul ignore next */
|
|
79
|
-
if (!
|
|
80
|
-
throw new Error("
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
setBoolean("
|
|
104
|
-
setBoolean("
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
setBoolean("
|
|
110
|
-
setBoolean("
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
| "
|
|
126
|
-
| "
|
|
127
|
-
| "
|
|
128
|
-
| "
|
|
129
|
-
| "
|
|
130
|
-
| "
|
|
131
|
-
| "
|
|
132
|
-
| "
|
|
133
|
-
| "
|
|
134
|
-
| "
|
|
135
|
-
| "
|
|
136
|
-
| "
|
|
137
|
-
| "
|
|
138
|
-
| "
|
|
139
|
-
| "
|
|
140
|
-
| "
|
|
141
|
-
| "
|
|
142
|
-
| "
|
|
143
|
-
| "
|
|
144
|
-
| "
|
|
145
|
-
| "
|
|
146
|
-
| "
|
|
147
|
-
| "
|
|
148
|
-
| "
|
|
149
|
-
| "
|
|
150
|
-
| "
|
|
151
|
-
| "
|
|
152
|
-
| "
|
|
153
|
-
| "
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
/* istanbul ignore next */
|
|
167
|
-
if (!
|
|
168
|
-
throw new Error("
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
/* istanbul ignore next */
|
|
204
|
-
if (!
|
|
205
|
-
throw new Error("addressSpace do not expose
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
/* istanbul ignore next */
|
|
211
|
-
if (!
|
|
212
|
-
throw new Error("addressSpace do not expose
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
aggregateConfiguration.
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module node-opcua-aggregates
|
|
3
|
+
*/
|
|
4
|
+
import { AggregateFunction } from "node-opcua-constants";
|
|
5
|
+
import { makeNodeId } from "node-opcua-nodeid";
|
|
6
|
+
import * as utils from "node-opcua-utils";
|
|
7
|
+
import { DataType } from "node-opcua-variant";
|
|
8
|
+
import {
|
|
9
|
+
AddressSpace,
|
|
10
|
+
BaseNode,
|
|
11
|
+
UAHistoryServerCapabilities,
|
|
12
|
+
UAObject,
|
|
13
|
+
UAServerCapabilities,
|
|
14
|
+
UAVariable
|
|
15
|
+
} from "node-opcua-address-space";
|
|
16
|
+
import { AddressSpacePrivate } from "node-opcua-address-space/src/address_space_private";
|
|
17
|
+
|
|
18
|
+
import { AggregateConfigurationOptionsEx } from "./interval";
|
|
19
|
+
import { readProcessedDetails } from "./read_processed_details";
|
|
20
|
+
|
|
21
|
+
// import { HistoryServerCapabilities } from "node-opcua-server";
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
HasProperty Variable AccessHistoryDataCapability Boolean PropertyType Mandatory
|
|
25
|
+
HasProperty Variable AccessHistoryEventsCapability Boolean PropertyType Mandatory
|
|
26
|
+
HasProperty Variable MaxReturnDataValues UInt32 PropertyType Mandatory
|
|
27
|
+
HasProperty Variable MaxReturnEventValues UInt32 PropertyType Mandatory
|
|
28
|
+
HasProperty Variable InsertDataCapability Boolean PropertyType Mandatory
|
|
29
|
+
HasProperty Variable ReplaceDataCapability Boolean PropertyType Mandatory
|
|
30
|
+
HasProperty Variable UpdateDataCapability Boolean PropertyType Mandatory
|
|
31
|
+
HasProperty Variable DeleteRawCapability Boolean PropertyType Mandatory
|
|
32
|
+
HasProperty Variable DeleteAtTimeCapability Boolean PropertyType Mandatory
|
|
33
|
+
HasProperty Variable InsertEventCapability Boolean PropertyType Mandatory
|
|
34
|
+
HasProperty Variable ReplaceEventCapability Boolean PropertyType Mandatory
|
|
35
|
+
HasProperty Variable UpdateEventCapability Boolean PropertyType Mandatory
|
|
36
|
+
HasProperty Variable DeleteEventCapability Boolean PropertyType Mandatory
|
|
37
|
+
HasProperty Variable InsertAnnotationsCapability Boolean PropertyType Mandatory
|
|
38
|
+
*/
|
|
39
|
+
const historicalCapabilitiesDefaultProperties /*: HistoryServerCapabilities */ = {
|
|
40
|
+
accessHistoryDataCapability: true, // Boolean PropertyType Mandatory
|
|
41
|
+
accessHistoryEventsCapability: true, // Boolean PropertyType Mandatory
|
|
42
|
+
deleteAtTimeCapability: false, // Boolean PropertyType Mandatory
|
|
43
|
+
deleteEventCapability: false, // Boolean PropertyType Mandatory
|
|
44
|
+
deleteRawCapability: false, // Boolean PropertyType Mandatory
|
|
45
|
+
insertAnnotationCapability: false, // Boolean PropertyType Mandatory
|
|
46
|
+
insertDataCapability: false, // Boolean PropertyType Mandatory
|
|
47
|
+
insertEventCapability: false, // Boolean PropertyType Mandatory
|
|
48
|
+
maxReturnDataValues: 0,
|
|
49
|
+
maxReturnEventValues: 0, // UInt32 PropertyType Mandatory
|
|
50
|
+
replaceDataCapability: false, // Boolean PropertyType Mandatory
|
|
51
|
+
replaceEventCapability: false, // Boolean PropertyType Mandatory
|
|
52
|
+
updateDataCapability: false, // Boolean PropertyType Mandatory
|
|
53
|
+
updateEventCapability: false // Boolean PropertyType Mandatory
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export function createHistoryServerCapabilities(addressSpace: AddressSpace, serverCapabilities: UAServerCapabilities): UAObject {
|
|
57
|
+
/* istanbul ignore next */
|
|
58
|
+
if (serverCapabilities.browseName.toString() !== "ServerCapabilities") {
|
|
59
|
+
throw new Error("Expecting server Capabilities");
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const historyServerCapabilitiesType = addressSpace.getNamespace(0).findObjectType("HistoryServerCapabilitiesType")!;
|
|
63
|
+
|
|
64
|
+
/* istanbul ignore next */
|
|
65
|
+
if (!historyServerCapabilitiesType) {
|
|
66
|
+
throw new Error("Cannot find HistoryServerCapabilitiesType");
|
|
67
|
+
}
|
|
68
|
+
return historyServerCapabilitiesType.instantiate({
|
|
69
|
+
browseName: "HistoryServerCapabilities",
|
|
70
|
+
componentOf: serverCapabilities
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function setHistoricalServerCapabilities(historyServerCapabilities: any, defaultProperties: any) {
|
|
75
|
+
function setBoolean(propName: string) {
|
|
76
|
+
const lowerCase = utils.lowerFirstLetter(propName);
|
|
77
|
+
|
|
78
|
+
/* istanbul ignore next */
|
|
79
|
+
if (!Object.prototype.hasOwnProperty.call(defaultProperties, lowerCase)) {
|
|
80
|
+
throw new Error("cannot find " + lowerCase);
|
|
81
|
+
}
|
|
82
|
+
const value = defaultProperties[lowerCase];
|
|
83
|
+
const prop = historyServerCapabilities.getChildByName(propName);
|
|
84
|
+
|
|
85
|
+
/* istanbul ignore next */
|
|
86
|
+
if (!prop) {
|
|
87
|
+
throw new Error(" Cannot find property " + propName);
|
|
88
|
+
}
|
|
89
|
+
prop.setValueFromSource({ dataType: DataType.Boolean, value });
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function setUInt32(propName: string) {
|
|
93
|
+
const lowerCase = utils.lowerFirstLetter(propName);
|
|
94
|
+
/* istanbul ignore next */
|
|
95
|
+
if (!Object.prototype.hasOwnProperty.call(historyServerCapabilities, lowerCase)) {
|
|
96
|
+
throw new Error("cannot find " + lowerCase);
|
|
97
|
+
}
|
|
98
|
+
const value = defaultProperties[lowerCase];
|
|
99
|
+
const prop = historyServerCapabilities.getChildByName(propName);
|
|
100
|
+
prop.setValueFromSource({ dataType: DataType.UInt32, value });
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
setBoolean("AccessHistoryDataCapability");
|
|
104
|
+
setBoolean("AccessHistoryEventsCapability");
|
|
105
|
+
|
|
106
|
+
setUInt32("MaxReturnDataValues");
|
|
107
|
+
setUInt32("MaxReturnEventValues");
|
|
108
|
+
|
|
109
|
+
setBoolean("InsertDataCapability");
|
|
110
|
+
setBoolean("ReplaceDataCapability");
|
|
111
|
+
setBoolean("UpdateDataCapability");
|
|
112
|
+
setBoolean("DeleteRawCapability");
|
|
113
|
+
setBoolean("DeleteAtTimeCapability");
|
|
114
|
+
setBoolean("InsertEventCapability");
|
|
115
|
+
setBoolean("ReplaceEventCapability");
|
|
116
|
+
setBoolean("UpdateEventCapability");
|
|
117
|
+
setBoolean("DeleteEventCapability");
|
|
118
|
+
|
|
119
|
+
/// FOUND A BUG HERE spec says InsertAnnotationsCapability
|
|
120
|
+
/// Standard nodeset2 says InsertAnnotationCapability ( without s )
|
|
121
|
+
// xx setBoolean("InsertAnnotationsCapability");
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export type AggregateFunctionName =
|
|
125
|
+
| "AnnotationCount"
|
|
126
|
+
| "Average"
|
|
127
|
+
| "Count"
|
|
128
|
+
| "Delta"
|
|
129
|
+
| "DeltaBounds"
|
|
130
|
+
| "DurationBad"
|
|
131
|
+
| "DurationGood"
|
|
132
|
+
| "DurationInStateNonZero"
|
|
133
|
+
| "DurationInStateZero"
|
|
134
|
+
| "EndBound"
|
|
135
|
+
| "Interpolative"
|
|
136
|
+
| "Maximum"
|
|
137
|
+
| "Maximum2"
|
|
138
|
+
| "MaximumActualTime"
|
|
139
|
+
| "MaximumActualTime2"
|
|
140
|
+
| "Minimum"
|
|
141
|
+
| "Minimum2"
|
|
142
|
+
| "MinimumActualTime"
|
|
143
|
+
| "MinimumActualTime2"
|
|
144
|
+
| "NumberOfTransitions"
|
|
145
|
+
| "PercentBad"
|
|
146
|
+
| "PercentGood"
|
|
147
|
+
| "Range"
|
|
148
|
+
| "Range2"
|
|
149
|
+
| "StandardDeviationPopulation"
|
|
150
|
+
| "StandardDeviationSample"
|
|
151
|
+
| "Start"
|
|
152
|
+
| "StartBound"
|
|
153
|
+
| "TimeAverage"
|
|
154
|
+
| "TimeAverage2"
|
|
155
|
+
| "Total"
|
|
156
|
+
| "Total2"
|
|
157
|
+
| "VariancePopulation"
|
|
158
|
+
| "VarianceSample"
|
|
159
|
+
| "WorstQuality"
|
|
160
|
+
| "WorstQuality2";
|
|
161
|
+
|
|
162
|
+
interface UAHistoryServerCapabilitiesWithH extends UAServerCapabilities {
|
|
163
|
+
historyServerCapabilities: UAHistoryServerCapabilities;
|
|
164
|
+
}
|
|
165
|
+
function addAggregateFunctionSupport(addressSpace: AddressSpace, functionName: number): void {
|
|
166
|
+
/* istanbul ignore next */
|
|
167
|
+
if (!functionName) {
|
|
168
|
+
throw new Error("Invalid function name");
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const serverCapabilities = addressSpace.rootFolder.objects.server.serverCapabilities as UAHistoryServerCapabilitiesWithH;
|
|
172
|
+
|
|
173
|
+
/* istanbul ignore next */
|
|
174
|
+
if (!serverCapabilities.historyServerCapabilities) {
|
|
175
|
+
throw new Error("missing serverCapabilities.historyServerCapabilities");
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const aggregateFunctions = serverCapabilities.aggregateFunctions;
|
|
179
|
+
|
|
180
|
+
const aggregateFunctionsInHist = serverCapabilities.historyServerCapabilities.aggregateFunctions;
|
|
181
|
+
|
|
182
|
+
const functionNodeId = makeNodeId(functionName);
|
|
183
|
+
const functionNode = addressSpace.getNamespace(0).findNode(functionNodeId);
|
|
184
|
+
|
|
185
|
+
/* istanbul ignore next */
|
|
186
|
+
if (!functionNode) {
|
|
187
|
+
throw new Error("Cannot find node " + functionName + " in addressSpace");
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
aggregateFunctions.addReference({
|
|
191
|
+
nodeId: functionNode.nodeId,
|
|
192
|
+
referenceType: "Organizes"
|
|
193
|
+
});
|
|
194
|
+
aggregateFunctionsInHist.addReference({
|
|
195
|
+
nodeId: functionNode.nodeId,
|
|
196
|
+
referenceType: "Organizes"
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export function addAggregateSupport(addressSpace: AddressSpace): void {
|
|
201
|
+
const aggregateConfigurationType = addressSpace.getNamespace(0).findObjectType("AggregateConfigurationType");
|
|
202
|
+
|
|
203
|
+
/* istanbul ignore next */
|
|
204
|
+
if (!aggregateConfigurationType) {
|
|
205
|
+
throw new Error("addressSpace do not expose AggregateConfigurationType");
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const aggregateFunctionType = addressSpace.getNamespace(0).findObjectType("AggregateFunctionType");
|
|
209
|
+
|
|
210
|
+
/* istanbul ignore next */
|
|
211
|
+
if (!aggregateFunctionType) {
|
|
212
|
+
throw new Error("addressSpace do not expose AggregateFunctionType");
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const serverObject = addressSpace.rootFolder.objects.getFolderElementByName("Server");
|
|
216
|
+
|
|
217
|
+
/* istanbul ignore next */
|
|
218
|
+
if (!serverObject) {
|
|
219
|
+
throw new Error("addressSpace do not expose a ServerObject");
|
|
220
|
+
}
|
|
221
|
+
// xx serverObject.
|
|
222
|
+
|
|
223
|
+
const serverCapabilities = serverObject.getChildByName("ServerCapabilities")! as UAServerCapabilities;
|
|
224
|
+
|
|
225
|
+
// Let see if HistoryServer Capabilities object exists
|
|
226
|
+
let historyServerCapabilities = serverCapabilities.getChildByName("HistoryServerCapabilities");
|
|
227
|
+
|
|
228
|
+
/* istanbul ignore next */
|
|
229
|
+
if (!historyServerCapabilities) {
|
|
230
|
+
historyServerCapabilities = createHistoryServerCapabilities(addressSpace, serverCapabilities);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
setHistoricalServerCapabilities(historyServerCapabilities, historicalCapabilitiesDefaultProperties);
|
|
234
|
+
|
|
235
|
+
addAggregateFunctionSupport(addressSpace, AggregateFunction.Interpolative);
|
|
236
|
+
addAggregateFunctionSupport(addressSpace, AggregateFunction.Minimum);
|
|
237
|
+
addAggregateFunctionSupport(addressSpace, AggregateFunction.Maximum);
|
|
238
|
+
addAggregateFunctionSupport(addressSpace, AggregateFunction.Average);
|
|
239
|
+
|
|
240
|
+
const addressSpaceInternal = addressSpace as unknown as AddressSpacePrivate;
|
|
241
|
+
addressSpaceInternal._readProcessedDetails = readProcessedDetails;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export function installAggregateConfigurationOptions(node: UAVariable, options: AggregateConfigurationOptionsEx): void {
|
|
245
|
+
const nodePriv = node as any;
|
|
246
|
+
const aggregateConfiguration = nodePriv.$historicalDataConfiguration.aggregateConfiguration;
|
|
247
|
+
aggregateConfiguration.percentDataBad.setValueFromSource({ dataType: "Byte", value: options.percentDataBad });
|
|
248
|
+
aggregateConfiguration.percentDataGood.setValueFromSource({ dataType: "Byte", value: options.percentDataGood });
|
|
249
|
+
aggregateConfiguration.treatUncertainAsBad.setValueFromSource({
|
|
250
|
+
dataType: "Boolean",
|
|
251
|
+
value: options.treatUncertainAsBad
|
|
252
|
+
});
|
|
253
|
+
aggregateConfiguration.useSlopedExtrapolation.setValueFromSource({
|
|
254
|
+
dataType: "Boolean",
|
|
255
|
+
value: options.useSlopedExtrapolation
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
nodePriv.$historicalDataConfiguration.stepped.setValueFromSource({
|
|
259
|
+
dataType: "Boolean",
|
|
260
|
+
value: options.stepped
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export function getAggregateConfiguration(node: BaseNode): AggregateConfigurationOptionsEx {
|
|
265
|
+
const nodePriv = node as any;
|
|
266
|
+
|
|
267
|
+
/* istanbul ignore next */
|
|
268
|
+
if (!nodePriv.$historicalDataConfiguration) {
|
|
269
|
+
throw new Error("internal error");
|
|
270
|
+
}
|
|
271
|
+
const aggregateConfiguration = nodePriv.$historicalDataConfiguration.aggregateConfiguration;
|
|
272
|
+
|
|
273
|
+
// Beware ! Stepped value comes from Historical Configuration !
|
|
274
|
+
const stepped = nodePriv.$historicalDataConfiguration.stepped.readValue().value.value;
|
|
275
|
+
|
|
276
|
+
return {
|
|
277
|
+
percentDataBad: aggregateConfiguration.percentDataBad.readValue().value.value,
|
|
278
|
+
percentDataGood: aggregateConfiguration.percentDataGood.readValue().value.value,
|
|
279
|
+
stepped,
|
|
280
|
+
treatUncertainAsBad: aggregateConfiguration.treatUncertainAsBad.readValue().value.value,
|
|
281
|
+
// xx stepped: aggregateConfiguration.stepped.readValue().value,
|
|
282
|
+
useSlopedExtrapolation: aggregateConfiguration.useSlopedExtrapolation.readValue().value.value
|
|
283
|
+
};
|
|
284
|
+
}
|