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.
Create an instance of the
SMC3_PersistPosition
function block for the axis.pp: SM3_BASIC.SMC3_PersistPosition;
Instantiate a persistent data structure of the
SMC3_PersistPosition_Data
type.pp_Data: SM3_BASIC.SMC3_PersistPosition_Data1;
Extend the program of the motion task so that a call of the
SMC3_PersistPosition
instance is implemented there.Call implemented in CFC:
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.
Create an instance of the
SMC3_PersistPosition
function block for the axis.ppst_X: SM3_BASIC.SMC3_PersistPositionSinglturn;
Instantiate a persistent data structure of the
SMC3_PersistPosition_Data
type.ppst_Data_X: SMC3_PersistPositionSingleturn_Data;
Extend the program of the motion task so that a call of the
SMC3_PersistPosition
instance is implemented and the persistent data structure of theSMC_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.
Create an instance of the
SMC3_PersistPositionLogical
function block for the axis.ppl: SM3_BASIC.SMC3_PersistPositionLogical;
Instantiate a persistent data structure of the
SMC3_PersistPositionLogical_Data
type.ppl_Data: SMC3_PersistPositionLogical_Data;
Extend the program of the motion task so that a call of the
SMC3_PersistPositionLogical
instance is implemented and the persistent data of typeSMC3_PersistPositionLogical_Data
is passed to it.