InformationModel.MakeVariable<T>(browseName, dataTypeId, arrayDimensions)
Create a project variable, derived from the specified <T>
type, which contains the data type indicated by the second argument. It returns a C# object of the specified <T>
type corresponding to the project variable created. Using the third argument (optional), it is possible to create an array, specifying its type and size.
Tip: At design time, the API functions only if the specified type is a predefined type (contained in the FTOptix modules).
static T MakeVariable<T>(QualifiedName browseName, NodeId dataTypeId, uint[] arrayDimensions);
Arguments
T
IUAVariable
C# class, corresponding to the C# object class to return and to the variable type from which the new variable is derived.browseName
(QualifiedName)- The
BrowseName
of the new variable. -
dataTypeId
(NodeId) -
The Data type contained in the new variable.
Tip: A node inside theDataTypes
class represents the Data type. For example,OpcUa.DataTypes.Boolean
. arrayDimensions
(uint[ ])- Optional. The size of the Array.
Returns
IUAVariable
- A C# object that corresponds to the project variable created.
Examples
Below is an example in which a Speed2
variable of the Speed
type is created and returns a Speed
C# object:
var myVar = InformationModel.MakeVariable<Speed>("Speed2", OpcUa.DataTypes.Int32);
Owner.Add(myVar);