Table of Contents

ObjectManager

Namespace
ZAux
Implements

This function block manages a list of IManagedObject and calls their Cyclic methods in a given interval (usually the PLC-taskcycle). The maximum amount of these objects handled by this class is given by MaxObjectManagerObjectCount

Objects, whose cyclic method should be called by this class, can be added using the AddObject method. Internally the function block stores interfaces to these objects. Objects should only be handled with the IObject within the framework and this class is the main exception to this rule, because it has to call the Cyclic method of an IManagedObject without the object having to implement IManagedObject.

FUNCTION_BLOCK ObjectManager IMPLEMENTS ZCore.IObject, ZCore.IBootable, ZCore.IError

Properties

Booted

PROPERTY Booted : BOOL

Property Value

BOOL

BootingHints

Suggests when the Cyclic method should be called during the booting phase of the application

PROPERTY BootingHints : ZCore.ManagedObjectBootingHintFlags

Property Value

ManagedObjectBootingHintFlags

Busy

If any object that has been added to the ObjectManager by calling AddObject is in one of the following busy states (Busy or Booting, this property returns TRUE.

Note that this property not only returns a flag, but also retrieves the busy state by iterating through all object registered with this object manager instance.

PROPERTY Busy : BOOL

Property Value

BOOL

Done

If all objects that have been added to the ObjectManager by calling AddObject are not busy and are not in an error state, this property returns TRUE.

Note that this property not only returns a flag, but also retrieves the error cause by iterating through all object registered with this object manager instance.

PROPERTY Done : BOOL

Property Value

BOOL

Error

If any object that has been added to the ObjectManager by calling AddObject is in an error state (Error or BootingError this property returns TRUE. The error information of the first object that is in an error state can be retrieved by the ErrorMessage method.

Note that this property not only returns a flag, but also retrieves the error cause by iterating through all object registered with this object manager instance.

PROPERTY Error : BOOL

Property Value

BOOL

Methods

AddObject

Adds an object to the ObjectManager list of cyclically to be called objects. This method returns true if an IManagedObject was added successfully. Otherwise the method returns false. The later occurs in the following cases:

  • the object interface is invalid
  • the internal list is full, in this case it might be necessary to adjust MaxObjectManagerObjectCount or use an additional ObjectManager instance
  • this particular object has already been added
METHOD AddObject (
 object : ZCore.IManagedObject) : BOOL

Inputs

object IManagedObject

Returns

BOOL

Cyclic

This method calls the Cyclic methods of all IManagedObject that have been added to this ObjectManager using AddObject

METHOD Cyclic ()

ErrorId

When the object Aborts the execution, the provided error id can be returned by calling this method; if the object was aborted by Assert() the errorId of the failure causing object is returned instead.

METHOD ErrorId () : UDINT

Returns

UDINT

ErrorMessage

This method returns an error messages that caused a fault in the object. The message that is returned by this method is only valid, if the object is in an error state (Error or BootingError, respectively). Notice that this method returns a string by value such that the internal message is copied.

Messages that are set at one point will not be cleared, because this could effect performance negatively.

METHOD ErrorMessage () : ZCore.ZString

Returns

ZString

ErrorSource

Returns the object that was the failure cause for this object to abort. This object gets automatically set when calling any of the abort methods. If the object itself is the failure cause, THIS^ is returned.

The object returned by this method is never 0, even if no error is present, use it in combination with a Error property.

METHOD ErrorSource () : ZCore.IError

Returns

IError

TraceErrorStack

This method is used internally when recording an error trace.

METHOD TraceErrorStack (
 trace : ZCore.IErrorTrace)

Inputs

trace IErrorTrace