Table of Contents

AxisSimulated

Namespace
ZEquipment
Extends
Inherited Properties
Inherited Methods
Implements

This function blocks implements the general axis interfaces for a fully simulated axis, which has no connection to any drive. It is intented for implementing machines before the actual specification of any axis is known.

The simulated axis supports all feature, which are supported by Zeugwerk Framework. Calling SetSimulation has no effect for this axis implementation.

FUNCTION_BLOCK AxisSimulated EXTENDS ZEquipment.Axis IMPLEMENTS ZEquipment.IAxisHoming, ZEquipment.IAxisMovePosition, ZEquipment.IAxisMoveVelocity, ZEquipment.IAxisMoveInterpolatedPosition, ZEquipment.IAxisMoveInterpolatedVelocity, ZEquipment.IAxisMoveInterpolatedCurrent, ZEquipment.IAxisFeedbackPosition, ZEquipment.IAxisFeedbackVelocity, ZEquipment.IAxisFeedbackCurrent, ZEquipment.IAxisHalt, ZEquipment.IAxisVelocityFeedrate, ZEquipment.IAxisBase, ZCore.IObject, ZCore.IBootable, ZCore.IError

Outputs

Diagnostics DiagnosticMessage

Constructor

FB_init

METHOD FB_init (
 bInitRetains : BOOL,
 bInCopyCode : BOOL,
 parent : ZCore.IManagedObject) : BOOL

Inputs

bInitRetains BOOL

if TRUE, the retain variables are initialized (warm start / cold start)

bInCopyCode BOOL

if TRUE, the instance afterwards gets moved into the copy code (online change)

parent IManagedObject

Returns

BOOL

Properties

ActualCurrent

Returns the actual current, which is used by the drive. The value returned is usually given in % of the nominal current.

PROPERTY ActualCurrent : LREAL

Property Value

LREAL

ActualFollowingError

Returns the deviation between the nominal position of the axis, according to the drive internal profile generator, to the actual position. The actual position is usually related to a position encoder or resolver 1 or 2 depending on which encoder is used for the actual movement. The value returned is given in drive positional-unit, which is usually millimeters or degrees, respectively.

By summing up the values of ActualFollowingError and ActualPosition it is possible to calculate the nominal position of the profile generator.

PROPERTY ActualFollowingError : LREAL

Property Value

LREAL

ActualPosition

Returns the actual position of the axis, which is usually related to a position encoder or resolver. The value returned is given in drive positional-unit, which is usually millimeters or degrees, respectively.

PROPERTY ActualPosition : LREAL

Property Value

LREAL

ActualSafetyState

This property can be used to test if a given safety feature of a drive is currently activated or not. Note that the property returns a "Flags" enumeration, which means that several bits of the returned value can be on at the same time.

Note

Retrieving the safety state of a drive is manufacturer specific.

  • Some drives may not support some of the features that are depicted in the returned value (some bits may always be 0).
  • Generic axes implementation (i.e. AxisPlcOpenMc) of the Zeugwerk Framework usually do not return the correct safety state of the drive. In doubt refer to the documentation of your specific implementation.
Warning

Since this axis implementation is generic it can not correctly return the safety state of the drive. The return value will always be 0 (no bit of the returned type is set)

PROPERTY ActualSafetyState : AxisSafetyStateFlags

Property Value

AxisSafetyStateFlags

ActualVelocity

Returns the actual velocity of the axis, which is usually calculated by using a position encoder or resolver. The value returned is given in drive velocity-units, which is usually millimeters-per-seconds or degree-per-seconds, respectively. In contrast to speed, velocity is a signed value such that it can have a positive or negative sign.

PROPERTY ActualVelocity : LREAL

Property Value

LREAL

Parameter

PROPERTY Parameter : IAxisPlcOpenMcParameter

Property Value

IAxisPlcOpenMcParameter

Referenced

This property can be used to test if an axis is referenced correctly. For axes that use an incremental encoder, this means that a homing procedure has been already been executed correctly. For axes that use an absolute encoder, this usually means that the encoder has been initialized correctly.

Read the documentation of your axes implementation (i.e. AxisPlcOpenMc) for more specifics.

PROPERTY Referenced : BOOL

Property Value

BOOL

Simulation

This property has no effect on this implementation.

PROPERTY Simulation : BOOL

Property Value

BOOL

State

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 State : ZCore.ObjectState

Property Value

ObjectState

VelocityFeedrate

This property is used to adjust the actual commanded velocity by a feedrate factor. Provide values between 0.0 and 1.0 which leads to 0% of the commanded velocity all the way up to 100%. The Feedrate functionality is automatically enabled after first power on of a PlcOpen axis.

PROPERTY VelocityFeedrate : LREAL

Property Value

LREAL

Methods

HaltAsync

By using this method the drive will stop with the same position profile (regarding jerk, acceleration and deceleration) as it is used to move the axis. Calling this method will beforehand automatically trigger the following sequences

  • Unlock the drive if it has been locked before (AxisPlcOpenMc only)

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.

METHOD HaltAsync (
 startToken : ZCore.IStartToken)

Inputs

startToken IStartToken

pass an StartToken instance here to check if the call was successfully executed

HomingAsync

Use this method to start the homing prodedure of the 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.

Note

Although (servo) drives usually offer a comparable method for homing, it is hard to abstract all methods, which might be possible to use for specific drive manufactures. Therefore, the actual selection of a homing method can usually be found in specific implementations with a SetHomingMethod method (i.e. AxisStepperEL7031.SetHomingMethod.

METHOD HomingAsync (
 startToken : ZCore.IStartToken)

Inputs

startToken IStartToken

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

IsAtPosition

Use this method to check if an axis is at a specific location in a given window. Note that some implementation may not use the parameter window, but may rely on a drive internal position-window. In doubt, read the documentation of your axes implementation (i.e. AxisPlcOpenMc).

METHOD IsAtPosition (
 pos : LREAL,
 window : LREAL) : BOOL

Inputs

pos LREAL

window LREAL

Returns

BOOL

MoveAbsoluteAsync

Starts to move the axes to a specific position with a given velocity. The method utilizes the drive's profile generator, which may offer to adjust acceleration, deceleration and jerk as PDOs or SDOs as well. The latter parameters are usually vendor specific and thus are not part of the interface. Use the Parameter property of each specialised axis to adjust said values before calling this method. 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
  • Enable the drive if it is not enabled yet

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.

If a MoveAbsoluteAsync or MoveRelativeAsync command is currently being executed, calling this method can be used to overwrite the current move command. This is an exeception to the rule that this method should not be called while the axis is busy.

METHOD MoveAbsoluteAsync (
 startToken : ZCore.IStartToken,
 position : LREAL,
 speed : LREAL)

Inputs

startToken IStartToken

pass an StartToken instance here to check if the call was successfully executed

position LREAL

Position in drive position units, usually millimeter or degree

speed LREAL

Speed in drive speed units, usually millimeter-per-second, or degree-per-second

MoveInterpolatedCurrentAsync

METHOD MoveInterpolatedCurrentAsync (
 startToken : ZCore.IStartToken)

Inputs

startToken IStartToken

pass an StartToken instance here to check if the call was successfully executed

MoveInterpolatedPositionAsync

This method is used to enter the drives interpolated position mode, i.e. CiA402 this mode is usually called cyclic-synchronous-position (CSP) mode. After the mode has been successfully switched to, SetInterpolatedPosition has to be called every PLC cycle, with a command value, which should not exceed any drive or physicial limit. The Async method is done if the object is not in its Busy state anymore.

Note

This method is used to start a specific operation mode of the drive. Calling any other Async method of the axes interfaces, will finish this mode. This includes methods like StopAsync and HaltAsync.

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.

METHOD MoveInterpolatedPositionAsync (
 startToken : ZCore.IStartToken)

Inputs

startToken IStartToken

pass an StartToken instance here to check if the call was successfully executed

MoveInterpolatedVelocityAsync

This method is used to enter the drives interpolated velocity mode, i.e. CiA402 this mode is usually called cyclic-synchronous-velocity (CSV) mode. After the mode has been successfully switched to, SetInterpolatedVelocity has to be called every PLC cycle, with a command value, which should not exceed any drive or physicial limit. The Async method is done if the object is not in its Busy state anymore.

Note

This method is used to start a specific operation mode of the drive. Calling any other Async method of the axes interfaces, will finish this mode. This includes methods like StopAsync and HaltAsync.

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.

METHOD MoveInterpolatedVelocityAsync (
 startToken : ZCore.IStartToken)

Inputs

startToken IStartToken

pass an StartToken instance here to check if the call was successfully executed

MoveRelativeAsync

Starts to move the axes to a specific distance from its current position with a given velocity. The method utilizes the drive's profile generator, which may offer to adjust acceleration, deceleration and jerk as PDOs or SDOs as well. The latter parameters are usually vendor specific and thus are not part of the interface. Use the Parameter property of each specialised axis to adjust said values before calling this method. 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
  • Enable the drive if it is not enabled yet

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.

If a MoveAbsoluteAsync or MoveRelativeAsync command is currently being executed, calling this method can be used to overwrite the current move command. This is an exeception to the rule that this method should not be called while the axis is busy.

METHOD MoveRelativeAsync (
 startToken : ZCore.IStartToken,
 distance : LREAL,
 speed : LREAL)

Inputs

startToken IStartToken

pass an StartToken instance here to check if the call was successfully executed

distance LREAL

Position in drive position units, usually millimeter or degree

speed LREAL

Speed in drive spped units, usually millimeter-per-second, or degree-per-second

MoveVelocityAsync

Starts to move the axes a specific velocity. The method utilizes the drive's profile generator, which may offer to adjust acceleration, deceleration and jerk as PDOs or SDOs as well. The latter parameters are usually vendor specific and thus are not part of the interface. Use the Parameter property of each specialised axis to adjust said values before calling this method. 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
  • Enable the drive if it is not enabled yet

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.

If a MoveVelocityAsync command is currently being executed, calling this method can be used to overwrite the current move command. This is an exeception to the rule that this method should not be called while the axis is busy.

METHOD MoveVelocityAsync (
 startToken : ZCore.IStartToken,
 velocity : LREAL)

Inputs

startToken IStartToken

pass an StartToken instance here to check if the call was successfully executed

velocity LREAL

velocity in drive velocity units, usually millimeter-per-second, or degree-per-second; for variable frequency drives rotations/minute are common

RebootAsync

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.

METHOD RebootAsync (
 startToken : ZCore.IStartToken)

Inputs

startToken IStartToken

pass an StartToken instance here to check if the call was successfully executed

SetInterpolatedCurrent

METHOD SetInterpolatedCurrent (
 startToken : ZCore.IStartToken,
 current : LREAL)

Inputs

startToken IStartToken

pass an StartToken instance here to check if the call was successfully executed

current LREAL

%, target current in percent of the drive's nominal current

SetInterpolatedPosition

This method has to be used together with MoveInterpolatedPositionAsync to send a command value to the drive. The latter should not exceed any drive or physicial limit.

If this method is called when MoveInterpolatedPositionAsync has not started before, the method will fail. Use startToken for testing if the method was executed correctly.

METHOD SetInterpolatedPosition (
 startToken : ZCore.IStartToken,
 position : LREAL)

Inputs

startToken IStartToken

pass an StartToken instance here to check if the call was successfully executed

position LREAL

In the drive's position units

SetInterpolatedVelocity

METHOD SetInterpolatedVelocity (
 startToken : ZCore.IStartToken,
 velocity : LREAL)

Inputs

startToken IStartToken

pass an StartToken instance here to check if the call was successfully executed

velocity LREAL

command velocity send cyclically in the drive's speed units

SetLogger

Use this method together with SetName to enable logging for this axis. Various methods of this implementation write log messages into the passed logger interface.

Note

Sometimes it is beneficial to disable logging by passing 0 to this method (e.g. for inputs or outputs which are switch very often).

METHOD SetLogger (
 logger : ZCore.ILogger)

Inputs

logger ILogger

SetName

Sets the name of this object as it will show up in any log messages that is created by this object. The name set with this method should be relatable to the name of the input in the electrical plan of your automation project to identify the corresponding input properly.

METHOD SetName (
 name : ZCore.ZString)

Inputs

name ZString

SetSimulation

Calling this method has no effect

METHOD SetSimulation (
 on : BOOL)

Inputs

on BOOL