Servo control method and system based on PLC
By building a synchronization deviation vector and a buffer transition zone in the PLC, combined with dynamic correction factors and high-speed timing output tasks, the trajectory deviation and synchronization problems in the multi-axis servo control system are solved, and high-precision and smooth multi-axis motion control is achieved.
Patent Information
- Application Number
- CN202511078784.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-01
- Publication Date
- 2025-09-26
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing PLC-based multi-axis servo control system has deficiencies in trajectory execution accuracy and axis coordination. Especially when running on complex trajectories or at high speeds, it is difficult to ensure synchronization and trajectory smoothness between axes, resulting in trajectory deviation and unstable response during operation.
By building a synchronization deviation vector in the PLC, introducing a dynamic correction factor, setting a buffer transition zone, and adjusting the acceleration curve based on the speed difference between the upper and lower segments, the smoothness and continuity of the servo axis motion are achieved. A trajectory segment pre-reading and interpolation queue management mechanism, combined with high-speed timed output tasks, ensures the cycle stability and synchronization of interpolation control.
It effectively reduces the real-time synchronization error between multiple axes, improves the consistency of the overall motion trajectory, reduces the speed mutation during inter-segment switching, maintains the smoothness and continuity of the servo axis motion process, and improves the response speed and anti-interference ability.
Smart Images

Figure CN120704230A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electric motors, and in particular to a servo control method and system based on PLC. Background Art
[0002] Servo control technology is a crucial component of modern industrial automation systems, widely used in a variety of multi-axis motion scenarios, including machining centers, automated assembly lines, laser cutting, and precision dispensing. With the increasing demand for system integration and flexible manufacturing, the use of programmable logic controllers (PLCs) for multi-axis servo control has become a common implementation method.
[0003] PLCs offer advantages such as high reliability, flexible programming, and strong adaptability, making them particularly well-suited for the complex and ever-changing control requirements of industrial sites. However, in practice, traditional PLC-based multi-axis servo control systems still have limitations in trajectory execution accuracy and axis coordination. This is especially true when executing complex trajectories or high-speed operations, where inter-axis synchronization and trajectory smoothness are difficult to ensure, potentially impacting the overall system performance and processing quality.
[0004] In addition, when processing multi-axis coordinated motion, existing systems often experience trajectory deviations, unstable responses, and other problems during operation due to inconsistent control responses or delayed execution logic, making it difficult to meet application requirements under high precision and multiple working conditions. Summary of the Invention
[0005] The object of the present invention is to provide a PLC-based servo control method based on energy recovery to solve the trajectory deviation problem in the multi-axis coordinated motion process in the prior art.
[0006] To achieve the above object, the present invention provides the following technical solutions:
[0007] A multi-axis servo control method based on PLC, comprising the following steps:
[0008] Trajectory data acquisition step: inputting at least one segment of trajectory data into the PLC through a host computer, wherein the trajectory data includes target motion information for controlling two or more servo axes, and the target motion information includes target position, speed, and torque;
[0009] Control instruction generating step: the PLC generates a corresponding multi-axis interpolation control instruction sequence according to the trajectory data, wherein the interpolation control instruction includes time-series target motion information;
[0010] Control instruction output step: according to a set servo refresh cycle, the plurality of interpolation control instructions are respectively sent to each servo driver connected to the PLC for communication, the servo driver being used to drive the servo axis;
[0011] Status information collection step: collecting actual operating status information of each servo axis, wherein the actual operating status information includes position feedback data, speed feedback data, and torque feedback data;
[0012] Synchronization error evaluation step: the PLC evaluates the relative synchronization error between the servo axes based on the actual operation state information and the target motion information;
[0013] Error compensation step: The PLC constructs a multi-axis synchronization deviation based on the deviation between the target motion information of the current cycle of each servo axis and the actual operating state, and corrects the position, speed or torque control parameters in the interpolation instruction of the next cycle of each servo axis according to the synchronization deviation and a preset adjustment coefficient to synchronize the motion state of each servo axis;
[0014] Trajectory continuity control step: When the trajectory data contains multiple trajectory segments, the PLC sets a buffer transition area at the trajectory segment switching point, and adjusts the target acceleration change amplitude and speed update interval in the buffer transition area based on the difference between the output speed at the end of the previous trajectory segment and the expected speed at the starting segment of the next trajectory segment.
[0015] Preferably, the error compensation step includes:
[0016] The PLC constructs a deviation vector containing multiple axial error values based on the synchronization deviation; the deviation vector is input into a preset interpolation adjustment model; the model calculates a correction factor for each servo axis based on the relative size of the error and its historical change trend; the correction factor is used to dynamically adjust the position increment or speed instruction in the next cycle interpolation control instruction.
[0017] Preferably, in the trajectory continuity control step, the PLC sets a first buffer segment and a second buffer segment on both sides of each trajectory segment switching point, respectively. The first buffer segment is used to record the operating status of the end of the current trajectory segment, and the second buffer segment is used to guide the starting acceleration process of the next trajectory segment. The PLC generates a gradually converging speed update sequence based on the difference between the end speed in the first buffer segment and the target starting speed in the second buffer segment, which is used to control the interpolation output frequency and acceleration change curve in the buffer transition area.
[0018] Preferably, in the control instruction generation step, the PLC manages the received trajectory data in segments, and pre-reads multiple continuous trajectory segments from the trajectory segment buffer queue in each cycle, and dynamically calculates the target position or speed update sequence of the interpolation instruction based on the connection status between the current running trajectory segment and the next trajectory segment and the remaining length of the current trajectory segment, and executes trajectory segment switching judgment and instruction switching according to the running time and the exhaustion of the pre-read segment during the interpolation control process.
[0019] Preferably, in the synchronization error evaluation step, the PLC selects one of the servo axes as the reference axis, uses its current position timestamp as the main reference moment in each cycle, performs time alignment on the feedback positions of other servo axes, and calculates the relative synchronization deviation of each slave axis based on the position deviation after time alignment. The relative synchronization deviation is used to construct a multi-axis synchronization error matrix.
[0020] Preferably, in the control instruction output step, the PLC writes the generated multi-axis interpolation control instructions into an independent output buffer queue in each cycle, and extracts the instructions of the corresponding axes from each buffer queue at a fixed cycle through a high-speed timing task and sends them to the servo drive, and the triggering cycle of the high-speed timing task is consistent with the cycle.
[0021] Preferably, during the interpolation control process, the PLC continuously monitors the synchronization deviation of each servo axis, the execution status of the trajectory segment, and the output beat of the interpolation control instruction. When it is detected that the synchronization deviation of any servo axis exceeds the preset limit, the trajectory segment fails to complete the switching within the limited period, or the interpolation control instruction fails to be successfully output within the continuous period, the abnormal response mechanism is triggered. The abnormal response mechanism includes: pausing the current interpolation control process, outputting emergency stop or speed limit instructions to all servo drives, recording the abnormal status, and reconstructing the interpolation starting point based on the interrupt position of the current running segment.
[0022] Preferably, the method includes a multi-axis synchronous start and stop control step, specifically including:
[0023] Before starting, the PLC sends a pre-start command to each servo drive and confirms that all servo axes are in the ready state, and then sends a unified start signal; when the stop condition is triggered during operation, the PLC generates corresponding deceleration control instructions based on the current operating status of each servo axis and coordinates the stopping process.
[0024] The present invention further provides a PLC-based servo control system, which is applied to the aforementioned PLC-based servo control method, comprising:
[0025] PLC, including interpolation generation module, instruction output module, synchronization error evaluation module, error compensation module, trajectory transition control module, exception handling module and start-stop synchronization module;
[0026] a trajectory data input module, in communication with the PLC, for providing the PLC with at least one segment of trajectory data containing target motion information of two or more servo axes;
[0027] An interpolation generation module, configured to generate a multi-axis interpolation control instruction sequence based on the trajectory data;
[0028] An instruction output module, used for sending the interpolation control instruction to the servo driver according to a set period;
[0029] Status acquisition module, used to collect the actual operating status information of each servo axis;
[0030] a synchronization error evaluation module, configured to evaluate multi-axis synchronization deviation based on the operation status information;
[0031] an error compensation module, configured to correct the interpolation control instruction according to the synchronization deviation;
[0032] The trajectory transition control module is used to coordinate the control output in the transition area during the switching of multiple trajectory segments to achieve smooth multi-axis connection;
[0033] The exception handling module is used to trigger shutdown and recovery processing when it detects that the synchronization deviation exceeds the limit, the trajectory segment switching fails, or the interpolation instruction is abnormal;
[0034] The start-stop synchronization module is used to realize the synchronous motion control of each servo axis during the interpolation start and stop process.
[0035] Preferably, when generating the interpolation control instructions for each cycle, the interpolation generation module calls the synchronization deviation output by the synchronization error evaluation module in the previous cycle, and the error compensation module generates a corresponding correction coefficient based on the synchronization deviation. The interpolation generation module dynamically adjusts the position, speed or torque control parameters in the interpolation instructions of the next cycle according to the correction coefficient.
[0036] Compared with the prior art, the beneficial effects of the present invention are as follows: by constructing a synchronization deviation vector and introducing a dynamic correction factor based on historical trends, the present invention enables the interpolation control instructions of each servo axis to be differentially compensated according to the current error state, effectively reducing the real-time synchronization error between multiple axes and improving the consistency of the overall motion trajectory. By setting a buffer transition zone at the trajectory segment switching point and adjusting the acceleration change curve in combination with the speed difference between the upper and lower segments, the present invention can effectively reduce the speed mutation during the switching between segments and maintain the smoothness and continuity of the servo axis motion process. The introduction of the trajectory segment pre-reading and interpolation queue management mechanism realizes the dynamic scheduling and switching judgment of the interpolation data, cooperates with the high-speed timing output task, ensures the cycle stability and output synchronization of the interpolation control, and improves the response speed and anti-interference ability. Through the integrated abnormality detection mechanism and interrupt recovery control strategy, the present invention can promptly shut down and reconstruct the starting point when the synchronization error exceeds the limit, the segment switching fails or the output is abnormal during the interpolation process, ensuring the operation safety and task continuity. Without relying on an external motion control card, the present invention enhances the functionality of the PLC control logic structure and can be widely applied to multi-axis collaborative control systems such as CNC machining, dispensing, cutting, and transportation, with good versatility and engineering deployability. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 1 is a step diagram of a PLC-based servo control method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0038] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0039] See also Figure 1 The present invention provides a multi-axis servo control method based on PLC, comprising the following steps:
[0040] Trajectory data acquisition step: inputting at least one segment of trajectory data into the PLC through a host computer, wherein the trajectory data includes target motion information for controlling two or more servo axes, and the target motion information includes target position, speed, and torque;
[0041] Control instruction generating step: the PLC generates a corresponding multi-axis interpolation control instruction sequence according to the trajectory data, wherein the interpolation control instruction includes time-series target motion information;
[0042] Control instruction output step: according to a set servo refresh cycle (hereinafter referred to as cycle), the plurality of interpolation control instructions are respectively sent to each servo driver connected to the PLC for communication, and the servo driver is used to drive the servo axis;
[0043] Status information collection step: collecting actual operating status information of each servo axis, wherein the actual operating status information includes position feedback data, speed feedback data, and torque feedback data;
[0044] Synchronization error evaluation step: the PLC evaluates the relative synchronization error between the servo axes based on the actual operation state information and the target motion information;
[0045] Error compensation step: The PLC constructs a multi-axis synchronization deviation based on the deviation between the target motion information of the current cycle of each servo axis and the actual operating state, and corrects the position, speed or torque control parameters in the interpolation instruction of the next cycle of each servo axis according to the synchronization deviation and a preset adjustment coefficient to synchronize the motion state of each servo axis;
[0046] Trajectory continuity control step: When the trajectory data contains multiple trajectory segments, the PLC sets a buffer transition area at the trajectory segment switching point, and adjusts the target acceleration change amplitude and speed update interval in the buffer transition area based on the difference between the output speed at the end of the previous trajectory segment and the expected speed at the starting segment of the next trajectory segment.
[0047] The present invention provides a PLC-based multi-axis servo control method that can be widely used in multi-axis collaborative motion scenarios such as electronic dispensing, glass cutting, and collaborative handling. It is particularly suitable for industrial equipment with high requirements for trajectory control accuracy and multi-axis synchronization performance.
[0048] Specifically, the invention is used in a multi-axis synchronous dispensing device that includes three servo axes: the X-axis (lateral movement), the Y-axis (vertical movement), and the Z-axis (dispensing head elevation). To achieve precise dispensing along complex paths in two or three-dimensional space, the following steps are used:
[0049] The operator presets the dispensing path in the host computer (such as HMI or industrial PC), including multiple position points or trajectory segments, and transmits the trajectory data to the PLC via Ethernet or bus interface to form a control command input containing multiple servo axis displacement targets.
[0050] The PLC processes the received trajectory data in segments and generates the multi-axis target control parameters (position, speed or acceleration) for each cycle according to the selected cycle, forming a continuous interpolation instruction sequence to control the three axes to run synchronously along the set path.
[0051] The interpolation control instructions are distributed to the corresponding servo drives via a high-speed bus (such as EtherCAT or CANopen) within each servo refresh cycle, ensuring that the X, Y, and Z axes maintain coordinated action in time, thereby driving the dispensing head to move continuously along the set trajectory.
[0052] During each control cycle, the PLC collects status information from all servo drives, including current position, speed, and, if necessary, torque data. This feedback data is used to dynamically determine operational differences between the three axes.
[0053] The PLC compares the current actual position of each servo axis with the interpolation target position, evaluates the relative error between multiple axes, and determines whether there are problems such as inter-axis synchronization deviation and response lag based on the error distribution.
[0054] When synchronization deviation is detected among the three axes, the PLC dynamically corrects the interpolation control parameters generated in the next cycle based on the actual error value and adjustment coefficient of each axis, so that the movement trends of each axis are realigned to avoid dispensing path deviation due to accumulated deviation.
[0055] For dispensing paths containing multiple trajectory segments (such as a combination of straight and circular segments), the PLC sets a buffer zone at the segment switching point and adjusts the acceleration based on the speed difference between the upper and lower segments, thereby achieving continuous speed transition at path corners and sharp turns, avoiding glue accumulation, offset or jerking.
[0056] This method can not only be used in three-axis synchronous control systems, but can also be extended to CNC systems with five or even more axes. Its core advantage lies in: completing the entire process logic such as interpolation, synchronous evaluation, error compensation and transition control through the PLC body, avoiding dependence on external motion control cards, reducing costs and improving system flexibility and scalability.
[0057] In this embodiment, the error compensation step includes:
[0058] The PLC constructs a deviation vector containing multiple axial error values based on the synchronization deviation; the deviation vector is input into a preset interpolation adjustment model; the model calculates a correction factor for each servo axis based on the relative size of the error and its historical change trend; the correction factor is used to dynamically adjust the position increment or speed instruction in the next cycle interpolation control instruction.
[0059] In this embodiment, the PLC constructs a multi-dimensional error vector based on the synchronization deviation of each servo axis in the current cycle. ,in Indicates the The synchronization error of the servo axis in the current cycle (such as position deviation), is the number of servo axes.
[0060] To compensate for the synchronization deviation between the servo axes, the PLC sets a rolling history window , used to record the servo axes in the past The error changes in a cycle. The PLC calculates a trend factor for each error sequence, for example, by estimating the error change rate of the axis through differential averaging. .
[0061] Then, the PLC will , its historical changing trends And the preset adjustment weight coefficient Input to the adjustment function:
[0062]
[0063] in, Indicates the The correction factor of each servo axis. This correction factor is used to dynamically update the interpolation position increment of the axis in the next cycle. Or speed command :
[0064]
[0065] or:
[0066]
[0067] in To control the intensity coefficient, the value range is set according to the servo system bandwidth and the allowable adjustment range. It can gradually converge the synchronization errors between the axes while ensuring the stability of the interpolation rhythm, achieving dynamic synchronization optimization.
[0068] For ease of implementation, the deviation vector can be expressed as an array of real numbers arranged in order by servo axis number. Each element represents the synchronous position deviation of the corresponding servo axis during the current cycle. This deviation is calculated as the difference between the target motion state and the actual operating state of the axis. The PLC automatically refreshes this vector data during each cycle to ensure that the estimated deviation is up to date and in real time.
[0069] The interpolation adjustment model can be set as a coefficient mapping structure based on a rule table, for example, corresponding compensation proportional factors are preset for synchronization deviations in different amplitude ranges, or a dynamic weighting algorithm based on the multi-cycle error change trend is used to perform trend prediction and amplitude limitation processing on the correction factors of each axis to avoid compensation overshoot.
[0070] In a specific implementation, the correction factor can be directly superimposed or multiplied by the position increment or speed setting value in the interpolation instruction of the next cycle, so that the servo axis with a larger deviation can obtain a larger adjustment, while the axis with a smaller deviation can perform subtle compensation, thereby achieving error convergence and smooth synchronization of the overall multi-axis interpolation process.
[0071] The PLC can set a maximum compensation limit before applying the correction factor to prevent sudden changes in trajectory data due to excessive instantaneous deviations within a cycle. Furthermore, the correction factor can also set a minimum effective threshold. If the deviation is within the error tolerance range, compensation is not performed to reduce fluctuations.
[0072] Through the above-mentioned error compensation mechanism, dynamic closed-loop synchronous control of the multi-axis servo system can be achieved by relying solely on the PLC body without introducing an external controller, adapting to industrial application needs under high-speed motion and high-precision trajectory requirements.
[0073] In this embodiment, in the trajectory continuity control step, the PLC sets a first buffer segment and a second buffer segment on both sides of each trajectory segment switching point, respectively. The first buffer segment is used to record the operating status of the end of the current trajectory segment, and the second buffer segment is used to guide the starting acceleration process of the next trajectory segment. The PLC generates a gradually convergent speed update sequence based on the difference between the end speed in the first buffer segment and the target starting speed in the second buffer segment, which is used to control the interpolation output frequency and acceleration change curve in the buffer transition area.
[0074] The first and second buffer segments can be configured to occupy a certain number of cycles before and after the trajectory data segment switching point. The specific buffer segment lengths can be dynamically calculated or set to fixed values based on the velocity difference between the preceding and following trajectory segments, the acceleration limit, and the allowed trajectory smooth transition time. Preferably, the buffer segment length can be set to 3 to 10 cycles to balance transition effect and response delay.
[0075] The first buffer is used to record the operating status at the end of the current trajectory segment, including actual output speed, acceleration, displacement direction, and other information. This information can be used as the initial boundary conditions for the next acceleration control segment. The second buffer is used to plan the velocity curve within the starting segment of the next trajectory segment, gradually transitioning from the current operating status to the initial velocity value set for the target trajectory segment.
[0076] Based on the speed difference within the buffer segment, the PLC generates a gradually converging speed update sequence. This sequence can be generated by setting a constant acceleration or a variable acceleration and performing interpolation calculations based on the period. This speed update sequence can be used to adjust the target speed of each period within the buffer segment in real time, thereby ensuring controllable and smooth transitions in the velocity curve between trajectory segments, avoiding servo shock, overshoot, or offset caused by sudden speed changes.
[0077] The PLC also generates a corresponding acceleration curve based on this velocity update sequence. This acceleration can be linear, exponential, or segmented, depending on the servo system's dynamic response capabilities. During interpolation control, the PLC adjusts the output frequency of control commands based on this curve, further matching the servo drive's actual execution capabilities.
[0078] Through buffer segment construction and convergence adjustment control, this embodiment can effectively avoid speed mutations, trajectory jitter and positioning deviation problems that occur during multi-axis trajectory control, significantly improve the trajectory continuity and motion stability of the multi-axis collaborative system, and is suitable for industrial processing scenarios with high requirements for path transition.
[0079] In this embodiment, in the control instruction generation step, the PLC manages the received trajectory data in segments and pre-reads multiple continuous trajectory segments from the trajectory segment buffer queue in each cycle. According to the connection status between the current running trajectory segment and the next trajectory segment and the remaining length of the current trajectory segment, the target position or speed update sequence of the interpolation instruction is dynamically calculated. In the interpolation control process, the trajectory segment switching judgment and instruction switching are executed according to the running time and the exhaustion of the pre-read segment.
[0080] The PLC can divide the received trajectory data into segments. Each segment contains information such as the starting point, ending point, path type (such as straight line, circular arc, etc.), segment length, starting speed, and ending speed. These segments are sequentially cached in a segment buffer queue, and a read pointer is set to track the current running segment.
[0081] During each cycle, the PLC uses a forward-looking mechanism to pre-fetch the current trajectory segment and one or more subsequent trajectory segments from the trajectory segment buffer queue. This is used to determine trajectory continuity, prepare for trajectory connection processing, and generate the target control variable sequence. The number of pre-fetched segments can be set to a fixed value based on performance, such as 2 or 3, or it can be dynamically adjusted to accommodate complex path structures.
[0082] The remaining length of the current segment is calculated in real time by subtracting the distance already traveled from the total target path length. The PLC combines this remaining length with the starting state information of the next segment to assess whether to initiate the switch decision logic in advance. When the remaining length falls below a set threshold (e.g., a buffer length), the PLC enters the segment switch preparation state.
[0083] During the interpolation control process, the PLC performs segment switching judgment based on the current running time, interpolation execution progress and the number of completed segments in the trajectory segment buffer queue. If the switching conditions are met, the current running segment pointer is updated, the executed trajectory segment is cleared, and the new pre-read trajectory segment is loaded.
[0084] When generating interpolation instructions, the PLC comprehensively considers the geometric parameters of the current segment, dynamic speed requirements and the connection status with the next segment, and dynamically calculates the target position sequence or speed update sequence to make the interpolation output continuous within the segment and smooth between segments, avoiding sudden changes or setbacks.
[0085] Through the interpolation look-ahead and segment management mechanism, the PLC can smoothly complete the seamless switching of multiple trajectory segments without interrupting the interpolation process, improving the continuity of trajectory execution and the real-time control response, and is suitable for high-speed and high-precision trajectory control applications.
[0086] In this embodiment, in the synchronization error evaluation step, the PLC selects one of the servo axes as the reference axis, uses its current position timestamp as the main reference moment in each cycle, performs time alignment on the feedback positions of other servo axes, and calculates the relative synchronization deviation of each slave axis based on the position deviation after time alignment. The relative synchronization deviation is used to construct a multi-axis synchronization error matrix.
[0087] The reference axis can be configured by the user during initialization, or the PLC can automatically select the servo axis with the most stable current position change and the smallest response delay as the reference axis. The current position feedback value of this reference axis in each cycle is bound to a timestamp, which serves as the main reference time for the current cycle.
[0088] Because feedback information from different servo axes may experience sampling delays or network communication differences, the PLC must time-align the feedback position values of each slave axis to ensure timing consistency during error assessment. This time alignment can be achieved through sampling at the nearest time point, interpolation estimation, or predictive extrapolation, ensuring that the feedback position of each axis corresponds to a unified reference time point, thereby avoiding spurious errors introduced by different sampling phases.
[0089] After alignment, the PLC calculates the difference between the target position and feedback position of each slave axis at the master reference time, yielding the relative synchronization deviation for each slave axis. These deviations are organized into a vector or two-dimensional array, organized by servo axis number, known as the multi-axis synchronization error matrix.
[0090] The synchronization error matrix not only records the error magnitude of each axis within the current cycle but also expands to record the error evolution trends over multiple past cycles, serving as the input basis for subsequent error compensation modules. By performing statistical analysis, fitting, or trend estimation on this matrix, the responsiveness and stability of compensation command generation can be further improved.
[0091] This structure is applicable to both 2-axis systems (such as XY dual-axis) and systems with more than 3 axes (such as XYZ or five-axis linkage systems). It has good scalability and modular implementation capabilities and is a key data processing link in the entire multi-axis coordinated control closed loop.
[0092] In this embodiment, in the control instruction output step, the PLC writes the generated multi-axis interpolation control instructions into an independent output buffer queue in each cycle, and extracts the instructions of the corresponding axes from each buffer queue at a fixed cycle through a high-speed timing task and sends them to the servo drive. The triggering period of the high-speed timing task is consistent with the cycle.
[0093] The core purpose of the control mechanism is to avoid unstable interpolation instruction output timing caused by fluctuations in the PLC main program cycle or multiple tasks preempting, which may lead to servo drive response delays or asynchrony between axes.
[0094] To this end, each servo axis is configured with an independent output buffer queue to temporarily store upcoming interpolation control commands. The PLC writes these commands into this buffer queue immediately after interpolation calculations are completed, rather than sending them directly. This approach decouples the interpolation calculation process from the actual command output process, helping to improve the timing determinism of the overall control system.
[0095] The high-speed timed task is typically configured as a hard real-time interrupt task, taking priority over the main loop task to ensure its execution cycle is not interrupted. This task runs at a fixed period, typically identical to the period (or an integer multiple of it). It reads the instructions due for the current period from the corresponding buffer queue and sends them synchronously to the servo drive, ensuring the simultaneous issuance of multi-axis interpolation control instructions.
[0096] This mechanism is particularly suitable for scenarios with high requirements for multi-axis motion synchronization. It can significantly reduce the interpolation output jitter caused by changes in the PLC main program load and improve the timing stability of trajectory control.
[0097] In this embodiment, during the interpolation control process, the PLC continuously monitors the synchronization deviation of each servo axis, the execution status of the trajectory segment, and the output rhythm of the interpolation control instructions. If it detects that the synchronization deviation of any servo axis exceeds a preset limit, the trajectory segment fails to switch within a specified period, or the interpolation control instruction fails to be successfully output for consecutive periods, an abnormal response mechanism is triggered. This abnormal response mechanism includes: pausing the current interpolation control process, issuing an emergency stop or speed limit command to all servo drives, recording the abnormal status, and reestablishing the interpolation starting point based on the interruption position of the current running segment. To improve operational safety and robustness, the PLC continuously monitors multiple key status parameters during the interpolation control process, including the synchronization deviation of each servo axis, the execution progress of the current trajectory segment, and the output rhythm of the interpolation instruction. If any of the monitored indicators is abnormal, such as the synchronization deviation of an axis exceeding a set threshold, the trajectory segment fails to switch within a specified time, or the interpolation instruction fails to be successfully output for consecutive periods, the PLC automatically triggers the abnormal response mechanism. The mechanism includes pausing the current interpolation control, sending emergency stop or speed limit commands to each servo drive, recording the current abnormal status and its interruption point information, and reconstructing the interpolation starting point after the fault is resolved to achieve rapid recovery.
[0098] In this embodiment, the method includes a multi-axis synchronous start and stop control step, specifically including:
[0099] Before startup, the PLC sends a pre-start command to each servo drive and confirms that all servo axes are in a ready state before issuing a unified start signal. When a stop condition is triggered during operation, the PLC generates corresponding deceleration control commands based on the current operating state of each servo axis and coordinates the stopping process. To ensure consistency and coordination in the start and stop processes of multi-axis interpolation control, in this embodiment, the PLC sends a pre-start signal to all servo drives before startup and, after confirming that all servo axes are in a ready state, issues a unified start command. At the end of execution or when a need to terminate operation is detected, the PLC calculates the deceleration control amount based on the current state of each axis and coordinates the deceleration and stopping processes of each axis through a synchronous scheduling module to prevent sudden speed changes between axes or inertial loss of control.
[0100] Also included is an embodiment of a PLC-based servo control system, applied in the previous embodiment, comprising:
[0101] PLC, including interpolation generation module, instruction output module, synchronization error evaluation module, error compensation module, trajectory transition control module, exception handling module and start-stop synchronization module;
[0102] a trajectory data input module, in communication with the PLC, for providing the PLC with at least one segment of trajectory data containing target motion information of two or more servo axes;
[0103] An interpolation generation module, configured to generate a multi-axis interpolation control instruction sequence based on the trajectory data;
[0104] An instruction output module, used for sending the interpolation control instruction to the servo driver according to a set period;
[0105] Status acquisition module, used to collect the actual operating status information of each servo axis;
[0106] a synchronization error evaluation module, configured to evaluate multi-axis synchronization deviation based on the operation status information;
[0107] an error compensation module, configured to correct the interpolation control instruction according to the synchronization deviation;
[0108] The trajectory transition control module is used to coordinate the control output in the transition area during the switching of multiple trajectory segments to achieve smooth multi-axis connection;
[0109] The exception handling module is used to trigger shutdown and recovery processing when it detects that the synchronization deviation exceeds the limit, the trajectory segment switching fails, or the interpolation instruction is abnormal;
[0110] The start-stop synchronization module is used to realize the synchronous motion control of each servo axis during the interpolation start and stop process.
[0111] When generating the interpolation control instructions for each cycle, the interpolation generation module calls the synchronization deviation output by the synchronization error evaluation module in the previous cycle, and the error compensation module generates a corresponding correction coefficient based on the synchronization deviation. The interpolation generation module dynamically adjusts the position, speed or torque control parameters in the interpolation instruction of the next cycle according to the correction coefficient.
[0112] By constructing a synchronization deviation vector and introducing a dynamic correction factor based on historical trends, the present invention enables differentiated compensation of interpolation control instructions for each servo axis based on the current error state, effectively reducing real-time synchronization errors between multiple axes and improving overall motion trajectory consistency. By setting a buffer transition zone at the trajectory segment switching point and adjusting the acceleration curve based on the speed difference between the upper and lower segments, the present invention effectively reduces speed fluctuations during segment switching, maintaining the smoothness and continuity of the servo axis motion process. A trajectory segment pre-reading and interpolation queue management mechanism is introduced to enable dynamic scheduling and switching judgment of interpolation data. This, combined with high-speed timed output tasks, ensures cycle stability and output synchronization of interpolation control, improving response speed and anti-interference capabilities. Through an integrated anomaly detection mechanism and interrupt recovery control strategy, the present invention promptly shuts down and reconstructs the starting point when synchronization errors exceed the limit, segment switching fails, or output anomalies occur during the interpolation process, ensuring operational safety and task continuity. Without relying on an external motion control card, the present invention enhances the PLC control logic structure and is widely applicable to multi-axis collaborative control systems for CNC machining, dispensing, cutting, and handling, demonstrating excellent versatility and engineering deployability.
[0113] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to these embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the appended claims and their equivalents.
Claims
1. A multi-axis servo control method based on PLC, characterized in that: The following steps are involved: Trajectory data acquisition step: inputting at least one segment of trajectory data into the PLC through a host computer, wherein the trajectory data includes target motion information for controlling two or more servo axes, and the target motion information includes target position, speed, and torque; Control instruction generating step: the PLC generates a corresponding multi-axis interpolation control instruction sequence according to the trajectory data, wherein the interpolation control instruction includes time-series target motion information; Control instruction output step: according to a set servo refresh cycle, the plurality of interpolation control instructions are respectively sent to each servo driver connected to the PLC for communication, the servo driver being used to drive the servo axis; Status information collection step: collecting actual operating status information of each servo axis, wherein the actual operating status information includes position feedback data, speed feedback data, and torque feedback data; Synchronization error evaluation step: the PLC evaluates the relative synchronization error between the servo axes based on the actual operation state information and the target motion information; Error compensation step: The PLC constructs a multi-axis synchronization deviation based on the deviation between the target motion information of the current cycle of each servo axis and the actual operating state, and corrects the position, speed or torque control parameters in the interpolation instruction of the next cycle of each servo axis according to the synchronization deviation and a preset adjustment coefficient to synchronize the motion state of each servo axis; Trajectory continuity control step: When the trajectory data contains multiple trajectory segments, the PLC sets a buffer transition area at the trajectory segment switching point, and adjusts the target acceleration change amplitude and speed update interval in the buffer transition area based on the difference between the output speed at the end of the previous trajectory segment and the expected speed at the starting segment of the next trajectory segment.
2. The PLC-based servo control method according to claim 1, characterized in that: The error compensation step comprises: The PLC constructs a deviation vector containing multiple axial error values based on the synchronization deviation; the deviation vector is input into a preset interpolation adjustment model; the model calculates a correction factor for each servo axis based on the relative size of the error and its historical change trend; the correction factor is used to dynamically adjust the position increment or speed instruction in the next cycle interpolation control instruction.
3. The PLC-based servo control method according to claim 1, characterized in that: In the trajectory continuity control step, the PLC sets a first buffer segment and a second buffer segment on both sides of each trajectory segment switching point. The first buffer segment is used to record the operating status of the end of the current trajectory segment, and the second buffer segment is used to guide the initial acceleration process of the next trajectory segment. The PLC generates a gradually convergent speed update sequence based on the difference between the end speed in the first buffer segment and the target starting speed in the second buffer segment, which is used to control the interpolation output frequency and acceleration change curve in the buffer transition area.
4. The PLC-based servo control method according to claim 1, characterized in that: In the control instruction generation step, the PLC manages the received trajectory data in segments and pre-reads multiple continuous trajectory segments from the trajectory segment buffer queue in each cycle. According to the connection status between the current running trajectory segment and the next trajectory segment and the remaining length of the current trajectory segment, the target position or speed update sequence of the interpolation instruction is dynamically calculated. In the interpolation control process, the trajectory segment switching judgment and instruction switching are executed according to the running time and the exhaustion of the pre-read segment.
5. The PLC-based servo control method according to claim 1, characterized in that: In the synchronization error evaluation step, the PLC selects one of the servo axes as the reference axis, uses its current position timestamp as the main reference moment in each cycle, performs time alignment on the feedback positions of other servo axes, and calculates the relative synchronization deviation of each slave axis based on the position deviation after time alignment. The relative synchronization deviation is used to construct a multi-axis synchronization error matrix.
6. The PLC-based servo control method according to claim 5, characterized in that: In the control instruction output step, the PLC writes the generated multi-axis interpolation control instructions into an independent output buffer queue in each cycle, and extracts the instructions of the corresponding axes from each buffer queue at a fixed cycle through a high-speed timing task and sends them to the servo drive. The triggering cycle of the high-speed timing task is consistent with the cycle.
7. The PLC-based servo control method according to claim 1, characterized in that: The PLC continuously monitors the synchronization deviation of each servo axis, the execution status of the trajectory segment, and the output beat of the interpolation control instructions. When it detects that the synchronization deviation of any servo axis exceeds the preset limit, the trajectory segment fails to complete the switching within the specified cycle, or the interpolation control instruction fails to be successfully output within consecutive cycles, the abnormal response mechanism is triggered. The abnormal response mechanism includes: pausing the current interpolation control process, outputting emergency stop or speed limit instructions to all servo drives, recording the abnormal status, and rebuilding the interpolation starting point based on the interruption position of the current operation segment.
8. The PLC-based servo control method according to claim 7, characterized in that: The method includes a multi-axis synchronous start and stop control step, specifically including: Before starting, the PLC sends a pre-start command to each servo drive and confirms that all servo axes are in the ready state, and then sends a unified start signal; when the stop condition is triggered during operation, the PLC generates corresponding deceleration control instructions according to the current operating status of each servo axis, and coordinates the stop process.
9. A PLC-based servo control system, applied to the PLC-based servo control method according to claims 1-8, characterized in that: include: PLC, including interpolation generation module, instruction output module, synchronization error evaluation module, error compensation module, trajectory transition control module, exception handling module and start-stop synchronization module; a trajectory data input module, in communication with the PLC, for providing the PLC with at least one segment of trajectory data containing target motion information of two or more servo axes; An interpolation generation module, configured to generate a multi-axis interpolation control instruction sequence based on the trajectory data; An instruction output module, used for sending the interpolation control instruction to the servo driver according to a set period; Status acquisition module, used to collect the actual operating status information of each servo axis; a synchronization error evaluation module, configured to evaluate multi-axis synchronization deviation based on the operation status information; an error compensation module, configured to correct the interpolation control instruction according to the synchronization deviation; The trajectory transition control module is used to coordinate the control output in the transition area during the switching of multiple trajectory segments to achieve smooth multi-axis connection; The exception handling module is used to trigger shutdown and recovery processing when it detects that the synchronization deviation exceeds the limit, the trajectory segment switching fails, or the interpolation instruction is abnormal; The start-stop synchronization module is used to realize the synchronous motion control of each servo axis during the interpolation start and stop process.
10. The PLC-based servo control system according to claim 9, characterized in that: When generating the interpolation control instructions for each cycle, the interpolation generation module calls the synchronization deviation output by the synchronization error evaluation module in the previous cycle, and the error compensation module generates a corresponding correction coefficient based on the synchronization deviation. The interpolation generation module dynamically adjusts the position, speed or torque control parameters in the interpolation instruction of the next cycle according to the correction coefficient.
Citation Information
Cited By
Modbus multi-axis real-time synchronous control method for numerical control machine tool
CN121091778A
High-precision three-axis cooperative motion control method and system based on sky PLC
CN121455050A
Robot control reconstruction method and system based on PLC replacement
CN121625172A
Robot control reconstruction method and system based on plc replacement
CN121625172B
Numerical control machine tool remote monitoring communication system based on industrial Ethernet
CN122331452A