首页 > 其他分享 >.Net 构建Opc Ua服务器和客户端

.Net 构建Opc Ua服务器和客户端

时间:2023-08-07 21:37:40浏览次数:37  
标签:License UaFx Machine Opc new Net Ua SDK

Package named Opc.UaFx.Advanced is found in https://www.nuget.org/packages/Opc.UaFx.Advanced that used as a Opc Ua Server and Client.

First of all. Install package

dotnet add package Opc.UaFx.Advanced --version 2.31.0

using Opc.UaFx;
using Opc.UaFx.Client;
using Opc.UaFx.Server;

// Define the root node of server
var machineNode = new OpcObjectNode("Machine");
// Declear a variable Hello world like very started.
var messageNode = new OpcDataVariableNode<string>("Message", "Hello World!");

// It's a variable set to false.
bool variableValue = false;

// bind the variable to root.
var isRunningNode = new OpcDataVariableNode<bool>(
    machineNode,
    "IsRunning",
    value: variableValue);

// bind another one in case.
var jobNode = new OpcObjectNode(
    machineNode,
    "Job",
    new OpcDataVariableNode<bool>("Cancel", false),
    new OpcDataVariableNode<int>("State", -1));

// New a opc server. Make sure tcp port 4840 haven't been used before
using var server = new OpcServer(
    "opc.tcp://localhost:4840/", machineNode, messageNode);

// Start it
server.Start();

// Wait a second
Thread.Sleep(1000);

// New a client to connect to 4840
using var client = new OpcClient("opc.tcp://localhost:4840/");

// Connect anyway
client.Connect();

// Print the variable value. It should be false here.
Console.WriteLine(client.ReadNode("ns=2;s=Machine/IsRunning"));

// Write some values.
OpcStatusCollection results = client.WriteNodes(
    new OpcWriteNode("ns=2;s=Machine/Job/Cancel", true),
    new OpcWriteNode("ns=2;s=Machine/Job/State", 0));
// Print them.
Console.WriteLine(client.ReadNode("ns=2;s=Machine/Job/Cancel"));
Console.WriteLine(client.ReadNode("ns=2;s=Machine/Job/State"));

Finally, the license is used following.

 

# License Information

Copyright (c) Traeger Industry Components GmbH

## License Model (en)

<https://opcua.traeger.de/en/#licensemodel>

### Single Developer License (en)

* Applies to a single person who is registered by name as a developer
* One single developer is allowed to use the SDK
* Any product / application developed with the SDK may be deployed in unlimited number to your customers and may be used by them (royalty free).
* Unlimited life time of the license
* Perfectly suitable for developing standard products

### Branch License (en)

* Applies to one branch (= a postal address), registered for developing
* Unlimited number of developers is allowed to use the SDK
* Any product / application developed with the SDK may be deployed in unlimited number to your customers and may be used by them (royalty free)
* Unlimited life time of the license
* Perfectly suitable for developing standard products

## License Model (de)

<https://opcua.traeger.de/#licensemodel>

### Single Developer License (de)

* Gilt für eine einzelne Person, die namentlich als Entwickler registriert wird
* Ein einzelner Entwickler darf das SDK verwenden
* Alle mit dem SDK entwickelten Produkte / Applikationen dürfen in unbegrenzter Zahl an Ihre Kunden ausgeliefert und von diesen genutzt werden (royalty free).
* Unbegrenzte Lizenzlaufzeit
* Ideal für Serienprodukte

### Branch License (de)

* Gilt für einen Entwicklungsstandort (eine postalische Adresse an der entwickelt wird)
* Eine unbegrenzte Anzahl von Entwicklern an diesem Standort darf das SDK verwenden
* Alle mit dem SDK entwickelten Produkte / Applikationen dürfen in unbegrenzter Zahl an Ihre Kunden ausgeliefert und von diesen genutzt werden (royalty free).
* Unbegrenzte Lizenzlaufzeit
* Ideal für Serienprodukte

标签:License,UaFx,Machine,Opc,new,Net,Ua,SDK
From: https://www.cnblogs.com/lu1770/p/17612726.html

相关文章

  • UART异步通信配置步骤/HAL
    1串口工作参数MX_USART2_UART_Init2底层初始化HAL_UART_MspInit3开启串口异步接收中断HAL_UART_Receive_IT4设置优先级,使能中断HAL_NVIC_SetPriority / HAL_NVIC_SetPriority5编写中断服务函数USART2_IRQHandler/HAL_UART_IRQHandler/HAL_UART_R......
  • nacos 系列:.net core 6.0 使用 nacos
    目录安装Nuget包配置appsettings.json添加服务和配置测试官方示例:https://kgithub.com/nacos-group/nacos-sdk-csharp安装Nuget包dotnetaddpackagenacos-sdk-csharp.AspNetCoredotnetaddpackagenacos-sdk-csharp.Extensions.Configuration配置appsettings.json......
  • rider下载安装 一款.Net跨平台开发神器 安装指南
    rider下载安装一款.Net跨平台开发神器安装指南原文链接:https://baijiahao.baidu.com/s?id=1763943888509043020&wfr=spider&for=pc下载破解补丁后,解压得到,如下图:将上面图示的补丁的所属文件夹/jetbra复制电脑某个位置,小编这里放置到了默认的下载目录下(不推荐,自己选个D盘目......
  • php多维数组自定义排序 uasort()
    对数组进行排序PHP有一些用来排序数组的函数,这个文档会把它们列出来。主要区别有:有些函数基于array的键来排序,而其他的基于值来排序的:$array['key']='value';。排序之后键和值之间的关联关系是否能够保持,是指排序之后数组的键可能会被重置为数字型的(0,1,2...)。排......
  • 从浅入深了解.NET Core MVC 2.x全面教程
    一、基础1.默认配置使用KestrelWebServerASP.NETCore内置——跨平台IIS集成UseIIS()UseIISIntergration()LogIConfiguration接口2.IConfiguration配置信息的来源appsettings.jsonUserSerets环境变量命令行参数XML...3.管道4.MVC5.路由RoutingConcentionalRoutingAttributeRou......
  • quarkus依赖注入之八:装饰器(Decorator)
    欢迎访问我的GitHub这里分类和汇总了欣宸的全部原创(含配套源码):https://github.com/zq2599/blog_demos本篇概览本篇是《quarkus依赖注入》系列的第八篇,目标是掌握quarkus实现的一个CDI特性:装饰器(Decorator)提到装饰器,熟悉设计模式的读者应该会想到装饰器模式,个人觉得下面这......
  • P9498 「RiOI-2」equals题解
    题目传送门:P9498「RiOI-2」equals-洛谷|计算机科学教育新生态(luogu.com.cn)这是洛谷月赛Div.2T3,由于我比较菜,只能赛场上切到T3(T4是黑。),开题我们很容易就看出这道题首先需要初始化每个点到根节点的最短路,而且边权都为1,所以我们先无脑打一个堆优化的dijkstra,剩下的就是处......
  • How to get User Name from External Login in ASP.NET Core?
    HowtogetUserNamefromExternalLogininASP.NETCore? 回答1DoyouhaveaccesstoSignInManagerorcanyouinjectit?Ifyes,thenthisishowyouwouldaccessuserid(username),email,first&lastname:publicclassMyController:Microsoft.Asp......
  • 后台是.net的话前端该用什么框架??
    如果你在后端使用.NET,以下是几个流行的前端框架可以考虑使用:1.React:-优点:React是一个由Facebook开发的JavaScript库,它专注于构建用户界面。它采用组件化的开发模式,使得构建复杂的UI变得简单且可维护。React具有高度的灵活性和可重用性,能够提供出色的性能。2.Angular:-......
  • Atcoder ABC313_C-Approximate Equalization 2
    AT_ABC313_C-ApproximateEqualization2Description:给定一个整数序列\(A=(A_1,A_2,···,A_n)\),可以做以下操作任意次(可能为0):选择一个整数对\((i,j)\)\((1\leqi,j\leqn)\),使得\(A[i]-\)=\(1\),\(A[j]+\)=\(1\),求出使得数列\(A\)中的\(max-min\leq1\)所需的最少......