Table of Contents

Instance

Namespace
ZCore
FUNCTION_BLOCK Instance

This class holds properties of an instance. Instantiate it inside of any object, which should be identifiable by a name (i.e. for logging purposes HMI, ...), to automatically get a name for every single instance of said object. If needed, the automatically generated name can be overwritten. The following examples shows how to use the object

FUNCTION_BLOCK SomeFunctionblock
VAR
  _instance : ZCore.Instance;
END_VAR
PROPERTY Name : STRING
// Getter of the Name property returns the automatically generated name
Name := _instance.Name;

Later, if to instances of SomeFunctionblock are instantiated with _instance1 : SomeFunctionblock and _instance2 : SomeFunctionblock the Name properties will return "Instance1" and "Instance2", respectively. The Instance object uses the actual name of the instance (here _instance1 and _instance2), but removes any prepending special characters and capitalizes.

Properties

Name

PROPERTY Name : REFERENCE TO ZString

Returns or sets the name of this instance. Per default the name is automatically generated from the instance path of the parent object.

Property Value

REFERENCE TO ZString

Methods

InstanceNameFromInstancePath

METHOD PRIVATE InstanceNameFromInstancePath () : STRING(ParameterList.MaxInstancePath)

Internal method that transforms an instance-path to the name of the instance. This is achived by finding the forelast range from '.' to '.' in the instance path, followed by stripping prepending special characters.

Returns

STRING(ParameterList.MaxInstancePath)