当前位置:网站首页>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 !
边栏推荐
- 未来互联网人才还稀缺吗?哪些技术方向热门?
- Voice network VQA: make the user's subjective experience of unknown video quality in real-time interaction known
- Construction and exploration of vivo database and storage platform
- Puge -- singleton mode
- 最后的二十九天
- The practice of event driven architecture in vivo content platform
- MySQL installation steps - Linux configuration file JDK installation (II)
- R 语言 ggmap
- 【C语言】详解 C 语言获取数组长度
- Yesterday, I went to a large factory for an interview and asked me to do four arithmetic operations. Fortunately, I am smart enough
猜你喜欢
Last 29 days
The practice of traffic and data isolation in vivo Reviews
以动态规划的方式求解最长回文子串
一个小工具可以更快的写爬虫
云原生(待更新)
金山云团队分享 | 5000字读懂Presto如何与Alluxio搭配
What should I do if the version is incompatible with the jar package conflict?
"Jay bear" plummeted by 96.6%. Why is NFT with star goods cold?
A small code editor can also run programs -- a summary of sublime Text3 running programs in various languages
【C语言】详解 C 语言获取数组长度
随机推荐
QT -- 通讯协议
"Jay bear" plummeted by 96.6%. Why is NFT with star goods cold?
Reinforcement learning - grid world
The practice of traffic and data isolation in vivo Reviews
vite2.9 中指定路径别名
An important term in MySQL -- CRUD
小小一款代码编辑器竟然也可以有程序运行之功能——Sublime Text3运行各种语言程序的总结
ice, protobuf ,thrift -- 笔记
Evolution of vivo push platform architecture
File header information cross reference table
Using interceptor and cache to complete interface anti brushing operation
Devtools implementation principle and performance analysis practice
Force buckle 515 Find the maximum value in each tree row
Practice of traffic recording and playback in vivo
C语言教程大全
A gadget can write crawlers faster
Wechat applets - basics takes you to understand the life cycle of applets (I)
Libuv framework echo server C source code explanation (TCP part)
剑指offer II 091.粉刷房子
MySQL installation steps - how to create a virtual machine under Linux (1)