Back to top

Differences Between DISTANCE and POSITION Moves.

This article refers to G&L PiC application note document AN000003 and describes the difference between DISTANCE and POSITION moves.

DISTANCE:

DISTANCE moves are incremental from the current position when the move becomes active in the que.

In DISTANCE moves the command delta is calculated based on the input DIST value.  The endoint position is based on the command delta and the current command position.  The equations:

            Command Delta = DIST*(FU/LU)

                        DIST - distance value at DISTANCE move function DIST input

                        FU - feedback units entered in servo setup.

                        LU - ladder units entered in servo setup.

            Command Endpoint = Command Delta + Current Command Position

The axis moves the incremental integer amount calculated  in Command Delta.  Values to the right of the decimal are truncated.

POSITION:

POSITION moves are absolute to the position specified at the POS input of the function.

POSITION moves calculate the Command Endpoint based on the value at the POS input.  The Command Delta is then calculated based on t he Current Command Position and the Command Endpoint.  The Equations:

            Command Endpoint = POS*(FU/LU)

                        POS - position value at POSITION move function POS input.

                        FU - feedback units entered in servo setup.

                        LU - ladder units entered in servo setup.

The axis moves to the Command Endpoint.  Values to the right of the decimal are truncated.
A problem can occur when using DISTANCE moves and making repeated short moves and FU/ LU is a non integer number.

Example difference between DISTANCE and POSITION.

TABLE 1

FU = 25,400    LU = 10,000   FU/LU = 2.54                           Initial position 1.0000

DIST (LU)

Current Command

Position (FU)

Calculated DIST

(FU)

Command Endpoint

(FU)

Endpoint (LU)

10

25400

25

25425

1.0010

10

25425

25

25450

1.0020

10

25450

25

25475

1.0030

10

25475

25

25500

1.0039

10

25500

25

25525

1.0049

10

25525

25

25550

1.0059

10

25550

25

25575

1.0069

10

25575

25

25600

1.0079

10

25600

25

25625

1.0089

10

25625

25

25650

1.0098

TABLE 2

FU = 25,400    LU = 10,000  Initial position 1.0000

POS(LU)

Current Command

Position (FU)

Calculated DIST

(FU)

Command Endpoint

(FU)

Endpoint (LU)

1.0010

25400

25

25425

1.0010

1.0020

25425

25

25450

1.0020

1.0030

25450

26

25476

1.0030

1.0040

25476

25

25501

1.0040

1.0050

25501

26

25527

1.0050

1.0060

25527

25

25552

1.0060

1.0070

25552

25

25577

1.0070

1.0080

25577

26

25603

1.0080

1.0090

25603

25

25628

1.0090

1.0100

25628

25

25654

1.0100

Notice that the values in the Endpoint columns of table 1 and 2 differ.  Table 1 loses .0001 in two places.  At 1.0040 it becomes 1.0039 and at 1.0100 it becomes 1.0098.

Solution:

A DISTANCE function style of move can be done by doing a READ_SV of Command Position, (variable 3), then add the DIST value to the Command Position for the POS input value of a POSITION function move.