Table of Contents

IUnit

Namespace
ZApplication
INTERFACE IUnit EXTENDS ZCore.IObject, ZCore.IError
Extends
Inherited Properties
Inherited Methods

Methods

HaltAsync

Calling this method will trigger the halting mechanism of the currently active sequence. Calling this method also propagates the halt to all objects that are under control of the unit. To trigger a complete halt of a machine that is made of a unit hierarchy, where one unit controls all other units, it is enough to halt the topmost unit. Calling this method on a specific subunit is usually not required.

Caution

Please be aware that you can change the behavior of the running sequences with a halt and this behavior may not correspond to the expectations of a former caller. Since the task remains the same, a former requester (IStartToken of a previous method call) is not informed!

METHOD HaltAsync (
 startToken : ZCore.IStartToken,
 unit : REFERENCE TO Unit)

Inputs

startToken IStartToken

(optional) object to check if the method was executed successfully, if the unit is already controlled by a different unit already the startToken may indicate an error

unit REFERENCE TO Unit

unit that wants to take control of the object

HomingAsync

METHOD HomingAsync (
 startToken : ZCore.IStartToken,
 unit : REFERENCE TO Unit)

Inputs

startToken IStartToken

(optional) object to check if the method was executed successfully - may be 0

unit REFERENCE TO Unit

unit that wants to take control of the object

IsLocked

METHOD IsLocked () : BOOL

Returns

BOOL

IsLockedBy

METHOD IsLockedBy (
 unit : REFERENCE TO Unit) : BOOL

Inputs

unit REFERENCE TO Unit

Returns

BOOL

Name

Returns the name of the object as it has been set by calling the SetName. Usually this name is used for logging in particular extensions of ManagedObject.

In this particular case it returns the name of the unit in use like 'Infrastructure', 'PlateHandling', ... which can be set by using SetName()

METHOD Name () : ZCore.ZString

Returns

ZString

RunAutomaticAsync

METHOD RunAutomaticAsync (
 startToken : ZCore.IStartToken,
 unit : REFERENCE TO Unit)

Inputs

startToken IStartToken

(optional) object to check if the method was executed successfully - may be 0

unit REFERENCE TO Unit

unit that wants to take control of the object

StopAsync

Stops the unit abruptly. Calling this method takes the unit to its Stop Sequence, performing is a hard stop: If the unit is currently in an active sequence (i.e. Automatic) it will execute this sequence one more time so it is possible to react to the stop with OnStop. However, in the same cycle the unit is also switched to the stop sequence.

Stopping is allowed from any state, besides FaultReaction, Fault, Stop, Init, Boot and stopping ignores the locker of the unit. For instance, if unit1 controls subUnit1, unit2 may still stop SubUnit1. However, there is a subtle difference.

  • For subUnit1.StopAsync(startToken:=startToken, unit:=unit1), subUnit1 will end up in the Stopped state and will be done (subunit1.Done=TRUE), since it is a normal command from the controlling unit to the controlled unit.
  • For subUnit1.StopAsync(startToken:=startToken, unit:=unit2), subUnit1 will end up in the Stopped state but will report an error (subunit1.Error=TRUE), since it is a forced command from a non-controlling unit. The reported error is "Forcefully stopped by unit2".

The parameter unit of this method is only used for making forced stops easier to trace in the logger.

Note

Even if the unit is in an inactive state, calling this method will trigger the Stop Sequence and subsequently put the unit in its Stopped state. The behavior is implemented like this, because the Stop Sequence, while not always the case, can change the physical state of the machine (move axes, switch off power, ...)

METHOD StopAsync (
 startToken : ZCore.IStartToken,
 unit : REFERENCE TO Unit)

Inputs

startToken IStartToken

(optional) object to check if the method was executed successfully - may be 0

unit REFERENCE TO Unit

unit that requests the stop, if not locked by another unit, the passed unit will be the new locker of this object

TryLock

METHOD TryLock (
 unit : REFERENCE TO Unit) : BOOL

Inputs

unit REFERENCE TO Unit

unit that wants to take control of the object

Returns

BOOL

Unlock

This method releases the internal mutex of the Unit such that it may be locked and controlled by a different Unit (including itself).

The method will succeed (return TRUE) if the unit has been actually locked by the unit that is passed as parameter. If the object is still Busy (i.e. it is still executing an active Sequence like Automatic, Stop, FaultReaction, ...) the lock is passed the the object itself such that it can not be locked by a different Unit.

The method will fail (return FALSE) for the following coditions

  • unit does not actually own this object.
  • the object is locked by itself (unit = THIS), but is still Busy.
Note

The unlock mechanism ensures that a Unit that is Busy is always locked - at least by itself.

METHOD Unlock (
 unit : REFERENCE TO Unit) : BOOL

Inputs

unit REFERENCE TO Unit

unit that wants to take control of the object

Returns

BOOL