A method for synchronous working rhythm of slave machines based on two-bus communication

By calculating the start-up duration and working cycle based on the clock information frame, the slave machine works at a self-timed pace, which solves the problem in the existing technology that the working rhythm of the slave machine equipment must be the same, realizes a flexible synchronization mechanism, simplifies the controller logic and reduces the bus load. burden.

CN115987712BActive Publication Date: 2024-08-30BEIJING JADE BIRD HUANYU FIRE FIGHTING SYST SOFTWARE SERVICE CO +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211638185.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-20
Publication Date
2024-08-30
Estimated Expiration
2042-12-20

AI Technical Summary

Technical Problem

The existing slave device synchronization working rhythm method based on two-bus communication limits the working rhythm of the slave devices on one bus to be the same, resulting in complex logic of the controller and increased bus load in the case of multiple buses, especially when the bus is busy. Controlling the burden.

Method used

The host periodically sends out clock information frames containing the starting time and the current time. The slave calculates the startup duration and calculates the number of cycles and remainders according to the set work cycle, and works on a self-time basis; when receiving non-clock information frames, the slave starts the duration variable Add the length of the frame interval until the next clock information frame update, and the slave can achieve synchronization at a time that does not limit the controller clock broadcast.

Benefits of technology

It realizes the synchronous update of slave machines when the host bus sends clock information frames from time to time, reducing the burden on the bus, simplifying the controller logic, and allowing multiple slave machines to flexibly set working modes, adapting to complex field applications, and easy function expansion.

✦ Generated by Eureka AI based on patent content.
Patent Text Reader

Abstract

This invention discloses a method for synchronizing the working cycle of a slave device based on two-bus communication, relating to the field of synchronization mechanism technology. The method includes: the master bus periodically sending clock information frames and non-clock information frames; when the slave device receives a clock information frame, it calculates the current time minus the start time to obtain the startup duration; the slave device assigns the startup duration as a slave startup duration variable i; the slave device calculates the startup duration and divides it by the slave device's set working cycle to obtain the cycle number n and remainder m; when the slave device receives a non-clock information frame, the slave device startup duration variable i is added to the frame interval duration to obtain the current slave device startup duration; the slave device calculates the cycle number n and remainder m based on the current startup duration until it receives a clock information frame, at which point the startup duration is updated based on the start time and the current time. This invention allows multiple slave devices to flexibly set their working modes, adapting to more complex field applications.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of synchronization mechanisms, and in particular to a method for synchronizing the working rhythm of slave machines based on two-bus communication. Background Art

[0002] The method of synchronizing the working rhythm of slaves based on two-bus communication is applied to the software design of the sound and light alarm system. It is a software processing mechanism for synchronizing the working rhythm of slave devices in a multi-slave system. The host generates a working clock and broadcasts it to the slave. The slave obtains the working clock and adjusts its own working rhythm, thereby synchronizing the working rhythm of multiple slave devices. This is an important part of the software design of the sound and light alarm system.

[0003] The general method of synchronizing the working rhythm of slaves based on two-bus communication is that the working rhythm of the slaves is completely controlled by the controller. This mechanism has the following disadvantages: the working rhythm of the slave devices on a bus must be exactly the same; the controller must issue rhythm control commands according to the working rhythm of the bus. When the bus is very busy, this timed rhythm control increases the bus load; when there are multiple buses on the controller and the working rhythm of each bus is different, the control logic of the controller becomes complicated.

[0004] In order to solve the above problems, it is necessary to design a synchronization mechanism that can support mixed working rhythms of slave devices on a bus, not limit the time when the controller broadcasts the clock, and unify the synchronization mechanism of each bus clock. Summary of the invention

[0005] The technical problem to be solved by the present invention is to provide a mechanism for synchronizing slaves when a host bus sends clock information frames irregularly.

[0006] In order to solve the above technical problems, the present invention provides a method for synchronizing the working rhythm of a slave based on two-bus communication, comprising: a host bus periodically sends a command frame, the command frame includes a clock information frame and a non-clock information frame, the clock information frame contains a start time and a current time, when the slave receives the clock information frame, the current time is subtracted from the start time to obtain the startup duration, the slave assigns the startup duration to a slave startup duration variable i, the slave calculates the startup duration according to the startup duration and divides the startup duration by the working cycle set by the slave to obtain the cycle number n and the remainder m, when the remainder m is 0, the slave starts to work self-timingly in the new working cycle, and when the remainder is not 0, the slave does not process; when the slave receives the non-clock information frame, the slave startup duration variable i plus the frame interval duration is the current slave startup duration, the slave calculates the cycle number n and the remainder m according to the current startup duration, until the slave receives the clock information frame and then updates the startup duration according to the start time and the current time.

[0007] According to a preferred embodiment of the present invention, the working cycles set by the slaves take the lowest common multiple, and the maximum values ​​of the current moment and the starting moment are both multiples of the lowest common multiple.

[0008] According to a preferred embodiment of the present invention, after the current moment reaches the maximum value, it returns to 0 and starts counting again.

[0009] According to a preferred embodiment of the present invention, the current maximum value is not less than a working cycle set by the slave.

[0010] According to a preferred embodiment of the present invention, when the working cycle of the slave changes, the slave subtracts the remainder m before the change from the remainder m calculated according to the changed working cycle to obtain the offset of the self-timing within the changed working cycle and adjust the self-timing time.

[0011] According to a preferred embodiment of the present invention, the variable is the number of frames discretely sent out by the host bus.

[0012] According to a preferred embodiment of the present invention, the calculation processing of the slave machine is all performed at the frame header.

[0013] According to a preferred embodiment of the present invention, the start time and the current time are both byte information in a clock information frame.

[0014] According to a preferred embodiment of the present invention, the time interval between adjacent frames discretely sent by the host bus is 250 ms.

[0015] According to a preferred embodiment of the present invention, the non-clock information frame includes a group inspection frame, a group setting frame, a single point configuration frame, a single point query frame and a single point information active reporting frame.

[0016] The technical effects of the present invention are:

[0017] 1. The present invention discloses a method for synchronizing the working rhythm of a slave based on two-bus communication. The host sends a clock information frame including a starting time and a current time. When the slave receives the clock information frame, the current time is subtracted from the starting time to obtain a startup duration. The slave assigns the startup duration to a slave startup duration variable i. The slave calculates the startup duration based on the startup duration and divides it by a working cycle set by the slave to obtain a cycle number n and a remainder m. When the remainder m is 0, the slave starts to work self-timingly in a new working cycle. When the slave receives a non-clock information frame, the slave startup duration variable i plus the frame interval duration is the current slave startup duration. This achieves the beneficial effect that when the host bus sends clock information frames irregularly, the slave can still update the synchronization, while also reducing the burden on the host bus.

[0018] 2. The present invention provides a method for synchronizing the working rhythm of slaves based on two-bus communication. The host bus can send clock information frames at irregular intervals, thereby greatly simplifying the control logic of the controller during sound and light synchronization. In addition, multiple slaves can flexibly set working modes to adapt to more complex field applications, and it is also easier to expand the functions of the slaves and expand the working modes of other cycles of the slaves in the later stage. DETAILED DESCRIPTION

[0019] The present invention is further described below in conjunction with specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the invention.

[0020] The present invention discloses a method for synchronizing the working rhythm of a slave based on two-bus communication, comprising: a host bus periodically sends out a command frame, the command frame includes a clock information frame and a non-clock information frame, the clock information frame includes a start time and a current time, when the slave receives the clock information frame, the current time is subtracted from the start time to obtain a start time, the slave assigns the start time to a slave start time variable i, the slave calculates the start time according to the start time and divides the start time by a working cycle set by the slave to obtain a cycle number n and a remainder m, when the remainder m is 0, the slave starts to work in a new working cycle by self-timing, when the remainder is not 0, the slave does not process; when the slave receives the non-clock information frame, the slave start time variable i plus the frame interval time is the current slave start time, the slave calculates the cycle number n and the remainder m according to the current start time, until the slave receives the clock information frame and then updates the start time according to the start time and the current time.

[0021] The present invention separates the working clock into clock information and working beat. The clock information frame is sent by the host and includes the starting time and the current time. The working beat is calculated by the slave according to the clock information, the fixed frame interval of the bus and the working cycle set by itself. In this way, the clock information of all buses can be unified, and the current time is assigned according to the time when the clock information is sent. The sending interval of the clock information frame is not limited by the working beat. In addition, the working beat is calculated by the slave itself and is only related to the slave itself. Multiple slaves on a bus can set different working beats.

[0022] Specifically, the host bus broadcasts clock information, and the slave parses the clock information and implements synchronization.

[0023] The clock information frame broadcast by the host bus includes the current time and the start time; the host bus sends a frame command every 250ms, which can be a clock information frame or a non-clock information frame. The start time is the sending time information of the first slave startup frame, and the current time is the sending time of the current clock information frame. Non-clock information frames include: group inspection frames, group setting frames, single-point configuration frames, single-point query frames, and single-point information active reporting frames. From the above description, the host bus does not need to broadcast the clock information frame according to a fixed beat, and the broadcast time can be flexibly adjusted according to the host bus situation.

[0024] When the slave receives the clock information frame, it calculates the startup time, which is the current time minus the start time. The slave synchronization calculation and processing are at the frame header. Because the length of each frame command is different, only the time interval between the frame headers is accurate to 250ms. At this time, the synchronization calculation and processing ensure the accuracy of synchronization. The working beat is calculated at the frame header, where the working beat is: the startup time divided by the slave's working cycle to get the number of cycles n and the remainder m; when the remainder m is 0, it is the beginning of the new working cycle of the slave. The slave works automatically within a cycle. When the remainder m is not 0, the slave does not process. The startup time will accumulate the frame interval at each frame header. When the slave does not receive a new clock information frame, the slave performs the above calculation based on the accumulated result. Because the frame header is also broadcast from the host bus, this accumulated calculation will not cause synchronization errors. When the slave receives a new clock information frame, it will update its own startup time and perform the above calculation at the next frame header to correct the synchronization. In summary, this is the synchronization implementation method of the slave.

[0025] Among them, because the current moment reaches the maximum value and will be reset to 0, the startup duration does not refer to the actual startup duration from the startup moment, but the relative startup duration that ignores the duration before the current moment returns to 0. Because we only focus on the remainder m obtained by dividing the startup duration by the working cycle, and ignore that the startup duration is an integer multiple of the working cycle, so this neglect does not affect the calculation result. The calculated cycle number n is not the real absolute cycle number, but the relative cycle number. Here it is only to describe the calculation process clearly, and this value is not used in actual control.

[0026] From the above description, it can be seen that the maximum values ​​of the current time and the startup time have the following restrictions: when the current time reaches the maximum value, it needs to be reset to 0 and start counting again; the current maximum value is not less than the working cycle of the slave; the current maximum value must be a multiple of the working cycle of the slave; the slave has different working cycle configurations, and the current maximum value must be compatible with various working cycles; in short, the startup duration needs to be a multiple of the least common multiple of all the working cycles of the slave, that is, the maximum value of the current time and the startup time needs to be a multiple of the least common multiple of all the working cycles of the slave. The current working cycle of the slave includes but is not limited to 3s, 4s, 6s and 60s, and the maximum value of the current time and the startup time is 60s. This maximum value is also applicable to other working cycles of the slave, such as: 1s, 2s, 2.5s, 5s, 6s, 10s, 12s and 15s.

[0027] Since the working beat is calculated by the slave according to the clock information, the fixed frame interval of the bus and its own working cycle, when the working cycle of the slave changes, the host does not need to consider this change. The slave calculates the offset of its own self-timing in the new cycle according to the changes before and after its own cycle and adjusts the self-timing time. After the adjustment, the working beat of the slave and other slaves in the same working mode remain synchronized. Specifically, the startup time of the slave before the change is divided by the working cycle before the change to obtain the number of cycles before the change n1 and the remainder before the change m1, and the startup time of the slave after the change is divided by the working cycle after the change to obtain the number of cycles after the change n2 and the remainder after the change m2, and then the offset of the start of the cycle is the remainder m2 minus the remainder m1; the self-timing time in the working cycle after the change of the slave is the sum of the self-timing time in the working cycle before the change of the slave and the offset of the start of the cycle.

[0028] The above-described embodiments are only preferred embodiments for fully illustrating the present invention, and the protection scope of the present invention is not limited thereto. Equivalent substitutions or changes made by those skilled in the art based on the present invention are within the protection scope of the present invention. The protection scope of the present invention shall be subject to the claims.

Claims

1. A method for synchronous working rhythm of slaves based on two-bus communication, characterized in that: include: The host bus periodically sends out command frames, which include clock information frames and non-clock information frames. The clock information frames include a start time and a current time. When the slave receives the clock information frame, it calculates the current time minus the start time to obtain the startup duration. The slave assigns the startup duration to the slave startup duration variable i. The slave calculates the startup duration based on the startup duration and divides it by the working cycle set by the slave to obtain the number of cycles n and the remainder m. When the remainder m is 0, the slave starts to work self-timingly in the new working cycle. When the remainder is not 0, the slave does not process. When the slave receives the non-clock information frame, the slave startup duration variable i plus the frame interval duration is the current slave startup duration. The slave calculates the number of cycles n and the remainder m based on the current startup duration until the slave receives the clock information frame and then updates the startup duration based on the start time and the current time.

2. A method for synchronous working rhythm of slaves based on two-bus communication according to claim 1, characterized in that: The lowest common multiple is taken between the working cycles set by the slaves, and the maximum values ​​of the current time and the starting time are both multiples of the lowest common multiple.

3. A method for synchronous working rhythm of slaves based on two-bus communication according to claim 2, characterized in that: After the current moment reaches the maximum value, it will return to 0 and start counting again.

4. The method for synchronous working rhythm of slaves based on two-bus communication according to claim 1, characterized in that: The current maximum value is not less than the working cycle set by the slave.

5. The method for synchronous working rhythm of slaves based on two-bus communication according to claim 1, characterized in that: When the working cycle of the slave changes, the slave subtracts the remainder m before the change from the remainder m calculated according to the changed working cycle to obtain the offset of the self-timing within the changed working cycle and adjust the self-timing time.

6. The method for synchronous working rhythm of slaves based on two-bus communication according to claim 1, characterized in that: The variable is the number of frames discretely sent out by the host bus.

7. The method for synchronous working rhythm of slaves based on two-bus communication according to claim 1, characterized in that: The calculation processing of the slave is all performed at the frame header.

8. The method for synchronous working rhythm of slaves based on two-bus communication according to claim 1, characterized in that: The start time and the current time are both byte information in the clock information frame.

9. The method for synchronous working rhythm of slaves based on two-bus communication according to claim 1, characterized in that: The time interval between adjacent frames discretely sent by the host bus is 250ms.

10. The method for synchronous working rhythm of slaves based on two-bus communication according to claim 1, characterized in that: The non-clock information frames include group inspection frames, group setting frames, single point configuration frames, single point query frames and single point information active reporting frames.

Citation Information

Patent Citations

  • Wireless network beacon frame synchronization method

    CN110809314A

  • Method for realizing special channel data uniform down-transmission

    CN1852286A