Indoor unit address allocation method of multi-split air conditioner
By hash conversion in multiple online air conditioning systems, the IP address is generated by hash conversion, and arbitration and backoff operations are performed on the CAN bus, the inefficiency and conflict of internal unit address allocation are solved, and efficient and stable internal unit address allocation is achieved.
Patent Information
- Application Number
- CN202510541073.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-28
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2045-04-28
AI Technical Summary
In multiple online air conditioning systems, the internal unit address allocation is inefficient and unsuccessful address allocation is particularly problematic when multiple internal units apply for addresses at the same time, CAN bus traffic collision and RS485 bus random number address duplication are prone to occur.
Hash conversion is performed through the unique MAC address of the internal unit to generate candidate IP addresses, and arbitration and backoff operations are performed on the CAN bus, prioritization is dynamically adjusted and sending time slot nodes are set to avoid conflicts and improve address allocation efficiency.
It effectively reduces the duplication rate of IP addresses, improves the efficiency and success rate of internal computer address allocation, avoids conflict cycles, and improves the stability of the system.
Smart Images

Figure CN120074980A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of address allocation for air conditioner indoor units, and particularly relates to a method for allocating addresses to indoor units of a multi-connected air conditioner. Background Art
[0002] A multi-connected air conditioner is a central air conditioning system in which one outdoor unit is connected to multiple indoor units. Therefore, a system of a centralized control host (air conditioner outdoor unit) and multiple slave units (air conditioner indoor units) needs to be constructed. In the system, the outdoor unit needs to allocate a unique valid address to the connected indoor units.
[0003] In the prior art, communication between the indoor unit and the outdoor unit is carried out through an RS485 bus or a CAN bus. For a system using a CAN bus for communication, the CAN bus indoor unit address allocation technology mainly involves the indoor unit generating a candidate IP address using a unique MAC address. The indoor unit applies to the outdoor unit through the preemption mechanism of the CAN bus with the candidate IP address. The outdoor unit confirms whether the candidate IP address is available. If available, it notifies the indoor unit that the IP allocation is successful. The RS485 bus is a half-duplex communication method, and the indoor unit uses random numbers for allocation. That is, after the outdoor unit is powered on, it sends a command to generate random numbers to the indoor unit. The indoor unit obtains the command from the outdoor unit and executes the generation of a random number address. After the outdoor unit delays and waits for the indoor unit to complete the generation of the random number address, it allocates the indoor unit IP address by naming according to the random number address.
[0004] The above two address allocation methods both have defects: 1. When multiple indoor units apply for addresses to the outdoor unit at the same time point, a CAN bus line occupation conflict will occur. After the conflict occurs, the indoor units that have not been allocated addresses will apply to the outdoor unit again at the same time, resulting in repeated conflicts, an endless loop of repeated applications and repeated conflicts, and thus leading to low efficiency of indoor unit address allocation or unsuccessful indoor unit address allocation; 2. The RS485 bus uses random number addresses for generation, and the random numbers will cause too high a repetition rate of the generated addresses, and it is necessary to continuously verify and regenerate the random number addresses.
[0005] Therefore, for a multi-connected air conditioner system, how to efficiently allocate addresses to indoor units and avoid conflicts when indoor units apply for addresses is a problem that needs to be solved currently. Summary of the Invention
[0006] In view of the problems raised in the background art, the present invention proposes a method for allocating addresses to indoor units of a multi-connected air conditioner.
[0007] To achieve this purpose, the present invention adopts the following technical solutions: A method for allocating the internal unit address of a multi-connected air conditioner, step A: When multiple air conditioner internal units are powered on, each internal unit reads the unique MAC address burned in, inputs the unique MAC address into a hash function to obtain a conversion value, and converts the conversion value into a candidate IP address; Step B: The internal unit accesses the CAN bus and sends a data packet to the external unit. The data packet includes the candidate IP address and the unique MAC address; Step C: When the internal unit executes step B, the CAN bus detects whether there is a bit conflict. If so, the internal unit enters step E; if not, it executes step D; Step D: The external unit confirms whether the candidate IP address is occupied through the data packet. If it is not occupied, the external unit sends a confirmation signal to the internal unit and stores the unique MAC address and the candidate IP address of the internal unit. After receiving the confirmation signal, the internal unit locks the candidate IP address and writes it into the non-volatile memory; If the candidate IP address is occupied, the external unit sends a signal to the internal unit to regenerate the candidate IP, and the internal unit enters step E; Step E: Perform a backoff operation: The conflicting internal units can only re-access the CAN bus after the waiting time ends; Perform the CAN bus arbitration operation: When multiple internal units access the CAN bus simultaneously, it is judged whether there are internal units that have not had a conflict. If so, the CAN bus allows all internal units that have not had a conflict to access the CAN bus and execute step B; if not, the CAN bus compares the priorities of all internal units accessing this time, allows the internal unit with the highest priority to access the CAN bus, cancels the access of other internal units this time and regards the access of other internal units this time as a conflict, and other internal units re-enter step E; Perform the operation of setting the transmission time slot: When a conflicting internal unit is allowed to access the CAN bus, the conflicting internal unit needs to set the transmission time slot node and send a data packet to the external unit at the transmission time slot node.
[0008] Preferably, in the step A, it includes: Step A1: Divide the unique MAC address into four conversion intervals from left to right, with every three hexadecimal digits as one interval. In the first and second conversion intervals, the first two hexadecimal digits are respectively fixed and input into the hash function to obtain the first conversion value and the second conversion value. In the third and fourth conversion intervals, any two hexadecimal digits are respectively input into the hash function to obtain the third conversion value and the fourth conversion value. All the obtained conversion values are four-digit hexadecimal numbers; Step A2: Take the last two hexadecimal digits of all the conversion values, convert them into decimal numbers to obtain four IP fields, and combine the four IP fields to form a candidate IP address.
[0009] Preferably, before executing the step B, the following steps are further included: Set a conflict counter and initial parameters for the indoor unit cache. The initial parameters include a candidate IP address, the number of times of the conflict counter, and an initial priority value. Initially, the number of times of the conflict counter is zero; The conflict counter is used to record the number of times the indoor unit retries due to conflicts; The initial priority value is used for the CAN bus arbitration operation. The CAN bus determines the priority of the indoor unit according to the initial priority value. The initial priority value is the last hexadecimal digit of the unique MAC address; When performing step B, the indoor unit accesses the CAN bus and sends a data packet to the outdoor unit. The data packet also includes the initial priority value.
[0010] Preferably, in step E, performing the backoff operation includes: After a conflict occurs in the indoor unit, update the number of times of the conflict counter of the indoor unit, calculate the waiting time of the indoor unit according to formula one, and the indoor unit can re-access the CAN bus only after the waiting time ends; --Formula one; Represents the waiting duration of the indoor unit; Represents the basic waiting unit duration, which is a preset value; n represents the updated number of times of the conflict counter; When the waiting duration of the indoor unit Exceeds the preset allowable waiting value, reset the number of times of the conflict counter of the indoor unit to zero.
[0011] Preferably, in step E, performing the CAN bus arbitration operation includes: When multiple indoor units access the CAN bus simultaneously, if there is no indoor unit that has not had a conflict, update the initial priority values of all indoor units accessing this time according to formula two below. The CAN bus compares the priorities of the indoor units according to the updated priority values, allows the indoor unit with the highest priority to access the CAN bus, cancels the access of other indoor units this time and determines that a conflict has occurred, updates the number of times of the conflict counter, and re-enters step E; Among them, the larger the priority value of the indoor unit, the lower the priority; --Formula two; Represents the updated priority value; Represents the unupdated priority value; Represents the binary number of the updated number of times value of the conflict counter; m represents The number of bits to shift left, which is a preset constant.
[0012] Preferably, in the step E, performing the set transmission time slot operation includes: After the indoor unit that has experienced a conflict is allowed to access the CAN bus, the indoor unit that has experienced a conflict sets the transmission time slot node according to Formula 3 and sends a data packet to the outdoor unit at the transmission time slot node; -- Formula 3; represents the set transmission time slot node, and the indoor unit that has experienced a conflict sends a data packet to the outdoor unit at this transmission time slot node; represents the IP field value obtained from the fourth conversion value; represents a preset byte constant, which is 64 or 8; % represents taking the remainder; represents the unit basic time slot divided within one time slot; n represents the number of times of the updated conflict counter; represents the length of the time slot unit that needs to be increased after a conflict occurs.
[0013] Preferably, in the step D, the outdoor unit sending a confirmation signal to the indoor unit includes: The validity period of the corresponding IP address.
[0014] Preferably, in the step D, after the indoor unit locks the candidate IP address and writes it into the non-volatile memory, it further includes: The indoor unit sends a heartbeat packet to the outdoor unit once at a preset interval. When the outdoor unit does not receive the heartbeat packet within the preset number of times, it is determined that the IP address of the indoor unit is invalid, and the indoor unit needs to re-execute steps A to E.
[0015] Advantages of the present invention over the prior art: The present invention obtains an IP address through hash conversion of the unique MAC address of the indoor unit, reduces the IP duplication rate by means of dispersing the IP address, calculates the retry waiting time after the conflict of the indoor unit through the number of conflicts and dynamically adjusts the priority to solve the problem of simultaneous conflicts of indoor units, and completely avoids conflicts by setting the transmission time slot node, thereby improving the efficiency and success rate of indoor unit address allocation. Description of the Drawings
[0016] Figure 1 is a flowchart of the indoor unit address allocation method for a multi-connected air conditioner of the present invention; Figure 2 is a schematic diagram of whether there is a conflict in the IP address occupancy of an embodiment of the present invention; Figure 3It is a schematic diagram of performing a backoff operation according to an embodiment of the present invention; Figure 4 It is a schematic diagram of performing a backoff operation according to another embodiment of the present invention; Figure 5 It is a schematic diagram of performing a CAN bus arbitration operation according to an embodiment of the present invention; Figure 6 It is a schematic diagram of performing a CAN bus arbitration operation according to another embodiment of the present invention. Detailed implementation manners
[0017] The technical solution of the present invention will be further described below with reference to the accompanying drawings and through specific implementation manners.
[0018] In order to enable those skilled in the art to better understand the solution of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without making creative efforts shall fall within the protection scope of the present invention.
[0019] The terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, device, product or terminal that includes a series of steps or units is not limited to the listed steps or units, but may optionally further include steps or units not listed, or may optionally further include other steps or units inherent to these processes, methods, products or terminals.
[0020] Referring to "embodiment" in this context means that a specific feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the present invention. The phrase appears in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art will explicitly and implicitly understand that the embodiments described herein can be combined with other embodiments.
[0021] This application proposes a method for allocating internal unit addresses of a multi-connected air conditioner, as Figure 1 shown, step A: When multiple air conditioner internal units are powered on, each internal unit reads the burned-in unique MAC address, inputs the unique MAC address into a hash function to obtain a conversion value, and converts the conversion value into a candidate IP address; Preferably, in the step A, it includes: Step A1: Divide the unique MAC address into four conversion intervals every three hexadecimal digits from left to right. In the first and second conversion intervals, fix the first two hexadecimal digits and input them into the hash function to obtain the first conversion value and the second conversion value respectively. In the third and fourth conversion intervals, randomly select two hexadecimal digits and input them into the hash function to obtain the third conversion value and the fourth conversion value. All the obtained conversion values are four-digit hexadecimal numbers; Step A2: Take the last two hexadecimal digits of all the conversion values, convert them into decimal numbers to obtain four IP fields, and combine the four IP fields to form a candidate IP address.
[0022] In this embodiment, the method generates a candidate IP address through the unique MAC address of each indoor unit, which can greatly reduce the problem of excessive repetition rate of the generated IP addresses. In actual production, the unique MAC address of each indoor unit is composed of 12 hexadecimal digits. The first six digits represent the unique identification code of the air conditioner manufacturer. Through the first six digits, the manufacturer of the air conditioner can be known, and the last six digits represent the unique identification code of this indoor unit. Specifically, after obtaining the unique MAC address, the method will get 12 hexadecimal digits. These 12 hexadecimal digits are divided into a conversion interval every three hexadecimal digits in the order from left to right, and a total of four conversion intervals are obtained. We will obtain the four fields of the IP address from these four conversion intervals. For the numbers in the first conversion interval and the second conversion interval, fix the first two hexadecimal digits of each conversion interval and input them into the hash function to obtain the first conversion value and the second conversion value. Therefore, the first six digits represent the unique identification code of the air conditioner manufacturer. Therefore, no matter which indoor unit it is, the first six digits are the same. So we fixedly take the first, second, fourth, and fifth digits as the first two fields of the IP address. For the third conversion interval and the fourth conversion interval, we randomly select any two digits in each interval and input them into the hash function to obtain the third conversion value and the fourth conversion value. The hash function used to convert the MAC address into the conversion value is the prior art. Which hash function is actually used shall be subject to actual production. A specific example will be used for explanation below; For example, a MAC address: "00-7B-89-66-2C-2B-00-1A-3B-12-34-56", "00-7B-89" corresponds to the first conversion interval, "66-2C-2B" corresponds to the second conversion interval, "00-1A-3B" corresponds to the third conversion interval, and "12-34-56" corresponds to the fourth conversion interval. The first conversion interval is fixed as "00-7B", the second conversion interval is fixed as "66-2C", any two are taken from the third conversion interval, such as "1A-3B", and any two are taken from the fourth conversion interval, such as "34-56". The numbers obtained from each conversion interval are input into the hash function for shift or exclusive OR operations, and the first conversion value is 0X00C0, the second conversion value is 0X80A8, the third conversion value is 0x1A55, and the fourth conversion value is 0XA5B3. Take the last two hexadecimal digits of each conversion value and convert them to decimal digits. The first conversion value takes C0 and converts to 192, the second conversion value takes A8 and converts to 168, the third conversion value takes 55 and converts to 85, and the fourth conversion value takes B3 and converts to 179. After combination, the candidate IP address is 192.168.85.179; The actual code of the hash function in one embodiment is expressed as: "mac_part = 0x3456 / / 0x represents hexadecimal, taking any two values 34-56 from the fourth conversion interval; hash_val = (mac_part<<8) ^ (mac_part>>4) / / Obtain 0xA5B3 through exclusive OR operation after shifting left by 8 bits and shifting right by 4 bits; ip_candidate = hash_val&0xFF / / Take the last two hexadecimal digits and convert them to decimal digits as the IP field, that is, B3 is converted to 179".
[0023] In another embodiment, since the first six digits of the MAC address are fixed, only the last three digits can be converted. That is, the first three fields of the IP addresses obtained from the first to the third conversion intervals of all indoor units are fixed, and only the numbers in the fourth conversion interval are subjected to hash conversion to obtain the last field of the IP address. This method is the most convenient, but if the duplication rate of IP addresses is to be minimized to the greatest extent, the last six digits still need to be converted.
[0024] Step B: The indoor unit accesses the CAN bus and sends a data packet to the outdoor unit. The data packet includes the candidate IP address and the unique MAC address; Preferably, before performing the said Step B, the following steps are further included: Set a conflict counter and the initial parameters of the indoor unit cache. The initial parameters include the candidate IP address, the number of times of the conflict counter, and the initial priority value. Initially, the number of times of the conflict counter is zero; The conflict counter is used to record the number of times the indoor unit retries due to conflicts; The initial priority value is used when performing the CAN bus arbitration operation. The CAN bus determines the priority of the indoor unit according to the initial priority value. The initial priority value is the last hexadecimal digit of the unique MAC address; When performing step B, the indoor unit accesses the CAN bus and sends a data packet to the outdoor unit. The data packet also includes the initial priority value.
[0025] In this embodiment, after all indoor units obtain the candidate IP address, they need to cache the initial parameters. The initial parameters include the candidate IP address, the number of times of the conflict counter, and the initial priority value. Among them, the conflict counter is used to record the number of times when subsequent indoor units have conflicts. Initially, the number of times of the conflict counter is 0. After one conflict occurs, the number of times of the conflict counter is updated to 1; the initial priority value takes the last hexadecimal digit of the unique MAC address. For example, in the above embodiment, the unique MAC address is "00-7B-89-66-2C-2B-00-1A-3B-12-34-56", and the last hexadecimal digit is 56. Then the initial priority value is expressed in hexadecimal notation as 0x5600; After all indoor units access the CAN bus, they need to send a data packet to the outdoor unit to let the outdoor unit verify whether the IP is available. The content format of the data packet can be expressed as:
[0026] Step C: When the indoor unit executes step B, the CAN bus detects whether there is a bit conflict. If so, the indoor unit enters step E; if not, it executes step D; In this embodiment, when the CAN bus detects a bit conflict, it means that multiple indoor units send data packets simultaneously, resulting in abnormal levels. This situation means that multiple indoor units have conflicts during the contention process. For the indoor units that have conflicts, they need to cancel the sending and exit the CAN bus, and perform the operations in step E; if no bit conflict is detected, it means that all indoor units have smoothly sent the data packets to the outdoor unit. At this time, only need to wait for the outdoor unit to verify whether the candidate IP address in the data packet is occupied.
[0027] Step D: The outdoor unit confirms whether the candidate IP address is occupied through the data packet. If it is not occupied, the outdoor unit sends a confirmation signal to the indoor unit and stores the unique MAC address and the candidate IP address of the indoor unit. After receiving the confirmation signal, the indoor unit locks the candidate IP address and writes it into the non-volatile memory; If the candidate IP address is occupied, the outdoor unit sends a signal to the indoor unit to regenerate the candidate IP, and the indoor unit enters step E; In this embodiment, as Figure 2 shown, when the candidate IP address in the verification data packet of the outdoor unit is not occupied by other indoor units, the outdoor unit will send an ACK confirmation signal to the indoor unit. The outdoor unit associates and stores the unique MAC address and the candidate IP address of the indoor unit. After receiving the ACK confirmation signal, the indoor unit will lock the candidate IP address and write it into the non-volatile memory, such as EEPROM. In this way, when the indoor unit is powered off and restarted, it will also first try to read and use the previously allocated IP from the non-volatile memory.
[0028] If the candidate IP address is occupied, the outdoor unit sends a signal to the indoor unit to regenerate the candidate IP. The indoor unit needs to regenerate a new candidate IP address and determine that this application has a conflict and needs to enter step E.
[0029] Preferably, in step D, the outdoor unit's reply confirmation signal to the indoor unit includes: The validity period of the corresponding IP address.
[0030] In this embodiment, the confirmation frame content of the ACK confirmation signal can be: [Allocated IP = 192.168.85.179 | Validity period = 24 hours | CRC check code]; By setting a validity period for the IP address, it is possible to prevent "zombie devices" from occupying valid addresses.
[0031] Preferably, in step D, after the indoor unit locks the candidate IP address and writes it into the non-volatile memory, it further includes: The indoor unit sends a heartbeat packet to the outdoor unit at a preset interval. When the outdoor unit does not receive the heartbeat packet within the preset number of times, it is determined that the IP address of the indoor unit is invalid, and the indoor unit needs to re-execute steps A to E.
[0032] In this embodiment, after the indoor unit locks the IP address, it will send a heartbeat packet to the outdoor unit at regular intervals. For example, it sends a heartbeat packet every 5 minutes (content: IP = 192.168.85.179 | Status normal). If the outdoor unit does not receive the heartbeat for 3 consecutive times (i.e., 15 minutes), it is determined that the IP address is invalid and the IP = 192.168.85.179 is recycled; the heartbeat packet can not only prevent valid addresses from being occupied, but also serve as network status monitoring.
[0033] Step E: Perform a backoff operation: The conflicting indoor unit can only reconnect to the CAN bus after the waiting time ends; Specifically, when a conflict occurs in the indoor unit, the number of times the conflict counter of the indoor unit is updated, and the waiting time of the indoor unit is calculated according to Formula 1. After the waiting time ends, the indoor unit can reconnect to the CAN bus; -- Formula 1; represents the waiting duration of the indoor unit; represents the basic waiting unit duration, which is a preset value; n represents the number of times the updated conflict counter; When the waiting duration of the indoor unit exceeds the preset allowable waiting value, the number of times of the conflict counter of the indoor unit is reset to zero.
[0034] In this embodiment, when a conflict occurs after the indoor unit accesses the CAN bus or is determined to be in conflict, it will not immediately retry to access, but needs to wait for a period of time before retrying to access the CAN bus. Because if it immediately accesses the bus after a conflict occurs, it may cause additional conflicts to other indoor units that are accessing the bus. At the same time, this application uses the conflict count to randomize the retry time, which can effectively avoid the conflicted indoor units from retrying simultaneously.
[0035] For example Figure 3 as shown, after the indoor unit A and the indoor unit C first access the bus and collide to form a conflict, the indoor unit A and the indoor unit C need to cancel the current transmission and wait for a period of time before retrying. According to the calculation of Formula 1 assuming that the basic waiting unit duration is preset to 5 ms according to the actual situation, and the indoor unit A has its first conflict and the updated conflict count n = 1, then the waiting duration of the indoor unit A is , that is, the indoor unit A needs to wait for 10 ms before retrying to access the bus; As Figure 4 shown, if Figure 3 the indoor unit A immediately accesses the bus after its first conflict, and then the indoor unit B first accesses the bus, then the indoor unit A may collide with the indoor unit B to form an additional conflict, resulting in a situation where the indoor unit A has continuous conflicts and retries, causing itself to be unable to send data packets and affecting other indoor units such as the indoor unit B from sending data packets.
[0036] Furthermore, when Figure 3 the indoor unit A has its first conflict and waits for 10 ms before accessing the bus for the second time, and at this time the indoor unit B first accesses the bus, it is still possible that as Figure 4 shown, after the indoor unit A accesses the bus for the second time, it collides with the indoor unit B to form a new conflict. This conflict is not considered an additional conflict. Then at this time, the indoor unit A needs to wait again, and the waiting duration is , that is, after the second conflict of the indoor unit A, it needs to wait for 20 ms before retrying to access the bus for the third time, while the indoor unit B is in its first conflict and needs to wait , before retrying to access the bus for the second time.
[0037] Furthermore, when the waiting duration of the indoor unit A exceeds the preset allowed waiting value, it means that the number of conflicts of the indoor unit A is too many. For example, after the indoor unit A has 6 conflicts, the waiting duration required is , and 160 ms exceeds the preset allowed waiting value, such as 100 ms. Since this waiting duration is too long, it will seriously affect the address allocation efficiency of the indoor unit A. Therefore, at this time, the number of conflicts of the indoor unit A needs to be reset to zero, and the indoor unit A only needs to wait . Subsequently, if the indoor unit A conflicts again, the number of conflicts will increase to 1 again.
[0038] Execute the CAN bus arbitration operation: When multiple indoor units access the CAN bus simultaneously, determine whether there is an indoor unit that has not had a conflict. If so, the CAN bus allows all indoor units that have not had a conflict to access the CAN bus and execute step B; if not, the CAN bus compares the priorities of all indoor units accessing this time, allows the indoor unit with the highest priority to access the CAN bus, cancels the current access of other indoor units and determines the current access of other indoor units as a conflict, and other indoor units re-enter step E; Specifically, it includes: When multiple indoor units access the CAN bus simultaneously, if there is no indoor unit that has not had a conflict, then update the initial priority values of all indoor units accessing this time according to the following formula two. The CAN bus compares the priorities of indoor units based on the updated priority values, allows the indoor unit with the highest priority to access the CAN bus, cancels the current access of other indoor units and determines it as a conflict, updates the number of times of the conflict counter, and re-enters step E; Among them, the indoor unit with a larger priority value has a lower priority; --Formula two; represents the updated priority value; represents the unupdated priority value; represents the binary number of the updated number of times of the conflict counter; m represents the number of bits shifted to the left, which is a preset constant.
[0039] In the prior art, the CAN bus has an ID arbitration function by itself. The CAN bus stipulates that the ID with a smaller value has a higher priority. Based on this, on the basis of the initial priority value, we calculate the priority value using the number of conflicts. The larger the priority value of the indoor unit, the lower the priority level. Therefore, in this embodiment, when multiple indoor units are connected to the bus at the same time, several situations may occur, such as Figure 5 As shown, the first situation is that the indoor units connected to the bus this time include those that have had conflicts and those that have not had conflicts (first access). For this situation, the CAN bus only allows the indoor units that have not had conflicts to access. Because according to the priority value calculation formula, the indoor units that have not had conflicts only have the initial priority value, and the initial priority value is the last hexadecimal digit of the MAC address. If we forcibly calculate according to the priority value calculation formula, this number has great randomness for the indoor units accessing the bus for the first time, resulting in only allowing the indoor unit with the smallest initial priority value to access among multiple indoor units accessing the bus for the first time, which is unfair to other indoor units accessing the bus for the first time. Therefore, the initial priority value has no reference significance for priority value calculation among the indoor units accessing the bus for the first time. Therefore, for the indoor units accessing the bus for the first time that have had conflicts and those that have not had conflicts, the bus only allows all indoor units that have not had conflicts to access, and other indoor units that have had conflicts are all recognized as conflict behaviors for this access, and need to cancel the transmission and calculate the waiting duration, and can retry after the waiting duration ends; The second situation is that none of the indoor units connected to the bus this time have had conflicts, such as Figure 2 As shown, all indoor units are accessing the bus for the first time; for this situation, as described above, it is meaningless to calculate the priority value for the indoor units accessing the bus for the first time, so all indoor units accessing the bus for the first time are also allowed to access the bus; As Figure 6 shown, the third situation is that all indoor units connected to the bus this time have had conflicts. For example, the initial priority values of indoor unit A and indoor unit B are the same, both are 0x3800, and the left shift bit number m is 13, and m is set according to the actual situation. Because what actually affects the priority value more is , only when is the same, will the initial priority value be considered; indoor unit B has sent two conflicts and is accessing the bus for the third time, and indoor unit A has had one conflict and is accessing the bus for the second time. Then the conflict number of indoor unit A is 1, that is , and the priority value is , the conflict number of indoor unit B is 2, that is , and the priority value is , , then the priority value of indoor unit A is less than that of indoor unit B, so the priority level of indoor unit A is higher than that of indoor unit B. The CAN bus arbitration allows indoor unit A to access, indoor unit B cancels the transmission, and is recognized as this conflict, and the conflict number of indoor unit B is updated to 3.
[0040] Execute the operation of setting the transmission time slot: When the indoor unit that has had a collision is allowed to access the CAN bus, the indoor unit that has had a collision needs to set the transmission time slot node and send a data packet to the outdoor unit at the transmission time slot node.
[0041] Specifically, it includes: When the indoor unit that has had a collision is allowed to access the CAN bus, the indoor unit that has had a collision sets the transmission time slot node according to Formula 3 and sends a data packet to the outdoor unit at the transmission time slot node; -- Formula 3; represents the set transmission time slot node, and the indoor unit that has had a collision sends a data packet to the outdoor unit at this transmission time slot node; represents the IP field value obtained from the fourth conversion value; represents a preset byte constant, which is 64 or 8; % represents taking the remainder; represents the unit basic time slot divided within a time slot; n represents the number of times of the updated collision counter; represents the length of the time slot unit that needs to be increased after the collision occurs.
[0042] In this embodiment, when the indoor unit that has had a collision is allowed to access the bus after the priority determination, there may still be other indoor units sending in the bus at this time, or other indoor units that have had a collision are also allowed to access the bus, resulting in a collision between the indoor unit that accesses the bus later and the indoor unit that accesses the bus earlier. Therefore, it is necessary to set the transmission time slot node and send at a specific transmission time node in sequence to avoid causing collisions; If the IP field value obtained from the fourth conversion value of the IP address of the indoor unit is 179, the preset byte constant takes 64, the unit basic time slot , the length of the time slot unit that needs to be increased after the collision occurs , the transmission time slot node of the indoor unit after the first collision ; the transmission time slot node after the second collision is .
[0043] It should be noted that when executing the operation of setting the transmission time slot, the outdoor unit broadcasts a time synchronization signal to the indoor unit every 10 ms, and all indoor units align their clocks according to the time synchronization signal.
[0044] The technical principles of the present invention have been described above in connection with specific embodiments. These descriptions are only for explaining the principles of the present invention and cannot be construed in any way as limiting the protection scope of the present invention. Based on the explanations herein, those skilled in the art can readily conceive of other specific embodiments of the present invention without creative efforts, and these embodiments will fall within the protection scope of the present invention.
Claims
1. A method for allocating addresses of indoor units of a multi-split air conditioner, characterized in that: Step A: When multiple air conditioner indoor units are powered on, each indoor unit reads the burned unique MAC address, inputs the unique MAC address into the hash function to obtain a conversion value, and converts the conversion value into a candidate IP address; Step B: The indoor unit is connected to the CAN bus and sends a data packet to the outdoor unit, the data packet includes a candidate IP address and a unique MAC address; Step C: When the indoor unit executes step B, the CAN bus detects whether there is a bit conflict. If yes, the indoor unit enters step E, otherwise, it executes step D; Step D: The outdoor unit confirms whether the candidate IP address is occupied through a data packet. If it is not occupied, the outdoor unit replies a confirmation signal to the indoor unit and stores the unique MAC address and candidate IP address of the indoor unit. After receiving the confirmation signal, the indoor unit locks the candidate IP address and writes it into the non-volatile memory. If the candidate IP address is occupied, the outdoor unit sends a signal to the indoor unit to regenerate the candidate IP address, and the indoor unit enters step E; Step E: Execute the backoff operation: the indoor unit that has conflict can reconnect to the CAN bus only after the waiting time is over; Execute CAN bus arbitration operation: when multiple indoor units are connected to the CAN bus at the same time, determine whether there is an indoor unit that has not had a conflict. If so, the CAN bus allows all indoor units that have not had a conflict to access the CAN bus and execute step B; if not, the CAN bus compares the priorities of all indoor units that are connected this time, allows the indoor unit with the highest priority to access the CAN bus, cancels the current access of other indoor units and regards the current access of other indoor units as a conflict, and the other indoor units re-enter step E; Execute the operation of setting the sending time slot: After the indoor unit that has had a conflict is allowed to access the CAN bus, the indoor unit that has had a conflict needs to set the sending time slot node and send data packets to the outdoor unit at the sending time slot node.
2. The method for allocating addresses of indoor units of a multi-split air conditioner according to claim 1, characterized in that: In the step A, it includes: Step A1: Divide every three hexadecimal digits of the unique MAC address from left to right into four conversion intervals. In the first and second conversion intervals, the first two hexadecimal digits are fixedly input into the hash function to obtain the first conversion value and the second conversion value. In the third and fourth conversion intervals, two hexadecimal digits are randomly input into the hash function to obtain the third conversion value and the fourth conversion value. All the conversion values obtained are four-digit hexadecimal digits. Step A2: Take the last two hexadecimal digits of all converted values, convert them into decimal digits to obtain four IP fields, and combine the four IP fields to form a candidate IP address.
3. The method for allocating addresses of indoor units of a multi-split air conditioner according to claim 2, characterized in that: Before executing step B, the method further includes executing the following steps: Setting a conflict counter, internal machine cache initial parameters, the initial parameters include candidate IP address, the number of conflict counters and initial priority value, initially, the number of conflict counters is zero; The conflict counter is used to record the number of times the internal machine retries due to conflicts; The initial priority value is used to perform CAN bus arbitration operations. The CAN bus determines the priority of the internal machine according to the initial priority value. The initial priority value is the last hexadecimal digit of the unique MAC address. When executing step B, the indoor unit is connected to the CAN bus to send a data packet to the outdoor unit, and the data packet also includes an initial priority value.
4. The method for allocating addresses of indoor units of a multi-split air conditioner according to claim 3, characterized in that: In the step E, performing the backoff operation includes: When a conflict occurs with the indoor unit, the number of times of the conflict counter of the indoor unit is updated, and the waiting time of the indoor unit is calculated according to Formula 1. The indoor unit can reconnect to the CAN bus only after the waiting time is over. --Formula 1; Indicates the waiting time of the indoor unit; Indicates the basic waiting unit duration, which is the preset value; n represents the number of updated conflict counters; When the waiting time of the indoor unit When the preset allowed waiting value is exceeded, the number of conflict counters of the indoor unit will be reset to zero.
5. The method for allocating addresses of indoor units of a multi-split air conditioner according to claim 3, characterized in that: In the step E, executing the CAN bus arbitration operation includes: When multiple indoor units are connected to the CAN bus at the same time, if there is no indoor unit that has not had a conflict, the initial priority values of all indoor units connected this time are updated according to the following formula 2. The CAN bus compares the priorities of the indoor units according to the updated priority values, and allows the indoor unit with the highest priority to access the CAN bus. The other indoor units cancel this access and are deemed to have a conflict. The number of conflict counters is updated, and the process re-enters step E. Among them, the indoor unit with a larger priority value has a lower priority; --Formula 2; Indicates the updated priority value; Indicates the priority value that has not been updated; A binary number representing the updated value of the conflict counter; m means The number of bits to shift left is a preset constant.
6. The method for allocating addresses of indoor units of a multi-split air conditioner according to claim 3, characterized in that: In the step E, performing the operation of setting the transmission time slot includes: When the indoor unit that has had a conflict is allowed to access the CAN bus, the indoor unit that has had a conflict sets the sending time slot node according to formula 3 and sends a data packet to the outdoor unit at the sending time slot node; --Formula 3; Indicates the set sending time slot node, where the indoor unit that has conflicted sends data packets to the outdoor unit; represents the IP field value obtained by the fourth conversion value; Indicates the preset byte constant, which is 64 or 8; % means taking the remainder; Indicates the unit basic time slot after division within a time slot; n represents the number of updated conflict counters; Indicates the unit length of the time slot that needs to be increased after a conflict occurs.
7. The method for allocating addresses of indoor units of a multi-split air conditioner according to claim 1, characterized in that: In step D, the outdoor unit replies a confirmation signal to the indoor unit, including: The validity period of the corresponding IP address.
8. The method for allocating addresses of indoor units of a multi-split air conditioner according to claim 1, characterized in that: In the step D, after the internal machine locks the candidate IP address and writes it into the non-volatile memory, the process further includes: The indoor unit sends a heartbeat packet to the outdoor unit at a preset interval. If the outdoor unit does not receive the heartbeat packet within the preset number of times, the IP address of the indoor unit is deemed invalid, and the indoor unit needs to re-execute steps A to E.
Citation Information
Patent Citations
Distribution method, distribution device, central air conditioning system and storage medium
CN110290231A
Bus resource allocation method and device and air conditioning system
CN111835609A
CAN bus communication network design method capable of avoiding conflicts
CN112532496A
Bus distributed indoor unit address allocation method for indoor unit and outdoor unit of air conditioner
CN119697157A
IP generation method, device, equipment and medium
CN119788643A