本文整理匯總了TypeScript中node-opcua-address-space.AddressSpace.getOwnNamespace方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript AddressSpace.getOwnNamespace方法的具體用法?TypeScript AddressSpace.getOwnNamespace怎麽用?TypeScript AddressSpace.getOwnNamespace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類node-opcua-address-space.AddressSpace
的用法示例。
在下文中一共展示了AddressSpace.getOwnNamespace方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: before
before(async () => {
const namespace = addressSpace.getOwnNamespace();
const fileType = addressSpace.findObjectType("FileType")!;
should.exists(fileType);
// install file 1
opcuaFile = fileType.instantiate({
browseName: "FileTransferObj",
organizedBy: addressSpace.rootFolder.objects.server
}) as UAFileType;
const tempFolder = await promisify(fs.mkdtemp)(path.join(os.tmpdir(), "test-"));
const filename = path.join(tempFolder, "tempFile1.txt");
await promisify(fs.writeFile)(filename, "content", "utf8");
installFileType(opcuaFile, { filename });
// install file 2
opcuaFile2 = fileType.instantiate({
browseName: "FileTransferObj2",
organizedBy: addressSpace.rootFolder.objects.server
}) as UAFileType;
const filename2 = path.join(tempFolder, "tempFile2.txt");
installFileType(opcuaFile2, { filename: filename2 });
});
示例2: before
before(async () => {
addressSpace = await getMiniAddressSpace();
const group = addressSpace.getOwnNamespace().addObject({
browseName: "Group",
organizedBy: addressSpace.rootFolder.objects
});
for (let i = 0; i < 10; i++) {
addressSpace.getOwnNamespace().addObject({
browseName: "Object" + i,
organizedBy: group
});
}
groupNodeId = group.nodeId;
});
示例3: createHistorian1
export function createHistorian1(addressSpace: AddressSpace): UAVariable {
const node = addressSpace.getOwnNamespace().addVariable({
browseName: "History1",
dataType: "Float"
});
const options = {
historian: undefined,
percentDataBad: 100,
percentDataGood: 100, // Therefore if all values are Good then the
// quality will be Good, or if all values are Bad then the quality will be Bad, but if there is
// some Good and some Bad then the quality will be Uncertain
stepped: false, // Therefore SlopedInterpolation is used between data points.
treatUncertainAsBad: false, // Therefore Uncertain values are included in Aggregate calls.
useSlopedExtrapolation: false, // Therefore SteppedExtrapolation is used at end boundary conditions.
};
addressSpace.installHistoricalDataNode(node, options);
installAggregateConfigurationOptions(node, options);
// 12:00:00 - BadNoData First archive entry, Point created
addHistory(node, "12:00:00", null, StatusCodes.BadNoData);
// 12:00:10 10 Raw, Good
addHistory(node, "12:00:10", 10, StatusCodes.Good);
// 12:00:20 20 Raw, Good
addHistory(node, "12:00:20", 20, StatusCodes.Good);
// 12:00:30 30 Raw, Good
addHistory(node, "12:00:30", 30, StatusCodes.Good);
// 12:00:40 40 Raw, Bad ANNOTATION: Operator 1
// Jan-02-2012 8:00:00 Scan failed, Bad data entered
// ANNOTATION:
// Jan-04-2012 7:10:00 Value cannot be verified
addHistory(node, "12:00:40", 40, StatusCodes.Bad);
// 12:00:50 50 Raw, Good ANNOTATION: Engineer1
// Jan-04-2012 7:00:00 Scanner fixed
addHistory(node, "12:00:50", 50, StatusCodes.Good);
// 12:01:00 60 Raw, Good
addHistory(node, "12:01:00", 60, StatusCodes.Good);
// 12:01:10 70 Raw, Uncertain ANNOTATION: Technician_1
// Jan-02-2012 8:00:00 Value flagged as questionable
addHistory(node, "12:01:10", 70, StatusCodes.Uncertain);
// 12:01:20 80 Raw, Good
addHistory(node, "12:01:20", 80, StatusCodes.Good);
// 12:01:30 90 Raw, Good
addHistory(node, "12:01:30", 90, StatusCodes.Good);
return node;
}
示例4: generateAddressSpace
generateAddressSpace(addressSpace, namespaces, (err?: Error) => {
const namespace = addressSpace.registerNamespace("PRIVATENAMESPACE");
namespace.index.should.eql(1);
should.exist(addressSpace.getOwnNamespace());
addAggregateSupport(addressSpace);
h1 = createHistorian1(addressSpace);
h2 = createHistorian2(addressSpace);
h3 = createHistorian3(addressSpace);
h4 = createHistorian4(addressSpace);
done(err!);
});
示例5: installCertificateExpirationAlarm
export function installCertificateExpirationAlarm(addressSpace: AddressSpace) {
debugLog("installCertificateExpirationAlarm");
const server = addressSpace.rootFolder.objects.server;
const namespace = addressSpace.getOwnNamespace();
const certificateExpirationAlarmType = addressSpace.findEventType("CertificateExpirationAlarmType");
const options = {
browseName: "ServerCertificateAlarm",
conditionSource: null,
eventSourceOf: server,
inputNode: NodeId.nullNodeId,
normalState: NodeId.nullNodeId,
};
const data = {};
const alarm = UACertificateExpirationAlarm.instantiate(namespace, options, data);
// const alarm = namespace.instantiateOffNormalAlarm({) as UACertificateExpirationAlarm;
alarm.currentBranch().setRetain(true);
alarm.activeState.setValue(true);
}