InformationModel.MakeVariable<T>(browseName, variableTypeId, dataTypeId, arrayDimensions)
Creates a project variable of the type indicated by the third argument, and 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 fourth argument (optional), it is possible to create an array, specifying its type and size.
static T MakeVariable<T>(QualifiedName browseName, NodeId variableTypeId, NodeId dataTypeId, uint[] arrayDimensions);
Arguments
T-
IUAVariableC# class, corresponding to the class of the C# object to return. browseName(QualifiedName)- The
BrowseNameof the new variable. variableTypeId(NodeId)-
The Variable type from which the new variable type is derived.
Tip: A node inside theVariableTypesclass represents the Data type. For example,FTOptix.CoDeSys.VariableTypes.Tag. -
dataTypeId(NodeId) -
The Data type contained in the new variable.
Tip: A node inside theDataTypesclass 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.
Example
var myTag = InformationModel.MakeVariable<FTOptix.CoDeSys.Tag>("CodesysTag", OpcUa.DataTypes.UInt16);
