An automated testing method, device and storage medium for a bus type servo driving unit
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NANJING ESTUN AUTOMATION CO LTD
- Filing Date
- 2023-02-15
- Publication Date
- 2026-06-16
Smart Images

Figure CN116089295B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of software testing technology for bus-type servo drive units. Background Technology
[0002] Industrial Ethernet-based motion control buses such as EtherCAT and CANopen offer advantages such as high communication speed, strong anti-interference performance, and high real-time performance, and have gradually replaced traditional pulse and analog interface control methods between motion controllers and servo drives. In the software testing of bus-type servo drive units, the process first requires software test engineers to design test cases based on the test functions, and then test each test case one by one through a host computer (e.g., a TwinCAT host). Due to the large variety of test cases, the lengthy test case writing time, and the numerous repetitive and tedious operations in the testing process, efficiency is low. Furthermore, human fatigue leads to test omissions and increased error rates. Especially when modifying a function requires verification of all servo functions, manual testing can take 1-2 weeks, and sometimes, due to time constraints, the comprehensiveness of the testing cannot be guaranteed.
[0003] CN112834852A and CN111157893A describe a comprehensive test platform for a modular servo drive unit based on bus control. Both inventions mainly describe the environment of the bus-type servo unit test platform, but lack a description of the test method.
[0004] CN109460011A describes a comprehensive performance testing device and method for bus-type motion control systems. It mainly introduces the timing of EtherCAT network data transmission and data fusion during the testing process, but does not provide specific testing methods. This fails to address the problems of repetitive, cumbersome, and inefficient servo testing.
[0005] CN112506759A discloses an automated testing method, apparatus, and computer-readable storage medium for servo system control software. The method, running on the LabVIEW platform, includes creating a test case generation template comprising a front panel and multiple sub-VIs, where the sub-VIs are a servo signal conversion sub-VI, a checksum generation sub-VI, an instruction type identification sub-VI, or a table generation sub-VI. This method lacks descriptions of environment setup and automated test case design methods. Summary of the Invention
[0006] To address the above problems, this invention proposes an automated testing method, device, and storage medium for bus-type servo drive units, enabling fully automated testing of bus-type servo drive unit software, improving the testing efficiency of servo system control software, and effectively controlling costs.
[0007] The technical solution of this invention is as follows: The .TSM system manager project file and .PRO project running on the Beckhoff CXxxx series controller TwinCAT platform complete the testing of the bus-type servo drive unit based on the CIA402 protocol of CANopen and EtherCAT bus;
[0008] The automated testing method includes: configuring the servo unit hardware testing environment, creating a new PDO interface variable for the bus-type servo unit in the System Manager environment of TwinCAT2.0 software, and generating a .TSM system manager project file;
[0009] In the TwinCAT2.0 PLC Control logic programming environment, create a human-machine interface and multiple automated testing function modules.
[0010] The multiple automated testing function modules include a communication connection module, a servo unit information acquisition module, a test case design module, a data processing and logic judgment module, an error handling module, a table generation module, and a human-machine interface module;
[0011] The communication connection module calls the library files IOF_DeviceReset and IOF_DeviceNetID in TwinCAT2 to establish a connection with the .TSM system manager;
[0012] The servo unit information acquisition module acquires the encoder bit depth and power of the servo drive unit;
[0013] The data processing and logic judgment module reads the data sent by the servo drive unit, compares the feedback servo status word, speed, position, following error and other information with the expected value of the use case design module, and determines whether the servo drive unit executes according to the use case.
[0014] When a test case fails to execute, the error handling module records the name of the erroneous test case and the error message.
[0015] The error handling module sends the error information to the table generation module, generates a test fault table, and converts it into text information that is easy for testers to recognize.
[0016] The human-machine interface module is used to select the test cases to be executed, read the parameters of the servo drive unit, display the state switching process of the servo drive unit, and other test process information.
[0017] Furthermore, the test case design module adopts a three-level directory structure, and the test items, test steps, and result judgments are designed using an enumeration approach.
[0018] The test cases are categorized by test content into PP mode, PV mode, PT mode, and HM mode.
[0019] The second-level directory is divided into the functions to be tested according to the functions required by the first-level directory: basic functions, HALT functions, position functions, limit functions, etc.; the third-level directory expands on each subdirectory of the second-level directory; the test items, test steps and result judgment adopt an enumeration design method.
[0020] The test case design module automatically sets the initialization parameters for the speed-position comparison window and the position-position comparison window based on the obtained encoder information of the servo drive unit.
[0021] Furthermore, the data processing and logic judgment module obtains the test steps for each test case and parses them into the execution instruction Action_item and the expected result Check_item;
[0022] The execution instructions are stored in the action sequence function Test_case_steps_action as an array and sent to the .TSM system manager; the .PRO project obtains the feedback information from the servo drive unit, the data processing and logic judgment module reads the expected result Check_item array, calls the Check_Process logic judgment module, compares the feedback result of the servo drive unit with the expected result of the test case design, and determines whether the test case execution passes.
[0023] The automated testing method specifically includes the following steps:
[0024] Determine if the communication connection is successful; if so, proceed to the next step; otherwise, manually investigate the cause of the error. Next, determine if the acquisition of axis parameters is complete; if so, proceed to the next step; otherwise, manually investigate the cause of the error. Then, initialize the axis parameters and clear the axis alarms.
[0025] Determine whether to enable PP, PV, PT, and HM automated testing. If yes, proceed with the automated testing process to perform PP, PV, PT, and HM modes one by one. Otherwise, wait for the selected mode and then perform PP, PV, PT, or HM mode according to the selected mode.
[0026] PP mode includes the following steps:
[0027] PP mode data initialization and parameter initialization;
[0028] In PP mode, the sequential execution of a sub-test case begins; each action is executed, including setting runtime parameters and state switching; it checks whether each action is completed, proceeding to the next step if yes, otherwise entering the PP mode error handling subroutine; it obtains runtime data feedback from the motor, including speed, position, and state machine, and checks whether the PDS state machine can switch normally, proceeding to the next step if yes, otherwise entering the PP mode error handling subroutine; it checks whether the driver has any abnormal alarms, proceeding to the next step if no, otherwise entering the PP mode error handling subroutine; it checks whether the running results meet expectations, proceeding to the next step if yes, otherwise entering the PP mode error handling subroutine; it checks whether all test cases in PP mode have finished executing, proceeding to the next step if yes, otherwise returning to restart the sequential execution of a sub-test case in PP mode until all test cases in PP mode have finished executing.
[0029] Determine if the current test is automated; if so, enter PV mode; otherwise, end the test.
[0030] PV mode includes the following steps:
[0031] PV mode data initialization and parameter initialization;
[0032] In PV mode, the sequential execution of a sub-test case begins; each action is executed, including setting runtime parameters and state switching; it checks whether each action is completed, proceeding to the next step if yes, otherwise entering the PV mode error handling subroutine; it obtains motor runtime data feedback, including speed, position, and state machine, and checks whether the PDS state machine can switch normally, proceeding to the next step if yes, otherwise entering the PV mode error handling subroutine; it checks whether the driver has any abnormal alarms, proceeding to the next step if no, otherwise entering the PV mode error handling subroutine; it checks whether the running results meet expectations, proceeding to the next step if yes, otherwise entering the PV mode error handling subroutine; it checks whether all PV mode test cases have finished executing, proceeding to the next step if yes, otherwise returning to restart the sequential execution of the sub-test cases in PV mode, until all PV mode test cases have finished executing;
[0033] Determine if the current test is automated; if yes, enter PT mode; otherwise, end the test.
[0034] PT mode includes the following steps:
[0035] PT mode data initialization and parameter initialization;
[0036] In PT mode, the sequential execution of a sub-test case begins; each action is executed, including setting runtime parameters and state switching; it checks whether each action is completed, proceeding to the next step if yes, otherwise entering the PT mode error handling subroutine; it obtains motor runtime data feedback, including speed, position, and state machine, and checks whether the PDS state machine can switch normally, proceeding to the next step if yes, otherwise entering the PT mode error handling subroutine; it checks whether the driver has any abnormal alarms, proceeding to the next step if no, otherwise entering the PT mode error handling subroutine; it checks whether the running results meet expectations, proceeding to the next step if yes, otherwise entering the PT mode error handling subroutine; it checks whether all PT mode test cases have finished executing, proceeding to the next step if yes, otherwise returning to restart the sequential execution of the sub-test cases in PT mode, until all PT mode test cases have finished executing;
[0037] Determine if the current test is automated; if so, enter HM mode; otherwise, end the test.
[0038] The HM model includes the following steps:
[0039] HM mode data initialization and parameter initialization;
[0040] The HM mode executes each zero-return method sequentially from start to finish. After starting the zero-return process, a zero-return signal is given at each step, including POT, NOT, and HM. The HM signal setting is checked for success; if successful, proceed to the next step; otherwise, proceed to the HM mode error handling subroutine. Motor runtime data feedback is obtained, including speed and state machine. The PDS state machine is checked for normal switching; if successful, proceed to the next step; otherwise, proceed to the HM mode error handling subroutine. The driver is checked for any abnormal alarms; if none are present, proceed to the next step; otherwise, proceed to the HM mode error handling subroutine. The running results are checked for compliance with expectations; if successful, proceed to the next step; otherwise, proceed to the HM mode error handling subroutine. All zero-return methods in the HM mode have finished executing; if successful, proceed to the next step; otherwise, return to restart the sequential execution of each zero-return method in the HM mode until all HM mode test cases have been completed.
[0041] Finish.
[0042] Furthermore, in the PP mode error handling subroutine, PV mode error handling subroutine, PT mode error handling subroutine, or HM mode error handling subroutine, when the test case execution result fails, the error handling module records the name and content of the error test case; then, the error handling module transmits the error information to the table generation module to generate a test fault table and converts it into text information.
[0043] An automated testing device for a bus-type servo drive unit that implements the aforementioned automated testing method includes a processor for executing a computer program stored in a memory.
[0044] A storage medium for implementing the automated testing method is provided, wherein an automated testing program for a bus-type servo drive unit is stored on the computer-readable storage medium, and when the automated testing program for the bus-type servo drive unit is executed by a processor, the automated testing method for the bus-type servo drive unit is implemented.
[0045] The beneficial effects of this invention are as follows:
[0046] I. This invention enables fully automated testing of bus-type servo drive unit software, improves the testing efficiency of servo system control software, and effectively controls costs.
[0047] II. Depending on the testing requirements of the test project, it can connect to CANopen and EtherCAT bus-type drivers, and is suitable for testing not only single-axis servos but also dual-axis and multi-axis servos, offering strong compatibility. It can automatically select appropriate test case initialization parameters based on the type of servo drive unit connected, making it easy to use.
[0048] Third, the test cases adopt a three-level directory design, and the test items, test steps, and result judgments use an enumeration design, making the test content clear. Expanding test cases and the test steps within each test case is very easy. Adding, modifying, or deleting test cases only requires modifying the test case module, without needing to modify other modules of the .PRO project, making it simpler and faster for testers to use. Attached Figure Description
[0049] Figure 1 This is a structural diagram of a specific embodiment of the automated testing device provided in this invention.
[0050] Figure 2 This is a data interaction diagram for an automated testing method provided in an embodiment of the present invention.
[0051] Figure 3 This is a schematic diagram of an automated testing method provided in an embodiment of the present invention.
[0052] Figure 4 This is a schematic diagram illustrating the execution flow of the automated testing method provided in an embodiment of the present invention.
[0053] Figure 5 This is a schematic diagram of a three-level directory design method for test cases in the automated testing method provided in this embodiment of the invention.
[0054] Figure 6 This is a schematic diagram of the test action sequence and result comparison sequence of the automated testing method provided in the embodiments of the present invention.
[0055] Figure 7A simulation diagram showing the error information display of the automated testing method provided in this embodiment of the invention.
[0056] Figure 8 A simulation diagram of the human-machine interface display for the automated testing method provided in this embodiment of the invention. Implementation
[0057] To clearly illustrate the technical features of this patent, the following detailed description is provided through specific embodiments and in conjunction with the accompanying drawings.
[0058] like Figure 1-8 As shown, the automated testing of this invention is applicable not only to testing single-axis servos but also to testing dual-axis and multi-axis servos, exhibiting good compatibility. The test cases employ a three-level directory design, and the test items, test steps, and result judgments utilize an enumeration design, making it easy to add, delete, and modify the number of test cases, test steps, and result judgment items.
[0059] Specifically:
[0060] The .TSM system manager project files and .PRO projects running on the Beckhoff CXxxx series controller TwinCAT platform can automatically and efficiently complete the testing of bus-type servo drive units based on the CIA402 protocol of CANopen and EtherCAT buses.
[0061] The automated testing method includes: configuring the servo unit hardware testing environment; creating a new PDO interface variable for the bus-type servo unit in the System Manager environment of TwinCAT2.0 software and generating a .TSM system manager project file; and creating a human-machine interface and multiple automated testing function modules in the PLC Control logic programming environment of TwinCAT2.0 to realize the automated testing process.
[0062] The automated testing function modules include: a communication connection module, a servo unit information acquisition module, a test case design module, a data processing and logic judgment module, an error handling module, a table generation module, and a human-machine interface module. The communication connection module establishes a connection with the .TSM system manager by calling the library files IOF_DeviceReset and IOF_DeviceNetID in TwinCAT2. The servo unit information acquisition module acquires information such as the encoder bit depth and power of the servo drive unit. The data processing and logic judgment module reads the data sent by the servo drive unit, compares the feedback servo status words, speed, position, and following error with the expected values from the test case design module, and determines whether the servo drive unit executes according to the test cases. The error handling module records the name and content of the erroneous test case when the test case execution result fails. The error handling module transmits the error information to the table generation module, generates a test fault table, and converts it into text information easily recognizable by testers. The human-machine interface module is used to select the test cases to be executed, read the parameters of the servo drive unit, display the servo drive unit state switching process, and other test process information.
[0063] Regarding the communication connection module;
[0064] It can connect not only to servo drive units on the CANopen bus, but also to servo drive units on the EtherCAT bus.
[0065] The IOF_GetDeviceName function in the communication connection module retrieves the device name set in the .TSM system manager. If the device name is "CANopen", it confirms that the connected device is a CANopen communication device, and the communication connection port is set to hexadecimal 16#1001. If the device name is "EtherCAT", it confirms that the connected device is an EtherCAT communication device, and the communication connection port is set to decimal 1001.
[0066] The communication connection module can connect not only to single-axis bus servo drive units, but also to dual-axis and multi-axis bus servo drive units. The different communication addresses obtained indicate which servo drive units are being connected.
[0067] Regarding the servo drive unit information acquisition module;
[0068] The communication connection module can connect to servo drive units with different bus models. The information acquisition module obtains the vendor_id and product_code of different product models through Ads_Sdo_RW, and determines the type of the servo drive unit under test based on the vendor_id and product_code.
[0069] Meanwhile, the information acquisition module reads the product information of the servo drive unit through the Ads_Sdo_RW component, and decodes the read information into physical information of the servo drive unit such as encoder bit depth, servo drive unit power level, drive motor type, CCW, CW direction selection, and maximum speed of the drive motor.
[0070] Regarding the test case design module;
[0071] The system adopts a three-level directory structure, and uses an enumeration design for test items, test steps, and result judgments. This makes it easy to add or delete test cases, expand test steps, and add or delete result judgment items.
[0072] Three-level directory design: The first-level directory of test cases is divided according to the test content: PP mode, PV mode, PT mode, and HM mode. The second-level directory is divided according to the functions to be tested in the first-level directory: basic functions, HALT functions, positioning functions, limit functions, etc. The third-level directory expands on each subdirectory of the second-level directory. For example, the basic functions of PP mode are divided into: absolute position positioning, relative position positioning, etc.
[0073] The test items, test steps, and result judgments adopt an enumeration design. Taking the PP mode as an example, they are enum_test_item_pp, enum_step_act_pp, and enum_chk_Process_pp, respectively.
[0074] The test case design module automatically sets the initialization parameters for the speed-position comparison window and the position-position comparison window based on the obtained encoder information of the servo drive unit.
[0075] Regarding the data processing and logical decision-making module;
[0076] The data processing and logic determination module obtains the test steps for each test case, parses them into execution instructions (Action_item) and expected results (Check_item). The execution instructions are stored as an array in the action sequence function Test_case_steps_action and sent to the .TSM system manager. The .PRO project obtains feedback information from the servo drive unit. The data processing and logic determination module reads the expected results (Check_item) array, calls the Check_Process logic determination module, compares the feedback results from the servo drive unit with the expected results designed in the test case, and determines whether the test case execution passes.
[0077] Regarding the error handling module;
[0078] The error handling module retrieves error information returned by the Check_Process() function of the data processing and logic judgment module. When the execution result of the servo drive unit does not meet expectations, it records the detailed information of the failed test case and skips that test case to execute the next one. When the servo drive unit's settings parameters are incorrect, it stops at the test execution interface and waits for manual intervention to reset the parameters.
[0079] Regarding the table generation module;
[0080] The table generation module first initializes an empty array. When a test case returns b_err=1, it writes the test case's second-level directory name, third-level directory name, executed action, and logical judgment content into the array and transmits it to the human-machine interface module in real time to display the test failure result information.
[0081] Regarding the human-computer interface module;
[0082] The human-machine interface module displays settings information for the servo drive unit, including encoder bit depth, motor type, connection method, drive type, and direction of motion. It also displays real-time information such as the status, position, speed, and external input signals fed back by the servo drive unit. Finally, it displays the complete test case library and allows users to select specific test cases for execution.
[0083] There are many specific ways to implement this invention. The above description is only a preferred embodiment of this invention. It should be noted that for those skilled in the art, several improvements can be made without departing from the principle of this invention, and these improvements should also be considered within the scope of protection of this invention.
Claims
1. An automated testing method for a bus-type servo drive unit, characterized in that, The .TSM system manager project file and .PRO project running on the Beckhoff CXxxx series controller TwinCAT platform were used to complete the testing of the bus-type servo drive unit based on the CIA402 protocol of CANopen and EtherCAT bus. The automated testing method includes: configuring the servo unit hardware testing environment, creating a new PDO interface variable for the bus-type servo unit in the SystemManager environment of TwinCAT2.0 software, and generating a .TSM system manager project file; In the TwinCAT2.0 PLC Control logic programming environment, create a human-machine interface and multiple automated testing function modules; The multiple automated testing function modules include a communication connection module, a servo unit information acquisition module, a test case design module, a data processing and logic judgment module, an error handling module, a table generation module, and a human-machine interface module; The communication connection module calls the library files IOF_DeviceReset and IOF_DeviceNetID in TwinCAT2 to establish a connection with the .TSM system manager; The servo unit information acquisition module acquires the encoder bit depth and power of the servo drive unit; The data processing and logic judgment module reads the data sent by the servo drive unit, compares the feedback servo status word, speed, position, and following error with the expected values of the test case design module, and determines whether the servo drive unit executes according to the test case. When a test case fails to execute, the error handling module records the name of the erroneous test case and the error message. The error handling module sends the error information to the table generation module, generates a test fault table, and converts it into text information that is easy for testers to recognize. The human-machine interface module is used to select the test cases to be executed, read the parameters of the servo drive unit, display the state switching process of the servo drive unit, and other test process information; The test case design module adopts a three-level directory structure, and the test items, test steps, and result judgments are designed using an enumeration approach. The test cases are categorized by test content into PP mode, PV mode, PT mode, and HM mode. The second-level directory is divided into the following categories based on the functions that need to be tested in the first-level directory: basic functions, HALT functions, positional functions, and limit functions; the third-level directory expands upon each subdirectory of the second-level directory. The test case design module automatically sets the initialization parameters for the speed-position comparison window and the position-position comparison window based on the obtained encoder information of the servo drive unit.
2. The automated testing method for a bus-type servo drive unit according to claim 1, characterized in that, The data processing and logic judgment module obtains the test steps for each test case and parses them into the execution instruction Action_item and the expected result Check_item; The execution instructions are stored in the action sequence function Test_case_steps_action as an array and sent to the .TSM system manager; the .PRO project obtains the feedback information from the servo drive unit, the data processing and logic judgment module reads the expected result Check_item array, calls the Check_Process logic judgment module, compares the feedback result of the servo drive unit with the expected result of the test case design, and determines whether the test case execution passes.
3. The automated testing method for a bus-type servo drive unit according to claim 1, characterized in that, The automated testing method specifically includes the following steps: Determine if the communication connection is successful; if so, proceed to the next step; otherwise, manually investigate the cause of the error. Next, determine if the acquisition of axis parameters is complete; if so, proceed to the next step; otherwise, manually investigate the cause of the error. Then, initialize the axis parameters and clear the axis alarms. Determine whether to enable PP, PV, PT, and HM automated testing. If yes, proceed with the automated testing process to perform PP, PV, PT, and HM modes one by one. Otherwise, wait for the selected mode and then perform PP, PV, PT, or HM mode according to the selected mode.
4. An automated testing method for a bus-type servo drive unit according to claim 3, characterized in that, In the PP mode error handling subroutine, PV mode error handling subroutine, PT mode error handling subroutine, or HM mode error handling subroutine, the error handling module records the name of the error test case and the error content when the test case execution result fails. Then, the error handling module sends the error information to the table generation module to generate a test fault table and convert it into text information.
5. An automated testing device for a bus-type servo drive unit implementing the automated testing method according to any one of claims 1-4, characterized in that, It includes a processor for executing computer programs stored in memory.
6. A storage medium for implementing the automated testing method according to any one of claims 1-4, characterized in that, An automated test program for a bus-type servo drive unit is stored on a computer-readable storage medium. When the automated test program for the bus-type servo drive unit is executed by a processor, an automated test method for the bus-type servo drive unit is implemented.