SMC_MoveContinuousRelative (FB)

FUNCTION_BLOCK SMC_MoveContinuousRelative

This function block executes a relative movement with a given end-velocity. In contrast to MC_MoveRelative, it will not reach the target position with zero velocity, but with the specified EndVelocity. It is designed for generating via movements. Once the target position has been reached, the function block sets the InEndVelocity output and keeps this velocity until interrupted by another movement.

Note

Take care when using MC_SetOverride while this function block is active. If AdaptEndVelToAvoidOvershoot is set to FALSE, reducing the acceleration or jerk override or changing the velocity override can lead to a position overshoot or reversal. This happens if the (potentially overridden) EndVelocity cannot be reached from the current state using the overridden Acceleration, Deceleration, and Jerk limits.

InOut:

Scope

Name

Type

Initial

Comment

Inout

Axis

AXIS_REF_SM3

Reference to axis

Input

Execute

BOOL

Rising edge: Starts the execution of the function block.

Distance

LREAL

Relative (signed) distance to travel (in technical units [u])

Velocity

LREAL

Value of maximum velocity (not necessarily reached) [u/s]

EndVelocity

LREAL

Unsigned (!) value of end velocity in [u/s]. This end velocity may also be higher than Velocity.

EndVelocityDirection

MC_Direction

current

Determines the direction of end velocity. Permissible values: positive, negative, current. current will use the direction of the Axis when a rising edge for the Execute input is detected (velocity < 0 = negative, velocity >= 0 = positive). Not applicable: shortest, fastest.

Acceleration

LREAL

Value of acceleration (increasing energy of the motor) [u/s²]

Deceleration

LREAL

Value of deceleration (decreasing energy of the motor) [u/s²]

Jerk

LREAL

Value of the Jerk [u/s³]

AdaptEndVelToAvoidOvershoot

BOOL

In some cases, a given EndVelocity may lead to a position overshoot. For example, if the remaining distance is too short to reach the end velocity from the current velocity and acceleration, then the axis may turn in opposite direction, leading to an overshoot. Another case is an end velocity that has opposite direction to the distance to be travelled. To arrive at the target position with this velocity, the axis will first exceed the distance, reverse and accelerate to the end velocity, again causing an overshoot.

If the input AdaptEndVelToAvoidOvershoot is TRUE, then the effective end velocity will be adapted in order to avoid an overshoot.

These are the two situatons where an overshoot will be avoided:

  • First, if the remaining distance is too short to reach the desired EndVelocity. In this case, the effective end velocity is reduced (if the current velocity is lower) or increased (if the current velocity is higher) to the closest velocity that can be reached in the given distance.

  • Second, if the direction of the end velocity is opposite to the direction of the movement. In this case, the effective end velocity will be set to zero. Note that the direction of the movement is not determined by the current velocity and acceleration, but by the sign of the distacne to the target position.

Note that the output InEndVelocity is set only after the programmed end velocity has been reached. Once the given distance has been travelled the output DistanceTravelled is set and the axis is accelerated or decelerated to the given (programmed) EndVelocity.

Output

InEndVelocity

BOOL

TRUE: Commanded distance has been travelled and the programmed EndVelocity has been reached. If AdaptEndVelToAvoidOvershoot is FALSE, this output rises to TRUE in the same cycle as DistanceTravelled. Otherwise, it may rise to TRUE later.

DistanceTravelled

BOOL

TRUE: Commanded distance has been travelled. Axis runs with commanded velocity``EndVelocity`` (or possibly slower if AdaptEndVelToAvoidOvershoot has been set).

Busy

BOOL

TRUE: Execution of function block has not been finished yet.

CommandAborted

BOOL

TRUE: Command has been aborted by another command.

Error

BOOL

TRUE: Error has occurred within the function block.

ErrorID

SMC_ERROR

Error identification