FB_HomeSetPos - General Information

Overview

Type:

Function block

Available as of:

V1.0.6.0

Inherits from:

-

Implements:

-

Versions:

Current version

Task

The positions of several objects (IF_Drive, L_Enc) shall be manipulated simultaneously or separately.

Description

This function block is used to set positions. After the i_xEnable input has enabled the function block, it awaits the i_xExecute input. Different types of functions can be called up using the i_etMode input.

Depending on the i_etMode input, the RefPosition of the axis, the position of a logical encoder, the axis and the logical encoder, the RefPosition of an axis to the EncoderPosition and the RefPosition of an axis to the specified RetainPosition can be set optionally.

ET_HomeSetPosMode.SetPosAxisPosition

In this mode, the function block sets the RefPosition of the axis to the value of the i_lrHomePo­sition input variables.

ET_HomeSetPosMode.SetPosLogEncoderPosition

In this mode, the function block sets the position of the logical encoder to the value of the i_lrEncoderPosition input variables.

ET_HomeSetPosMode.SetPosAxisAndLogEncoderPosition

In this mode, the block sets the RefPosition of the axis to the value of the i_lrHomePosition input variables and also sets the position of the logical encoder to the value of the i_lrEncoder­Position input variables.

ET_HomeSetPosMode.RestorePosFromAxisEncoder

The EncoderPosition of the drive is read out in this mode. Doing so requires the same parameters as used for writing the EncoderPosition with FB_HomeAbs. There are two different cases:

1. case i_lrUserPeriod = 0

Here, the AbsEncOffset input is taken into account when setting the RefPosition. This value causes a shift in RefPosition in relation to EncoderPosition. If the axis is driven into the negative range of position and EncoderPosition is reread, RefPosition is set to the correct value.

2. case i_lrUserPeriod > 0

Here, the i_lrAbsEncOffset input is not taken into account. The RefPosition is set to the EncoderWert. If the value is outside of the period value, the block determines the corresponding position within the period.

ET_HomeSetPosMode.RestorePosFromRetain

The EncoderPosition of the drive is read out in this mode. Based on the EncoderPosition and the ReferencePosition saved in the retentive variable at the i_pstRestorePosRetain input, the ReferencePosition is recalculated via the FC_RestoreAxisPosition function and the RefPosition of the axis is set to this value. You can specify the mandatory range for the calculated position using the i_lrRestoreWindow variable. If it is outside this range, an diagnostic message is displayed. The i_lrUserPeriod input is considered when setting the RefPosition.

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

SystemConfigurationItf.IF_Drive

Input for the axis that shall be controlled.

i_etMode

ET_HomeSetPosMode

Homing mode

i_lrHomePosition

LREAL

The position to which the axis shall be set.

i_lrEncoderPosition

LREAL

The position to which the logical encoder shall be set.

i_lrAbsEncOffset

LREAL

Encoder position offset

i_lrUserPeriod

LREAL

Machine period in which the axis position shall be set

i_lrRestoreWindow

LREAL

Maximum permissible deviation between the saved and the restored axis positions.

i_pstRestorePosRetain

POINTER TO ST_AxisRestorePosition

Retentive data of axis position.

i_xExecute

BOOL

A positive edge executes the position according to the mode selected in i_etMode.

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: The POU executes the issued user command.

FALSE: The POU is waiting for further user commands.

q_xDone

BOOL

TRUE: The user command has been executed.

FALSE: The user command is being executed, or none has been issued yet.

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_lrPosition

LREAL

Position of the axis

q_lrEncoderPosition

LREAL

Position of the logic encoder

q_xHomeOk

LREAL

TRUE: position setting has ended successfully

FALSE: position setting has not been executed yet

Input/Output

Data type

Description

iq_lencEncoder

SystemConfiguration.L_ENC

Input for the logical encoder for connecting to the master. An individual encoder must be applied for each POU instance.

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

WaitUntilHomingDone

265

Wait until the homing is completed.

DriveConditionInvalid

DriveEncoderInvalid

175

The drive encoder is invalid.

DriveConditionInvalid

RestoreInterrupted

196

Restoring was interrupted.

InputParameterInvalid

AbsEncOffsetRange

178

AbsEncOffset is outside the valid range.

InputParameterInvalid

CheckSumInvalid

193

The checksum is invalid.

InputParameterInvalid

DataNVRamInvalid

194

The non-volatile memory (NVRam) does not contain any more valid data.

InputParameterInvalid

DriveInvalid

3

The connected drive is invalid.

InputParameterInvalid

LencInvalid

162

The connected logical encoder is invalid.

InputParameterInvalid

PointerRestorePosRetainInvalid

264

The RestorePosRetain pointer is invalid.

InputParameterInvalid

UnknownMode

111

The Mode is indeterminable.

InputParameterInvalid

UserPeriodRange

177

UserPeriod is outside the valid range.

SercosConditionInvalid

SercosNotInPhaseFour

19

The Sercos bus is not in phase 4.

UnexpectedProgramBehavior

OutOfRestoreWindow

195

The position is outside the restore window.

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.

Has the following mode been selected at the i_etMode input of FB_HomeSetPos?

oET_HomeSetPosMode.RestorePosFromAxisEncoder

Issue

Cause

Solution

-

A number < 0 or greater than the encoder period has been transferred to the i_lrAbsEncOffset input.

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

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

If the mode mentioned above has not been selected, please inform the support team about this detected error.

CheckSumInvalid

Enumeration name:

CheckSumInvalid

Enumeration value:

193

Description:

The checksum is invalid.

Has one of the following modes been selected at the i_etMode input of FB_HomeSetPos?

oET_HomeSetPosMode.RestorePosFromRetain

Issue

Cause

Solution

-

The data saved in iq_pstRestorePosRetain are not consistent. The position cannot be restored.

Homing of the drive is again required.

If none of the modes mentioned above has been selected, please inform the support team about this detected error.

DataNVRamInvalid

Enumeration name:

DataNVRamInvalid

Enumeration value:

194

Description:

The non-volatile memory (NVRam) does not contain any more valid data.

Has one of the following modes been selected at the i_etMode input of FB_HomeSetPos?

oET_HomeSetPosMode.RestorePosFromRetain

Issue

Cause

Solution

-

The data saved in the NVRam are invalid. Thus, the position cannot be restored from iq_pstRestorePosRetain.

The EncoderRange parameter of the axis must be greater than 0.

For more details, see q_sMsg output.

If none of the modes mentioned above has been selected, please inform the support team about this detected error.

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.

Has one of the following modes been selected at the i_etMode input of FB_HomeSetPos?

oET_HomeSetPosMode.RestorePosFromAxisEncoder

oET_HomeSetPosMode.RestorePosFromRetain

Issue

Cause

Solution

-

The axis encoder is not supported.

The EncoderRange parameter of the axis must be greater than 0.

If necessary, use an axis with a different encoder type.

If none of the modes mentioned above has been selected, please inform the support team about this detected error.

DriveInvalid

Enumeration name:

DriveInvalid

Enumeration value:

3

Description:

The connected drive is invalid.

Has one of the following modes been selected at the i_etMode input of FB_HomeSetPos?

oET_HomeSetPosMode.RestorePosFromRetain

oET_HomeSetPosMode.SetPosAxisPosition

oET_HomeSetPosMode.RestorePosFromAxisencoder

oET_HomeSetPosMode.SetPosAxisAndLogEncoderPosition

Issue

Cause

Solution

-

At the input i_ifDrive, no drive was applied.

At the input i_ifDrive, a valid drive must be transferred.

If none of the modes mentioned above has been selected, please inform the support team about this detected error.

HomingDone

Enumeration name:

HomingDone

Enumeration value:

222

Description:

Homing has been performed.

The homing sequence has been completed successfully.

LencInvalid

Enumeration name:

LencInvalid

Enumeration value:

162

Description:

The connected logical encoder is invalid.

Has one of the following modes been selected at the i_etMode input of FB_HomeSetPos?

oET_HomeSetPosMode.SetPosLogEncoderPosition

oET_HomeSetPosMode.SetPosAxisAndLogEncoderPosition

Issue

Cause

Solution

-

At the input iq_lencEncoder, no encoder has been applied.

At the input iq_lencEncoder, a separate logical encoder must be transferred.

If none of the modes mentioned above has been selected, please inform the support team about this detected error.

OutOfRestoreWindow

Enumeration name:

OutOfRestoreWindow

Enumeration value:

195

Description:

The position is outside the restore window.

Has one of the following modes been selected at the i_etMode input of FB_HomeSetPos?

oET_HomeSetPosMode.RestorePosFromRetain

Issue

Cause

Solution

-

The axis has been moved too far since the last time the position has been saved.

Push the axis position back into the window.

Extend the limits of the window i_lrRestoreWindow.

If none of the modes mentioned above has been selected, please inform the support team about this detected error.

PointerRestorePosRetainInvalid

Enumeration name:

PointerRestorePosRetainInvalid

Enumeration value:

264

Description:

The RestorePosRetain pointer is invalid.

Has one of the following modes been selected at the i_etMode input of FB_HomeSetPos?

oET_HomeSetPosMode.RestorePosFromRetain

Issue

Cause

Solution

-

An invalid pointer was transferred to the i_pstRestorePosRetain input.

The address of the memory containing the structure values must be transferred to the i_pstRestorePosRetain input.

If none of the modes mentioned above has been selected, please inform the support team about this detected error.

RestoreInterrupted

Enumeration name:

RestoreInterrupted

Enumeration value:

196

Description:

Restoring was interrupted.

Has one of the following modes been selected at the i_etMode input of FB_HomeSetPos?

oET_HomeSetPosMode.RestorePosFromRetain

Issue

Cause

Solution

-

Reading the encoder has been interrupted repeatedly by the SERCOS.

Ensure that the execution of the function is not interrupted for too long by other tasks, so that it can be interrupted by the SERCOS task only once.

If none of the modes mentioned above has been selected, please inform the support team about this detected error.

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.

UnknownMode

Enumeration name:

UnknownMode

Enumeration value:

111

Description:

The Mode is indeterminable.

Issue

Cause

Solution

-

At the input i_etMode, an invalid value has been applied.

An element of the ET_HomeSetPosMode enumeration must be applied at the i_etMode input.

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.

Has one of the following modes been selected at the i_etMode input of FB_HomeSetPos?

oET_HomeSetPosMode.RestorePosFromAxisEncoder

oET_HomeSetPosMode.RestorePosFromRetain

Issue

Cause

Solution

-

An invalid value has been transferred to the i_lrUserPeriod input.

The following must apply: 0 <= i_lrUserPeriod

-

The value of the i_lrUserPeriod input does not fit into the encoder period.

Assign zero to the i_lrUserPeriod input if an offset is not to be considered.

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 axis.

If none of the modes mentioned above has been selected, please inform the support team about this detected error.

WaitForExecute

Enumeration name:

WaitForExecute

Enumeration value:

180

Description:

Wait for execution.

The function block is ready. As reaction to a positive edge of i_xExecute, the axis position and/or the logical encoder position are set according to parameterization.

WaitUntilHomingDone

Enumeration name:

WaitUntilHomingDone

Enumeration value:

265

Description:

Wait until the homing is completed.

Homing was triggered. The function block awaits the finish.

Methods

Name

Description

RegisterLoggerPoint

Registering the logger points of the POU in the Application Logger