6.1Position Control

Version 2.10 by Leo Wei on 2022/07/29 10:02

Instruction

Position control mode is the most important and commonly used control mode of servo system. Position control refers to controlling the position of the motor through position commands, determining the target position of the motor based on the total number of position commands, and the frequency of the position command determines the rotation speed of the motor. The servo drive could achieve fast and accurate control of the position and speed of the machine. Therefore, the position control mode is mainly used in applications requiring positioning control, such as manipulators, chip mounters, engraving machines, CNC machine tools, etc.

The block diagram of position control is as follows:

6.1Position Control Mode_html_609e40846452ee6f.jpg

Figure 6-2 Position control diagram

Position Reference Input Setting

The servo drive has 1 set of pulse input terminals for receiving position pulse input (through the CN2 terminal of the drive)

6.1Position Control Mode_html_b4583250d8c6f14a.jpg

The reference from the host controller could be differential output or open collector output. The maximum input frequency is shown in the following table:

Pulse TypeDifferentialOpen collector
Max. frequency500k200k
Voltage5V24V
  1. Low-speed Pulse Input   Differential drive mode

6.1Position Control Mode_html_490dedbefe04fcc2.jpg

  1. OC mode

6.1Position Control Mode_html_569c7689f69f646.jpg

  1. Position pulse selection

The servo drive supports three pulse input formats:

Direction + pulse (positive logic),Phase A + phase B quadrature pulse (4-frequency multiplication), CW + CCW

CodeParameter NameProperty

Effective

Time

RangeFunctionUnitDefault
P0-12Position pulse type selectionAt stop

Power-on

again

0~2

0:Direction + pulse (positive logic)

1:CW/CCW

2:Phase A + phase B quadrature pulse (4-frequency multiplication)

-0

The corresponding pulse waveform is as follows:

[P0-12]=0 (Direction + pulse(positive logic))

PULSE:Pulse SIGN:Signal

Positive pulse waveformNegative pulse waveform
6.1Position Control Mode_html_7a9487f068524a06.jpg6.1Position Control Mode_html_a14dfb549ce24194.jpg

(b)[P0-12]=1(CW/CCW)

PULSE:Pulse SIGN:Signal

Diagram
6.1Position Control Mode_html_a902eee139336d62.png

(c)[P0-12]=2(Phase A + phase B quadrature pulse (4-frequency multiplication))

PULSE(A phase):pulse SIGN(B phase):signal

Positive pulse waveformNegative pulse waveform

A advances B by 90°

6.1Position Control Mode_html_b76ec4546293bb58.png

B advances A by 90°

6.1Position Control Mode_html_811c198d2fd30ab6.png

Position pulse frequency and anti-interference level

Filtering time is necessary for the reference input pin to prevent external interference input to the driver and affect the control of the motor. The signal input and output waveforms with filtering enabled are shown in the following figure:

6.1Position Control Mode_html_ae99a14a8a0edd6a.jpg

Figure 6-3 Filtering signal waveform

The input pulse frequency refers to the frequency of the input signal, and the frequency of the input pulse command could be modified through the function code [P0-13]. If the actual input frequency is greater than [P0-13], it may cause pulse loss or alarm. The function code [P0-14] could adjust the position pulse anti-interference level, the greater the value, the greater the depth of the filter.

Relevant function code:

CodeParameter NameProperty

Effective

Time

RangeFunctionUnitDefault
P0-13Position pulse frequencyAt stop

Power-on

again

1~500Set the maximum pulse frequencykHz300
P0-14Position pulse anti-interference levelAt stop

Power-on

again

1~3

Set the pulse anti-interference level.

1:Low anti-interference level. (0.1)

2: Medium (0.25)

3: High (0.4)

-2

Electronic Gear Ratio

[Glossary]

Reference unit: It means the minimum value the host controller input to the servo drive.

Encoder unit: It means that the value from the input reference processed with the electronic gear ratio.

[Electronic gear ratio definition]

In position control mode, the input position reference (reference unit) defines the load displacement. the motor position reference (encoder unit) defines the motor displacement. The electronic gear ratio is used to indicate the relationship between input position reference and motor position reference. By dividing (electronic gear ratio < 1) or multiplying (electronic gear ratio > 1) the electronic gear ratio, the actual motor rotating or moving displacement within the input

position reference of one reference unit could be set.

[Setting range of electronic gear ratio]

The setting range of the electronic gear ratio should meet the following conditions:

6.1Position Control Mode_html_2c181c45c26d57f7.jpg

Otherwise, it would display [Er. 35] "Electronic gear ratio setting over limit" fault.

Electronic gear ratio setting Flowchart:

6.1Position Control Mode_html_ad9e5ff442164b5d.jpg

Figure 6-4 Electronic gear ratio setting flowchart

Firstly, confirm the mechanical parameters, including confirming the reduction ratio, ball screw lead, gear diameter in gear transmission, pulley diameter in pulley transmission, etc. Confirm the resolution of the servo motor encoder used.

Confirm the parameters such as machine specifications and positioning accuracy, and determine the load displacement corresponding to the position command output by the host computer. Combine information including the mechanical parameters and the load displacement corresponding to one position command to calculate the position command value required for one rotation of the load shaft.

Electronic gear ratio = encoder resolution / position command (command unit) required for one revolution of the load shaft × reduction ratio, Set the function code parameters according to the calculated electronic gear ratio value.

In addition to use the electronic gear ratio function, you could also use [P0-16] (the number of command pulses for one rotation of the motor). Both gear ratio 1 and electronic gear ratio 2 are invalid when [P0-16] is not zero.

Relevant function codes:

CodeParameter NameProperty

Effective

Time

RangeFunctionUnitDefault
P0-16pulse number per revolutionAt stop

Power-on

again

0~10000

Set the pulse number of per rotation

Only when P0-16=0 then P0-17,P0-18,P0-19,P0-20 would take effect

pulse10000
P0-17Electronic gear 1 numeratorDuring runningImmediate1~32767

Set the numerator of the first group electronic gear ratio.

It is valid when P0-16=0

-1
P0-18Electronic gear 1 denominatorDuring runningImmediate1~32767

Set the denominator of the first group electronic gear ratio.

It is valid when P0-16=0

-1
P0-19Electronic gear 2 numeratorDuring runningImmediate1~32767

Set the numerator of the first group electronic gear ratio.

It is valid when P0-16=0

-1
P0-20Electronic gear 2 denominatorDuring runningImmediate1~32767

Set the denominator of the first group electronic gear ratio.

It is valid when P0-16=0

-1

Position Reference Filter

This function filters the position references (encoder unit) divided or multiplied by the electronic gear ratio. It involves the first-order filter and average filter.

It is applicable to the following conditions:

  1. Acceleration/Deceleration is absent on the position references from the host controller.
  2. The pulse frequency is too low.
  3. The electronic gear ratio is larger than 10.

Properly setting the position loop filter time constant could run the motor more smoothly, so that the motor speed would not overshoot before it stabilizes. This setting has no effect on the number of command pulses.

The filter time is not as long as possible. The longer the filter time, the longer the delay time and the longer the response time.

6.1Position Control Mode_html_c13c256a6e790c7f.jpg

Figure 6-5 position reference filter

Relevant parameters:

CodeParameter NameProperty

Effective

Time

RangeFunctionUnitDefault
P4-1Pulse command filtering modeAt stopImmediate0~1

0:first-order low-pass filtering

1: average filter

-0
P4-2Position command first-order low-pass filterAt stopImmediate0~128For pulse command input filteringms0
P4-3Position command average filtering time constantAt stopImmediate0~1000For pulse command input filteringms20

Position Deviation Clear

Position deviation = Position reference – Position feedback (encoder unit)

The position deviation clear function refers to the function that the drive clears the deviation register in the position mode. The function of clearing position deviation could be realized through DI terminal.

Frequency-Division Output

The encoder pulse is output as a quadrature differential signal after divided by the internal circuit of the servo driver. The phase and frequency of the frequency-divided signal could be set by parameters. The source of frequency division output could be set by function code, and the setting of different sources makes the function of frequency division output more widely used.

6.1Position Control Mode_html_aff13745232892c.jpg

Figure 6-6 diagram of frequency division output wiring

The frequency-division output is a differential signal output:

Phase A pulse: PAO +, PAO-, differential output, the maximum output pulse frequency is 2Mpps

Phase B pulse: PBO +, PBO-, differential output, the maximum output pulse frequency is 2Mpps

Phase Z pulse: PZO +, PZO-, differential output, the maximum output pulse frequency is 2Mpps

The frequency division pulse output direction could be set through the function code [P0-21]. The waveform diagram of the encoder frequency division pulse output is as follows:

P0-21Forward rotation, pulse output waveformReverse rotation, pulse output waveform
06.1Position Control Mode_html_d66fab59025c842d.jpg6.1Position Control Mode_html_7f87ff6faaa689d0.jpg
16.1Position Control Mode_html_4303570ed8f08519.jpg6.1Position Control Mode_html_535a2e7e164c2b2f.jpg

In addition, the Z pulse output polarity could be set through function code P0-23, as shown in the following figure:

P0-23(Z pulse output polarity)pulse waveform (forward / reverse)
06.1Position Control Mode_html_99fac56ab3d3e115.jpg
16.1Position Control Mode_html_893cb0bf9e405027.jpg

Function code P0-22(the number of output pulses per revolution of the motor) is used to set the number of output pulses of the A and B phases of the motor, and changing the function code could set the frequency division of the output.

Relevant parameters:

CodeParameter NameProperty

Effective

Time

RangeFunctionUnitDefault
P0-21frequency-dividing output directionAt stop

Power-on

again

0~1

Quadrature pulse output.

0: When the motor rotation direction is CW, A advances B

1: When the motor rotation direction is CCW, B advances A

-0
P0-22Encoder pprAt stopPower-on10~10000Quadrature output. Set the number of output pulses of phase A and phase B for each rotation of the motorPulse2500
P0-23

Z pulse output

OZ polarity

At stopagain0~1

0-Z Active when pulse is high

1-Z Active when pulse is low

-0

Position-relevant DO output function

The feedback value of the position command is compared with different thresholds, and the DO signal could be output for the host controller to use.

(1)Positioning completed/near output

The internal command completion function means that when the multi position reference within the servo is zero, it could be considered that the command transmission is completed. At this time, the servo drive could output the internal command completion signal, and the host computer could confirm that the multi-segment position command within the servo drive has been sent.

The positioning completion function means that the position deviation meets the conditions set by the [P5-12], and it could be considered that the positioning is completed in the position control mode. At this time, the servo driver could output the positioning completion signal, and the host controller could confirm that the positioning of the servo driver is completed after receiving this signal.

The functional schematic diagram is as follows:

6.1Position Control Mode_html_d9b34f7fe3d81eaa.jpg

Figure 6-7 positioning completed diagram

When using the positioning completion / proximity function, you could also set positioning completion, positioning proximity conditions, window, and hold time. The diagram of window filtering time is shown in the figure below:

6.1Position Control Mode_html_db565056f6f34cb6.jpg

Figure 6-8 diagram of positioning completion signal output with window filtering time

Relevant parameters:

CodeParameter NameProperty

Effective

Time

Range FunctionFunctionUnitDefault
P5-11Positioning completed, positioning near settingDuring runningImmediate1~3

Output signal judging conditions for positioning completed and positioning near

0:The output is valid when the absolute value of the position deviation is less than the positioning completion threshold / location near threshold.

1:The absolute value of the position deviation is less than the positioning completion threshold / positioning near threshold, and the input position command is 0 then the output is valid

2:The absolute value of the position deviation is smaller than the positioning completion threshold / positioning approach threshold, and the input position command filter value is 0 then the output is valid

3:The absolute value of the position deviation is less than the positioning completion threshold / positioning approach threshold, the input position command filter value is 0, and the positioning detection time window is continued then the output is valid

-0
P5-12Positioning completed thresholdDuring runningImmediate1~65535Positioning completion thresholdPulse800
P5-13Positioning approach thresholdDuring runningImmediate1~65535Positioning near thresholdPulse5000
P5-14Positioning detection time windowDuring runningImmediate0~20000Set the positioning completion detection time windowms10
P5-15Positioning signal hold timeDuring runningImmediate0~20000Set the hold time of positioning completion outputms100

To use the positioning completion function, the DO terminal of the servo drive should be assigned as the positioning completion function and determine the valid logic. Take the DO1 terminal as an example, the relevant function code:

CodeParameter NameProperty

Effective

Time

RangeFunctionUnitDefault
P6-26DO_1 function selectionDuring running

Power-on

again

128~142

129-RDY Servo Ready

130-ALM  Alarm

131-WARN Warning

132-TGON Motor rotation output

133-ZSP Zero speed signal

134-P-COIN Positioning completed

135-P-NEAR  Positioning near

136-V-COIN  Speed consistent

137-V-NEAR  Speed near

138-T-COIN Torque reached

139-T-LIMIT Torque limit

140-V-LIMIT Speed limit

141-BRK-OFF Solenoid brake

(not implemented yet)

142-SRV-ST  Enable Servo status output

-131
P6-27DO_1 logic selectionDuring running

Power-on

again

0~1

Output logic function selection. ★

1. Set to 0:

When the signal is valid, the output transistor is on.

When the signal is invalid, the output transistor is off.

2. Set to 1:

When the signal is valid, the output transistor is off.

When the signal is invalid, the output transistor is on.

-0

Servo position control case

Introduction

This case uses three commonly used PLC positioning instructions to implement the servo position control mode actions.

I/O wiring

1611563158799-293.png

Servo parameter setting

Step 1:Power on the servo, set the M key on the panel of the servo drive, set the value of function code P0-1 to 1, and 1 is the position control mode;

CodeParameter NameProperty

Effective

Time

RangeFunctionUnitDefault
P0-1Control mode (default setting)At stopPower-on again1~10

1: Position control mode

2: Speed control mode

3: Torque control mode

-1

Step 2:Set the value of function code P0-4, 0 is forward rotation, 1 is reverse rotation

CodeParameter NameProperty

Effective

Time

RangeFunctionUnitDefault
P0-4

Rotating

direction

selection

At stop

Power-on

again

0~1

Forward direction:viewed from the motor shaft.

0: CW direction as the forward direction

1: CCW direction as the

forward direction

-0

Step 3:Set the value of function code P6-04 to 1. 0 is the hardware DI_1 channel, which requires wiring; 1 is the virtual DI_1 channel,no wiring is required.

CodeFunctionEffective timeDefaultRangeDescription
P13-1Virtual VDI_1 input value00-1

VDI1 input level:

0: low level. 1: high level.

Step 4:Set the value of the function code P13-1 to choose whether VDI1 is valid at high or low levels.

Notes:the value of function code P6-02 should be set to 1. Only in this way can the motor rotate.

CodeFunctionEffective timeDefaultRangeDescriptionUnit
P6-02DI_1 function selection10-16

1: SON, Servo ON

2: A-CLR, Fault and warning clear

3: POT, Forward limit switch

4: NOT, Reverse limit switch

5: ZCLAMP, Zero speed clamp

6: CL, Clear the position deviation

7: C-SIGN, Instruction negation

8: E-STOP, Emergency stop

9: GEAR-SEL, Electronic gear switching 1

10: GAIN-SEL, Gain switch

11: INH, Position reference inhibited

12: VSSEL, Damer control switch(not implemented yet)

13: INSPD1, Internal speed command selection 1(not implemented yet)

14: INSPD2, Internal speed command selection 2(not implemented yet)

15: INSPD3, Internal speed command selection 3(not implemented yet)

16: J-SEL, Inertia ratio switch(not implemented yet)

 

PLC Project

1611563183076-132.png

Explanation

The program uses M0,M1,M2 as the switch button of three modes of actions.

When M0 is turned on, the Y0 servo motor rotates 5000 pulses in the direction of Y3.

When M1 is turned on, the Y0 servo motor rotates 20,000 pulses at the speed of 4,000 pulses, and Y3 represents the direction of the motor.

When M2 is turned on, the Y0 servo motor moves to the absolute position of 2000 at the speed of 4000 pulses, and Y3 represents the direction of the motor.