MC_MoveVelocity
This function block commands an endless movement with a specified velocity.
Syntax
Definition:
FUNCTION_BLOCK MC_MoveVelocity
VAR_IN_OUT
Axis : Reference To AXIS_REF;
END_VAR
VAR_INPUT
Execute : BOOL;
Velocity : LREAL;
Acceleration : LREAL;
Deceleration : LREAL;
Jerk : LREAL;
BufferMode : EBufferMode;
CommandHandle : Reference To MC_CommandHandle;
END_VAR
VAR_OUTPUT
InVelocity : BOOL;
Busy : BOOL;
Active : BOOL;
CommandAborted : BOOL;
Error : BOOL;
ErrorId : UDINT;
END_VAR
Inputs
Name | Type | Default | Description |
|---|---|---|---|
Execute | BOOL |
| Triggers the command on a rising edge. |
Velocity | LREAL | #Invalid | Commanded velocity ([PosUnit]/s, the sign of this parameter determines the direction of movement). |
Acceleration | LREAL | #Default | Maximum acceleration ([PosUnit]/s^2, positive) |
Deceleration | LREAL | #Default | Maximum deceleration ([PosUnit]/s^2, positive) |
Jerk | LREAL | #Default | Maximum jerk ([PosUnit]/s^3, positive) |
BufferMode | Aborting | Chronological sequence of the command | |
CommandHandle | Reference To MC_CommandHandle |
| Optional. On a rising edge of Execute the handle is cleared and then attached to the command sent. Each call also updates the outputs of the handle. Like any input, it keeps the handle last passed, which must stay valid as long as the function block is called. |
Outputs
Name | Type | Description |
|---|---|---|
InVelocity | BOOL | Commanded velocity reached |
Busy | BOOL | Function block is not finished and new output values are to be expected. |
Active | BOOL | Function block has active control on the axis. |
CommandAborted | BOOL | Command is aborted by another command. |
Error | BOOL | Error occurred within function block. |
ErrorId | UDINT | Error identifier |
Further information
The function block MC_MoveVelocity is used to start an endless travel with a specified velocity and direction. As soon as the specified constant velocity is reached, the InVelocity output is set, and the function block has completed its operation. The function block does not perform any further monitoring of the motion. If the command is aborted during the acceleration phase, the CommandAborted output or, in the event of an error, the Error output is set.
The motion can be paused using MC_Halt and MC_Stop, or it can be canceled by another motion command.
If a motion command with the input BufferMode = Tc3_Mc3Base.EBufferMode.Aborting is applied to a coupled slave axis, this causes the axis to be automatically decoupled, followed by the execution of the command.
Note on the migration from NC2 to MC3
Unlike the NC2 function block of the same name, the MC3 function block MC_MoveVelocity has a signed Velocity input. The sign indicates the direction of motion.
Possible error codes
For this function block, the following values, among others, are possible for the ErrorId output:
Error(Hex) | Error(Dec) | Error type | Description |
|---|---|---|---|
0x813c | 33084 | Parameter | BufferMode is invalid. The BufferMode passed to the function block is unknown or not supported by the command (some commands accept only Aborting, others only Buffered). |
0x8145 | 33093 | Function Block | Mapping of cyclic interface between NC and PLC is missing (e.g., AXIS_REF, AXES_GROUP_REF, ...). A reference used by the function block (e.g., to an axis, group, mover or other motion object) is not linked to the corresponding NC object, or its cyclic mapping is incomplete. |
0x8146 | 33094 | Function Block | Invalid velocity value. The velocity was not set or the entered value is invalid. |
0x8151 | 33105 | State | Command is not allowed in current axis state. If the axis has no controller enable, is in error or has been added to a group, some commands are not permitted. |
0x819a | 33178 | NC Programming | Direction-dependent feed enable is missing. The execution of this command is not possible because of a missing direction-dependent feed enable. |
0x819b | 33179 | NC Programming | Controller enable is missing. The controller enable of the axis was withdrawn during a movement. The dynamics of the setpoint did not correspond to zero dynamics. |
0x81a9 | 33193 | Parameter | Invalid acceleration value. The supplied acceleration value is invalid (e.g. not a finite number, negative or outside the permitted range). |
0x81aa | 33194 | Parameter | Invalid deceleration value. The supplied deceleration value is invalid (e.g. not a finite number, negative or outside the permitted range). |
0x81ab | 33195 | Parameter | Invalid jerk value. The jerk value used for the motion is invalid (e.g., negative, zero, or outside the permitted range of the mover or axis). |
An overview of all NC error codes can be found here:
Version information
- TwinCAT Standard >= v3.1.4026.23.1
- TF5500 MC3 Base >= v4.0.6