我正在使用Java OPC-UA客户端Eclipse Milo。每当我使用服务器的端点URL创建会话时,方法都会UaTcpStackClient.getEndpoints()
将URL更改为localhost
。
String endpointUrl = "opc.tcp://10.8.0.104:48809";
EndpointDescription[] endpoints = UaTcpStackClient.getEndpoints(endpointUrl).get();
EndpointDescription endpoint = Arrays.stream(endpoints)
.filter(e -> e.getSecurityPolicyUri().equals(securityPolicy.getSecurityPolicyUri()))
.findFirst().orElseThrow(() -> new Exception("no desired endpoints returned"));
Run Code Online (Sandbox Code Playgroud)
但是return的endpoint.getEndpointUrl()
值opc.tcp://127.0.0.1:4880/
会导致连接失败。
我不知道为什么我的OPC URL被更改了?
我是 OPC-UA 世界和 Eclipse Milo 的新手。我不明白这里的安全性是如何工作的,讨论 eclipse-milo 提供的客户端示例
我发现连接 OPCUA 服务器时使用了一些安全属性:
SecurityPolicy、MessageSecurityMode、clientCertificate、clientKeyPair、setIdentityProvider、
我试图运行 client-examples -> BrowseNodeExample。此示例在内部运行ExampleServer。ExampleServer 配置为与匿名和用户名密码提供程序一起运行。它还必然接受SecurityPolicy.None
, Basic128Rsa15
, Basic256
,Basic256Sha256
和MessageSecurityMode
as ,SignandEncrypt
除了SecurityPolicy.None
where MessageSecurityMode
isNone
也是如此。
SecurtiyPolicy
和配对连接到服务器(没有提供客户端证书)。MessageSecurityMode
但我不能对 做同样的事情UsernameProvider
,因为UsernameProvider
只能SecurityPolicy
MessageSecurityMode
配对None
成功运行。所有其他对都会引发安全检查失败异常(当提供证书时),否则用户访问被拒绝(当未提供客户端证书时)。如何使这项工作有效?最后,如果有人能向我指出 Eclipse Milo 的正确用户文档,那就太好了。因为除了示例代码之外我看不到任何文档,而且它们也没有记录。
我使用node-opcua module
并且我想opc ua nodes
通过订阅监视许多我看到的结果如下:用户在html UI中选择要监视的节点,然后单击Monitor按钮将这些nodeIds
作为参数发送,然后为每个nodeid
将设置订阅和.on("已更改" )并行处理所有这些项目.现在代码看起来像:
var monitoredItem = the_subscription.monitor({
nodeId: opcua.resolveNodeId("ns=6;s=S71500ET200MP station_1.Master.111"),
attributeId: 13
},
{
samplingInterval: 100,
discardOldest: true,
queueSize: 10
},
opcua.read_service.TimestampsToReturn.Both
);
console.log("-------------------------------------");
var nodes = [];
monitoredItem.on("changed",function(dataValue){
//console.log(" value = ",dataValue.value.value);
//console.log(" sourceTimestamp = ",dataValue.sourceTimestamp.toISOString());
//console.log(JSON.stringify(dataValue));
var Node = {nodeId: "ns=6;s=S71500ET200MP station_1.Master.111", nodeName: "111" , nodeValue: dataValue.value.value , nodeTimestamp: dataValue.sourceTimestamp.toISOString()};
var arrayNode = Object.keys(Node).map(function(k) { return Node[k] });
//console.log(JSON.stringify(Node));
nodes.push(arrayNode);
// console.log(nodes);
});
},
Run Code Online (Sandbox Code Playgroud)
现在,如果我想设置新项目来监控它,只需添加许多变量MonitorItem1,..2,.3等.
怎么做更多的agile/dynamic …
我有一个 C# 应用程序,其中包含一个可与多个 OPC UA 会话 ( UnifiedAutomation.UaClient.Session )配合使用的服务。这些会话是通过连接到 opc.tcp://localhost:48030 等地址来创建的。
foreach (ConnectionStringSettings connectionSettings in ConfigurationManager.ConnectionStrings)
{
var connectionString = connectionSettings.ConnectionString;
// Ignore non-OPC-connections
if (!connectionString.StartsWith("opc.tcp")) continue;
// Create new session for connection
var session = new Session
{
AutomaticReconnect = true,
ReconnectDelay = 0
};
// Connect to OPC UA Server
try
{
session.Connect(connectionString, SecuritySelection.None);
Log("OPC UA Session establish.", EventLogEntryType.Information);
}
catch (StatusException)
{
Log($"No OPC UA Server found at {connectionString}.",
EventLogEntryType.Warning);
}
}
Run Code Online (Sandbox Code Playgroud)
我想对我的服务方法进行单元测试,但我不知道如何模拟 OPC …
我正在使用 node-opcua 库构建 OPC UA 客户端。我已经使用基本示例连接到OPC-UA服务器(prosys OPC-UA模拟服务器),但现在我想让我的客户端支持各种身份验证方法。
我可以使用以下代码获得基于用户名+密码的身份验证:
const client = OPCUAClient.create(options);
await client.connect(endpointUrl);
let userIdentity = {type: opcua.UserTokenType.UserName, userName: "bruce", password: "test" };
const session = await client.createSession(userIdentity);
Run Code Online (Sandbox Code Playgroud)
在prosys OPC-UA模拟服务器上,我检查了“用户名+密码”身份验证方法并创建了匹配的用户。
但现在我想让基于 X.509 证书的用户身份验证正常工作。有谁有 node-opcua 的工作示例以及使用 OpenSSL 生成证书的说明吗?
节点 v16.14.2
节点-OPC-UA v2.75.0
你好,
我目前在使用自定义数据类型从 S7-1500 读取大型 ExtensionObject 时遇到问题。在第一次读取这些 ExtensionObjects 的过程中,我收到很多错误消息,告诉我该库找不到数据类型定义。但是,在这些错误日志之后,读取过程工作正常,我可以成功访问我的数据。
这是错误输出:
17:20:35.217Z :populate_data_type_manager_104:50 Error Error: Cannot find dataType Definition ! with nodeId =ns=2;i=6522
... at C:\Users\me\Desktop\my-opcua-client\node_modules\node-opcua-client-dynamic-extension-object\source\private\populate_data_type_manager_104.ts:34:19
... at Generator.next (<anonymous>)
... at fulfilled (C:\Users\me\Desktop\my-opcua-client\node_modules\node-opcua-client-dynamic-extension-object\dist\private\populate_data_type_manager_104.js:5:58)
... at processTicksAndRejections (node:internal/process/task_queues:96:5)
17:20:35.240Z :populate_data_type_manager_104:177 err= Error
... at assert (C:\Users\me\Desktop\my-opcua-client\node_modules\node-opcua-assert\source\index.ts:12:21)
... at C:\Users\me\Desktop\my-opcua-client\node_modules\node-opcua-client-dynamic-extension-object\source\private\populate_data_type_manager_104.ts:175:19
... at Generator.next (<anonymous>)
... at fulfilled (C:\Users\me\Desktop\my-opcua-client\node_modules\node-opcua-client-dynamic-extension-object\dist\private\populate_data_type_manager_104.js:5:58)
... at processTicksAndRejections (node:internal/process/task_queues:96:5)
17:20:35.293Z :populate_data_type_manager_104:50 Error Error: Cannot find dataType Definition ! with nodeId =ns=2;i=6525
... at C:\Users\me\Desktop\my-opcua-client\node_modules\node-opcua-client-dynamic-extension-object\source\private\populate_data_type_manager_104.ts:34:19
... at …
Run Code Online (Sandbox Code Playgroud) 我有一个西门子 TP1200 Comfort 面板,我已将其配置为 OPC AU 服务器。该面板有一些标签(节点),我想从中获取 C# 应用程序的值。
我已阅读 OPC UA github 项目的示例: https: //github.com/OPCFoundation/UA-.NETStandard。
我能够连接到面板并获取根,但是如果我调试并检查根的结构,我看不到该值的任何属性,也没有看到子节点的集合,所以我不知道如何通过名称查找节点。
有没有类似 GetNodeVale(NodeName); 的方法
我没有显示任何代码,因为我真的迷失了 OPC,这是我第一次尝试实现一个简单的客户端,我想在其中读取节点(标签)的代码,但我无法做到这一点。
谢谢。
我正在尝试创建自己的 OPC UA 客户端。我正在使用 Nuget 包 OPCFoundation.NetStandard.Opc.Ua。为此,我使用了以下代码示例:
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Opc.Ua; // Install-Package OPCFoundation.NetStandard.Opc.Ua
using Opc.Ua.Client;
using Opc.Ua.Configuration;
using System.Threading;
namespace Test_OPC_UA
{
public partial class Form1 : Form
{
//creating a object that encapsulates the netire OPC UA Server related work
OPCUAClass myOPCUAServer;
//creating a dictionary of Tags that would be captured from the OPC UA Server
Dictionary<String, Form1.OPCUAClass.TagClass> TagList = new Dictionary<String, Form1.OPCUAClass.TagClass>();
public Form1()
{
InitializeComponent();
//Add tags to the Tag List, For …
Run Code Online (Sandbox Code Playgroud) 我面临的任务是从 OPC 系统中提取历史数据,然后将这些数据存储到我们 BI 团队的独立数据库中。
虽然我是一名经验丰富的开发人员,但我以前从未使用过 OPC UA。我在这里找到了OPC基金会提供的最新库:
https://github.com/OPCFoundation/UA-.NETStandardLibrary
此存储库中有一个示例控制台客户端应用程序。然而,我没有找到HDA(历史数据访问)的任何线索。那么,有人可以帮忙吗?
而且,我实际上是公司里唯一有IT背景的人。经理告诉我,还有另一个人正在使用一些第 3 方应用程序维护 OPC 系统,因此我认为没有必要实现任何有关 OPC 服务器的操作。换句话说,我想我只需要实现一个 OPC 客户端连接到一些可以在该 OPC 应用程序中找到的 URL。我的假设正确吗?
总结起来,有两个问题:
任何帮助将不胜感激。
opc-ua ×10
c# ×4
node-opcua ×4
javascript ×3
opc ×3
milo ×2
node.js ×2
asp.net-core ×1
java ×1
localhost ×1
nunit ×1
siemens ×1
unit-testing ×1
x509 ×1