In exception to this rule a CLASS hierarchy is exported flat for the three reasons:
- in order to avoid the restriction of 8 levels on a SIMATIC PLC which reached in typical architectural designs quite easily
- to prove the same model as in ST programming, where members of a base class can be access from derived classes (same name scope)
- to harmonize the behavior in both workflows TIAX library and TIAX direct loading
'Flat' means that all variables of a class hierarchy are collected in the final class type. In the following example there will be four variables accessible for the type SpecificMotorA: Run (RW), ReverseDirection (RW), ActualVelocity (RO) and MaxAcceleration (RW).
CONFIGURATION config
VAR_GLOBAL
{S7.extern=ReadWrite}
mot1 : SpecificMotorA;
END_VAR
END_CONFIGURATION
{S7.extern=ReadWrite}
CLASS ABSTRACT AbstractMotor
VAR PUBLIC
Run : BOOL;
ReverseDirection : BOOL;
END_VAR
...
END_CLASS
{S7.extern=ReadWrite}
CLASS GenericMotor EXTENDS AbstractMotor
VAR INTERNAL
{S7.extern=ReadOnly}
ActualVelocity : LReal;
END_VAR
...
END_CLASS
{S7.extern=ReadWrite}
CLASS SpecificMotorA EXTENDS GenericMotor
VAR INTERNAL
{S7.extern=ReadWrite}
MaxAcceleration : LReal;
END_VAR
...
END_CLASS