Giter Club home page Giter Club logo

opcuahelper-1's Introduction

Net FrameWork 4.5.2

本机KepWare测试

OpcUa安装策略Node

#单点读写测试

        OpcUaClient client = new OpcUaClient();
        client.Connect("opc.tcp://127.0.0.1:49320");

        Console.WriteLine("单点读");
        Console.WriteLine("ns=2;s=Channel1.Device1.Tag1");
        var retValue =  client.ReadNode("ns=2;s=Channel1.Device1.Tag1");
        Console.WriteLine(retValue);

        Console.WriteLine("单点写");
        client.WriteNode("ns=2;s=Channel1.Device1.Tag2", "111");
        Console.WriteLine("ns=2;s=Channel1.Device1.Tag2");
        retValue = client.ReadNode("ns=2;s=Channel1.Device1.Tag2");
        Console.WriteLine(retValue);

#多点读写测试

        Console.WriteLine("多点读");
        var retValues = client.ReadNodes(new List<string> { "ns=2;s=Channel1.Device1.Tag1", "ns=2;s=Channel1.Device1.Tag2" });
        retValues.ForEach(x => Console.WriteLine(x));

        Console.WriteLine("多点写");
        client.WriteNodes(new List<string> { "ns=2;s=Channel1.Device1.Tag1", "ns=2;s=Channel1.Device1.Tag2" },new List<string> { "100","100"});
        retValues = client.ReadNodes(new List<string> { "ns=2;s=Channel1.Device1.Tag1", "ns=2;s=Channel1.Device1.Tag2" });
        retValues.ForEach(x => Console.WriteLine(x));

#数据监控测试

        client.AddSubscription("monitor", "ns=2;s=Channel1.Device1.Tag1", (string key, MonitoredItem monitoredItem, MonitoredItemNotificationEventArgs EventArgs) => {
            Console.WriteLine(key + ":" + monitoredItem.StartNodeId + "->" + (EventArgs.NotificationValue as MonitoredItemNotification).Value.ToString());
        });

#节点浏览

        var nodes = client.BrowseNodes();

        nodes.ForEach(x => {
            Console.WriteLine(x.NodeId);
            var nodesnew = client.BrowseNodes(x);
            nodesnew.ForEach(y =>
            {
                Console.WriteLine(y.NodeId);
            });
        }
        );

opcuahelper-1's People

Contributors

lizhengzhou avatar

Watchers

James Cloos avatar  avatar

Forkers

storm12

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.