Giter VIP home page Giter VIP logo

opc-ua-pubsub-dotnet's Introduction

Contributor Covenant GitHub

Build & Test Publish NuGet Packages

Nuget Nuget

opc-ua-pubsub-dotnet

opc-ua-pubsub-dotnet is a library which implements OPC UA PubSub encoding and decoding in a simplified way.

It's not offering the full flexibility of OPC UA PubSub, but it supports encoding and decoding of all data types which are used by Siemens SICAM A8000 and SICAM GridEdge. You can easily extend this library to support additional data types.

The library itself is written in .NET 5.

Using

Add the Nuget package, e.g.:

dotnet add package opc.ua.pubsub.dotnet.client

or by using Visual Studio, Visual Studio for Mac or the Package Manager Console

Decoding

Create a new instace of DecodeMessage and pass the binary message:

DecodeMessage Decoder = new DecodeMessage();
NetworkMessage message = Decoder.ParseBinaryMessage(rawMessage)

Please keep in mind, that OPC UA PubSub is stateful. That means you need to have decoded the Meta-Message before you can decode any Key- or Delta-Message.

For more advanced use cases please see the developer documentation.

Encoding

Create an instance of the ProcessData class:

string publisherID = "my-publisher-id";
string dataSetName = "my-data-set-name";
ushort writerID    = 123;
ProcessDataSet dataSet = new ProcessDataSet( publisherID, dataSetName, writerID, ProcessDataSet.DataSetType.TimeSeries );

Now you can create a Datapoint and add it to the previously created ProcessData instance:

DPSEvent dataPoint = new DPSEvent()
{
        Name      = "Sample DPS",
        Value     = 2,
        Orcat     = OrcatConstants.Process,
        Quality   = QualityConstants.Good,
        Timestamp = DateTime.Now.ToFileTimeUtc()
};

dataSet.AddDataPoint( dataPoint );

Now you can get the binary encoded Meta-Message and as well a binary encoded Key- or Delta-Message from the ProcessData instance:

ushort sequenceNumber = 1;
byte[]         encodedMeta        = dataSet.GetEncodedMetaFrame( new EncodingOptions(), sequenceNumber++ );
byte[]         encodedKey         = dataSet.GetEncodedDeltaFrame( sequenceNumber++ );

More advanced use cases including the usage of MQTT are available in the developer documentation.

Build

Building just the library requires only .NET Core 3.1 SDK and can be done on any operating system supported by .NET Core 3.1.

Building the entire repository including sample applications can done only on Windows and requires additionally the installation of the .NET Framework Developer Pack. It's recommended to use Visual Studio for building the entire repository.

Contributions

Contributions are always welcome! Please see CONTRIBUTING.md for details.

License

This project use the following license: MIT

opc-ua-pubsub-dotnet's People

Contributors

thomasseidenbecher avatar thomaspiskol avatar stefan-busch avatar andreasfoerster avatar

Watchers

James Cloos avatar

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.