Servo drive system control method and system for PLC
By pre-setting function block modules in the PLC, uniformly encapsulating custom data structures and safety interfaces, and judging logical motion conditions, the stability and safety issues in PLC servo drive system control are solved, and the stability and robustness of servo control are improved.
Patent Information
- Application Number
- CN202511295989.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-11
- Publication Date
- 2025-12-05
AI Technical Summary
The lack of unified development standards in existing PLC servo drive systems leads to poor program stability, and the reliance on manual programming for motion precondition checks can easily cause equipment malfunctions.
In the PLC, a preset function block module receives motion control instructions through a custom data structure interface and a safety interface, judges the preset logical motion conditions, and calls the underlying motion library functions only when the conditions are met, including emergency stop and interlock interfaces to ensure safety.
This improves the stability and robustness of servo control, lowers the development threshold, avoids equipment malfunctions caused by flawed logic, and enhances the reliability and security of the program.
Smart Images

Figure CN121069881A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of automatic control, in particular to a servo drive system control method and system for PLC. BACKGROUND
[0002] When using a programmable logic controller (PLC) to control a servo drive system based on an EtherCAT bus protocol, the common practice is to directly call the underlying function blocks provided by the PLC manufacturer, and use these underlying function blocks to implement basic functions such as servo enable, jog, absolute motion, relative motion, fault check, etc.
[0003] However, in the process of forming the present application, the inventors found that the prior art has the following defects: Programmers need to select and combine these scattered underlying function blocks according to project requirements, and there is a lack of unified development specifications. This leads to great differences in the final implemented control logic between different projects, even between different engineers, and the functions are often incomplete or even missing, and the stability of the program is poor. More importantly, the checking of motion preconditions (such as safety conditions) in this programming manner is completely written by hand, and if not well considered, it can easily lead to poor program robustness, and even trigger device misoperation under abnormal working conditions. SUMMARY
[0004] The purpose of the present application is to provide a servo drive system control method and system for PLC that greatly improves the stability and robustness of the program.
[0005] To achieve the above-mentioned purpose of the application, an embodiment of the present application provides a servo drive system control method for PLC, wherein a function block module is pre-set in the PLC, and the servo drive system control method comprises the following steps: monitoring a custom data structure interface of the function block module and a plurality of safety interfaces of the function block module to receive a motion control instruction for the servo drive system, wherein the custom data structure interface includes a plurality of instruction variables and corresponding motion parameters encapsulated uniformly, and the plurality of safety interfaces include a plurality of safety variables and corresponding safety parameters; after responding to the motion control instruction, determining whether all preset logical motion conditions corresponding to the motion control instruction are satisfied, wherein the preset logical motion conditions include at least one of whether a plurality of the motion parameters satisfy corresponding preset states, and whether a plurality of the safety parameters satisfy corresponding preset states; when all the preset logical motion conditions are satisfied, extracting the motion parameters corresponding to the motion control instruction, and calling an underlying motion library function with the extracted motion parameters as input to execute the motion control instruction.
[0006] As a further improvement of the present application, the several safety interfaces include an emergency stop interface and an interlock interface, the safety parameter corresponding to the emergency stop interface is an emergency stop parameter, the safety parameter corresponding to the interlock interface is an interlock parameter, and the servo drive system control method further comprises the steps of: when the emergency stop parameter received by the emergency stop interface is open, executing a servo shaft stop function and disconnecting the enable signal of the servo shaft; when the interlock parameter received by the interlock interface is open, keeping the servo shaft enable signal in the on state, and judging that the preset logical motion condition is not met, so as to prevent the execution of a new motion control instruction.
[0007] As a further improvement of the present application, the several instruction variables include a servo shaft static state, a shaft stop, a shaft pause, a home return, and an absolute positioning; when the motion control instruction is an absolute positioning instruction, the step of judging whether all the preset logical motion conditions are met comprises: generating an internal trigger signal indicating whether to allow or prohibit absolute positioning by judging whether the servo shaft is in a static state, whether the interlock parameter is closed, whether the shaft stop is in an inactive state, whether the shaft pause is in an inactive state, whether the home return is completed, and whether the absolute positioning is in an active state.
[0008] As a further improvement of the present application, the several instruction variables include an absolute displacement value, a shaft target speed, and a shaft acceleration; when the motion control instruction is an absolute positioning instruction, the step of calling the underlying motion library function specifically comprises: when the internal trigger signal is to allow absolute positioning, using the internal trigger signal to trigger the execution interface of the underlying motion library function; associating the absolute displacement value, the shaft target speed, and the shaft acceleration with the parameter interface corresponding to the underlying motion library function, respectively.
[0009] As a further improvement of the present application, the several instruction variables include a servo shaft static state, a shaft stop, a shaft pause, and a shaft relative positioning; when the motion control instruction is a relative motion instruction, the step of judging the preset logical motion condition specifically comprises: generating an internal trigger signal indicating whether to allow or prohibit relative motion by judging whether the servo shaft is in a static state, whether the interlock parameter is closed, whether the shaft stop is in an inactive state, whether the shaft pause is in an inactive state, and whether the shaft relative positioning is in an active state.
[0010] As a further improvement of the present application, the several instruction variables include a relative displacement value, an axis target speed, and an axis acceleration; When the motion control instruction is a relative motion instruction, the step of calling the underlying motion library function specifically includes: When the internal trigger signal is to allow relative motion, an execution interface of the underlying motion library function is triggered using the internal trigger signal; The relative displacement value, the axis target speed, and the axis acceleration are respectively associated with parameter interfaces corresponding to the underlying motion library function.
[0011] As a further improvement of the present application, the several instruction variables include an absolute positioning instruction, a relative positioning instruction, and a positioning completion; The servo drive system control method further includes the steps of: When a rising edge of a completion signal of absolute positioning completion or relative positioning completion is triggered, the positioning completion is set to an open state, wherein the absolute positioning completion is a temporary variable in the underlying motion library function corresponding to the absolute positioning instruction, and the relative positioning completion is a temporary variable in the underlying motion library function corresponding to the relative positioning instruction; When a rising edge of a new absolute positioning instruction or relative positioning instruction is detected, the positioning completion is set to a closed state.
[0012] As a further improvement of the present application, the several instruction variables include a static state of a servo axis, an axis stop, an axis pause, and a speed running mode; When the motion control instruction is a constant speed motion instruction, the step of judging the preset logic motion condition specifically includes: An internal trigger signal indicating whether to allow or prohibit constant speed motion is generated by judging whether the servo axis is in a static state, whether the interlock parameter is closed, whether the axis stop is in an inactive state, whether the axis pause is in an inactive state, and whether the speed running mode is in an active state.
[0013] As a further improvement of the present application, the several instruction variables include an axis target speed and an axis acceleration; When the motion control instruction is a constant speed motion instruction, the step of calling the underlying motion library function specifically includes: When the internal trigger signal is to allow constant speed motion, an execution interface of the underlying motion library function is triggered using the internal trigger signal; The axis target speed and the axis acceleration are respectively associated with parameter interfaces corresponding to the underlying motion library function.
[0014] To achieve the above-mentioned one of the purposes of the application, an embodiment of the present application provides a servo drive system control system for PLC, comprising: a servo drive system; a PLC, which is in communication connection with the servo drive system, wherein a function block module is stored in the memory of the PLC, the function block module comprises a self-defined data structure interface and a plurality of safety interfaces, the self-defined data structure interface comprises a plurality of instruction variables and corresponding motion parameters which are uniformly packaged, and the plurality of safety interfaces comprise a plurality of safety variables and corresponding safety parameters, and the function block module is configured to: after receiving a motion control instruction, judging whether all preset logical motion conditions corresponding to the motion control instruction are satisfied, wherein the preset logical motion conditions comprise at least one of whether a plurality of the motion parameters satisfy corresponding preset states and whether a plurality of the safety parameters satisfy corresponding preset states; when it is judged that all the preset logical motion conditions are satisfied, extracting motion parameters corresponding to the motion control instruction, and calling a bottom motion library function with the extracted motion parameters as input, so as to execute the motion control instruction through the servo drive system.
[0015] To achieve the above-mentioned one of the purposes of the application, an embodiment of the present application provides an electronic device, comprising: a storage module for storing a computer program; a processing module, which can realize the steps in the servo drive system control method for PLC when executing the computer program.
[0016] Compared with the commonly used technology, the present application has the following beneficial effects: on the one hand, the method uniformly packages the complex judgment logic and a plurality of motion modes in the function block module, provides a standardized self-defined data structure interface and a safety interface, and the user does not need to care about the complex logic combination of the bottom layer, but only needs to issue an instruction and configure parameters through the standard interface, so that complete and unified servo control functions can be realized, the development threshold and the dependence on personal experience are greatly reduced, and the stability of the program is better. On the other hand, before responding to the motion control instruction, the preset logical motion conditions are automatically judged, the conditions comprehensively consider the safety state of the device and the state of the servo shaft itself, and through the built-in "safety door", it is ensured that the bottom motion library function is only called when the device is in a safe and compliant state, so that the device misoperation caused by the illogicality of the logic is fundamentally avoided, the whole control system is more stable and reliable, and the robustness of the program is stronger. That is, the servo drive system control method for PLC significantly improves the stability and robustness of the servo control. BRIEF DESCRIPTION OF DRAWINGS
[0017] Figure 1This is a flowchart of a servo drive system control method for a PLC according to an embodiment of this application; Figure 2 This is a schematic diagram of functional blocks according to an embodiment of this application; Figure 3 This is a schematic diagram of a custom data structure interface according to an embodiment of this application. Detailed Implementation The present application will now be described in detail with reference to the specific embodiments shown in the accompanying drawings. However, these embodiments do not limit the present application, and any structural, methodological, or functional modifications made by those skilled in the art based on these embodiments are included within the scope of protection of this application.
[0018] One embodiment of this application provides a servo drive system control method and system for PLC that greatly improves the stability and robustness of the program.
[0019] This method and system encapsulate complex servo control logic within a pre-defined function block module in the PLC, interacts with external programs through a standardized interface, and establishes a rigorous pre-logic judgment mechanism internally. This greatly improves the stability, standardization, and reusability of the servo control program without changing the underlying library functions.
[0020] In this embodiment, the servo drive system control system communicates using the EtherCAT bus protocol, with the PLC acting as the master device and the servo drive system as the slave device. The PLC sends encapsulated control commands to the servo drive system via the EtherCAT bus and receives status feedback from the servo drive system. This servo drive system control method solves the problems of poor program stability and low portability caused by the lack of unified specifications when directly using the low-level function blocks for EtherCAT servos provided by PLC manufacturers.
[0021] The following is combined Figures 1-3 This application describes a servo drive system control method for a PLC provided in one embodiment. Although this application provides method operation steps as shown in the following embodiments or flowcharts, the execution order of steps in which there is no necessary causal relationship in logic, based on conventional or non-creative labor, is not limited to the execution order provided in the embodiments of this application.
[0022] Specifically, the servo drive system control method for PLC in this embodiment includes the following steps: Step S10: monitoring a custom data structure interface of the function block module and a plurality of safety interfaces of the function block module to receive a motion control instruction for the servo drive system, wherein the custom data structure interface includes a plurality of instruction variables and corresponding motion parameters packaged uniformly, and the plurality of safety interfaces include a plurality of safety variables and corresponding safety parameters.
[0023] Step S20: after responding to the motion control instruction, determining whether a preset logical motion condition corresponding to the motion control instruction is satisfied, wherein the preset logical motion condition includes at least one of whether a plurality of the motion parameters satisfy corresponding preset states, and whether a plurality of the safety parameters satisfy corresponding preset states.
[0024] Step S30: when the preset logical motion condition is satisfied, extracting motion parameters corresponding to the motion control instruction, and calling a bottom motion library function with the extracted motion parameters as inputs to execute the motion control instruction.
[0025] In step S10, the custom data structure interface is a main channel for regular instruction and data interaction, corresponding to a custom data type or structure in PLC programming. The application unifies a plurality of instruction variables (e.g., a Boolean switch to start an action) and motion parameters (e.g., target position, target speed, etc.) required for executing an action to form a complete data packet. When the main program needs to control a servo axis, it only needs to fill in this structure variable and connect it to the custom data structure interface of the function block.
[0026] The function block is as shown in Figure 2 The interface Axis is a custom data structure interface, Estop (emergency stop) is one of the safety interfaces, and Interlock (interlock) is another safety interface. The custom structure variable MyAxis uses a uniformly packaged data structure, which greatly simplifies the complexity and data management of the program. Compared to the traditional programming that needs to handle a large number of scattered and independent variables, the application can complete the transmission of all regular information through a structured data packet. This makes the program logic clearer, the data transmission more efficient, and provides great convenience for controlling multiple servo axes, such as each axis corresponding to an independent structure variable MyAxis, which significantly improves the readability and maintainability of the program.
[0027] Safety interface connects priority high, the state signal of personnel safety or equipment, for example, the state of physical emergency stop button (Estop), the signal of safety light curtain or safety door (Interlock) and so on. The safety variable (such as the on-off state of signal) received by these interfaces and the corresponding safety parameters (such as specific safety level or configuration) are physically and logically separated from the conventional instruction variable (Axis), which ensures that the safety signal can be processed by the internal logic of the function block with higher priority, avoids the delay or omission caused by the confusion with conventional instruction data, and makes the safety logic of the function block more clear and independent, providing a clear and reliable access point for the safety design of the main program.
[0028] In step S20, after the function block module receives the motion control instruction, it does not immediately pass the instruction to the underlying hardware, but first starts an internal "goalkeeper" - a preset logic motion condition judgment mechanism.
[0029] The preset logic motion condition judgment mechanism is a set of built-in Boolean logic in the function block. It checks the current state of the received motion parameters and safety parameters, and judges whether they meet the pre-set conditions for "allowing motion".
[0030] The preset logic motion condition is a composite logic, which at least includes the judgment of the state of motion parameters (for example, whether the current servo axis is in a specific state that allows motion) and the judgment of the state of safety parameters (for example, whether the external safety device is in a safe state). Only when all the conditions are met, the result is "true", thus establishing a safety and logic barrier.
[0031] Step S20 ensures that any servo motion must be based on the compliance of the device's own state and the satisfaction of external safety conditions. It internalizes the scattered safety check logic that originally relied on the programmer's personal experience and responsibility into the inherent and mandatory steps of the function block itself, fundamentally avoiding the misoperation of the device in an unsafe and non-compliant state due to logical oversight or lack of foresight, greatly improving the stability and safety of the entire control system.
[0032] In step S30, only when the "preset logical motion condition" judgment result of step S20 is "all satisfied", the program will enter the actual execution step. At this time, the function block module will extract the specific motion parameters (such as target speed, target position, acceleration, etc.) corresponding to the current motion control instruction from its self-defined data structure interface. Then it will call the underlying motion library function provided by the PLC manufacturer for directly controlling the hardware, and pass the motion parameters just extracted as input to the corresponding parameter interface of the library function, so as to drive the servo drive system to complete the final physical motion.
[0033] The underlying motion library function (such as MC_MoveAbsolute, MC_Power, MC_ReadStatus functions conforming to the PLCopen specification) is a specific instruction set provided by the PLC manufacturer to implement the EtherCAT bus protocol communication and control the basic functions of the servo drive system. The function block module performs actual physical operations by calling these underlying library functions for EtherCAT.
[0034] Step S30 builds an intelligent scheduling and management layer on top of the underlying library function, reusing the powerful functions of the underlying library function while supplementing the standardization of the calling interface and the pre-safety logic judgment lacking in the prior art. This allows developers to enjoy the convenience brought by the library function, while improving stability and standardization.
[0035] The plurality of safety interfaces differentially process safety events of different priorities. In one embodiment, as shown in FIG. 4, the plurality of safety interfaces include an EStop interface and an Interlock interface. The EStop interface corresponds to an EStop parameter, and the Interlock interface corresponds to an Interlock parameter. Figure 2
[0036] The servo drive system control method further includes steps of: Step S41: When the EStop parameter received by the EStop interface is open, the servo shaft stop function is executed, and the enable signal of the servo shaft is disconnected.
[0037] Step S42: When the Interlock parameter received by the Interlock interface is open, the preset logical motion condition is judged as not satisfied while keeping the servo shaft enable signal on, so as to prevent the execution of new motion control instructions.
[0038] In step S41, the emergency stop interface is used to connect the highest safety level device in the system, such as a physical emergency stop button. When the external emergency stop button is pressed, the corresponding emergency stop parameter (e.g. a Boolean value of "on" or "valid") is input into the function block module through the interface. At this time, the logic inside the function block is designed to execute the highest priority response: it will immediately invoke the servo shaft stop function, and directly turn off the enable signal of the servo shaft. Turning off the enable signal means cutting off the current output of the servo driver to the motor coil, making the motor enter a free stop or mechanical brake state with no torque output.
[0039] The emergency stop interface provides the highest level of safety assurance, ensuring that in an emergency, no matter what task the servo shaft is currently performing, it can be immediately and forcibly brought into a state of no energy and maximum safety, thereby protecting personnel and equipment.
[0040] In step S42, the interlock interface is used to connect non-emergency safety conditions related to the process flow or device state, such as safety doors, protective light curtains, or workpiece clamping sensors, etc. When these conditions are not met (e.g. the safety door is open), the corresponding interlock parameter becomes "on". The interlock interface is different from the emergency stop interface in that when the interlock parameter received by the interlock interface is on, the enable signal of the servo shaft remains on, meaning that the servo motor is still in a state of being powered and having torque, and can strongly maintain its current position from shifting.
[0041] The interlock interface can "lock" the execution of new motion commands tightly without losing the current precise position of the servo shaft, for example, when the operator opens the safety door to place or remove a workpiece, the system needs to prevent any new action of the robot, but at the same time needs the robot to remain in its original position. After the safety door is closed and the interlock signal is restored, the system can continue to execute the task from the locked position without the need to re-zero or position, greatly improving production efficiency and process continuity.
[0042] By differentiating the processing of the emergency stop interface and the interlock interface, this method achieves more fine-grained safety control.
[0043] In one embodiment, for the motion control instruction being an absolute positioning instruction, the judgment mechanism and invocation steps of the "preset logical motion condition" are described in detail. Absolute positioning refers to moving the servo shaft to a precise position based on the origin of the fixed coordinate system.
[0044] The instruction variables and corresponding motion parameters included in the custom data structure interface are as follows: Figure 3As shown, in the embodiment, the several instruction variables include Stand Still of the servo shaft, Stop of the shaft, Halt of the shaft, Homed of the origin, AbsExcute of the absolute position, Position of the absolute displacement value, Velocity of the shaft target speed, and ACC of the shaft acceleration.
[0045] When the motion control instruction is the absolute positioning instruction, the corresponding "absolute positioning" instruction variable is activated, and the judgment logic inside the function block module will immediately perform a comprehensive "logical and" operation on a group of six specific conditions to generate an internal trigger signal indicating whether the absolute positioning is allowed or prohibited. The judgment logic includes whether all of the following conditions are met: Step S51: generating the internal trigger signal indicating whether the absolute positioning is allowed or prohibited by judging whether the servo shaft is in a stand still state, whether the interlock parameter is closed, whether the shaft stop is in an inactive state, whether the shaft halt is in an inactive state, whether the origin homing is completed, and whether the absolute positioning is in an active state.
[0046] Among them, whether the servo shaft is in a stand still state is determined by checking whether the current speed of the servo shaft is zero. If the speed is 0, the servo shaft is in a stand still state. The stand still state ensures that a new positioning is not started during the motion process; whether the interlock parameter is closed is determined by the signal transmitted from the interlock interface, ensuring that all external safety conditions are met; whether the shaft stop is in an inactive state is determined by checking whether a higher priority stop instruction is in effect; whether the shaft halt is in an inactive state is determined by checking whether a higher priority halt instruction is in effect; whether the origin homing is completed is used to confirm whether the servo shaft has performed a zero reset operation and established an effective coordinate system; and whether the absolute positioning is in an active state is determined by confirming that the external program indeed issued a request for this absolute positioning.
[0047] When the results of the six judgments are all yes, the internal trigger signal indicating that the absolute positioning is allowed is generated, otherwise, if at least one of the judgment results is no, the internal trigger signal indicating that the absolute positioning is prohibited is generated.
[0048] Through multi-dimensional pre-judgment, position errors and even equipment collisions are avoided, ensuring that each execution of absolute positioning is performed under the premise of safe device state, correct logic condition, and effective coordinate system, thereby greatly improving the accuracy of positioning and the reliability of device operation.
[0049] The servo drive system control method further includes the steps of: Step S52: Trigger the execution interface of the underlying motion library function using the internal trigger signal.
[0050] Step S53: Associate the absolute displacement value, the axis target speed and the axis acceleration with the parameter interface corresponding to the underlying motion library function, respectively.
[0051] Step S52 triggers the execution using the internal trigger signal of "allowing absolute positioning" to activate the execution interface (Execute) of the underlying motion library function (such as the MC_MoveAbsolute function block conforming to the PLCopen specification).
[0052] Step S53 triggers the execution, and the function block module automatically reads the user- preset motion parameters from its self- defined data structure interface, including the absolute displacement value (i.e. the precise coordinate to be moved to), the axis target speed and the axis acceleration, and associates or transfers these values to the parameter input interface corresponding to the above- mentioned underlying motion library function, respectively. The user only needs to "fill in the form" to set the motion target in the self- defined data structure, without needing to care about when and how to transfer these parameters to the underlying function. The logic inside the function block module will automatically complete the whole process of triggering and parameter transfer at a safe and appropriate time.
[0053] In an embodiment thereof, as shown in Figure 3 the plurality of instruction variables further include the axis relative positioning (RelExcute) and the relative displacement value (Distance).
[0054] When the motion control instruction is a relative motion instruction, the step of judging the preset logic motion condition specifically includes: Step S61: Generate an internal trigger signal indicating whether to allow or prohibit relative motion by judging whether the servo axis is in a stationary state, whether the interlock parameter is closed, whether the axis stop is in an inactive state, whether the axis pause is in an inactive state, and whether the axis relative positioning is in an active state.
[0055] Step S62: Trigger the execution interface of the underlying motion library function using the internal trigger signal when the internal trigger signal is to allow relative motion.
[0056] Step S63: Associate the relative displacement value, the axis target speed and the axis acceleration with the parameter interface corresponding to the underlying motion library function, respectively.
[0057] In step S61, by five judgment conditions, the original point regression check is omitted, and the relative motion instruction can be safely executed without completing the initialization (zero return) of the device. The execution of the relative motion instruction is very useful in many application scenarios, such as manual debugging or some processes that only need stepping motion. The operation process can be simplified, the device response speed is improved, and it is ensured that the execution of the motion is also safe and reliable in the non-origin mode.
[0058] Step S62: When the five conditions in step S61 are all met, the execution step is started, the internal trigger signal is allowed to move relatively, and the function block module uses the internal trigger signal to trigger the execution interface of the underlying motion library function (such as MC_MoveRelative).
[0059] Step S63: The motion parameters required for executing the instruction are automatically extracted and passed from the custom data structure interface, mainly including the relative displacement value (Distance), the axis target speed (Velocity), and the axis acceleration (ACC).
[0060] In an embodiment, the plurality of instruction variables include a positioning completion (PosOK).
[0061] The servo drive system control method further includes the steps of: Step S71: When the rising edge of the absolute positioning completion or the relative positioning completion signal is triggered, the positioning completion is set to an open state, wherein the absolute positioning completion is a temporary variable in the underlying motion library function corresponding to the absolute positioning instruction, and the relative positioning completion is a temporary variable in the underlying motion library function corresponding to the relative positioning instruction.
[0062] Step S72: When a new absolute positioning instruction or a relative positioning instruction is detected, the positioning completion is set to an off state.
[0063] On the one hand, the function block module continuously monitors the temporary variable representing the task completion in the underlying library function, such as MC_MoveAbsolute (absolute motion) or MC_MoveRelative (relative motion). When it detects the rising edge of the completion signal from OFF to ON (i.e., the moment when the motion is completed), it sets the "positioning completion" member variable to an open state (ON).
[0064] On the other hand, the function block module also monitors the user's action of issuing a new instruction. When it detects the rising edge of a new absolute positioning instruction or a relative positioning instruction (i.e., the moment when the new task starts), it immediately sets the "positioning completion" member variable to an off state (OFF).
[0065] After a positioning command is issued, the program can safely wait for the "positioning complete" signal to turn ON. Once the signal turns ON, the main program can be sure that the command just issued is completed, and can immediately start the next step of the flow (e.g., start the next positioning command). Since the new command will immediately clear the previous completion signal, it fundamentally avoids the risk of the program reading the stale, last-time completion status, thus causing the flow to be confused.
[0066] In an embodiment thereof, the plurality of command variables includes a velocity execution mode (VelExcute).
[0067] When the motion control command is a constant velocity motion command, the step of judging the preset logic motion condition specifically includes: Step S81: An internal trigger signal indicating whether constant velocity motion is allowed or prohibited is generated by judging whether the servo axis is in a stationary state, whether the interlock parameter is closed, whether the axis stop is in an inactive state, whether the axis pause is in an inactive state, and whether the velocity execution mode is in an active state.
[0068] Step S82: When the internal trigger signal indicates that constant velocity motion is allowed, the execution interface of the underlying motion library function is triggered using the internal trigger signal.
[0069] Step S83: The axis target speed and the axis acceleration are associated with the parameter interfaces corresponding to the underlying motion library function, respectively.
[0070] In step S81, the function block performs a logical AND operation on the five conditions to generate an internal trigger signal indicating whether constant velocity motion is allowed or prohibited, ensuring safety. Whether used for manual operation during device debugging or for continuous feeding in the production process, the application of this function is equally stable and safe, avoiding the risk of starting the motor to run in an inappropriate state (such as when the safety door is open). When all five conditions are true, the internal trigger signal indicating that constant velocity motion is allowed is generated, otherwise it is prohibited.
[0071] In step S82, when the internal trigger signal is generated as "allow constant velocity motion", the function block module triggers the execution interface of the underlying motion library function (e.g., MC_MoveVelocity) using the signal.
[0072] In step S83, the module automatically extracts and passes the axis target speed and axis acceleration (for smooth start and stop) required to execute the command from the custom data structure interface. The motor will run at the set target speed until a stop command is received.
[0073] In addition to the absolute positioning, relative positioning and constant speed motion modes detailed in the foregoing embodiments, the function block module can also integrate other important motion control modes to adapt to more diverse industrial application requirements. For example, torque control mode, jog function, etc. Other Figure 3 The content of the custom data structure interface is defined.
[0074] Taking the torque control mode as an example, the custom data structure interface can also contain a target torque parameter (TarTorque) and a torque control mode start instruction (TorExcute). After the function block receives the torque control start instruction, and after passing the same pre-logic motion condition judgment (such as safety interlocking, etc.), it will call the underlying torque control library function (such as MC_TorqueControl), and pass the target torque parameter to the function, so that the servo shaft outputs with the set torque. In this way, torque control is also included in the unified packaging framework, so that all motion modes follow the same call and safety check logic, greatly improving the uniformity and development efficiency of the application.
[0075] Taking the jog function as an example, the custom data structure interface can set independent forward jog instruction (JOG_F) and reverse jog instruction (JOG_B), as well as a jog speed parameter (Velocity_JOG). When the operator triggers the jog instruction through the human-machine interface, the function block will call the underlying jog library function (such as MC_Jog) after passing the safety check, to drive the servo shaft to move in the specified direction at the set jog speed, also improving the uniformity and development efficiency of the application.
[0076] In addition, the actual position (ActPos), actual speed (ActVel), actual torque (ActTor), maximum actual speed reached during motion (ActVelMax), positive limit (Limit_FF), negative limit (Limit_RR), and home sensor (Limit_Home) of the servo drive system can be read back in real time and updated to the corresponding member variables in the custom data structure interface.
[0077] The custom data structure interface also contains an instruction variable for alarm reset (Reset), as well as member variables for feedback of fault status (Error) and fault code (ErrID). When a fault occurs in the servo drive system, the function block will capture the fault by calling the underlying library function (such as MC_ReadAxisError), and immediately set the Error variable, while writing the specific ErrID to the corresponding variable. The operator can see the detailed fault information, and after eliminating the physical fault, trigger the Reset instruction to make the function block call the alarm reset library function (such as MC_Reset) to clear the fault status of the driver.
[0078] Compared with the common technology, the embodiment has the following beneficial effects: On the one hand, the method unifies the complex judgment logic and various motion modes in the function block module, provides a standardized self-defined data structure interface and a safety interface, and the user does not need to care about the complex logic combination of the bottom layer any more, but only needs to issue an instruction and configure a parameter through the standard interface, so that complete and unified servo control functions can be realized, the development threshold and the dependence on personal experience are greatly reduced, and the stability of the program is better. On the other hand, before responding to the motion control instruction, the preset logic motion condition is automatically judged, the condition comprehensively considers the safety state of the equipment and the state of the servo shaft, and through the built-in “safety door”, it is ensured that the bottom layer motion library function is called only when the equipment is in a safe and compliant state, so that the equipment misoperation caused by the imprecise logic is fundamentally avoided, the control system is more stable and reliable, and the robustness of the program is stronger. That is, the servo drive system control method for the PLC significantly improves the stability and robustness of the servo control.
[0079] In an embodiment, a servo drive system control system for a PLC is provided, comprising a servo drive system and a PLC, the PLC being in communication connection with the servo drive system, wherein a function block module is stored in the memory of the PLC, the function block module comprising a self-defined data structure interface and a plurality of safety interfaces, the self-defined data structure interface comprising a plurality of instruction variables and corresponding motion parameters uniformly encapsulated therein, and the plurality of safety interfaces comprising a plurality of safety variables and corresponding safety parameters, the function block module being configured to: after receiving a motion control instruction, judging whether preset logic motion conditions corresponding to the motion control instruction are all satisfied, wherein the preset logic motion conditions comprise at least one of whether a plurality of the motion parameters satisfy corresponding preset states, and whether a plurality of the safety parameters satisfy corresponding preset states; when it is judged that the preset logic motion conditions are all satisfied, extracting motion parameters corresponding to the motion control instruction, and calling a bottom layer motion library function with the extracted motion parameters as inputs, so as to execute the motion control instruction through the servo drive system.
[0080] The servo drive system control system for the PLC of the embodiment further comprises a human-computer interaction system, such as a touch screen, for an operator to set motion parameters, issue motion instructions, and monitor the state of the servo shaft in real time. The PLC receives instructions from the human-computer interaction system, executes the encapsulated logic inside the function block, and sends the final motion instruction to the servo drive system, and the servo drive system specifically executes the instruction from the PLC to drive the servo motor to complete physical motion.
[0081] To achieve the above-mentioned one of the purposes of the application, an embodiment of the present application provides an electronic device, comprising: a storage module, which stores a computer program; a processing module, which, when executing the computer program, can implement the steps in the above-mentioned servo drive system control method for PLC.
[0082] The servo drive system control device for PLC can also include a computer, a notebook, a palm computer, a cloud server and other computing devices, and include but not limited to a processing module, a storage module, and a computer program stored in the storage module and executable on the processing module, such as the above-mentioned servo drive system control method program for PLC. The processing module executes the computer program to implement the steps in each of the above-mentioned servo drive system control method embodiments for PLC, such as Figure 1 the steps shown.
[0083] In addition, the present application also proposes an electronic device, which includes a storage module and a processing module, and the processing module, when executing the computer program, can implement the steps in the above-mentioned servo drive system control method for PLC, that is, implement the steps in any one of the above-mentioned technical solutions of the servo drive system control method for PLC.
[0084] The electronic device can be part of the servo drive system control device for PLC, or a local terminal device, or part of a cloud server.
[0085] The processing module can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor, or any conventional processor. The processing module is the control center of the servo drive system control device for PLC, and connects all parts of the servo drive system control device for PLC through various interfaces and lines.
[0086] The storage module can be used to store the computer programs and / or modules, the processing module implements various functions of the servo drive system control device for PLC by running or executing the computer programs and / or modules stored in the storage module and calling the data stored in the storage module. The storage module mainly includes a storage program area and a storage data area, wherein the storage program area can store an operating system, at least one application program required by a function, and the like. In addition, the storage module can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0087] For example, the computer program can be divided into one or more modules / units, which are stored in the storage module and executed by the processing module to complete the present application. The one or more modules / units can be a series of computer program instruction segments capable of completing a specific function, which are used to describe the execution process of the computer program in the servo drive system control device for PLC.
[0088] It should be understood that although the present specification is described in terms of embodiments, not every embodiment contains only one independent technical solution, and the description of the specification is only for the sake of clarity, and those skilled in the art should consider the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that those skilled in the art can understand.
[0089] The series of detailed descriptions listed above are only specific descriptions of the feasible embodiments of the present application, and are not used to limit the protection scope of the present application, and any equivalent embodiments or changes made without departing from the specific spirit of the present application should be included in the protection scope of the present application.
Claims
1. A servo drive system control method for a PLC, characterized by, The PLC has a preset function block module, and the servo drive system control method comprises the steps of: monitoring a custom data structure interface of the function block module and a plurality of safety interfaces of the function block module to receive a motion control instruction for the servo drive system, wherein the custom data structure interface comprises a plurality of instruction variables and corresponding motion parameters packaged uniformly, and the plurality of safety interfaces comprise a plurality of safety variables and corresponding safety parameters; after responding to the motion control instruction, determining whether preset logical motion conditions corresponding to the motion control instruction are all satisfied, wherein the preset logical motion conditions comprise at least one of whether a plurality of the motion parameters satisfy corresponding preset states and whether a plurality of the safety parameters satisfy corresponding preset states; when the preset logical motion conditions are all satisfied, extracting motion parameters corresponding to the motion control instruction, and calling a bottom motion library function with the extracted motion parameters as inputs to execute the motion control instruction.
2. The servo drive system control method for a PLC according to claim 1, characterized by, The plurality of safety interfaces comprises an emergency stop interface and an interlock interface, the safety parameter corresponding to the emergency stop interface is an emergency stop parameter, the safety parameter corresponding to the interlock interface is an interlock parameter, and the servo drive system control method further comprises the steps of: when the emergency stop parameter received by the emergency stop interface is open, executing a servo shaft stop function and disconnecting an enable signal of the servo shaft; when the interlock parameter received by the interlock interface is open, keeping the servo shaft enable signal in an on state and determining that the preset logical motion conditions are not satisfied to prevent execution of a new motion control instruction.
3. The servo drive system control method for a PLC according to claim 2, wherein The plurality of instruction variables comprises a servo shaft static state, a shaft stop, a shaft pause, a home return, and an absolute positioning; when the motion control instruction is an absolute positioning instruction, the determination of whether the preset logical motion conditions are all satisfied comprises: generating an internal trigger signal indicating whether absolute positioning is allowed or prohibited by determining whether the servo shaft is in a static state, the interlock parameter is closed, the shaft stop is in an inactive state, the shaft pause is in an inactive state, the home return is completed, and the absolute positioning is in an active state.
4. The servo drive system control method for a PLC according to claim 3, wherein The plurality of instruction variables comprises an absolute displacement value, a shaft target speed, and a shaft acceleration; when the motion control instruction is an absolute positioning instruction, the step of calling the bottom motion library function comprises: when the internal trigger signal indicates that absolute positioning is allowed, triggering an execution interface of the bottom motion library function using the internal trigger signal; associating the absolute displacement value, the shaft target speed, and the shaft acceleration with corresponding parameter interfaces of the bottom motion library function, respectively.
5. The servo drive system control method for a PLC according to claim 2, wherein The plurality of instruction variables comprises a servo shaft static state, a shaft stop, a shaft pause, and a shaft relative positioning; when the motion control instruction is a relative motion instruction, the step of determining the preset logical motion conditions comprises: The internal trigger signal is generated by judging whether the servo shaft is in a static state, whether the interlock parameter is closed, whether the shaft stop is in an inactive state, whether the shaft pause is in an inactive state, and whether the shaft relative positioning is in an active state, to represent permission or prohibition of relative motion.
6. The servo drive system control method for a PLC according to claim 5, wherein The plurality of instruction variables include a relative displacement value, a shaft target speed, and a shaft acceleration; When the motion control instruction is a relative motion instruction, the step of calling the underlying motion library function specifically includes: When the internal trigger signal is permission of relative motion, an execution interface of the underlying motion library function is triggered using the internal trigger signal; The relative displacement value, the shaft target speed, and the shaft acceleration are respectively associated with parameter interfaces corresponding to the underlying motion library function.
7. The servo drive system control method for a PLC according to claim 3 or 5, wherein The plurality of instruction variables include an absolute positioning instruction, a relative positioning instruction, and a positioning completion; The servo drive system control method further includes the steps of: When a rising edge of a completion signal of absolute positioning completion or relative positioning completion is triggered, the positioning completion is set to an open state, wherein the absolute positioning completion is a temporary variable in the underlying motion library function corresponding to the absolute positioning instruction, and the relative positioning completion is a temporary variable in the underlying motion library function corresponding to the relative positioning instruction; When a rising edge of a new absolute positioning instruction or relative positioning instruction is detected, the positioning completion is set to a closed state.
8. The servo drive system control method for a PLC according to claim 2, wherein The plurality of instruction variables include a static state of a servo shaft, a shaft stop, a shaft pause, and a speed running mode; When the motion control instruction is a constant speed motion instruction, the step of judging the preset logic motion condition specifically includes: The internal trigger signal is generated by judging whether the servo shaft is in a static state, whether the interlock parameter is closed, whether the shaft stop is in an inactive state, whether the shaft pause is in an inactive state, and whether the speed running mode is in an active state, to represent permission or prohibition of constant speed motion.
9. The servo drive system control method for a PLC according to claim 8, wherein The plurality of instruction variables include a shaft target speed and a shaft acceleration; When the motion control instruction is a constant speed motion instruction, the step of calling the underlying motion library function specifically includes: When the internal trigger signal is permission of constant speed motion, an execution interface of the underlying motion library function is triggered using the internal trigger signal; The shaft target speed and the shaft acceleration are respectively associated with parameter interfaces corresponding to the underlying motion library function.
10. A servo drive system control system for a PLC, characterized by, It includes: A servo drive system; A PLC, which is in communication connection with the servo drive system, wherein a memory of the PLC stores a function block module, the function block module includes a self-defined data structure interface and a plurality of safety interfaces, the self-defined data structure interface includes a plurality of instruction variables and corresponding motion parameters encapsulated uniformly, and the plurality of safety interfaces include a plurality of safety variables and corresponding safety parameters, and the function block module is configured to: After receiving the motion control instruction, it is judged whether all preset logical motion conditions corresponding to the motion control instruction are satisfied, wherein the preset logical motion conditions include at least one of whether a plurality of motion parameters satisfy corresponding preset states and whether a plurality of safety parameters satisfy corresponding preset states; When it is judged that all the preset logical motion conditions are satisfied, the motion parameters corresponding to the motion control instruction are extracted, and the extracted motion parameters are taken as inputs to call a bottom motion library function, so as to execute the motion control instruction through the servo drive system.
Citation Information
Patent Citations
Torque control method of servo driver
CN104779894A
Semi-automatic and full-automatic correction method for cutter head offset of swash plate servo tool magazine
CN107678397A
Servo motor energy-saving control system
CN110058567A
Motion controller for servo motor
CN114995536A
Control method and system for controlling multi-axis linkage driving of servo driver
CN118112993A