InformationModel.MakeVariable(browseName, dataTypeId, variableTypeId, arrayDimensions)
Create 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
IUAVariable
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 IUAVariable MakeVariable(QualifiedNamebrowseName, NodeIddataTypeId, NodeIdvariableTypeId, uint[]arrayDimensions);
Arguments
- browseName(QualifiedName)
- TheBrowseNameof the new variable.
- dataTypeId(NodeId)
- The Data type contained in the new variable.MANCIA: The Data type is represented by a node inside theDataTypesclasses. For example,OpcUa.DataTypes.Boolean.
- variableTypeId(NodeId)
- A Variable type from which the new variable is derived, represented by a node inside theVariableTypesclasses (for example,FTOptix.CoDeSys.VariableTypes.Tag).
- arrayDimensions(uint[ ])
- Optional. The size of the Array.
Returns
- IUAVariable
- A C# object that corresponds to the project variable created.
Example
The following example shows an API that creates a
Tag2
variable of the CoDeSysTag
predefined type, that contains one Int32 data:var myVar = InformationModel.MakeVariable("Tag2", OpcUa.DataTypes.Int32, FTOptix.CoDeSys.VariableTypes.Tag);; Owner.Add(myVar);
Fornire un feedback