Conventional servo drives achieve precise control because the distance, position, and speed information of the motor's movement are fed back to the servo drive via an encoder attached to the motor. This creates a small closed-loop system between the servo drive and the motor, thus achieving precise control. However, this precision is limited to the independent system of the servo and the motor. For the entire equipment using the servo system, mechanical and transmission errors still exist. Therefore, the precision here is only relative. Conventional solutions often use various sensors, proximity switches, etc., through a PLC to overcome the errors of the entire system, but the accuracy is relatively poor, and it can only provide alarms without real-time error correction.
Therefore, a system consisting of a servo driver, a servo motor, and the motor's own encoder is also called a semi-closed-loop system. To achieve higher precision control, Teco's high-end servo JSDG2S adds an encoder feedback device (which can be an external encoder such as an optical rotary encoder or a grating ruler) to the semi-closed-loop system. This directly detects the target mechanical movement distance of the controlled object (such as the actual running distance of the slide). In this way, the servo driver, the object being measured, and the second encoder feedback (the additional encoder) constitute a fully closed-loop control system.
Working principle
Similar to the motor encoder interface CN2, the second encoder interface CN8 can also be matched with optical rotary encoders, optical rulers, etc. (These optical rotary encoders and optical rulers convert the distance moved into A/B/Z phase pulse signals; the number of pulses represents the distance the object moves, and the pulse frequency represents the speed of the object). This second encoder interface CN8 supports a maximum resolution of 1,000,000 pulses/rev (the maximum number of fourth-harmonic pulses corresponding to one rotation of the motor in a fully closed-loop system is 1,000,000). 1. Hardware design circuit and principle circuit description from left to right: Interface CN8 is a grating ruler or optical rotary encoder interface. The input signal is A+/A-, B+/B-, Z+/Z- differential signal. The number and frequency of pulses reflect the currently detected object's moving distance and speed. The interface is protected by clamping diodes to prevent noise and high voltage from damaging the chip, ensuring the reliability of the hardware circuit. After filtering by an RC circuit, it is converted into a level signal that can be received by the FPGA through a differential circuit receiver AM32LVIDR. The subsequent signal will be parsed and processed internally by the FPGA.
Figure 1 System Schematic Diagram
Figure 2 Hardware circuit diagram
Figure 3 Software System Flowchart
2. Software Control Principles
(1) The position command is sent to the driver via the bus (EtherCAT/CANopen) or pulse controller. After passing through the electronic gear ratio and the corresponding unit conversion function (expression: received position command * electronic gear ratio * second encoder resolution), the corresponding position 1 (CmdPos) is generated. At the same time, the actual operating position 2 (FbPos) of the device is obtained by using the second external encoder installed on the device.
(2) The above two positions are sent to the position controller (the position controller is a proportional system) for calculation (the proportional system calculation is (Cmd Pos- FbPos)*KP (KP is an adjustable coefficient, the default value is 40)) to obtain the actual position that the motor needs to move (the position increment DeltaPos) and the moving speed (the position increment per unit time is the moving speed CmdSpeed, the unit time of this system is 400 microseconds). At this time, the motor feedback speed (FbSpeed) is obtained through the internal encoder of the motor (using differential calculation = position change/time change).
(3) The above two speeds are then fed into the speed controller for calculation (the speed controller is a proportional-integral system). In order to respond quickly, this algorithm adopts anti-integral saturation proportional/integral calculation. The specific algorithm is that when calculating the current error, it first determines whether the error at the previous moment has exceeded the limit range. If the error at the previous moment is greater than the maximum limit, only the negative deviation is accumulated; if the error at the previous moment is less than the minimum limit, only the positive deviation is accumulated. This avoids the control quantity from staying in the saturation zone for a long time (exceeding the maximum/minimum speed limit range), and obtains the actual running speed (RealSpeed) of the motor and the torque current required by the motor (current actual speed = previous actual speed + current speed error calculated by the speed controller). The current controller (which converts the AC servo motor control model into a DC motor control model, and the DC motor model only needs to control the magnitude of the current to control the magnitude of the torque) ensures the accurate torque output of the motor.
The above-mentioned fully closed-loop position algorithm directly calculates the position of the measured object, reducing mechanical transmission backlash and transmission error between mechanisms.
To improve the smoothness of object movement, the single-segment control S(x)=0 is extended to multi-segment control during trajectory control, including acceleration, constant speed, and deceleration segments. The segments are as follows:
1. Acceleration segment S1 = ax² + (x1 - x10) where x10 is the initial position error.
2. Constant speed segment S2 = x2 - x10
3. Deceleration segment S3 = cx1 + x2
The above methods can help the device enable the driver to control the motor more smoothly and compensate for errors caused by mechanical parts.
Of course, there are also some situations where mechanical or transmission failures occur. In such cases, the drive can determine and directly alarm through the maximum error protection mechanism to avoid damage to the machinery.
Alarm determination:
Internal encoder x External encoder resolution (PPR4 2500 x 4) / Internal encoder resolution (17bit) - External encoder > Pn347
Pn347: Maximum value of full closed-loop error (the error setting value between full closed-loop CN4 and the actual encoder. When the position error exceeds the number of pulses set by Pn347, this device generates AL022 (excessive pulse error between the motor end and the load end).
Functional operation steps
1. Confirm the organization's direction
1. Confirm that the positive direction of the external encoder corresponds to the motor direction. Set Pn314 (position command direction definition) and confirm by manually pushing (without energizing). When the external mechanism is pushed in the positive direction, check Un-14 (motor feedback - number of pulses per revolution) to confirm that the value is increasing. 2. Confirm that the internal and external directions are the same. Manually push (without energizing) the external mechanism in the positive direction and check Un-50 (external encoder pulse count) to confirm that the value is increasing. If not, please correct the Pn349 (complete closed loop direction) setting to 0 or 1.
Figure 4 Mechanism Structure Diagram
3. Confirm Pn348 (external edge coder resolution)
When using an external encoder or optical scale for full dead-loop control, the Pn348 (resolution corresponding to one revolution of the full dead-loop encoder) setting must first be performed. The calculation is as follows, using a screw mechanism with an optical scale as an example:
After setting the resolution of the full-loop encoder, you can use Pn349 (full-loop operation direction setting) to set the operation direction, or use Pn347 (full-loop error maximum value) to set the maximum range of error between the actual encoder and the external encoder, and use Un-52 (error between external encoder and motor encoder) to monitor the error between the two. When it exceeds the range, an alarm signal AL.022 (excessive pulse error between motor end and load end) is generated, and the servo stops operating. Finally, set Pn346 (full-loop function cycle selection) as needed.
Using a manual drive method (without excitation), calculate the total displacement distance of the motor count based on Un-14 (motor feedback - number of pulses per revolution) and Un-16 (motor feedback - number of revolutions). Compare this total motor position with Un50 (external encoder pulse count). Are the directions the same? Is the ratio between the two close to the motor resolution of the Pn348?
If the platform is as shown in Figure 1, ignoring the effect of backlash, and the status display parameters show Un-50 (external encoder pulse count) as 2500 and Un14 as 32768, then the value of Pn348 (the resolution corresponding to one revolution of the full-loop encoder) can be calculated accordingly:
Summarize
This function enables electrical equipment to form a fully closed-loop system. Compared to static feedback such as proximity switches, the use of sensors such as encoders/grating rulers allows the equipment to form a dynamic fully closed-loop system. In this feedback control system, the servo drive can monitor the equipment's movement and speed variables in real time. During operation, regardless of the cause (external disturbance or internal system changes), as long as the controlled variable deviates from the specified value, a corresponding control action will be generated to eliminate the deviation. Therefore, it has the ability to suppress interference, is insensitive to changes in the equipment's error characteristics, and can actively improve the system's response characteristics and control accuracy, enabling the equipment to reach a perfect working state (Note: For detailed usage parameters, please refer to the Teco JSDG2S Servo User Manual).