我有一台西门子1200 PLC.使用node-opcua客户端和Kepserver我能够读取变量并更改值.现在我想在KepServer中从node-opcua在PLC中创建一个新变量.

我曾尝试使用node-opcua服务器,因为在示例中我已经看到了如何创建变量,但是我收到错误,因为我正在尝试连接到KepServer所执行的相同端口.
var server = new opcua.OPCUAServer({
port: 49320, // the port of the listening socket of the server
resourcePath: "", // this path will be added to the endpoint resource name
buildInfo : {
productName: "MySampleServer1",
buildNumber: "7658",
buildDate: new Date(2014,5,2)
}
});
Run Code Online (Sandbox Code Playgroud)
我怎么处理创建一个新变量?并从node-opcua创建一个组标签?
是否可以在Kepserver中安装opcua服务器并创建直接连接到该服务器的变量?我的Kepserver位于:opc.tcp:// localhost:49320要连接到此Kepserver,我使用nodeopcua客户端:
var opcua = require("node-opcua");
var client = new opcua.OPCUAClient();
var endpointUrl = "opc.tcp://127.0.0.1:49320";
var the_session = null;
async.series([
// step 1 : connect to
function(callback) {
client.connect(endpointUrl,function (err) {
if(err) …Run Code Online (Sandbox Code Playgroud) 我使用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 …
我正在使用 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) 我正在尝试构建OPC UA客户端应用程序。
我希望能够在OPC树中唯一标识一个UA节点。
我知道在OPC DA中,标准节点ID是带有“。”的字符串。作为我可以用来识别节点的分度符。
在OPC UA中,节点ID不必是字符串,但是我仍然希望能够构建映射到特定节点的唯一字符串。
我正在考虑将其基于节点名称。例如:Demo.MyNode.MyValue。
但恐怕节点名称可能包含诸如“。”之类的字符。这会使我的ID不唯一。
有没有可以用作分隔符的字符?
有没有更好的方法将节点ID表示为字符串(包括其路径)?
我正在学习节点opc-ua并且已经遵循了GitHub页面中为sample_server.js和simple_client.js提供的示例.
在sample_server中,我在构造服务器的地址空间时添加一个变量,例如:
//this code is in the server
addressSpace.addVariable({
componentOf: device,
nodeId: "ns=1;s=variable_1",
browseName: "MyVariable1",
dataType: "Double",
value: {
get: function () {
return new opcua.Variant({ dataType: opcua.DataType.Double, value: variable1 });
}
}
});
Run Code Online (Sandbox Code Playgroud)
以下是整个服务器代码供参考:
var opcua = require("node-opcua");
var server = new opcua.OPCUAServer({
port: 4334, // the port of the listening socket of the server
resourcePath: "UA/MyLittleServer", // this path will be added to the endpoint resource name
buildInfo: {
productName: "MySampleServer1",
buildNumber: "7658",
buildDate: new Date(2014, 5, 2) …Run Code Online (Sandbox Code Playgroud) 我正在使用 node-opcua 库。我有 OPCUAServer 实例。如何获取节点值并对其进行编辑?
我认为 OPC 客户端应该能够做到这一点,但我想与 OPC 服务器交互,因为我正在响应内部事件。
我应该使用像WriteRequest这样的东西来执行这样的操作吗?
我一直在互联网上阅读,以很好地解释 OPC-UA 中的节点。似乎有一些库可以用于它,但实际上没有一个解释节点。OPC-UA 中节点的用途是什么?
注意:此处为 OPC 和 OPC-UA 菜鸟
我熟悉node-opc-ua项目,我想自动从给定的节点集(xml文件)生成服务器地址空间.
有可能吗?
我需要订阅 ~1000 个节点,这些节点是在层次结构中创建的,例如:
ns=2;s=0:Manufacturing.E01.Ambient.Temperature
ns=2;s=0:Manufacturing.E01.Ambient.WindDir
ns=2;s=0:Manufacturing.E01.Commands.AckAllErrors
ns=2;s=0:Manufacturing.E03.Ambient.Temperature
ns=2;s=0:Manufacturing.E03.Ambient.WindDir
ns=2;s=0:Manufacturing.E03.Ambient.WindSpeed
我以相同的方式处理每个更新,因此subscription.monitor()为每个更新调用函数并创建一个新的回调函数对我来说似乎不是最佳方式。
是否可以订阅具有模式的多个节点,例如属于以下所有节点:
ns=2;s=0:制造.E01。
我的机器上正在运行一个节点操作服务器。我想从PLC读取数据。据我了解,OPC Server用于在PLC上进行读写。
我已按照说明从http://node-opcua.github.io/创建服务器和客户端
那么,我的问题是如何从PLC读取信号?我是物联网和OPC UA的新手。请指导我。