Scheduling method and apparatus for multi-node communication system, and multi-node communication system
By introducing a listening state, device serial number backoff delay, and identity declaration mechanism into a multi-node communication system, the master device is identified and its address is allocated. A unified time base is established, which solves the communication instability and reliability problems in the multi-node communication system and achieves orderly communication scheduling and stability improvement.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN POWEROAK NEWENER CO LTD
- Filing Date
- 2026-04-30
- Publication Date
- 2026-06-02
AI Technical Summary
In multi-node communication systems, existing technologies struggle to guarantee the stability and reliability of communication between multiple similar electronic devices. Especially in a shared communication bus environment, as the number of system nodes or their operating status changes, communication efficiency decreases, affecting the system's operational stability and reliability.
By entering a listening state after the electronic device is powered on, parsing bus messages, obtaining the device serial number and performing a backoff delay, broadcasting an identity declaration frame, identifying candidate master devices and allocating addresses, and establishing a unified set of device serial numbers and a time base, orderly communication scheduling is achieved.
It improves the stability of communication processes and the reliability of system operation in a shared communication bus environment, reduces bus resource contention, and enhances the system's self-organization capability and information consistency.
Smart Images

Figure CN122137768A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of communication and interaction technology, and specifically relates to a scheduling method, apparatus and multi-node communication system for a multi-node communication system. Background Technology
[0002] In multi-node distributed control scenarios such as energy storage systems and industrial control systems, multiple similar electronic devices (taking energy storage systems as an example, these devices could be multiple energy storage inverters connected in AC parallel or multiple battery packs connected in DC parallel) typically need to interact with each other via a shared communication bus (such as a CAN bus or RS-485 bus) to achieve state synchronization, collaborative control, and operation management. Because shared buses offer advantages such as simple wiring, high real-time performance, and support for multiple node access, they are widely used in scenarios involving parallel operation of multiple devices.
[0003] In such multi-node communication systems, to reduce development and maintenance costs, all electronic devices typically use the same software programs and a unified communication mechanism. When multiple electronic devices are connected to the same shared communication bus, each device sends status messages at the same time interval after power-on, causing continuous data frame collisions (commonly known as "packet collisions") on the shared bus. This results in decreased communication efficiency, bus load saturation, and even system communication anomalies, seriously threatening the stability and reliability of system operation.
[0004] In the process of developing this application, the inventors discovered at least the following problems in the prior art: In existing multi-node communication systems, multiple devices typically rely on fixed communication parameters to send bus messages. However, in a shared communication bus environment, as the number of system nodes or their operating states change, existing communication methods struggle to ensure stable coordination of communication between multiple similar electronic devices, easily leading to decreased bus communication efficiency and affecting the overall reliability of the system. Furthermore, in application scenarios with dynamically changing multi-nodes, existing communication methods still fall short in terms of system scalability and operational stability, making it difficult to meet the requirements of multi-node communication systems for communication orderliness and system reliability. Summary of the Invention
[0005] To address the aforementioned issues, this application provides a scheduling method, apparatus, and system for a multi-node communication system, thereby enabling orderly communication scheduling among multiple electronic devices of the same type in a multi-node communication system, and improving the stability of the communication process and the reliability of system operation in a shared communication bus environment.
[0006] To solve the above-mentioned technical problems, one technical solution adopted in this application is: providing a scheduling method for a multi-node communication system, applied to a multi-node communication system including various electronic devices of the same type, the method including the following steps: S1. After each electronic device is powered on, each electronic device enters a listening state and parses the bus messages received in the listening state according to a preset mode decision rule to obtain message parsing results; S2. When the message parsing results meet the preset mode decision conditions, the device serial number corresponding to each electronic device is obtained, and a backoff delay operation is performed on each electronic device according to the device serial number; after each electronic device completes the backoff delay operation, an identity declaration frame corresponding to each electronic device is broadcast, and a set of device serial numbers is obtained according to the identity declaration frame; wherein, the identity declaration frame is generated based on the device serial number; S3. The set of device serial numbers is sorted to obtain a target set of device serial numbers, and the device serial number is determined according to the target set of device serial numbers. Electronic devices that meet preset candidate conditions are designated as candidate master devices, and other electronic devices are designated as slave devices. The candidate master device broadcasts a master device announcement frame, enabling each slave device to perform objection negotiation based on the announcement frame, generating and sending a negotiation result frame to the candidate master device. The candidate master device parses the negotiation result frame to obtain a protocol parsing result. When the negotiation parsing result meets preset election conditions, the candidate master device is determined as the target master device, and a first target address is allocated to it. S4. Based on the target device sequence number set, the target master device allocates addresses to each slave device in sequence, obtaining address allocation results, and generates an address allocation queue based on the address allocation results and the first target address. S5. The target master device broadcasts a synchronization reference frame to each slave device, enabling each slave device to obtain a target time reference based on the synchronization reference frame. S6. Based on the address allocation queue and the target time reference, the target master device performs a relay-style sequential message transmission operation to establish periodic communication.
[0007] To solve the above-mentioned technical problems, another technical solution adopted in this application is: providing a scheduling device for a multi-node communication system, applied to a multi-node communication system including various electronic devices of the same type. The device includes: a message listening module, which is used to parse the bus messages received in the listening state according to preset mode decision rules after each electronic device is powered on, and obtain message parsing results; an identity collection module, which is used to obtain the device serial number corresponding to each electronic device when the message parsing results meet preset mode decision conditions, and perform backoff delay operation on each electronic device according to the device serial number; after each electronic device completes the backoff delay operation, it broadcasts the identity declaration frame corresponding to each electronic device, and obtains the device serial number set according to the identity declaration frame; wherein, the identity declaration frame is generated based on the device serial number; and a target master device election module, which is used to sort the device serial number set to obtain a target device serial number set, and determine the device serial number set based on the target device serial number set. Electronic devices meeting preset candidate conditions are designated as candidate master devices, and other electronic devices are designated as slave devices. The candidate master device broadcasts a master device announcement frame, enabling each slave device to perform objection negotiation based on the announcement frame, generating and sending a negotiation result frame to the candidate master device. The candidate master device parses the negotiation result frame to obtain a protocol parsing result. When the negotiation parsing result meets preset election conditions, the candidate master device is determined as the target master device, and a first target address is allocated to it. An address allocation module is used to allocate addresses to each slave device sequentially based on the target device sequence number set, obtaining address allocation results, and generating an address allocation queue based on the address allocation results and the first target address. A time synchronization module is used for the target master device to broadcast a synchronization reference frame to each slave device, enabling each slave device to obtain a target time reference based on the synchronization reference frame. A periodic communication establishment module is used for the target master device to perform relay-style sequential message sending operations based on the address allocation queue and the target time reference, establishing periodic communication.
[0008] To solve the above-mentioned technical problems, another technical solution adopted in the embodiments of this application is: to provide a multi-node communication system, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the above-mentioned method.
[0009] Unlike related technologies, this application provides a scheduling method, apparatus, and system for a multi-node communication system. By monitoring power-on and making mode decisions, electronic devices can perceive network status and select appropriate communication paths, thereby reducing uncertainty in the initialization phase. Through a backoff delay and identity declaration mechanism based on device serial numbers, distributed collection of device information is achieved, forming a unified set of device serial numbers, providing a consistent basis for subsequent scheduling. By sorting the set of device serial numbers and determining the target master device and allocating addresses, each electronic device logically forms a clear role division and sequence relationship, providing a deterministic execution basis for the communication process. By establishing a unified time base, the impact of timing deviations between devices on communication is reduced. Message transmission is organized based on address allocation queues and time bases, enabling each device to form an ordered communication process on the timeline, reducing bus resource contention. Based on the synergistic effect of the above processes, through ordered scheduling design of the multi-node communication process, the communication behavior of each electronic device on the shared communication bus changes from disordered competition to controlled collaboration, thereby improving the stability and reliability of system communication. Attached Figure Description
[0010] One or more embodiments are illustrated by way of example with reference to the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements having the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.
[0011] Figure 1 This is a flowchart of a scheduling method for a multi-node communication system provided in an embodiment of this application; Figure 2 This is a schematic diagram of the structure of a scheduling device for a multi-node communication system provided in an embodiment of this application; Figure 3 This is a schematic diagram of the hardware structure of a multi-node communication system provided in an embodiment of this application. Detailed Implementation
[0012] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and thoroughly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0013] It should be noted that, unless otherwise specified, the various features in the embodiments of this application can be combined with each other, all of which are within the protection scope of this application. Furthermore, although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device schematic diagram or the order in the flowchart.
[0014] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and are not used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and are not limited in number; for example, a first object can be one or more.
[0015] Unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of this application.
[0016] Please see Figure 1 , Figure 1 This is a flowchart illustrating a scheduling method for a multi-node communication system provided in an embodiment of this application. Figure 1 As shown, this method is applied to a multi-node communication system, which includes various electronic devices of the same type. The method includes steps S1-S6: S1: After each electronic device is powered on, it enters a listening state and parses the bus messages received in the listening state according to the preset mode decision rules to obtain the message parsing results.
[0017] After powering on, each electronic device first switches to a continuous T_listen (typical value 200ms) communication listening operation state. This listening state means that the device's communication transmission function is suppressed, and only the bus reception and local analysis and processing capabilities are retained. In this state, the device will not actively send any periodic messages, but only continuously receive and buffer data frames on the shared communication bus (such as CAN bus, RS-485 bus).
[0018] In listening mode, the device performs real-time parsing of received bus messages. A bus message refers to a standardized data frame transmitted on a shared communication bus, which at least contains basic communication elements such as a message identifier (indicating the sending source and function type), data fields, and timestamps or reception order information. When parsing these messages, the device focuses on extracting structural information related to communication organization, such as the source address field carried in the message identifier and the time interval characteristics between adjacent messages.
[0019] Based on this, the device judges the parsing results according to preset mode decision rules to obtain the judgment result. These mode decision rules refer to a set of judgment logic used to identify the current network communication operating state. Their core basis includes two types of characteristics: first, the structural characteristics of the message sequence, i.e., whether continuously received periodic messages exhibit a sequence structure where the source address field increases cyclically according to a fixed rule (e.g., address 1 → address 2 → address 3 → address 1 →…); second, the time interval characteristics of message arrival, i.e., whether the time interval between adjacent messages is stable and consistent with the preset relay interval. When the device continuously detects a message sequence that simultaneously satisfies the above structural and time characteristics within T_listen, it determines that a stable and orderly relay communication process exists in the current network. When the device continuously fails to detect a message sequence that simultaneously satisfies the above structural and time characteristics within T_listen, it determines that the network is in an idle or uninitialized state.
[0020] Based on the determination result, a message parsing result is generated. This message parsing result is used to characterize the current network state, which includes at least two state types: the first is "ordered relay communication already exists," corresponding to the detection of a message sequence that meets the preset mode decision rules within T_listen; the second is "no valid relay communication detected," corresponding to the failure to continuously detect a message sequence that meets the rules after T_listen ends. This message parsing result serves as the basis for subsequent control, driving the system's path selection in subsequent processes: when it is determined that ordered relay communication exists, the device jumps to the new device hot-join process to avoid interfering with the existing network; when it is determined that no valid relay communication is detected, step S2 is entered, thereby realizing adaptive traffic distribution control of the system's operating state.
[0021] By introducing a controlled listening state after each electronic device is powered on, the devices do not participate in message transmission during the communication initialization phase, but only receive and analyze data on the shared bus. This avoids disordered communication behavior when the network status is unclear, reducing the risk of communication interference during the initialization phase. Simultaneously, by jointly analyzing the structural and timing characteristics of the received bus messages and generating message parsing results reflecting the network operating status based on preset mode decision rules, each device can identify whether the current network is in an ordered communication state or an idle state without external intervention, thus providing a clear status basis for subsequent system processes. Therefore, the system can achieve adaptive identification and traffic distribution of communication status at the initial startup stage, providing a stable basis for subsequent ordered networking or dynamic access, and improving the reliability and operational determinism of the system initialization phase.
[0022] S2: When the message parsing result meets the preset mode decision conditions, obtain the device serial number corresponding to each electronic device, and perform a backoff delay operation on each electronic device according to the device serial number; after each electronic device completes the backoff delay operation, broadcast the identity declaration frame corresponding to each electronic device, and obtain the device serial number set according to the identity declaration frame; wherein, the identity declaration frame is generated based on the device serial number.
[0023] The process of obtaining the device serial number corresponding to each electronic device and performing a backoff delay operation on each electronic device based on the device serial number includes: obtaining the device serial number corresponding to each electronic device; determining the value of a preset number of digits in the device serial number as the first delay time corresponding to each electronic device based on the device serial number, and delaying each electronic device for the first delay time.
[0024] The process includes: after each electronic device completes the backoff delay operation, it broadcasts an identity declaration frame corresponding to each electronic device, and obtains a set of device serial numbers based on the identity declaration frame. This process includes: after each electronic device completes the backoff delay operation, it executes an information synchronization process with a preset information synchronization period. The information synchronization process includes: within the preset identity broadcast period, each electronic device broadcasts an identity declaration frame corresponding to each electronic device; at the same time, each electronic device extracts the device serial number from the received identity declaration frame, and obtains a set of device serial numbers based on the device serial number.
[0025] After T_listen in step S1, a judgment is made based on the message parsing result output in step S1. When the message parsing result meets the preset mode decision conditions, it indicates that the current network has not detected a valid ordered relay communication sequence, the system is in an idle or uninitialized state, and each electronic device enters the distributed initialization networking process.
[0026] Under this premise, each electronic device obtains its corresponding device serial number, which corresponds to a unique serial number (SN) used to distinguish different electronic devices in a multi-node communication system. Subsequently, each electronic device performs a backoff delay operation based on its obtained serial number. This backoff delay operation is used to distribute and control the initial communication behavior of each electronic device along the timeline, avoiding communication conflicts caused by simultaneous transmissions from multiple devices. It can be understood that each electronic device extracts a preset number of bits from its SN as the first delay time. The preset number of bits refers to the last two bits of the SN, which are directly mapped to the first delay time of the corresponding device in milliseconds. For example, different devices have different first delay times due to differences in the last two bits of their SNs, thus creating a natural staggered startup structure for each device in the time dimension. After obtaining this first delay time, each electronic device waits locally according to this time, thus completing the deterministic backoff delay process determined by the SN.
[0027] After each electronic device completes its backoff delay, the system enters the information synchronization phase, which is constrained by the identity broadcast period T1 and the information synchronization period T2. The identity broadcast period T1 defines the time interval for each electronic device to broadcast its identity declaration frame. This period is designed to balance avoiding broadcast conflicts with accelerating network discovery, satisfying the constraint: T1 > Nmax × (T_frame_max + T_proc_max). Here, Nmax is the maximum number of electronic devices supported by the system, T_frame_max is the longest transmission time for a single frame (including worst-case bit stuffing and frame intervals) at the current communication rate (a specific baud rate), and T_proc_max is the maximum processing time required for an electronic device to receive and process a frame. This parameter covers the worst-case processing delay, thus ensuring the stability of the broadcast process. For example, if there is a task with a period of 1ms dedicated to processing received broadcast messages, then T_proc_max should be greater than the task period to cover its worst-case execution time; that is, T_proc_max can typically be taken as T_proc_max = task period + worst-case execution time of the task. It should be noted that the identity broadcast period T1 in this embodiment should not be too short, otherwise broadcast collisions may easily occur when there are too many electronic devices. For example, if Nmax=10ms, T_frame_max=0.3ms, the application layer message processing task period is 1ms, and its worst execution time is 0.2ms, then T_proc_max = 1.2ms, and T1 can be taken as >15ms. In practice, 50ms can be taken to reserve enough time.
[0028] Under the constraint of the identity broadcast period T1, each electronic device continuously sends identity declaration frames periodically, and simultaneously enters the information synchronization period T2 to synchronize information across the entire network. The information synchronization period T2 limits the total time required to complete the collection of identities for all devices across the network, and is designed as T2 = K2 × T1. Here, K2 represents the number of broadcast rounds of the identity declaration frame, typically K2 ≥ 3, to ensure that even if a single message is lost, multiple rounds of broadcasting can achieve complete information coverage across the entire network, thereby improving the reliability of information synchronization.
[0029] Within the T2 time window, each electronic device continuously performs identity broadcasting and receiving operations, extracting device serial number information from the received identity declaration frames. These identity declaration frames are standard communication frames constructed based on the device serial numbers, carrying the unique identifier of the current device. Each electronic device aggregates and deduplicates all received device serial numbers, forming a device serial number set. This set corresponds to the complete set of SN codes for all online devices of the same type in the current network, allowing for an accurate count of the total number N of online electronic devices of the same type.
[0030] By introducing a deterministic backoff delay mechanism based on device serial numbers (SN codes), the initial communication behaviors of each electronic device after power-on are naturally staggered on the timeline, thus avoiding initial communication conflicts caused by simultaneous broadcasts from multiple devices and improving the stability of the system startup phase. Simultaneously, by executing periodic identity declaration frame broadcasting and reception under the constraints of the identity broadcasting period T1 and the information synchronization period T2, each device can complete the unified collection and synchronization of device serial numbers across the entire network without central control, forming a consistent set of device serial numbers. This provides a reliable data foundation for subsequent target master device election and address allocation. Therefore, the system achieves a smooth transition from disordered access to ordered information convergence in a distributed environment, improving the self-organization capability, information consistency, and reliability of the communication initialization phase of the multi-node network.
[0031] S3: Sort the set of device serial numbers to obtain the set of target device serial numbers. Based on the set of target device serial numbers, determine the electronic devices whose serial numbers meet the preset candidate conditions as candidate master devices, and the electronic devices other than the candidate master devices as slave devices. The candidate master device broadcasts a master device announcement frame, so that each slave device can perform objection negotiation operation according to the master device announcement frame, generate and send a negotiation result frame to the candidate master device. The candidate master device parses the negotiation result frame to obtain the protocol parsing result. When the negotiation parsing result meets the preset election conditions, the candidate master device is determined as the target master device, and a first target address is allocated to the target master device.
[0032] The process involves the candidate master device broadcasting a master device announcement frame to enable each slave device to perform objection negotiation based on the master device announcement frame, generating and sending a negotiation result frame to the candidate master device. This includes: generating a master device announcement frame corresponding to the candidate master device based on the device serial number; the candidate master device broadcasting the master device announcement frame to each slave device to enable each slave device to verify the master device announcement frame; when the device serial number corresponding to each slave device and the device serial number corresponding to the master device announcement frame meet the preset negotiation conditions, generating and sending a negotiation result frame to the candidate master device based on the device serial number corresponding to each slave device; and when the device serial number corresponding to each slave device and the device serial number corresponding to the master device announcement frame do not meet the preset negotiation conditions, no negotiation result frame is generated.
[0033] Based on the device serial number set generated in step S2, each electronic device is sorted. The device serial number set is the SN code set of all online electronic devices in the current network. By rearranging this set according to a preset sorting rule (e.g., ascending or descending order of values), a target device serial number set is obtained. This target device serial number set is used to determine the selection order of subsequent master-slave relationships.
[0034] Based on the target device serial number set, candidate master devices and slave devices are determined according to preset candidate conditions. The preset candidate conditions are used to select electronic devices with master device candidate qualifications from the sorted target device serial number set. For example, the device with the smallest or largest SN code can be selected as the candidate master device to ensure the configurability and adaptability of this selection rule in the system design. The selected candidate master device corresponds to the initiating node currently participating in the election, and the remaining electronic devices are classified as slave devices for participation in subsequent negotiation processes.
[0035] The candidate master device generates a master device announcement frame based on its own device serial number. This announcement frame is a standard broadcast communication frame carrying the candidate master device's SN code information, used to announce the current candidate master device identity to all slave devices in the network. Subsequently, the candidate master device continuously sends master device announcement frames according to a preset broadcast period T3. T3 is the broadcast interval for the master device announcement frames, and its design must be greater than the sum of the single frame transmission time and the node processing time, i.e., satisfying: T3 > T_frame_max + T_proc_max. This ensures that each announcement frame can be completely received and processed by each slave device, thereby avoiding communication congestion caused by overlapping processing. For example, T_frame_max = 0.3ms, T_proc_max = 1.2ms, mainly to prevent processing congestion. Typically, T3 is taken as a conservative value, such as 5ms to 10ms.
[0036] Upon receiving a master device announcement frame, each slave device verifies the candidate master device serial number (SN) carried by the frame and performs a pre-defined negotiation condition judgment based on its own device serial number. The pre-defined negotiation condition defines whether a slave device has any objection to the identity of the current candidate master device, and its judgment logic is based on the comparison relationship between device serial numbers. For example, when selecting the device with the smallest SN as the candidate master device, if the slave device's own SN is less than the SN in the master device announcement frame (meeting the pre-defined negotiation condition), the slave device considers the current candidate master device to be inconsistent with the pre-defined rules; if the slave device's own SN is greater than the SN in the master device announcement frame (not meeting the pre-defined negotiation condition), the current candidate master device is considered legitimate, and no further negotiation response is generated.
[0037] For slave devices that meet the negotiation conditions, they generate a negotiation result frame based on their own device serial number and send it to the candidate master device. The negotiation result frame is a feedback message carrying the slave device's SN code information, used to express objection information to the current candidate master device. For slave devices that do not meet the negotiation conditions, no negotiation result frame is generated, thereby avoiding unnecessary communication overhead.
[0038] The candidate master device receives and parses the negotiation result frames sent by each slave device within the election timeout period T4. T4 limits the maximum time window for the candidate master device to wait for the negotiation result frames. Its design must cover the time required for the slave devices to complete sending and transmission under worst-case communication conditions to ensure the integrity and reliability of the election process. T4 satisfies the following constraint: T4 > T_frame_max + T_proc_max + α, where α is an additional margin. For example, T_frame_max = 0.3ms, T_proc_max = 1.2ms, ensuring sufficient election and preventing premature acknowledgment; typically, T4 is taken as 10ms to 20ms.
[0039] After the candidate master device parses the negotiation result frame, it obtains the protocol parsing result, which includes the device serial number of the slave device currently in dispute.
[0040] Based on this, the candidate master device determines the protocol parsing result according to preset election conditions: taking the device with the smallest SN code as the candidate master device as an example, if the SN code of the slave device corresponding to the received negotiation result frame is greater than the SN code of the candidate master device (satisfying the preset election conditions), then the current candidate master device is determined to meet the election conditions, and the candidate master device is directly determined as the target master device, and a first target address (such as logical address 1) is assigned to it. This first target address is used as the unified identifier of the master node in the subsequent system; if the SN code of the slave device corresponding to the negotiation result frame is less than the SN code of the current candidate master device (not satisfying the preset election conditions), then the candidate master device accepts the objection, performs the backoff process, replies with a backoff frame to the slave device corresponding to the negotiation result frame that does not meet the preset election conditions, upgrades the slave device to the new candidate master device, and rebroadcasts the master device announcement frame, repeating the above objection negotiation operation until the election conditions are met.
[0041] For example, taking the selection of the device with the largest SN code as the candidate master device as an example, if the SN code of the slave device corresponding to the received negotiation result frame is less than the SN code of the candidate master device (meeting the preset election conditions), then the current candidate master device is determined to meet the election conditions, and the candidate master device is directly determined as the target master device, and a first target address (such as logical address 1) is assigned to it. This first target address is used as the unified identifier of the master node in the subsequent system. If the SN code of the slave device corresponding to a negotiation result frame is greater than the SN code of the current candidate master device (not meeting the preset election conditions), then the candidate master device accepts the objection, performs the backoff process, replies with a backoff frame to the slave device corresponding to the negotiation result frame that does not meet the preset election conditions, upgrades the slave device to the new candidate master device, and rebroadcasts the master device announcement frame, repeating the above objection negotiation operation until the election conditions are met.
[0042] If the candidate master device does not receive any valid negotiation result frame within T4, the election is successful, the device is confirmed as the sole master node by the entire network, and the process proceeds to step S4.
[0043] By sorting the device serial number set and introducing a candidate master device determination mechanism based on serial number rules, all electronic devices can form a unified election starting point without external coordination, thereby reducing the randomness and uncertainty in the master device determination process. Simultaneously, by having candidate master devices broadcast master device announcement frames and each slave device respond differently based on preset negotiation conditions, the system can achieve hierarchical verification and feedback of the legitimacy of candidate master devices in a distributed environment, thus improving the reliability and consistency of the election process. Furthermore, by centrally receiving and parsing the negotiation result frames within the election timeout T4, the master device election process has clear time boundaries and a convergence mechanism, avoiding infinite loops or prolonged uncertain states. Under the control of preset election conditions, the target master device is confirmed and the first target address is allocated, ultimately forming a uniquely determined master node, providing a stable foundation for subsequent logical address allocation and ordered communication. Therefore, this step enables deterministic election and rapid convergence of master devices in a multi-node distributed environment, improving system structural consistency and operational stability.
[0044] S4: Based on the target device serial number set, the target master device allocates addresses to each slave device in sequence to obtain the address allocation results, and generates an address allocation queue based on the address allocation results and the first target address.
[0045] Based on the target device serial number set determined in step S3, the target master device performs sequential logical address allocation processing on each slave device. "Sequential" means allocating incremental logical addresses to each slave device according to the order of the devices in the target device serial number set, forming a stable address mapping relationship. It can be understood that, starting from logical address 2, the target master device sequentially sends address allocation frames to each slave device in the target device serial number set, except for the target master device corresponding to the first target address (logical address 1), establishing a one-to-one correspondence between each slave device's device serial number and its unique logical address. During this process, each slave device completes its own SN code matching based on the received address allocation frame, then accepts the allocated address and replies with an acknowledgment frame. After the address allocation is complete, the target master device broadcasts an address allocation completion frame. Finally, a complete address allocation result is formed, which is essentially an ordered set of slave device logical addresses, for example, [2, 3, ..., N] in a system with N electronic devices, representing the logical order of all slave devices in the communication system.
[0046] After address allocation to each slave device, the target master device integrates its own first target address (i.e., logical address 1) with the address allocation results to generate an address allocation queue. This address allocation queue is a complete ordered sequence containing the logical addresses of all devices, such as [1, 2, ..., N], where "1" corresponds to the target master device, and the remaining addresses correspond to the slave devices in sequence. This queue is used to uniformly describe the logical communication order of all electronic devices in the entire multi-node system. Furthermore, during the address allocation process, if there is an unresponsive slave device, it can request an address at this stage, and the target master device will append its address to the end of the queue, ensuring the integrity and continuity of the final address allocation queue.
[0047] By allocating sequential logical addresses to each slave device based on the target device serial number set, a deterministic address mapping relationship is established among all electronic devices in the system under the unified scheduling of the master device, thereby eliminating the randomness and inconsistency of address allocation in a multi-node environment. By organizing the address allocation results of the slave devices sequentially and integrating them with the first target address of the target master device to generate an address allocation queue, a unique and continuous ordered address structure is formed at the logical layer for all network devices, providing a unified execution order basis for subsequent communication scheduling. Simultaneously, this process improves the consistency and reliability of address allocation through the centralized allocation and confirmation mechanism of the target master device, reducing the possibility of address conflicts and duplicate configurations between devices. Therefore, a stable logical topology can be established in the early stages of operation of a multi-node system, providing deterministic support for subsequent ordered communication and relay data transmission, and improving the overall communication organization capability and operational stability of the system.
[0048] S5: The target master device broadcasts a synchronization reference frame to each slave device so that each slave device can obtain the target time reference based on the synchronization reference frame.
[0049] The target master device generates and broadcasts a synchronization reference frame according to a preset time period. This synchronization reference frame is a data frame carrying standard time information, containing at least the target master device's current high-precision timestamp and a synchronization identifier field for time alignment, providing a unified time reference for all slave devices in the network. The preset time period is not limited here and can be adaptively set according to actual conditions.
[0050] The target master device periodically sends the synchronization reference frame via a shared communication bus. Upon receiving the synchronization reference frame, each slave device parses the timestamp information carried within the frame and uses this timestamp as a time calibration basis to correct and align its own local timing unit. During this process, the slave devices compare their local clocks with the time information in the synchronization reference frame, calculate the time deviation, and compensate for it, so that the local running time of each slave device gradually converges to a time reference system consistent with that of the target master device.
[0051] After synchronous calibration, the unified time reference formed by each slave device becomes the target time base. This target time base indicates that all electronic devices in the network have been aligned to the same time coordinate system in the time dimension, so that each node can perform message sending and receiving operations based on a consistent time reference in subsequent communication processes.
[0052] Through the above process, the multi-node communication system can further complete the unified calibration of the time dimension after the logical address is determined, thereby providing a stable and consistent time basis for subsequent time-triggered relay sequential communication, ensuring that the communication behavior of each node can be predicted and coordinated under the same time reference.
[0053] S6: Based on the address allocation queue and the target time base, the target master device performs relay-style sequential message sending operations to establish periodic communication.
[0054] The process involves the target master device performing a relay-style sequential message transmission operation based on the address allocation queue and the target time base to establish periodic communication. This includes: obtaining the number of periodic messages and determining the number of communication cycles based on the number of periodic messages; and executing a relay-style transmission process based on the target time base and the address allocation queue until the number of communication cycles is met. The relay-style transmission process includes: determining the current transmitting device, the electronic device corresponding to the previous address adjacent to the current transmitting device as the predecessor transmitting device, and the electronic device corresponding to the next address adjacent to the current transmitting device as the successor transmitting device, based on the address arrangement order in the address allocation queue; when the current transmitting device is the target master device, sending a periodic message of a preset type corresponding to the target master device to the successor transmitting device; when the current transmitting device is not the target master device, after receiving the periodic message of the preset type sent by the predecessor transmitting device and delaying for a preset relay interval, the current transmitting device sends a periodic message of the preset type corresponding to the current transmitting device to the successor transmitting device.
[0055] Based on the address allocation queue generated in step S4 and the target time base established in step S5, and assuming that the time and logical address of the entire network are unified, the target master device initiates a relay transmission process to establish deterministic periodic communication.
[0056] Specifically, the target master device first determines the number of periodic messages based on the system's preset service requirements. This number of periodic messages represents the number of messages that need to be sent sequentially within a complete communication cycle, such as the number of periodic reports of multiple different service states or control information. Based on this, the number of communication cycles is determined according to the number of periodic messages. The number of communication cycles is used to characterize the number of rounds of execution of the complete periodic communication process; that is, each round of relaying all periodic messages is counted as one communication cycle.
[0057] During the relay-style transmission process, the target master device determines the address arrangement order based on the logical address sequence of each device in the address allocation queue. This address arrangement order is an ordered chain structure starting from the target master device (logical address 1) and sequentially increasing to the last slave device. Under this sequential structure, the device currently performing the transmission operation is defined as the current transmitting device, the device corresponding to the preceding logical address in the address arrangement order is defined as the predecessor transmitting device, and the device corresponding to the following logical address is defined as the successor transmitting device, thus forming a logically stable chain transmission relationship.
[0058] In this relay structure, when the current sending device is the target master device, the target master device first sends a periodic message of its corresponding preset type. This preset type of periodic message is a standard service message type predefined by the system, used to initiate the relay process of the current communication round, and then sends the message to its subsequent sending device. When the current sending device is not the target master device, after receiving the preset type of periodic message from its predecessor sending device, the slave device starts local timing based on the target time base, and sends its own corresponding preset type of periodic message to the subsequent sending device after a preset relay interval time T_delay. The preset relay interval time T_delay is a fixed delay parameter that maintains the consistency of time intervals between adjacent devices during the relay process, ensuring that the sending behavior of each device is evenly and orderly distributed on the time axis. T_delay satisfies the following dual constraints: 1) Lower limit: T_delay_min > T_proc_max; 2) Upper limit: determined by the system real-time requirement T_cycle: T_delay_max = (T_cycle / Nmax) - T_frame_max. The final value is selected within the interval [T_delay_min, T_delay_max], and the median value is usually chosen for optimal robustness. For example, assuming T_cycle = 100ms, T_frame_max = 0.274ms, and T_proc_max = 1.2ms: T_delay_max = (100 / 10) - 0.274 = 9.726ms, T_delay_min = 1.2ms; T_delay = 5ms can be chosen.
[0059] Through the aforementioned time alignment mechanism based on the target time base and the chain relay mechanism based on the address arrangement order, each device sequentially completes the node-by-node transmission of periodic messages. Starting from the target master device, the messages are transmitted level by level along the predecessor and successor relationships to the end device, thus completing a complete relay transmission process.
[0060] Once the system completes the relay transmission corresponding to the total number of periodic messages, it is considered to have completed one communication cycle. The relay process is then repeated based on the number of communication cycles until the preset number of communication cycles is reached, thereby achieving stable, multi-round periodic communication.
[0061] To facilitate understanding, the relay transmission process provided in this application embodiment is described in detail below through a specific example: For example, the total number of electronic devices is 3 (logical address numbers are 1, 2, and 3), the number of messages each device needs to send periodically is 5, and the preset relay interval T_delay is 5ms. The relay sending process is as follows: First round (sending "periodic message 1"): 1. The target master device at address 1 first sends periodic message 1.
[0062] 2. After successfully receiving periodic message 1 from address 1, the slave device at address 2 will send its own periodic message 1 after a 5ms delay.
[0063] 3. After successfully receiving periodic message 1 from address 2, the slave device at address 3 delays for 5ms and then sends its own periodic message 1.
[0064] At this point, all devices have completed sending the first periodic message.
[0065] Second round (sending "periodic message 2"): 1. After successfully receiving periodic message 1 from address 3, the target master device at address 1 immediately sends periodic message 2.
[0066] 2. After receiving periodic message 2 from address 1, the slave device at address 2 delays for 5ms before sending its own periodic message 2.
[0067] 3. After receiving periodic message 2 from address 2, the slave device at address 3 delays for 5ms before sending its own periodic message 2.
[0068] Subsequent rounds (sending messages 3, 4, and 5): will not be elaborated here.
[0069] Understandably, the target master device at address 1 always initiates the transmission of the next periodic message immediately after receiving the previous periodic message from address 3. The slave devices at address 2 and address 3, on the other hand, always send their own periodic messages after a 5ms delay after receiving the corresponding periodic messages from their respective predecessor nodes (address 1 and address 2).
[0070] After the relay of the 5th message (periodic message 5) is completed, the target master device at address 1 will receive the periodic message 5 sent by the slave device at address 3. The entire system will automatically restart from step 1 and begin the cycle of the next communication cycle until the number of communication cycles (5 times) is met.
[0071] By constructing a relay-style sequential transmission mechanism based on an established address allocation queue and a unified time base, the multi-node communication process is transformed from concurrent contention-based transmission to deterministic, node-by-node transmission based on logical order. This avoids the conflict risks caused by multiple devices simultaneously occupying the shared communication bus at the mechanism level. Simultaneously, by introducing control methods for the number of periodic messages and the number of communication cycles, the system communication process has clear periodic boundaries and a repeatable execution structure, improving the predictability and manageability of communication behavior. Furthermore, network-wide time alignment is achieved using a target time base, and the transmission timing of each node is constrained by a fixed relay interval T_delay, enabling each device to release messages evenly and orderly on the timeline, thereby improving bus utilization efficiency and reducing the impact of communication jitter. Therefore, this step enables stable sequential transmission of messages and periodic closed-loop communication in a multi-node environment, significantly improving the determinism, stability, and overall coordination capabilities of the system communication.
[0072] In some embodiments, the method further includes: if the current sending device does not receive the periodic message sent by the predecessor sending device within a preset waiting timeout period, the current sending device sends a periodic message of a preset type corresponding to the current sending device to the successor sending device; if the target master device detects that the interval time between adjacent periodic messages and the preset relay interval time meet the preset abnormal threshold, the target master device interrupts the relay sending process and jumps to step S5.
[0073] In the relay transmission process, to ensure the continuity of the communication link and the stability of system operation, a fault tolerance and exception handling mechanism is further introduced on top of the basic process described in step S6.
[0074] Specifically, during relay transmission, each electronic device sets a local timeout period (T_guard) to prevent communication link interruption due to malfunction of the preceding transmitting device. This timeout period limits the maximum time window during which the current transmitting device waits for periodic messages from its predecessor transmitting device. T_guard satisfies the following constraint: T_guard = T_delay + T_frame_max + T_margin. The safety margin T_margin covers clock errors and transmission jitter during communication, ensuring that under normal circumstances, it is not mistaken for a communication anomaly. It should be noted that T_guard must be greater than T_delay, but should not be too large. For example, if T_margin is 0.5ms, T_frame_max = 0.274ms, and T_delay = 5ms, then T_guard = 5 + 0.274 + 0.5 ≈ 5.8ms. Typically, T_guard is 1.2 to 1.5 times T_delay.
[0075] Under this waiting mechanism, if the current sending device does not receive the periodic message sent by the predecessor sending device within the T_guard time window, it is determined that the predecessor node may have failed or communication interrupted. At this time, the current sending device no longer waits for the predecessor message to be triggered, but directly continues to perform the sending operation based on the current relay sequence, sending the preset type periodic message corresponding to itself to the successor sending device, thereby realizing the local self-recovery of the relay link and avoiding the overall interruption of the communication process.
[0076] On the other hand, the target master device continuously monitors the overall network communication timing throughout the relay transmission process. Its monitoring object is the time interval between adjacent periodic packets, which refers to the actual time difference between periodic packets sent by two adjacent devices in the address allocation queue. This time interval should be consistent with the preset relay interval T_delay to characterize the stability of the system's relay rhythm.
[0077] When the target master device detects that the actual interval between multiple adjacent periodic messages continuously deviates from T_delay and reaches a preset abnormal threshold, it determines that the current relay transmission process has timing disorder or interference from uncontrolled nodes. The preset abnormal threshold is used to define the boundary at which the accumulated time deviation reaches the point where a system abnormality can be determined. In this case, the target master device will interrupt the current relay transmission process and trigger the system to roll back to step S5 to re-execute time base synchronization in order to reconstruct the time base of all network devices, thereby restoring the orderliness and consistency of relay communication.
[0078] By introducing a local takeover strategy based on the waiting timeout T_guard into the relay transmission process, each current transmitting device can autonomously trigger transmission within a limited time window when it does not receive periodic messages from the predecessor transmitting device. This avoids the entire relay link being interrupted due to a single node's failure, improving the continuity and local self-recovery capability of chained communication. Simultaneously, by continuously comparing the actual interval between adjacent periodic messages with the preset relay interval T_delay by the target master device, and actively interrupting the current relay process and reverting to the time base synchronization step when the accumulated deviation reaches a preset abnormal threshold, the system can promptly identify and eliminate global timing disorder or abnormal states caused by uncontrolled nodes, thereby achieving dynamic correction and global reconstruction of the communication rhythm. Thus, while ensuring communication continuity, it also considers global consistency control capabilities, significantly improving the fault tolerance, timing stability, and long-term operational reliability of the multi-node relay communication system.
[0079] In some embodiments, the method further includes: when the multi-node communication system detects that a new electronic device is powered on, step S1 is executed; when the message parsing result does not meet the mode decision conditions, the new electronic device sends a network access application frame to the target master device, so that the target master device interrupts the relay transmission process after receiving the network access application frame; wherein, the network access application frame is generated based on the device serial number corresponding to the new electronic device; the device serial number of the new electronic device is inserted into the end of the address allocation queue, and the process jumps to step S4.
[0080] When a multi-node communication system detects a new electronic device powering on, this new electronic device refers to a similar device that has been added to the existing communication network but has not yet completed address allocation and communication registration. After powering on, the device first executes step S1, which involves entering a listening state and parsing bus messages to determine whether the current network is in an orderly communication operation state.
[0081] If the message parsing result obtained by the new electronic device during the monitoring process does not meet the mode decision conditions, that is, if it is determined that the current network is already in a stable relay communication operation state, then the device will not directly participate in the current communication process, but will instead send a network access request frame to the target master device. The network access request frame is a standard communication message generated based on the serial number of the new electronic device, and it carries the device's SN code information to identify itself and request network access to the target master device.
[0082] Upon receiving a network access request frame, the target master device will first interrupt the currently executing relay transmission process to avoid maintaining the old communication topology when the network structure changes, thereby ensuring system consistency and communication security. Subsequently, the target master device triggers a network-wide silence control, causing all devices to suspend their current relay transmission behavior and enter a brief synchronization processing state.
[0083] After completing the access preparation, the target master device inserts the device serial number of the new electronic device into the end of the address allocation queue without changing the order of existing devices in the original address allocation queue. The address allocation queue is an ordered set of logical addresses of all registered devices in the current system. Inserting it into the end indicates that the new electronic device is assigned a new position with the lowest priority in the current communication topology, ensuring that the original communication order is not disrupted.
[0084] After the insertion operation is completed, the target master device re-executes step S4 to reallocate logical addresses to the updated set of device serial numbers, assigning corresponding logical addresses to the newly added devices and synchronously updating the total number of electronic devices N. Subsequently, the target master device broadcasts a new address allocation frame, causing all devices to update their local address mapping relationships, thereby resuming the relay communication process and achieving seamless access for the newly added devices.
[0085] In some embodiments, the method further includes: when the target master device detects a communication timeout in the relay transmission process, the target master device performs status detection on each slave device participating in the relay transmission process and obtains the status detection result; the target master device identifies the slave device whose status detection result meets the preset fault determination condition as the target fault device and removes the target fault device from the address allocation queue; the target master device interrupts the relay transmission process and jumps to step S4 after updating the target device serial number set; when there is a situation in the relay transmission process where a slave device fails to receive the message sent by the target master device within the preset master device timeout transmission time, the slave device that meets the preset announcement condition is identified as the target announcement device; the target announcement device interrupts the relay transmission process and jumps to step S1.
[0086] When a multi-node communication system is in the process of relay transmission, the target master device continuously monitors the execution status of the communication link in real time. Specifically, the target master device determines whether there is a communication timeout in the current link based on the reception timing of the messages of each slave device. Here, a communication timeout refers to the failure to receive a periodic message sent by a certain predecessor transmitting device as expected within a preset time window (e.g., waiting timeout time T_guard), thus indicating that the predecessor transmitting device may be abnormal or malfunctioning.
[0087] When the target master device detects multiple consecutive communication timeout events, and the number of timeouts reaches a preset fault tolerance threshold, it triggers status checks on each slave device participating in the current relay transmission process. Status checks refer to the target master device evaluating the communication activity of each slave device based on historical communication records and current reception status. This includes statistically analyzing the message response status, reception success rate, and the presence of persistently missing messages for each slave device over recent communication cycles, thereby generating a corresponding status check result. This status check result can be understood as a set of communication status identifiers for each slave device, such as "normal response," "intermittent loss," or "persistent no response." It should be noted that the preset fault tolerance threshold in this embodiment can be adaptively set according to actual conditions and is not limited here.
[0088] After obtaining the status detection results, the target master device filters each slave device according to preset fault judgment criteria. These preset fault judgment criteria define the conditions for identifying a device as a faulty device; for example, they can be set as "failure to send or forward messages for multiple consecutive communication cycles" or "message missing count exceeding a threshold." Any slave device whose status detection results meet these preset fault judgment criteria is identified as the target faulty device. Essentially, this target faulty device refers to an abnormal device that is unable to participate in normal relay transmission in the current communication system and would cause communication link interruption or disorder.
[0089] After identifying the faulty device, the target master device removes the target faulty device from the current address allocation queue. This removal operation essentially deletes the logical address of the corresponding faulty device and its position in the queue, thereby logically severing the device's association with the relay communication link and preventing it from further affecting subsequent communication processes.
[0090] Subsequently, the target master device broadcasts a "silent frame," causing the entire network to enter a silent state and interrupting the currently executing relay transmission process to ensure that the subsequent topology adjustment process is not disturbed. Based on this, the target master device recounts the number N of currently online electronic devices according to the updated target device serial number set (i.e., the SN code set after removing faulty devices), and jumps to execute step S4 to re-allocate logical addresses and construct queues for the remaining normal devices, thereby generating a new address allocation queue.
[0091] Furthermore, during the relay transmission process, each slave device not only triggers its own transmission behavior based on the messages from its corresponding predecessor device, but also independently monitors the operational status of the target master device (such as an electronic device with logical address 1). Specifically, each slave device maintains a master device monitoring timing mechanism. The master device timeout transmission time T_master_fault is a time threshold used to determine whether the target master device has failed. Its value is significantly larger than the waiting timeout time T_guard in the relay link, covering the maximum transmission interval of the target master device's periodic messages, synchronization reference frames, or other heartbeat messages under normal circumstances. For example, the value of T_master_fault can be set to several times the waiting timeout time T_guard (e.g., T_guard = 500ms, T_master_fault = 2s) to avoid misjudgments due to short-term jitter or individual message loss.
[0092] In the specific implementation, each slave device resets the monitoring timer of the target master device when it receives a message (including periodic messages, synchronization reference frames, or explicit heartbeat frames) from the target master device. If no message is received from the target master device within a consecutive master device timeout transmission period, it is determined that the current target master device has malfunctioned or exited the network. At this time, the slave device that first completes the malfunction determination is identified as the target announcement device. The target announcement device refers to the slave device that first detects the failure of the target master device in the current network and has the ability to trigger a network-wide state switch (i.e., meets the preset announcement conditions). Its selection does not depend on a fixed address but is triggered by the actual detection event, thus possessing adaptability.
[0093] Once the target device completes the master device failure determination, it immediately interrupts its relay transmission process and broadcasts a pre-set control message (such as a "stop relay frame" or "global reset frame") to the bus. This message carries the target master device failure identifier information to notify other slave devices in the network that the current communication sequence has failed. Upon receiving this control message, other slave devices synchronously stop their current relay communication behavior, thereby avoiding the continuation of the original chain transmission in the absence of the target master device, which could lead to communication disorder.
[0094] Subsequently, the entire network uniformly executes a process jump operation from the current operating state back to the initial step S1 of the initialization phase. By re-entering the listening state, each device re-awares the bus environment and sequentially executes the subsequent distributed identity broadcast, target master device election, and address allocation processes, thereby re-electing a new target master device from the remaining online devices and constructing a new address allocation queue and relay communication link.
[0095] By distinguishing between two typical abnormal scenarios—"slave device failure" and "master device failure"—and introducing differentiated detection and recovery mechanisms for each, the system possesses more refined fault tolerance and self-recovery capabilities. On one hand, when the target master device detects a communication timeout in the relay transmission process, it performs status checks on each slave device and generates status check results. Combined with preset fault judgment conditions, it identifies the target faulty device and removes it from the address allocation queue. Simultaneously, it triggers a partial reconstruction based on step S4, enabling the system to eliminate abnormal nodes and quickly restore orderly communication without affecting the overall operating framework, thereby avoiding the continuous impact of a single slave device failure on the global communication link. On the other hand, when a slave device does not receive a message from the target master device within the preset master device timeout transmission time, it actively triggers a network-wide process rollback to step S1 by declaring the slave device as the target device. This achieves a global reconstruction mechanism in the master device failure scenario, thereby avoiding system loss of control or communication stagnation due to the absence of a master device. Through the synergistic effect of the two mechanisms mentioned above, the system can adopt the strategies of "local repair" and "global reconstruction" when facing different levels of failure, thereby improving the robustness, adaptability and overall operational reliability of the system while ensuring communication continuity.
[0096] This application provides a scheduling method for a multi-node communication system. By introducing a unified logical scheduling mechanism in multiple stages such as system initialization, master-slave election, address allocation, timing synchronization, and relay transmission, the distributed communication process that originally relied on competition arbitration is transformed into a deterministic cooperative communication process with clear order constraints, thereby significantly improving the overall system communication performance and operational stability.
[0097] First, in terms of communication conflict suppression, by sorting the device serial numbers and constructing a target device serial number set, each node forms a unique and definite sending order at the logical layer. Furthermore, through the candidate master device election mechanism and negotiation confirmation process, the master device determination process is transformed from random competition to deterministic decision-making based on serial number comparison. This mechanism reduces the uncertainty caused by concurrent competition among multiple devices, thereby establishing a stable control source for subsequent communication.
[0098] Secondly, in terms of communication organization structure, centralized address allocation and address allocation queue construction enable electronic devices in the system to form a logically ordered topology independent of physical connections, making the communication path predictable and traceable, thereby providing a stable structural foundation for subsequent relay data transmission and reducing the impact of dynamic changes of multiple devices on the communication structure.
[0099] Furthermore, by establishing a unified time reference, all electronic devices can perform sending and receiving operations under the same time reference system, effectively eliminating timing deviations caused by clock drift between devices. This ensures that the sending behavior of each device in relay communication can be strictly executed according to the preset time relationship, thereby improving the overall communication synchronization and determinism.
[0100] At the data transmission level, the relay-style sequential transmission mechanism based on address allocation queues enables periodic messages to be triggered and transmitted between devices in a fixed order, avoiding the conflict and retransmission problems under traditional broadcast or contention-based transmission methods. This allows bus resources to be used evenly and efficiently in the time dimension, thereby significantly improving communication bandwidth utilization and system real-time performance.
[0101] Furthermore, in terms of system adaptability, this application introduces a dynamic network entry and exit processing mechanism, enabling new devices to smoothly access the network without interrupting the overall communication process, and achieves uninterrupted structural expansion through queue end insertion and reallocation mechanisms. At the same time, through fault node identification and automatic removal mechanisms, the system can quickly reconstruct the communication topology when local devices fail, maintaining the continuity and stability of the overall communication link, thereby significantly enhancing the system's fault tolerance and robustness.
[0102] Based on this, this application constructs an integrated scheduling system from device sequencing, master node election, address allocation, time synchronization to relay communication, realizing the transformation of multi-node communication from a competitive and uncertain mechanism to an ordered and deterministic collaborative mechanism. This not only effectively solves the communication conflict problem in a shared bus environment, but also significantly improves the system's scalability, stability, real-time performance, and engineering deployability.
[0103] Based on the scheduling method for a multi-node communication system provided in the above embodiments, this application further provides a scheduling apparatus for a multi-node communication system. Please refer to... Figure 2 , Figure 2 This is a schematic diagram of the scheduling device of the multi-node communication system. (For example...) Figure 2 As shown, the scheduling device 100 of the multi-node communication system includes: a message monitoring module 110, an identity collection module 120, a target master device election module 130, an address allocation module 140, a time synchronization module 150, and a periodic communication establishment module 160.
[0104] The message monitoring module 110 is used to parse the bus messages received in the monitoring state after each electronic device is powered on, according to a preset mode decision rule, to obtain the message parsing result. The identity collection module 120 is used to obtain the device serial number corresponding to each electronic device when the message parsing result meets the preset mode decision conditions, and to perform a backoff delay operation on each electronic device according to the device serial number. After each electronic device completes the backoff delay operation, it broadcasts the identity declaration frame corresponding to each electronic device, and obtains the device serial number set according to the identity declaration frame. The identity declaration frame is generated based on the device serial number. The target master device election module 130 is used to sort the device serial number set to obtain the target device serial number set, and to determine the electronic devices whose device serial numbers meet the preset candidate conditions as candidate master devices, and the electronic devices other than the candidate master devices among the electronic devices. Each device acts as a slave device. A candidate master device broadcasts a master device announcement frame, enabling each slave device to perform objection negotiation based on the announcement frame, generating and sending a negotiation result frame to the candidate master device. The candidate master device parses the negotiation result frame to obtain a protocol parsing result. When the negotiation parsing result meets preset election conditions, the candidate master device is determined as the target master device, and a first target address is allocated to it. An address allocation module 140 is used to allocate addresses to each slave device sequentially based on the target device sequence number set, obtaining address allocation results, and generating an address allocation queue based on the address allocation results and the first target address. A time synchronization module 150 is used for the target master device to broadcast a synchronization reference frame to each slave device, enabling each slave device to obtain a target time reference based on the synchronization reference frame. A periodic communication establishment module 160 is used for the target master device to perform relay-style sequential message sending operations based on the address allocation queue and the target time reference, establishing periodic communication.
[0105] It should be noted that the scheduling device for the multi-node communication system described above can execute the scheduling method for the multi-node communication system provided in the embodiments of this application, and has the corresponding functional modules and beneficial effects of the method. Technical details not described in detail in the embodiments of the scheduling device for the multi-node communication system can be found in the scheduling method for the multi-node communication system provided in the embodiments of this application.
[0106] This application also provides a multi-node communication system 200, please refer to... Figure 3 This diagram illustrates the hardware structure of a multi-node communication system 200 capable of performing the methods described in the embodiments above. The multi-node communication system 200 includes: at least one processor 210; and a memory 220 communicatively connected to the at least one processor 210. Figure 3Taking a processor 210 as an example, the memory 220 stores instructions executable by at least one processor 210. These instructions, when executed by at least one processor 210, enable the at least one processor 210 to perform the scheduling method of the multi-node communication system described in the above embodiment. The processor 210 and the memory 220 can be connected via a bus or other means. Figure 3 Taking the example of a connection between China and Israel via a bus.
[0107] The memory 220, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the program instructions / modules corresponding to the scheduling method of the multi-node communication system in the embodiments of this application. The processor 210 executes various functional applications and data processing of the server by running the non-volatile software programs, instructions, and modules stored in the memory 220, thereby implementing the scheduling method of the multi-node communication system in the above embodiments.
[0108] Memory 220 may include a stored program area and a stored data area, wherein the stored program area may store the operating system and applications required for at least one function; the stored data area may store data created based on the use of the computing device, etc. Furthermore, memory 220 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, memory 220 may optionally include memory remotely located relative to processor 210, and these remote memories may be connected to the computing device via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0109] One or more modules are stored in memory 220 and, when executed by one or more processors 210, execute the scheduling method of the multi-node communication system described above.
[0110] It should be noted that the scheduling method for the multi-node communication system provided in this application embodiment is executed by the multi-node communication system itself. This system includes multiple electronic devices of the same type, which are interconnected through a shared communication bus (such as a CAN bus or RS-485 bus) and work collaboratively under unified scheduling rules. Each electronic device in the system can act as a data sending node or a data receiving node, and dynamically assumes the role of master or slave device at the logical layer according to a preset scheduling mechanism. The multi-node communication system as a whole is responsible for the entire process control, including network status perception after device power-on, device identification, master-slave relationship determination, logical address allocation, time base synchronization, and relay-style sequential transmission of periodic messages. This achieves unified organization and scheduling management of multi-node communication behavior, ensuring the orderliness and determinism of the overall communication process.
[0111] The above-described product can execute the methods provided in the embodiments of this application, and has the corresponding functional modules and beneficial effects for executing the methods. Technical details not described in detail in this embodiment can be found in the scheduling method of the multi-node communication system in the embodiments of this application.
[0112] This application provides a non-volatile computer-readable storage medium storing computer-executable instructions. These instructions are executed by one or more processors to enable at least one processor to perform the scheduling method of the multi-node communication system described above. For example, the non-volatile computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CDROM), magnetic tape, floppy disk, or optical data storage device, etc.
[0113] This application provides a computer program product, which includes a computer program stored on a non-volatile computer-readable storage medium. The computer program includes program instructions, which, when executed by a multi-node communication system, enable the multi-node communication system to perform the scheduling method of the multi-node communication system in any of the above method embodiments.
[0114] It should be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0115] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0116] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and not to limit them; under the concept of this application, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of different aspects of this application as described above, which are not provided in detail for the sake of brevity; although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A scheduling method for a multi-node communication system, applied to the multi-node communication system, the multi-node communication system comprising various electronic devices of the same type, characterized in that, The method includes the following steps: S1. After each electronic device is powered on, each electronic device enters a listening state and parses the bus messages received in the listening state according to a preset mode decision rule to obtain the message parsing result; S2. When the message parsing result meets the preset mode decision conditions, obtain the device serial number corresponding to each electronic device, and perform a backoff delay operation on each electronic device according to the device serial number; after each electronic device completes the backoff delay operation, broadcast the identity declaration frame corresponding to each electronic device, and obtain the device serial number set according to the identity declaration frame; wherein, the identity declaration frame is generated based on the device serial number; S3. Sort the set of device serial numbers to obtain a set of target device serial numbers, and determine electronic devices whose serial numbers meet preset candidate conditions as candidate master devices, and electronic devices other than the candidate master devices as slave devices; the candidate master device broadcasts a master device announcement frame, so that each slave device performs an objection negotiation operation according to the master device announcement frame, generates and sends a negotiation result frame to the candidate master device; the candidate master device parses the negotiation result frame to obtain a protocol parsing result; when the negotiation parsing result meets preset election conditions, the candidate master device is determined as the target master device, and a first target address is allocated to the target master device; S4. Based on the target device serial number set, the target master device performs sequential address allocation to each slave device to obtain address allocation results, and generates an address allocation queue based on the address allocation results and the first target address; S5. The target master device broadcasts a synchronization reference frame to each slave device, so that each slave device obtains the target time reference based on the synchronization reference frame; S6. Based on the address allocation queue and the target time base, the target master device performs a relay-style sequential message sending operation to establish periodic communication.
2. The scheduling method for a multi-node communication system according to claim 1, characterized in that, The step of obtaining the device serial number corresponding to each electronic device and performing a backoff delay operation on each electronic device based on the device serial number includes: Obtain the device serial number corresponding to each of the electronic devices; Based on the device serial number, a preset number of digits in the device serial number is determined as the first delay time corresponding to each electronic device, and each electronic device is delayed by the first delay time.
3. The scheduling method for a multi-node communication system according to claim 1, characterized in that, After each electronic device completes the backoff delay operation, an identity declaration frame corresponding to each electronic device is broadcast, and a device serial number set is obtained based on the identity declaration frame, including: After each electronic device completes the backoff delay operation, an information synchronization process with a preset information synchronization cycle is executed; wherein, the information synchronization process includes: Within a preset identity broadcasting period, each electronic device broadcasts the identity declaration frame corresponding to that electronic device; Simultaneously, each electronic device extracts the device serial number from the received identity declaration frame and obtains the device serial number set based on the device serial number.
4. The scheduling method for a multi-node communication system according to claim 1, characterized in that, The candidate master device broadcasts a master device announcement frame, enabling each slave device to perform objection negotiation operations based on the master device announcement frame, generate and send a negotiation result frame to the candidate master device, including: Based on the device serial number, generate the master device announcement frame corresponding to the candidate master device; The candidate master device broadcasts the master device announcement frame to each slave device, so that each slave device can verify the master device announcement frame; When the device serial number corresponding to each slave device and the device serial number corresponding to the master device announcement frame meet the preset negotiation conditions, the negotiation result frame is generated and sent to the candidate master device according to the device serial number corresponding to each slave device; When the device serial number corresponding to each slave device and the device serial number corresponding to the master device announcement frame do not meet the preset negotiation conditions, the negotiation result frame is not generated.
5. The scheduling method for a multi-node communication system according to claim 1, characterized in that, Based on the address allocation queue and the target time base, the target master device performs a relay-style sequential message sending operation to establish periodic communication, including: Obtain the number of periodic messages, and determine the number of communication cycles based on the number of periodic messages; Based on the target time base and the address allocation queue, the target master device executes a relay transmission process until the number of communication cycles is met; wherein, the relay transmission process includes: Based on the address arrangement order in the address allocation queue, the current transmitting device, the electronic device corresponding to the previous address adjacent to the current transmitting device are determined as the predecessor transmitting device of the current transmitting device, and the electronic device corresponding to the next address adjacent to the current transmitting device is determined as the successor transmitting device of the current transmitting device. When the current sending device is the target master device, a periodic message of a preset type corresponding to the target master device is sent to the subsequent sending device; When the current sending device is not the target master device, after receiving a periodic message of a preset type sent by the predecessor sending device and delaying for a preset relay interval, the current sending device sends a periodic message of the preset type corresponding to the current sending device to the successor sending device.
6. The scheduling method for a multi-node communication system according to claim 5, characterized in that, The method further includes: If the current sending device does not receive the periodic message sent by the predecessor sending device within the preset waiting timeout period, the current sending device sends the periodic message of the preset type corresponding to the current sending device to the successor sending device. If the target master device detects that the interval between adjacent periodic messages and the preset relay interval meet the preset abnormal threshold, the target master device interrupts the relay transmission process and jumps to step S5.
7. The scheduling method for a multi-node communication system according to claim 5, characterized in that, The method further includes: When the multi-node communication system detects that a new electronic device is powered on, step S1 is executed; When the message parsing result does not meet the mode decision condition, the new electronic device sends a network access application frame to the target master device, so that the target master device interrupts the relay transmission process after receiving the network access application frame; wherein, the network access application frame is generated based on the device serial number corresponding to the new electronic device; Insert the device serial number of the new electronic device into the end of the address allocation queue, and then proceed to step S4.
8. The scheduling method for a multi-node communication system according to claim 5, characterized in that, The method further includes: When the target master device detects a communication timeout in the relay transmission process, the target master device performs status checks on each slave device participating in the relay transmission process and obtains the status check results; the target master device identifies the slave device whose status check results meet the preset fault determination conditions as the target fault device and removes the target fault device from the address allocation queue; the target master device interrupts the relay transmission process and jumps to step S4 after updating the target device serial number set; When a slave device fails to receive a message sent by the target master device within the preset master device timeout period during the relay transmission process, the slave device that meets the preset declaration conditions is identified as the target declaration device; the target declaration device interrupts the relay transmission process and jumps to step S1.
9. A scheduling device for a multi-node communication system, applied to the multi-node communication system, the multi-node communication system comprising various electronic devices of the same type, characterized in that, The device includes: The message listening module is used to parse the bus messages received in the listening state after each electronic device is powered on, and to obtain the message parsing result according to the preset mode decision rules. An identity collection module is configured to, when the message parsing result meets preset mode decision conditions, obtain the device serial number corresponding to each electronic device, and perform a backoff delay operation on each electronic device based on the device serial number; after each electronic device completes the backoff delay operation, broadcast an identity declaration frame corresponding to each electronic device, and obtain a set of device serial numbers based on the identity declaration frame; wherein, the identity declaration frame is generated based on the device serial number; A target master device election module is configured to sort the set of device serial numbers to obtain a target device serial number set, and determine electronic devices whose serial numbers meet preset candidate conditions as candidate master devices, and electronic devices other than the candidate master devices as slave devices. The candidate master device broadcasts a master device announcement frame, enabling each slave device to perform objection negotiation operations based on the master device announcement frame, generating and sending a negotiation result frame to the candidate master device. The candidate master device parses the negotiation result frame to obtain a protocol parsing result. When the negotiation parsing result meets the preset election conditions, the candidate master device is determined as the target master device, and a first target address is allocated to the target master device. The address allocation module is used to allocate addresses to each slave device in sequence according to the target device serial number set and the target master device, to obtain the address allocation result, and to generate an address allocation queue according to the address allocation result and the first target address. A time synchronization module is provided, which is used by the target master device to broadcast a synchronization reference frame to each slave device, so that each slave device can obtain a target time reference based on the synchronization reference frame. A periodic communication establishment module is used to establish periodic communication by having the target master device perform a relay-style sequential message sending operation based on the address allocation queue and the target time base.
10. A multi-node communication system, characterized in that, include: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the method according to any one of claims 1-8.