TypeDefinitionNodescan be complex. A complex TypeDefinitionNodealso defines Referencesto other Nodesas part of the type definition. The ModellingRulesdefined in 6.4.4specify how those Nodesare handled when creating an instance of the type definition.
A TypeDefinitionNodereferences instances instead of other TypeDefinitionNodesto allow unique names for several instances of the same type, to define default values and to add Referencesfor those instances that are specific to this complex TypeDefinitionNodeand not to the TypeDefinitionNodeof the instance. For example, in Figure 6the ObjectType“AI_BLK_TYPE”, representing a function block, has a HasComponent Referenceto a Variable“SP” of the VariableType“SetPoint”. “AI_BLK_TYPE” could have an additional setpoint Variableof the same type using a different name. It could add a Propertyto the Variablethat was not defined by its TypeDefinitionNode“SetPoint”. And it could define a default value for “SP”, that is, each instance of “AI_BLK_TYPE” would have a Variable“SP” initially set to this value.
This approach is commonly used in object-oriented programming languages in which the variables of a class are defined as instances of other classes. When the class is instantiated, each variable is also instantiated, but with the default values (constructor values) defined for the containing class. That is, typically, the constructor for the component class runs first, followed by the constructor for the containing class. The constructor for the containing class may override component values set by the component class.
To distinguish instances used for the type definitions from instances that represent real data, those instances are called InstanceDeclarations. However, this term is used to simplify this specification, if an instance is an InstanceDeclarationor not is only visible in the AddressSpaceby following its References. Some instances may be shared and therefore referenced by TypeDefinitionNodes, InstanceDeclarationsand instances. This is similar to class variables in object-oriented programming languages.