Skip to main content

Persisting an Axis Position

An axis which has an absolute encoder can save a position so that it retains its previous position after restarting the controller. Homing is not required. The SMC3_PersistPosition and SMC3_PersistPositionLogical function blocks provide the functionality for the save operation. The necessary data is saved in SMC3_PersistPosition_Data and SMC3_PersistPositionLogical_Data.

The bPositionStored output indicates whether the contents of PersistentData have changed. This occurs at different times depending on the type of persistence.

The value range persisted by the encoder must be configured at the SMC_PersistPosition.maxPersistedValue input. For multi-turn encoders, the value is set to 16#FFFFFFFFFF. For a 12-bit single-turn encoder, for example, the value is set to 2^12 = 4096.

For more information, see: Data Persistence

Tip

The instance is made persistent by means of a declaration as VAR_PERSISTENT or the Persistence Manager of the Application Composer.

Persisting the axis position of a multi-turn absolute encoder with a physical axis

Requirement: The axis has a multi-turn absolute encoder.

Use the SMC3_PersistPosition function block to make the position of the physical axis persistent. The respective program runs in the motion task.

  1. Create an instance of the SMC3_PersistPosition function block for the axis.

    pp: SM3_BASIC.SMC3_PersistPosition;

  2. Instantiate a persistent data structure of the SMC3_PersistPosition_Data type.

    pp_Data: SM3_BASIC.SMC3_PersistPosition_Data1;

  3. Extend the program of the motion task so that a call of the SMC3_PersistPosition instance is implemented there.

    Call implemented in CFC:

    _sm_img_call_of_SMC3_PersistPosition.png

    The function block is called in cycles with the motion task. The SMC3_PersistPosition instance performs the restoring of the saved position during the startup operation. In normal operation, the function block saves the actual position in the respective data structure.

Persisting the axis position of single-turn absolute encoder with physical axis

Requirement: The physical axis has a single-turn absolute encoder.

Use the SMC3_PersistPosition function block to make the position of the axis persistent. The respective program runs in the motion task. The position is displayed correctly only if the axis has not traveled any distance or only a short distance (maximum of half of the single-turn distance) between switching off and on the controller. For example, you can use a mechanical brake to do this. If the axis makes a large movement when the controller is switched off, then it receives an incorrect position. It is not possible to check by means of the FB.

  1. Create an instance of the SMC3_PersistPosition function block for the axis.

    ppst_X: SM3_BASIC.SMC3_PersistPositionSinglturn;

  2. Instantiate a persistent data structure of the SMC3_PersistPosition_Data type.

    ppst_Data_X: SMC3_PersistPositionSingleturn_Data;

  3. Extend the program of the motion task so that a call of the SMC3_PersistPosition instance is implemented and the persistent data structure of the SMC_PersistPosition_Data type is passed to it.

Persisting the axis position of a logical axis

Requirement: The axis is logical.

Use the SMC3_PersistPositionLogical function block to make the position of the logical axis persistent. This works only if the position of the superordinate physical axis was made persistent. The position of a virtual axis cannot be made persistent by means of these FBs.

  1. Create an instance of the SMC3_PersistPositionLogical function block for the axis.

    ppl: SM3_BASIC.SMC3_PersistPositionLogical;

  2. Instantiate a persistent data structure of the SMC3_PersistPositionLogical_Data type.

    ppl_Data: SMC3_PersistPositionLogical_Data;

  3. Extend the program of the motion task so that a call of the SMC3_PersistPositionLogical instance is implemented and the persistent data of type SMC3_PersistPositionLogical_Data is passed to it.