Instrument control method based on CANoe
By inserting the CAPL test module into the CANoe tool and loading the instrument control function DLL, the problems of low testing efficiency, poor safety, and difficulty in data recording in the bench test of automotive electronic controllers were solved, realizing the automated control of the instrument and data recording, and improving testing efficiency and safety.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- UNITED AUTOMOTIVE ELECTRONICS SYST
- Filing Date
- 2023-10-12
- Publication Date
- 2026-07-14
AI Technical Summary
Existing bench tests for automotive electronic controllers suffer from problems such as low testing efficiency, poor safety, inconvenient operation, and difficulty in data recording. In particular, it is difficult to achieve automated control of the instrument when using the CANoe tool.
By inserting the CAPL test module into the CANoe tool, loading general or specific instrument control function DLLs, using SCPI instructions and function functions to control the instrument, and virtualizing it onto the simulation bus, the automated control and data recording of the instrument can be achieved.
It enables convenient control of instruments within the CANoe tool, improving testing efficiency and safety, solving the problems of data recording and inter-instrument communication, and supporting multiple communication methods and dynamic expansion functions.
Smart Images

Figure CN117452846B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of automotive electronic controller technology, specifically a CANoe-based instrument control method. Background Technology
[0002] With the rapid development of the automotive industry, ensuring the high reliability and safety requirements of automotive electronic controllers, as one of the core components of automobiles, is a pressing issue for parts suppliers. To guarantee the high reliability of automotive electronic controllers, bench testing is an essential and time-consuming part of the safety testing process.
[0003] However, many problems exist in current bench testing of automotive electronic controller products:
[0004] Question 1: When using equipment such as high-voltage DC power supply, low-voltage DC power supply, high-voltage AC power supply, and electronic loads to simulate the actual working conditions of a vehicle, most test engineers still use the primitive method of manually controlling the instruments. This is not only inefficient but also prone to misoperation that could lead to safety issues.
[0005] Question 2: When using measuring instruments such as oscilloscopes and multimeters, most test engineers can only record test data by recording key data, and cannot record complete test data. Therefore, multiple tests are required to obtain sufficient data. This method not only affects the efficiency of testing, but also seriously affects the validity of test results.
[0006] Question 3: A small number of testers replace traditional manual testing methods by developing their own instrumentation and control software. However, bench tests often involve multiple tools, such as the bus testing tool CANoe. This results in testers having to operate multiple tools frequently, which is extremely inconvenient. Furthermore, the data recorded by multiple tools is difficult to align with the same time base, leading to difficulties in data analysis.
[0007] Question 4: CANoe is a practical and very powerful bus development tool, but how to implement instrument control functions within it is a rather tricky problem.
[0008] Therefore, it is necessary to design an instrument control method based on CANoe to solve the above problems. Summary of the Invention
[0009] The purpose of this invention is to overcome the shortcomings of the prior art and provide an instrument control method based on CANoe, which enables testers to easily control the instrument in the CANoe tool and conveniently apply the corresponding functions to complete the automated control of the instrument in the entire bench test in conjunction with other bus test steps.
[0010] To achieve the above objectives, this invention provides an instrument control method based on CANoe, comprising the following steps: Step 1, in the CANoe tool, inserting a corresponding number of CAPL test modules onto the simulation bus according to the number of instruments controlled in the test scenario; Step 2, in the CAPL scripts of each inserted CAPL test module, selecting to load either a general instrument control function DLL that can be recognized by the CAPL script or a specific instrument-specific function DLL that can be recognized by the CAPL script. If a general instrument control function DLL is selected, proceed to Step 3; if a specific instrument-specific function DLL is selected, proceed to Step 4. Step 3: In the CAPL script of the CAPL test module, find the corresponding SCPI command based on the function of the instrument used in the test, send the SCPI command to control the instrument using the function provided by the general instrument control function DLL, and read the instrument's measurement data; Step 4: In the CAPL script of the CAPL test module, select the function provided by the specific instrument equipment dedicated function DLL to control the instrument based on the function of the instrument used in the test, and read the instrument's measurement data; Step 5: Virtualize each instrument on the CANoe simulation bus, and complete the entire automated instrument control process in the bench test in conjunction with the other bus test steps according to the actual test requirements.
[0011] Optionally, step 6 is also included, which involves analyzing the data automatically recorded by the CANoe tool during the instrument automation control process and summarizing the test results.
[0012] Optionally, in step 2, when a specific instrument-specific function DLL can cover all instruments, the specific instrument-specific function DLL is selected to be loaded; when the specific instrument-specific function DLL cannot cover all instruments, the general instrument control function DLL is selected to be loaded.
[0013] Optionally, the development of the general instrument control function DLL that can be recognized by CAPL scripts includes the following steps: Step 1a, in Visual Studio software, create a CAPL dynamic link library generation project according to the syntax agreed upon by the CAPL language of the CANoe tool; Step 2a, in the created CAPL dynamic link library generation project, load the VISA instrument library for instrument programming and the WS2_32 network library for network programming under the Windows system; Step 3a, in the created CAPL dynamic link library generation project, according to the specifications agreed upon by the CAPL language of the CANoe tool and the custom rules defined in actual applications, encapsulate the functions provided by the VISA instrument library and the WS2_32 network library into general instrument control functions that can be recognized by the CAPL language; Step 4a, after encapsulation, run the CAPL dynamic link library generation project, and finally compile to obtain a general instrument control function DLL that can be directly used in the CAPL scripts of the CANoe tool.
[0014] Optionally, the development of the instrument-specific function DLL that can be recognized by CAPL scripts includes the following steps: Step 1b, in Visual Studio software, create a CAPL dynamic link library generation project according to the syntax agreed upon by the CAPL language of the CANoe tool; Step 2b, in the created CAPL dynamic link library generation project, load the VISA instrument library for instrument programming and the WS2_32 network library for network programming under the Windows system; Step 3b, according to the needs of encapsulating various instrument functions, organize the corresponding SCPI instruction sets; Step 4b, in the created CAPL dynamic link library generation project, according to the specifications agreed upon by the CAPL language of the CANoe tool, use the functions provided by the VISA instrument library and the WS2_32 network library to encapsulate the SCPI instruction sets into function functions provided by the instrument-specific function DLL; Step 5b, after encapsulation, run the CAPL dynamic link library generation project, and finally compile to obtain the instrument-specific function DLL that can be directly used in the CAPL script of the CANoe tool.
[0015] Optionally, the result of loading the general instrument control function DLL includes the VISA general instrument control function and / or the TCP general instrument control function.
[0016] Optionally, the VISA general instrument control functions include the VISA_OpenDefaultRM function to open the VISA Explorer, the VISA_ConnectInstrument function to establish an instrument VISA connection, the VISA_ClearInstrument function to clear the instrument device, the VISA_DisconnectInstrument function to disconnect the instrument VISA connection, the VISA_CloseDefaultRM function to close the VISA Explorer, the VISA_Send function to send data, the VISA_Read function to read data, the VISA_ExecuteCommand function to execute commands and check data, and the VISA_Query function to query data.
[0017] Optionally, the general TCP instrument control functions include the TCP_ConnectInstrument function for establishing an instrument TCP connection, the TCP_DisConnectInstrument function for disconnecting an instrument TCP connection, the TCP_Send function for sending data, the TCP_Read function for reading data, the TCP_ExecuteCommand function for executing commands and checking data, and the TCP_Query function for querying data.
[0018] Optionally, the loading of specific instrument-specific function DLLs includes VISA-specific instrument-specific function functions and / or TCP-specific instrument-specific function functions.
[0019] Optionally, VISA-specific instrument-specific function functions are instrument function functions that are independently encapsulated in the CAPL DLL project using the VISA instrument library according to actual testing needs, following the development steps of a VISA-specific instrument-specific function DLL.
[0020] Optionally, TCP-specific instrument-specific function functions are instrument function functions that are independently encapsulated using the WS2_32 network library in the CAPL DLL project according to actual testing requirements, following the development steps of a DLL for specific instrument-specific function functions.
[0021] Compared with existing technologies, this invention, based on the CAPL language conventions of the CANoe tool, utilizes an instrument control dynamic link library (DLL) developed externally that can be recognized by the CANoe tool's CAPL scripts. This allows testers to easily control instruments within the CANoe tool and integrate instrument control with other bus testing steps to achieve a complete automated testing process. Simultaneously, it also solves problems related to data recording, inter-instrument communication, and dynamic expansion of instrument equipment. Attached Figure Description
[0022] Figure 1 This is a flowchart of the instrument control method based on CANoe according to the present invention.
[0023] Figure 2 This is a flowchart illustrating the development steps of the universal instrument control function DLL that can be recognized by CAPL scripts according to the present invention.
[0024] Figure 3 This is a flowchart illustrating the development steps of a DLL containing specific instrument and equipment functions that can be recognized by CAPL scripts, according to the present invention. Implementation
[0025] The present invention will now be further described with reference to the accompanying drawings.
[0026] See Figure 1 This invention is an instrument control method based on CANoe, comprising the following steps:
[0027] Step 1: In the CANoe tool, insert the corresponding number of CAPL test modules on the simulation bus according to the number of instruments controlled in the test scenario.
[0028] In actual testing, different test scenarios often require different instruments. For example, in the bench testing of CharCon products, the instruments required include a high-voltage DC power supply, a high-voltage AC power supply, multiple low-voltage DC power supplies, and a low-voltage electronic load; in the bench testing of PEU products, the instruments required include a low-voltage power supply, a high-voltage power supply, a multimeter, an oscilloscope, a waveform recorder, and a signal generator.
[0029] Step 2: In the CAPL scripts of each inserted CAPL test module, select to load either a general instrument control function DLL that can be recognized by the CAPL script or a specific instrument-specific function DLL that can be recognized by the CAPL script. If you select to load a general instrument control function DLL, proceed to Step 3. If you select to load a specific instrument-specific function DLL, proceed to Step 4.
[0030] In actual testing, a dedicated function DLL for a specific instrument may not cover all instruments. When the dedicated function DLL can cover all instruments, select to load the dedicated function DLL. When the dedicated function DLL cannot cover all instruments, select to load the general instrument control function DLL.
[0031] Step 3: In the CAPL script of the CAPL test module, find the corresponding SCPI command according to the function of the instrument used in the test, send the SCPI command to control the instrument by using the function provided by the general instrument control function DLL, and read the measurement data of the instrument to realize the control of the instrument and the recording of measurement data.
[0032] The test requires the use of instrument functions, such as: setting voltage protection, setting voltage, setting current, measuring voltage, measuring current, measuring power, power output, and power shutdown. These functions have corresponding SCPI commands. By sending the SCPI command corresponding to the function to be used to the instrument, the instrument can be controlled.
[0033] Step 4: In the CAPL script of the CAPL test module, select the function provided by the specific instrument-specific function DLL according to the function of the instrument used in the test to control the instrument and read the measurement data of the instrument, so as to realize the control of the instrument and the recording of measurement data.
[0034] The test requires the use of instrument functions, such as: setting voltage protection, setting voltage, setting current, measuring voltage, measuring current, measuring power, power output, and power shutdown. These functions have corresponding functions in the dedicated function DLL of specific instruments and equipment. There is no need to look up the corresponding SCPI instructions. The instrument can be controlled through the function.
[0035] Step 5: Virtualize each instrument onto the CANoe simulation bus, and complete the instrument automation control process in the entire bench test in conjunction with the other bus test steps according to the actual test requirements.
[0036] Step 6: Analyze the data automatically recorded by the CANoe tool during the instrument automation control process and summarize the test results.
[0037] See Figure 2 The development of a general-purpose instrument control function DLL that can be recognized by CAPL scripts includes the following steps:
[0038] Step 1a: In Visual Studio, create a CAPL dynamic link library generation project according to the syntax of the CAPL language conventions in the CANoe tool.
[0039] The syntax of the CAPL language is defined by the CANoe tool itself, and only general instrument control function DLLs generated according to this syntax can be recognized by the CAPL language of the CANoe tool.
[0040] Step 2a: In the CAPL dynamic link library generation project, load the VISA instrument library for instrument programming and the WS2_32 network library for network programming under the Windows system.
[0041] Step 3a: In the created CAPL dynamic link library generation project, according to the CAPL language conventions of the CANoe tool and the custom rules defined in actual applications, encapsulate the functions provided by the VISA instrument library and the WS2_32 network library into general instrument control functions that can be recognized by the CAPL language.
[0042] In practical applications, custom rules refer to rules for extracting general instrument control functions based on actual instrument control scenarios, i.e., how to cover all instrument control scenarios.
[0043] Step 4a: After encapsulation, run the CAPL dynamic link library to generate the project, and finally compile to obtain a general instrument control function DLL that can be directly used in the CAPL script of the CANoe tool.
[0044] See Figure 3 The development of a DLL containing specific instrument-specific function calls that can be recognized by CAPL scripts includes the following steps:
[0045] Step 1b: In Visual Studio, create a CAPL dynamic link library generation project according to the syntax of the CAPL language conventions in the CANoe tool.
[0046] The syntax of the CAPL language is defined by the CANoe tool itself. Only DLLs of specific instrument and equipment functions generated according to this syntax can be recognized by the CAPL language of the CANoe tool.
[0047] Step 2b: In the CAPL dynamic link library generation project, load the VISA instrument library for instrument programming and the WS2_32 network library for network programming under the Windows system.
[0048] Step 3b: Based on the required encapsulated instrument functions, compile the corresponding SCPI instruction sets.
[0049] Step 4b: In the created CAPL dynamic link library generation project, according to the CAPL language conventions of the CANoe tool, use the functions provided by the VISA instrument library and WS2_32 network library to encapsulate the SCPI instruction set into the function functions provided by the DLL for specific instrument equipment.
[0050] Step 5b: After encapsulation, run the CAPL dynamic link library to generate the project, and finally compile it to obtain a DLL of specific instrument-specific function functions that can be directly used in the CAPL script of the CANoe tool.
[0051] Loading the generic instrument control function DLL results in the VISA generic instrument control function and / or TCP generic instrument control function.
[0052] VISA general instrument control functions include: VISA_OpenDefaultRM (opens the VISA Resource Manager, used to initialize the VISA Resource Manager and obtain its ID); VISA_ConnectInstrument (establishes a VISA connection with a specified instrument); VISA_ClearInstrument (clears an instrument's data using the VISA driver); VISA_DisconnectInstrument (disconnects a specified instrument's VISA connection); VISA_CloseDefaultRM (closes the VISA Resource Manager); VISA_Send (sends commands to the instrument using the VISA driver); VISA_Read (reads data from the instrument using the VISA driver); VISA_ExecuteCommand (executes commands and checks data), and VISA_Query (sends commands to the instrument using the VISA driver and checks if the returned result matches the expected result); and VISA_Query (sends commands to the instrument using the VISA driver and reads the returned data).
[0053] The general TCP instrument control functions include: TCP_ConnectInstrument (establishes an instrument TCP connection): used to establish a TCP socket communication connection with a specified instrument; TCP_DisConnectInstrument (disconnects an instrument TCP connection): used to disconnect a TCP socket communication connection with a specified instrument; TCP_Send (sends data): used to send commands to the instrument using TCP sockets; TCP_Read (reads data): used to read data sent by the instrument using TCP sockets; TCP_ExecuteCommand (executes commands and checks data): used to send commands to the instrument using TCP sockets and determine whether the actual returned result matches the expected result; and TCP_Query (queries data): used to send commands to the instrument using TCP sockets and read the data returned by the instrument.
[0054] The VISA general instrument control functions and the TCP general instrument control functions are developed based on the VISA instrument library and the WS2_32 network library, respectively. In practice, the appropriate function should be selected based on the specific situation. When the computer has the VISA driver installed, the developer can choose the VISA general instrument control functions for instrument control; when the computer does not have the VISA driver installed but the instrument supports TCP socket communication, the developer can choose the TCP general instrument control functions.
[0055] Loading DLLs for specific instrument and equipment functions results in VISA-specific and / or TCP-specific instrument and equipment functions.
[0056] VISA-specific instrument and device-specific function is based on Figure 3 The development steps for a DLL with specific instrument and equipment functions are shown. In the CAPL DLL project, instrument function functions encapsulated by the VISA instrument library are used according to actual testing requirements.
[0057] TCP-specific instrument and equipment dedicated function is based on Figure 3 The development steps for a DLL with specific instrument and equipment functions are shown. In the CAPL DLL project, instrument function functions are encapsulated using the WS2_32 network library according to actual testing requirements.
[0058] The VISA-specific instrument and equipment-specific function and the TCP-specific instrument and equipment-specific function are developed based on the VISA instrument library and the WS2_32 network library, respectively. In actual use, the appropriate function needs to be selected based on the actual situation. The specific selection rules are the same as those for the aforementioned general instrument control function DLL.
[0059] This invention, based on the CAPL language conventions of the CANoe tool, utilizes an instrument control dynamic link library (DLL) developed externally that can be recognized by the CANoe tool's CAPL scripts. This allows testers to easily control instruments within the CANoe tool and integrate instrument control with other bus testing steps to achieve a complete automated testing process. Simultaneously, it solves problems related to data recording, inter-instrument communication, and dynamic instrument expansion: all measurement data can be completely recorded in the CANoe tool, and data playback is supported; all instrument control communication methods are supported, including USB, serial, Ethernet, and GPIB communication, and Ethernet communication is supported even without a VISA driver; testers can dynamically expand instrument control functions in C++ or CAPL scripts according to actual needs.
Claims
1. An instrument control method based on CANoe, characterized in that: The process includes the following steps: Step 1: In the CANoe tool, insert the corresponding number of CAPL test modules onto the simulation bus according to the number of instruments controlled in the test scenario; Step 2: In the CAPL script of each inserted CAPL test module, select to load either a general instrument control function DLL that can be recognized by the CAPL script or a specific instrument-specific function DLL that can be recognized by the CAPL script. If a general instrument control function DLL is selected, proceed to Step 3; if a specific instrument-specific function DLL is selected, proceed to Step 4; Step 3: In the CAPL script of the CAPL test module, find the corresponding SCPI instruction according to the function of the instrument used in the test, send the SCPI instruction to control the instrument using the function provided by the general instrument control function DLL, and read the instrument's measurement data; Step 4: In the CAPL script of the CAPL test module, select the function provided by the specific instrument-specific function DLL according to the function of the instrument used in the test to control the instrument and read the instrument's measurement data; Step 5: Virtualize each instrument onto the CANoe simulation bus, and complete the entire automated instrument control process in the bench test in conjunction with the other bus test steps according to the actual test requirements.
2. The instrument control method based on CANoe according to claim 1, characterized in that: It also includes step 6, which analyzes the data automatically recorded by the CANoe tool during the instrument automation control process and summarizes the test results.
3. The instrument control method based on CANoe according to claim 1, characterized in that: In step 2, when a specific instrument-specific function DLL can cover all instruments, the specific instrument-specific function DLL is selected to be loaded; when the specific instrument-specific function DLL cannot cover all instruments, the general instrument control function DLL is selected to be loaded.
4. The instrument control method based on CANoe according to claim 1, characterized in that: The development of the general instrument control function DLL that can be recognized by CAPL scripts includes the following steps: Step 1a, in Visual Studio software, create a CAPL dynamic link library generation project according to the syntax of the CAPL language convention of the CANoe tool; Step 2a: In the CAPL dynamic link library generation project, load the VISA instrument library for instrument programming and the WS2_32 network library for network programming under the Windows system. Step 3a: In the created CAPL dynamic link library generation project, according to the specifications of the CAPL language in the CANoe tool and the custom rules defined in actual applications, encapsulate the functions provided by the VISA instrument library and the WS2_32 network library into general instrument control functions that can be recognized by the CAPL language; Step 4a: After encapsulation, run the CAPL dynamic link library generation project, and finally compile to obtain a general instrument control function DLL that can be directly used in the CAPL script of the CANoe tool.
5. The instrument control method based on CANoe according to claim 1, characterized in that: The development of the instrument-specific function DLL that can be recognized by CAPL scripts includes the following steps: Step 1b, in Visual Studio software, create a CAPL dynamic link library generation project according to the syntax agreed upon by the CAPL language of the CANoe tool; Step 2b, in the created CAPL dynamic link library generation project, load the VISA instrument library for instrument programming and the WS2_32 network library for network programming under the Windows system; Step 3b, according to the needs of encapsulating various instrument functions, organize the corresponding SCPI instruction sets; Step 4b, in the created CAPL dynamic link library generation project, according to the specifications agreed upon by the CAPL language of the CANoe tool, use the functions provided by the VISA instrument library and the WS2_32 network library to encapsulate the SCPI instruction sets into function functions provided by the instrument-specific function DLL; Step 5b, after encapsulation, run the CAPL dynamic link library generation project, and finally compile to obtain the instrument-specific function DLL that can be directly used in the CAPL script of the CANoe tool.
6. The instrument control method based on CANoe according to claim 1, characterized in that: The loading of the general instrument control function DLL results includes the VISA general instrument control function and / or the TCP general instrument control function.
7. The instrument control method based on CANoe according to claim 6, characterized in that: The aforementioned VISA general instrument control functions include: VISA_OpenDefaultRM (opens VISA Explorer), VISA_ConnectInstrument (establishes instrument VISA connection), VISA_ClearInstrument (clears instrument device), VISA_DisconnectInstrument (disconnects instrument VISA connection), VISA_CloseDefaultRM (closes VISA Explorer), VISA_Send (sends data), VISA_Read (reads data), VISA_ExecuteCommand (executes command and checks data), and VISA_Query (queries data).
8. The instrument control method based on CANoe according to claim 6, characterized in that: The general TCP instrument control functions include TCP_ConnectInstrument (establishing an instrument TCP connection), TCP_DisConnectInstrument (disconnecting an instrument TCP connection), TCP_Send (sending data), TCP_Read (reading data), TCP_ExecuteCommand (executing commands and checking data), and TCP_Query (querying data).
9. The instrument control method based on CANoe according to claim 1, characterized in that: The loading of specific instrument-specific function DLLs includes VISA-specific instrument-specific function functions and / or TCP-specific instrument-specific function functions.
10. A CANoe-based instrument control method according to claim 5 or 9, characterized in that: VISA-specific instrument function is an instrument function that is independently encapsulated in the VISA instrument library within the CAPL DLL project according to actual testing needs, following the development steps of a VISA-specific instrument function DLL.
11. A CANoe-based instrument control method according to claim 5 or 9, characterized in that: TCP-specific instrument-specific function functions are instrument function functions that are independently encapsulated using the WS2_32 network library in the CAPL DLL project according to actual testing requirements, following the development steps of a DLL for specific instrument-specific functions.