Motion Control

Task Concept

The controller runs the user application in which motion control function blocks are called in a task separate from the real-time motion task in which motion profiles are calculated and Sercos communication takes place. These two tasks can have different cycle times.The cycle time of the user application task is typically 10 ms, but shorter cycle times down to 1 ms are possible. The real-time task operates with cycle times of 1 ms, 2 ms, or 4 ms, depending on the Sercos cycle time and the machine configuration (controller type, number of axes, etc.).

This separation provides a number of benefits in terms of increased performance. The user application can be run as slowly as required, for example, to allow for file system operations or network communication. Event handling, decision making, and command processing of the application (typically less time-critical) can be performed in this potentially slower task. However, modifications to the motion profile can be executed at maximum speed by executing and buffering the function blocks ahead of time.

This proven approach is also used by Schneider Electric PacDrive systems.

Programmers familiar with systems such as SoftMotion (which executes the user application in the real-time process) and standard PLCopen programming need to reconsider a number of common practices to take this approach to its full potential. A typical approach of PLCopen programming is to wait for a function block to “finish” (for example, outputs Done, inVelocity, EndOfProfile, InGear) and use the corresponding signals to execute the next function block.

To achieve the expected movement without sudden jumps (especially with velocity and/or acceleration values not equal to zero at the end of one motion job), function blocks must be executed ahead of time with MC_Buffer_Mode set to Buffered. This way, the motion profile of a function block becomes active in the same real-time cycle in which a preceding function block finishes.

If you trigger the start (Execute) of the subsequent function block via, for example, the EndOfProfile signal of the preceding function block instead of buffering it, one or several cycles of delay result in which no function block is active and the axis remains at a standstill until the next application task cycle starts the subsequent function block.

Axis_Ref

As defined by PLCopen, an Axis_Ref is used as an input to motion control function blocks to specify the axis to be used as the master axis or slave axis for that function block.

The Modicon M262 Motion Controller provides three types of implementations for the Axis_Ref:

oDrive axis

A drive axis provided by the LXM32S drive or by the generic Sercos Drive device object. It can be accessed via, for example, DRV_X.Axis. A drive axis can be used as a master axis or as a slave axis for any function block with the corresponding input. The position, velocity and/or /acceleration values of a drive axis are usually target values. The only exception is in situations in which the Modicon M262 Motion Controller does not control the movement of the axis (for example, during homing, during a stop performed autonomously by the drive, or when the drive power stage is disabled). In such conditions, the position of the axis is the feedback position and the velocity/acceleration are calculated based on the feedback position. A slave axis can still follow a master axis even when the master axis is not currently controlled by the Modicon M262 Motion Controller.

oVirtual axis

A virtual axis represents, for example, a virtual machine shaft, or any other intermediate axis for complex relationships between master axes and slave axes. A virtual axis can be created by declaring a VAR of type FB_ControlledAxis anywhere in the application. A virtual axis can be used as a master axis or as a slave axis for any function block with the corresponding input.

The Modicon M262 Motion Controller does not limit the number of virtual axes. However, take into account that a virtual axis has a performance impact on the CPU of the Modicon M262 Motion Controller that is comparable to that of a drive axis.

oEncoder input axis

An encoder input axis is provided by the on-board encoder input of the Modicon M262 Motion Controller. An encoder input axis can be used as a master axis only, not as a slave axis. When used as a master axis, the feedback values provided by the encoder are used as master axis position.

When a master axis becomes unavailable (for example, encoder is disconnected or inoperative), any slave axis following this master transitions to the PLCopen operating state ErrorStop. If you want to have slaves stop in a synchronous way in such a situation, implement an intermediate virtual axis between the axes:

If the master axis becomes unavailable, the intermediate virtual axis transitions to the PLCopen operating state ErrorStop. The axes following the intermediate axis remain in the PLCopen operating state SynchronizedMotion and continue to follow the intermediate virtual axis during its deceleration ramp.

Axis Configuration

The Modicon M262 Motion Controller supports both axis types implied by PLCopen:

oModulo axis

oLinear/finite axis (with or without movement limits)

An axis is configured by calling the corresponding method of Axis_Ref.

The modulo of an axis defined as modulo axis is observed regardless of the job or axis state (for example, even while the axis is disabled).

There is not necessarily a relation between the axis modulo and the cam application period (neither in X nor in Y direction), even if the cam is started in absolute mode. Refer to the description of the function block for details.

The reference position and the actual position are on the same side of the modulo jump. This means that, for example, in the case of an axis moving forward with modulo 360, the actual position can have a value of -2 (instead of 358) when the reference position is 1.

Absolute Position, Homing, and Absolute Movements

After a power cycle, a drive axis or an encoder axis usually restores its absolute position form the stored encoder position. This is done by multiplying the encoder position with the scaling of the drive and relating the value to the modulo position, if a modulo axis is used. However, the controller cannot verify that this restored absolute position is correct. The position may not be correct if, for example, the mechanical position has been modified (for example, motor, encoder, and/or gearbox have been replaced, or manual movements have been made during power off). In addition, the movement range of the axis must be mechanically restricted to be within less than one encoder overflow. Also, the gear ratio of a mechanical gearbox and/or the scaling factor for the drive must be selected in such a way that the encoder position of the encoder period can be resolved to an integer multiple of the application period.

To help avoid conditions with incorrect absolute positions, the Modicon M262 Motion Controller restores the absolute position, but does not automatically consider the axis or axes to be homed. An axis is only considered to be homed after the function block MC_Home or the function block MC_SetPosition have been executed successfully or the flag isHomed has been set to TRUE by the PLC application.

Warning_Color.gifWARNING

UNINTENDED EQUIPMENT OPERATION

oVerify that the axis has been homed properly after each power cycle and after each manual intervention before performing any other movements.

oVerify that the axis has been homed properly before performing any type of absolute movements.

oDo not set the flag isHomed to TRUE in the PLC application unless you have positively ensured and confirmed by appropriate means that the restored absolute position is correct.

oFully read and understand all pertinent documentation of all software and equipment used in your application/process.

Failure to follow these instructions can result in death, serious injury, or equipment damage.

Movement Range and Position Calculation With Floating-Point Numbers

The Modicon M262 Motion Controller uses floating-point numbers for absolute axis positions. It is inherent to floating-point numbers that the resolution (in absolute terms) decreases the further away the numbers are from zero. The position of a drive, on the other hand, is represented by real numbers (encoder increments) so that the resolution is always the same, regardless of how far away the number is from zero. Over time, this leads to reduced control accuracy and ultimately to a stop of the axis as a result of a detected error even if the floating point resolution is still sufficient.

Warning_Color.gifWARNING

UNINTENDED EQUIPMENT OPERATION

oUse the axis type modulo for an axis that moves in only one direction and continuously increments its position, such as a conveyor axis.

oUse the axis type linear/finite only for axes with physically limited movement ranges, for example, by means of limit switches.

Failure to follow these instructions can result in death, serious injury, or equipment damage.