CN-122019374-A - QEMU-based energy storage battery management system simulation debugging method and system
Abstract
The invention discloses a QEMU-based energy storage battery management system simulation debugging method and system, and belongs to the technical field of embedded system simulation and debugging. The method comprises the steps of carrying out simulation debugging configuration based on QEMU, creating an independent QEMU virtual machine instance for each BMS node, building a virtual hardware link, building a virtual communication network consistent with the topology of a real energy storage battery management system, creating a simulation agent program, injecting simulation data and faults into the virtual communication network, starting the QEMU virtual machine instances of all BMS nodes in parallel, carrying out debugging operation through the simulation agent program, and monitoring and analyzing the simulation debugging process. The invention can flexibly simulate multi-stage BMS systems with arbitrary topology, supports each stage of BMS to operate different operating systems, can safely, conveniently and repeatedly simulate various normal and extreme test working conditions, and greatly improves test coverage rate and reliability.
Inventors
- WU JIANGWEI
- SHEN YU
- WANG DEGUAN
Assignees
- 合肥国轩高科动力能源有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20260120
Claims (10)
- 1. The energy storage battery management system simulation debugging method based on QEMU is characterized by comprising the following steps of: Based on QEMU, performing simulation debugging configuration, and creating an independent QEMU virtual machine instance for each BMS node; Virtual hardware links are built for QEMU virtual machine examples of all BMS nodes, and a virtual communication network consistent with the topology of a real energy storage battery management system is built; Creating a simulation agent program for injecting simulation data and faults into the virtual communication network; The QEMU virtual machine examples of all BMS nodes are started in parallel, and debugging operation is carried out through the simulation agent program; and monitoring and analyzing the simulation debugging process.
- 2. The QEMU-based energy storage battery management system emulation debug method of claim 1, wherein the configuration of the QEMU virtual machine instance comprises: The architecture of the CPU in the simulation was such that, Mapping the simulated memory size and address space; the simulated peripheral device is provided with a display, And, designating a running operating system image for each QEMU virtual machine instance.
- 3. The QEMU-based energy storage battery management system emulation debug method of claim 2, wherein the emulated peripheral comprises: the CAN controller is used for simulating CAN bus communication between the BMS nodes of each level and between the BMS nodes and external equipment; The SPI/I2C controller is used for simulating communication between the BMS main control chip, the AFE acquisition chip and the EEPROM slave equipment; The general purpose input/output port GPIO is used for simulating switching value and indicating lamps; The analog-digital converter ADC is used for inputting analog voltage and temperature analog signals; and the Ethernet controller is used for carrying out network communication or debugging.
- 4. The QEMU-based energy storage battery management system simulation debugging method of claim 1, wherein the building a virtual hardware link for the QEMU virtual machine instance of each BMS node comprises: And the virtual network function provided by the QEMU is used for connecting the simulation peripheral equipment of each independent QEMU virtual machine instance to construct a virtual communication network consistent with the topology of the real energy storage battery management system.
- 5. The QEMU-based energy storage battery management system emulation debug method of claim 1, wherein the emulation agent is configured to implement: Simulating AFE behavior, namely injecting simulated battery cell voltage and temperature sensor data into a QEMU virtual machine instance representing a battery monitoring unit CMU; simulating faults, namely dynamically injecting abnormal working conditions; And simulating load and environment change, namely dynamically adjusting the injected analog quantity data according to the charge-discharge curve.
- 6. The QEMU-based energy storage battery management system emulation debug method of claim 5, wherein said abnormal conditions include communication interruption, signal timeout, sensor value overrun, short circuit and open circuit.
- 7. The QEMU-based energy storage battery management system emulation debug method of claim 5, wherein the emulation agent interacts with QEMU virtual machine instances of the designated BMS node through a qtest protocol or custom virtual device model of the QEMU.
- 8. The QEMU-based energy storage battery management system simulation debugging method of claim 1, wherein the monitoring and analyzing the simulation debugging process comprises: In the simulation debugging process, monitoring communication messages of all BMS nodes on a virtual CAN bus, recording and analyzing BMS behaviors, and verifying logic correctness and fault tolerance of each level of BMS software.
- 9. The QEMU-based energy storage battery management system simulation debugging method of claim 8, wherein in the simulation debugging process, all QEMU virtual machine instances share a clock source of a host, so as to realize cross-node synchronization, and the host is a host for deploying QEMU virtual machine instances.
- 10. Energy storage battery management system emulation debugging system based on QEMU, characterized by comprising: the configuration management module is used for creating and loading configuration files of each level of BMS nodes describing the multi-level BMS architecture, wherein the configuration files refer to configuration files of QEMU virtual machine instances created for each BMS node; The QEMU virtual machine cluster consists of a plurality of QEMU processes started according to configuration files, and each process simulates a BMS node; Virtual network exchanger, which is a virtual communication network realized by QEMU internal network function and connected with the simulation peripheral equipment of QEMU virtual machine instance of all BMS nodes through CAN bus; the simulation agent and injection module is used for running a simulation agent program on the host computer and is responsible for injecting simulation data and faults into the QEMU virtual machine cluster; a debugger integration interface, which is to provide a standard connection interface for an external debugger; And the monitoring and analyzing module is used for monitoring and analyzing the simulation debugging process.
Description
QEMU-based energy storage battery management system simulation debugging method and system Technical Field The invention relates to the technical field of embedded system simulation and debugging, in particular to a QEMU-based energy storage battery management system simulation and debugging method and system. Background An energy storage Battery Management System (BMS) is a core component for guaranteeing safe, stable and efficient operation of a battery. Modern large energy storage systems typically employ multi-level distributed architecture, such as complex structures of "Master-Slave" (or "top manager (TBMU) -Battery Management Unit (BMU) -battery monitoring unit (CMU)". In the development of such systems, the following challenges are faced: 1. the hardware dependence is strong, and the traditional debugging is seriously dependent on a real BMS hardware circuit board (such as an MCU-based controller, an AFE analog front end acquisition chip and the like). Hardware damage and iterative changes can greatly affect software development and debugging progress. 2. Multistage inter-debugging is difficult because in a multistage architecture, each BMS may run different operating systems, such as FreeRTOS, linux, RT-Thread, etc., and need to work cooperatively. The cost of building a complete multistage debugging environment on real hardware is high, the connection is complex, and a specific fault scene is not easy to reproduce. 3. Insufficient test coverage is that the test of extreme and abnormal working conditions (such as battery overvoltage, short circuit, communication interruption and the like) is at risk, real hardware is easy to damage, and many test cases are difficult to execute or have no repeatability. In the prior art, although some single-chip simulators (such as JTAG and ICE) exist, the single-chip simulators can only be debugged aiming at a single board, and interaction and complicated hardware abnormality of the whole multi-stage system cannot be simulated. QEMU, as a generic open source machine simulator, although usable to simulate a single board environment, lacks a dedicated simulation debug solution for multi-level BMS architecture. Thus, there is an urgent need for an emulation debug scheme that can be removed from specific hardware limitations, is efficient, safe, and can cover multi-level BMS systems. Disclosure of Invention The invention aims to overcome the defects of the prior art and provides a QEMU-based energy storage battery management system simulation debugging method and system. The method can efficiently simulate the hardware environment of the multi-level BMS, support different operating systems, and realize convenient, safe and comprehensive system level debugging and testing. In order to achieve the above purpose, the invention adopts the following technical scheme: the invention provides a QEMU-based energy storage battery management system simulation debugging method, which comprises the following steps: Based on QEMU, performing simulation debugging configuration, and creating an independent QEMU virtual machine instance for each BMS node; Virtual hardware links are built for QEMU virtual machine examples of all BMS nodes, and a virtual communication network consistent with the topology of a real energy storage battery management system is built; Creating a simulation agent program for injecting simulation data and faults into the virtual communication network; The QEMU virtual machine examples of all BMS nodes are started in parallel, and debugging operation is carried out through the simulation agent program; and monitoring and analyzing the simulation debugging process. According to the technical scheme, the multi-stage BMS system which flexibly simulates any topology is realized based on the QEMU, real BMS hardware is not needed, development and debugging cost is greatly reduced, and development period is quickened. Preferably, the configuration of the QEMU virtual machine instance includes: The architecture of the CPU in the simulation was such that, Mapping the simulated memory size and address space; the simulated peripheral device is provided with a display, And, designating a running operating system image for each QEMU virtual machine instance. According to the technical scheme, through QEMU virtual machine instance configuration, each level of nodes of the BMS are virtualized into independent QEMU virtual machine instances, and simulation of the BMS is achieved based on software. Preferably, the emulated peripheral device includes: the CAN controller is used for simulating CAN bus communication between the BMS nodes of each level and between the BMS nodes and external equipment; The SPI/I2C controller is used for simulating communication between the BMS main control chip, the AFE acquisition chip and the EEPROM slave equipment; The general purpose input/output port GPIO is used for simulating switching value and indicating lamps; The analog-digital converter