6.1 Position Control
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:
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)
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 Type | Differential | Open collector |
---|---|---|
Max. frequency | 500k | 200k |
Voltage | 5V | 24V |
- Low-speed Pulse Input Differential drive mode
- OC mode
- 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
Code | Parameter Name | Property | Effective Time | Range | Function | Unit | Default |
---|---|---|---|---|---|---|---|
P0-12 | Position pulse type selection | At 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 waveform | Negative pulse waveform |
![]() | ![]() |
(b)[P0-12]=1(CW/CCW)
PULSE:Pulse SIGN:Signal
Diagram |
![]() |
(c)[P0-12]=2(Phase A + phase B quadrature pulse (4-frequency multiplication))
PULSE(A phase):pulse SIGN(B phase):signal
Positive pulse waveform | Negative pulse waveform |
A advances B by 90° | B advances A by 90° |
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:
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:
Code | Parameter Name | Property | Effective Time | Range | Function | Unit | Default |
---|---|---|---|---|---|---|---|
P0-13 | Position pulse frequency | At stop | Power-on again | 1~500 | Set the maximum pulse frequency | kHz | 300 |
P0-14 | Position pulse anti-interference level | At 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:
Otherwise, it would display [Er. 35] "Electronic gear ratio setting over limit" fault.
Electronic gear ratio setting Flowchart:
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:
Code | Parameter Name | Property | Effective Time | Range | Function | Unit | Default |
---|---|---|---|---|---|---|---|
P0-16 | pulse number per revolution | At 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 | pulse | 10000 |
P0-17 | Electronic gear 1 numerator | During running | Immediate | 1~32767 | Set the numerator of the first group electronic gear ratio. It is valid when P0-16=0 | - | 1 |
P0-18 | Electronic gear 1 denominator | During running | Immediate | 1~32767 | Set the denominator of the first group electronic gear ratio. It is valid when P0-16=0 | - | 1 |
P0-19 | Electronic gear 2 numerator | During running | Immediate | 1~32767 | Set the numerator of the first group electronic gear ratio. It is valid when P0-16=0 | - | 1 |
P0-20 | Electronic gear 2 denominator | During running | Immediate | 1~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:
- Acceleration/Deceleration is absent on the position references from the host controller.
- The pulse frequency is too low.
- 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.
Figure 6-5 position reference filter
Relevant parameters:
Code | Parameter Name | Property | Effective Time | Range | Function | Unit | Default |
---|---|---|---|---|---|---|---|
P4-1 | Pulse command filtering mode | At stop | Immediate | 0~1 | 0:first-order low-pass filtering 1: average filter | - | 0 |
P4-2 | Position command first-order low-pass filter | At stop | Immediate | 0~128 | For pulse command input filtering | ms | 0 |
P4-3 | Position command average filtering time constant | At stop | Immediate | 0~1000 | For pulse command input filtering | ms | 20 |
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.
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-21 | Forward rotation, pulse output waveform | Reverse rotation, pulse output waveform |
0 | ![]() | ![]() |
1 | ![]() | ![]() |
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) |
0 | ![]() |
1 | ![]() |
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:
Code | Parameter Name | Property | Effective Time | Range | Function | Unit | Default |
---|---|---|---|---|---|---|---|
P0-21 | frequency-dividing output direction | At 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-22 | Encoder ppr | At stop | Power-on | 10~10000 | Quadrature output. Set the number of output pulses of phase A and phase B for each rotation of the motor | Pulse | 2500 |
P0-23 | Z pulse output OZ polarity | At stop | again | 0~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:
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:
Figure 6-8 diagram of positioning completion signal output with window filtering time
Relevant parameters:
Code | Parameter Name | Property Effective Time | Range | Function | Function | Unit | Default |
---|---|---|---|---|---|---|---|
P5-11 | Positioning completed, positioning near setting | During running | Immediate | 1~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-12 | Positioning completed threshold | During running | Immediate | 1~65535 | Positioning completion threshold | Pulse | 800 |
P5-13 | Positioning approach threshold | During running | Immediate | 1~65535 | Positioning near threshold | Pulse | 5000 |
P5-14 | Positioning detection time window | During running | Immediate | 0~20000 | Set the positioning completion detection time window | ms | 10 |
P5-15 | Positioning signal hold time | During running | Immediate | 0~20000 | Set the hold time of positioning completion output | ms | 100 |
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:
Code | Parameter Name | Property | Effective Time | Range | Function | Unit | Default |
---|---|---|---|---|---|---|---|
P6-26 | DO_1 function selection | During 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-27 | DO_1 logic selection | During 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
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;
Code | Parameter Name | Property | Effective Time | Range | Function | Unit | Default |
---|---|---|---|---|---|---|---|
P0-1 | Control mode (default setting) | At stop | Power-on again | 1~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
Code | Parameter Name | Property | Effective Time | Range | Function | Unit | Default |
---|---|---|---|---|---|---|---|
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.
Code | Function | Effective time | Default | Range | Description |
---|---|---|---|---|---|
P13-1 | Virtual VDI_1 input value | ▲ | 0 | 0-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.
Code | Function | Effective time | Default | Range | Description | Unit |
---|---|---|---|---|---|---|
P6-02 | DI_1 function selection | △ | 1 | 0-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
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.