Say I would like to define type Person
with "fields" Name
and Age
in terms of OPC-UA (it is trivial to define a node of any structure of ByteStream and serialize/deserialize data -- this is not what I am after). Also I would like to define variable node person
of type Person
and write to that node in one step. How to do it?
假设我想根据OPC-UA定义具有“字段”名称和年龄的Person类型(定义ByteStream的任何结构的节点并序列化/反序列化数据是微不足道的 - 这不是我所追求的)。另外我想定义Person类型的变量节点人,并一步写入该节点。怎么做?
Please note: when I update person
with such data (Kevin, 47)
, (Jane, 22)
client should get in subscription, or when reading the variable directly only those 2 pairs, not something like (Kevin,22)
.
请注意:当我用这样的数据更新人时(Kevin,47),(Jane,22)客户应该订阅,或者直接读取变量只有2对,而不是像(Kevin,22)。
I use OPC-UA .Net official stack, but I should be able to "translate" from any given framework.
我使用OPC-UA .Net官方堆栈,但我应该能够从任何给定的框架“翻译”。
1 个解决方案
#1
1
With OPC UA what has been trying to achieve above is possible.. it is called information modeling..
使用OPC UA可以实现上述目标。它被称为信息建模。
It depends on OPC UA SDK(Framework) to SDK whether it is supported..
它取决于OPC UA SDK(Framework)到SDK是否支持..
If the SDK supports the custom Object Types, Custom Variable types creation then, it can be created with the the help of simple nodeset XML file for creating custom types..
如果SDK支持自定义对象类型,然后创建自定义变量类型,则可以使用简单节点集XML文件创建它以创建自定义类型。
In your example you can create an Variable Type called Person and create an instance of the same. And you will be able to achieve push notifications as you described above as well..
在您的示例中,您可以创建名为Person的变量类型并创建相同的实例。如上所述,您将能够实现推送通知。
Please find the below mentioned Nodeset XML Snippet for creating the custom Object Type Custom Variable and creating the instance of the same.
请查找下面提到的Nodeset XML Snippet,以创建自定义对象类型自定义变量并创建相同的实例。
<!-- Below XML logic will explain on how to create Custom Object Type and Custom Variable Type-->
<UAObjectType NodeId="ns=2;s=PersonType" BrowseName="2:PersonType">
<DisplayName>PersonType</DisplayName>
<Description>A Person Object Type</Description>
<References>
<Reference ReferenceType="HasComponent">ns=2;s=NameType</Reference>
<Reference ReferenceType="HasComponent">ns=2;s=AgeType</Reference>
<Reference ReferenceType="HasSubtype" IsForward="false">i=58</Reference>
</References>
</UAObjectType>
<UAVariableType NodeId="ns=2;s=AgeType" BrowseName="2:AgeType" DataType="Byte">
<DisplayName>AgeType</DisplayName>
<Description>A Age variable type. it is component of AgeType</Description>
<References>
<Reference ReferenceType="HasComponent" IsForward="false" >ns=2;s=PersonType</Reference>
<Reference ReferenceType="HasSubtype" IsForward="false">i=63</Reference>
</References>
</UAVariableType>
<UAVariableType NodeId="ns=2;s=NameType" BrowseName="2:NameType" DataType="LocalizedText">
<DisplayName>NameType</DisplayName>
<Description>A Name Variable type. it is component of NameType</Description>
<References>
<Reference ReferenceType="HasComponent" IsForward="false" >ns=2;s=PersonType</Reference>
<Reference ReferenceType="HasSubtype" IsForward="false">i=63</Reference>
</References>
</UAVariableType>
<!-- Below XML logic will explain on how to create instance of an object using above mentioned types-->
<!-- This will create a person1 object inside the Object folder -->
<UAObject NodeId="ns=2;s=Person1" BrowseName="2:Person1">
<DisplayName>Person1</DisplayName>
<References>
<Reference ReferenceType="Organizes" IsForward="false">i=85</Reference>
<Reference ReferenceType="HasComponent">ns=2;s=Name1</Reference>
<Reference ReferenceType="HasComponent">ns=2;s=Age1</Reference>
<Reference ReferenceType="HasTypeDefinition" IsForward="false">ns=2;s=PersonType</Reference>
</References>
</UAObject>
<UAVariable NodeId="ns=2;s=Age1" BrowseName="2:Age1" DataType="Byte">
<DisplayName>Age1</DisplayName>
<Description>A Age variable type. it is component of AgeType</Description>
<References>
<Reference ReferenceType="HasComponent" IsForward="false" >ns=2;s=Person1</Reference>
<Reference ReferenceType="HasTypeDefinition" IsForward="false">ns=2;s=AgeType</Reference>
</References>
<Value>
<Byte>10</Byte>
</Value>
</UAVariable>
<UAVariable NodeId="ns=2;s=Name1" BrowseName="2:Name1" DataType="LocalizedText">
<DisplayName>Name1</DisplayName>
<Description>A Name Variable type. it is component of NameType</Description>
<References>
<Reference ReferenceType="HasComponent" IsForward="false" >ns=2;s=Person1</Reference>
<Reference ReferenceType="HasTypeDefinition" IsForward="false">ns=2;s=NameType</Reference>
</References>
<Value>
<LocalizedText>
<Locale>en</Locale>
<Text>MyName</Text>
</LocalizedText>
</Value>
</UAVariable>
If The SDK supports the nodeset file parsing, then please put this snippet in the existing nodeset file and import. Or create a nodeset file and put this snippet and import in your server code.
如果SDK支持节点集文件解析,请将此片段放在现有节点集文件中并导入。或者创建一个节点集文件,并将此片段和导入放入您的服务器代码中。
This will easily create a object types and its instances.
这将轻松创建对象类型及其实例。
I hope this helps.
我希望这有帮助。
Thank you.
谢谢。
#1
1
With OPC UA what has been trying to achieve above is possible.. it is called information modeling..
使用OPC UA可以实现上述目标。它被称为信息建模。
It depends on OPC UA SDK(Framework) to SDK whether it is supported..
它取决于OPC UA SDK(Framework)到SDK是否支持..
If the SDK supports the custom Object Types, Custom Variable types creation then, it can be created with the the help of simple nodeset XML file for creating custom types..
如果SDK支持自定义对象类型,然后创建自定义变量类型,则可以使用简单节点集XML文件创建它以创建自定义类型。
In your example you can create an Variable Type called Person and create an instance of the same. And you will be able to achieve push notifications as you described above as well..
在您的示例中,您可以创建名为Person的变量类型并创建相同的实例。如上所述,您将能够实现推送通知。
Please find the below mentioned Nodeset XML Snippet for creating the custom Object Type Custom Variable and creating the instance of the same.
请查找下面提到的Nodeset XML Snippet,以创建自定义对象类型自定义变量并创建相同的实例。
<!-- Below XML logic will explain on how to create Custom Object Type and Custom Variable Type-->
<UAObjectType NodeId="ns=2;s=PersonType" BrowseName="2:PersonType">
<DisplayName>PersonType</DisplayName>
<Description>A Person Object Type</Description>
<References>
<Reference ReferenceType="HasComponent">ns=2;s=NameType</Reference>
<Reference ReferenceType="HasComponent">ns=2;s=AgeType</Reference>
<Reference ReferenceType="HasSubtype" IsForward="false">i=58</Reference>
</References>
</UAObjectType>
<UAVariableType NodeId="ns=2;s=AgeType" BrowseName="2:AgeType" DataType="Byte">
<DisplayName>AgeType</DisplayName>
<Description>A Age variable type. it is component of AgeType</Description>
<References>
<Reference ReferenceType="HasComponent" IsForward="false" >ns=2;s=PersonType</Reference>
<Reference ReferenceType="HasSubtype" IsForward="false">i=63</Reference>
</References>
</UAVariableType>
<UAVariableType NodeId="ns=2;s=NameType" BrowseName="2:NameType" DataType="LocalizedText">
<DisplayName>NameType</DisplayName>
<Description>A Name Variable type. it is component of NameType</Description>
<References>
<Reference ReferenceType="HasComponent" IsForward="false" >ns=2;s=PersonType</Reference>
<Reference ReferenceType="HasSubtype" IsForward="false">i=63</Reference>
</References>
</UAVariableType>
<!-- Below XML logic will explain on how to create instance of an object using above mentioned types-->
<!-- This will create a person1 object inside the Object folder -->
<UAObject NodeId="ns=2;s=Person1" BrowseName="2:Person1">
<DisplayName>Person1</DisplayName>
<References>
<Reference ReferenceType="Organizes" IsForward="false">i=85</Reference>
<Reference ReferenceType="HasComponent">ns=2;s=Name1</Reference>
<Reference ReferenceType="HasComponent">ns=2;s=Age1</Reference>
<Reference ReferenceType="HasTypeDefinition" IsForward="false">ns=2;s=PersonType</Reference>
</References>
</UAObject>
<UAVariable NodeId="ns=2;s=Age1" BrowseName="2:Age1" DataType="Byte">
<DisplayName>Age1</DisplayName>
<Description>A Age variable type. it is component of AgeType</Description>
<References>
<Reference ReferenceType="HasComponent" IsForward="false" >ns=2;s=Person1</Reference>
<Reference ReferenceType="HasTypeDefinition" IsForward="false">ns=2;s=AgeType</Reference>
</References>
<Value>
<Byte>10</Byte>
</Value>
</UAVariable>
<UAVariable NodeId="ns=2;s=Name1" BrowseName="2:Name1" DataType="LocalizedText">
<DisplayName>Name1</DisplayName>
<Description>A Name Variable type. it is component of NameType</Description>
<References>
<Reference ReferenceType="HasComponent" IsForward="false" >ns=2;s=Person1</Reference>
<Reference ReferenceType="HasTypeDefinition" IsForward="false">ns=2;s=NameType</Reference>
</References>
<Value>
<LocalizedText>
<Locale>en</Locale>
<Text>MyName</Text>
</LocalizedText>
</Value>
</UAVariable>
If The SDK supports the nodeset file parsing, then please put this snippet in the existing nodeset file and import. Or create a nodeset file and put this snippet and import in your server code.
如果SDK支持节点集文件解析,请将此片段放在现有节点集文件中并导入。或者创建一个节点集文件,并将此片段和导入放入您的服务器代码中。
This will easily create a object types and its instances.
这将轻松创建对象类型及其实例。
I hope this helps.
我希望这有帮助。
Thank you.
谢谢。