Axis
- Namespace
- ZEquipment
- Implements
FUNCTION_BLOCK ABSTRACT Axis IMPLEMENTS ZCore.IObject, ZCore.IBootable, ZCore.IError
This class implements common behaviour of axes, like AxisPlcOpenMc. Methods that are implemented by this object forward their parameters to the actual axis implementation (i.e. AxisPlcOpenMcImpl).
The function block severs two main purposes.
- It is to avoid some code duplication, which would otherwise be needed. And more importantly
- the function block comes with an abstract Simulation property, which dictates all extensions of this function block to implement a logic to switch from a physical axis-instance to a simulated axis-instance, and vice-versa.
Properties
ActualMotionState
PROPERTY ActualMotionState : AxisMotionState
Property Value
Booted
PROPERTY Booted : BOOL
Property Value
- BOOL
Busy
PROPERTY Busy : BOOL
Use State
to find out if the object is busy executing its initialization phase,
or it is busy performing an actual sequence.
Property Value
- BOOL
Done
PROPERTY Done : BOOL
If the object is in idle state (often mentioned as "the object is not busy and not on error"),
this is indicated by this property returning TRUE
.
Property Value
- BOOL
DriveEnabled
PROPERTY DriveEnabled : BOOL
This property can be used to check if an axis is powered by its drive.
On the one hand, after successfully running an
enable drive command with EnableDriveAsync(on:=TRUE)
it is expected that this property is returning TRUE
.
On the other hand, after successfully executing EnableDriveAsync(on:=FALSE)
it is expected that this property is returning FALSE
.
If the STO of a drive is active or not enabled for any other reason, this property returns FALSE
as well.
Property Value
- BOOL
DrivePowered
PROPERTY DrivePowered : BOOL
This property returns TRUE
if the drive itself is powered and can provide power to an axis by calling
EnableDriveAsync.
If this property returns FALSE
usually an emergency-stop is pressed or power is missing for some other reason.
Property Value
- BOOL
DriveStateAsString
PROPERTY DriveStateAsString : ZCore.ZString
Returns the current state of the drive as string. The returned string may differ may differ severly between implementations, manufactures and depends if the axis is simulated or not. So, this should only be used for logging, debugging and visualization and not be linked to any logic.
Property Value
Error
PROPERTY Error : BOOL
Property Value
- BOOL
Manufacturer
PROPERTY Manufacturer : ZCore.ZString
Returns the manufacturer name of the axis as human-readable text
Property Value
Parked
PROPERTY Parked : BOOL
Axes can be parked by calling ParkAsync(on:=TRUE).
Parking means that any cyclic methods are skipped after executing a parking sequence.
If this property returns TRUE
, an axis can be "unparked" by using ParkAsync(on:=FALSE).
Property Value
- BOOL
Simulation
PROPERTY Simulation : BOOL
This property has to be overwritten by an actual axis implementation (i.e. AxisPlcOpenMc). It is used to switch the axis from a physical instance (i.e. AxisPlcOpenMcImpl) to a simulated axis-instance (i.e. AxisSimulatedImpl).
Settings this property with TRUE or FALSE takes care of automatically parking the unused axis instance and starting the booting sequence for the axis instance that should be used.
Property Value
- BOOL
State
PROPERTY ABSTRACT State : ZCore.ObjectState
Returns the object state of the axis object. This exposes if an object is still in its booting phase, had an error, or is busy executing an async action.
Property Value
Methods
EnableDriveAsync
METHOD EnableDriveAsync (
[input] startToken : ZCore.IStartToken,
[input] on : BOOL)
By using this method the power output of a drive to an axis can be enabled (on:=TRUE
) or disabled(on:=FALSE
), respectively.
Calling this method will beforehand automatically trigger the following sequences
- Unlock the drive if it has been locked before (AxisPlcOpenMc only)
- Reset any drive errors if there are still errors, which have not been acknowledged yet
- Write parameters to the drive that have been requested to read or write by using the Parameter property of each specialised axis
Executing this method while the drive is still Busy with another Async command will cause this method to fail. This can
be checked by submitting an StartToken as a startToken
. Simply pass such an object and Assert it
or check for startToken.Error
after calling this method.
Inputs
startToken
IStartTokenon
BOOL
ErrorId
METHOD ErrorId () : UDINT
Returns the error code of the first error source for this object. The method recursively goes down the error stack until the initial source of error of this object can be found. For performance reasons, the error stack is not cleared when the error state is reset. So this method should always used in conjunction with Error.
Returns
- UDINT
ErrorMessage
METHOD ErrorMessage () : ZCore.ZString
Returns the error description of the first error source for this object. The method recursively goes down the error stack until the initial source of error of this object can be found. For performance reasons, the error stack is not cleared when the error state is reset. So this method should always used in conjunction with Error.
Returns
ErrorSource
METHOD ErrorSource () : ZCore.IError
This method returns the direct error source of this object. This method can then be used to retrieve the actual error source by using the method of the returned IError.
Returns
Name
METHOD FINAL Name () : ZCore.ZString
Returns the names of all objects that are used within this axis and were set by calling [SetName](xref:ZEquipment.IAxisBase#SetName].
This method should be used with care. It copies several strings and should be called rarely and that means of course not every cycle, but only at initialization phases.
Returns
ParametrizeAsync
METHOD ParametrizeAsync (
[input] startToken : ZCore.IStartToken)
This method executes parametrization to the drive. Parameters to read and write can be set-up by using the Parameter property of each axis. Usually this method doesn't have to be called manually, because most other Async method of an axes are calling this method automatically internally. However, use this method if reading or writing is explicitly required at a specific point in the PLC.
Executing this method while the drive is still Busy with another Async command will cause this method to fail. This can
be checked by submitting an StartToken as a startToken
. Simply pass such an object and Assert it
or check for startToken.Error
after calling this method.
Inputs
startToken
IStartToken
ParkAsync
METHOD ParkAsync (
[input] startToken : ZCore.IStartToken,
[input] on : BOOL)
This method can be used to skip any internal cyclic method. Parking an axes and then "unparking" it will automatically execute a booting sequences, where the PLC variables are reinitialized. Parking is usually needed for drives that are optional for a machine and can be hotplugged.
Executing this method while the drive is still Busy with another Async command will cause this method to fail. This can
be checked by submitting an StartToken as a startToken
. Simply pass such an object and Assert it
or check for startToken.Error
after calling this method.
Inputs
startToken
IStartToken(optional) object to check if the method was executed successfully - may be 0
on
BOOL
RebootAsync
METHOD ABSTRACT RebootAsync (
[input] startToken : ZCore.IStartToken)
Reboot of the axis, which means that the internal state is switched back to Booting. In practice, this switches the axis' fieldbus back to PREOP, writes all parameters to the drive and then switches back to OP. Internally this is achieved by parking the axis and then unparking it.
Inputs
startToken
IStartTokenpass an StartToken instance here to check if the call was successfully executed
RegisterListener
METHOD ABSTRACT RegisterListener (
[input] listener : REFERENCE TO AxisListenerSequence) : REFERENCE TO AxisListenerSequence
This method called internally whenever an AxisListenerSequence is constructed to register the listener with this axis. Listeners, registered with an axis, are automatically called before and after movements, see AxisListenerType and ListenerState and even during the actual sequence is running
An axis holds a linked list for all listeners that are registered with it. This method returns a reference to the previous listener such that AxisListenerSequence may add itself to the linked list.
Inputs
listener
REFERENCE TO AxisListenerSequence
Returns
- REFERENCE TO AxisListenerSequence
ResetErrorAsync
METHOD ResetErrorAsync (
[input] startToken : ZCore.IStartToken)
By using this method any remaining unacknowledged errors on the drive are reset. Usually this method doesn't have to be called manually, because most other Async method of an axes are calling this method automatically internally. However, use this method if resetting the error manually is required for some reason.
- Unlock the drive if it has been locked before (AxisPlcOpenMc only)
- Write parameters to the drive that have been requested to read or write by using the Parameter property of each specialised axis
Executing this method while the drive is still Busy with another Async command will cause this method to fail. This can
be checked by submitting an StartToken as a startToken
. Simply pass such an object and Assert it
or check for startToken.Error
after calling this method.
Inputs
startToken
IStartToken(optional) object to check if the method was executed successfully - may be 0
StopAsync
METHOD StopAsync (
[input] startToken : ZCore.IStartToken)
By using this method the drive will stop with the quickstop profile (regarding jerk, acceleration and deceleration), usually this profile is quicker than the normal position profile, which is used for normal movement profiles and sometimes also for halt. Calling this method will beforehand automatically trigger the following sequences
To check if the method could be started successfully pass such an StartToken as a startToken
. Then
Assert this object or check for startToken.Error
. However, usually
StopAsync can always be called, only some very specific implementations may behave differently.
In doubt, refer to the documenation of a specific implementation.
Note
If an ongoing task was started with an ExecutionToken as the token parameter (e.g. _axis.AxisName.MoveAbsolutAsync(THIS^) in a Sequence), it gets informed (aborted), if not the same ExecutionToken is used here with this call.
Inputs
startToken
IStartToken(optional) object to check if the method was executed successfully - may be 0
TraceErrorStack
METHOD TraceErrorStack (
[input] trace : ZCore.IErrorTrace)
This method is used internally when recording an error trace.
Inputs
trace
IErrorTrace