Terminal timing method and terminal equipment
By receiving Bluetooth broadcast packets from multiple peripheral terminals, the target calibration time with high time confidence is determined, and the real-time time of the local terminal is updated, the calibration error problem caused by real-time time error of Bluetooth broadcast during the calibration process of the power meter is solved, and more accurate time calibration is achieved.
Patent Information
- Application Number
- CN202411915551.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-24
- Publication Date
- 2025-04-11
AI Technical Summary
During the calibration process, existing electricity meters are easily affected by large real-time time errors of Bluetooth broadcasts, resulting in calibration errors.
By receiving Bluetooth broadcast packets sent by multiple peripheral terminals, each packet contains real-time time and time confidence, determining the target calibration time with high time confidence, and updating the real-time time of the local terminal.
Ensure the accuracy of local terminal time and avoid timing errors caused by large real-time time errors in Bluetooth broadcasting.
Smart Images

Figure CN119815499A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of time calibration, and in particular to a terminal time calibration method and a terminal device. Background Art
[0002] At present, in order to ensure that the electricity meter can accurately bill, the electricity meter usually needs to adopt a high-precision RTC (Real Time Clock) module (such as a 32K crystal oscillator). Since the errors of mass-produced RTC modules are difficult to ensure consistency, the current electricity meter needs to be calibrated during the working process to ensure the accuracy of its real-time time.
[0003] In the related art, the time calibration of electric energy meters can be carried out by Bluetooth broadcasting, that is, a certain electric energy meter broadcasts its real-time time through Bluetooth, so that other electric energy meters receive the real-time time broadcasted by Bluetooth and calibrate the time. However, if the real-time time error of the electric energy meter performing Bluetooth broadcasting is large, it may cause the electric energy meter receiving the Bluetooth broadcast to calibrate the time incorrectly. Summary of the invention
[0004] In view of the above problems, an embodiment of the present application provides a terminal time synchronization method and a terminal device to solve the above technical problems.
[0005] In a first aspect, an embodiment of the present application provides a terminal time synchronization method, including:
[0006] Receive Bluetooth broadcast data packets sent by multiple peripheral terminals, each Bluetooth broadcast data packet includes real-time time and time credibility, and the time credibility represents the accuracy of the real-time time of the corresponding terminal;
[0007] Determine a target calibration time based on a plurality of Bluetooth advertising data packets;
[0008] Update the real-time time of the local terminal according to the target calibration time.
[0009] In a second aspect, an embodiment of the present application further provides a terminal device, including:
[0010] Time module, the time module is used to output real time;
[0011] A Bluetooth module, which is used to receive Bluetooth broadcast data packets sent by multiple peripheral terminals. Each Bluetooth broadcast data packet includes real-time time and time credibility. The time credibility represents the accuracy of the real-time time of the corresponding terminal.
[0012] The control module is used to determine a target calibration time according to a plurality of Bluetooth broadcast data packets, and to update a real-time time according to the target calibration time.
[0013] The present application receives Bluetooth broadcast data packets sent by multiple surrounding terminals. Since each Bluetooth broadcast data packet includes real-time time and time reliability, and the time reliability represents the accuracy of the real-time time of the corresponding terminal, it is possible to determine a target calibration time with higher accuracy based on multiple Bluetooth broadcast data packets, and then use the target calibration time to update the real-time time of the local terminal, ultimately ensuring the accuracy of the local terminal time and avoiding the phenomenon of time calibration errors caused by large errors in the real-time time of the Bluetooth broadcast.
[0014] These and other aspects of the present application will become more clearly understood in the description of the following embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0016] Figure 1 A schematic diagram of an electricity meter billing system in an embodiment of the present application is shown.
[0017] Figure 2 A flow chart of a method for broadcasting terminal timing information in an embodiment of the present application is shown.
[0018] Figure 3 A schematic diagram showing multiple local terminals performing Bluetooth broadcasting in an embodiment of the present application is shown.
[0019] Figure 4 A schematic diagram of a process of real-time Bluetooth broadcasting in an embodiment of the present application is shown.
[0020] Figure 5 A schematic diagram showing a format of a Bluetooth broadcast data packet in an embodiment of the present application is shown.
[0021] Figure 6 A schematic diagram of a process for determining time credibility in an embodiment of the present application is shown.
[0022] Figure 7 Another schematic diagram of a process for determining time credibility in an embodiment of the present application is shown.
[0023] Figure 8 Another schematic diagram of a process for determining time credibility in an embodiment of the present application is shown.
[0024] Fig. 9 Another schematic diagram of a process for determining time credibility in an embodiment of the present application is shown.
[0025] Fig.10 A flow chart of a terminal time synchronization method in an embodiment of the present application is shown.
[0026] Fig.11 A schematic diagram of a process for determining a target calibration time in an embodiment of the present application is shown.
[0027] Fig.12 Another flow chart of determining the target calibration time in an embodiment of the present application is shown.
[0028] Fig.13 Another flow chart of determining the target calibration time in an embodiment of the present application is shown.
[0029] Fig.14 A schematic diagram of a process for calibrating real time in an embodiment of the present application is shown.
[0030] Fig.15 A schematic diagram of a terminal device in an embodiment of the present application is shown.
[0031] Among them, 110 is an electric meter terminal, 120 is a concentrator, 130 is a network, 140 is a server, 1501 is a time module, 1502 is a Bluetooth module, and 1503 is a control module. DETAILED DESCRIPTION
[0032] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be understood as limiting the present application.
[0033] In order to enable those skilled in the art to better understand the solutions of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application.
[0034] In the embodiments of the present application, it should be noted that, in this article, relational terms such as first and second, etc. are merely used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations.
[0035] Moreover, the terms "comprises," "comprising," or any other variation thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus that includes a list of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.
[0036] In the description of the embodiments of the present application, words such as "example" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "example" or "for example" in the embodiments of the present application is not to be interpreted as being more preferred or having more advantages than another embodiment or design. The use of words such as "example" or "for example" is intended to present relative concepts in a clear manner.
[0037] In addition, the "plurality" in the embodiments of the present application refers to two or more than two. In view of this, in the embodiments of the present application, "plurality" can also be understood as "at least two". "At least one" can be understood as one or more, for example, one, two or more. For example, including at least one means including one, two or more, and there is no limit on which ones are included. For example, including at least one of A, B and C, then A, B, C, A and B, A and C, B and C, or A, B and C can be included.
[0038] It should be noted that, in the embodiments of the present application, "and / or" describes the association relationship of the associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / ", unless otherwise specified, generally indicates that the associated objects before and after are in an "or" relationship.
[0039] The embodiments of the present application provide a terminal time synchronization method and a terminal device, which are described in detail below.
[0040] First, before introducing the terminal time synchronization method of the present application, an exemplary application scenario of the terminal time synchronization method of the present application and a terminal time synchronization information broadcasting method for sending a Bluetooth broadcast data packet are introduced.
[0041] See also Figure 1 , Figure 1 A schematic diagram of an electricity meter billing system in an embodiment of the present application is shown, wherein the electricity meter billing system includes multiple electricity meter terminals 110, a concentrator 120, a network 130 and a server 140.
[0042] Specifically, the meter terminal 110 can measure the electric energy used by the user. For example, the meter terminal 110 can measure household electricity or industrial electricity. Generally, each meter terminal 110 can correspond to one user, that is, each meter terminal 110 measures the electricity consumption of one user. In some possible embodiments, each meter terminal 110 can also correspond to one user, that is, each meter terminal 110 measures the electricity consumption of multiple users. In some other possible embodiments, multiple meters can also correspond to one user, that is, multiple meter terminals 110 measure the electricity consumption of the same user. Exemplarily, the meter terminal 110 can be, but not limited to, a single-phase energy meter, a three-phase three-wire energy meter, or a three-phase four-wire energy meter.
[0043] In some embodiments of the present application, the meter terminal 110 can receive the real-time time data sent by the concentrator 120 to calibrate the time. For example, the meter terminal 110 can obtain the real-time time data sent by the concentrator 120 through HPLC (Low-voltage Power Line Carrier Communication) to calibrate the time. In some embodiments of the present application, a certain meter terminal 110 can receive the real-time time data sent by other meter terminals 110 to calibrate the time. For example, other meter terminals 110 can broadcast the real-time time through a Bluetooth module. After receiving the real-time time data broadcast by other meter terminals 110, the certain meter terminal 110 can perform time calibration. In some embodiments of the present application, the meter terminal 110 can also receive the real-time time data sent by the operation and maintenance terminal to calibrate the time. For example, the operation and maintenance handheld terminal of the power system operation and maintenance personnel sends the real-time time data to the meter terminal 110 on site. After the meter terminal 110 receives the real-time time data of the operation and maintenance handheld terminal, the time calibration can be performed.
[0044] The concentrator 120 is connected to the meter terminal 110 via a power line so that the concentrator 120 and the meter terminal 110 can perform data communication or control command transmission. For example, the concentrator 120 can query the meter terminal 110 for power control instructions at regular intervals (e.g., 1 hour). After the meter terminal 110 receives the query control instruction, the meter terminal 110 can return the power metering data to the concentrator 120. After the concentrator 120 collects the power metering data of each meter terminal 110, the concentrator 120 reports it to the server 140 via the network 130 for processing (e.g., data storage, electricity fee calculation, etc.). Exemplarily, the concentrator 120 can be, but is not limited to, a passive concentrator, an active concentrator, or an intelligent concentrator.
[0045] The network 130 connects the concentrator 120 and the server 140 so that the two can communicate with each other to facilitate the exchange of information and / or data. In some embodiments, the network 130 of the electric meter billing system can be any one or more of a wired network or a wireless network. For example, the network 130 can include a cable network, a wired network, an optical fiber network, a telecommunications network, an intranet, the Internet, a local area network (LAN), a wide area network (WAN), a wireless local area network (WLAN), a metropolitan area network (MAN), etc.
[0046] The server 140 can process data and / or information from the concentrator 120. For example, the server 140 can receive the electric energy metering data of each electric meter terminal 110 sent by the concentrator 120, so as to measure the electricity fee. For another example, the server 140 can receive the alarm information of the abnormality of the electric meter terminal 110 sent by the concentrator 120, so that the server 140 can send the alarm information to the operation and maintenance personnel in time. In some embodiments, the server 140 can be a single server or a server group. The server 140 group can be a centralized server group connected to the network 130 via an access point, or a distributed server group connected to the network 130 via at least one access point. In some embodiments, the server 140 can be implemented on a cloud platform. As an example only, the cloud platform can include a private cloud, a public cloud, a hybrid cloud, a community cloud, a distributed cloud, an internal cloud, a multi-layer cloud, etc. or any combination thereof.
[0047] It can be understood that the above scenario is only an exemplary application scenario of the terminal timing information broadcasting method of the present application, and does not constitute a limitation on the terminal timing information broadcasting method of the present application. The terminal timing information broadcasting method of the present application can also be applied to surrounding terminal timing scenarios. For example, the terminal timing information broadcasting method of the present application can also be applied to billing scenarios such as gas meters or water and electricity meters; for another example, the terminal timing information broadcasting method of the present application can also be applied to household appliances such as smart door locks, refrigerators, and washing machines; for another example, the terminal timing information broadcasting method of the present application can also be applied to shared terminal scenarios such as shared bicycles, shared electric vehicles, and shared cars; for another example, the terminal timing information broadcasting method of the present application can also be applied to agricultural terminals (such as greenhouse temperature control terminals, greenhouse humidity control terminals), logistics terminals (such as logistics robots), industrial terminals (such as industrial robots), and other Internet of Things scenarios.
[0048] Continue reading Figure 2 , Figure 2A schematic diagram of a process of a terminal timing information broadcasting method in an embodiment of the present application is shown, wherein the terminal timing information broadcasting method can send a Bluetooth broadcast data packet, and the terminal timing information broadcasting method includes:
[0049] Step S201, obtaining operation data of the local terminal;
[0050] Specifically, the local terminal has a Bluetooth module, and the local terminal can broadcast the real-time time via the Bluetooth module, so that the surrounding terminals perform time calibration after receiving the Bluetooth broadcast signal and parsing to obtain the real-time time.
[0051] It should be noted that the local terminal and the peripheral terminal refer to two terminals, one of which is a local terminal and the other is a peripheral terminal. Figure 3 , Figure 3 A schematic diagram of multiple local terminals performing Bluetooth broadcasting in an embodiment of the present application is shown. Taking terminal A as a local terminal as an example, terminal B, terminal C and terminal D are peripheral terminals of terminal A, that is, terminal A can send Bluetooth broadcast data packets to terminal B, terminal C and terminal D through a terminal timing information broadcasting method, and terminal B, terminal C and terminal D can receive the Bluetooth broadcast data packets of terminal A through a terminal timing method and perform time synchronization; taking terminal B as a local terminal as an example, terminal A, terminal C and terminal D are peripheral terminals of terminal B, that is, terminal B can send Bluetooth broadcast data packets to terminal A, terminal C and terminal D through a terminal timing information broadcasting method, and terminal A, terminal C and terminal D can receive the Bluetooth broadcast data packets of terminal B through a terminal timing method and perform time synchronization; the same is true for terminal C and terminal D, which will not be repeated here.
[0052] Exemplarily, the local terminal or the peripheral terminal may be, but not limited to, an electric energy meter, a gas meter, a water meter, a smart door lock, a refrigerator, a washing machine, a shared bicycle, a shared electric vehicle, a shared car, a logistics robot, an industrial robot, etc. It should be noted that the above peripheral terminal may be the same type of product as the local terminal, for example, the local terminal is an electric energy meter, and the peripheral terminal receiving the Bluetooth broadcast signal is also an electric energy meter; for another example, the local terminal is an electric energy meter, and the peripheral terminal receiving the Bluetooth broadcast signal is a gas meter or a water meter.
[0053] In some embodiments of the present application, the real-time time of the local terminal can be determined by calibrating the real-time time data sent by wireless communication. For example, the local terminal can calibrate the real-time time by a Bluetooth broadcast time calibration method. The Bluetooth broadcast time calibration method refers to a method in which the local terminal can receive the real-time time data sent by the Bluetooth broadcast of the surrounding terminals through the Bluetooth module to perform time calibration. For another example, the local terminal can calibrate the real-time time by a ciphertext time calibration method. The ciphertext time calibration method refers to a method in which the local terminal receives the real-time time data sent by the operation and maintenance handheld terminal of the operation and maintenance personnel to the RS485 communication module and the infrared communication module of the local terminal to perform time calibration.
[0054] In some embodiments of the present application, the real-time time of the local terminal can be determined by calibrating the real-time time data sent by wired communication. For example, the local terminal can calibrate the real-time time by a carrier broadcast time synchronization method. The carrier broadcast time synchronization method refers to a method in which the local terminal obtains the real-time time data sent by the concentrator 120 through the HPLC carrier communication method to perform time synchronization.
[0055] The operation data of the local terminal refers to the data related to the real-time time during the operation of the local terminal, so as to determine the time credibility of the local terminal according to the operation data of the local terminal. In some embodiments of the present application, the operation data of the local terminal may include the data of the current operation, which may be obtained by real-time acquisition. For example, the operation data of the local terminal may include the current time of the local terminal, the power supply battery voltage, etc. The current time may be obtained by reading the current time of the RTC module, and the power supply battery voltage may be obtained by measuring the battery voltage through an analog-to-digital converter.
[0056] In some embodiments of the present application, the operating data of the local terminal may include data saved during the historical operation process, and the data saved during the historical operation process can be obtained by reading data in storage circuits such as registers. For example, the operating data of the local terminal may include historical time calibration moments, historical power-off moments, time before calibration, time after calibration, the credibility of the time source used in the historical time calibration process of the local terminal, the length of time since the last calibration of the local terminal to real-time time, the last time calibration method of the local terminal (such as the aforementioned Bluetooth broadcast time calibration method, ciphertext time calibration method, carrier broadcast time calibration method, etc.), the production time of the local terminal, the production time of the Bluetooth module, etc.
[0057] It should be noted that the operating data of the above-mentioned local terminal is only an exemplary implementation of the present application. Those skilled in the art can select the corresponding operating data of the local terminal according to actual needs to determine the time credibility. For example, the operating data of the local terminal can also include the service life of the local terminal, the working time of the power supply battery, the working time of the RTC module, etc.
[0058] Step S202, determining the time credibility of the local terminal according to the operation data of the local terminal;
[0059] Since the operation data of the local terminal is related to the real-time time, the time credibility of the local terminal can be determined according to the operation data of the local terminal, and the time credibility characterizes the accuracy of the real-time time of the local terminal, so that the local terminal can broadcast the real-time time by Bluetooth by judging whether the time credibility meets the requirements. In some embodiments of the present application, the time credibility of the local terminal can be represented by numbers, such as 0, 1, 2, 3...15, etc. In some embodiments of the present application, the time credibility of the local terminal can be represented by letters, such as S, A, B, C, D, etc.
[0060] It can be understood that the method of expressing the time reliability of the local terminal is not limited to this. Technical personnel in this field can use various symbols to express the time reliability of the local terminal according to actual needs. The use of various symbols to express the time reliability of the local terminal falls within the scope of protection of this application. For example, the time reliability of the local terminal can also be expressed by Greek letters.
[0061] As an exemplary embodiment of determining time credibility, taking the case where the operation data of the local terminal includes a calibration time interval (i.e., the time length from the last calibration of the local terminal to the real-time time) as an example, the time credibility of the local terminal can be determined according to the rules of the following table:
[0062] Calibration time interval (T) Time credibility T≥10 days 0 5 days ≤ T < 10 days 1 1 day ≤ T < 5 days 2 1 hour ≤ T < 1 day 3 T<1 hour 4
[0063] It can be seen that if the local terminal calibration time interval T≥10 days, the time reliability of the local terminal can be determined to be 0; if the local terminal calibration time interval is 5 days≤T<10 days, the time reliability of the local terminal can be determined to be 1; if the local terminal calibration time interval is 1 day≤T<5 days, the time reliability of the local terminal can be determined to be 2; if the local terminal calibration time interval is 1 hour≤T<1 day, the time reliability of the local terminal can be determined to be 3; if the local terminal calibration time interval T<1 hour, the time reliability of the local terminal can be determined to be 4.
[0064] As another exemplary embodiment of determining time credibility, taking the case where the operation data of the local terminal includes a historical time calibration mode (i.e., the mode of the last time calibration of the local terminal) as an example, the time credibility of the local terminal can be determined according to the rules of the following table:
[0065] Historical timekeeping method Time credibility No time calibration method C Bluetooth broadcast time synchronization method B Carrier broadcast timing method A Cipher text time synchronization method S
[0066] It can be seen that if the local terminal has not calibrated the real-time time through any time calibration method, the time credibility of the local terminal can be determined to be C; if the local terminal has calibrated the real-time time through the Bluetooth broadcast time calibration method, the time credibility of the local terminal can be determined to be B; if the local terminal has calibrated the real-time time through the carrier broadcast time calibration method, the time credibility of the local terminal can be determined to be A; if the local terminal has calibrated the real-time time through the ciphertext time calibration method, the time credibility of the local terminal can be determined to be S.
[0067] It should be pointed out that the above-mentioned implementation method for determining time credibility is only an exemplary embodiment of the present application. Those skilled in the art may also adopt other methods to determine time credibility according to actual needs. For example, when the operating data of the local terminal includes the method of the last time calibration of the local terminal and the calibration time interval, step S202 may also determine the time credibility of the local terminal in combination with the calibration time interval and the time calibration method.
[0068] Step S203: When the time credibility of the local terminal meets the first preset condition, the real-time time of the local terminal is broadcasted via Bluetooth.
[0069] When the time credibility of the local terminal meets the first preset condition, it means that the accuracy of the real-time time of the local terminal meets the requirement. Therefore, the real-time time can be broadcasted via Bluetooth through the Bluetooth module of the local terminal, so that the surrounding terminals can calibrate the time after receiving the Bluetooth broadcast signal.
[0070] For example, taking the aforementioned determination of the time credibility based on the calibration time interval of the local terminal as an example, the first preset condition may include that the time credibility of the local terminal is greater than the first preset value, for example, the first preset condition may be that the time credibility is greater than 0, that is, the real-time time of the local terminal is broadcasted via Bluetooth only when the time credibility of the local terminal is 1, 2, 3 or 4. For another example, taking the aforementioned determination of the time credibility based on the historical time calibration method of the local terminal as an example, the first preset condition may be that the time credibility is greater than C, that is, the real-time time of the local terminal is broadcasted via Bluetooth only when the time credibility of the local terminal is B, A or S.
[0071] In an embodiment of the present application, the present application determines the time credibility of the local terminal based on the operating data of the local terminal. Since the time credibility represents the accuracy of the real-time time of the local terminal, when the time credibility of the local terminal meets the first preset condition, the real-time time of the local terminal can be broadcasted via Bluetooth, so that the surrounding terminals can calibrate the time according to the real-time time broadcasted by the local terminal via Bluetooth, ultimately ensuring the accuracy of the time of the surrounding terminals and avoiding the phenomenon that the real-time time of large-area electric energy meters is incorrect due to Bluetooth broadcasting even though the real-time time error of the local terminal is large.
[0072] In some embodiments of the present application, see Figure 4 , Figure 4 A schematic diagram of a process of real-time Bluetooth broadcasting of an embodiment of the present application is shown. When the time credibility of the local terminal meets the first preset condition, the step of performing Bluetooth broadcasting of the real-time time of the local terminal includes:
[0073] Step S401, when the time credibility of the local terminal meets the first preset condition, data packaging is performed on the real-time time and the time credibility of the local terminal to obtain a Bluetooth broadcast data packet;
[0074] Specifically, data packaging of the real-time time and time credibility of the local terminal may refer to string concatenation, encoding, and encryption of data such as the real-time time and time credibility, and after data packaging, a Bluetooth broadcast data packet may be obtained. As an example, taking the Bluetooth broadcast data packet using the BLE 5.0 (Bluetooth Low Energy 5.0, low-power Bluetooth technology 5.0) protocol as an example, refer to Figure 5 , Figure 5 A format diagram of a Bluetooth broadcast data packet in an embodiment of the present application is shown. The Bluetooth broadcast data packet includes an Extended Header Length data segment, an AdvMode data segment, an Extended Header data segment, and an AdvDat data segment. The AdvDat data segment contains the real-time time and time credibility of the local terminal.
[0075] It can be understood that the data of the local terminal can also be packaged to obtain a Bluetooth broadcast data packet. For example, the AdvDat data segment can also include the manufacturer ID number of the Bluetooth module, the MAC address of the Bluetooth module, the encrypted signature information, the power-on running time of the Bluetooth module, etc.; or, the Bluetooth broadcast data packet can also be generated by other Bluetooth broadcast protocols, such as A2DP (Advanced Audio Distribution Profile), BR / EDR (Basic Rate / Enhanced Data Rate), etc.
[0076] Step S402: Perform Bluetooth broadcast based on the Bluetooth broadcast data packet, so that the surrounding terminals receive the Bluetooth broadcast data packet and update the real-time time based on the real-time time and time credibility of the local terminal.
[0077] After obtaining the Bluetooth broadcast data packet, Bluetooth broadcast can be performed based on the Bluetooth broadcast data packet, so that the surrounding terminals receive the Bluetooth broadcast data packet and update the real-time time based on the real-time time and time credibility of the local terminal. For example, when the Bluetooth broadcast data packet adopts the BLE protocol, the Bluetooth module of the surrounding terminal can receive the Bluetooth broadcast data packet according to the BLE protocol, and after parsing and decrypting the Bluetooth broadcast data packet, the real-time time and time credibility of the local terminal can be obtained, and finally the real-time time of the surrounding terminals can be updated.
[0078] It should be noted that since the peripheral terminals can not only parse the real-time time but also the time credibility based on the received Bluetooth data packets, the peripheral terminals will select the real-time times of multiple different terminals based on the time credibility, and thus select the real-time time with the highest time credibility for time calibration, thereby ultimately ensuring the accuracy of the real-time time of the peripheral terminals.
[0079] For example, see Figure 3 , the time credibility of terminal A, terminal B, terminal C and terminal D all meet the first preset condition and are performing Bluetooth broadcast based on their respective Bluetooth broadcast data packets. Assuming that the time credibility of terminal A is 1, the time credibility of terminal B is 2, the time credibility of terminal C is 3, and the time credibility of terminal D is 4, for terminal A, terminal A can receive real-time time with time credibility of 2, 3, and 4 respectively, so terminal A can choose the real-time time with time credibility of 4 for time calibration; for terminal B, terminal B can receive real-time time with time credibility of 1, 3, and 4 respectively, so terminal B can choose the real-time time with time credibility of 4 for time calibration, and the same is true for terminal B and terminal C, which will not be repeated here.
[0080] It can be seen that since the local terminal broadcasts the real-time time and time credibility via Bluetooth, multiple local terminal Bluetooth broadcast data packets are received for time calibration, thereby ensuring the accuracy of the real-time time of the surrounding terminals.
[0081] It should be pointed out that the above-mentioned time calibration by selecting a real-time time with higher time credibility is only an exemplary embodiment of the present application. In some possible embodiments, the terminal receiving multiple Bluetooth broadcast data packets can also determine the real-time time as the time calibration benchmark by performing mathematical processing (such as probability calculation, mathematical statistics, etc.) on the time credibility and the real-time time.
[0082] In some embodiments of the present application, the operation data of the local terminal includes the time source credibility, and the step of determining the time credibility of the local terminal according to the operation data of the local terminal includes:
[0083] The time credibility of the local terminal is determined according to the time source credibility, and the time credibility of the local terminal is less than or equal to the time source credibility.
[0084] It should be noted that the time source credibility represents the credibility of the time source used in the historical time calibration process of the local terminal. For example, taking the real-time time of the local terminal based on the Bluetooth broadcast time calibration method as an example, the time source credibility of the Bluetooth broadcast time calibration method is the credibility of the real-time time received based on the Bluetooth broadcast. Figure 3 Terminal A selects the real-time with a time credibility of 4 (i.e., the real-time time of terminal D) for time calibration, and the time source credibility of terminal A is 4. For another example, taking the case where the real-time time of the local terminal is based on the carrier broadcast time calibration method, the time source credibility of the carrier broadcast time calibration method is the credibility of the real-time time of the concentrator 120. For another example, taking the case where the real-time time of the local terminal is based on the ciphertext time calibration method, the time source credibility of the ciphertext time calibration method is the credibility of the real-time time of the operation and maintenance handheld terminal.
[0085] After obtaining the time source credibility of the local terminal, the time credibility of the local terminal can be determined based on the time source credibility, so that the time credibility of the local terminal is less than or equal to the time source credibility. After time calibration, the time credibility of the local terminal may be reduced, thereby avoiding the phenomenon that the time accuracy decreases while the time credibility does not decrease during the process of forwarding time calibration in sequence through multiple terminals, which ultimately causes the surrounding terminals to select real-time time with lower accuracy for time calibration.
[0086] As an example, continue to refer to Figure 3 , for example, in Figure 3 In the example, terminal A selects the real time with a time reliability of 4 (i.e., the real time of terminal D) for time calibration. Since terminal A is close to terminal D, it can be determined that the time reliability of terminal A is equal to the time reliability of terminal D, i.e., the time reliability of terminal A is 4. For another example, Figure 3 Terminal B selects the real time with a time credibility of 4 (i.e., the real time of terminal D) for time calibration. Since terminal B is far away from terminal D, the time credibility of terminal D can be attenuated by 1 and used as the time credibility of terminal A, i.e., the time credibility of terminal A is 3.
[0087] In some embodiments of the present application, see Figure 6 , Figure 6 A schematic diagram of a process for determining time credibility in an embodiment of the present application is shown. The steps of determining the time credibility of a local terminal according to the time source credibility include:
[0088] Step S601, when the time source credibility is greater than a first preset value and less than a second preset value, determining that the time credibility of the local terminal is equal to the time source credibility;
[0089] Step S602: When the time source credibility is greater than or equal to a second preset value, the time source credibility is attenuated according to a first preset rule to serve as the time credibility of the local terminal.
[0090] For example, the time source credibility and the local terminal time credibility can meet the rules in the following table:
[0091] Time source credibility (N0) Time reliability of the local terminal (N) 0<N0<4 N=N0 4≤N0 N=N0-1
[0092] According to the above table, it can be seen that the first preset value is 0, the second preset value is 4, and the first preset rule refers to attenuating the time source credibility by 1. When the time source credibility N0 is 1, 2, or 3, since the time source credibility is low, the time credibility N of the local terminal is determined to be equal to the time source credibility N0, so as to avoid the abnormal phenomenon that the time credibility N of the local terminal decays to a negative value; and when the time source credibility N0 is greater than or equal to 4, the time source credibility N0-1 can be used as the time credibility N of the local terminal, so as to avoid the phenomenon that the time credibility N of the local terminal remains unchanged relative to the time source credibility after time calibration, resulting in subsequent time calibration errors of surrounding terminals.
[0093] It can be understood that the first preset value, the second preset value and the first preset rule in the above embodiment are only exemplary embodiments, and those skilled in the art can set corresponding values and rules according to actual needs.
[0094] In some embodiments of the present application, for example, for an embodiment in which the operation data of a local terminal includes the time source credibility and the calibration time interval, refer to Figure 7 , Figure 7 Another flow chart of determining time credibility in an embodiment of the present application is shown. The step of determining the time credibility of the local terminal according to the time source credibility includes:
[0095] Step S701, when the time source credibility is greater than a first preset value and less than a second preset value, determining that the time credibility of the local terminal is equal to the time source credibility;
[0096] Step S702: when the time source credibility is greater than or equal to the second preset value and less than or equal to the third preset value, attenuate the time source credibility according to the first preset rule to determine the time credibility of the local terminal;
[0097] Step S703, when the time source credibility is greater than the third preset value and the calibration time interval is greater than the first preset duration, attenuating the time source credibility according to the second preset rule to determine the time credibility of the local terminal;
[0098] Step S704: when the time source credibility is greater than the third preset value and the calibration time interval is less than or equal to the first preset duration, determine that the time credibility of the local terminal is equal to the time source credibility.
[0099] For example, the time source credibility, calibration time interval, and local terminal time credibility can meet the rules in the following table:
[0100] Time source credibility (N0) Calibration time interval (T) Time reliability of the local terminal (N) 0<N0<4 \ N=N0 4≤N0<14 \ N=N0-1 14≤N0 T>10 days N=N0-1 14≤N0 T≤10 days N=N0
[0101] According to the above table, it can be seen that the first preset value is 0, the second preset value is 4, and the third preset value is 14. The first preset rule and the second preset rule refer to attenuating the time source credibility by 1. The first preset time is 10 days. When the time source credibility N0 is 1, 2, or 3, it can be determined that the time credibility N of the local terminal is equal to the time source credibility N0; and when the time source credibility N0 is 4 to 13, the time source credibility N0-1 can be used as the time credibility N of the local terminal; when the time source credibility N0 is greater than or equal to 14 and the calibration time interval is greater than 10 days, the time source credibility N0-1 can be used as the time credibility N of the local terminal; when the time source credibility N0 is greater than or equal to 14 and the calibration time interval is less than or equal to 10 days, the time source credibility N0 can be used as the time credibility N of the local terminal.
[0102] It can be seen that the present application can also combine the credibility of the time source and the calibration time interval to determine the time credibility of the local terminal, so as to avoid the phenomenon that the real-time time of the local terminal is reduced due to long-term non-calibration, while the time credibility is not reduced synchronously with the accuracy of the real-time time, which ultimately leads to the phenomenon that the surrounding terminals have time calibration errors.
[0103] In some embodiments of the present application, for example, in an embodiment where the operation data of the local terminal also includes the current time, the historical time calibration time, and the historical power-off time, refer to Figure 8 , Figure 8 Another flow chart of determining time credibility in an embodiment of the present application is shown, wherein the step of determining the time credibility of the local terminal according to the operation data of the local terminal further includes:
[0104] Step S801, when the current time is before the historical time calibration time, determining that the time credibility of the local terminal is a first preset value;
[0105] Step S802: When the current time is before the historical power-off time, determine that the time credibility of the local terminal is a first preset value.
[0106] It should be noted that the current time of the local terminal refers to the time when the local terminal determines its time credibility, the historical time calibration time refers to the time when the local terminal last calibrated the time, and the historical power-off time refers to the time when the local terminal last powered off. It can be seen that as time goes by, the current time is generally after the historical time calibration time and the historical power-off time. Therefore, if the current time is before the historical time calibration time, or the current time is before the historical power-off time, the time credibility of the local terminal can be determined to be the first preset value (for example, 0), to indicate that the time credibility of the local terminal is completely unreliable. If the first preset condition means that the time credibility is greater than the first preset value, the local terminal will not broadcast its real-time time.
[0107] It can be understood that if the current time is after the historical time calibration time and the historical power-off time, it means that the real-time time of the local terminal is not completely disordered. Therefore, it can be determined that the time credibility of the local terminal is not the first preset value, and the time credibility of the local terminal is further determined in combination with other embodiments. For example, the time credibility of the local terminal is further determined based on the aforementioned time source credibility and calibration time interval.
[0108] In some embodiments of the present application, for example, for an embodiment in which the operation data of the local terminal also includes the power supply battery voltage and the time source credibility, refer to Fig. 9 , Fig. 9 Another flow chart of determining time credibility in an embodiment of the present application is shown, wherein the step of determining the time credibility of the local terminal according to the operation data of the local terminal further includes:
[0109] Step S901, when the power supply battery voltage is less than the first preset voltage and the time source credibility is equal to the fourth preset value or the fifth preset value, determining that the time credibility of the local terminal is the fourth preset value;
[0110] Step S902, when the power supply battery voltage is greater than or equal to the first preset voltage and the time source credibility is equal to the fourth preset value or the fifth preset value, determine that the time credibility of the local terminal is the fifth preset value; wherein the fourth preset value is less than the fifth preset value, and the fourth preset value and the fifth preset value are greater than the first preset value.
[0111] It should be noted that when the power supply battery of the local terminal is less than the first preset voltage, the time module (RTC module) of the local terminal may be lost or slow down. Therefore, the present application can also combine the time source credibility and the power supply battery voltage to determine the time credibility of the local terminal.
[0112] For example, the power supply battery voltage, the time source credibility, and the time credibility of the local terminal may satisfy the rules in the following table:
[0113] Time source credibility (N0) Power supply battery voltage (V) Time reliability of the local terminal (N) N0=1 or N0=2 In <V0 N=1 N0=1 or N0=2 V ≥ V0 N=2
[0114] According to the above table, it can be seen that the fourth preset value is 1 and the fifth preset value is 2. At this time, the credibility of the time source is relatively small. Therefore, if the power supply battery of the local terminal is less than the first preset voltage, the time credibility of the local terminal can be determined as a smaller fourth preset value; if the power supply battery of the local terminal is greater than or equal to the first preset voltage, the time credibility of the local terminal is determined as the fifth preset value.
[0115] In some embodiments of the present application, the operating data of the local terminal may also include pre-calibration time and post-calibration time, where the pre-calibration time of the local terminal refers to the time before the last time calibration of the local terminal, and the post-calibration time of the local terminal refers to the time after the last time calibration of the local terminal. Based on the operating data of the local terminal, the step of determining the time credibility of the local terminal also includes: when the time interval between the pre-calibration time and the post-calibration time is within a preset threshold, determining that the time credibility of the local terminal is a first preset value.
[0116] It should be noted that if the time before calibration is too different from the time after calibration, the time calibration process of the local terminal will be restricted in some possible scenarios. For example, for the embodiment in which the local terminal is an electric energy meter, the electric energy meter usually limits the time before calibration and the time after calibration to less than 5 minutes or 10 minutes to avoid the phenomenon that the real-time time of the electric energy meter is maliciously tampered with. For example, if the time before calibration of the electric energy meter is 9:55, and the time after calibration is 10:55, the calibration process can only change the time to 10:00 or 10:05. Therefore, if the time interval between the time before calibration and the time after calibration is within the preset threshold (for example, 4min55s-5min5s, 9min55s-10min5s), it means that the time calibration process of the local terminal is restricted, and then it is necessary to determine the time credibility of the local terminal to be the first preset value to indicate that the time credibility of the local terminal is completely unreliable.
[0117] In some embodiments of the present application, in order to more clearly illustrate the relationship between the operating data of the local terminal of the present application and the time credibility, the relationship between the operating data of the local terminal of the present application and the time credibility is shown in an exemplary table below, as follows:
[0118]
[0119] It should be pointed out that the above table is intended to clearly illustrate the relationship between the operating data and time credibility of the local terminal in this application. Technical personnel in this field can also make equivalent modified designs based on the above table under the guidance of this application. These equivalent modified designs should be understood as within the scope of the technical solution of this application.
[0120] Next, based on the terminal time synchronization information broadcasting method, this application begins to introduce the terminal time synchronization method, see Fig.10 , Fig.10 A schematic diagram of a process flow of a terminal time synchronization method in an embodiment of the present application is shown, wherein the terminal time synchronization method includes:
[0121] Step S1001, receiving Bluetooth broadcast data packets sent by multiple peripheral terminals, each Bluetooth broadcast data packet includes real-time time and time credibility, and the time credibility represents the accuracy of the real-time time of the corresponding terminal;
[0122] For example, see Figure 3 When terminal A, terminal B, terminal C and terminal D use the terminal timing information broadcasting method described in the above embodiment to perform Bluetooth broadcasting, for terminal A as a local terminal, terminal A can receive Bluetooth broadcast data packets sent by multiple peripheral terminals such as terminal B, terminal C and terminal D; for terminal B as a local terminal, terminal B can receive Bluetooth broadcast data packets sent by multiple peripheral terminals such as terminal A, terminal C and terminal D; the same is true for terminal C and terminal D, which will not be repeated here.
[0123] Exemplarily, the local terminal may receive Bluetooth broadcast data packets using Bluetooth communication protocols such as BLE (Bluetooth Low Energy 5.0, low-power Bluetooth technology) protocol, A2DP (Advanced Audio Distribution Profile) protocol, BR / EDR (Basic Rate / Enhanced Data Rate) protocol, etc.
[0124] Step S1002, determining a target calibration time according to a plurality of Bluetooth broadcast data packets;
[0125] Since each Bluetooth broadcast data packet includes real-time time and time reliability, and the time reliability represents the accuracy of the real-time time of the corresponding terminal, after receiving Bluetooth broadcast data packets sent by multiple surrounding terminals, the target calibration time with higher time accuracy can be determined based on multiple Bluetooth broadcast data packets to facilitate the calibration of the real-time time of the local terminal.
[0126] In some embodiments of the present application, the target calibration time can be determined by screening the real time of multiple Bluetooth broadcast packets, for example, see Figure 3, the time credibility of terminal A, terminal B, terminal C and terminal D are 1, 2, 3 and 4 respectively, the time credibility of terminal D is the highest, and the time credibility of terminal A is the lowest. After terminal A receives the Bluetooth broadcast data packets sent by multiple peripheral terminals such as terminal B, terminal C and terminal D, terminal A can select the real-time time of the Bluetooth broadcast data packet sent by terminal D as the target calibration time, that is, the real-time time with the highest time credibility can be selected from multiple Bluetooth broadcast data packets as the target calibration time.
[0127] In some embodiments of the present application, the target calibration time is obtained by calculating the real time of multiple Bluetooth broadcast data packets, for example, see Figure 3 The time credibility of terminal A, terminal B, terminal C and terminal D are 1, 2, 4 and 4 respectively. The time credibility of terminal C is the highest and the time credibility of terminal D is the lowest. After terminal A receives Bluetooth broadcast data packets sent by multiple peripheral terminals such as terminal B, terminal C and terminal D, terminal A can calculate the average of the real-time time of terminal C and terminal D as the target calibration time.
[0128] It can be understood that the above-mentioned method for determining the target calibration time is only an exemplary embodiment of the present application. Those skilled in the art can determine the target calibration time based on multiple Bluetooth broadcast data packets in an appropriate manner according to actual needs. For example, the target calibration time can also be determined in combination with the Bluetooth broadcast data packet and the distance between the local terminal and the surrounding terminals.
[0129] Step S1003: updating the real-time time of the local terminal according to the target calibration time.
[0130] After determining the target calibration time, the real-time time of the local terminal can be updated according to the target calibration time to ensure the accuracy of the real-time time in the local terminal. In some embodiments of the present application, the real-time time of the local terminal can be directly changed to the target calibration time to achieve the local terminal time calibration process, for example, the target calibration time is written into the RTC module of the local terminal. In some embodiments of the present application, the real-time time of the local terminal and the target calibration time can also be calculated, and then the local terminal can be time-calibrated. For example, the average value between the real-time time of the local terminal and the target calibration time can be calculated, and then the average value is written into the RTC module of the local terminal to complete the time calibration process.
[0131] In an embodiment of the present application, the present application receives Bluetooth broadcast data packets sent by multiple peripheral terminals. Since each Bluetooth broadcast data packet includes real-time time and time credibility, the time credibility represents the accuracy of the real-time time of the corresponding terminal. Therefore, a target calibration time with higher accuracy can be determined based on multiple Bluetooth broadcast data packets, and then the target calibration time is used to update the real-time time of the local terminal, ultimately ensuring the accuracy of the local terminal time and avoiding the phenomenon of time calibration errors caused by large errors in the real-time time of the Bluetooth broadcast.
[0132] In some embodiments of the present application, see Fig.11 , Fig.11 A schematic diagram of a process for determining a target calibration time in an embodiment of the present application is shown, wherein the step of determining the target calibration time according to multiple Bluetooth broadcast data packets includes:
[0133] Step S1101, parsing multiple Bluetooth broadcast data packets to obtain multiple sets of parsed data, each set of parsed data including real-time time and time credibility;
[0134] It should be noted that after the local terminal receives the Bluetooth broadcast data packet, it is usually necessary to parse the Bluetooth broadcast data packet to obtain multiple sets of parsed data. Generally, parsing the Bluetooth broadcast data packet may refer to disassembling, decoding, and decrypting the Bluetooth broadcast data packet string. Since each Bluetooth broadcast data packet includes real-time time and time credibility, the parsed data obtained after parsing will include real-time time and time credibility.
[0135] It can be understood that when the Bluetooth broadcast data packet also includes other data, the parsed data obtained by parsing can also include corresponding data. For example, when the Bluetooth broadcast data packet also includes the manufacturer ID number of the Bluetooth module, the MAC address of the Bluetooth module, the encrypted signature information, the power-on running time of the Bluetooth module and other data, the parsed data obtained by parsing will also include the above data.
[0136] Step S1102, screening out analysis data satisfying a second preset condition from the multiple groups of analysis data, to obtain at least one group of target analysis data satisfying the second preset condition;
[0137] The second preset condition refers to the condition that the parsed data meets the requirement of the local terminal to update the real-time time, so that the local terminal can select the parsed data that meets the requirement for time calibration. In some embodiments of the present application, the second preset condition may include that the time credibility of the target parsed data is greater than or equal to the time credibility of the local terminal, for example, see Figure 3, assuming that the time credibility of terminal A, terminal B, terminal C and terminal D are 2, 1, 3 and 4 respectively, the time credibility of terminal D is the highest, and the time credibility of terminal B is the lowest. After terminal A receives Bluetooth broadcast data packets sent by multiple peripheral terminals such as terminal B, terminal C and terminal D, since the time credibility of terminal B is less than the time credibility of terminal A, terminal A can select the two sets of parsed data obtained by parsing the Bluetooth broadcast data packets of terminal C and terminal D as the two sets of target parsed data.
[0138] In some embodiments of the present application, the second preset condition may include that the distance between the local terminal and the surrounding terminal is less than a certain distance (eg, 50 m). For example, see Figure 3 , assuming that the distances between terminal A and terminal B, terminal C and terminal D are 30m, 45m and 65m respectively. Since the distance between terminal A and terminal D is greater than 50m, terminal A can select two sets of parsed data obtained by parsing the Bluetooth broadcast data packets of terminal B and terminal C as two sets of target parsed data.
[0139] It can be understood that the above-mentioned screening of target parsing data that meets the second preset condition is only an exemplary embodiment, and the implementation of the second preset condition is not limited to this. For example, in some possible embodiments, the two groups of parsing data with the largest real-time time and the smallest real-time time can be removed from multiple groups of parsing data, and all other parsing data can be used as target parsing data.
[0140] Step S1103, determining a target calibration time according to at least one set of target parsing data.
[0141] After obtaining the target resolution data, the target calibration time can be determined so as to use the target calibration time to calibrate the local terminal. In some embodiments of the present application, the step of determining the target calibration time based on at least one set of target resolution data includes: determining the real time with the highest time credibility in multiple sets of target resolution data as the target calibration time.
[0142] For example, for the above-mentioned assumption that the time credibility of terminal A, terminal B, terminal C and terminal D are 2, 1, 3, and 4 respectively, terminal A can select two sets of parsed data obtained by parsing the Bluetooth broadcast data packets of terminal C and terminal D as implementation examples of two sets of target parsed data. Since the time credibility of terminal D is the highest, the real-time time of terminal D can be determined as the target calibration time.
[0143] In some embodiments of the present application, each Bluetooth broadcast data packet also includes a time when time synchronization has expired. Then, each set of parsed data obtained in step S1101 also includes a time when time synchronization has expired. The time when time synchronization has expired represents the time interval between the corresponding surrounding terminal and the last non-Bluetooth broadcast time synchronization. The non-Bluetooth broadcast time synchronization may include the aforementioned carrier broadcast time synchronization method and ciphertext time synchronization method.
[0144] For example, taking the local terminal and the peripheral terminal as an electric energy meter, the concentrator 120 performs carrier broadcast time calibration on all or part of the electric energy meters through the power line at 00:00 every day. If the current time of the electric energy meter is 12:00, the time elapsed from the calibration is 12 hours. For another example, the operation and maintenance personnel use a handheld operation and maintenance terminal to perform a ciphertext time calibration on a certain electric energy meter at 09:00. If the current time of the electric energy meter is 14:00, the time elapsed from the calibration of the electric energy meter is 5 hours.
[0145] In some embodiments of the present application, for example, for each set of parsed data further including the time elapsed for calibration, see Fig.12 , Fig.12 Another flow chart of determining the target calibration time in an embodiment of the present application is shown, wherein the step of determining the target calibration time according to at least one set of target parsing data includes:
[0146] Step S1201, determining the credibility factor of each set of target parsed data according to the time credibility of each set of target parsed data and the time elapsed from the calibration;
[0147] It should be noted that compared with non-Bluetooth broadcast time synchronization methods such as carrier broadcast time synchronization and ciphertext time synchronization, the Bluetooth broadcast time synchronization method has lower accuracy. Therefore, although the time credibility of the surrounding terminals can represent the accuracy of their real-time time to a certain extent, as time goes by, the time credibility of the surrounding terminals cannot better represent the accuracy of their real-time time.
[0148] In the above embodiment, the trust factor of each set of target parsed data can be determined by combining the time credibility and the time elapsed from the time calibration. The trust factor is not only related to the time credibility, but also to the time elapsed from the time calibration. Therefore, the trust factor can better characterize the accuracy of the real-time time of the corresponding peripheral terminal. As an example, the trust factor, the time credibility and the time elapsed from the time calibration can satisfy the following formula:
[0149]
[0150] Among them, a and b are parameters, Telapese is the time elapsed from calibration, and CR is the time reliability.
[0151] It can be seen that in the above formula, the larger the time credibility CR is and the smaller the time Telapese is, the larger the credibility factor Kr is, so it can be characterized that the accuracy of the real-time time of the surrounding terminals is higher; conversely, the smaller the time credibility CR is and the larger the time Telapese is, the smaller the credibility factor Kr is, so it can be characterized that the accuracy of the real-time time of the surrounding terminals is lower.
[0152] The above formula is only an exemplary relationship between the credibility factor, the time credibility and the time elapsed from the calibration. Those skilled in the art may adjust the above formula according to actual needs. For example, the above formula may be modified to:
[0153]
[0154] It can be understood that these modifications still fall within the scope of the technical solution of this application.
[0155] Step S1202, determining the target calibration time according to the credibility factor of each set of target analysis data and the real time.
[0156] After determining the trust factor of each set of target parsed data, the target calibration time can be determined based on the trust factor of each set of target parsed data and the real time. In some embodiments of the present application, the real time of the target parsed data with the largest trust factor can be determined as the target calibration time among multiple sets of target parsed data. For example, see Figure 3 Terminal A parses the Bluetooth broadcast data packets of terminal B, terminal C and terminal D to obtain three corresponding target resolution data that meet the second preset condition. The credibility factors of the three sets of target resolution data are 1.2, 1.4 and 0.8 respectively. Since the credibility factor of terminal C is the highest, it can be determined that the real-time actual time of terminal C is the target calibration time.
[0157] In some embodiments of the present application, when the local terminal receives a large number of Bluetooth broadcast data packets from surrounding terminals, mathematical statistics can be performed on the trust factors and real-time times of multiple sets of target resolution data to determine the most accurate real-time time as the target calibration time. Fig.13 , Fig.13 Another flow chart of determining the target calibration time in an embodiment of the present application is shown. According to the trust factor and real-time time of each set of target parsed data, the step of determining the target calibration time may include:
[0158] Step S1301, determining the probability density of the real time of each set of target parsed data according to the credibility factor and the real time of each set of target parsed data;
[0159] Step S1302: Determine the real time with the largest probability density as the target calibration time in multiple sets of target analysis data.
[0160] It should be noted that the probability density of the real-time time can represent the probability of the real-time time appearing in all the real-time times. As an example, the probability density of the real-time time of each group of target parsed data can be calculated according to the following formula:
[0161]
[0162] Among them, x i is the real time sorted from small to large, P(x i ) is x i The probability of occurrence of real time, f(x i ) is x i Probability density at real time.
[0163] It can be seen that the real-time time with the highest probability density can be statistically obtained through the above formula, so the real-time time with the highest probability density can be used as the target calibration time, and ultimately the accuracy of the local terminal time calibration can be guaranteed.
[0164] It should be noted that, those skilled in the art can adopt the real-time time with the highest credibility factor as the target calibration time according to actual needs, or use the real-time time with the highest probability density as the target calibration time. For example, when the local terminal determines that the number of parsed data that meets the second preset condition is less than 5 groups, the real-time time with the highest credibility factor can be used as the target calibration time; when the local terminal determines that the number of parsed data that meets the second preset condition is greater than 5 groups, the real-time time with the highest probability density can be used as the target calibration time.
[0165] In some embodiments of the present application, for example, for an embodiment in which the real-time time of the local terminal is calculated with the target calibration time and then the time is calibrated, refer to Fig.14 , Fig.14 A schematic diagram of a process of calibrating real-time time in an embodiment of the present application is shown, wherein the step of updating the real-time time of the local terminal according to the target calibration time includes:
[0166] Step 1401, obtaining the current real-time time of the local terminal, and determining the calibration time difference between the current real-time time and the target calibration time;
[0167] Step 1402, when the calibration time difference is less than the first preset time difference, calibrate the real-time time of the local terminal according to the calibration time difference;
[0168] Step 1403: When the calibration time difference is greater than or equal to the first preset time difference, calibrate the real-time time of the local terminal according to the first preset time difference.
[0169] Specifically, the current real-time time of the local terminal can be obtained by reading the time module (such as the RTC module) of the local terminal. After obtaining the current real-time time of the local terminal, the calibration time difference between the current real-time time and the target calibration time can be determined. For example, the current real-time time of the local terminal is 10:11:55, and the target calibration time is 10:13:55, so it can be determined that the calibration time difference between the current real-time time and the target calibration time is +2:00; for another example, the current real-time time of the local terminal is 10:11:55, and the target calibration time is 10:05:35, that is, the calibration time difference between the current real-time time and the target calibration time is -6:20.
[0170] The first preset time difference refers to the maximum adjustable time difference each time the local terminal calibrates the time. For example, for the embodiment in which the local terminal is an electric energy meter, the relevant standards require that the maximum adjustable time difference of the electric energy meter each time is 5 minutes or 10 minutes, so as to avoid the electric energy meter time being maliciously tampered with and causing abnormal billing. Therefore, in the above embodiment, if the calibration time difference is less than the first preset time difference, the real-time time of the local terminal can be calibrated normally according to the calibration time difference to ensure the accuracy of the real-time time of the local terminal. For example, for the embodiment in which the current real-time time of the above local terminal is 10:11:55 and the target calibration time is 10:13:55, the local terminal can modify the real-time time to 10:13:55 normally according to the calibration time difference of +2:00.
[0171] On the contrary, if the calibration time difference is greater than or equal to the first preset time difference, the real-time time of the local terminal can be calibrated according to the first preset time difference to avoid the real-time time modification of the local terminal exceeding the adjustable maximum time difference. For example, for the above-mentioned embodiment where the current real-time time of the local terminal is 10:11:55 and the target calibration time is 10:05:35, the local terminal can modify the real-time time to 10:06:55 according to the first preset time difference of 5:00.
[0172] In some embodiments of the present application, when the calibration time difference is greater than or equal to a first preset time difference, the step of calibrating the real-time time of the local terminal according to the first preset time difference includes: when the calibration time difference is greater than or equal to the first preset time difference, obtaining the backup real-time time of the local terminal; updating the real-time time of the local terminal according to the first preset time difference and the backup real-time time.
[0173] It should be noted that when the calibration time difference is greater than or equal to the first preset time difference, it indicates that the time module of the local terminal may be abnormal, resulting in low accuracy of the real-time time. If the real-time time of the local terminal is still used for calibration, the real-time time of the local terminal after calibration may still have a large error. In the above embodiment, when the calibration time difference is greater than or equal to the first preset time difference, the real-time time of the local terminal can be updated according to the first preset time difference and the backup real-time time. The backup real-time time can be the real-time time of other circuit modules of the local terminal. For example, the backup real-time time can be the real-time time output by the RTC module in the Bluetooth module. Therefore, the backup real-time time of the local terminal is used for calibration, which can avoid the phenomenon that the real-time time of the local terminal after calibration may still have a large error.
[0174] It can be understood that when the calibration time difference is less than the first preset time difference, after the local terminal calibrates its real-time time with the calibration time difference, the backup real-time time of other circuit modules can be updated to the real-time time of the local terminal to ensure the consistency between the real-time time of the local terminal and the backup real-time time.
[0175] In some embodiments of the present application, before the step of receiving Bluetooth broadcast data packets sent by multiple surrounding terminals, the method also includes: determining the time credibility of the local terminal based on the operating data of the local terminal; determining the Bluetooth broadcast reception duration of the local terminal based on the time credibility of the local terminal, the Bluetooth broadcast reception duration representing the duration for the local terminal to receive Bluetooth broadcast data packets sent by multiple surrounding terminals.
[0176] It should be noted that the determination process of the time credibility of the local terminal can refer to the determination process in the aforementioned terminal timing information broadcasting method, which will not be repeated here. After determining the time credibility of the local terminal, the Bluetooth broadcast reception duration of the local terminal can be determined, so that the local terminal can perform time calibration at appropriate intervals according to its time credibility.
[0177] For example, when the time credibility of the local terminal is 0, the Bluetooth broadcast reception time of the local terminal is 1 minute, that is, the local terminal adjusts the time according to the Bluetooth broadcast data packet received in 1 minute; when the time credibility of the local terminal is 1, the Bluetooth broadcast reception time of the local terminal is 10 minutes, that is, the local terminal adjusts the time according to the Bluetooth broadcast data packet received in 10 minutes; when the time credibility of the local terminal is 2, the Bluetooth broadcast reception time of the local terminal is 60 minutes, that is, the local terminal adjusts the time according to the Bluetooth broadcast data packet received in 60 minutes; when the time credibility of the local terminal is 3-13, the Bluetooth broadcast reception time of the local terminal is 24 hours, that is, the local terminal adjusts the time according to the Bluetooth broadcast data packet received in 24 hours; when the time credibility of the local terminal is 14 or 15, the local terminal does not need to receive the Bluetooth broadcast data packet.
[0178] It can be seen that the higher the time credibility of the local terminal, the longer the local terminal takes to receive Bluetooth broadcast data packets, so that the local terminal can obtain more Bluetooth broadcast data packets and finally filter out the most accurate target calibration time from them, so that the local terminal can calibrate the time more accurately; conversely, the lower the time credibility of the local terminal, the shorter the time the local terminal takes to receive Bluetooth broadcast data packets, so that the local terminal can quickly calibrate the time to avoid the phenomenon that the real-time time accuracy of the local terminal is low and cannot be updated for a long time.
[0179] Furthermore, in order to better implement the terminal timing information broadcasting method in the embodiment of the present application, on the basis of the terminal timing information broadcasting method, the present application also provides a terminal device, referring to Fig.15 , Fig.15 A schematic diagram of a terminal device in an embodiment of the present application is shown, wherein the terminal device includes a time module 1501, a Bluetooth module 1502 and a control module 1503.
[0180] Specifically, the time module 1501 is used to output the real-time time. The time module 1501 may include circuits such as an oscillator and a counter. The clock signal is output by the oscillator, and the counter is counted to convert it into the corresponding real-time time. Exemplarily, the oscillator may be, but is not limited to, a crystal oscillator (e.g., an oscillation frequency of 32768H), an RC oscillator, or an LC oscillator. The Bluetooth module 1502 performs Bluetooth broadcasting on the real-time time so that the surrounding terminals receive the Bluetooth broadcast data packet and perform time calibration. Exemplarily, the Bluetooth module 1502 may be, but is not limited to, a classic Bluetooth module 1502, a low-power Bluetooth module 1502 (BLE), a dual-mode Bluetooth module 1502, etc. The control module 1503 is used to determine the time credibility of the terminal device according to the operation data of the terminal device, so as to control the Bluetooth module 1502 to perform Bluetooth broadcasting on the real-time time when the time credibility meets the first preset condition, wherein the time credibility characterizes the accuracy of the real-time time of the terminal device. Exemplarily, the control module 1503 may include but is not limited to an MCU microcontroller, a SOC (System on Chip) chip, a SIP (system in package) chip, and the like.
[0181] In some embodiments of the present application, the control module 1503 is further used to:
[0182] When the time credibility of the terminal device meets the first preset condition, data packaging is performed on the real-time time and the time credibility of the terminal device to obtain a Bluetooth broadcast data packet;
[0183] The Bluetooth module 1502 is controlled to perform Bluetooth broadcast based on the Bluetooth broadcast data packet, so that the surrounding terminals receive the Bluetooth broadcast data packet and update the real-time time based on the real-time time and time credibility of the terminal device.
[0184] In some embodiments of the present application, the Bluetooth module 1502 is also used to receive Bluetooth broadcast data packets sent by multiple peripheral terminals, each Bluetooth broadcast data packet includes real-time time and time credibility, so that the control module 1503 can perform time calibration based on the Bluetooth broadcast data packets sent by the peripheral terminals.
[0185] In some embodiments of the present application, the control module 1503 is used to determine the target calibration time according to multiple Bluetooth broadcast data packets, and update the real-time time of the time module 1501 according to the target calibration time, thereby ensuring the accuracy of the real-time time of the local terminal.
[0186] In some embodiments of the present application, the control module 1503 is further used to: parse multiple Bluetooth broadcast data packets to obtain multiple groups of parsed data, each group of parsed data including real-time time and time credibility;
[0187] Screening the parsed data satisfying the second preset condition from the multiple sets of parsed data to obtain at least one set of target parsed data satisfying the second preset condition;
[0188] determining a target calibration time based on at least one set of target resolution data;
[0189] Among them, the second preset condition includes that the time credibility of the target parsed data is greater than or equal to the time credibility of the terminal device.
[0190] It should be understood that Fig.15The terminal device and its modules shown can be implemented in various ways. For example, in some embodiments, the terminal device and its modules can be implemented by hardware, software or a combination of software and hardware. Among them, the hardware part can be implemented using dedicated logic; the software part can be stored in a memory and executed by an appropriate instruction execution system, such as a microprocessor or a dedicated design hardware. Those skilled in the art will understand that the above methods and systems can be implemented using computer executable instructions and / or included in a processor control code, such as a carrier medium such as a disk, CD or DVD-ROM, a programmable memory such as a read-only memory (firmware), or a data carrier such as an optical or electronic signal carrier. Such code is provided on the carrier medium such as a disk, CD or DVD-ROM, a programmable memory such as a read-only memory (firmware), or a data carrier such as an optical or electronic signal carrier. The system and its modules of the present application can not only be implemented by hardware circuits such as ultra-large-scale integrated circuits or gate arrays, semiconductors such as logic chips, transistors, etc., or programmable hardware devices such as field programmable gate arrays, programmable logic devices, etc., but can also be implemented by software such as executed by various types of processors, and can also be implemented by a combination of the above hardware circuits and software (e.g., firmware).
[0191] It should be noted that the above description of the device and its modules is only for convenience of description and does not limit the present application to the scope of the embodiments. It is understandable that, after understanding the principle of the system, those skilled in the art may arbitrarily combine the modules or form a subsystem to connect with other modules without deviating from the principle. For example, Fig.15 The time module 1501, Bluetooth module 1502 and control module 1503 disclosed in the disclosure may be different modules in a system, or one module may realize the functions of two or more of the above modules. For example, the time module 1501 and the Bluetooth module 1502 may be two modules respectively having the functions of outputting real-time time and receiving and sending Bluetooth signals, or may be a module having both the functions of outputting real-time time and receiving and sending Bluetooth signals.
[0192] The above are only preferred embodiments of the present application, and are not intended to limit the present application in any form. Although the present application has been disclosed as above with preferred embodiments, it is not intended to limit the present application. Any technical personnel in the field can make some changes or modify the technical contents disclosed above into equivalent embodiments without departing from the scope of the technical solution of the present application. However, any brief modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present application without departing from the content of the technical solution of the present application are still within the scope of the technical solution of the present application.
Claims
1. A terminal time calibration method, characterized in that: include: Receiving Bluetooth broadcast data packets sent by multiple peripheral terminals, each of the Bluetooth broadcast data packets includes real-time time and time credibility, and the time credibility represents the accuracy of the real-time time of the corresponding terminal; Determine a target calibration time according to a plurality of the Bluetooth broadcast data packets; The real-time time of the local terminal is updated according to the target calibration time.
2. The terminal time synchronization method according to claim 1, characterized in that: The step of determining the target calibration time according to the plurality of Bluetooth broadcast data packets comprises: Parsing a plurality of the Bluetooth broadcast data packets to obtain a plurality of groups of parsed data, each group of the parsed data including the real time and the time credibility; Screening the parsed data satisfying the second preset condition from the plurality of groups of parsed data to obtain at least one group of target parsed data satisfying the second preset condition; A target calibration time is determined based on at least one set of the target resolution data.
3. The terminal time calibration method according to claim 2, characterized in that: The second preset condition includes that the time credibility of the target parsed data is greater than or equal to the time credibility of the local terminal.
4. The terminal time calibration method according to claim 2, characterized in that: The step of determining the target calibration time according to at least one set of the target parsing data comprises: Among the multiple groups of target parsed data, the real time with the highest time credibility is determined as the target calibration time.
5. The terminal time calibration method according to claim 2, characterized in that: Each of the Bluetooth broadcast data packets also includes a time elapsed from the time calibration, and each group of the parsed data also includes a time elapsed from the time calibration, wherein the time elapsed from the time calibration represents the time interval between the corresponding peripheral terminal and the last non-Bluetooth broadcast time calibration; The step of determining the target calibration time according to at least one set of the target parsing data comprises: Determining a credibility factor of each set of the target parsed data according to the time credibility of each set of the target parsed data and the time elapsed from the calibration; The target calibration time is determined according to the trust factor of each set of the target parsed data and the real time.
6. The terminal time calibration method according to claim 5, characterized in that: The step of determining the target calibration time according to the trust factor of each set of the target parsed data and the real time comprises: Among the multiple groups of target parsing data, the real time of the target parsing data with the largest credibility factor is determined as the target calibration time.
7. The terminal time calibration method according to claim 5, characterized in that: The step of determining the target calibration time according to the trust factor of each set of the target parsed data and the real time comprises: Determining the probability density of the real-time of each group of the target parsed data according to the trust factor and the real-time of each group of the target parsed data; In the multiple groups of target analysis data, the real time with the largest probability density is determined as the target calibration time.
8. The terminal time calibration method according to claim 1, characterized in that: The step of updating the real-time time of the local terminal according to the target calibration time comprises: Acquire the current real-time time of the local terminal, and determine a calibration time difference between the current real-time time and the target calibration time; When the calibration time difference is less than a first preset time difference, calibrating the real-time time of the local terminal according to the calibration time difference; When the calibration time difference is greater than or equal to the first preset time difference, the real-time time of the local terminal is calibrated according to the first preset time difference.
9. The terminal time calibration method according to claim 8, characterized in that: When the calibration time difference is greater than or equal to the first preset time difference, the step of calibrating the real-time time of the local terminal according to the first preset time difference comprises: When the calibration time difference is greater than or equal to the first preset time difference, acquiring the backup real-time time of the local terminal; The real-time time of the local terminal is updated according to the first preset time difference and the backup real-time time.
10. The terminal time calibration method according to any one of claims 1 to 9, characterized in that: Before the step of receiving Bluetooth broadcast data packets sent by multiple peripheral terminals, the method further includes: Determining the time credibility of the local terminal according to the operation data of the local terminal; The Bluetooth broadcast reception duration of the local terminal is determined according to the time credibility of the local terminal, where the Bluetooth broadcast reception duration represents the duration for the local terminal to receive Bluetooth broadcast data packets sent by multiple peripheral terminals.
11. A terminal device, characterized in that: include: A time module, wherein the time module is used to output real time; A Bluetooth module, the Bluetooth module is used to receive Bluetooth broadcast data packets sent by multiple peripheral terminals, each of the Bluetooth broadcast data packets includes real-time time and time credibility, and the time credibility represents the accuracy of the real-time time of the corresponding terminal; A control module is used to determine a target calibration time according to a plurality of the Bluetooth broadcast data packets, and to update a real-time time according to the target calibration time.
12. The terminal device according to claim 11, characterized in that: The control module is further used for: parsing the plurality of Bluetooth broadcast data packets to obtain a plurality of groups of parsed data, each group of the parsed data including the real time and the time credibility; Screening the parsed data satisfying the second preset condition from the plurality of groups of parsed data to obtain at least one group of target parsed data satisfying the second preset condition; determining a target calibration time based on at least one set of said target resolution data; The second preset condition includes that the time credibility of the target parsed data is greater than the time credibility of the terminal device.