Giter Club home page Giter Club logo

opcuanet-samples's Introduction

OPC UA .NET SDK Samples

Here you will find sample projects for C#, VB.NET, C++/CLI, LabVIEW and PowerShell to guide developers of OPC UA Client and Server applications using our OPC UA .NET SDKs. Each sample is provided as it is without any promise regarding its accuracy and correctness especially in productive environments.

SDKs

All the samples/projects provided in this repository rely on one of our OPC UA SDKs:

Usage

The samples are implemented to use them quite headless with an absolute minimum number of dependencies (per sample/project). We want to encourage you to copy and use them as you want to fulfil your needs accordingly without any restrictions. To do so you may chose one of the following approaches.

Copy & Paste

You may just browse the samples and copy the code snippets required into your own spike. As soon as your spike fulfils your needs you may think about to offer a pull request for the project here.

Clone, Open & Run

As usual you can just clone this repository, open one of the solutions/projects, set the project of your interest as the "Startup Project" (via right-click on the project) and hit F5 (or click the "green arrow" - play-button).

opcuanet-samples's People

Contributors

dscharnagl avatar f-porter avatar kathamp avatar kpreisser avatar lightbringor avatar m-kirschner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

opcuanet-samples's Issues

OPC-UA Multiclient on same pc

Hi Everybody

I have a simple question.

I have a project where i want manage 25 client opa ua that point on 25 different server.
The problem is that the clients are in the same pc and in the same project ( so 25 client with same ip address and 25 server with different ip).

Currently i have 24 server offline and 1 is online. The problem is that the client that have the server available, is not able to connect,
so all is not connected. If in my project i remove the 24 offline clients, the client will be connected.

Exist a maximum opc ua client number?

i m using Opc.Ua.FX.Advanced library

Thanks

OpcApplicationConfiguration.LoadClientConfig does not work

Hello

I tried your example under ..\opcuanet-samples-master\cs\Configuration\Client.ConfiguredViaXml with the 2nd Way to load an OPC UA Configuration with following line
configuration = OpcApplicationConfiguration.LoadClientConfig("Opc.UaFx.Client"); I get null as result.
I didn't change anythnig on your example. I would be happy for an answer. Thanks a lot and best reagrds
JP.

Event Subscription Problem

Hello,

it's not possible for me to subscribe Events with the Version 2.30-2.33.(look at #9 )
When i downgrade to 2.29 i get the Events without using an filter.

OpcNodeInfo node = Path2NodeID(parentnode, "DeviceSet/IMM_ENGEL_247005");
fclient.SubscribeEvent(node.NodeId, HandleEvent);

When i try to filter the Events, i get nothing.

OpcNodeId[] eventFilterIds = new OpcNodeId[] {
                       Path2NodeID(fclient.BrowseNode(OpcObjectTypes.EventTypesFolder), "BaseEventType/CycleParametersEventType").NodeId,
                       Path2NodeID(fclient.BrowseNode(OpcObjectTypes.EventTypesFolder), "BaseEventType/CycleParametersEventType/EngelCycleParametersEventType").NodeId,
                       Path2NodeID(fclient.BrowseNode(OpcObjectTypes.EventTypesFolder), "BaseEventType/LogbookEventType").NodeId,
                       Path2NodeID(fclient.BrowseNode(OpcObjectTypes.EventTypesFolder), "BaseEventType/LogbookEventType/ProductionStatusChangeLogType").NodeId

                   };
      
var eventFilter = OpcFilter.Using(fclient).FromEvents(eventFilterIds).Select();
subscription = fclient.SubscribeEvent(OpcObjectTypes.ObjectsFolder, eventFilter, HandleEvent);

I want to get the Event EngelCycleParametersEventType. How do i have to set the filter?

grafik

thanks in advanced
atheos

Clarification of client reconnection event behaviour

Hi all,

I found the following unit test failing due to multiple Asserts at the end of the test are not valid:

`[Fact]
public async Task ClientReconnectOnServerRestart()
{
// Arrange
var server = new OpcServer();

var client = new OpcClient("opc.tcp://localhost:4840/")
{
    ReconnectTimeout = 5,
    UseBreakDetection = true
};

var calledReconnecting = false;
var calledReconnected = false;
var calledConnecting = false;
var calledConnected = false;
var calledBreakDetected = false;
var calledDisconnected = false;

server.Start();
client.Connect();

client.Disconnected += (sender, args) => calledDisconnected = true;
client.Reconnecting += (sender, args) => calledReconnecting = true;
client.Reconnected += (sender, args) => calledReconnected = true;
client.Connecting += (sender, args) => calledConnecting = true;
client.Connected += (sender, args) => calledConnected = true;
client.BreakDetected += (sender, args) => calledBreakDetected = true;

using var tokenSource = new CancellationTokenSource(30000);
CancellationToken cancellationToken = tokenSource.Token;

// Assert
Assert.Equal(OpcClientState.Connected, client.State);

// Act
server.Stop();

server.Start();

while (!cancellationToken.IsCancellationRequested)
{
    await Task.Delay(10);

    if (calledReconnected)
    {
        break;
    }
}

// Assert
Assert.False(cancellationToken.IsCancellationRequested);
Assert.False(calledBreakDetected);
Assert.False(calledConnected);
Assert.False(calledConnecting);
Assert.True(calledReconnecting);
Assert.True(calledReconnected);
Assert.False(calledDisconnected);

}`

The result looks as follows and in this case not as expected:

image

What I understand from the docs is that with ReconnectTimeout = 0 the BreakDetected should fire and with ReconnectTimeout > 0 the Reconnecting and Reconnected should fire.

Am I missing any conditions/docs or am I using the API the wrong way?

Thanks for help!

AE.Server EventNotifier and source hierarchy

From 6.2 EventNotifier and source hierarchy https://reference.opcfoundation.org/v104/Core/docs/Part9/6.2/
It says "The Server Object shall be the root of this hierarchy." if this is to be followed should the AE.Server example be updated so that machineOne node sends event to server?
https://github.com/Traeger-GmbH/opcuanet-samples/blob/master/cs/Basic/Server.AE/SampleNodeManager.cs
with current example code i get this:
image

and when following example from> https://docs.traeger.de/en/software/sdk/opc-ua/net/client.development.guide
client.SubscribeEvent(OpcObjectTypes.Server, HandleGlobalEvents);
I will not get events on alarms generated under machineOne.

with this line added:
this.AddNotifierNode(machineOne);
i get this>
image

Connecting to remote classic OPC DA server

Hi Team,

I am trying to connect to a classic OPC DA.
I can connect when server is local but facing problems while connecting to remote OPC DA.
when I try to discover servers then for local it works fine, but for remote it gives below error
var discoveryClient = new OpcClassicDiscoveryClient("", identity)
OpcException: Could not create COM server '13486d51-4821-11d2-a494-3cb306c10000' on host ''. Reason: The object exporter specified was not found

Can you please share some sample configuration with code example that needs to be made on the client or server, ports that needs to opened etc

In the end, I would like to create a container which will run on linux to connect to OPC DA server

Read Nodes with Path

Hello,

I want to read nodes with the nodepath like Objects/DeviceSet/IMM_ENGEL_247005/MachineMESStatus/StandstillMessage/Message

In the next Image i try to access the node with different ways. Attept 1,3 and 4 returns the expected value.(Path2NodeID is only a Helper function which browse through the path)
grafik

What is the correct way to use the paths instead of the identifier? Did i have to browse for the nodeids or should i import a nodelist.xml(the ids changes through the manufacturer)

grafik

thanks in advanced
atheos

Event Subscription not working

Hello,
I tried to implement the example illustrated here but unfortunately the event pub / sub doesn't seem to work on either my MacOS and Windows:

Screenshot 2023-04-18 at 15 16 35

Can you help me?
Thank you

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.