Multi-device hot plug automatic detection and processing method based on CAN communication
Through the automatic detection and processing methods of hot-swap detection of multiple devices based on CAN communication, the problems of insufficient flexibility and cumbersome verification mechanism of hot-swap detection in the existing technology are solved, automatic detection and processing are realized, and the normal operation capability and user experience of the system are improved.
Patent Information
- Application Number
- CN202411871718.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-04-11
AI Technical Summary
The prior art has insufficient flexibility and cumbersome verification mechanisms in the hot-swap process of energy storage batteries, which affect the normal operation of the system and user experience.
The automatic detection and processing method of multiple devices based on CAN communication is adopted to obtain the serial number of the battery device through the CAN bus, sort and compare, and automatically determine the hot plug result to realize automatic detection and processing.
Improves the flexibility of hot-swap detection, reduces the cumbersome verification mechanism of battery devices during hot-swap, and ensures that the system does not re-bury the code or restarts.
Smart Images

Figure CN119806931A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic technology, and in particular to a method for automatically detecting and processing hot plugging of multiple devices based on CAN communication. Background Art
[0002] With the rapid development of science and technology, in equipment with high reliability and stability requirements such as servers and monitoring equipment, some basic power distribution units or energy storage equipment need to be replaced, expanded, maintained, etc. without affecting the normal operation of the system. Therefore, the power distribution system of some equipment with high reliability is developing towards multi-functional, high fault tolerance, uninterrupted hot-swappable replacement or parallel operation.
[0003] At present, in the process of paralleling energy storage batteries, the address information of the slave battery is usually burned into the code to manage the parallel battery, or the slave battery is detected by restarting and then managed. However, they have some defects. When the method of detecting the slave device address information embedded in the code lacks flexibility, it takes time to modify the code and burn the firmware every time the device is replaced; when the method of detecting and managing the device by turning it on and off is adopted, the frequent turning on and off will affect the battery life, and there will be delays in collecting battery data, resulting in a poor user experience.
[0004] Based on this, how to improve the flexibility of hot-swap detection and reduce the cumbersome verification mechanism of battery equipment during hot-swap without re-burning code or restarting needs to be solved urgently. Summary of the invention
[0005] The embodiment of the present application provides a method for automatic hot-plug detection and processing of multiple devices based on CAN communication, which improves the flexibility of hot-plug detection and reduces the cumbersome verification mechanism of battery devices during the hot-plug process without re-burning code or restarting.
[0006] In a first aspect, an embodiment of the present application provides a method for automatically detecting and processing hot plugging of multiple devices based on CAN communication, which is applied to a battery management device, wherein the battery management device includes: m first battery devices and a CAN bus, wherein the m first battery devices communicate through the CAN bus, where m is an integer greater than 1, and the method includes:
[0007] Acquire the serial numbers of the m first battery devices through the CAN bus to obtain m first serial numbers;
[0008] Determine a first sorting sequence according to the m first sequence numbers;
[0009] Acquire serial numbers of all battery devices in the battery management device through the CAN bus to obtain n second serial numbers; n is m+1 or n is m-1;
[0010] Determine a second sorting sequence according to the n second sequence numbers;
[0011] Comparing the first sorted sequence with the second sorted sequence to obtain a target sequence comparison result;
[0012] A target hot-plug result is determined according to the target sequence comparison result.
[0013] In a second aspect, an embodiment of the present application provides a device for automatically detecting and processing hot plugging of multiple devices based on CAN communication, which is applied to a battery management device, wherein the battery management device comprises: m first battery devices and a CAN bus, wherein the m first battery devices communicate through the CAN bus, where m is an integer greater than 1, and the device comprises:
[0014] an acquisition unit, configured to acquire the serial numbers of the m first battery devices to obtain m first serial numbers; acquire the serial numbers of all battery devices in the device to obtain n second serial numbers; n is m+1 or n is m-1;
[0015] A determination unit, configured to determine a first sorting sequence according to the m first sequence numbers; determine a second sorting sequence according to the n second sequence numbers; and determine a target hot-swap result according to the target sequence comparison result;
[0016] A control unit is used to compare the first sorting sequence with the second sorting sequence to obtain a target sequence comparison result.
[0017] In a third aspect, an embodiment of the present application provides a battery management device, comprising a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the program includes instructions for executing the steps of any method in the first aspect of the embodiment of the present application.
[0018] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute part or all of the steps described in any method of the first aspect of the embodiment of the present application.
[0019] In a fifth aspect, an embodiment of the present application provides a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute some or all of the steps described in any method of the first aspect of the embodiment of the present application. The computer program product may be a software installation package.
[0020] By implementing a method for automatically detecting and processing hot plugging of multiple devices based on CAN communication in an embodiment of the present application, the following beneficial effects are achieved:
[0021] Obtain the serial numbers of m first battery devices through the CAN bus to obtain m first serial numbers; determine the first sorting sequence according to the m first serial numbers; obtain the serial numbers of all battery devices in the battery management device through the CAN bus to obtain n second serial numbers; n is m+1 or n is m-1; determine the second sorting sequence according to the n second serial numbers; compare the first sorting sequence with the second sorting sequence to obtain the target sequence comparison result; determine the target hot plug result according to the target sequence comparison result. On the one hand, during the hot plugging process of the battery device, the battery device automatically uploads data and obtains the battery serial number on the bus, and sorts it, so as not to affect other battery devices on the bus, realizing the function of inserting and clearing data, and the whole process does not require manual intervention, thereby improving the flexibility of hot plug detection; on the other hand, the battery device only needs to upload the serial number and its own device information to the CAN bus, sort the serial number of the battery device, and verify it according to the serial number sorting information, so that the serial number and its own device information can be processed and verified faster in each battery device, thereby reducing the cumbersome verification mechanism of the device during the hot plugging process. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0023] Figure 1 It is a schematic diagram of the hardware architecture of a battery management device provided in an embodiment of the present application;
[0024] Figure 2 It is a structural schematic diagram of a battery management device provided in an embodiment of the present application;
[0025] Figure 3It is a flowchart of a method for automatically detecting and processing hot plugging of multiple devices based on CAN communication provided by an embodiment of the present application;
[0026] Figure 4 A schematic diagram of a battery device uploading to a CAN bus and sorting provided in an embodiment of the present application;
[0027] Figure 5 It is a flow chart of another method for automatic detection and processing of hot plugging of multiple devices based on CAN communication provided in an embodiment of the present application;
[0028] Figure 6 This is a functional module composition block diagram of a device for automatically detecting and processing hot-plugging of multiple devices based on CAN communication provided in an embodiment of the present application. DETAILED DESCRIPTION
[0029] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0030] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.
[0031] It should be understood that the term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article indicates that the associated objects before and after are in an "or" relationship. The "plurality" appearing in the embodiments of the present application refers to two or more.
[0032] In the embodiments of the present application, "at least one item" or similar expressions refer to any combination of these items, including any combination of single items or plural items, and refer to one or more, and multiple refers to two or more. For example, at least one item of a, b, or c can represent the following seven situations: a, b, c, a and b, a and c, b and c, a, b, and c. Among them, each of a, b, and c can be an element or a set containing one or more elements.
[0033] The "connection" that appears in the embodiments of the present application refers to various connection methods such as direct connection or indirect connection to achieve communication between devices, and the embodiments of the present application do not impose any limitations on this.
[0034] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0035] The following is an explanation of the relevant terms involved in this application, as follows:
[0036] CAN bus: Controller Area Network (CAN) bus, used to achieve communication between different electronic control units (ECUs). A CAN bus network usually includes multiple nodes, which are connected to the bus through CAN controllers and transceivers and can be transmitted in the form of differential signals.
[0037] Hot-swap: Hot-swap is also called hot replacement or hot upgrade. It allows users to remove and replace damaged hard disks, power supplies, boards, and other components without shutting down the system or cutting off the power supply, thereby improving the system's ability to recover from disasters in a timely manner, scalability, and flexibility.
[0038] To solve the above problems, an embodiment of the present application provides a method for automatic hot-plug detection and processing of multiple devices based on CAN communication, which is applied to a battery management device, wherein the battery management device includes: m first battery devices and a CAN bus, wherein the m battery devices communicate through the CAN bus, and m is an integer greater than 1, and the method includes: obtaining the serial numbers of the m first battery devices through the CAN bus to obtain m first serial numbers; determining a first sorting sequence according to the m first serial numbers; obtaining the serial numbers of all battery devices in the battery management device through the CAN bus to obtain n second serial numbers; n is m+1 or n is m-1; determining a second sorting sequence according to the n second serial numbers; comparing the first sorting sequence with the second sorting sequence to obtain a target sequence comparison result; and determining a target hot-plug result according to the target sequence comparison result. By implementing the method, the flexibility of hot-plug detection can be improved without re-burning the code or restarting, and the cumbersome verification mechanism of the device during the hot-plug process can be reduced.
[0039] Combine the following Figure 1 The hardware architecture of a battery management device in an embodiment of the present application is described. Figure 1 It is a hardware architecture diagram of a battery management device provided in an embodiment of the present application. The battery management device includes an MCU 110 , an isolator 120 , a CAN transceiver 130 , and a CAN bus peripheral circuit 140 .
[0040] Among them, MCU110 is used to control the entire circuit, and process and send the information of the battery device uploaded via the CAN bus. The information of the battery device uploaded to the CAN bus can be the voltage, current, temperature and other parameters of the battery device. At the same time, the MCU will issue an early warning prompt based on the data of the CAN bus. In addition, MCU110 includes 111 (Transmit, TX) TX pin and 112 (Receive, RX) RX pin.
[0041] The isolator 120 is used for electrical isolation to prevent interference between circuits and ensure the stability and security of data transmission on the CAN bus. In addition, the isolator 120 includes a transmit data (Transmit Data, TXD) pin 121 and a receive data (Receive Data, RXD) pin 122.
[0042] Among them, the CAN transceiver 130 is used to convert the logic level into a differential signal on the CAN bus and send and receive data. The CAN transceiver is connected to the CAN bus through the CAN high level line (CAN Hight, CAN_H), the CAN low level line (CAN Low, CAN_L) and the ground terminal GND (Ground) pin, and communicates with the isolator through the TXD pin and the RXD pin.
[0043] The CAN bus peripheral circuit is composed of CAN_H, CAN_L, a fuse 141, an NPN transistor 142, a resistor 143 and a ground terminal 144, wherein the fuse 141 is used to protect the circuit from damage caused by overload current, and the NPN transistor 142 is used to amplify the signal.
[0044] In one possible embodiment, the battery management device is connected to a group of valid hot-swappable battery devices. When the battery device is inserted, the battery management device detects the insertion of the battery device and generates a trigger signal to send to MCU110. After receiving the signal, MCU110 sends the control instruction to the isolator 120 through the TXD pin. After the isolator 120 performs electrical isolation processing, it transmits the instruction to the CAN transceiver 130 through the RXD pin. The CAN transceiver 130 converts the logic level instruction into a differential signal on the CAN bus and sends it to the CAN bus peripheral circuit through the CAN_H and CAN_L lines. In the CAN bus peripheral circuit, the fuse 141 ensures that the circuit is protected from possible overload current during operation, and the NPN transistor 142 amplifies the relevant signal to ensure the strength and stability of signal transmission. Then, the battery device sends its own serial number, capacity, health status and other device information to the CAN transceiver 130 through the CAN bus. After receiving this information, the CAN transceiver 130 converts the differential signal into a logic level signal and sends it to the isolator 120 through the RXD pin. The isolator 120 then transmits the data to the MCU110 through the TXD pin. After receiving the information of the new battery device, the MCU110 stores and processes it. If a potential risk is found in the battery module during the processing, such as overheating or low power, the MCU110 will make corresponding early warning prompts based on the data of the CAN bus, such as displaying a warning message on the device display to remind the user to handle it in time. When the battery device needs to be unplugged, the battery management device sends a signal to the MCU110, and the MCU110 will orderly stop the data interaction and control operations related to the battery module, and delete the working information of the battery device to ensure the safety and stability of the hot plug process.
[0045] It can be seen that through the hardware architecture of a battery management device in the above embodiment, data can be automatically reported and obtained when the battery device is connected and unplugged, and during the hot plugging process of the device, when the battery device is online, it will actively upload its own serial number to the CAN bus. When the battery device is offline, if the loss of the serial number is detected, it is judged that the battery device is offline, and the information bound to the serial number is deleted, and the battery device reports data. Thereby, the flexibility of the hot plug detection process is improved, and the cumbersome verification mechanism of the battery device during the hot plugging process is reduced.
[0046] Combine the following Figure 2 The battery management device in the embodiment of the present application is described. Figure 2 A schematic diagram of the structure of a battery management device provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, the battery management device 200 includes one or more processors 210, a memory 220, a communication interface 230 and one or more programs 221. The processor 210 is communicatively connected with the memory 220 and the communication interface 230 via an internal communication bus.
[0047] The processor 210 may be a central processing unit (CPU), a general purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, units and circuits described in conjunction with the disclosure of this application. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like.
[0048] Among them, the memory 220 can be a volatile memory such as a dynamic random access memory DRAM, or a non-volatile memory such as a mechanical hard disk. The above-mentioned memory 220 is used to store a set of executable program codes, and the above-mentioned processor 210 is used to call one or more programs 221 stored in the memory 220, and can execute some or all steps of the method recorded in the embodiment of the automatic detection and processing method for hot plugging of multiple devices based on CAN communication as described below. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM) or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct rambus RAM (DRRAM).
[0049] The communication interface 230 may be a transceiver, a transceiver circuit, etc., which is not limited here.
[0050] Among them, the one or more programs 221 are stored in the above-mentioned memory 220 and are configured to be executed by the above-mentioned processor 210. The one or more programs 221 include instructions for executing any step in the following embodiment of a method for automatic detection and processing of hot plugging of multiple devices based on CAN communication.
[0051] It is understood that the battery management device may include more or fewer structural elements than those in the above structural block diagram, for example, including a power module, a physical button, a Wi-Fi module, a speaker, a Bluetooth module, a sensor, a display module, etc., which are not limited here. It is understood that the battery management device may be equipped with Figure 1 The hardware architecture described.
[0052] After understanding the hardware architecture of this application, the following Figure 3 A method for automatically detecting and processing hot plugging of multiple devices based on CAN communication in an embodiment of the present application is described. Figure 3 A flow chart of a method for automatically detecting and processing hot-plugging of multiple devices based on CAN communication provided in an embodiment of the present application, the method is applied to a battery management device, the battery management device comprising: m first battery devices and a CAN bus, the m first battery devices communicate through the CAN bus, m is an integer greater than 1, and the method specifically comprises the following steps:
[0053] Step S310: Acquire the serial numbers of the m first battery devices through the CAN bus to obtain m first serial numbers.
[0054] Among them, the serial number (SN) is the unique identifier of each battery device, which is used to distinguish different battery devices. The serial number may include the production batch information of the battery device, the battery device model information, etc. The m first serial numbers obtained through the CAN bus can reflect the specific information of each battery device in the target battery management device, and provide support for the subsequent data processing and battery device management of the battery device. The serial number of each battery device can be used to track its operating status, detect abnormal conditions, and implement personalized management.
[0055] Among them, CAN bus is a communication protocol based on multi-master mechanism, which is used for data transmission between ECUs. Obtaining the serial number of the battery device through the CAN bus can ensure the real-time and reliability of data transmission and avoid system abnormalities caused by data delays or transmission errors. At the same time, by using the priority mechanism of the CAN bus, important information can be transmitted first when multiple battery devices send data at the same time, improving the stability and safety of the battery equipment. For example, when a battery device is added to the battery management device, the CAN bus will scan the serial number of the added battery device first. After the battery device is verified, the current, voltage, battery pack state of charge (State of Charge, SOC), battery pack health status (State of Health, SOH) and other information are uploaded through the CAN bus.
[0056] Specifically, after obtaining the serial number of the battery device, it can be further combined with the operating parameters of the battery device, such as battery voltage, current, temperature, SOC, SOH and other information. By combining these operating parameters, the battery device can be monitored to provide data support for subsequent battery device status assessment, fault diagnosis and safety management.
[0057] It should be noted that the acquisition of the m first serial numbers is not only the basis for subsequent data processing, but also can provide key support for the safety management of the target battery management equipment. For example, when the target battery is in an abnormal state, the abnormal battery equipment can be quickly located based on the serial number, and the specific abnormal cause can be analyzed in combination with the operating parameters. Furthermore, based on the relevant information of the serial number, targeted emergency response measures can be implemented, such as actively disconnecting the abnormal battery equipment to reduce the risk of accidents.
[0058] Step S320: determine a first sorting sequence according to the m first sequence numbers.
[0059] The first sorting sequence may be determined by sorting according to the size of each serial number, or by the time sequence of battery device access, or by the capacity of the battery device, or by SOH, which is not limited here. In a possible embodiment, the sorting priority is determined according to the serial number size of the battery device, that is, the serial numbers are arranged in ascending order.
[0060] Specifically, the process of determining the first sorting sequence can be: first, detect the serial number of the new device and upload it. When the new device is connected, its serial number will be uploaded to the CAN bus. By detecting the newly added serial number in the bus data stream, the battery management device automatically recognizes the addition of the new battery device. Then, merge the serial number of the new battery device with the currently sorted battery device serial number list to form an unsorted sequence containing all battery devices. Then, re-sort by the size of the serial number, sort the merged sequence, and finally, ensure that the new battery device and the existing device are arranged in order from small to large serial numbers. In the process of determining the first sorting sequence, it can be completed independently on the MCU of each battery device, thereby realizing decentralized processing.
[0061] It should be noted that while ensuring the accuracy of the sorting, it also supports real-time performance. After a new battery device is inserted, the existing battery device can complete the sorting update without stopping communication. In addition, if the serial number of a device is detected to be missing, it is judged that the battery device is offline, and the information of the battery device is automatically removed from the sorting sequence. At the same time, the updated sorting information is broadcast to all battery devices to ensure the dynamic consistency of the data.
[0062] Step S330, obtaining serial numbers of all battery devices in the battery management device through the CAN bus to obtain n second serial numbers; n is m+1 or n is m-1.
[0063] Where n represents the total number of all battery devices in the current battery management device. When a new battery device is added, n is m+1; when a battery device is offline or removed due to a fault, n is m-1.
[0064] Specifically, when the CAN bus uses a polling mechanism to monitor battery devices, its control unit will send request signals to each battery device in turn according to a preset order and time interval to inquire about its serial number information. After receiving the request, each battery device will feedback its own serial number to the control unit through the CAN bus. The CAN bus can also use an event trigger mechanism to detect data changes on the bus to obtain n second serial numbers. When the status of a battery device changes, such as when a new battery device is connected or a battery device is offline, a corresponding event signal will be generated, which will trigger the monitoring function of the CAN bus, allowing it to quickly obtain this change and obtain the updated serial numbers of all battery devices in a timely manner.
[0065] In a possible embodiment, when n is m+1, before acquiring the serial numbers of all battery devices in the battery management device through the CAN bus to obtain n second serial numbers, the method further includes:
[0066] 331. Obtain target sequence number format information corresponding to a target sequence number; the target sequence number is one of the n second sequence numbers except the m first sequence numbers;
[0067] 332. Determine the sequence number format information corresponding to any sequence number among the m first sequence numbers, and obtain reference sequence number format information;
[0068] 333. Compare the reference sequence number format information with the target sequence number format information to obtain a comparison result;
[0069] 334. If the comparison result meets the preset conditions, the target serial number is uploaded to the CAN bus; if the comparison result does not meet the preset conditions, an early warning prompt is issued.
[0070] The serial number format information may include the serial number length, encoding rules and value range, which are not limited here. By comparing the format information, illegal battery equipment can be prevented from accessing and the safe operation of the system can be ensured.
[0071] The target serial number is the serial number of the newly added battery device, that is, one of the n second serial numbers that does not belong to the original m first serial numbers, and its format information is obtained by detecting the serial number of the newly added battery device.
[0072] Specifically, first, in the existing battery equipment, a battery device is determined according to the established selection strategy, and the serial number is parsed to obtain the format information of its serial number, which is used as a reference standard. Then, for the target serial number of the newly added battery device, the target serial number is parsed according to the same steps to obtain the format information of the target serial number, and it is compared with the reference serial number format information. In the comparison process, according to the pre-set comparison rules, the comparison rules can be determined based on the serial number length and the serial number range, can be determined based on the character type and position rules of the serial number, or can be determined based on the check code comparison, which is not limited here. Finally, it is determined that all the format elements of the target serial number are consistent with the reference serial number format, then the system will automatically start the battery device access process, upload the target serial number to the CAN bus through a secure data transmission channel, so that it can smoothly communicate and cooperate with other battery devices in the system, and realize the hot insertion of the newly added battery device. On the contrary, if a difference in format is detected during the comparison process, the system will immediately trigger the early warning module, which will generate corresponding prompt information according to the preset early warning strategy, and pass the prompt information to the relevant operator or system management module through the CAN bus. After receiving the warning information, the operator can take targeted measures based on the prompt content, such as physically inspecting the newly added battery equipment, verifying the identity and source of the battery equipment, or further reviewing and adjusting the system's security settings to ensure that the system's security and stability are not threatened by illegal battery equipment.
[0073] In a possible embodiment, comparing the reference sequence number format information with the target sequence number format information to obtain a comparison result includes:
[0074] 3331. Obtain first battery attribute information of a target first battery device; the target first battery device is any one of the m first battery devices;
[0075] 3332. Obtain a serial number range corresponding to the first battery attribute information;
[0076] 3333. Determine the sequence number parameters in the target sequence number format information to obtain the target sequence number parameters; the target sequence number parameters include the target sequence number length and the target sequence number size;
[0077] 3334. Determine the sequence number length in the reference sequence number format information to obtain the reference sequence number length;
[0078] 3335. Determine a difference between the target sequence number length and the reference sequence number length to obtain a difference;
[0079] 3336. When the difference is 0, determine whether the target sequence number size is within the sequence number range; if the target sequence number size is within the sequence number range, determine that the comparison result meets the preset condition; if the target sequence number size is not within the sequence number range, determine that the comparison result does not meet the preset condition.
[0080] The first battery attribute information includes battery brand, battery type, voltage range, capacity information, SOC, SOH and production batch information, which are not limited here. The purpose of obtaining the first battery attribute information is to ensure that the battery device within the reference serial number range is consistent with the target battery device, which provides an important basis for the subsequent verification of the serial number format.
[0081] Among them, the key parameters in the target serial number format information and the reference serial number format information, such as length and size, are obtained by parsing the preset standards of the battery equipment when it leaves the factory. The target serial number length must be consistent with the reference serial number length to ensure the uniformity of the serial number structure, and the target serial number size must be within the reference serial number range to ensure that the serial number of the newly added battery equipment is logically reasonable and identifiable.
[0082] Specifically, the process of obtaining the target serial number parameters includes parsing the serial number of the target battery device, for example, decomposing it into multiple fields (such as production date, battery device number, batch number, etc.), and then calculating its overall length and size range. For example, for a certain type of battery device, the size range is 000001 to 999999, then the serial number of the newly added battery device must meet this rule and must not be repeated with the serial number of the existing battery device.
[0083] Specifically, when the difference is 0, that is, the length of the target serial number and the reference serial number is in compliance with the access rules of the battery management device. To determine whether the target serial number size is within the serial number range, first, compare the target serial number size with the upper and lower limits of the reference serial number range. If the target serial number size is greater than the lower limit and less than or equal to the upper limit, it is determined to meet the preset conditions; otherwise, the target serial number is deemed invalid and the system triggers an alarm prompt.
[0084] It can be seen that through the above comparison process, the newly added battery equipment can be effectively verified to ensure that it complies with the established rules when joining the battery management system, avoiding abnormal system operation due to illegal battery equipment access or serial number conflicts. Especially in the scenario of supporting hot insertion of multiple battery devices, the above comparison result is a process that meets the preset conditions, which not only improves the accuracy of battery equipment management, but also significantly enhances the safety and reliability of the system.
[0085] Step S340: determine a second sorting sequence according to the n second sequence numbers.
[0086] The second sorting sequence is a sequence obtained by sorting the n second sequence numbers according to a preset rule. The sorting rule can be flexibly set according to the needs of the target system. The purpose of sorting is to ensure that all battery devices in the system have a clear logical order relationship to facilitate subsequent battery device management and operation execution. Specifically, the sorting rule is as described in the above step S320, and the steps of determining the first sorting sequence according to the m first sequence numbers are not repeated here.
[0087] In a possible embodiment, determining the second sorting sequence according to the n second sequence numbers includes: sorting the n second sequence numbers in ascending order to obtain the second sorting sequence.
[0088] The sorting rules may be based on bubble sort, quick sort, bucket sort, etc., which are not limited here. The selection of the sorting method can be dynamically adjusted according to system resources and real-time requirements. For example, for a scenario with a small number of battery devices, bubble sort can be used to achieve simple sorting. For a large number of battery devices, quick sort or bucket sort can be used to improve sorting efficiency.
[0089] Specifically, the battery management device can adaptively select a suitable sorting algorithm based on the number of battery devices, real-time requirements, and its own computing resources. For example, bubble sort is suitable for scenarios with a small number of battery devices and high requirements for sorting stability. By comparing and exchanging the positions of the serial numbers in pairs, the sorting from small to large is finally completed; quick sort is suitable for scenarios with a large number of battery devices and the need for efficient sorting. The divide-and-conquer method is used to recursively divide the serial numbers into two groups, smaller and larger, and then sort them separately. Then, the n second serial numbers are sorted according to the adaptively selected sorting method, and finally a second sorted sequence arranged from small to large is obtained. Finally, after the sorting is completed, the battery management device may also verify the sorting results to ensure that there are no missing or duplicated serial numbers and to ensure the consistency of the sorting information.
[0090] For easier understanding, see Figure 4 , Figure 4 A schematic diagram of battery device uploading to the CAN bus and sorting is provided in an embodiment of the application. The battery device realizes data transmission through the CAN bus. Each battery device is independently connected to the CAN high level line (CAN_H) and the CAN low level line (CAN_L), thereby completing the upload and sorting operations of the serial number information.
[0091] Specifically, the figure shows five battery devices (battery 1, battery 2, battery 3, battery 4, battery 5), each of which has an independent serial number (SN), such as: the serial number of battery 1 is 000xx2, the serial number of battery 2 is 000xx10, the serial number of battery 3 is 000xx8, the serial number of battery 4 is 000xx5, and the serial number of battery 5 is 000xx3. These serial numbers are uploaded to the system via the CAN bus, and the system sorts them according to the serial numbers and generates a sorting result from the smallest to the largest serial number. For example, the sorted results are: 000xx2, 000xx3, 000xx5, 000xx8, 000xx10.
[0092] Specifically, first, each battery device uploads its corresponding serial number through the CAN bus. On the CAN bus, all devices send data in a broadcast form, and the battery management device receives it according to the upload priority and data integrity. Then, after the battery management device receives the serial numbers of all battery devices, it first performs a check to ensure that there is no omission or conflict. For example, if the serial numbers uploaded by two devices are the same, the battery management device will prompt a conflict and require re-upload. If the serial number of the uploaded device does not meet the serial number specification of the current battery management system, the battery management device issues a prompt warning. Then, the battery management device uses a predetermined sorting rule to process the received serial number data. In a possible embodiment, the sorting rule is to arrange from small to large. Through a sorting algorithm (such as quick sort or bubble sort), the battery management device arranges the serial numbers in order of size and forms a sorting result to facilitate subsequent hot plug detection and status management. In addition, the sorting result will be broadcast to all battery devices on the CAN bus, where each battery device will save the sorting sequence locally for checking the hot plug detection result and for subsequent acquisition of battery information and processing of the saved value information. This ensures that each device can acquire and process data independently, thus reflecting the decentralized effect of the battery management device.
[0093] Step S350: compare the first sorting sequence with the second sorting sequence to obtain a target sequence comparison result.
[0094] The target sequence comparison result is generated by comparing the difference or consistency between the first sorting sequence and the second sorting sequence. The first sorting sequence and the second sorting sequence represent the sorting results of two groups of data respectively.
[0095] Specifically, first, the battery management device obtains the complete data of the first sorting sequence and the second sorting sequence and verifies their validity. Then, the length of the two sequences is directly compared. Since there is a fixed difference pattern between the lengths of the two sequences, if the length of the second sequence is longer than that of the first sequence, the battery management device will focus on analyzing the position of the newly added sequence number in the sequence and its impact on the overall sorting; if the length of the second sequence is shorter than that of the first sequence, the original position of the missing sequence number will be located.
[0096] In a possible embodiment, comparing the first sorted sequence and the second sorted sequence to obtain a target sequence comparison result includes:
[0097] 351. Determine the positions of the m first battery devices in the first sorting sequence to obtain m first sorting position information;
[0098] 352. Determine the positions of the battery devices corresponding to the n second serial numbers in the second sorting sequence, and obtain n second sorting position information;
[0099] 353. Compare the m first sorting position information and the n second sorting position information to obtain a target sequence comparison result, wherein the target sequence comparison result includes a second sorting position information that is different from each first sorting position information in the m first sorting position information, or includes a first sorting position information that is different from each second sorting position information in the n second sorting position information.
[0100] Among them, when comparing the m first sorting position information and the n second sorting position information, since there is a quantitative relationship between n and m (n is m+1 or n is m-1), when n=m+1, it means that the second sorting sequence has one more battery device than the first sorting sequence. In this case, there must be a second sorting position information in the second sorting sequence that is different from all the m first sorting position information, and this different position information corresponds to the position of the newly added battery device in the second sorting sequence. For example, the first sorting sequence has 3 battery devices, and the positions are 1st, 3rd, and 5th, respectively, while the second sorting sequence has 4 battery devices, and the possible positions are 1st, 2nd, 3rd, and 5th. Here, the second position is the second sorting position information that is different from the first sorting position information. When n=m-1, the second sorting sequence has one less battery device than the first sorting sequence. At this time, there must be a first sorting position information in the first sorting sequence that is different from all the n second sorting position information, and this position information corresponds to the position of the battery device missing in the second sorting sequence in the first sorting sequence. Through this comparison, the changes of battery devices in different sorting sequences can be accurately determined, providing an important basis for subsequent battery management operations.
[0101] Specifically, first, according to the order in the first sorting sequence, the position of each first battery device is determined. Each first battery device is arranged in the first sorting sequence according to a certain rule according to its serial number or other identification features. Through this process, the battery management device can obtain the sorting position information of each first battery device. The sorting position information of each first battery device will be used as the basis for subsequent comparison to ensure that the structure and order of the first sorting sequence are effectively retained. The same process is applied to the second sorting sequence. For each corresponding battery device, its position is determined in the second sorting sequence by its serial number or other features. In this way, the system can provide accurate sorting position information for each battery device corresponding to the second sequence number. In the same way as the processing of the first sorting sequence, this process ensures the structure and order of the second sorting sequence. The battery management device will compare the obtained first sorting position information with the second sorting position information. Specifically, the comparison process compares each first sorting position information with the second sorting position information one by one to find out which positions are inconsistent. For inconsistent position information, the battery management device will mark the difference items and form the target sequence comparison result based on the difference items. The target sequence comparison result may be in two forms: The first form: If a position in the first sorting position information is inconsistent with the corresponding position in the second sorting position information, the battery management device will record the difference and include it in the target sequence comparison result. This indicates that the positions of some devices in the two sorting sequences are different and may require further analysis or adjustment. The second form: If a position in the second sorting position information is inconsistent with the corresponding position in the first sorting position information, the battery management device will also include this difference in the target sequence comparison result. This indicates that there is a sorting difference between the two, which may affect subsequent operations or require further adjustments.
[0102] See also Figure 5 , Figure 5This is a flowchart of another method for automatically detecting and processing hot-plugging multiple devices based on CAN communication provided by an embodiment of the present application. It can be seen that when a new device is connected, the new device uploads battery information with a serial number. This serial number is a unique identifier of the new battery device, which can be used to distinguish and identify the battery device in subsequent processes. Then, the remaining battery devices on the CAN bus begin to receive the serial number uploaded by the new battery device. After all battery devices receive the serial number of the new battery device, they will enter the reordering stage. In this stage, all devices are rearranged in order from small to large in the order of serial numbers. Then, the battery device sends its position in the serial number to other devices in turn according to the size of the serial number. After each battery device receives the position information sent by other devices, it will immediately compare it with the sorting information stored by itself. This comparison operation is a key link in the entire detection process. Through accurate comparison, it can be determined whether the information is wrong during the transmission process. If the comparison results match, all devices respond to the bus through. This result shows that the information interaction and verification between devices are successful, which means that the hot-plug operation of the new device is successfully completed and the entire system is in a normal working state. At this point, the system can run stably, and the new device can be seamlessly integrated into the existing battery system and work with other devices; if the comparison results do not match, it means that there are differences in the information between the devices. This difference may be due to errors in the data transmission process, such as data loss or errors caused by electromagnetic interference, or it may be due to a failure of the device itself, such as hardware failure or software error. If this happens, the battery management device will quickly take corresponding error correction measures, which may include retransmitting data, repairing erroneous data, and other operations. At the same time, the system can also issue an alarm to remind the operator to ensure the safe and stable operation of the battery system.
[0103] In a possible embodiment, when n is less than m, the method further includes:
[0104] A1. Determine a serial number among the m first serial numbers that does not exist in the n second serial numbers, and obtain a battery device corresponding to the serial number to obtain a target battery device;
[0105] A2. Delete device parameters of the target battery device, where the device parameters include at least one of the following voltage parameters and current parameters of the target battery device.
[0106] Among them, the target sequence comparison result can reflect the following situations: First, one of the m first sequence numbers is missing in the n second sequence numbers. For example, there is 000xx5 in the first sorting sequence, but not in the second sorting sequence, then this position is marked as a difference point; Second, one of the m first sequence numbers is not missing in the n second sequence numbers. For example, the first sorting sequence is [000xx2, 000xx3, 000xx5, 000xx8, 000xx10], but the second sorting sequence is [000xx2, 000xx3, 000xx9, 000xx10], then the 4th position of the second sequence 000xx9 is marked as a difference point, and the exception is uploaded.
[0107] Specifically, the first sorting sequence is generated by sorting the serial numbers of m first battery devices, and the m first sorting position information is the position index of each first battery device in the sequence. For example, if the first sorting sequence is [000xx2, 000xx3, 000xx5, 000xx8, 000xx10], the first sorting position information of the first battery device 000xx2 is 1, 000xx3 is 2, and so on. Similarly, the second sorting sequence is generated by sorting the n second serial numbers, and the n second sorting position information is the position index of each second serial number in the sequence. For example, if the second sorting sequence is [000xx2, 000xx3, 000xx8, 000xx10], the second sorting position information of the second serial number 000xx2 is 1, 000xx3 is 2, and so on. First, check in turn whether each position in the first sorting position information can find a corresponding relationship in the second sorting position information. If a position does not have a corresponding item in the second sort position information, it is marked as a difference item. In this example, the difference is indeed 000xx5. Then, the serial number 000xx5 is marked as the target battery device. Finally, all parameters of the device with serial number 000xx5 are deleted. The deleted information can be current, voltage, SOC, SOH, etc., which is not limited here.
[0108] Step S360: determining a target hot-swap result according to the target sequence comparison result.
[0109] The hot-swap results include two situations: insertable and unpluggable.
[0110] Specifically, the target sequence comparison result is used as the key basis for judging the feasibility of hot-swap behavior. When the target sequence comparison result shows that the length of the second sorting sequence is greater than the length of the first sorting sequence, it indicates that a new battery device serial number has been inserted into the battery management device. At this time, the battery management device will further conduct comprehensive detection and verification of the device corresponding to the newly added serial number. First, check whether the electrical parameters of the device are compatible with the overall electrical specifications of the system, including key indicators such as voltage and current, to ensure that the new device will not interfere with or damage the normal operation of other devices in the system after access. Secondly, verify the compatibility of the communication protocol of the new device to confirm that it can communicate with the CAN bus in the system to ensure the accuracy and stability of data transmission. If all aspects pass the test, the battery management device will determine that the hot-swap operation is "insertable" and automatically execute the corresponding device access initialization program, such as allocating system resources to the new device, updating the system configuration file, etc., and monitor the operating status of the new device in real time to ensure that it is smoothly integrated into the overall operating architecture of the battery management system. On the contrary, if the target sequence comparison result shows that the length of the second sorting sequence is smaller than the length of the first sorting sequence, this indicates that a device has been disconnected from the system. In this case, the system will first quickly confirm whether the device's disconnection is a normal hot-swap operation, rather than an accidental situation such as a device failure or abnormal power outage. The battery management device will check the various operating parameters of the device before disconnection, such as temperature, power, workload, etc., based on the preset device status monitoring mechanism, to determine whether it is in a normal removable state. If confirmed to be correct, the system will determine the hot-swap result as "removable" and start the corresponding resource recovery and system adjustment program to release the system resources occupied by the device, update the information records related to the device connection status in the system, and ensure that the system can timely and accurately reflect the current device configuration and maintain the efficient and stable operation of the system.
[0111] It can be seen that the method for automatically detecting and processing hot-plugging of multiple devices based on CAN communication provided by the embodiment of the present application first determines the incorporation of a new device or the removal of a battery device in a battery management device through hot-plugging detection of battery devices. Further, the hot-plugging operation is determined based on the hot-plugging detection result, providing a solid guarantee for the continuous and stable operation of the entire battery management system, ensuring that it can adapt to different device configuration change requirements and flexibly and efficiently respond to complex and changeable actual application scenarios. Thereby, the flexibility of the hot-plugging detection process is improved, and the cumbersome verification mechanism of the device during the hot-plugging process is reduced.
[0112] The above mainly introduces the scheme of the embodiment of the present application from the perspective of the execution process on the method side. It can be understood that in order to realize the above functions, the battery management device includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments provided in this document, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0113] The embodiment of the present application can divide the functional units of the battery management device according to the above method example. For example, each functional unit can be divided according to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. It should be noted that the division of units in the embodiment of the present application is schematic and is only a logical functional division. There may be other division methods in actual implementation.
[0114] In the case of dividing each functional module into corresponding functional modules, Figure 6 A functional module composition block diagram of a device for automatically detecting and processing hot plugging of multiple devices based on CAN communication provided in an embodiment of the present application, wherein the device 600 for automatically detecting and processing hot plugging of multiple devices based on CAN communication is applied to a battery management device, wherein the battery management device comprises: m first battery devices and a CAN bus, wherein the m first battery devices communicate via the CAN bus, wherein m is an integer greater than 1, and wherein the device comprises:
[0115] An acquiring unit 610 is configured to acquire serial numbers of the m first battery devices to obtain m first serial numbers;
[0116] A determining unit 620, configured to determine a first sorting sequence according to the m first sequence numbers;
[0117] The acquisition unit 610 is further used to acquire the serial numbers of all battery devices in the apparatus to obtain n second serial numbers; n is m+1 or n is m-1;
[0118] The determining unit 620 is further configured to determine a second sorting sequence according to the n second sequence numbers;
[0119] A control unit 630 is used to compare the first sorting sequence with the second sorting sequence to obtain a target sequence comparison result;
[0120] The determination unit 620 is further configured to determine a target hot plug result according to the target sequence comparison result.
[0121] In a possible embodiment, the control unit 630, in comparing the first sorting sequence with the second sorting sequence to obtain a target sequence comparison result, is specifically configured to:
[0122] Determine the positions of the m first battery devices in the first sorting sequence to obtain m first sorting position information;
[0123] Determine the positions of the battery devices corresponding to the n second serial numbers in the second sorting sequence to obtain n second sorting position information;
[0124] Compare the m first sorting position information and the n second sorting position information to obtain a target sequence comparison result, wherein the target sequence comparison result includes a second sorting position information different from each first sorting position information in the m first sorting position information, or includes a first sorting position information different from each second sorting position information in the n second sorting position information.
[0125] In a possible embodiment, when n is less than m, the control unit 630 is further configured to:
[0126] Determine a serial number among the m first serial numbers that does not exist in the n second serial numbers, and obtain a battery device corresponding to the serial number to obtain a target battery device;
[0127] Delete device parameters of the target battery device, where the device parameters include at least one of the following voltage parameters and current parameters of the target battery device.
[0128] In a possible embodiment, the determining unit 620, in determining the second sorting sequence according to the n second sequence numbers, is specifically configured to:
[0129] The n second sequence numbers are sorted in ascending order to obtain the second sorted sequence.
[0130] In a possible embodiment, when n is m+1, the control unit 630 obtains the serial numbers of all battery devices in the battery management device through the CAN bus to obtain n second serial numbers, and is specifically used to:
[0131] Acquire target sequence number format information corresponding to a target sequence number; the target sequence number is one of the n second sequence numbers excluding the m first sequence numbers;
[0132] Determine the serial number format information corresponding to any serial number among the m first serial numbers to obtain reference serial number format information;
[0133] Comparing the reference sequence number format information with the target sequence number format information to obtain a comparison result;
[0134] If the comparison result meets the preset conditions, the target serial number is uploaded to the CAN bus; if the comparison result does not meet the preset conditions, an early warning prompt is issued.
[0135] In a possible embodiment, the determination unit 620, in comparing the reference sequence number format information with the target sequence number format information to obtain a comparison result, is specifically configured to:
[0136] Acquire first battery attribute information of a target first battery device; the target first battery device is any one of the m first battery devices;
[0137] Obtaining a serial number range corresponding to the first battery attribute information;
[0138] Determine the sequence number parameters in the target sequence number format information to obtain the target sequence number parameters; the target sequence number parameters include the target sequence number length and the target sequence number size;
[0139] Determine the length of the sequence number in the reference sequence number format information to obtain the reference sequence number length;
[0140] Determine the difference between the target sequence number length and the reference sequence number length to obtain the difference;
[0141] When the difference is 0, determine whether the target sequence number size is within the sequence number range; if the target sequence number size is within the sequence number range, determine that the comparison result meets the preset condition; if the target sequence number size is not within the sequence number range, determine that the comparison result does not meet the preset condition.
[0142] It should be noted that the specific functional implementation of the multiple device hot plug automatic detection and processing device 600 based on CAN communication can be found in the above Figure 3The description of a method for automatically detecting and processing hot plugging of multiple devices based on CAN communication is shown, for example, the acquisition unit 610 is used to implement the relevant content of executing S310 and S330. Each unit or module in a device 600 for automatically detecting and processing hot plugging of multiple devices based on CAN communication can be respectively or completely merged into one or several other units or modules to constitute, or one (some) of the units or modules can also be further divided into multiple smaller units or modules in function to constitute, which can achieve the same operation without affecting the realization of the technical effect of the embodiment of the present invention. The above-mentioned units or modules are divided based on logical functions. In practical applications, the function of a unit (or module) is implemented by multiple units (or modules), or the function of multiple units (or modules) is implemented by one unit (or module). The specific implementation of each operation can adopt the corresponding description of the method embodiment shown above. A device 600 for automatically detecting and processing hot plugging of multiple devices based on CAN communication can be used to execute the above-mentioned method embodiment of the present application, which will not be repeated.
[0143] It can be seen that the automatic detection and processing device for hot-plugging of multiple devices based on CAN communication described in the embodiment of the present application first obtains the serial numbers of m first battery devices included in the battery management device through the CAN bus to obtain m first serial numbers, and the m first serial numbers determine the first sorting sequence, and obtains the serial numbers of all battery devices in the battery management device through the CAN bus to obtain n second serial numbers, where n is m+1 or n is m-1, and then determines the second sorting sequence according to the n second serial numbers, compares the first sorting sequence with the second sorting sequence to obtain the target sequence comparison result, and finally determines the target hot-plug result according to the target sequence comparison result. In this way, without re-burning the code or restarting, the flexibility of hot-plug detection is improved, and the cumbersome verification mechanism of the device during the hot-plugging process is reduced.
[0144] An embodiment of the present application also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute part or all of the steps of any method recorded in the above method embodiments, and the above computer includes a battery management device.
[0145] The embodiment of the present application also provides a computer program product, the computer program product includes a non-transitory computer-readable storage medium storing a computer program, the computer program is operable to cause a computer to execute some or all of the steps of any method described in the method embodiment. The computer program product may be a software installation package, and the computer includes a battery management device.
[0146] It should be noted that, for the above-mentioned various embodiments, for the sake of simple description, they are all expressed as a series of action combinations. Those skilled in the art should be aware that the present application is not limited by the described order of actions, because some steps in the embodiments of the present application can be performed in other orders or simultaneously. In addition, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions, steps, modules or units involved are not necessarily required by the embodiments of the present application.
[0147] In the above embodiments, the embodiments of the present application have different focuses on the description of each embodiment. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0148] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.
[0149] The steps of the method or algorithm described in the embodiments of the present application can be implemented in hardware or by executing software instructions by a processor. The software instructions can be composed of corresponding software modules, and the software modules can be stored in RAM, flash memory, ROM, EPROM, electrically erasable programmable read-only memory (electrically EPROM, EEPROM), registers, hard disks, mobile hard disks, read-only compact disks (CD-ROMs) or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC. In addition, the ASIC can be located in a terminal device or a management device. Of course, the processor and the storage medium can also be present in a terminal device or a management device as discrete components.
[0150] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiments of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server, or data center to another website site, computer, server, or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a digital video disc (DVD)), or a semiconductor medium (eg, a solid state disk (SSD)).
[0151] The modules / units included in the devices and products described in the above embodiments may be software modules / units or hardware modules / units, or may be partially software modules / units and partially hardware modules / units. For example, for the devices and products applied to or integrated in the chip, the modules / units included therein may all be implemented in the form of hardware such as circuits, or at least some of the modules / units may be implemented in the form of software programs, which run on the processor integrated inside the chip, and the remaining (if any) modules / units may be implemented in the form of hardware such as circuits; for the devices and products applied to or integrated in the chip module, the modules / units included therein may all be implemented in the form of hardware such as circuits, and different modules / units may be located in the same component (such as a chip, circuit module, etc.) or in different components of the chip module, or at least some of the modules / units may be implemented in the form of software programs. The software programs run on the processor integrated inside the chip, and the remaining (if any) modules / units may be implemented in the form of hardware such as circuits. It is implemented in the form of a software program, which runs on a processor integrated inside the chip module, and the remaining (if any) modules / units can be implemented in hardware such as circuits; for various devices and products applied to or integrated in the terminal equipment, the various modules / units contained therein can be implemented in hardware such as circuits, and different modules / units can be located in the same component (for example, chip, circuit module, etc.) or in different components in the terminal equipment, or, at least some modules / units can be implemented in the form of a software program, which runs on a processor integrated inside the terminal equipment, and the remaining (if any) modules / units can be implemented in hardware such as circuits.
[0152] The specific implementation methods described above further illustrate the purpose, technical solutions and beneficial effects of the embodiments of the present application. It should be understood that the above description is only the specific implementation method of the embodiments of the present application and is not intended to limit the protection scope of the embodiments of the present application. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solutions of the embodiments of the present application should be included in the protection scope of the embodiments of the present application.
Claims
1. A method for automatically detecting and processing hot plugging of multiple devices based on CAN communication, characterized in that: Applied to a battery management device, the battery management device comprises: m first battery devices and a CAN bus, the m first battery devices communicate via the CAN bus, m is an integer greater than 1, the method comprises: Acquire the serial numbers of the m first battery devices through the CAN bus to obtain m first serial numbers; Determine a first sorting sequence according to the m first sequence numbers; Acquire serial numbers of all battery devices in the battery management device through the CAN bus to obtain n second serial numbers; n is m+1 or n is m-1; Determine a second sorting sequence according to the n second sequence numbers; Comparing the first sorted sequence with the second sorted sequence to obtain a target sequence comparison result; A target hot-plug result is determined according to the target sequence comparison result.
2. The method according to claim 1, characterized in that The comparing the first sorted sequence and the second sorted sequence to obtain a target sequence comparison result includes: Determine the positions of the m first battery devices in the first sorting sequence to obtain m first sorting position information; Determine the positions of the battery devices corresponding to the n second serial numbers in the second sorting sequence to obtain n second sorting position information; Compare the m first sorting position information and the n second sorting position information to obtain a target sequence comparison result, wherein the target sequence comparison result includes a second sorting position information different from each first sorting position information in the m first sorting position information, or includes a first sorting position information different from each second sorting position information in the n second sorting position information.
3. The method according to claim 2, characterized in that When n is less than m, the method further comprises: Determine a serial number among the m first serial numbers that does not exist in the n second serial numbers, and obtain a battery device corresponding to the serial number to obtain a target battery device; Delete device parameters of the target battery device, where the device parameters include at least one of the following voltage parameters and current parameters of the target battery device.
4. The method according to any one of claims 1 to 3, characterized in that: The determining the second sorting sequence according to the n second sequence numbers comprises: The n second sequence numbers are sorted in ascending order to obtain the second sorted sequence.
5. The method according to any one of claims 1 to 3, characterized in that: When n is m+1, before acquiring the serial numbers of all battery devices in the battery management device through the CAN bus to obtain n second serial numbers, the method further includes: Acquire target sequence number format information corresponding to a target sequence number; the target sequence number is one of the n second sequence numbers excluding the m first sequence numbers; Determine the serial number format information corresponding to any serial number among the m first serial numbers to obtain reference serial number format information; Comparing the reference sequence number format information with the target sequence number format information to obtain a comparison result; If the comparison result meets the preset conditions, the target serial number is uploaded to the CAN bus; if the comparison result does not meet the preset conditions, an early warning prompt is issued.
6. The method according to claim 5, characterized in that The comparing the reference sequence number format information with the target sequence number format information to obtain a comparison result includes: Acquire first battery attribute information of a target first battery device; the target first battery device is any one of the m first battery devices; Obtaining a serial number range corresponding to the first battery attribute information; Determine the sequence number parameters in the target sequence number format information to obtain the target sequence number parameters; the target sequence number parameters include the target sequence number length and the target sequence number size; Determine the length of the sequence number in the reference sequence number format information to obtain the reference sequence number length; Determine the difference between the target sequence number length and the reference sequence number length to obtain the difference; When the difference is 0, determine whether the target sequence number size is within the sequence number range; if the target sequence number size is within the sequence number range, determine that the comparison result meets the preset condition; if the target sequence number size is not within the sequence number range, determine that the comparison result does not meet the preset condition.
7. A device for automatically detecting and processing hot plugging of multiple devices based on CAN communication, characterized in that: Applied to a battery management device, the battery management device comprises: m first battery devices and a CAN bus, the m first battery devices communicate via the CAN bus, m is an integer greater than 1, the device comprises: an acquisition unit, a determination unit, and a control unit, wherein: The acquiring unit is used to acquire the serial numbers of the m first battery devices to obtain m first serial numbers; The determining unit is used to determine a first sorting sequence according to the m first sequence numbers; The acquisition unit is further used to acquire the serial numbers of all battery devices in the device to obtain n second serial numbers; n is m+1 or n is m-1; The determining unit is further configured to determine a second sorting sequence according to the n second sequence numbers; The control unit is used to compare the first sorting sequence with the second sorting sequence to obtain a target sequence comparison result; The determining unit is further configured to determine a target hot plug result according to the target sequence comparison result.
8. The device according to claim 7, characterized in that In the aspect of comparing the first sorting sequence with the second sorting sequence to obtain a target sequence comparison result, the control unit is specifically configured to: Determine the positions of the m first battery devices in the first sorting sequence to obtain m first sorting position information; Determine the positions of the battery devices corresponding to the n second serial numbers in the second sorting sequence to obtain n second sorting position information; Compare the m first sorting position information and the n second sorting position information to obtain a target sequence comparison result, wherein the target sequence comparison result includes a second sorting position information different from each first sorting position information in the m first sorting position information, or includes a first sorting position information different from each second sorting position information in the n second sorting position information.
9. A battery management device, characterized in that: include: A processor, a memory, a communication interface, and one or more programs; The one or more programs are stored in the memory and configured to be executed by the processor, the programs comprising instructions for executing the steps in the method according to any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 6.