C# project nodes

Introduction

In the code of a NetLogic, the project nodes (see Information Model) are represented by special C# classes that contain and expose properties.

IUANode class

Displays the following base properties of any project node:

  • BrowseName: name of the node in the Q Studio project, cannot be localized

  • DisplayName: name of the node, usually visible in the user interface and can be localized in Q Studio

  • NodeId: unique ID for the node, automatically assigned by Q Studio

IUAObject class

Displays the properties of any instance of project object (e.g.: graphical objects, alarms, drivers, etc.).

It is an IUANode subclass and therefore displays all of its properties. It also exposes the ObjectType property, i.e., a reference to the object type (IUAObjectType class) from which the instance derives.

IUAObjectType class

Displays the properties of any type of project object (e.g.: graphical objects, alarms, drivers, etc.).

It is an IUANode subclass and therefore displays all of its properties. It also exposes the SuperType property, i.e., the C# object which represents the object type from which the same IUAObjectType derives.

IUAVariable class

Displays the properties of any project variable instance (base variable, analog variable, PLC tag, node pointer).

It is an IUANode subclass and therefore displays all of its properties. It also exposes the following properties:

  • ArrayDimensions: quantity of cells in the array

  • DataType: data type that the variable can contain (e.g.: OpcUa.DataTypes.Boolean, OpcUa.DataTypes.Int16).

  • Value: value of the variable (UAValue property)

  • VariableType: C# object that represents the type of variable from which the instance derives.

IUAVariableType class

Displays the properties of any type of project variable.

It is an IUANode subclass and therefore displays all of its properties. It also exposes the following properties:

  • ArrayDimensions: quantity of cells in the array

  • DataType: data type that the variable can contain (e.g.: OpcUa.DataTypes.Boolean, OpcUa.DataTypes.Int16).

  • SuperType: C# object that represents the variable type from which the same IUVariableType derives.

UAValue class

Display a value. The value can then be converted to and from different types of C# data.

Classes for custom and native types

A corresponding C# class is available for any project native or custom type. This class is always a subclass of IUAObject or IUAVariable, to which any properties specified in the type are added. For example, if a Motor object type is created in Q Studio with the two properties Speed and Acceleration, the Motor C# class is automatically created with the Speed, SpeedVariable, Acceleration, AccelerationVariable properties (for the classes of the properties see Object properties).

C# native class types are defined in Q Platform modules. The C# classes corresponding to custom types are instead automatically created by Q Studio when the project is saved.

Note

the type of an object or variable selected from which an instance derives can be displayed in Q Studio in the Property panel with a mouseover on Type or on its value.

Object properties

For each OPC UA object property, two C# property variants are available:

  • a property whose name is equal to the BrowseName of the property (for example, the Text class for the Text property of a Label object). This represents the value of the property (e.g. "Current speed is: "), whose data type is that of the same C# property (for example, string data type for Text).

  • a property of the IUAVariable type, whose name consists of the BrowseName of the property and the “Variable” suffix (for example, the TextVariable property corresponds to the Text property of a Label object). This represents the OPC UA node of the property. It is useful, for example, in setting dynamic links (see API for dynamic links) and for other instructions that require access to the IUAVariable class of the property.