How to model a simple DataType?|OPC UA Standard|Forum|OPC Foundation

Avatar
Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
Lost password?
sp_Feed sp_PrintTopic sp_TopicIcon
How to model a simple DataType?
Avatar
Alexander Hoffman
Member
Members
Forum Posts: 3
Member Since:
01/08/2018
sp_UserOfflineSmall Offline
1
01/08/2018 - 02:46
sp_Permalink sp_Print

Hi all,

I am a masters student currently doing my thesis with Siemens, I am doing information model mapping into OPC UA. I am currently a little stuck on understanding how to implement simple DataTypes.

What I want:

I need to map two properties of a device description, namely I have two properties, one that describes what the data type is used for (eg, frequency input, input, output etc.) and one that describes the data type’s type (string, uint16 etc). I am hoping to model these two properties through a simple DataType where the base node description/one of the names can house the description of what the data type is used for and then the data type’s type is one of the inbuilt OPC UA types, as I will only ever have Ints, Floats and Strings. 

My problem:

I cannot figure out how this is modeled. Do I create a DataType node, edit it’s base node description attribute and then use a HasSubtype reference to the inbuilt DataType to show it’s inherited type?

Hopefully this isn’t an obvious problem, but for the life of me and my googling abilities, plus the Siemen’s resources that I can get my greasy fingers on, I can’t figure this.

Cheers,

Alex

Avatar
Randy Armstrong
Admin
Forum Posts: 1579
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
2
01/08/2018 - 07:12
sp_Permalink sp_Print

It really depends on what tools you are using to create your model.

If you are using the UA Model Design schema the declaration looks like this:

<DataType SymbolicName=”tns:Decimal” BaseType=”tns:Number” />

Avatar
Alexander Hoffman
Member
Members
Forum Posts: 3
Member Since:
01/08/2018
sp_UserOfflineSmall Offline
3
01/10/2018 - 03:22
sp_Permalink sp_Print

I am not using any tools, my supervisor and I are hoping more for an understanding of the semantics rather than a schema representation. None of the resources I have read really explain simple DataTypes in a way that makes one able to see how they are used in practice.

Avatar
Paul Hunkar
Member
Members
Forum Posts: 27
Member Since:
07/05/2017
sp_UserOfflineSmall Offline
4
01/10/2018 - 15:56
sp_Permalink sp_Print

Alex,

 OPC UA support a very robust information modelling capability.  It can represent any information model, Objects, variable , references and datatypes can all work together.  In OPC UA all variables have a datatype that can be assigned any of the built in type or any sub-type that you might define as part of a model.  The data type is readable from the variable instance. The variables also contain an optional description.  For what you are trying to model, you could just create VariableType that is  just a sub-type of BaseDataVariableType assign it the appropriate datatype and fill in the description. Than all instance of the variable would have the information you are looking for.

  If you actually want to assign a datatype to the variable that is a structure that combines the two items,(i.e. a description (which is just a string) and a DataType which is a nodeid ), you could create a subtype of Structured DataType, that is this specific structure.  Not sure if you would really need this?

Paul

Avatar
Randy Armstrong
Admin
Forum Posts: 1579
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
5
01/10/2018 - 16:44
sp_Permalink sp_Print

You can create a subtype of any built in type.

For example, the base spec defines the Duration type which is a DataType Node with a HasSubtype reference from the Double DataType Node.

The semantics associated with the Duration type are a double value representing a number of milliseconds.

Any Variable that represents a Duration can used the NodeId of the Duration DataType Node as the DataType.

On the wire, reads and writes would use Doubles.

You can define any subtype of any standard type and attach whatever semantics you want.

The only caveat is you cannot change the encoding on the wire for any DataType other subtypes of Structure.

Avatar
Alexander Hoffman
Member
Members
Forum Posts: 3
Member Since:
01/08/2018
sp_UserOfflineSmall Offline
6
01/11/2018 - 23:58
sp_Permalink sp_Print

Awesome thanks for the information!

Much appreciated

Forum Timezone: America/Phoenix
Most Users Ever Online: 510
Currently Online:
Guest(s) 39
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Forum Stats:
Groups: 2
Forums: 10
Topics: 1445
Posts: 4889