Virtual rack construction method, electronic equipment and storage medium

By constructing a virtual test bench and simulating bus signals and hardwired signals, the problem of insufficient hardware test bench resources was solved, and efficient concurrent testing of vehicle-side application software was achieved.

CN121009023APending Publication Date: 2025-11-25ZHEJIANG GEELY HLDG GRP CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511230247.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-29
Publication Date
2025-11-25

AI Technical Summary

Technical Problem

When performing a large number of concurrent tests on vehicle-side application software, insufficient hardware test bench resources affect testing efficiency.

Method used

By constructing a virtual test bench and using bus signal simulation and hardwired signal simulation, the virtual nodes, electrical components and connection circuits of the vehicle control system are simulated, the connection between the virtual controller and the virtual test bench is realized, and a large number of concurrent tests are carried out.

Benefits of technology

It eliminates the need for hardware test benches, improving the testing efficiency of vehicle-side application software and enabling easy reuse and efficient testing of virtual test benches.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121009023A_ABST
    Figure CN121009023A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a virtual rack construction method, electronic equipment and a storage medium, and the method comprises the steps: configuring a virtual node, and constructing a bus network of a virtual rack based on the virtual node; virtual electrical elements and virtual connection circuits among the virtual electrical elements are constructed, and the virtual rack is formed by the bus network, the virtual electrical elements and the virtual connection circuits; and constructing a connection interface, wherein the virtual rack is connected with a virtual controller through the connection interface. According to the embodiment of the invention, the virtual rack is constructed through bus signal simulation and hardwire signal simulation, and the vehicle-end application software can carry out a large number of concurrent tests based on the virtual rack, so that the test efficiency is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of vehicle software testing technology, and in particular to a virtual test bench construction method, electronic device and storage medium. Background Technology

[0002] With the development of vehicle technology, vehicle control is becoming increasingly intelligent. To enhance competitiveness, vehicle manufacturers have developed various vehicle-side application software for vehicle control, such as body control software and intelligent driving software. After the vehicle-side application software is developed, it usually needs to undergo relevant functional testing on a vehicle test bench to ensure it can function properly. However, when conducting a large number of concurrent tests on the vehicle-side application software, there may be insufficient hardware test bench resources, thus affecting the testing efficiency of the vehicle-side application software. Summary of the Invention

[0003] In view of the above, it is necessary to provide a virtual test bench construction method, electronic device and storage medium to solve the problem that insufficient hardware test bench resources affect the testing efficiency of vehicle application software when performing a large number of concurrent tests.

[0004] In a first aspect, embodiments of this application provide a virtual test bench construction method, applied to electronic devices, the method comprising: Configure virtual nodes, and build a bus network for the virtual rack based on the virtual nodes; Construct virtual electrical components and virtual connection circuits between the virtual electrical components, wherein the bus network, the virtual electrical components, and the virtual connection circuits form the virtual test bench; A connection interface is constructed, through which the virtual platform connects to the virtual controller.

[0005] In one possible implementation, the virtual node includes the virtual rack, the virtual controller, and the electronic device; configuring the virtual node includes: Start the virtual test bench software platform and load the virtual controller and bus communication matrix; Assign at least one of the sender and receiver of bus messages defined in the bus communication matrix to the virtual node; Configure the sending period and conditions of the bus messages of the virtual node, as well as the generation and receiving logic of the bus signals of the virtual node.

[0006] In one possible implementation, the construction of the bus network for the virtual rack based on the virtual nodes includes: The bus network is constructed based on the bus communication matrix and the configuration of the virtual nodes; Simulate the physical layer characteristics and protocol layer behavior of the bus.

[0007] In one possible implementation, the virtual electrical components include virtual sensors, virtual actuators, virtual loads, and virtual switches, and the construction of the virtual electrical components includes: The virtual sensor is constructed by converting the physical quantities sensed by the sensor into electrical signals, and by simulating the electrical characteristics and output signals of the sensor. The virtual actuator is constructed by converting the electrical signals received by the actuator into physical actions and simulating the electrical characteristics of the actuator. The virtual load is constructed by simulating the power consumption characteristics and reverse action of the load. The virtual switch is constructed by simulating the state transition and contact characteristics of the switch.

[0008] In one possible implementation, constructing the connection circuit between the virtual electrical components includes: Define the connection topology between the virtual electrical components; A parametric model of the wiring harness connecting the virtual electrical components is established based on the connection topology. A virtual connection circuit between the virtual electrical components is generated based on the connection topology and the parameter model of the wiring harness.

[0009] In one possible implementation, the method further includes: Circuit open-circuit simulation is performed by simulating open circuit faults between wire harnesses.

[0010] In one possible implementation, the construction of the connection interface includes: Simulate I / O interfaces using global variables or shared memory. Simulate a bus interface using message queues, pipes, or sockets.

[0011] In one possible implementation, the method further includes: A precise time protocol and a time synchronization unit are used to synchronize the clocks of the virtual controller and the virtual test bench, so that the clock error between the virtual controller and the virtual test bench is within a preset time range.

[0012] Secondly, embodiments of this application provide an electronic device, the electronic device including a memory and a processor: wherein the memory is used to store program instructions; the processor is used to read and execute the program instructions stored in the memory, and when the program instructions are executed by the processor, the electronic device performs the above-described virtual test bench construction method.

[0013] Thirdly, embodiments of this application provide a computer storage medium storing program instructions that, when executed on an electronic device, cause the processor of the electronic device to perform the aforementioned virtual test bench construction method.

[0014] The virtual test bench construction method, electronic device, and storage medium provided in this application construct a virtual test bench through bus signal simulation and hard-wired signal simulation. The virtual test bench is easy to reuse, enabling vehicle-side application software to perform a large number of concurrent tests based on the virtual test bench without relying on a hardware test bench, thus effectively improving the testing efficiency of vehicle-side application software. Attached Figure Description

[0015] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0016] Figure 1 This is a flowchart of a virtual test bench construction method provided in an embodiment of this application.

[0017] Figure 2 This is a schematic diagram of the application environment of the virtual test bench construction method provided in one embodiment of this application.

[0018] Figure 3 This is a schematic diagram of the structure of a virtual rig construction device provided in an embodiment of this application.

[0019] Figure 4 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0020] The terms "first" and "second" used in the embodiments of this application are for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more features. In the description of the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.

[0021] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains. The terminology used in this application's specification is for the purpose of describing particular embodiments only and is not intended to limit the application. It should be understood that, unless otherwise stated, " / " in this application means "or". For example, A / B can mean A or B. "And / or" in this application is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. "At least one" refers to one or more. "More than one" refers to two or more. For example, at least one of a, b, or c can represent: a, b, c, a and b, a and c, b and c, and a, b, and c. Where there is no conflict, the following embodiments and features described herein can be combined with each other.

[0022] With the development of vehicle technology, vehicle control is becoming increasingly intelligent. To enhance competitiveness, vehicle manufacturers have developed various vehicle-side application software for vehicle control, such as body control software and intelligent driving software. After the vehicle-side application software is developed, relevant functional tests are usually performed on the vehicle to ensure normal operation. However, when conducting a large number of concurrent tests on the vehicle-side application software, there may be insufficient hardware test bench resources, thus affecting the testing efficiency of the vehicle-side application software.

[0023] For example, after vehicle body application software based on the AUTOSAR CP (Automotive Open System Architecture Classic Platform) architecture is developed on an x86 system, its implemented functions need to be tested according to functional requirements. Hardware-in-the-loop testing (HIL) requires waiting for the hardware to mature. However, the testable time from the first version delivery of the application software to actual vehicle mass production is very limited, and there is a problem of insufficient hardware test bench resources when conducting a large number of concurrent tests. Therefore, testing methods that are not limited by controller hardware and hardware testing environments are needed to conduct comprehensive testing of functional coverage as early as possible to ensure software quality. However, the demand for hardware test benches is high during large-scale testing, and there may be a shortage of hardware test bench resources, thus affecting the testing efficiency of the vehicle-side application software.

[0024] To address the above issues, this application provides a virtual test bench construction method. The virtual test bench is constructed using bus signal simulation and hardwired signal simulation. The virtual test bench is easily reusable, enabling vehicle-side application software to undergo extensive concurrent testing without relying on a hardware test bench, thus effectively improving the testing efficiency of vehicle-side application software.

[0025] AUTOSAR is a collaborative development framework for vehicle electronic systems, involving global automakers, component suppliers, and various research and service organizations. It establishes an open standard software architecture for vehicle control units (ECUs). AutoSAR comprises three layers: ASW (Application Software Layer), RTE (Runtime Environment), and BSW (Basic Software Layer). To ensure independence between layers, each layer typically only uses the interfaces provided by the layer below it and provides corresponding interfaces to the layer above it. This layered architecture is key to achieving hardware-software separation, freeing developers of vehicle embedded system control software from the dependence on hardware systems inherent in traditional ECU software development and verification.

[0026] The application software layer contains several SWCs (Software Components), which interact with each other through interfaces (Ports). Each software component can contain one or more Runnable Entities (REs), which encapsulate the relevant control algorithms and can be triggered by RTE events. An SWC file can be a .c file (source code written in C).

[0027] The runtime environment (RTE) acts as a bridge between the application software layer and the basic software layer, enabling hardware-software separation. The RTE facilitates communication between software components, between basic software layers, and between software components and basic software. The basic software layer contains multiple basic software modules responsible for non-application-related functions of the ECU. One of the most important functions of the basic software is communication between ECUs, i.e., signal interaction. The basic software layer can be divided into four layers: the Services Layer, the ECU Abstraction Layer, the Microcontroller Abstraction Layer (MCAL), and Complex Drivers. The MCAL is a special layer that unifies different hardware interfaces. The Microcontroller Abstraction Layer encapsulates the hardware, preventing upper-layer software from directly manipulating the microcontroller's registers. Middleware is a type of software that sits between the application system and the system software. It uses the basic services or functions provided by the system software to connect various parts of the application system or different applications on the network, achieving resource sharing and function sharing.

[0028] See Figure 1The diagram shown is a flowchart of a virtual test bench construction method provided in an embodiment of this application. The virtual test bench construction method is applied to an electronic device and includes: S101, configure virtual nodes, and build a bus network for virtual racks based on virtual nodes.

[0029] See Figure 2 The diagram illustrates the application environment of a virtual controller testing method provided in one embodiment of this application. In one embodiment, both the virtual controller and the virtual test bench are software modules running in an electronic device. The virtual controller includes virtual peripherals, a virtual driver layer, a hardware abstraction layer (MCAL), a basic software layer (BSW), a runtime environment (RTE), and an application software layer (ASW). The virtual peripherals simulate various hardware interfaces on the virtual controller (ECU), such as the Serial Peripheral Interface (SPI), microcontroller functional unit pins, and general-purpose input / output ports. The virtual driver layer is used to simulate software drivers. The hardware abstraction layer is used to standardize the software layer accessing the underlying virtual hardware. The basic software layer includes general-purpose software components such as an operating system, communication protocol stack, storage management, and diagnostic services. The runtime environment is middleware between the application software layer and the basic software layer, used to perform data exchange and task scheduling. The application software layer includes at least one vehicle-side software, which is the software under test, i.e., the core logic software running on the ECU to implement specific vehicle functions. For example, vehicle-side software includes seat temperature control software, door control software, autonomous driving control software, and air conditioning control software. A virtual test bench can include a vehicle model (PlantModel) and a monitoring tool (controldesk). The vehicle model is the target object model that the vehicle-side software operates on; for example, a vehicle model could be a seat temperature control model, a door control model, an air conditioning control model, or a vehicle motion model. The monitoring tool is used to design, manage, and monitor the vehicle model and provide a visual interface.

[0030] In one embodiment of this application, the electronic device acts as a host computer, providing a test script transfer layer, a virtual hardware transfer module, and a virtual bus signal simulation module through test software. The test script transfer layer includes an electrical interface connection layer and a bus interface connection layer. The electrical interface connection layer connects to the virtual hardware transfer module to simulate the IO signal transmission channel for transmitting electrical signals from actuators, such as sensors or motors. The bus interface connection layer connects to the virtual bus signal simulation module to simulate the bus message transmission channel for transmitting bus messages, such as CAN, LIN, FlexRay, and automotive Ethernet. Both the electrical interface connection layer and the bus interface connection layer provide input simulation and output feedback. Through input simulation, analog signals (voltage, PWM wave, switch state, etc.) can be actively set as inputs to the virtual controller, while simultaneously monitoring the output signals emitted by the virtual controller and the virtual test bench via IO or the bus.

[0031] In one embodiment of this application, the virtual node includes a virtual test bench, a virtual controller, and an electronic device. During the testing of the virtual controller, the electronic device sends test signals to the virtual controller through preset test software. The virtual controller sends control signals to the virtual test bench, and the virtual test bench responds to the control signals by performing corresponding actions and generating response signals.

[0032] In one embodiment of this application, bus signal simulation of a virtual test bench is performed. The virtual test bench software platform is started, and the virtual controller and bus communication matrix are loaded. The bus communication matrix is ​​a database or specification document that defines all communication signals exchanged between all electronic control units connected to the same bus network (such as CAN, LIN, FlexRay, Ethernet, etc.) and their precise attributes. For example, attributes include the ID, name, length, sender, and period / event type of all messages; the start bit, length, byte order, scaling factor, offset, unit, value range, and receiver of each signal in the message data field; and the conversion relationship between signal values ​​and physical quantities.

[0033] In one embodiment of this application, at least one of a sender and a receiver for bus messages defined in a bus communication matrix is ​​assigned to the virtual node. The sending period and conditions for the bus messages of the virtual node are set, and the generation and receiving logic of the bus signals of the virtual node are configured. For example, the sending conditions may include receiving a specific signal, a change in an internal state, or the occurrence of a simulation event. The generation logic of the bus signals can be a constant value, generated based on a mathematical formula, generated based on a lookup table, based on physical model output, or dynamically injected from a test script or automation framework. The receiving processing logic is configured to determine how the virtual test bench handles the received messages and signals, such as updating the internal state, triggering calculations, ignoring, or recording.

[0034] In one embodiment of this application, a bus network is constructed based on the configuration of a bus communication matrix and virtual nodes to simulate the characteristics of the bus physical layer and the behavior of the protocol layer. For example, the characteristics of the bus physical layer may include baud rate, sampling point location, signal propagation delay, and termination resistor matching. The behavior of the bus protocol layer may include message arbitration, error detection and handling, frame format, and network management.

[0035] S102, construct virtual electrical components and virtual connection circuits between virtual electrical components, and the bus network, virtual electrical components and virtual connection circuits form a virtual test bench.

[0036] In one embodiment of this application, hard-wired signal simulation of a virtual test bench is performed. Virtual electrical components include, but are not limited to, virtual sensors, virtual actuators, virtual loads, and virtual switches. Specifically, a virtual sensor is constructed by converting the physical quantities sensed by the sensor into electrical signals and simulating the electrical characteristics and output signals of the sensor; for example, a virtual sensor may be a temperature sensor. A virtual actuator is constructed by converting the electrical signals received by the actuator into physical actions and simulating the electrical characteristics of the actuator; for example, a virtual actuator may be a heating resistance wire. A virtual load is constructed by simulating the energy consumption characteristics and reverse action of the load. A virtual switch is constructed by simulating the state transitions and contact characteristics of the switch.

[0037] In one embodiment of this application, a connection topology between virtual electrical components is defined, a parametric model of the wiring harnesses connecting the virtual electrical components is established based on the connection topology, and a virtual connection circuit between the virtual electrical components is generated based on the connection topology and the parametric model of the wiring harnesses. The connection topology refers to the wiring harness connection relationship between the virtual electrical components. The parameters of the wiring harnesses may include resistance, inductance, capacitance, coupling coefficient, etc., and the parametric model may be a calculation formula for each parameter.

[0038] In one embodiment of this application, open circuit simulation can also be performed by simulating open circuit faults between wire harnesses, thereby reducing the risk of faults, verifying fault diagnosis capabilities, and improving the safety and robustness of the virtual test bench.

[0039] S103, Build the connection interface, the virtual bench connects to the virtual controller through the connection interface.

[0040] In one embodiment of this application, the connection interface includes, but is not limited to, I / O interfaces and bus interfaces. I / O interfaces are simulated using global variables or shared memory. Taking global variables as an example, a shared data structure is defined, including I / O signals sent from the virtual controller to the virtual test bench, I / O signals sent from the virtual test bench to the virtual controller, bidirectional signals, synchronous counters, etc., and a global shared instance is created, including virtual controller thread functions and virtual test bench thread functions. By executing the virtual controller thread function, sensor data is obtained from the shared area, a control algorithm is executed on the sensor data, and control commands are output. By executing the virtual test bench thread function, control commands are obtained from the shared area, physical model calculations are performed, and sensor data is output.

[0041] In one embodiment of this application, a bus interface is simulated using message queues, pipes, or sockets. Taking message queues as an example, the structure of bus messages for the virtual controller and the virtual rig, as well as the message queues, are defined. Bus messages are sent by the virtual controller thread and the virtual rig thread based on their respective message queues.

[0042] In one embodiment of this application, the method further includes: synchronizing the clocks of the virtual controller and the virtual test bench using a precision time protocol and a time synchronization unit, such that the clock error between the virtual controller and the virtual test bench is within a preset duration range. For example, the preset duration range is 0.5-1ms. For example, the precision time protocol is PTP, and by deploying PTP master-slave clocks in the virtual controller and the virtual test bench, the virtual controller and the virtual test bench periodically calibrate their local clocks through the time synchronization unit.

[0043] In one embodiment of this application, the constructed virtual test bench can reuse the test scripts of the hardware-in-the-loop test system. The reused test scripts include hardware-related system variables and bus-related signals, thereby reducing the duplication of script development.

[0044] The above embodiments of this application construct a virtual test bench through bus signal simulation and hard-wired signal simulation. The virtual test bench is easy to reuse, enabling vehicle-side application software to perform a large number of concurrent tests based on the virtual test bench without relying on a hardware test bench, thus effectively improving the testing efficiency of vehicle-side application software.

[0045] See Figure 3 The diagram shown is a structural schematic of a virtual rig construction apparatus provided in one embodiment of this application. In one embodiment of this application, the virtual rig construction apparatus 200 may include multiple functional modules composed of computer program segments. The computer program segments in the virtual rig construction apparatus 200 may be stored in the memory of an electronic device and executed by at least one processor to perform the virtual rig construction function.

[0046] In one embodiment of this application, the virtual rig construction device 200 can be divided into multiple functional modules according to the functions it performs. The functional modules of the virtual rig construction device 200 may include: a first construction module 201, a second construction module 202, and a third construction module 203. In this embodiment, a module refers to a series of computer program segments that can be executed by at least one processor and perform a fixed function, and which are stored in memory.

[0047] The first building module 201 is used to configure virtual nodes and build a bus network for the virtual bench based on the virtual nodes.

[0048] The second building module 202 constructs virtual electrical components and virtual connection circuits between virtual electrical components. The bus network, virtual electrical components, and virtual connection circuits form a virtual test bench.

[0049] The third building module 203 builds the connection interface, through which the virtual platform connects to the virtual controller.

[0050] This application embodiment also provides an electronic device 10, which may be a mobile phone, tablet computer, desktop computer, laptop computer, handheld computer, notebook computer, ultra-mobile personal computer (UMPC), netbook, as well as cellular phone, personal digital assistant (PDA), augmented reality (AR) device, virtual reality (VR) device, artificial intelligence (AI) device, wearable device, in-vehicle device, smart home device and / or smart city device. This application embodiment does not impose any special restrictions on the specific type of electronic device 10.

[0051] See Figure 4 The diagram shown is a hardware structure schematic of an electronic device provided in an embodiment of this application. The virtual test bench construction method provided in this application embodiment is applied to an electronic device 10, which includes, but is not limited to, a processor 110 and a memory 120 connected via a communication bus 130. Figure 4 This is merely an example of an electronic device and does not constitute a limitation thereof. In other embodiments, the electronic device may include more components than those shown in the figure.

[0052] The memory 120 may include one or more random access memory (RAM) and one or more non-volatile memory (NVM). The RAM can be directly read and written by the processor 110 and can be used to store executable programs (such as machine instructions) of the operating system or other running programs, as well as user and application data. The RAM may include static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), etc.

[0053] Non-volatile memory can also store executable programs and user and application data, and can be pre-loaded into random access memory for direct reading and writing by the processor 110. Non-volatile memory can include disk storage devices and flash memory.

[0054] The memory 120 is used to store one or more computer programs. The one or more computer programs are configured to be executed by the processor 110. The one or more computer programs include a plurality of instructions that, when executed by the processor 110, enable a virtual benchtop construction method to be executed on the electronic device 10.

[0055] In other embodiments, the electronic device 10 further includes an external memory interface for connecting to an external memory to expand the storage capacity of the electronic device 10.

[0056] Processor 110 may include one or more processing units, such as an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). These different processing units may be independent devices or integrated into one or more processors.

[0057] The processor 110 provides computing and control capabilities; for example, the processor 110 is used to execute computer programs stored in the memory 120 to implement the virtual rig construction method described above.

[0058] The communication bus 130 is used to provide a channel for communication between the memory 120 and the processor 110 in the electronic device 10.

[0059] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 10. In other embodiments of this application, the electronic device 10 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0060] This application also provides a computer storage medium storing computer instructions. When the computer instructions are executed on the electronic device 10, the electronic device 10 performs the above-mentioned related method steps to implement the virtual rig construction method in the above embodiments.

[0061] This application also provides a computer program product that, when run on a computer, causes the computer to perform the aforementioned steps to implement the virtual test bench construction method described in the above embodiments.

[0062] In addition, embodiments of this application also provide an apparatus, which may specifically be a chip, component or module. The apparatus may include a connected processor and a memory; wherein the memory is used to store computer execution instructions, and when the apparatus is running, the processor may execute the computer execution instructions stored in the memory to cause the chip to execute the virtual test bench construction method in the above method embodiments.

[0063] In this application, the electronic devices, computer storage media, computer program products or chips provided in the embodiments are all used to execute the corresponding methods provided above. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding methods provided above, and will not be repeated here.

[0064] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0065] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0066] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units; that is, it can be located in one place or distributed in multiple different locations. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0067] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0068] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts or all or part of the technical solutions that contribute to the prior art, can be embodied in the form of a software product. The software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0069] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application and are not intended to limit it. Although this application has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of this application without departing from the spirit and scope of the technical solutions of this application.

Claims

1. A method for constructing a virtual test bench, applied to electronic devices, characterized in that, The method includes: Configure virtual nodes, and build a bus network for the virtual rack based on the virtual nodes; Construct virtual electrical components and virtual connection circuits between the virtual electrical components, wherein the bus network, the virtual electrical components, and the virtual connection circuits form the virtual test bench; A connection interface is constructed, through which the virtual platform connects to the virtual controller.

2. The virtual test bench construction method as described in claim 1, characterized in that, The virtual node includes the virtual rack, the virtual controller, and the electronic device. Configuring the virtual node includes: Start the virtual test bench software platform and load the virtual controller and bus communication matrix; Assign at least one of the sender and receiver of bus messages defined in the bus communication matrix to the virtual node; Configure the sending period and conditions of the bus messages of the virtual node, as well as the generation and receiving logic of the bus signals of the virtual node.

3. The virtual test bench construction method as described in claim 2, characterized in that, The bus network for constructing the virtual rack based on the virtual nodes includes: The bus network is constructed based on the bus communication matrix and the configuration of the virtual nodes; Simulate the physical layer characteristics and protocol layer behavior of the bus.

4. The virtual test bench construction method as described in claim 1, characterized in that, The virtual electrical components include virtual sensors, virtual actuators, virtual loads, and virtual switches. Constructing these virtual electrical components includes: The virtual sensor is constructed by converting the physical quantities sensed by the sensor into electrical signals, and by simulating the electrical characteristics and output signals of the sensor. The virtual actuator is constructed by converting the electrical signals received by the actuator into physical actions and simulating the electrical characteristics of the actuator. The virtual load is constructed by simulating the power consumption characteristics and reverse action of the load. The virtual switch is constructed by simulating the state transition and contact characteristics of the switch.

5. The virtual test bench construction method as described in claim 4, characterized in that, The construction of the connection circuit between the virtual electrical components includes: Define the connection topology between the virtual electrical components; A parametric model of the wiring harness connecting the virtual electrical components is established based on the connection topology. A virtual connection circuit between the virtual electrical components is generated based on the connection topology and the parameter model of the wiring harness.

6. The virtual test bench construction method as described in claim 5, characterized in that, The method further includes: Circuit open-circuit simulation is performed by simulating open circuit faults between wire harnesses.

7. The virtual test bench construction method as described in claim 1, characterized in that, The construction of the connection interface includes: Simulate I / O interfaces using global variables or shared memory. Simulate a bus interface using message queues, pipes, or sockets.

8. The virtual test bench construction method as described in claim 1, characterized in that, The method further includes: A precise time protocol and a time synchronization unit are used to synchronize the clocks of the virtual controller and the virtual test bench, so that the clock error between the virtual controller and the virtual test bench is within a preset time range.

9. An electronic device, characterized in that, The electronic device includes a memory and a processor: The memory is used to store program instructions; The processor is configured to read and execute the program instructions stored in the memory, and when the program instructions are executed by the processor, cause the electronic device to perform the virtual rig construction method as described in any one of claims 1 to 8.

10. A computer storage medium, characterized in that, The computer storage medium stores program instructions that, when executed on the electronic device, cause the processor of the electronic device to perform the virtual rig construction method as described in any one of claims 1 to 8.