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>(QualifiedNamebrowseName, NodeIddataTypeId, uint[]arrayDimensions);
Arguments
- T
- IUAVariableC# class, corresponding to the C# object class to return and to the variable type from which the new variable is derived.
- browseName(QualifiedName)
- TheBrowseNameof the new variable.
- dataTypeId(NodeId)
- The Data type contained in the new variable.TIP: The Data type is represented by a node inside theDataTypesclasses. 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);
Provide Feedback