当前位置:网站首页>Open62541 import nodeset file directly
Open62541 import nodeset file directly
2022-06-28 07:15:00 【Yaojiawan】
upc ua Modeling is usually done using modeling tools ( such as uaModeler), Direct output C,C++,C# Source code , Then with OPC UA The server code is compiled together .opc ua The same is true for open source projects . It provides a python Compiling nodeset_compiler Tools . take nodeset.XML Compile it into myNS.c and .h file . Then combine to server In the code of .
If you are developing a specific product , its opc ua The model is predetermined . Then it can be tolerated , After all, this is the work done by programmers . however , If the developed product is a general product , need OT Engineers to build OPC UA Model of . So for OT Engineers are too much trouble . They are not good at such work .
The solution is by server Program to dynamically build opc ua Model . stay server In the program of nodeset.xml file , from server The program in is built automatically server End of the information model . Realization opc ua Dynamic modeling of server .

stay Server Use... In the program nodeset.xml What is built is the type of object (objectType), Then instantiate the object type , Additional information is needed . They use configuration.xml Provide .
Implementation details
use first uamodeler Software build one opcua Of nodeset Model . And output nodeset.xml file .
<?xml version="1.0" encoding="utf-8"?>
<UANodeSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:uax="http://opcfoundation.org/UA/2008/02/Types.xsd" xmlns="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd" xmlns:s1="http://yourorganisation.org/demo2022/Types.xsd" xmlns:ua="http://unifiedautomation.com/Configuration/NodeSet.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<NamespaceUris>
<Uri>http://yourorganisation.org/demo2022/</Uri>
</NamespaceUris>
<Aliases>
<Alias Alias="Boolean">i=1</Alias>
<Alias Alias="Double">i=11</Alias>
<Alias Alias="HasTypeDefinition">i=40</Alias>
<Alias Alias="HasComponent">i=47</Alias>
</Aliases>
<Extensions>
<Extension>
<ua:ModelInfo Tool="UaModeler" Hash="Yl8uWJaLMTz0jvkxYQoGkw==" Version="1.6.0"/>
</Extension>
</Extensions>
<UAObject NodeId="ns=1;i=5001" BrowseName="1:Meter">
<DisplayName>Meter</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=58</Reference>
<Reference ReferenceType="HasComponent">ns=1;i=6001</Reference>
<Reference ReferenceType="HasComponent">ns=1;i=5002</Reference>
<Reference ReferenceType="HasComponent">ns=1;i=6002</Reference>
<Reference ReferenceType="HasComponent" IsForward="false">i=85</Reference>
</References>
</UAObject>
<UAVariable DataType="Double" NodeId="ns=1;i=6001" BrowseName="1:Current" AccessLevel="3">
<DisplayName>Current</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=63</Reference>
<Reference ReferenceType="HasComponent" IsForward="false">ns=1;i=5001</Reference>
</References>
</UAVariable>
<UAObject NodeId="ns=1;i=5002" BrowseName="1:Switch">
<DisplayName>Switch</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=58</Reference>
<Reference ReferenceType="HasComponent">ns=1;i=6004</Reference>
<Reference ReferenceType="HasComponent" IsForward="false">ns=1;i=5001</Reference>
</References>
</UAObject>
<UAVariable DataType="Boolean" NodeId="ns=1;i=6004" BrowseName="1:Status" AccessLevel="3">
<DisplayName>Status</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=63</Reference>
<Reference ReferenceType="HasComponent" IsForward="false">ns=1;i=5002</Reference>
</References>
</UAVariable>
<UAVariable DataType="Double" NodeId="ns=1;i=6002" BrowseName="1:Voltage" AccessLevel="3">
<DisplayName>Voltage</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=63</Reference>
<Reference ReferenceType="HasComponent" IsForward="false">ns=1;i=5001</Reference>
</References>
</UAVariable>
<UAVariable DataType="Double" NodeId="ns=1;i=6003" BrowseName="1:Temperature" AccessLevel="3">
<DisplayName>Temperature</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=63</Reference>
<Reference ReferenceType="HasComponent" IsForward="false">i=85</Reference>
</References>
</UAVariable>
</UANodeSet>
The second step : Write a by hand configuration.xml file . After this step, you can use a small software tool , Generated in configuration mode .
<?xml version="1.0" encoding="utf-8"?>
<UAObject NodeId="ns=1;i=5001" BrowseName="1:Meter">
<Param BrowseName="Meter1">
<DisplayName>
Meter 1
</DisplayName>
<Description>Electricity Meter 1</Description>
</Param>
<UAVariable DataType="Double" NodeId="ns=1;i=6001" BrowseName="1:Current" AccessLevel="3">
<Value>10</Value>
<DataSource></DataSource>
</UAVariable>
<UAVariable DataType="Double" NodeId="ns=1;i=6002" BrowseName="1:Voltage" AccessLevel="3">
<Value>220</Value>
</UAVariable>
<UAObject NodeId="ns=1;i=5002" BrowseName="1:Switch">
<Param BrowseName="Meter1">
<DisplayName>
Meter 1
</DisplayName>
</Param>
<UAVariable DataType="Boolean" NodeId="ns=1;i=6004" BrowseName="1:Status" AccessLevel="3">
<Value>On</Value>
</UAVariable>
</UAObject>
<UAVariable DataType="Double" NodeId="ns=1;i=6003" BrowseName="1:Temperature" AccessLevel="3">
<Value>25.6</Value>
</UAVariable>
</UAObject>From the code above ,configuration.XML The following content has been added to
1 Object The parameters of the node BrowseName,DisplayName,Description They use Param describe
<Param BrowseName="Meter1">
<DisplayName>
Meter 1
</DisplayName>
<Description>Electricity Meter 1</Description>
</Param>2 Variable Node added Value and DataSource These are the initial values (Value) And the address corresponding to the hardware (DataSource)
<UAVariable DataType="Double" NodeId="ns=1;i=6001" BrowseName="1:Current" AccessLevel="3">
<Value>10</Value>
<DataSource></DataSource>
</UAVariable>The third step : from Nodeset.xml produce ObjectType node ( Hang in the air )
Step four : from Configuration.XML produce Object example , And initialize .( Hang in the air )
Conclusion
At present, it is only a technical solution , When finished, it will be updated . Please give me more comments !
边栏推荐
- Makefile
- [online tutorial] official iptables tutorial -- learning notes 1
- Cmake tips
- 全方位透析真实企业软件测试流程
- Optimization steps of SQL statements (II) -- MySQL statement optimization
- okcc呼叫中心没有电脑的坐席能不能开展工作?
- Libuv framework echo server C source code explanation (TCP part)
- linux下修改mysql用户名root
- Jinshan cloud team shared | 5000 words to understand how Presto matches with alluxio
- CMAKE小知识
猜你喜欢

一个小工具可以更快的写爬虫

mysql57 zip文件安装

LeetCode+ 66 - 70 高精度、二分专题

MySQL installation steps - how to create a virtual machine under Linux (1)

Comprehensive analysis of real enterprise software testing process

HTTP Caching Protocol practice

Alibaba cloud server creates snapshots and rolls back disks

Construction and exploration of vivo database and storage platform

看似简单的光耦电路,实际使用中应该注意些什么?

Pytorch RNN learning notes
随机推荐
Yesterday, I went to a large factory for an interview and asked me to do four arithmetic operations. Fortunately, I am smart enough
LLVM 与 Clang
Rust FFI 编程 - libc crate
NDK 交叉编译
Puge -- three basic sorting, bubbling, selection and quickness
MySQL master-slave replication, detailed configuration, create unable to connect processing prompt
饿久了,大脑会进入“省电模式”!感官被削弱,还看不清东西丨爱丁堡大学...
ABAP skill tree
炒股开户在手机上安全吗?
「杰伦熊」暴跌96.6% 明星带货NFT为何遇冷?
面经---测试工程师web端自动化---大厂面试题
R language ggmap visual cluster
A gadget can write crawlers faster
CMAKE小知识
vite2.9 中指定路径别名
ABAP 技能树
代码提交规范
力扣515.在每棵树行中找最大值
linux下修改mysql用户名root
extern “C“概述