A self-organizing network method, device and equipment of an electrical appliance and a readable storage medium
By acquiring the identification and operating status parameters of electrical equipment, generating random parameters and priorities, and scheduling communication resources, the problems of low address allocation efficiency and high hardware overhead in the self-organizing network of electrical equipment are solved, and an efficient and reliable self-organizing network process is realized.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHEJIANG TENGEN ELECTRIC
- Filing Date
- 2025-09-28
- Publication Date
- 2026-07-21
AI Technical Summary
Existing self-organizing processes for electrical equipment suffer from low address allocation efficiency, easy conflicts, and high hardware overhead, making it difficult to simultaneously simplify operation, reduce costs, and improve network robustness.
By acquiring the identification information and operating status parameters of electrical equipment, generating random parameters, calculating priorities and generating contention information, scheduling communication resources, sending contention messages, determining master and slave roles and allocating communication addresses, a self-organizing network is realized.
It significantly reduces the probability of message collisions, improves the accuracy of address allocation and networking efficiency, avoids manual intervention and additional hardware overhead, and ensures the flexibility and robustness of networking.
Smart Images

Figure CN121174302B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of electrical equipment technology, and in particular to a method, apparatus, device, and readable storage medium for self-organizing networks of electrical equipment. Background Technology
[0002] Currently, with the development of power line carrier communication and intelligent appliance control systems, multi-device collaborative operation has become a common requirement. The self-organizing network capability of electrical appliances is particularly important in home energy management, building automation, and industrial control scenarios. The goal of a self-organizing network is to automatically establish a network topology under a unified communication link without manual intervention, achieving the division of master and slave roles and the allocation of communication addresses. Theoretically, an ideal self-organizing network should meet three basic requirements: address uniqueness, network reliability, and scalability. That is, even as the number of devices continues to expand, it should still ensure correct address allocation, low probability of message collisions, and overall system communication stability during the networking process.
[0003] There are three main types of existing self-organizing network methods: The first type uses DIP switches to assign addresses, but when there are many slave devices or long communication lines, address conflicts and assignment errors are prone to occur, and manual DIP operation is cumbersome. The second type presets a unique address code at the factory, and the master assigns addresses according to this address code. However, this method requires a one-to-one correspondence between the identification code and the assigned address, lacking flexibility and causing inconvenience in actual use. The third type uses a constant current source to send signals at the bus terminal, and the slave devices determine the address by collecting signal characteristics. Although this method solves the shortcomings of the first two methods to some extent, it increases hardware overhead and raises the system implementation cost. In summary, there is a clear contradiction between networking efficiency, reliability, and hardware complexity in existing technologies, making it difficult to simultaneously meet the needs of simplified operation, reduced costs, and improved network robustness. Summary of the Invention
[0004] In view of this, embodiments of this application provide a method, apparatus, device, and readable storage medium for self-organizing networks of electrical devices, which can effectively solve the problems of low address allocation efficiency, easy conflict, and high hardware overhead in the prior art.
[0005] In a first aspect, embodiments of this application provide a method for self-organizing a network of electrical devices, including: Obtain the identification information and operating status parameters of the target electrical equipment, and generate random parameters based on the identification information; The priority of the target electrical equipment is calculated based on the operating status parameters, and competition information is generated by combining the random parameters. Communication resources are scheduled based on the competition information and network scale information, and competition messages are sent within the scheduled transmission time slots; The master / slave role of the target electrical device is determined based on the interaction results of the competition messages, and the self-organizing network operation is completed through the allocation and confirmation of communication addresses.
[0006] In some embodiments, obtaining the identification information and operating status parameters of the target electrical device, and generating random parameters based on the identification information, includes: Collect the unique identification information of the target electrical device, combine it with the operating time, cumulative switching count and communication status parameters of the target electrical device, input the unique identification information into a random number generation function to obtain a random seed, and generate random delay parameters based on the random seed.
[0007] In some embodiments, the operating status parameters include at least the operating time, cumulative switching count, and communication status parameters of the target electrical device. The step of calculating the priority of the target electrical device based on the operating status parameters and generating competition information in conjunction with the random parameters includes: The ratio of the running time to the design life, the ratio of the cumulative number of switching operations to the maximum allowed number of switching operations, and the communication status parameters are combined according to preset weights to calculate the priority. The priority is then combined with the random parameters to form competition information.
[0008] In some embodiments, the step of scheduling communication resources based on the contention information and network scale information, and sending contention packets within the scheduled transmission time slot, includes: Under the periodic reference of the power grid frequency signal, the bus contention signal is monitored and the network scale information is obtained. The time slot allocation parameters are determined based on the network scale information. The transmission time slot of the target electrical device is determined based on the time slot allocation parameters, and a competition message containing the competition information is sent in the corresponding time slot.
[0009] In some embodiments, the step of monitoring bus contention signals and obtaining network size information under the periodic reference of the power grid frequency signal, and determining time slot allocation parameters based on the network size information, includes: The number of bus contention pulses is monitored and counted within multiple power grid frequency cycles to obtain the current number of competing devices. The number of time slots is calculated using a logarithmic function based on the number of competing devices, and the time slot width is determined by the ratio of the power frequency cycle length to the number of time slots. When the number of time slots in a single power frequency cycle is insufficient to accommodate all devices, multiple power frequency cycles are combined into a superframe to determine the superframe time slot allocation parameters.
[0010] In some embodiments, determining the transmission time slot of the target electrical device based on the time slot allocation parameters, and transmitting a contention message containing the contention information within the corresponding time slot, includes: The identification information of the target electrical device is used in a function operation with the time slot allocation parameters to determine a unique transmission time slot; At the start of the transmission time slot, the bus status is detected based on the reference time obtained from the zero-crossing point of the power frequency signal: When the bus is idle, a contention message containing the contention information is sent directly; When the bus is occupied, the contention message is sent in the corresponding transmission slot of the next cycle.
[0011] In some embodiments, determining the master / slave role of the target electrical device based on the interaction result of the contention message, and completing the ad hoc network operation through the allocation and confirmation of communication addresses, includes: When the target electrical device receives a contention message, the priority in the contention message is compared with the priority of the target electrical device to determine the master / slave role of the target electrical device; When the target electrical device is identified as the master device, a communication address is sent to the device in the slave device role. Based on the confirmation information returned by the slave device when it receives the communication address, poll and retry the remaining slave devices that have not returned confirmation information; After all slave devices have completed the communication address confirmation, the self-organizing network operation is completed.
[0012] Secondly, embodiments of this application provide a self-organizing network device for electrical equipment, comprising: The parameter generation module is used to obtain the identification information and operating status parameters of the target electrical equipment, and generate random parameters based on the identification information; The priority determination module is used to calculate the priority of the target electrical equipment based on the operating status parameters, and generate competition information in combination with the random parameters; The scheduling module is used to schedule communication resources based on the competition information and network scale information, and send competition packets within the scheduled transmission time slot; The networking module is used to determine the master / slave role of the target electrical device based on the interaction results of the contention messages, and to complete the self-organizing network operation through the allocation and confirmation of communication addresses.
[0013] Thirdly, embodiments of this application provide an electrical device, the electrical device including a processor and a memory, the memory storing a computer program, and the processor executing the computer program to implement the self-organizing network method of the electrical device described in the first aspect.
[0014] Fourthly, embodiments of this application provide a computer-readable storage medium, wherein when the computer program is executed on a processor, it implements the self-organizing network method of the electrical equipment described in the first aspect.
[0015] The embodiments of this application have the following beneficial effects: First, the identification information and operating status parameters of the target electrical equipment are obtained, and random parameters are generated based on the identification information to introduce initial competition randomness; second, the priority of the target electrical equipment is calculated according to the operating status parameters, and competition information is generated in combination with the random parameters, thereby reflecting the equipment's lifespan, reliability, and random disturbance characteristics during the competition phase; then, communication resource scheduling is performed according to the competition information and network scale information, and competition messages are sent in an orderly manner within the allocated transmission time slots to achieve distributed communication scheduling with controllable collision probability; finally, the master-slave role of the target electrical equipment is determined based on the interaction results of the competition messages, and the networking operation is completed through the allocation and confirmation of communication addresses, ensuring the integrity and scalability of the network structure. Through the scheme of this application, the probability of message collisions during the networking process can be significantly reduced, the accuracy of address allocation and networking efficiency can be improved; at the same time, manual intervention and additional hardware overhead are avoided, ensuring the flexibility and robustness of the network. Attached Figure Description
[0016] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 A flowchart of an embodiment of the self-organizing network method for electrical devices in this application is shown; Figure 2 A simplified implementation flowchart of the self-organizing network method for electrical equipment according to an embodiment of this application is shown; Figure 3 This illustration shows a framework diagram of an electrical device self-organizing network method according to an embodiment of this application; Figure 4 A detailed implementation flowchart of the self-organizing network method for electrical equipment according to an embodiment of this application is shown. Figure 5 A schematic diagram of a self-organizing network method for electrical equipment according to an embodiment of this application is shown. Detailed Implementation
[0018] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.
[0019] The components of the embodiments of this application described and illustrated in the accompanying drawings can be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of this application provided in the drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0020] In the following text, the terms "comprising," "having," and their cognates, which may be used in various embodiments of this application, are intended only to indicate a particular feature, number, step, operation, element, component, or combination thereof, and should not be construed as primarily excluding the presence of one or more other features, numbers, steps, operations, elements, components, or combinations thereof, or adding the possibility of one or more combinations thereof. Furthermore, the terms "first," "second," "third," etc., are used only for distinguishing descriptions and should not be construed as indicating or implying relative importance.
[0021] Unless otherwise specified, all terms used herein (including technical and scientific terms) shall have the same meaning as commonly understood by one of ordinary skill in the art to which the various embodiments of this application pertain. Terms (such as those defined in commonly used dictionaries) shall be interpreted as having the same meaning as in their contextual meaning in the relevant technical field and shall not be construed as having an idealized or overly formal meaning, unless clearly defined in the various embodiments of this application.
[0022] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0023] Considering the problems of low address allocation efficiency, easy conflicts, and high hardware overhead of electrical devices in existing technologies, this application proposes a self-organizing network method for electrical devices, such as... Figure 1As shown, after power-on, the device first synchronizes with the power grid. After successful synchronization, it enters the dynamic time slot allocation stage, where the system allocates transmission time slots based on the current network size and contention information. Subsequently, a time slot mapping operation is performed, mapping each device's unique identifier to the corresponding transmission time slot to ensure the rational allocation of channel resources. When each device sends messages according to the mapped time slots, collision-free message transmission can be achieved. Once all devices have completed communication interaction and network confirmation, the network is in the network completion state. Finally, the entire network switches to normal operation, and all electrical devices interact with each other under a unified communication protocol.
[0024] The following describes the self-organizing network method of this electrical device using some specific embodiments.
[0025] like Figure 2 As shown, the self-organizing network method of this electrical device includes the following steps: Step S100: Obtain the identification information and operating status parameters of the target electrical equipment, and generate random parameters based on the identification information.
[0026] The identification information refers to the unique identification data used to uniquely identify electrical devices during the networking process; it is the UID code or other unique serial number fixed at the factory. Operating status parameters refer to a set of parameters that reflect the device's lifespan, operating load, and communication reliability, including the current operating time, cumulative switching count, and communication status parameters. After the system powers on, the devices collect the aforementioned identification information and operating status parameters to generate random parameters for the contention phase. By introducing randomness in the initial stage, conflicts caused by all devices simultaneously sending competing packets can be avoided, thereby improving the stability and reliability of the ad hoc networking process.
[0027] In an optional embodiment, step S100 includes the following sub-steps: Collect the unique identification information of the target electrical equipment, combine it with the operating time, cumulative switching count and communication status parameters of the target electrical equipment, input the unique identification information into the random number generation function to obtain the random seed, and generate random delay parameters based on the random seed.
[0028] The random number generation function calculates a random seed based on the input unique identifier and operating status parameters. The random delay parameter, derived from the random seed, is a transmission waiting time used to stagger transmission times during power-up, reducing the probability of simultaneous bus access. The unique identifier is a UID code permanently embedded in the chip at the factory, which remains unique across the entire network. Exemplarily, the system first reads the UID after power-up and combines it with the device's current operating time. (in hours) Design life (Default 50,000 hours), cumulative number of throws / cuts Maximum number of throws allowed (Default 500,000 times), and communication status parameters. The success rate of the most recent 100 communications is used as the basis for inputting the above data into a random number generation function to obtain a random seed. Based on this random seed, random delay parameters are further calculated and generated to set different delay transmission times during the power-on waiting period. Each device will only send the first contention packet after the delay expires, thus achieving distributed packet scheduling. Furthermore, the distribution design of the random delay parameters satisfies the collision probability threshold. Constraints are imposed to ensure that the probability of message collisions is kept within an acceptable range.
[0029] Furthermore, the random delay parameter not only affects the sending order of contention packets but also ensures that the sending interval of packets is effectively spaced out in scenarios with a large number of devices, avoiding instantaneous bus overload. Simultaneously, combined with the input of running time, cumulative switching counts, and communication status parameters, it can also provide supporting data for subsequent priority calculations.
[0030] Step S200: Calculate the priority of the target electrical equipment based on the operating status parameters, and generate competition information by combining random parameters.
[0031] Operating status parameters refer to a set of parameters reflecting the lifespan, switching frequency, and communication link quality of the target electrical equipment, including operating time, cumulative switching counts, and communication status parameters. Priority is a measure of a device's position during the contention phase, used to determine the contention order of devices in ad hoc networks. By calculating priorities and combining them with random parameters, unique contention information can be generated for each device, thus reflecting the device's stability, reliability, and remaining lifespan advantages when sending contention messages.
[0032] In one alternative embodiment, such as Figure 3 As shown, step S200 includes the following sub-steps: The ratio of running time to design life, the ratio of cumulative switching counts to maximum allowable switching counts, and communication status parameters are combined and calculated according to preset weights to obtain priority. The priority is then combined with random parameters to form competition information.
[0033] Among them, priority is a quantification of a device's relative first-mover / first-selection capability during the competition phase; preset weight is a combination coefficient of three indicators: lifetime share, usage share, and communication reliability; competition information is a set of message fields formed by priority and random parameters, used to announce the device's competition status externally. The formula for calculating priority is:
[0034] in, Indicates priority. This indicates the current operating time of the device (in hours). Indicates the most recent power-on time (Unix timestamp). Indicates the design life (default 50,000 hours). This indicates the cumulative number of times the capacitor has been switched on and off. This indicates the maximum number of throws allowed (default 500,000). Indicates the communication success rate (last 100 communications). , , For the weighting coefficients, satisfying , to take as an example , , .
[0035] Demonstratively, runtime The design life is calculated cumulatively in hours. The default value is 50,000 hours; the ratio of these two values reflects the equipment's lifespan consumption; cumulative number of switching operations. With the maximum allowed number of cuts The ratio is used to measure the degree of loss caused by the switching action; communication status parameters The success rate of the most recent 100 communications is used to reflect the stability of the device's communication link. The system weights and combines the three types of indicators according to the aforementioned weighting coefficients to obtain a priority value. Subsequently, this priority value is combined with the random parameters generated in the previous step to form contention information, which is carried in the contention message. After the priority is combined with the random delay parameter, the contention message reflects the device's operating status while retaining random disturbance components, thereby avoiding the problem of the same device repeatedly acting as the master for a long time.
[0036] Furthermore, the priority calculation process is closely related to physical meaning: the longer a device operates, the closer it is to its design life, and the lower its priority; fewer cumulative switching operations indicate lower device wear and tear; and a higher communication success rate indicates stronger network control capabilities. By introducing these three types of indicators, it can be ensured that when there are many devices, those with stable operation, low wear and tear, and reliable communication will participate in host contention first. Simultaneously, the system also sets a conflict probability threshold. As a performance constraint, this ensures that the probability of collisions during priority arbitration and message contention remains within an acceptable range, thereby improving the robustness of the networking process.
[0037] Step S300: Based on the contention information and network scale information, communication resources are scheduled, and contention messages are sent within the scheduled transmission time slot.
[0038] Communication resource scheduling refers to the dynamic determination of channel usage order and time allocation strategy during ad hoc networking, based on the contention information of each device and the current network scale information, to ensure that all devices can send competing messages in an orderly manner under the condition of limited bus resources. A transmission time slot refers to a time slice allocated for a single device to send a message, based on the periodicity of the power frequency signal. By rationally scheduling communication resources and allocating a unique transmission time slot to each device, message conflicts can be effectively avoided, improving communication efficiency and reliability during the networking phase.
[0039] In one alternative embodiment, such as Figure 3 As shown, step S300 includes the following sub-steps: S301 listens to bus contention signals and obtains network scale information under the periodic reference of the power grid frequency signal, and determines time slot allocation parameters based on the network scale information.
[0040] Among them, the periodic reference of the power grid frequency signal ( This is used to provide a unified time base for all electrical devices; network size information refers to the number of competing devices detected within a preset observation window; time slot allocation parameters include at least the number of time slots within a single power frequency cycle. With time slot width When single-cycle capacity is insufficient, it also includes superframe parameters (the number of cycles contained in a superframe). and superframe duration For ease of understanding, this embodiment uses the following basic definition: power grid frequency. A single power frequency cycle The total number of system devices is recorded as If superframes are introduced, the superframe duration will be... .
[0041] Demonstratively, the system is used in multiple (3×) The number of contention pulses on the bus during the power frequency cycle is monitored, and the number of devices currently participating in the contention is counted. Based on the number of devices, the system needs to calculate the optimal number of time slots while satisfying the collision probability constraint and time slot width constraint. The following collision probability assessment and capacity selection are adopted: Collision probability (in a given number of time slots) (Below) can be represented as:
[0042] in, λ represents the number of time slots allocated, and given the number of time slots k, the collision probability (the probability of multiple devices simultaneously attempting to occupy the channel, leading to a collision) of devices competing for the channel; N is the number of devices participating in the competition, and λ is the average arrival rate. The frame period is used. This function can be used to evaluate the collision probability for a given number of time slots. The system uses a collision probability threshold. As a constraint, choose to satisfy... Minimum number of slots This yields the optimal configuration of the time slot capacity:
[0043] in, Find the smallest k that makes the following conditions true (i.e., find the smallest number of slots that satisfies Pcoll(k) < δ). A set of positive integers (the number of time slots k must be a positive integer); in other words, when the collision probability is sufficiently small (less than...). Finding a balance between "reliability (low collision probability)" and "minimizing the number of time slots (saving time resources)" is crucial. This formula allows us to calculate the optimal configuration that satisfies both reliability (low collision probability) and the most efficient use of time slots. At the same time, it satisfies timing constraints (such as when a minimum time slot limit is required): ; This is the minimum time slot width.
[0044] When the equipment scale is large (e.g., N≥8), engineering approximations can be used. To reduce the burden of real-time computing.
[0045] In obtaining Next, determine the time slot width:
[0046] When the number of time slots in a single power frequency cycle is insufficient to cover all equipment (i.e. When multiple power frequency cycles are combined into one frame, a superframe mechanism is introduced, and the number of cycles contained in the superframe is determined by the following formula:
[0047]
[0048] To facilitate understanding, a numerical example is given: Assume =32N, Target number of time slots per cycle =8, then:
[0049]
[0050] Therefore, a superframe contains 4 power frequency cycles with a total duration of 80ms; each of the 32 devices can obtain a unique transmission opportunity within the superframe, providing capacity guarantee for subsequent transmission time slot mapping and collision-free transmission.
[0051] S302, determine the transmission time slot of the target electrical device based on the time slot allocation parameters, and send a competition message containing competition information in the corresponding time slot.
[0052] Among them, the transmission time slot ( The time slot (p, s) refers to the unique time slice allocated to the target electrical device within the period / superframe structure. If a superframe mechanism is used, both the period number and the time slot number of the device must be determined simultaneously. Therefore, the relationship between the device's unique time slot number k and (period number, time slot number) (p, s) is defined as follows:
[0053]
[0054]
[0055] in, A hash operation is performed on the "User Identifier (UID)" to obtain a hash value (mapping irregular UIDs to a fixed range of values for subsequent "deterministic allocation"); through "hash + modulo", the "User UID" is mapped to a value between 0 and 1. An integer k between the two values is used to implement "each user corresponds to a unique resource index" (hash guarantees dispersion, and modulo guarantees that it falls within the resource range).
[0056] Divide the index k obtained in the first step by the number of time slots per subframe. Then, round down to obtain the subframe index p. The purpose of this step is to extract the subframe number that the device should be allocated from the "total resource index k" (because k covers the total range of "subframe + time slot"), divided by... Then, the integer part is the position of the subframe.
[0057] It is a modulo (remainder) operation. It refers to the quantity of more granular resources (such as "time slots" and "sub-blocks").
[0058] This formula takes k as an example. The remainder yields the fine-grained resource identifier 's' for "within the group / block". For example, in a group there are... In a time slot, s represents the specific time slot number corresponding to k within the group.
[0059] The overall approach involves using mathematical operations to break down a global index k into "coarse-grained groups p" and "fine-grained sub-resources s", thereby enabling hierarchical allocation and location of resources.
[0060] The above mapping ensures that each device within the same network obtains a unique (p,s) combination in a superframe.
[0061] As an example, the execution process is as follows: All equipment obtains a unified reference time through power frequency zero-crossing detection. ; When entering the current power frequency cycle, the device determines whether the cycle number is consistent with p obtained by mapping itself; If they match, then wait until the start of the s-th time slot in this cycle. The transmission start time is determined by the following formula:
[0062] exist The system detects the bus status: if it is idle, it immediately sends a contention message containing contention information; if it is occupied, it retryes in the corresponding time slot of the next power frequency cycle.
[0063] Combined with the example in S301 ( =32, =8, Each device has a unique (p,s) within the superframe; based on the timing and bus occupancy determination mentioned above, contention-based message transmission can be completed sequentially and without conflict within an 80ms superframe window. This distributed scheduling method, which uses the power frequency as the natural clock and combines hash mapping and occupancy postponement, enables the system to maintain good orderliness and robustness even in scenarios with a large number of devices and intense competition.
[0064] Step S400: Determine the master / slave role of the target electrical device based on the interaction results of the contention messages, and complete the self-organizing network operation through the allocation and confirmation of communication addresses.
[0065] In this context, the master and slave roles refer to the network control node (master) and the controlled node (slave) elected by a contention algorithm during the self-organizing network process. The master is responsible for subsequent communication resource scheduling, address allocation, and broadcasting to complete the network formation, while the slave participates in network communication after being allocated an address. By determining the master and slave roles through contention message exchange and combining the address allocation and confirmation process, automatic networking between multiple devices can be completed, avoiding manual intervention and improving the system's adaptability and reliability.
[0066] In an optional embodiment, step S400 includes the following sub-steps: S401: When the target electrical device receives a contention message, the priority in the contention message is compared with the priority of the target electrical device to determine the master / slave role of the target electrical device.
[0067] The contention message carries priority and randomness-related fields; the master and slave roles refer to the master device responsible for control and the slave device responsible for controlled communication, respectively. Exemplarily, after a target electrical device detects a contention message sent by another device, it parses the priority value contained in the message and compares it with its own priority. When it detects that another device has a higher priority than its own, the target device automatically enters the slave candidate state; when its own priority is the highest and the random delay has expired, it becomes the master candidate. Through this mechanism, the entire network can quickly determine a unique master in scenarios where multiple devices compete in parallel, avoiding multi-master conflicts.
[0068] S402: When the target electrical device is identified as the master device, a communication address is sent to the device in the slave device role.
[0069] In this context, the communication address is an identifier used to distinguish and address devices within the network; address allocation is the process by which the host issues and confirms addresses. For example, after self-confirmation, the host first reads the unique identifier (UID) of the slave device and, in conjunction with its maintained address pool, assigns a unique communication address to each slave. Address allocation uses either sequential allocation or hash mapping to ensure address uniqueness within the same network. During the allocation process, the host broadcasts communication address messages via the bus. Each slave, upon receiving the message, records its assigned address for subsequent point-to-point communication.
[0070] S403: Based on the confirmation information returned by the slave device when it receives the communication address, perform polling and retrying on the remaining slave devices that have not returned confirmation information.
[0071] The acknowledgment message is a receipt from the slave device indicating the address received. Polling retry is a mechanism whereby the master device triggers retransmission and acknowledgment for each unacknowledged node when no acknowledgment is received within a preset time window. For example, after receiving the communication address assigned by the master, the slave device immediately returns an acknowledgment message to notify the master that the address allocation was successful. When the master device does not receive acknowledgment messages from some slave devices within the preset time window, it will poll and retry these unacknowledged slave devices, sending address acknowledgment requests one by one until all slave devices return acknowledgment messages. This mechanism ensures that every slave device in the network has a valid communication address, avoiding incomplete network configurations due to packet loss from individual devices.
[0072] S404 completes the self-organizing network operation after all slave devices have confirmed their communication addresses.
[0073] The network completion message / broadcast is a network establishment signal published by the host to the entire network, used to notify all nodes to enter normal communication. For example, after receiving acknowledgment messages from all slave devices, the host broadcasts a network completion message to the entire network. This message includes fields such as the host address, the number of slave devices, and an acknowledgment flag. Upon receiving this message, all devices enter normal communication operation. This broadcast confirmation of network completion ensures that the entire network topology has been established, and all devices can interact with data under a unified communication protocol.
[0074] Understandably, such as Figure 4 As shown, the detailed implementation process of the self-organizing network method for electrical devices in this embodiment includes: First, the system calculates the dynamic priority of the target electrical device and reads the chip's unique identifier (UID) to create a random seed; based on the random seed, a random delay parameter is generated, and after the delay expires, it is determined whether the bus is idle. If the bus is idle, a contention message is sent; if the bus is occupied, the next round of random delay is entered; after the contention message is sent, the device makes a judgment based on the priority of the received message: when a message with a higher priority than itself is received, the device enters the slave state; when a message with the same priority as itself is received, further arbitration is conducted through random delay, and if this fails, the device enters the slave state; when a message with a lower priority than itself is received or no response from a higher priority device is received in the contention, the device remains in the master candidate state; after the master confirms its own status, it further completes the communication address allocation and slave confirmation. If some slaves do not return confirmation information, the master completes the confirmation through a polling retry mechanism; when all slaves complete the communication address confirmation, the master broadcasts the network completion information, and the network enters a stable master-slave structure. This detailed flowchart visually illustrates the complete logic of random delay control, contention message transmission, priority arbitration, and master-slave role determination, which corresponds one-to-one with the content of the implementation examples of steps S100 to S404.
[0075] Figure 5 A schematic diagram of a self-organizing network device for an electrical appliance according to an embodiment of this application is shown. Exemplarily, the self-organizing network device 100 for the electrical appliance includes: The parameter generation module 110 is used to acquire the identification information and operating status parameters of the target electrical equipment, and generate random parameters based on the identification information; The level determination module 120 is used to calculate the priority of the target electrical equipment based on the operating status parameters, and generate competition information in combination with the random parameters; The scheduling module 130 is used to schedule communication resources according to the competition information and network scale information, and send competition messages within the scheduled transmission time slot; The networking module 140 is used to determine the master / slave role of the target electrical device based on the interaction results of the contention messages, and to complete the self-organizing network operation through the allocation and confirmation of communication addresses.
[0076] It is understood that the apparatus of this embodiment corresponds to the method of the above embodiments, and the options in the above embodiments are also applicable to this embodiment, so they will not be described again here.
[0077] This application also provides an electrical device, such as (1) a smart switch / smart socket, which is suitable for smart power control devices in home or building automation and supports functions such as remote control, timed tasks, and energy consumption statistics. (2) a smart lighting device, such as smart LED lights, dimmers, and lighting controllers, which supports unified scheduling and scene mode linkage after networking. (3) a household appliance, such as a smart air conditioner, refrigerator, washing machine, and water heater, which supports energy management, status reporting, and collaborative operation. (4) an industrial control device, such as a PLC (programmable logic controller), sensor, actuator, and motor driver, which is suitable for device self-networking in the Industrial Internet of Things (IIoT) scenario. (5) a power management device, such as a smart meter, power quality monitoring device, photovoltaic inverter, and energy storage system controller, which supports collaborative operation and data acquisition of distributed energy systems. (6) a security monitoring device, such as a smart door lock, camera, smoke alarm, and gas detector, which supports linkage alarm and status synchronization after networking. (7) an electric vehicle charging pile, which supports communication coordination, load balancing, remote monitoring, and management between multiple charging piles. (8) The smart home hub gateway serves as the main device of the local network, coordinating communication and task scheduling between various sub-devices.
[0078] Exemplarily, the electrical device includes a processor and a memory, wherein the memory stores a computer program, and the processor executes the computer program to enable the electrical device to perform the functions of the various modules in the above-described method or apparatus. The processor can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, including at least one of a Central Processing Unit (CPU), Graphics Processing Unit (GPU), Network Processor (NP), Digital Signal Processor (DSP), Application-Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor can be a microprocessor or any conventional processor, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The memory can be, but is not limited to, Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), etc. The memory is used to store computer programs, and the processor can execute the computer programs accordingly after receiving execution instructions.
[0079] This application also provides a computer-readable storage medium for storing the computer program used in the aforementioned electrical device. For example, the computer-readable storage medium may include, but is not limited to, various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0080] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative; for example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that, in alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0081] In addition, the functional modules or units in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0082] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a smartphone, personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application.
[0083] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
Claims
1. A method for self-organizing networks of electrical equipment, characterized in that, The method includes: Obtain the identification information and operating status parameters of the target electrical device. The operating status parameters include at least the operating time, cumulative switching count, and communication success rate of the target electrical device. Generate random delay parameters based on the identification information and the operating status parameters. The priority of the target electrical equipment is calculated based on the operating status parameters, and competition information is generated by combining the random delay parameters. Under the periodic reference of the power grid frequency signal, the bus contention signal is monitored and the network scale information is obtained. The time slot allocation parameters are determined based on the network scale information, and the transmission time slot of the target electrical device is determined based on the time slot allocation parameters. A contention message containing the contention information is sent in the corresponding time slot. The priority in the contention message is compared with the priority of the target electrical device to determine the master / slave role of the target electrical device, and the self-organizing network operation is completed through the allocation and confirmation of communication addresses. The network scale information refers to the number of competing devices detected within a preset observation window; the time slot allocation parameters include at least the number of time slots and the time slot width within a single power frequency cycle. The step of determining the time slot allocation parameters based on the network scale information includes: calculating the optimal number of time slots based on the number of devices, provided that the conflict probability satisfies the conflict probability constraint and the time slot width satisfies the time slot width constraint; wherein, given the number of time slots, the conflict probability of devices competing for the channel is calculated based on the number of devices participating in the competition, and the minimum number of time slots with the conflict probability less than the conflict probability threshold is selected; and the time slot width is determined based on the minimum number of time slots. The formula for calculating the priority of the target electrical equipment is as follows: In the formula, Indicates priority. Indicates the current running time of the device. Indicates the time of the most recent power-on. Indicates the design life. This indicates the cumulative number of times the capacitor has been switched on and off. Indicates the maximum number of throws allowed. Indicates the communication success rate. , , For the weighting coefficients, satisfying .
2. The self-organizing network method for electrical equipment according to claim 1, characterized in that, The step of acquiring the identification information and operating status parameters of the target electrical device, and generating random delay parameters based on the identification information and operating status parameters, includes: Collect the unique identification information of the target electrical device, combine it with the operating time, cumulative switching count and communication status parameters of the target electrical device, input the unique identification information into a random number generation function to obtain a random seed, and generate random delay parameters based on the random seed.
3. The self-organizing network method for electrical equipment according to claim 1, characterized in that, The process of listening to bus contention signals and obtaining network scale information based on the periodic reference of the power grid frequency signal includes: The number of bus contention pulses is monitored and counted within multiple power grid frequency cycles to obtain the current number of competing devices. Determining the time slot width based on the minimum number of time slots includes: The time slot width is defined as the ratio of the power frequency cycle length to the minimum number of time slots.
4. The self-organizing network method for electrical equipment according to claim 3, characterized in that, The method further includes: When the number of time slots in a single power frequency cycle is insufficient to accommodate all devices, multiple power frequency cycles are combined into a superframe to determine the superframe time slot allocation parameters.
5. The self-organizing network method for electrical equipment according to claim 1, characterized in that, The step of determining the transmission time slot of the target electrical device based on the time slot allocation parameters, and transmitting a contention message containing the contention information within the corresponding time slot, includes: The identification information of the target electrical device is used in a function operation with the time slot allocation parameters to determine a unique transmission time slot; At the start of the transmission time slot, the bus status is detected based on the reference time obtained from the zero-crossing point of the power frequency signal: When the bus is idle, a contention message containing the contention information is sent directly; When the bus is occupied, the contention message is sent in the corresponding transmission slot of the next cycle.
6. The self-organizing network method for electrical equipment according to claim 1, characterized in that, The process of comparing the priority in the contention message with the priority of the target electrical device to determine the master / slave role of the target electrical device, and completing the ad hoc network operation through the allocation and confirmation of communication addresses, includes: When the target electrical device receives a contention message, the priority in the contention message is compared with the priority of the target electrical device to determine the master / slave role of the target electrical device; When the target electrical device is identified as the master device, a communication address is sent to the device in the slave device role. Based on the confirmation information returned by the slave device when it receives the communication address, poll and retry the remaining slave devices that have not returned confirmation information; After all slave devices have completed the communication address confirmation, the self-organizing network operation is completed.
7. A self-organizing network device for electrical equipment, characterized in that, include: The parameter generation module is used to obtain the identification information and operating status parameters of the target electrical equipment. The operating status parameters include at least the operating time, cumulative switching count, and communication success rate of the target electrical equipment, and generate random delay parameters based on the identification information and the operating status parameters. The priority determination module is used to calculate the priority of the target electrical equipment based on the operating status parameters, and generate competition information in combination with the random delay parameters; The scheduling module is used to listen to bus contention signals and obtain network scale information under the periodic reference of the power grid frequency signal, determine time slot allocation parameters based on the network scale information, determine the transmission time slot of the target electrical device based on the time slot allocation parameters, and send a contention message containing the contention information in the corresponding time slot. The networking module is used to compare the priority in the contention message with the priority of the target electrical device to determine the master / slave role of the target electrical device, and to complete the self-organizing network operation through the allocation and confirmation of communication addresses; The network scale information refers to the number of competing devices detected within a preset observation window; the time slot allocation parameters include at least the number of time slots and the time slot width within a single power frequency cycle. The step of determining the time slot allocation parameters based on the network scale information includes: calculating the optimal number of time slots based on the number of devices, provided that the conflict probability satisfies the conflict probability constraint and the time slot width satisfies the time slot width constraint; wherein, given the number of time slots, the conflict probability of devices competing for the channel is calculated based on the number of devices participating in the competition, and the minimum number of time slots with the conflict probability less than the conflict probability threshold is selected; and the time slot width is determined based on the minimum number of time slots. The formula for calculating the priority of the target electrical equipment is as follows: In the formula, Indicates priority. Indicates the current running time of the device. Indicates the time of the most recent power-on. Indicates the design life. This indicates the cumulative number of times the capacitor has been switched on and off. Indicates the maximum number of throws allowed. Indicates the communication success rate. , , For the weighting coefficients, satisfying .
8. An electrical appliance, characterized in that, The electrical device includes a processor and a memory, the memory storing a computer program, and the processor executing the computer program to implement the self-organizing network method of the electrical device according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, It stores a computer program, which, when executed on a processor, implements the self-organizing network method for electrical equipment according to any one of claims 1-6.