FB_PersistPosition - General Information

Overview

Type:

Function block

Available as of:

V2.2.0.0

Inherits from:

-

Implements:

-

Task

This function block allows you to restore the home position of an axis during phasing up of Sercos without having to go through a homing procedure. The function block supports LXM32S drives controlling approved motors containing multiturn motor encoders having a working range of 4096 turns and 131072 increments per turn.

NOTE: For more information on approved motors, contact your local Schneider Electric service representative.

Description

This function block allows you to restore the home position of an axis based on an axis position value and the corresponding encoder increment value previously stored in persistent memory. This restoration is performed during phasing up of Sercos so that the axis does not need to be homed again.

An axis is homed if the relationship between an axis position X (LXM32.Axis.lrPosition) and its mechanical position Y (as determined by the increments of its motor encoder) is known. This relationship is established by homing.

For an axis already homed, the relationship for a given axis position value can be calculated based on the known axis position value and the encoder increment value if these two values originate from the same Realtime Process (RTP) cycle. The relationship remains fixed as long as the values X and Y do not exceed the limits of their position ranges (modulo axis for X, encoder overflow or underflow for Y). The fixed relationship also persists beyond a power removal and rebooting of the controller under the condition that the axis has not been moved, for example by external forces, while power was off. This means that the homing relationship between a position value X_1 of a homed axis and an encoder increment value Y_1 can be used to determine the relationship between a read encoder increment value Y_2 and the corresponding axis position value X_2.

The function block stores the homing relationship of an axis via the tuple of the values of the axis position and the encoder increment in a persistent variable. After phasing up of Sercos, the home position of the axis can be set without a homing procedure, based on the stored relationship, the read encoder increment value and the calculated axis position value.

To use the function block:

Step

Action

1

Create a structure of type ST_PersistPositionData in an area of the persistent memory that is used exclusively for this function block. This structure is used for the axis position value and the corresponding motor increment value.

2

Create a function block FB_PersistPosition.

3

Connect the structure ST_PersistPositionData to the input/output iq_stHomedData of the function block.

4

Home the axis via the function block MC_HOME.

5

Set the operating state of the drive used with the axis to Operational (DRV_Lexium32s.SercosDiagnostics.ConnectionState == S3M.ET_SlaveCommunicationState.Operational).

6

Call the function block by setting the value at its input i_xEnable to TRUE.

NOTE: If the input i_xEnable is set to TRUE, but the operating state of the drive is not Operational:
  • The value at the output q_xPositionStored is FALSE.

  • The value at the output q_xPositionRestored is FALSE.

  • The value at the output q_xError is FALSE

    .
  • The value at the output q_etResult is OK

    .

If the home position is to be restored after a controller bootup, ensure that the axis is set to the original values before the function block is called in the application.

If the axis is correctly homed, each subsequent call of the function block FB_PersistPosition stores the axis position value and the corresponding motor encoder increment value in the structure ST_PersistPositionData. The value at the output q_xPositionStored is TRUE and the value at the output q_etResult is OK.

NOTE: If the specified axis is not homed when the function block is called:
  • The value at the output q_xPositionStored is FALSE.

  • The value at the output q_etResult is AxisNotHomed.

  • The value at the output q_xError is FALSE, that is, no error detected.

If the specified axis is invalid (for example, axis of a drive that is not supported):
  • The value at the output q_xPositionStored is FALSE.

  • The value at the output q_etResult is DeviceNotSupported.

  • The value at the output q_xError is TRUE, that is, error detected.

Once the function block FB_PersistPosition has saved the data in ST_PersistPositionData and Sercos is phased up again (for example, after a controller reboot), calling an enabled function block FB_PersistPosition reads the encoder increment value. The stored homing relationship is used to calculate the home position of the axis corresponding to the encoder increment value read. This home position is set to the axis and the value at the output q_xPositionRestored is set to TRUE. No homing procedure is required.

In addition to the axis position value and the encoder increment value, the function block stores the checksum of these two values for each cycle. When the home position is restored during phasing up of Sercos, the function block verifies the consistency of the two values on the basis of the checksum. If a checksum error is detected during the restoration of the home position (q_xError is TRUE), the output q_etResult is set to ChecksumInvalid. In this case, no values are stored or restored. Set the data in the structure ST_PersistPositionData to 0. Home the axis. Retry to execute the function blockFB_PersistPosition. Contact your Schneider Electric service representative if the condition persists.

The checksum verification is not performed if the values in the structure ST_PersistPositionData are zero.

You can call the function block cyclically in the background.

Requirements and Limitations

The following requirements and limitations apply to the use of the function block FB_PersistPosition:

  • The function block supports LXM32S drives controlling approved motors containing multiturn motor encoders having a working range of 4096 turns and 131072 increments per turn (refer to the user guide of the drive for details).

  • The function block does not support machine encoders.

  • While the function block is being executed, the values of axis parameters must not be modified.

  • The following parameters of the LXM32S drive require the following settings:

    • SimAbsolutePos: OFF (value 0, no simulation)

    • ShiftEncWorkRang: OFF

      (value 0, no shifting of encoder working range)
    • InvertDirOfMove: OFF

      (value 0, no inversion of direction of movement)
  • If the motor is replaced, or in the event of any other type of uncoupling of the motor from the mechanical system (for example, during maintenance), the axis needs to be re-homed before the function block can be used again.

  • The memory area for the persistent data must be used exclusively for this function block.

Interface

Input

Data type

Description

i_xEnable

BOOL

Starts (value TRUE) or terminates (value FALSE) the execution of the function block.

i_ifAxis

MOIN.IF_Axis

Reference to the axis for which the function block is to be executed.

Output

Data type

Description

q_xPositionStored

BOOL

Indicates whether storing of the home position was successful (value TRUE) or not (value FALSE).

q_xPositionRestored

BOOL

Indicates whether restoring of the home position was successful (value TRUE) or not (value FALSE).

q_xError

BOOL

Indicates whether the last execution of the function block was successful (value FALSE = no error detected) or not (value TRUE = error detected).

q_etResult

ET_Result

Provides information on the execution of the function block.

Input/Output

Data type

Description

iq_stHomedData

ST_PersistPositionData

Structure for the axis position value and the corresponding motor increment value.