01/08/2018
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
07/05/2017
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
05/30/2017
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.
1 Guest(s)