FB_HomeAbs - General Information

Overview

Type:

Function block

Available as of:

V1.0.7.0

Inherits from:

-

Implements:

-

Versions:

Current version

Task

Write the encoder position of an axis such that a desired reference to the axis position (Axis.EncoderPosition) can be reestablished using FB_HomeSetPos in mode ET_HomeSetPosMode.RestorePosFromAxisencoder.

Description

The encoder of a servo axis is written. Afterwards the axis position (Axis.RefPosition) is set, according to the configuration of the function block. At the end, the axis position equates the value of input i_lrHomePosition, considering all the input parameters.

After the function block is switched on, the homing process is started by a positive edge at the input i_xExecute. The function block requests the disabling of the position control of the axis via the output q_xDisableDrive. Subsequently, the deactivation and the standstill of the axis are verified through the function block. After the verification the position is written to the encoder and the axis position is set, according to the input parameters.

The function block differentiates two use cases (periodic and non-periodic applications). The selection of the use case takes place via a valid value at the input i_IrUserPeriod of the function block.

Background Information for Using the FB_HomeAbs

After one-time writing the encoder value using the FB_HomeAbs function block – and so establishing a mechanical reference – later on (with FB_HomeSetPos in the mode ET_HomeSet­PosMode.RestorePosFromAxisencoder) a desired reference to the axis position (Axis.RefPosition) can be reestablished from the present encoder position (Axis.EncoderPosition).

PERIODIC Applications

In this use case the EncoderPosition and the RefPosition of the axis are set within the user-defined period. After the homing, the axis position is in the interval [0; i_lrUserPeriod].

Conditions

A valid value has to be defined at the input i_lrUserPeriod. This means, the value in periodic applications must be greater zero and an integer divider of the maximum possible encoder position (encoder period).

 EncoderPeriod = Axis.EncoderRange * Axis.FeedConstant * Axis.GearIn / Axis.GearOut

Information on the Value Range of i_lrHomePosition

Values that are not from the interval [0; i_lrUserPeriod] can also be defined at the input i_IrHomePosition. These values are calculated back to the interval.

Example for i_lrUserPeriod= 360 and Axis.Direction = TRUE

Function block

Object in the controller configuration

i_lrHomePosition

q_lrPosition

Axis.RefPosition

Axis.EncoderPosition

10

10

10

10

370

10

10

10

730

10

10

10

-10

350

350

350

-370

350

350

350

Information on the Direction of the Axis

The previous table describes the values that result by a right rotating motor direction (Axis.Direction= TRUE). This rotating direction is the standard setting of the axis. If the direction is changed to left (Axis.Direction= FALSE), then it must be considered, that the encoder position acts contrary to the axis position. Therefore the following changes apply for the listed table:

Example for i_lrUserPeriod= 360 and Axis.Direction = FALSE

Function block

Object in the controller configuration

i_lrHomePosition

q_lrPosition

Axis.RefPosition

Axis.EncoderPosition

10

10

10

350

370

10

10

350

730

10

10

350

-10

350

350

10

-370

350

350

10

Information on i_lrAbsEncOffset in Periodic Applications

With this use case the value at the input i_lrAbsEncOffset is ignored.

NON-PERIODIC Applications

The input parameter i_lrAbsEncOffset in non-periodic applications even allows to write/set negative values. Though the maximum possible encoder position (encoder period) is calculated:

 EncoderPeriod = Axis.EncoderRange * Axis.FeedConstant * Axis.GearIn / Axis.GearOut

After the homing the value range for the axis position is in the interval [-i_lrAbsEncOffset; EncoderPeriod -i_lrAbsEncOffset].

Conditions

A valid value has to be defined at the input i_lrAbsEncOffset. This means, the value must be greater than zero. In this case the value of the input i_lrUserPeriod must be =0.

Information on the Value Range of i_lrHomePosition

Values that are not from the interval [-i_lrAbsEncOffset; EncoderPeriod -i_lrAbsEn­cOffset] can also be defined at the input i_IrHomePosition. These values are calculated back to the interval.

Example for:

oi_lrAbsEncOffset = 60

oAxis.EncoderRange = 10

oAxis.FeedConstant = 360

oAxis.GearIn = 1

oAxis.GearOut = 1

oAxis.Direction = TRUE

Therefore we have an encoder period of 3600 and the following interval for the axis position [-60; 3540].

Function block

Object in the controller configuration

i_lrHomePosition

q_lrPosition

Axis.RefPosition

Axis.EncoderPosition

10

10

10

10

3539

3539

3539

3539

3541

-59

-59

3541

3599

-1

-1

3599

3610

10

10

10

7210

10

10

10

-10

-10

-10

3590

-59

-59

-59

3541

-61

3539

3539

3539

Information on the Direction of the Axis

The previous table describes the values that result by a right rotating motor direction (Axis.Direction= TRUE). This rotating direction is the standard setting of the axis. If the direction is changed to left (Axis.Direction= FALSE), then it must be considered, that the encoder position acts contrary to the axis position. Therefore the following changes apply for the listed table:

Example for:

oi_lrAbsEncOffset = 60

oAxis.EncoderRange = 10

oAxis.FeedConstant = 360

oAxis.GearIn = 1

oAxis.GearOut = 1

oAxis.Direction = FALSE

Function block

Object in the controller configuration

i_lrHomePosition

q_lrPosition

Axis.RefPosition

Axis.EncoderPosition

10

10

10

3590

3539

3539

3539

61

3541

-59

-59

59

3599

-1

-1

1

3610

10

10

3590

7210

10

10

3590

-10

-10

-10

10

-59

-59

-59

59

-61

3539

3539

61

NOTE: Exception Virtual Axis!

Using this function block only makes sense for real axes. With virtual axes the function block releases the diagnostic message q_etDiag = InputParameterInvalid in conjunction with q_etDiagExt = DriveInvalid.

NOTE: POU changes cycle time monitoring!

The POU relatively increases the settings of the cycle time monitoring in the enabled state.

The POU independently resets this relative increase when no longer required.

Hereto, the POU must be called-up correctly.

Interface

Input

Data type

Description

i_xEnable

BOOL

A rising edge FALSE -> TRUE activates the POU, a falling edge TRUE -> FALSE deactivates the POU.

A deactivated POU does not execute any actions.

i_ifDrive

IF_Drive

Input for the axis that shall be controlled.

i_lrHomePosition

LREAL

Position value (Axis.RefPosition) of the axis that it shall have at the position when i_xExecute FALSE -> TRUE (calculated back to the range i_lrUserPeriod or EncoderPeriod).

The position value i_lrHomePosition does not have to be within the range (0 ... EncoderPeriod or i_lrUserPeriod. However, after successful run of the POU the Axis.RefPosition is in the range i_lrUserPeriod or EncoderPeriod, see use cases above.

i_lrAbsEncOffset

LREAL

Absolute value by which the axis position can be reconstructed in the negative range in the case of non-periodic applications.

For 'i_lrUserPeriod = 0' this value must be greater than 0.

i_lrUserPeriod

LREAL

Machine period

> 0: periodic application: After homing the Axis.RefPosition is in the range (i_lrHomePos MOD i_lrUserPeriod); i_lrAbsEncOffset is not taken into account.

= 0: not periodic application: After homing the Axis.RefPosition is in the range - i_lrAbsEncOffset ... (EncoderPeriod - i_lrAbsEncOffset)

i_xExecute

BOOL

If i_xEnable = TRUE, homing can be started via this input. If homing has been started once, it is not possible to cancel it via i_xExecute TRUE -> FALSE.

Output

Data type

Description

q_xActive

BOOL

TRUE: The POU is active and has to be executed further.

FALSE: The POU is inactive.

q_xReady

BOOL

TRUE: The POU is ready to operate and can accept user commands.

FALSE: The POU is not ready to accept user commands.

q_xBusy

BOOL

TRUE: Homing is active, the POU has to be executed further

q_xDone

BOOL

TRUE: Homing completed

q_etDiag

GD.ET_Diag

General library-independent statement on the diagnostic.

A value not equal to ET_Diag.Ok corresponds to an diagnostic message.

q_etDiagExt

ET_DiagExt

POU-specific output on the diagnostic.

q_etDiag = ET_Diag.Ok -> Status message

q_etDiag <> ET_Diag.Ok -> Diagnostic message

q_sMsg

STRING[80]

Event-triggered message which gives more detailed information on the diagnostic state.

q_xDisableDrive

BOOL

TRUE: Requirement to disable position control

FALSE: Requirement to enable position control

q_lrPosition

LREAL

Axis.RefPosition of the axis

q_xHomeOk

BOOL

TRUE: Axis is homed

Examples

Example with Single-Turn-Encoder (Encoder period standardized to 0 ... 360° standardized)

i_lrHomePos

i_lrAbsEncOffset

i_lrUserPeriod

Axis position according to FB_HomeAbs or FB_HomeSetPos

Run range

50

1

0

50

-1 ... 359 (Delta 360)

1000

100

0

-80

-100 ... 260 (Delta 360)

0

100

0

0

-100 ... 260 (Delta 360)

-1000

100

0

80

-100 ... 260 (Delta 360)

1000

0

360

280

0 ... 360

-1000

0

360

80

0 ... 360

1

0

36

1

0 ... 36

35

0

36

35

0 ... 36

54

0

36

18

0 ... 36

-54

0

36

18

0 ... 36

-55

0

36

17

0 ... 36

If in the example above it shall be possible to reconstruct outside the encoder period (e.g. travel range -1000 ... -640), the FB_WriteDriveEncoder POU can be used alternatively in connection with FC_ReadDriveEncoder.

Diagnostic Messages

q_etDiag

q_etDiagExt

Enumeration value

Description

OK

Disabled

9

The POU is disabled.

OK

HomingDone

222

Homing has been performed.

OK

WaitForExecute

180

Wait for execution.

OK

WaitUntilDriveDisabled

179

Waiting until the drive is deactivated.

OK

WaitUntilEncoderWritten

188

Waiting until the encoder has been written.

OK

WaitUntilPositionSetFromEncoder

263

Wait until the position has been set according to the encoder position.

OK

WritingPositionDone

184

The encoder position has been written.

ControllerConditionInvalid

SercosInterfaceInvalid

262

The G_ifSercos interface is invalid.

DriveConditionInvalid

DriveEncoderInvalid

175

The drive encoder is invalid.

DriveConditionInvalid

DriveIsMoving

182

The drive is moving.

DriveConditionInvalid

DriveNotDisabled

183

The drive is not disabled.

DriveConditionInvalid

NoAccessToEEPROM

187

The EEPROM of the drive cannot be accessed.

DriveConditionInvalid

ProgrammingInProgress

189

Writing is being performed on the encoder.

DriveConditionInvalid

ProgrammingInvalidEEPROM

186

An error has been detected while writing on the encoder EEPROM.

ExecutionAborted

AsyncInitNotFinished

290

Init has not been completed yet.

ExecutionAborted

ColdResetOfControllerNecessary

297

A cold start of the controller is required

ExecutionAborted

NoAsyncTasksCreated

289

No asynchronous task has been generated.

HomingFailed

OutsideExecutionOfControllerStopSet

325

Action has been stopped after executing ControllerStopSet.

InputParameterInvalid

AbsEncOffsetRange

178

AbsEncOffset is outside the valid range.

InputParameterInvalid

AsyncInvalid

288

The value of IF_Async is invalid.

InputParameterInvalid

DriveInvalid

3

The connected drive is invalid.

InputParameterInvalid

UserPeriodRange

177

UserPeriod is outside the valid range.

SercosConditionInvalid

SercosNotInPhaseFour

19

The Sercos bus is not in phase 4.

UnexpectedProgramBehavior

AsyncAddWasNotSuccessful

284

It was not possible to transfer an asynchronous job to a task.

UnexpectedProgramBehavior

EncoderWriteTimeOut

185

Timeout during encoder writing.

UnexpectedProgramBehavior

InterfaceCastFailed

285

The prompt for the interface was unsuccessful.

UnexpectedProgramBehavior

SemaphoreMeCreateFailed

287

The creating of a Semaphore failed

UnexpectedProgramBehavior

UnexpectedFeedback

1

An unintended detected error occurred during execution.

UnexpectedProgramBehavior

UnknownState

2

The POU is in an undefined state.

AbsEncOffsetRange

Enumeration name:

AbsEncOffsetRange

Enumeration value:

178

Description:

AbsEncOffset is outside the valid range.

Issue

Cause

Solution

-

At the input i_lrAbsEncOffset, a number <= 0 or greater than the encoder period has been transferred.

For i_lrAbsEncOffset, the following must hold: 0 < i_lrAbsEncOffset < maximum possible value of Drive.EncoderPosition.

For the permissible value range for i_lrAbsEncOffset, also refer to q_sMsg output of FB_HomeAbs.

AsyncAddWasNotSuccessful

Enumeration name:

AsyncAddWasNotSuccessful

Enumeration value:

284

Description:

It was not possible to transfer an asynchronous job to a task.

Issue

Cause

Solution

-

An error has been detected and occurred in the internal execution.

Please inform the support team about this detected error.

AsyncInitNotFinished

Enumeration name:

AsyncInitNotFinished

Enumeration value:

290

Description:

Init has not been completed yet.

Issue

Cause

Solution

-

Init() method has not yet been completed.

Call up the Init() before you call up Start() for the first time.

After you have called up the Init, wait until Init has been executed successfully. (Init.q_xDone = TRUE)

AsyncInvalid

Enumeration name:

AsyncInvalid

Enumeration value:

288

Description:

The value of IF_Async is invalid.

Issue

Cause

Solution

-

No valid value has been transferred at the i_ifAsync input.

Verify the value at the i_ifAsync input for <> 0.

ColdResetOfControllerNecessary

Enumeration name:

ColdResetOfControllerNecessary

Enumeration value:

297

Description:

A cold start of the controller is required

Issue

Cause

Solution

-

Gc_udiNumOfAsyncTasks has been changed.

A cold start of the controller is required.

Disabled

Enumeration name:

Disabled

Enumeration value:

9

Description:

The POU is disabled.

The function block is deactivated, it executes no actions whatsoever. i_xEnable and q_xActive have the value FALSE.

DriveEncoderInvalid

Enumeration name:

DriveEncoderInvalid

Enumeration value:

175

Description:

The drive encoder is invalid.

Issue

Cause

Solution

-

The axis encoder is not supported.

Use an axis with a different encoder.

DriveInvalid

Enumeration name:

DriveInvalid

Enumeration value:

3

Description:

The connected drive is invalid.

Issue

Cause

Solution

-

No drive was applied at the i_ifDrive input.

A valid drive must be transferred to the i_ifDrive input.

-

The connected drive does not support all required functionalities.

Establish which functionalities are not supported by the drive by means of the q_sMsg output.

Use a drive that supports all required functionalities.

-

The connected drive is set to virtual.

The connected drive has to be a real axis.

-

The connected drive is deactivated.

The connected drive has to be an activated axis.

DriveIsMoving

Enumeration name:

DriveIsMoving

Enumeration value:

182

Description:

The drive is moving.

Issue

Cause

Solution

-

The axis is moving.

Verify the state of the axis.

DriveNotDisabled

Enumeration name:

DriveNotDisabled

Enumeration value:

183

Description:

The drive is not disabled.

Issue

Cause

Solution

-

The axis is not in AxisState 1

Verify the state of the axis.

EncoderWriteTimeOut

Enumeration name:

EncoderWriteTimeOut

Enumeration value:

185

Description:

Timeout during encoder writing.

Issue

Cause

Solution

-

The encoder writing process has taken too long.

Verify the connection to the encoder and retry.

HomingDone

Enumeration name:

HomingDone

Enumeration value:

222

Description:

Homing has been performed.

The homing sequence has been completed successfully.

InterfaceCastFailed

Enumeration name:

InterfaceCastFailed

Enumeration value:

285

Description:

The prompt for the interface was unsuccessful.

Issue

Cause

Solution

-

An error has been detected and occurred in the internal execution.

Please inform your Schneider Electric representative about this detected error.

NoAccessToEEPROM

Enumeration name:

NoAccessToEEPROM

Enumeration value:

187

Description:

The EEPROM of the drive cannot be accessed.

Issue

Cause

Solution

-

The access to the encoder has been denied.

Verify the axis state.

NoAsyncTasksCreated

Enumeration name:

NoAsyncTasksCreated

Enumeration value:

289

Description:

No asynchronous task has been generated.

Issue

Cause

Solution

-

Gc_udiNumOfAsyncTasks = 0

Allocate Gc_udiNumOfAsyncTasks with a value > 0 and <= 10.

OutsideExecutionOfControllerStopSet

Enumeration name:

OutsideExecutionOfControllerStopSet

Enumeration value:

325

Description:

Action has been stopped after executing ControllerStopSet.

Issue

Cause

Solution

-

User has stopped active homing movement with ControllerStopSet.

Restart movement or selected a different operating mode

ProgrammingInProgress

Enumeration name:

ProgrammingInProgress

Enumeration value:

189

Description:

Writing is being performed on the encoder.

Writing is being performed on the encoder of the axis.

ProgrammingInvalidEEPROM

Enumeration name:

ProgrammingInvalidEEPROM

Enumeration value:

186

Description:

An error has been detected while writing on the encoder EEPROM.

Issue

Cause

Solution

-

Writing is already being performed on the encoder.

Please retry later.

SemaphoreMeCreateFailed

Enumeration name:

SemaphoreMeCreateFailed

Enumeration value:

287

Description:

The creating of a Semaphore failed

Issue

Cause

Solution

-

An error has been detected and occurred in the internal execution.

Please inform the support team about this detected error.

SercosInterfaceInvalid

Enumeration name:

SercosInterfaceInvalid

Enumeration value:

262

Description:

The G_ifSercos interface is invalid.

Issue

Cause

Solution

-

The global Sercos interface G_ifSercos is invalid.

Ensure that the Sercos interface G_ifSercos outside the function block is not accidentally overwritten with 0.

SercosNotInPhaseFour

Enumeration name:

SercosNotInPhaseFour

Enumeration value:

19

Description:

The Sercos bus is not in phase 4.

Issue

Cause

Solution

-

The parameter State of the SERCOS bus is not 4.

Set the SERCOS bus parameter PhaseSet to 4.

Verify the SERCOS bus for errors.

UnexpectedFeedback

Enumeration name:

UnexpectedFeedback

Enumeration value:

1

Description:

An unintended detected error occurred during execution.

Issue

Cause

Solution

-

An internal execution error has been detected.

Please inform your Schneider Electric representative about this detected error.

UnknownState

Enumeration name:

UnknownState

Enumeration value:

2

Description:

The POU is in an undefined state.

Issue

Cause

Solution

-

An internal execution error has been detected.

Please inform your Schneider Electric representative about this detected error.

UserPeriodRange

Enumeration name:

UserPeriodRange

Enumeration value:

177

Description:

UserPeriod is outside the valid range.

Issue

Cause

Solution

-

The input i_lrUserPeriod is negative.

For the input i_lrUserPeriod, a positive value or zero must be specified.

-

The i_lrUserPeriod input does not fit into the encoder period.

The input i_lrUserPeriod must be chosen such that the following formula is fulfilled:

ABS(lrEncoderPeriode/i_lrUserPeriod - TRUNC_INT(lrEncoderPeriode / i_lrUserPeriod)) = 0

with

lrEncoderPeriode := EncoderRange * FeedConstant * DINT_TO_LREAL(GearIn) / DINT_TO_LREAL(GearOut)

EncoderRange, FeedConstant, GearIn and GearOut are parameters of the i_ifDrive axis.

WaitForExecute

Enumeration name:

WaitForExecute

Enumeration value:

180

Description:

Wait for execution.

The function block is ready. As reaction to a positive edge from i_xExecute, the data is written in the encoder and the axis position is set accordingly.

WaitUntilDriveDisabled

Enumeration name:

WaitUntilDriveDisabled

Enumeration value:

179

Description:

Waiting until the drive is deactivated.

The function block awaits the disabling of the axis.

WaitUntilEncoderWritten

Enumeration name:

WaitUntilEncoderWritten

Enumeration value:

188

Description:

Waiting until the encoder has been written.

Writing is being performed on the encoder of the axis.

WaitUntilPositionSetFromEncoder

Enumeration name:

WaitUntilPositionSetFromEncoder

Enumeration value:

263

Description:

Wait until the position has been set according to the encoder position.

The function block awaits the setting of the axis according to the encoder position.

WritingPositionDone

Enumeration name:

WritingPositionDone

Enumeration value:

184

Description:

The encoder position has been written.

Writing on the axis encoder has been completed.

Methods

Name

Description

RegisterLoggerPoint

Registering the logger points of the POU in the Application Logger