MC_BR_InitReceiveNetworkEnc

<< 点击显示目录 >>

主页  轴控开发使用手册 > ACP10/ARNC0帮助信息 > ACP10_MC运动库 > 分类的功能块 > 管理ACOPOS ParIDs >

MC_BR_InitReceiveNetworkEnc

This function block can be used to set the parameters for reading an encoder that is not connected to a drive over the network. In addition to the encoder position, it is also possible to read status information and homing events. The function block returns a ParID on the drive that stores the encoder position for further use.

Requirements for use

This function block can only be used on SG4 target system.

This function block can only be used for axes on a POWERLINK network.

This function block does not work with virtual axes, SIM and SDC axes, or ACOPOS-2 devices (8V1xxx.xx-2).

The virtual encoder (ENCOD0) is configured by this function block and cannot be used elsewhere.

The encoder must be in the same POWERLINK network as the drive that is reading from it (e.g. X2X module on a bus controller).

Reading an encoder over a network results in considerably higher dead time than reading an encoder directly on a drive. The encoder position of a network encoder is therefore only suitable for control under certain circumstances.

PLCopen axis states in which the function block is permitted to be enabled

Disabled

Function block

mc_br_initreceivenetworkenc

Parameter

I/O

Parameter

Data type

Description

IN

Axis

UDINT

Axis reference

IN

Execute

BOOL

Execution of the function block begins on a rising edge of this input.

IN

EncoderInformation

MC_NET_ENC_INFO_REF

Information about the encoder in the network

IN

EncoderParameters

MC_NET_ENC_PARAM_REF

Parameter for reading the encoder data

IN

ReceiveConfiguration

MC_NET_ENC_CONFIG_REF

Configuration for processing the read encoder data

OUT

Done

BOOL

Command executed

OUT

Busy

BOOL

The function block is active and must continue to be called.

OUT

Error

BOOL

Error during execution

OUT

ErrorID

UINT

Error numbers

OUT

PositionParID

UINT

ParID on the drive that holds the encoder position

Table: Parameter MC_BR_InitReceiveNetworkEnc

Data type MC_NET_ENC_INFO_REF and examples

Data type MC_NET_ENC_INFO_REF

Parameter

Data type

Description

Type

USINT

Type of encoder being read

mcINC ... Incremental encoder

mcINC_REF ... Incremental encoder with reference track

mcINC_ABS ... Incremental encoder with absolute information (e.g. EnDat 2.1)

mcABS ... Absolute encoder

AdrDeviceString

UDINT

Address of the string with the name of the I/O module containing the data points for the position and other values.

Note:

The string must be structured like for the AsIOAccRead function block from the AsIOAcc library (e.g. 'SS1.IF2.ST3').

AdrPosition

UDINT

Address of the string with the name of the data point (channel name) for the encoder position.

AdrPositionHW

UDINT

Address of the string with the name of the data point (channel name) for top 32 bits of the encoder position (if it exists).

Note:

Only for types mcABS and mcINC_ABS

AdrReferencePosition

UDINT

Address of the string with the name of the data point (channel name) for the reference event position.

Note:

Only required for type mcINC_REF.

AdrReferenceCount

UDINT

Address of the string with the name of the data point (channel name) for the reference event position.

Note:

Only required for type mcINC_REF.

AdrPositionTime

UDINT

Address of the string with the name of the data point (channel name) for the position timestamp.

AdrEncoderStatus

UDINT

Address of the string with the name of the data point (channel name) for the encoder status.

Note:

Data point identifiable as "-Status" or "-Error". The data type of the data point is never permitted to be BOOL!

Overview of parameters based on encoder type

Parameter

mcINC

mcINC_REF

mcINC_ABS

mcABS

AdrPosition

Required

AdrPositionHW

Not possible

Not possible

Required for 64-bit position

Required for 64-bit position

AdrReferencePosition

Not possible

Required

Not possible

Not possible

AdrReferenceCount

AdrPositionTime

Optional if "ReceiveConfiguration.Interpolation" and ".Extrapolation" = mcOFF

Required if "ReceiveConfiguration.Interpolation" or ".Extrapolation" = mcON

Note:

Urgently recommended in order to be able to detect encoder and network errors.

AdrEncoderStatus

Optional

Note:

Using it makes it possible to respond to encoder errors.

Example with SinCos incremental encoder

I/O configuration X20DC1073 (sin/cos incremental encoder)

scnshot_iocfg_x20dc1073_initreceivenetworkenc

NetEncoderInfoRef.Type := mcINC_REF;

DeviceString := 'IF3.ST6.IF1.ST2';

Position := 'Position';

PositionTime := 'PosTime';

ReferencePosition := 'Reference';

ReferenceCount := 'RefCycle';

NetEncoderInfoRef.AdrDeviceString := ADR(DeviceString);

NetEncoderInfoRef.AdrPosition := ADR(Position);

NetEncoderInfoRef.AdrPositionTime := ADR(PositionTime);

NetEncoderInfoRef.AdrReferencePosition := ADR(ReferencePosition);

NetEncoderInfoRef.AdrReferenceCount := ADR(ReferenceCount);

Example with EnDat encoder

X20DS1928 I/O configuration (EnDat encoder)

scnshot_iocfg_x20ds1928_initreceivenetworkenc

NetEncoderInfoRef.Type := mcINC_ABS; (or mcABS)

DeviceString := 'IF3.ST1.IF1.ST2';

Position := 'PositionLW';

PositionHW := 'PositionHW';

PositionTime := 'PosTime';

EncoderStatus := 'EnDatError';

NetEncoderInfoRef.AdrDeviceString := ADR(DeviceString);

NetEncoderInfoRef.AdrPosition := ADR(Position);

NetEncoderInfoRef.AdrPositionHW := ADR(PositionHW);

NetEncoderInfoRef.AdrPositionTime := ADR(PositionTime);

NetEncoderInfoRef.AdrEncoderStatus := ADR(EncoderStatus);

Data type MC_NET_ENC_PARAM_REF

Parameter

Data type

Description

ScaleIncrements

UDINT

Increments per encoder revolution

IncValueRangeHW

UDINT

"HighWord" range of values - upper word [Increments * 2^32]

IncValueRangeLW

UDINT

"LowWord" range of values - lower word [Increments]

ScaleUnits

UDINT

Units per encoder revolution (ScaleRevolutions)

ScaleRevolutions

UDINT

Number of encoder revolutions (that result in ScaleUnits)

CountDirection

USINT

Count direction of the encoder

mcSTANDARD … Not inverted

mcINVERSE … Inverted

IncValueRangeLW/HW:

If the value range is larger than can be represented by the UDINT data type (2^32 = 4 294 967 296 ), this must be split into high and low ranges.

Details about the resolution of the encoder in bit or decimal form can be found in the data sheet for the encoder.

Measurement range of the encoder [Inc.] = Resolution [Inc./Rev] x multi-turn revolutions

Example 1 (23-bit multi-turn encoder)

EnDat multi-turn encoder with 23-bit (2^23 = 8 388 608 inc/rev) resolution and 12-bit (2^12 = 4096 rev) multi-turn revolutions

Procedure:

Multiply the resolution of the encoder with the number of multi-turn revolutions: 8 388 608 x 4096 = 34 359 738 368

Compare whether this value > the UDINT limit (2^32 = 4 294 967 296). Answer for this example: Yes

To simplify things, this number is converted to a hexadecimal (HEX) value (e.g. with Windows Calculator). In this example, the value is (2^35 =) 34 359 738 368 => 0x800000000 (HEX format).

The hexadecimal format is better suited for grouping; 8 positions are grouped together: 0x(00000008) (00000000).

This now results in the values "IncValueRangeLW" = 0x00000000 = 0 and "IncValueRangeHW" = 0x00000008 = 8.

Example 2 (13-bit multi-turn encoder)

EnDat multi-turn encoder with 13-bit (2^13 = 8 192 inc/rev) resolution and 12-bit (2^12 = 4096 rev) multi-turn revolutions

Procedure:

Multiply the resolution of the encoder with the number of multi-turn revolutions: 8192 x 4096 = 33 554 432

Compare whether this value > the UDINT limit (2^32 = 4 294 967 296). Answer for this example: No

This now results in the values "IncValueRangeLW" = 33 554 432 and "IncValueRangeHW" = 0x00000000 = 0.

Example 3 (programmable multi-turn encoder)

Multi-turn encoder with 500 000 inc/rev and 10 000 multi-turn revolutions

Procedure:

Multiply the resolution of the encoder with the number of multi-turn revolutions: 500 000 x 10 000 = 5 000 000 000

Compare whether this value > the UDINT limit (2^32 = 4 294 967 296). Answer for this example: Yes

To simplify things, this number is converted to a hexadecimal (HEX) value (e.g. with Windows Calculator). In this example, the value is 5 000 000 000 => 0x12A05F200 (hex HEX format)

The hexadecimal format is better suited for grouping; 8 positions are grouped together: 0x(00000001) (2A05F200).

This now results in the values "IncValueRangeLW" = 0x2A05F200 = 705 032 704 and "IncValueRangeHW" = 0x00000001 = 1.

Example 4 (incremental encoder)

When using an incremental encoder, only position counters with 16 or 32 bits are supported.

Procedure

Checking the data type of the position counter

With a 16-bit data type (INT, UINT), "IncValueRangeLW" = 0x00010000 = 65536 and "IncValueRangeHW" = 0x00000000 = 0 are set.

With a 32-bit data type (DINT, UDINT), "IncValueRangeLW" = 0x00000000 = 0 and "IncValueRangeHW" = 0x00000001 = 1 are set.

Data type MC_NET_ENC_CONFIG_REF

Parameter

Data type

Description

Timeout

REAL

If values are not refreshed during this time, processing is aborted and an error message [s] is generated.

Range of values: 0.0004 - 0.0163

Interpolation

BOOL

If the network cycle time is > 400µs, interpolation of the read encoder position can be activated here.

mcOFF... 0 (default)

mcON.... 1

Note:

Activating interpolation increases dead time (+1 POWERLINK cycle)

Extrapolation

BOOL

If no new encoder positions are received for one or several network cycles, it is possible to activate extrapolation of the encoder position here.

mcOFF... 0 (default)

mcON .... 1

FilterTime

REAL

Time constant for position filter [s]

Default: 0.0 … Filter is disabled

Range of values: 0.0 - 1000.0

NetworkCompensation

REAL

The position is pre-calculated by this amount of time. This parameter can be used to compensate for network transfer times.

Default 0.0 … Pre-calculation is disabled

Range of values: 0.0 - 1.0

Note:

When the speed changes, the pre-calculated position may deviate significantly from the actual position.

Topics in this section:

Additional information

Error numbers