Address management method and device, electronic equipment and computer readable storage medium
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TCL AIR CONDITIONER ZHONGSHAN CO LTD
- Filing Date
- 2026-03-05
- Publication Date
- 2026-06-16
Smart Images

Figure CN122226752A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of device management technology, specifically to an address management method, apparatus, electronic device, and computer-readable storage medium. Background Technology
[0002] In distributed device networks, such as building automation and industrial IoT systems, assigning globally unique network addresses to a massive number of terminal devices is the foundation for reliable system operation.
[0003] Traditional methods often rely on manual static allocation or simple automatic increment strategies, which have problems such as low address configuration efficiency and easy conflicts. This makes maintenance work cumbersome and prone to errors when replacing equipment or expanding the system. Summary of the Invention
[0004] This application provides an address management method, apparatus, electronic device, and computer-readable storage medium. By introducing a deterministic conflict resolution mechanism that generates new addresses based on conflicting device identification information, it can effectively ensure the global uniqueness of address allocation for devices in complex network environments.
[0005] In a first aspect, embodiments of this application provide an address management method, including: Obtain the first address of the target device; Address conflict detection is performed on the first address, and when the first address is detected as a conflicting address, the first device identification information of the conflicting device is obtained; the conflicting device is a device that has an address conflict with the target device; Based on the first device identification information and the first address, a second address of the target device is generated; The second address is assigned to the target device.
[0006] In one embodiment, prior to obtaining the first address of the target device, the process includes: Obtain the location information of the target device and the identification information of the second device; The first address is generated based on the location information and the second device identification information.
[0007] In one embodiment, generating the first address based on the location information and the second device identification information includes: Based on the location information, location encoding information is generated; Perform a hash operation on the location encoding information to obtain the target hash value; The first address is generated based on the target hash value and the second device identification information.
[0008] In one embodiment, generating the first address based on the target hash value and the second device identification information includes: Extract the first identifier from the target hash value; Extract the second identifier from the second device identification information; The first address is obtained by combining the first identifier and the second identifier.
[0009] In one embodiment, generating the second address based on the first device identification information and the first address includes: Based on the first device identification information and the second device identification information of the target device, a conflict resolution identifier is generated; The second address is generated based on the conflict resolution identifier and the first address.
[0010] In one embodiment, generating a conflict resolution identifier based on the first device identification information and the second device identification information of the target device includes: Perform arithmetic or logical operations on the first device identification information and the second device identification information to obtain the target value; The target value is moduloed to obtain the conflict resolution identifier.
[0011] In one embodiment, after allocating the second address to the target device, the method further includes: The second address is determined as the object attribute value in the device model defined by the target communication protocol; Based on the object attribute values, generate the object identifier of the target device; Based on the object attribute values and the object identifier, generate a configuration file in the target format; Based on the configuration file, the target device is registered to a communication gateway based on the target communication protocol.
[0012] Secondly, embodiments of this application provide an address management device, the device comprising: The address acquisition module is used to obtain the first address of the target device; The information acquisition module is used to perform address conflict detection on the first address, and when the first address is detected to be a conflicting address, acquire the first device identification information of the conflicting device; the conflicting device is a device that has an address conflict with the target device; The address generation module is used to generate a second address based on the first device identification information and the first address; The address allocation module is used to allocate the second address to the target device.
[0013] In one embodiment, the address acquisition module includes: The identification information acquisition submodule is used to acquire the location information of the target device and the second device identification information; The first address generation submodule is used to generate the first address based on the location information and the second device identification information.
[0014] In one embodiment, the first address generation submodule includes: A location encoding unit is used to generate location encoding information based on the location information; A hash operation unit is used to perform a hash operation on the location encoding information to obtain a target hash value; The address generation unit is used to generate the first address based on the target hash value and the second device identification information.
[0015] In one embodiment, the address generation unit includes: The first extraction subunit is used to extract the first identifier from the target hash value; The second extraction subunit is used to extract the second identifier from the second device identification information; The address generation subunit is used to combine the first identifier and the second identifier to obtain the first address.
[0016] In one embodiment, the address generation module includes: The identifier generation submodule is used to generate a conflict resolution identifier based on the first device identification information and the second device identification information of the target device; The second address generation submodule is used to generate the second address based on the conflict resolution identifier and the first address.
[0017] In one embodiment, the identifier generation submodule includes: The first arithmetic unit is used to perform arithmetic or logical operations on the first device identification information and the second device identification information to obtain the target value. The second arithmetic unit is used to perform a modulo operation on the target value to obtain the conflict resolution identifier.
[0018] In one embodiment, the address management device further includes: The object attribute value determination module is used to determine the second address as the object attribute value in the device model defined by the target communication protocol; An object identifier generation module is used to generate an object identifier for the target device based on the object attribute values; The configuration file generation module is used to generate a configuration file in the target format based on the object attribute values and the object identifier; The device registration module is used to register the target device to a communication gateway based on the target communication protocol, based on the configuration file.
[0019] Thirdly, embodiments of this application also provide an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the steps in the address management method described above.
[0020] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in the address management method described above.
[0021] Fifthly, embodiments of this application also provide a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various optional implementations described in the embodiments of this application.
[0022] In summary, in this embodiment, by performing address conflict detection on the first address of the target device, and obtaining the first device identifier information of the conflicting device when the first address is detected as a conflicting address, a second address of the target device can be generated based on the first device identifier information and the first address, and the second address can be assigned to the target device. This effectively ensures the global uniqueness of address allocation for devices in complex network environments, fundamentally preventing system communication disruptions caused by address conflicts, and thus effectively improving the reliability of address management. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 This is a flowchart illustrating an embodiment of the address management method provided in this application; Figure 2 This is a schematic diagram of a specific embodiment of generating a first address provided in this application; Figure 3This is a schematic diagram illustrating a specific embodiment of generating a second address provided in this application; Figure 4 This is a schematic diagram of a specific embodiment of the registration target device provided in this application; Figure 5 This is a schematic diagram of the structure of an address management device provided in an embodiment of this application; Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0025] The technical solutions of this application will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of the present invention, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0026] It should be noted that in scenarios such as intelligent buildings and smart factories, thousands of devices that require network control are deployed (such as air conditioning indoor units, lighting terminals, and sensors). Before these devices are connected to the control system, they must be assigned a unique identifier within the network, namely, a device address.
[0027] In related technologies, address management faces the following main challenges: First, manual configuration relies heavily on engineer experience, making it prone to address duplication during large-scale deployments, leading to communication conflicts and system failures. Statistics show that the address conflict rate for manual configuration can exceed 15%. Second, static address allocation mechanisms are rigid. When a device fails and needs replacement, the new device cannot inherit the network identifier of the original device. This necessitates manual reconfiguration of all logical points and scenario policies associated with that device in the control system, resulting in high maintenance costs and a high risk of legacy errors. Third, existing automatic addressing schemes often use random numbers or simple timestamps to avoid conflicts, leading to potential address changes after each power-on or redeployment, which is detrimental to system state persistence and fault diagnosis. Finally, many professional communication protocols (such as BACnet and Modbus) do not define a comprehensive automatic address allocation mechanism in their standards. Forcibly extending these mechanisms requires firmware upgrades to existing gateways and controllers, making compatibility and promotion costs significant obstacles.
[0028] To address the problems of low efficiency and frequent conflicts in current device address configuration, this application aims to provide an address management method. After obtaining the first address of the target device, address conflict detection is performed on the first address. When a conflicting address is detected, the first device identifier information of the conflicting device is obtained. Based on the first device identifier information and the first address, a second address of the target device can be generated and assigned to the target device. This effectively ensures the global uniqueness of address allocation for devices in complex network environments, fundamentally preventing system communication disruptions caused by address conflicts, and thus effectively improving the reliability of address management and the efficiency of subsequent maintenance.
[0029] The following sections provide detailed descriptions of each example. It should be noted that the order in which the embodiments are described is not intended to limit the priority of the embodiments.
[0030] Figure 1 The illustration shows a schematic flowchart of an address management method according to an embodiment of this application. The entity executing the address management method can be an address management device, which can be integrated into any electronic device with address management, network communication, and program execution functions. The electronic device can be a server or a terminal, etc.
[0031] The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, network acceleration services (Content Delivery Network, CDN), as well as big data and artificial intelligence platforms.
[0032] The terminal may be a system main controller, protocol gateway, central management platform, or controller with protocol stack processing capabilities, but is not limited to these. The terminal and server can be connected directly or indirectly through wired or wireless communication, and this application does not impose any restrictions.
[0033] Furthermore, in the embodiments of this application, "multiple" refers to two or more. The terms "first" and "second," etc., in the embodiments of this application are used for distinguishing descriptions and should not be construed as implying relative importance.
[0034] The following sections provide detailed descriptions of each example. It should be noted that the order in which the embodiments are described is not intended to limit the preferred order of the embodiments.
[0035] Reference Figure 1 The diagram shows a flowchart of an address management method according to this application. The method may specifically include steps S101 to S104, as follows: S101: Obtain the first address of the target device.
[0036] In this embodiment, the target device is the physical device that needs to be assigned a logical address. This target device can be an indoor air conditioning unit, a temperature and humidity sensor, a lighting controller, etc., within an automated control system. The automated control system can be a building automation system, an industrial Internet of Things (IIoT) system, or other similar control system.
[0037] In this embodiment, when the target device needs to be connected to the automation control system as a new device, an address allocation process for the target device will be triggered to obtain the first address of the target device.
[0038] In this embodiment, the first address refers to a logical address initially generated for the target device that has not undergone global uniqueness verification. This first address can be an address generated based on the device information of the target device.
[0039] In this embodiment, the first address can be pre-generated based on the device information of the target device, or it can be obtained from other devices via a network, Bluetooth, etc. Specifically, the first address can be generated locally or in the cloud based on the device information of the target device; or, the first address can be read from pre-configuration information associated with the target device, for example, reading the initial address pre-programmed into the read-only memory when the target device leaves the factory; or, the first address can be received from an external management system or address allocation server, for example, an address pre-allocated or dynamically issued to the target device by the main controller in the network or a dedicated address management service; or, the first address can be determined based on configuration information manually input or selected by the user.
[0040] S102: Perform address conflict detection on the first address, and when the first address is detected to be a conflicting address, obtain the first device identification information of the conflicting device.
[0041] In this embodiment, the conflicting device is a device that has an address conflict with the target device, that is, the conflicting device is a device that is currently occupying the first address.
[0042] In this embodiment, after obtaining the first address of the target device, the generated first address is compared with the global address pool to determine whether the first address is a conflicting address. The global address pool stores successfully allocated device addresses and the devices corresponding to those addresses. For example, the global address pool can be a list of allocated device addresses stored in memory or a database.
[0043] It should be noted that the device address of any device in the global address pool can be generated in the same way as or differently from the first address of the target device. For example, the device address of any device in the global address pool can be an address generated based on the device information of that device.
[0044] In this embodiment, if no address that is duplicated with the first address is found in the global address pool, it is determined that the first address is not a conflicting address. At this time, the first address will be assigned to the target device and added to the global address pool.
[0045] In this embodiment, if an address that is duplicated with the first address is found in the global address pool, the first address is determined to be a conflicting address, and the conflict resolution mechanism will be triggered. Subsequently, the conflicting device that has occupied the first address is located, and its first device identification information is read.
[0046] In this embodiment, the first device identification information refers to information used to uniquely identify the conflicting device. This first device identification information can originate from the immutable hardware of the conflicting device. For example, the first device identification information can be the device serial number stored in read-only memory corresponding to the conflicting device, the product code printed on a label, the MAC address of the network interface, or the physical address value set by a DIP switch, etc.
[0047] S103: Generate the second address of the target device based on the first device identification information and the first address.
[0048] In this embodiment, after obtaining the first device identification information of the conflicting device, a preset conflict resolution algorithm is used to resolve the conflict. This algorithm takes the first device identification information of the conflicting device and the first address of the conflict as input, and generates a new and unique address, namely the second address, through preset, deterministic calculation rules. This second address refers to the final logical address regenerated for the target device, ensuring global uniqueness.
[0049] In a specific implementation, the step of generating a second address of the target device based on the first device identification information and the first address may include: combining the first device identification information and the first address to obtain the second address; or, extracting a target identifier from the first device identification information and combining the target identifier with the first address to obtain the second address.
[0050] In this embodiment, unlike simple random retry or manual specification methods, by using the first device identification information of the conflicting device for conflict resolution, it is possible to effectively ensure that the generated second address is the same and unique regardless of when and where it is executed in the same complex networking environment, thereby meeting the strict requirements of industrial systems for device determinism.
[0051] S104: Assign a second address to the target device.
[0052] In this embodiment, after generating a globally unique second address, the second address is formally assigned to the target device and added to the global address pool. For example, the mapping relationship between the device identifier corresponding to the target device and the second address can be written into the final device configuration list or network registry. In this way, the target device will have a unique and legitimate identity in the network, thereby successfully completing communication and control operations between devices.
[0053] In this embodiment, by using the first device identification information of the conflicting device to perform deterministic calculation to generate a new second address, the conflict problem during automatic address allocation in the device network can be effectively solved. Thus, without manual intervention, a globally unique device address can be automatically and reliably generated, thereby greatly improving the automation, reliability and maintainability of device address management.
[0054] In one feasible implementation, refer to Figure 2 Before the step of obtaining the first address of the target device, the address management method may also include steps S201 to S202, as follows: S201: Obtain the location information of the target device and the identification information of the second device.
[0055] In this embodiment, location information refers to the information about the installation location or logical area to which the target device belongs in the physical space. This location information usually exists in the form of structured data. For example, the location information can be a text description such as "Building A / 3rd Floor / Room 305" or "Production Workshop A Area - Assembly Line 2", or a coordinate code derived from a Building Information Model (BIM) or floor plan.
[0056] In this embodiment, the second device identification information refers to information obtained from the target device itself, used to uniquely identify the target device. It should be noted that the second device identification information here is only used to distinguish it from the first device identification information of conflicting devices; the two are essentially the same type of information (both referring to unique device identifiers), but originate from different devices. That is, the second device identification information can also originate from the immutable hardware of the target device. For example, the first device identification information could be the device serial number stored in the read-only memory corresponding to the target device, the product code printed on a label, the MAC address of the network interface, or the physical address value set by a DIP switch, etc.
[0057] S202: Generate a first address based on location information and second device identification information.
[0058] In this embodiment, after obtaining the location information and the second device identification information, a preset address generation rule is invoked to process and combine them. The processing methods can be varied, such as: concatenating the code converted from the location information with a fragment of the device identification information; performing arithmetic or logical operations on both and then encoding them; or inputting both as parameters into an algorithm model to generate a hash value as the address. This address generation rule is used to merge the location information and the second device identification information into a single identifier, namely the first address.
[0059] In this implementation, location information represents the spatial location of the target device, and the second device identification information represents the hardware identity of the target device. By comprehensively considering the device information from both dimensions, the first address not only possesses uniqueness potential but also carries topological semantics by incorporating location information. This transforms the first address from a purely abstract and meaningless number into an understandable identifier containing topological relationships. For example, the address "A3-305_SN1234" intuitively indicates that the target device is located in Room 305, 3rd Floor, Building A. This design greatly improves address readability and system maintainability, serving as a crucial bridge between manual operation and maintenance and automated management.
[0060] In this embodiment, by comprehensively considering the location information of the target device and the identification information of the second device, the physical topology and device identity can be deeply integrated into the address encoding, so that the first address can have topological semantics and identity characteristics. This not only provides a high-quality, low-conflict-rate initial input for subsequent conflict detection, but also greatly facilitates the physical location of the device, the logical attribution judgment, and the configuration association analysis when replacing the device, significantly reducing the cognitive burden and operational complexity of system deployment and subsequent maintenance.
[0061] In one feasible implementation, the step of generating a first address based on location information and second device identification information may specifically include: generating location encoding information based on location information; performing a hash operation on the location encoding information to obtain a target hash value; and generating a first address based on the target hash value and second device identification information.
[0062] In this embodiment, location encoding information is the encoded information obtained after performing data encoding operations on location information. Specifically, data encoding refers to the process of standardizing, formatting, and abstracting the raw, human-readable location information to obtain concise code or strings. Data encoding is used to convert lengthy and irregular textual descriptions into location encoding information under a predetermined set of rules, facilitating subsequent computer processing.
[0063] In this implementation, after obtaining the location information, predefined encoding rules or mapping tables can be used to convert it. For example, the system has pre-stored rules: the "building number" takes the first letter, the "floor" uses numbers directly, and the "room number" uses numbers directly, connected by underscores. After applying this rule, "Building A, 3rd Floor, Room 305" is converted into the location code "A3_305".
[0064] In this embodiment, considering that location information has various descriptive forms and is generally not suitable for direct structured address generation, it is converted into a unified encoding format. This eliminates ambiguity and ensures processing consistency. Furthermore, it compresses semantic information into short code, significantly reducing the amount of data and storage overhead in subsequent operations, which is particularly suitable for resource-constrained embedded processing environments.
[0065] In this embodiment, hashing refers to a one-way computation process that maps input data of arbitrary length to a fixed-length output value using a specific hash function. The target hash value refers to the fixed-length numerical or string result obtained after performing a hash operation on the position-encoded information.
[0066] In this embodiment, the hash operation can employ hash algorithms such as SHA-256 and SHA-512. Alternatively, to reduce computational resource consumption, a lightweight hash function (such as CRC16 or CRC32) can be used to perform a hash operation on the positional encoding information to obtain the target hash value. For example, performing a CRC32 operation on "A3_305" yields an 8-bit hexadecimal number "0x5A1B3C8D".
[0067] In this embodiment, by performing a hash operation on the location encoding information, even if the location encoding information has different lengths or uneven distribution, the hash operation can output a value with a fixed length and relatively uniform bit distribution, which facilitates the subsequent formation of addresses with a uniform format. At the same time, the hash operation possesses deterministic and avalanche effect characteristics (small changes in input leading to large differences in output). Determinism ensures that the same location encoding will always produce the same hash value, which is the basis for the system's reusable deployment; while the avalanche effect enhances the differences between the first addresses generated by different location encodings, probabilistically reducing the possibility of first address conflicts caused solely by similarities in different parts of the location encoding.
[0068] In this embodiment, the step of generating a first address based on a target hash value and a second device identifier can specifically include: combining the target hash value and the second device identifier to obtain the first address.
[0069] In this embodiment, since the target hash value represents the mapping of the physical location of the target device and the second device identification information represents the unique identity of the device itself, by combining the two, the generated first address contains both physical topology information and can effectively guarantee the uniqueness of the address.
[0070] In one feasible implementation, the step of generating a first address based on a target hash value and a second device identification information may specifically include: extracting a first identifier from the target hash value; extracting a second identifier from the second device identification information; and combining the first identifier and the second identifier to obtain the first address.
[0071] In this embodiment, after obtaining the target hash value, a portion of the target hash value can be selected as the first identifier according to a pre-configured first extraction rule. For example, the first extraction rule can be defined as: "extract the first N characters of the target hash value" or "extract the last M characters of the target hash value". Here, N and M are positive integers, and N and M can be the same or different. For example, if the target hash value is a 32-bit hexadecimal number 0x5A1B3C8D, and the first extraction rule is to extract the first 6 characters of the hexadecimal string representation of the hash value, then the first identifier extracted from 0x5A1B3C8D is 5A1B3C (ignoring the 0x prefix).
[0072] In this implementation, the length of the complete hash value is fixed but may be quite long (e.g., CRC32 is an 8-bit hexadecimal number), and directly using the portion as the first address may result in an excessively long address. By extracting a portion as the first identifier, the address length can be significantly shortened while preserving the core characteristics of the hash function (i.e., inputs encoded from the same location will inevitably produce the same prefix, and the probability of different inputs producing different prefixes is still very high), making it more adaptable to the identifier length limitations imposed by embedded systems or communication protocols.
[0073] In this embodiment, after obtaining the second device identification information of the target device, a portion of the second device identification information can be selected as the second identifier according to a pre-configured second extraction rule. For example, the second extraction rule can be defined as: "extract the first X characters of the second device identification information" or "extract the last Y characters of the second device identification information", where X and Y are positive integers, and X and Y can be the same or different. For example, the second device identification information is the complete device serial number SN202408170001 of the target device, and the second extraction rule is "extract the last four digits of the second device identification information". Therefore, the second identifier extracted from SN202408170001 is 0001.
[0074] In this embodiment, the extracted first identifier and second identifier can be assembled according to a predefined address format. For example, the first identifier and second identifier can be concatenated to obtain the first address.
[0075] In this embodiment, the step of combining the first identifier and the second identifier to obtain the first address may specifically include: using the first identifier as an address prefix, using the second identifier as an address suffix, and concatenating the first identifier and the second identifier to obtain the first address.
[0076] In this embodiment, delimiters can be introduced to enhance readability when concatenating strings. For example, if the address format is "[first identifier]_[second identifier]", the first identifier is 5A1B3C, and the second identifier is 0001, then the combined first address is "5A1B3C_0001".
[0077] In this embodiment, by extracting a first identifier from the target hash value as the address prefix and a second identifier from the second device identification information as the address suffix, and combining the two in a fixed format, the first address becomes more compact, concise, and uniform in format, while also being easy for both manual identification and computer processing. This significantly optimizes address storage efficiency, transmission efficiency, and the operability of daily operations and maintenance, laying a solid foundation for automated address management in large-scale device networks.
[0078] In one feasible implementation, refer to Figure 3 The step of generating a second address based on the first device identifier information and the first address may specifically include steps S301 to S302, as follows: S301: Generate a conflict resolution identifier based on the first device identification information and the second device identification information of the target device.
[0079] In this implementation, upon detecting a first address conflict, the system acquires the device identification information of both conflicting devices: the first device identifier of the conflicting device and the second device identifier of the target device itself. Subsequently, the system calls a predefined conflict resolution algorithm, using the device identifiers of these two devices as input to generate a conflict resolution identifier. This conflict resolution identifier is a unique identifier generated to resolve the address conflict. This identifier is specifically used to modify or expand the first address that caused the conflict, forming a completely new, globally unique second address.
[0080] In this embodiment, the conflict resolution algorithm may specifically include: performing a hash operation on the combined string of the first device identification information and the second device identification information to obtain a first hash value, and extracting a conflict resolution identifier from the first hash value; or, performing an XOR operation on the first device identification information and the second device identification information to obtain a conflict resolution identifier; or, sorting the first device identification information and the second device identification information to obtain a sorting number of the target device, and determining the sorting number of the target device as the conflict resolution identifier.
[0081] It should be noted that, since the device identification information is inherent and unchanging, for target devices and conflicting devices that have address conflicts, regardless of when, where, or how many times they are restarted, as long as the same conflict resolution algorithm is used, the calculation result will always be the same. This ensures a high degree of predictability and reproducibility of the entire conflict resolution process, meeting the stringent requirements of industrial control systems for stability and maintainability, and effectively avoiding configuration uncertainty and subsequent maintenance chaos caused by random allocation.
[0082] S302: Generate a second address based on the conflict resolution identifier and the first address.
[0083] In this embodiment, after calculating the conflict resolution identifier, it can be combined with the first address where the conflict occurred to form a second address. The combination rules are preset; for example, a separator "-" and the conflict resolution identifier can be appended to the end of the first address to generate the second address. For instance, if the conflict resolution identifier is a two-digit hexadecimal number 0x1F, and the first address is 5A1B3C_0001, then the second address is 5A1B3C_0001-1F.
[0084] In this embodiment, after an address conflict is detected, a new second address is generated by retaining the first address and using it as a basis, and attaching a conflict resolution identifier determined by the identities of the conflicting parties. This completely eliminates the randomness in the address allocation process and ensures that the system can always generate a unique and unchanging final address in any specific device conflict scenario, which facilitates the system's identification, management, and storage.
[0085] In one feasible implementation, a conflict resolution identifier is generated based on the first device identification information and the second device identification information of the target device, including: performing arithmetic or logical operations on the first device identification information and the second device identification information to obtain a target value; and performing a modulo operation on the target value to obtain the conflict resolution identifier.
[0086] In this embodiment, performing arithmetic or logical operations on the first device identification information and the second device identification information means performing arithmetic or logical operations on the numerical representations corresponding to the first device identification information and the second device identification information.
[0087] In this embodiment, the step of performing arithmetic or logical operations on the first device identification information and the second device identification information to obtain the target value may specifically include: converting the first device identification information into a first value, converting the second device identification information into a second value, and performing arithmetic or logical operations on the first value and the second value to obtain the target value. The arithmetic operations include addition, subtraction, multiplication, and division, while the logical operations include bitwise AND, OR, XOR, and NOT operations.
[0088] For example, the first device identification information of the conflicting device is the serial number "SN001", and the second device identification information of the target device is the serial number "SN002". The numeric parts 001 and 002 in the serial numbers can be extracted, or their ASCII codes can be converted into integers. Then, a preset arithmetic operation, such as summation (001+002=3), or a preset logical operation, such as bitwise XOR (001 XOR 002), is performed on these two values.
[0089] In this embodiment, by performing arithmetic or logical operations on the first device identification information and the second device identification information, it is possible to map the two independent, high-dimensional unique identifiers of the conflicting parties into a single, low-dimensional target value.
[0090] In this embodiment, considering that the target value may be a value with a variable data length, a modulus can be predefined to limit the range of the conflict resolution identifier, such as 100, 256, or 1000. Then, the target value is modulo this modulus. For example, if the target value is 203 and the modulus is 100, then 203%100=3. The remainder 3 can be directly used as the conflict resolution identifier, or it can be formatted to a fixed length, such as using 03 as the conflict resolution identifier.
[0091] In this embodiment, by performing a modulo operation on the target value, no matter how large the target value is, the modulo operation can map it to a fixed and finite range of integers (i.e., 0 to modulus-1). Furthermore, the modulo operation is computationally very efficient and suitable for rapid execution in embedded systems or resource-constrained configuration tools, meeting the requirements of real-time performance and low overhead in industrial scenarios.
[0092] In this embodiment, by performing arithmetic or logical operations on the first and second device identification information and combining them with modulo operations to generate conflict resolution identifiers, the calculation of conflict resolution identifiers can be achieved with extremely low computational overhead. At the same time, the results are naturally constrained within a predetermined range by modulo operations, making the final generated second address format uniform and greatly simplifying the system processing logic, effectively meeting the requirements of industrial control field for reliability and lightweight computation.
[0093] In one feasible implementation, refer to Figure 4 After assigning a second address to the target device, the address management method may further include steps S401 to S404, as follows: S401: The second address is determined as the object attribute value in the device model defined by the target communication protocol.
[0094] In this embodiment, the target communication protocol refers to the standardized set of communication rules and data formats used in a device network. For example, in the field of building automation, the target communication protocol may be BACnet (Building Automation and Control networks), Modbus (Modicon Bus), KNX (Konnex), etc.; in the field of industrial IoT, it may be OPC UA (Open Platform Communications Unified Architecture), PROFINET (Process Field Network), etc. The target communication protocol defines how devices represent themselves and how they exchange data.
[0095] In this embodiment, a device model refers to a standardized object or data point structure defined by the target communication protocol, used to abstractly describe a device and its functions. For example, in the BACnet protocol, the core of the device model is the device object, which has standard attributes including an object identifier and object attribute values.
[0096] In this embodiment, after obtaining the globally unique second address (such as 5A1B3C_0001-1F), it can be filled into the object attribute value in the device model of the target communication protocol according to the predefined mapping rules.
[0097] In this embodiment, the object attribute value refers to the specific data value corresponding to each attribute in the device model. For example, the object attribute value can be the Object_Name (name attribute) of BACnet, and this Object_Name needs to be unique within the system. For instance, if the second address is 5A1B3C_0001-1F, then this second address can be set as the Object_Name of BACnet.
[0098] S402: Generate the object identifier of the target device based on the object attribute value.
[0099] In this embodiment, an object identifier refers to the encoding used in the device model to uniquely identify a specific object within the system. The object identifier is the basis for addressing and data exchange by the protocol stack. For example, this object identifier can be BACnet's Object_Identifier.
[0100] In this embodiment, the step of generating an object identifier for a target device based on object attribute values may specifically include: performing a hash operation on the object attribute values to obtain a second hash value, performing a modulo operation on the hash value to obtain a third value within the target number range, and generating an object identifier for the target device based on the third value; or, extracting a key feature substring from the object attribute values, converting the feature substring into a fourth value, performing a modulo operation on the fourth value to obtain a fifth value within the target number range, and generating an object identifier for the target device based on the fifth value; or, querying a preset mapping table used to represent the correspondence between object attribute values and object identifiers, and if an object attribute value exists in the mapping table, determining the object identifier corresponding to the object attribute value in the mapping table as the object identifier for the target device; if no object attribute value exists in the mapping table, generating object identifiers for the target device in sequence, and adding the object identifiers and their correspondences to the mapping table.
[0101] S403: Generate a configuration file in the target format based on object attribute values and object identifiers.
[0102] In this embodiment, a new target format configuration file can be created according to the structure of the device model of the target communication protocol.
[0103] For example, in the BACnet protocol, the Object_Name, the Object_Identifier generated based on the Object_Name, and other necessary attributes of the device model (such as device type, vendor ID, etc.) can be filled into the corresponding fields of the initial file according to the requirements of the target format (such as JSON) and serialized into a configuration file of the target format.
[0104] In this embodiment, by encapsulating object attribute values and object identifiers into a configuration file that conforms to industry or protocol standard formats, the configuration file is a normal and valid configuration file for any communication gateway that supports the standard protocol and file format.
[0105] S404: Based on the configuration file, register the target device to the communication gateway based on the target communication protocol.
[0106] In this embodiment, the generated configuration file can be transmitted and loaded into the communication gateway via physical media (such as a USB flash drive) or network upload (such as FTP or HTTP). When the communication gateway starts up or receives an update command, it can parse the configuration file and call the API (Application Programming Interface) of its internal standard protocol stack to automatically register the device object instance corresponding to the target device based on the configuration file, thereby realizing the registration of the target device on the communication gateway.
[0107] In this embodiment, since the configuration file is standard, the communication gateway can seamlessly recognize and process the configuration file through its protocol stack without any firmware modification or upgrade, thereby achieving automatic registration of the target device.
[0108] In this embodiment, after the target device is registered to the communication gateway based on the target communication protocol, the communication gateway can control the target device.
[0109] In one example, the second address (Object_Name) of the target device in the configuration file loaded by the communication gateway is B3_05_SN8A2. The communication gateway provides this information to the upper-level management software. The management software can parse the logical topology code B3_05 in the address and automatically display the target device on the location icon of Room 5, 3rd Floor, Building B in the virtual building map, and highlight its alarm status.
[0110] In another example, maintenance personnel issue control commands to the communication gateway via the network management interface or API: operate all device objects whose Object_Name is prefixed with B3_, and set their operating mode to shutdown mode. The communication gateway, utilizing the structured characteristics of dynamic addresses (the prefix B3 represents the 3rd floor of Building B), can dynamically filter all devices that meet the conditions in real time (such as B3_01_xxx, B3_02_xxx, ..., B3_05_SN8A2, ...), and execute batch control commands, thereby setting the operating mode of all devices on the 3rd floor of Building B, including the target device (B3_05_SN8A2), to shutdown mode.
[0111] In this embodiment, by mapping the second address to object attribute values and automatically generating configuration files for the gateway to register devices, address management is seamlessly integrated with the existing industrial communication system. This enables "plug-and-play" automated registration and deployment of a large number of devices without modifying any existing hardware or core system software. It effectively solves the problems of poor protocol compatibility, high deployment costs, and difficult system upgrades in traditional solutions, and greatly improves the deployment efficiency, operation and maintenance convenience, and system reliability of the entire device network.
[0112] In this embodiment, a central air conditioning control system based on the BACnet protocol is used as an example. The following is a sample table of traditional configuration files based on the BACnet protocol: { "name": "powerSwitch", "address": "1", / / Fixed address "type": "uint16", "rw": "rw", "timeout": 311040000}, { "name": "powerSwitch", "address": "2", / / Different addresses for the same function "type": "uint16", "rw": "rw", "timeout": 311040000} In the BACnet protocol, Object_Name (or its mapping field name) is a crucial readable identifier. Although the standard requires it to be unique within the device, many system configuration practices or upper-layer application logic rely on name to find and control specific functions. The address field, as the device address, is merely a manually assigned fixed number (such as 1, 2). It does not carry any physical location or identity information of the device; it is simply an abstract index.
[0113] When a system has multiple indoor air conditioning units (belonging to different units or located in different rooms), they are likely to have the same functionalities (such as powerSwitch). In traditional configurations, the name field of these different physical devices for the same function is simply configured as "powerSwitch". In this case, if the building management system (BMS) or control logic attempts to send a shutdown command using name="powerSwitch", the BACnet gateway or network will be unable to distinguish which physical device the command is intended for, because multiple device objects are responding to the same "name". This can lead to: commands being sent to the wrong device, mistakenly shutting down the air conditioning in other rooms; commands being responded to by multiple devices simultaneously, causing unpredictable system states; and the gateway refusing to execute commands due to ambiguity, resulting in control failure.
[0114] In this embodiment, an example table of configuration files generated using the technical solution of this application is shown: { "name": "1_21#powerSwitch", "address": "a3f5c8_21", / / Dynamically generated topology address "type": "uint16", "rw": "rw", "timeout":311040000} { "name": "1_80#powerSwitch", "address": "b2d9e1_80", / / Different addresses for the same function "type": "uint16", "rw": "rw", "timeout": 311040000} In this implementation, the `name` and `address` fields of the configuration file have been restructured. For the `name` field, the format `[Device Original Identifier]#[Function Point]` is adopted, with each function point having a globally unique name. The prefix "1_21#" clearly indicates that this is a power switch belonging to "System 1, Indoor Unit 21," distinct from the switch with the prefix "1_80#". For the `address` field, as the device address, the format `[Location Hash Prefix]_[Device Identifier Suffix]` is adopted, for example, "a3f5c8_21". The "a3f5c8" part is generated by a hash algorithm from the device's physical location (e.g., "Building A / 3rd Floor / Room 305"), ensuring that device prefixes differ for different locations. The "_21" part originates from the device's identification information (e.g., indoor unit number).
[0115] In this embodiment, by adopting the technical solution of the present application, a globally unique device address is generated for all devices in the system, which can achieve the following technical effects: (1) Eliminate control chaos. By constructing globally unique names and addresses, each device object is ensured to have a unique identity in the BACnet network, and commands can be delivered accurately, completely solving the "control failure" problem. After laboratory stress testing, 0 ID conflicts were achieved in 10,000 iterations, and the fault recovery time was optimized from the traditional 45 minutes to real-time automatic repair.
[0116] (2) Automated configuration upgrades. By automatically generating configuration files in the target format, configuration time can be significantly reduced. Compared to the traditional method of manually editing JSON for device configuration, this solution can reduce the configuration time required for configuring 50 devices from 6 hours to 8 minutes, and the configuration time required for configuring 200 devices from 24 hours to 25 minutes. At the same time, the configuration file itself, as a self-interpreting engineering document, can also greatly reduce the understanding cost and error probability of operation and maintenance.
[0117] (3) Seamless compatibility with existing systems, reducing operation and maintenance costs. In traditional solutions, protocol incompatibility requires custom development, and equipment replacement requires firmware updates, increasing time and money costs; this solution can reduce deployment costs by 75%, system expansion costs by 75%, equipment replacement time by 92%, fault recovery time by <3 seconds, and seamlessly adapt to current mainstream gateways, allowing mainstream gateways such as BACnet gateways to directly load and use configuration files without modification.
[0118] To facilitate better implementation of the address management method of this application, this application also provides an address management device based on the above-described address management method. The meanings of the terms used are the same as in the address management method described above, and specific implementation details can be found in the descriptions of the method embodiments.
[0119] Based on the same inventive concept, and referring to Figure 5 This application provides an address management device 500, which includes: Address acquisition module 501 is used to acquire the first address of the target device; The information acquisition module 502 is used to perform address conflict detection on the first address, and when the first address is detected to be a conflicting address, acquire the first device identification information of the conflicting device; the conflicting device is a device that has an address conflict with the target device; Address generation module 503 is used to generate a second address based on the first device identification information and the first address; Address allocation module 504 is used to allocate a second address to the target device.
[0120] In one embodiment, the address acquisition module 501 includes: The identification information acquisition submodule is used to acquire the location information of the target device and the identification information of the second device; The first address generation submodule is used to generate a first address based on location information and second device identification information.
[0121] In one embodiment, the first address generation submodule includes: The location coding unit is used to generate location coding information based on location information; The hash operation unit is used to perform hash operations on the location-encoded information to obtain the target hash value; The address generation unit is used to generate a first address based on the target hash value and the second device identification information.
[0122] In one embodiment, the address generation unit includes: The first extraction subunit is used to extract the first identifier from the target hash value; The second extraction subunit is used to extract the second identifier from the second device identification information; The address generation subunit is used to combine the first identifier and the second identifier to obtain the first address.
[0123] In one embodiment, the address generation module 503 includes: The identifier generation submodule is used to generate a conflict resolution identifier based on the first device identification information and the second device identification information of the target device. The second address generation submodule is used to generate a second address based on the conflict resolution identifier and the first address.
[0124] In one embodiment, the identifier generation submodule includes: The first arithmetic unit is used to perform arithmetic or logical operations on the first device identification information and the second device identification information to obtain the target value. The second arithmetic unit is used to perform a modulo operation on the target value to obtain the conflict resolution identifier.
[0125] In one embodiment, the address management device 500 further includes: The object attribute value determination module is used to determine the second address as the object attribute value in the device model defined by the target communication protocol. The object identifier generation module is used to generate the object identifier of the target device based on the object attribute values; The configuration file generation module is used to generate configuration files in the target format based on object attribute values and object identifiers; The device registration module is used to register target devices to a communication gateway based on the target communication protocol, based on a configuration file.
[0126] The technical solution of this application embodiment uses the first device identification information of the conflicting device to perform deterministic calculation to generate a new second address, which can effectively solve the conflict problem when the address is automatically allocated in the device network. In this way, a globally unique device address can be automatically and reliably generated without manual intervention, thereby greatly improving the automation, reliability and maintainability of device address management.
[0127] Specific limitations regarding the address management device 500 can be found in the limitations of the address management method described above, and will not be repeated here. Each module in the address management device 500 can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware or independently of the processor in the computer device, or stored in software in the memory of the computer device, so that the processor can call and execute the operations corresponding to each module.
[0128] In addition, this application also provides an electronic device, such as Figure 6 As shown, it illustrates the structural diagram of the electronic device involved in this application, specifically: The electronic device may include components such as a processor 601 with one or more processing cores and a memory 602 with one or more computer-readable storage media. Those skilled in the art will understand that... Figure 6 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein: The processor 601 is the control center of the electronic device. It connects various parts of the electronic device via various interfaces and lines, and performs various functions and processes data by running or executing software programs and / or modules stored in the memory 602, and by calling data stored in the memory 602, thereby providing overall monitoring of the electronic device. Optionally, the processor 601 may include one or more processing cores; preferably, the processor 601 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 601.
[0129] The memory 602 can be used to store software programs and modules. The processor 601 executes various functional applications and performs address management by running the software programs and modules stored in the memory 602. The memory 602 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 602 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 602 may also include a memory controller to provide the processor 601 with access to the memory 602.
[0130] In one feasible implementation, the electronic device further includes a power supply 603 that supplies power to the various components. Preferably, the power supply 603 can be logically connected to the processor 601 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 603 may also include one or more DC or AC power supplies, recharging systems, power equipment debugging circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0131] In one feasible implementation, the electronic device may further include an input unit 604, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0132] Although not shown, the electronic device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 601 in the electronic device loads the executable files corresponding to the processes of one or more applications into the memory 602 according to the following instructions, and the processor 601 runs the applications stored in the memory 602, thereby implementing the steps in any of the address management methods provided in the embodiments of this application.
[0133] Those skilled in the art will understand that Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the electronic device to which the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.
[0134] In one feasible implementation, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the methods described in any embodiment of this application.
[0135] In one feasible implementation, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the methods described in any embodiment of this application.
[0136] In one feasible implementation, a computer program product is also proposed, comprising a computer program or instructions that, when executed by a processor, implement the methods described in any embodiment of this application.
[0137] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0138] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0139] Therefore, this application provides a computer-readable storage medium storing a computer program that can be loaded by a processor to execute the steps of any of the address management methods provided in this application.
[0140] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0141] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0142] Since the instructions stored in the computer-readable storage medium can execute the steps of any of the address management methods provided in this application, the beneficial effects that any of the address management methods provided in this application can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.
[0143] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes the element.
[0144] The above provides a detailed description of an address management method, apparatus, electronic device, and computer-readable storage medium provided in this application. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, those skilled in the art will recognize that there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. An address management method, characterized in that, The method includes: Obtain the first address of the target device; Address conflict detection is performed on the first address, and when the first address is detected as a conflicting address, the first device identification information of the conflicting device is obtained; the conflicting device is a device that has an address conflict with the target device; Based on the first device identification information and the first address, a second address of the target device is generated; The second address is assigned to the target device.
2. The address management method according to claim 1, characterized in that, Before obtaining the first address of the target device, the following steps are included: Obtain the location information of the target device and the identification information of the second device; The first address is generated based on the location information and the second device identification information.
3. The address management method according to claim 2, characterized in that, The step of generating the first address based on the location information and the second device identification information includes: Based on the location information, location encoding information is generated; Perform a hash operation on the location encoding information to obtain the target hash value; The first address is generated based on the target hash value and the second device identification information.
4. The address management method according to claim 3, characterized in that, The step of generating the first address based on the target hash value and the second device identifier information includes: Extract the first identifier from the target hash value; Extract the second identifier from the second device identification information; The first address is obtained by combining the first identifier and the second identifier.
5. The address management method according to claim 1, characterized in that, The step of generating a second address based on the first device identification information and the first address includes: Based on the first device identification information and the second device identification information of the target device, a conflict resolution identifier is generated; The second address is generated based on the conflict resolution identifier and the first address.
6. The address management method according to claim 5, characterized in that, The step of generating a conflict resolution identifier based on the first device identification information and the second device identification information of the target device includes: Perform arithmetic or logical operations on the first device identification information and the second device identification information to obtain the target value; The target value is moduloed to obtain the conflict resolution identifier.
7. The address management method according to claim 1, characterized in that, After allocating the second address to the target device, the method further includes: The second address is determined as the object attribute value in the device model defined by the target communication protocol; Based on the object attribute values, generate the object identifier of the target device; Based on the object attribute values and the object identifier, generate a configuration file in the target format; Based on the configuration file, the target device is registered to a communication gateway based on the target communication protocol.
8. An address management device, characterized in that, The device includes: The address acquisition module is used to obtain the first address of the target device; The information acquisition module is used to perform address conflict detection on the first address, and when the first address is detected to be a conflicting address, acquire the first device identification information of the conflicting device; the conflicting device is a device that has an address conflict with the target device; The address generation module is used to generate a second address based on the first device identification information and the first address; The address allocation module is used to allocate the second address to the target device.
9. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the steps of the address management method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the address management method as described in any one of claims 1 to 7.