• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript node-opcua-address-space.AddressSpace类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中node-opcua-address-space.AddressSpace的典型用法代码示例。如果您正苦于以下问题:TypeScript AddressSpace类的具体用法?TypeScript AddressSpace怎么用?TypeScript AddressSpace使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了AddressSpace类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: addAggregateSupport

export function addAggregateSupport(addressSpace: AddressSpace) {
    const aggregateConfigurationType = addressSpace.getNamespace(0).findObjectType("AggregateConfigurationType");
    if (!aggregateConfigurationType) {
        throw new Error("addressSpace do not expose AggregateConfigurationType");
    }

    const aggregateFunctionType = addressSpace.getNamespace(0).findObjectType("AggregateFunctionType");
    if (!aggregateFunctionType) {
        throw new Error("addressSpace do not expose AggregateFunctionType");
    }

    const serverObject = addressSpace.rootFolder.objects.getFolderElementByName("Server");
    if (!serverObject) {
        throw new Error("addressSpace do not expose a ServerObject");
    }
    // xx serverObject.

    const serverCapabilities = serverObject.getChildByName("ServerCapabilities")! as UAServerCapabilities;

    // Let see if HistoryServer Capabilities object exists
    let historyServerCapabilities = serverCapabilities.getChildByName("HistoryServerCapabilities");
    if (!historyServerCapabilities) {
        historyServerCapabilities = createHistoryServerCapabilities(addressSpace, serverCapabilities);
    }

    setHistoricalServerCapabilities(historyServerCapabilities, historicalCapabilitiesDefaultProperties);

    addAggregateFunctionSupport(addressSpace, AggregateFunction.Interpolative);
    addAggregateFunctionSupport(addressSpace, AggregateFunction.Minimum);
    addAggregateFunctionSupport(addressSpace, AggregateFunction.Maximum);

}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:32,代码来源:aggregates.ts


示例2: before

 before(async () => {
     const xmlFiles = [
         nodesets.standard
     ];
     addressSpace = AddressSpace.create();
     await generateAddressSpace(addressSpace, xmlFiles);
     addressSpace.registerNamespace("Own");
 });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:8,代码来源:test_file_transfer.ts


示例3: before

    before(async () => {
        await initializeHelpers();

        await applicationGroup.initialize();
        await userTokenGroup.initialize();

        addressSpace = AddressSpace.create();
        await generateAddressSpace(addressSpace, xmlFiles);
        addressSpace.registerNamespace("Private");

    });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:11,代码来源:test_server_configuration.ts


示例4: 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;

}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:52,代码来源:create_historizing_variables.ts


示例5: 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!);
        });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:15,代码来源:test_aggregates.ts


示例6: addAggregateFunctionSupport

function addAggregateFunctionSupport(
  addressSpace: AddressSpace, functionName: number): void {
    if (!functionName) {
        throw new Error("Invalid function name");
    }

    const serverCapabilities = addressSpace.rootFolder.objects.server.serverCapabilities;

    /* istanbul ignore next */
    if (!serverCapabilities.historyServerCapabilities) {
        throw new Error("missing serverCapabilities.historyServerCapabilities");
    }

    const aggregateFunctions = serverCapabilities.aggregateFunctions;

    const aggregateFunctionsInHist = serverCapabilities.historyServerCapabilities.aggregateFunctions;

    const functionNodeId = makeNodeId(functionName);
    const functionNode = addressSpace.getNamespace(0).findNode(functionNodeId);
    if (!functionNode) {
        throw new Error("Cannot find node " + functionName + " in addressSpace");
    }
    aggregateFunctions.addReference({
        nodeId: functionNode.nodeId,
        referenceType: "Organizes"
    });
    aggregateFunctionsInHist.addReference({
        nodeId: functionNode.nodeId,
        referenceType: "Organizes"
    });
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:31,代码来源:aggregates.ts


示例7: 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;
    });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:17,代码来源:test_crawler_on_addresss_space.ts


示例8: beforeEach

    beforeEach((done) => {

        addressSpace = AddressSpace.create();

        const namespaces: string[] = [
            nodesets.standard_nodeset_file
        ];
        generateAddressSpace(addressSpace, namespaces, (err?: Error) => {
            done(err);
        });
    });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:11,代码来源:test_aggregates.ts


示例9: 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);
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:23,代码来源:install_CertificateAlarm.ts


示例10: promisify

    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 });

    });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:28,代码来源:test_file_transfer.ts



注:本文中的node-opcua-address-space.AddressSpace类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript node-opcua-assert.assert函数代码示例发布时间:2022-05-25
下一篇:
TypeScript node-opcua.OPCUAServer类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap