Beidou short message time calibration method, device and storage medium
By combining chip timer and satellite signal data in the Beidou short message system, multiple calibrations are performed using specific algorithms, the problem of time verification failure when signal is poor is solved, and the accuracy and reliability of short message communication is improved .
Patent Information
- Application Number
- CN202411336819.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2044-09-25
AI Technical Summary
The Beidou short message system cannot accurately obtain the time when the signal is poor, resulting in a failure of time verification, affecting the accuracy of short message transmission.
A method is adopted to ensure the accuracy of time by combining a chip timer and satellite signal data using a specific algorithm to calibrate the satellite signal data after multiple acquisitions. The specific steps include enabling the timer after the chip is powered on, obtaining the initial time, and calibrating it by comparing it with the satellite signal data, using the first algorithm and the second algorithm to process the initial 10 times and subsequent signal data respectively to ensure the time accuracy.
When the signal is poor, the accuracy of Beidou short message time is improved through multiple calibrations and comparisons, avoiding the strongest beam switching and inaccurate initial signal data, and ensuring the reliability of short message communication.
Smart Images

Figure CN118884801B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Beidou short message technology, and in particular to a Beidou short message time calibration method, device and storage medium. Background Art
[0002] CRC: Cyclic Redundancy Check, an algorithm used to detect data transmission or storage errors. CRC-6 refers to a CRC version that uses a 6-bit checksum. Since the CRC-6 checksum is 6 bits long, the probability of a misjudgment (i.e., an error not being detected) is 1 / 64.
[0003] Week count: Week count is a time counting method in the Beidou satellite navigation system, used to record the system operation time. Beidou Time (BDT) uses the SI unit second as the basic unit for continuous accumulation, without leap seconds, and the starting time corresponds to 00:00:00 on January 1, 2006 UTC. The Beidou system's whole week count (WN) starts from 00:00:00 on January 1, 2006 Beidou Time, and counts from zero. The rollover period is 8192 weeks, which is about 157 years.
[0004] Seconds of week: Beidou week count is part of the Beidou system time system. The system time is recorded by counting weeks and seconds of week. The count starts from zero at 0:0:0:0 Beidou time every Sunday, and there are 604800 seconds per week.
[0005] Short message communication is one of the unique services of the BeiDou system that distinguishes it from other global satellite navigation systems. As an important part of the national emergency response system, short message communication services have played a positive role in people's livelihood security, disaster relief and reduction, and field search and rescue in recent years. At present, the BeiDou-3 short message communication service platform has been completed and put into use. During the BeiDou short message transmission process, one of the verification items for the transmission data is the time. If there is a deviation in the time, the verification will fail, and the short message cannot be sent. Therefore, ensuring the accuracy of the time is crucial for the transmission of short messages.
[0006] The Beidou short message chip itself has a counter, but because there is no battery, it cannot save the current time. Beidou satellites will have time information in the communication message. After the chip finds the signal, it can parse the data from the message to get the time value as the initial time. When the signal is good, the message time can be regularly decoded for timing. However, when the signal is not good, the time value may not be regularly parsed. At this time, it is necessary to enable the internal counter of the chip to accumulate timing based on the previous accurate time. When the signal is good, the time is calibrated by the data parsed from the satellite message. The chip itself does not have a system time as a reference, and can only get the time through satellite data, and the time obtained from satellite data is not 100% accurate (because the broadcast information sent by Beidou satellites contains standard time data, but the broadcast information uses CRC-6 verification, which has a 1 / 64 error probability). Therefore, it is necessary to process the data through some technical means to obtain the most accurate time possible. Summary of the invention
[0007] The present invention aims to solve at least one of the technical problems in the related art to a certain extent. To this end, one object of the present invention is to provide a method, device and storage medium for Beidou short message time calibration, which can obtain Beidou short message time as reliably as possible when both the accumulated timing by the short message chip timer and the Beidou satellite signal decoding time are unreliable.
[0008] The technical solution adopted by the present invention is:
[0009] In a first aspect, the present invention provides a method for calibrating the time of Beidou short messages, which includes: S11: After the chip is powered on, set the initial parameters: set the number of cycles n = 1, the last week count last_wn = 0, the seconds within the last week last_tow = 0, the current week count wn = 0, the seconds within the current week tow = 0, the current week count current_wn = 0, the seconds within the current week current_tow = 0; set the time counter timecounter to start timing, increment by 1 per second, and set the seconds within the current week current_tow to automatically increment by 1 every 1 s. When current_tow reaches 604800, it automatically resets to 0, and at the same time current_wn automatically increments by 1; S12: Search for satellite broadcast signals, parse the first satellite signal data from them, and then verify the first satellite signal data; S13: If the first satellite signal data cannot be parsed, or the first satellite signal data does not meet the preset value range, return to step S12; conversely, if the first satellite signal data can be parsed and the first satellite signal data meets the preset value range, then extract the first time data from the first satellite signal data. The first time data includes the first week count and the seconds within the first week. Assign the first week count to wn and the seconds within the first week to tow, that is, wn = the first week count, tow = the seconds within the first week; when n = 1, assign wn to last_wn and current_wn, and assign tow to last_tow and current_tow, that is, last_wn = current_wn = wn, last_tow = current_tow = tow, and return to step S12; S14: If wn < last_wn or "wn = last_wn and tow <= last_tow", then discard wn and tow, and jump to step S17; S15: If wn = last_wn, calculate the difference between current_tow and tow. If the difference is greater than 2, then discard wn and tow, and jump to step S17; S16: Update last_wn = wn, last_tow = tow; if current_wn is not equal to wn, update current_wn = wn; if current_tow is not equal to tow, update current_tow = tow; at the same time, clear the time counter time_counter; when n = 9, set the temporary week count tmp_wn = 0, the temporary seconds within the week tmp_tow = 0, set the continuous counter continuous_count = 0, assign wn to tmp_wn, and assign tow to tmp_tow, that is, tmp_wn = wn, tmp_tow = tow;S17: Update the number of cycles n=n+1, and determine whether n is equal to 10. If so, proceed to the next step S18, otherwise, return to step S12; S18: Use the second algorithm to calibrate the current week second current_tow and the current week count current_wn. ;
[0010] Among them, the use of the second algorithm to calibrate the current week second current_tow and the current week count current_wn includes: S181: searching for satellite broadcast signals, if the signal strength value CNR of the satellite broadcast signal is less than 40, then discarding the satellite broadcast signal, otherwise, collecting the satellite broadcast signal; S182: sorting all collected satellite broadcast signals according to signal strength, finding the beam with the strongest signal strength and recording the beam number, recorded as max_cnr_beam, and then parsing the second satellite signal data from the beam with beam number = max_cnr_beam, and then verifying the second satellite signal data; S183: if the second satellite signal cannot be parsed, If the second satellite signal data is not satisfied with the preset value range, or the second satellite signal data does not meet the preset value range, then return to step S181; otherwise, if the second satellite signal data can be parsed and the second satellite signal data meets the preset value range, then extract the second time data from the second satellite signal data, the second time data including the second week count and the second week seconds, assign the second week count to wn, and assign the second week seconds to tow, that is, wn=the second week count, tow=the second week seconds; S184: compare the values of wn and tmp_wn, tow and tmp_tow, if wn is not equal to tmp_wn, then update the continuous counter continuous_count= 0, update tmp_wn = wn, tmp_tow = tow, and return to step S181; S185: If the value of tow-tmp_tow is not equal to 6 and tow is not equal to tmp_tow, then update the continuous counter continuous_count = 0, update tmp_wn = wn, tmp_tow = tow, and return to step S181; S186: If tow is equal to tmp_tow, then return to step S181; S187: If tow-tmp_tow = 6, then update tmp_tow = tow, and update the continuous counter continuous_count = continuous s_count+1, go to the next step S188; S188: determine whether continuous_count is equal to 10, if not, return to step S181, if yes, go to the next step S189; S189: clear the time counter time_counter, update continuous_count=0, and then determine whether the value of tow-last_tow-time_counter is less than 2, if the value is less than 2, update last_wn=wn, last_tow=tow, if current_wn is not equal to wn, update current_wn=wn;If current_tow is not equal to tow, then update current_tow=tow; if the value is greater than or equal to 2, then update last_wn=wn, last_tow=tow; finally return to step S181. ;
[0011] The data contents of the first satellite signal data and the second satellite signal data are the same, and the satellite signal data include a satellite number, a beam number, a week count, and seconds in a week; the checking of the satellite signal data in step S12 and step S182 includes: if the satellite number is outside 59-61, it means that the satellite number is erroneous, the data is unreliable, and the satellite signal data is discarded; if the beam number is outside 1-7, it means that the beam number is erroneous, the data is unreliable, and the satellite signal data is discarded; if the seconds in a week are greater than 7*24*3600, it means that the seconds in a week are erroneous, the data is unreliable, and the satellite signal data is discarded; if the week count is greater than 8191, it means that the week count is erroneous, the data is unreliable, and the satellite signal data is discarded.
[0012] In a second aspect, the present invention provides a device for calibrating the time of Beidou short messages, comprising: an initialization module, which is used to set initial parameters after the chip is powered on: set the number of loop times n = 1, the last week count last_wn = 0, the seconds within the last week last_tow = 0, the current week count wn = 0, the seconds within the current week tow = 0, the current week count current_wn = 0, the seconds within the current week current_tow = 0; set the time counter timecounter to start timing, increment by 1 per second, and set the seconds within the current week current_tow to automatically increment by 1 every 1 s. When current_tow reaches 604800, it automatically resets to 0, and at the same time current_wn automatically increments by 1; a first satellite signal data acquisition module, which is used to search for satellite broadcast signals, parse out the first satellite signal data from them, and then verify the first satellite signal data; a first satellite signal data assignment module, which is used to return to the first satellite signal data acquisition module if the first satellite signal data cannot be parsed out, or if the first satellite signal data does not meet the preset value range; on the contrary, if the first satellite signal data can be parsed out and the first satellite signal data meets the preset value range, extract the first time data from the first satellite signal data, the first time data includes the first week count and the seconds within the first week, assign the first week count to wn, and assign the seconds within the first week to tow, that is, wn = the first week count, tow = the seconds within the first week; when n = 1, assign wn to last_wn and current_wn, and assign tow to last_tow and current_tow, that is, last_wn = current_wn = wn, last_tow = current_tow = tow, and return to the first satellite signal data acquisition module; a first data comparison module, which is used to discard wn and tow and jump to the loop count update and judgment module if wn < last_wn or "wn = last_wn and tow <= last_tow"; a second data comparison module, which is used to calculate the difference between current_tow and tow if wn = last_wn, and discard wn and tow and jump to the loop count update and judgment module if the difference is greater than 2; a data update module, which is used to update last_wn = wn, last_tow = tow; if current_wn is not equal to wn, update current_wn = wn; if current_tow is not equal to tow, update current_tow = tow; at the same time, clear the time counter time_counter;When n=9, set the temporary week count tmp_wn=0, the temporary week second tmp_tow=0, set the continuous counter continuous_count=0, assign wn to tmp_wn, assign tow to tmp_tow, that is, tmp_wn=wn, tmp_tow=tow; the cycle number update and judgment module is used to update the cycle number n=n+1, and judge whether n is equal to 10, if so, enter the second algorithm calibration module, otherwise, return to the first satellite signal data acquisition module; the second algorithm calibration module is used to use the second algorithm to calibrate the current week second current_tow and the current week count current_wn. ;
[0013] The second algorithm calibration module includes: a satellite broadcast signal collection unit, which is used to search for satellite broadcast signals. If the signal strength value CNR of the satellite broadcast signal is less than 40, the satellite broadcast signal is discarded, otherwise, the satellite broadcast signal is collected; a second satellite signal data acquisition unit, which is used to sort all received satellite broadcast signals according to signal strength, find the beam with the strongest signal strength and record the beam number, which is recorded as max_cnr_beam, and then parse out the second satellite signal data from the beam with beam number = max_cnr_beam, and then verify the second satellite signal data; a second satellite signal data assignment unit, which is used to check if the second satellite signal data cannot be parsed or the second satellite signal data does not meet the preset value range. , then the satellite broadcast signal collection unit is returned; on the contrary, if the second satellite signal data can be parsed and the second satellite signal data meets the preset value range, the second time data is extracted from the second satellite signal data, and the second time data includes a second week count and a second week second, the second week count is assigned to wn, and the second week second is assigned to tow, that is, wn=the second week count, tow=the second week second; the first data comparison unit is used to compare the values of wn and tmp_wn, tow and tmp_tow, if wn is not equal to tmp_wn, then the continuous counter continuous_count=0 is updated, tmp_wn=wn is updated, tmp_tow=tow is updated, and the satellite broadcast signal collection unit is returned. The satellite broadcast signal collection unit is returned to the satellite broadcast signal collection unit; the second data comparison unit is used to update the continuous counter continuous_count=0, update tmp_wn=wn, tmp_tow=tow, and return to the satellite broadcast signal collection unit if the value of tow-tmp_tow is not equal to 6 and tow is not equal to tmp_tow; the third data comparison unit is used to return to the satellite broadcast signal collection unit if tow is equal to tmp_tow; the first data updating unit is used to update tmp_tow=tow if tow-tmp_tow=6, and update the continuous counter continuous_count=continuous_count+ 1. Enter the continuous counter data judgment unit; the continuous counter data judgment unit is used to judge whether continuous_count is equal to 10. If not, return to the satellite broadcast signal collection unit. If yes, enter the second data update unit; the second data update unit is used to clear the time counter time_counter, update continuous_count=0, and then judge whether the value of tow-last_tow-time_counter is less than 2. If the value is less than 2, update last_wn=wn, last_tow=tow, and if current_wn is not equal to wn, update current_wn=wn;If current_tow is not equal to tow, then update current_tow=tow; if the value is greater than or equal to 2, then update last_wn=wn, last_tow=tow; then return to the satellite broadcast signal collection unit and proceed to the next cycle. ;
[0014] In a third aspect, the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the method as described above.
[0015] The beneficial effects of the present invention are:
[0016] The present invention enables the timer to count after the chip is powered on, and obtains the satellite signal data time to obtain the initial time. By timing at the initial time and comparing the time counted by the timer with the time obtained by the satellite signal through a specific algorithm, the accurate time current_wn and current_tow are obtained as the short message communication time.
[0017] The present invention needs to acquire satellite signal data for multiple times in succession, and uses the first algorithm to calibrate the time for the first 10 times, and uses the second algorithm to calibrate the time after the 10th time. This can avoid the strongest beam switching and inaccurate satellite signal data acquired for the first time, thereby making the calibration time more accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is a flow chart of an embodiment of a method for Beidou short message time calibration of the present invention;
[0019] Figure 2 yes Figure 1 A flowchart of an embodiment of step S18;
[0020] Figure 3 It is a structural schematic diagram of an embodiment of a device for Beidou short message time calibration of the present invention;
[0021] Figure 4 yes Figure 3 A structural diagram of an embodiment of a second algorithm calibration module 18. DETAILED DESCRIPTION
[0022] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application may be combined with each other.
[0023] At present, the civil signals related to Beidou short messages are related to three satellites, numbered 59, 60, and 61 respectively. Each satellite has 7 beams, a total of 21 beams. Each beam corresponds to a channel, and each channel has broadcast information. A code chip is 125ms, and 48 code chips constitute a superframe, that is, a superframe is formed every 6s. Each superframe contains information such as the satellite number (the value range is 59-61), the beam number (the value range is 1-7), the week count (the value range is 0-8191), and the second in the week (the value range is 0-604799). Therefore, the time interval between the second in the same beam week in two superframes is 6s (except when the week switches). When multiple beams are received at the same time, multiple beams will arrive in the same second. When all data are correct, the time of each beam is the same. The algorithm of the present invention is that the chip receives the telegram, decodes it, and performs a CRC-6 check, and then parses the superframe data. This algorithm is to decode the received telegram and perform CRC-6 check to parse the superframe data. The processing algorithm starts from here. The data processing before this is not within the scope of this algorithm. Embodiment 1
[0024] See also Figure 1 , Figure 1 FIG. 1 is a flow chart of an embodiment of a method for Beidou short message time calibration according to the present invention. Figure 1 As shown, the method comprises the following steps:
[0025] S11: After the chip is powered on, set the initial parameters: set the number of cycles n=1, the last week count last_wn=0, the last week seconds last_tow=0, the current week count wn=0, the current week seconds tow=0, the current week count current_wn=0, the current week seconds current_tow=0; set the time counter timecounter to start timing, add 1 per second, and set the current week seconds current_tow to automatically add 1 every 1s. When current_tow reaches 604800, it automatically returns to 0, and current_wn automatically adds 1;
[0026] S12: searching for satellite broadcast signals, parsing the signals to obtain first satellite signal data, and then verifying the first satellite signal data;
[0027] S13: If the first satellite signal data cannot be parsed, or the first satellite signal data does not meet the preset value range, return to step S12; otherwise, if the first satellite signal data can be parsed and the first satellite signal data meets the preset value range, extract first time data from the first satellite signal data. The first time data includes a first week count and seconds within the first week. Assign the first week count to wn and the seconds within the first week to tow, i.e., wn = the first week count, tow = the seconds within the first week;
[0028] When n = 1, assign wn to last_wn and current_wn, and assign tow to last_tow and current_tow, i.e., last_wn = current_wn = wn, last_tow = current_tow = tow, and return to step S12;
[0029] S14: If wn < last_wn or "wn = last_wn and tow <= last_tow", discard wn and tow, and jump to step S17;
[0030] S15: If wn = last_wn, calculate the difference between current_tow and tow. If the difference is greater than 2, discard wn and tow, and jump to step S17;
[0031] S16: Update last_wn = wn, last_tow = tow; if current_wn is not equal to wn, update current_wn = wn; if current_tow is not equal to tow, update current_tow = tow; at the same time, clear the time counter time_counter;
[0032] When n = 9, set the temporary week count tmp_wn = 0, the temporary seconds within the week tmp_tow = 0, set the continuous counter continuous_count = 0, assign wn to tmp_wn, and assign tow to tmp_tow, i.e., tmp_wn = wn, tmp_tow = tow;
[0033] S17: Update the loop count n = n + 1, and determine whether n is equal to 10. If so, enter the next step S18; otherwise, return to step S12;
[0034] S18: Calibrate the current seconds within the week current_tow and the current week count current_wn using a second algorithm.
[0035] After the 10th time, in order to get a more accurate time and correct the previous wrong time, the second algorithm is used to get a more accurate time. Because the time obtained for the first time is assumed to be accurate, according to actual test results, the time obtained for the first time is usually accurate, but there is also a probability of error.
[0036] See also Figure 2 , Figure 2 yes Figure 1 A flow chart of an embodiment of step S18. Figure 2 As shown, step S18 includes the following sub-steps:
[0037] S181: Searching for satellite broadcast signals. If the signal strength value CNR of the satellite broadcast signal is less than 40, the satellite broadcast signal is discarded. Otherwise, the satellite broadcast signal is collected.
[0038] S182: sorting all collected satellite broadcast signals according to signal strength, finding the beam with the strongest signal strength, recording the beam number, recorded as max_cnr_beam, then parsing the second satellite signal data from the beam with beam number = max_cnr_beam, and then verifying the second satellite signal data;
[0039] S183: If the second satellite signal data cannot be parsed, or the second satellite signal data does not meet the preset value range, return to step S181; conversely, if the second satellite signal data can be parsed and the second satellite signal data meets the preset value range, extract the second time data from the second satellite signal data, the second time data including the second week count and the second week seconds, assign the second week count to wn, and assign the second week seconds to tow, that is, wn=the second week count, tow=the second week seconds;
[0040] S184: Compare the values of wn and tmp_wn, tow and tmp_tow. If wn is not equal to tmp_wn, update the continuous counter continuous_count=0, update tmp_wn=wn, tmp_tow=tow, and return to step S181;
[0041] S185: If the value of tow-tmp_tow is not equal to 6 and tow is not equal to tmp_tow, then update the continuous counter continuous_count=0, update tmp_wn=wn, tmp_tow=tow, and return to step S181;
[0042] S186: If tow is equal to tmp_tow, return to step S181;
[0043] S187: If tow-tmp_tow=6, then update tmp_tow=tow, update the continuous counter continuous_count=continuous_count+1, and go to the next step S188;
[0044] S188: Determine whether continuous_count is equal to 10, if not, return to step S181, if yes, go to the next step S189;
[0045] S189: Clear the time counter time_counter, update continuous_count=0, and then determine whether the value of tow-last_tow-time_counter is less than 2. If the value is less than 2, update last_wn=wn, last_tow=tow. If current_wn is not equal to wn, update current_wn=wn; if current_tow is not equal to tow, update current_tow=tow. If the value is greater than or equal to 2, update last_wn=wn, last_tow=tow. Finally, return to step S181.
[0046] In step S186, because tow may be equal to tmp_tow when the maximum beam is switched, when tow=tmp_tow, the continuous counter continuous_count is not cleared.
[0047] In step S189, it is necessary to determine whether the value of tow-last_tow-time_counter is less than 2. If it is less than 2, current_wn and current_tow are assigned values using wn and tow, and last_wn and last_tow are assigned values at the same time, and time_counter is cleared. The reason for adding this determination is that the strongest beam will not switch in a short time, but it will switch with the change of position. When the beam switches, the following situation may occur: the current strongest beam is No. 1, and the second of the week is 10. Within 1 second, the strongest beam switches to No. 2. At this time, the data of beam No. 2 arrives, and the data is wrong. The second of the week is 16, 16-10=6, which is exactly 6 seconds different. If this condition is not added, there will be a difference of 6 seconds from the last time. According to the previous algorithm, it will be considered continuous. If it happens to reach 10 times at this time, it will be assigned, and the time will be wrong by 6 seconds. After adding this condition, this error will be filtered out, thereby improving the accuracy of the time.
[0048] When it is greater than 2, use wn and tow to assign values to last_wn and last_tow, and clear time_counter. The reason for doing this is to remove the time errors that occurred in the previous 10 times (as mentioned earlier, the default time obtained for the first time is accurate, but there is also a very small probability of error). For example, the time obtained for the first time is 502034, and the correct time is 272658. This is the time error, but because we assume that the first time is correct, the subsequent time deviation is too large and there will be a situation where the value cannot be assigned. After this judgment, the first assignment after the tenth time will correct last_tow=502034 to the correct value, such as 272796, and the counter will be cleared. When the requirements are met next time, tow=272856 and time_counter=60, so tow-last_tow-time_counter=272856-272796-60=0, which meets the conditions and is assigned. In this way, the previous wrong current_tow will be corrected and assigned to the correct value 272856.
[0049] It should be noted here that the data contents of the above-mentioned first satellite signal data and the second satellite signal data are the same, and the satellite signal data include a satellite number, a beam number, a week count and seconds in the week; the checking of the satellite signal data in step S12 and step S182 includes: if the satellite number is outside 59-61, it means that the satellite number is erroneous and the data is unreliable, and the satellite signal data is discarded; if the beam number is outside 1-7, it means that the beam number is erroneous and the data is unreliable, and the satellite signal data is discarded; if the seconds in the week are greater than 7*24*3600, it means that the seconds in the week are erroneous and the data is unreliable, and the satellite signal data is discarded; if the week count is greater than 8191, it means that the week count is erroneous and the data is unreliable, and the satellite signal data is discarded. Embodiment 2
[0050] See also Figure 3 , Figure 3 FIG. 1 is a schematic diagram of the structure of an embodiment of a device for Beidou short message time calibration according to the present invention. Figure 3 As shown, the device includes an initialization module 11, a first satellite signal data acquisition module 12, a first satellite signal data assignment module 13, a first data comparison module 14, a second data comparison module 15, a data update module 16, a cycle number update and judgment module 17 and a second algorithm calibration module 18.
[0051] Initialization module 11 is used to set initial parameters after the chip is powered on: set the loop count n = 1, the last week count last_wn = 0, the seconds within the last week last_tow = 0, the current week count wn = 0, the seconds within the current week tow = 0, the current week count current_wn = 0, and the seconds within the current week current_tow = 0; set the time counter timecounter to start timing, increment by 1 per second, and set the seconds within the current week current_tow to also increment automatically by 1 every 1 s. When current_tow reaches 604800, it automatically resets to 0, and at the same time current_wn automatically increments by 1.
[0052] The first satellite signal data acquisition module 12 is used to search for satellite broadcast signals, parse the first satellite signal data from them, and then verify the first satellite signal data.
[0053] The first satellite signal data assignment module 13 is used to return to the first satellite signal data acquisition module 12 if the first satellite signal data cannot be parsed or the first satellite signal data does not meet the preset value range; conversely, if the first satellite signal data can be parsed and the first satellite signal data meets the preset value range, extract the first time data from the first satellite signal data. The first time data includes the first week count and the seconds within the first week. Assign the first week count to wn and the seconds within the first week to tow, that is, wn = the first week count, tow = the seconds within the first week; when n = 1, assign wn to last_wn and current_wn, and assign tow to last_tow and current_tow, that is, last_wn = current_wn = wn, last_tow = current_tow = tow, and then return to the first satellite signal data acquisition module 12.
[0054] The first data comparison module 14 is used to discard wn and tow and jump to the loop count update and judgment module 17 if wn < last_wn or "wn = last_wn and tow <= last_tow".
[0055] The second data comparison module 15 is used to calculate the difference between current_tow and tow if wn = last_wn. If the difference is greater than 2, discard wn and tow and jump to the loop count update and judgment module 17.
[0056] The data updating module 16 is used to update last_wn=wn, last_tow=tow; if current_wn is not equal to wn, update current_wn=wn; if current_tow is not equal to tow, update current_tow=tow; and clear the time counter time_counter at the same time; when n=9, set the temporary week count tmp_wn=0, the temporary week second tmp_tow=0, set the continuous counter continuous_count=0, assign wn to tmp_wn, and assign tow to tmp_tow, that is, tmp_wn=wn, tmp_tow=tow.
[0057] The cycle number updating and judging module 17 is used to update the cycle number n=n+1 and judge whether n is equal to 10. If so, it enters the second algorithm calibration module 18, otherwise, it returns to the first satellite signal data acquisition module 12.
[0058] The second algorithm calibration module 18 is used to calibrate the current week second current_tow and the current week count current_wn using the second algorithm.
[0059] See also Figure 4 , Figure 4 yes Figure 3 A schematic diagram of the structure of an embodiment of the second algorithm calibration module 18. Figure 4 As shown, the second algorithm calibration module 18 includes a satellite broadcast signal collection unit 181, a second satellite signal data acquisition unit 182, a second satellite signal data assignment unit 183, a first data comparison unit 184, a second data comparison unit 185, a third data comparison unit 186, a first data update unit 187, a continuous counter data judgment unit 188, and a second data update unit 189.
[0060] The satellite broadcast signal collecting unit 181 is used to search for satellite broadcast signals. If the signal strength value CNR of the satellite broadcast signal is less than 40, the satellite broadcast signal is discarded. Otherwise, the satellite broadcast signal is collected.
[0061] The second satellite signal data acquisition unit 182 is used to sort all received satellite broadcast signals according to signal strength, find the beam with the strongest signal strength, record the beam number, record it as max_cnr_beam, then parse the second satellite signal data from the beam with beam number = max_cnr_beam, and then verify the second satellite signal data.
[0062] The second satellite signal data assignment unit 183 is used to return to the satellite broadcast signal collection unit 181 if the second satellite signal data cannot be parsed or the second satellite signal data does not meet the preset value range; conversely, if the second satellite signal data can be parsed and the second satellite signal data meets the preset value range, extract the second time data from the second satellite signal data, the second time data including the second week count and the second week seconds, assign the second week count to wn, and assign the second week seconds to tow, that is, wn=the second week count, tow=the second week seconds.
[0063] The first data comparison unit 184 is used to compare the values of wn and tmp_wn, tow and tmp_tow. If wn is not equal to tmp_wn, the continuous counter continuous_count=0 is updated, tmp_wn=wn, tmp_tow=tow is updated, and the satellite broadcast signal collection unit 181 is returned.
[0064] The second data comparison unit 185 is used to update the continuous counter continuous_count=0, update tmp_wn=wn, tmp_tow=tow if the value of tow-tmp_tow is not equal to 6 and tow is not equal to tmp_tow, and return to the satellite broadcast signal collection unit 181.
[0065] The third data comparing unit 186 is used to return to the satellite broadcast signal collecting unit 181 if tow is equal to tmp_tow.
[0066] The first data updating unit 187 is used for updating tmp_tow=tow if tow-tmp_tow=6, updating the continuous counter continuous_count=continuous_count+1, and entering the continuous counter data judging unit 188.
[0067] The continuous counter data determination unit 188 is used to determine whether continuous_count is equal to 10. If not, it returns to the satellite broadcast signal collection unit 181. If so, it enters the second data updating unit 189.
[0068] The second data updating unit 189 is used to clear the time counter time_counter, update continuous_count=0, and then determine whether the value of tow-last_tow-time_counter is less than 2. If the value is less than 2, last_wn=wn and last_tow=tow are updated. If current_wn is not equal to wn, current_wn=wn is updated; if current_tow is not equal to tow, current_tow=tow is updated. If the value is greater than or equal to 2, last_wn=wn and last_tow=tow are updated. Finally, the satellite broadcast signal collecting unit 181 is returned to perform the next cycle.
[0069] Specifically, the working method of each module has been described in detail in the first embodiment and will not be repeated here. Embodiment 3
[0070] The present invention further provides a computer-readable storage medium, which stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the method described in the first embodiment.
[0071] The above is a specific description of the preferred implementation of the present invention, but the invention is not limited to the embodiments. Those skilled in the art can make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of this application.
Claims
1. A method for Beidou short message time calibration, characterized in that: Including: S11: After the chip is powered on, set the initial parameters: set the loop count n = 1, the last week count last_wn = 0, the last second within the week last_tow = 0, the current week count wn = 0, the current second within the week tow = 0, the current week count current_wn = 0, the current second within the week current_tow = 0; set the time counter timecounter to start timing, increment by 1 per second, and set the current second within the week current_tow to also increment by 1 automatically every 1s. When current_tow reaches 604800, it automatically resets to 0, and at the same time current_wn automatically increments by 1; S12: Search for the satellite broadcast signal, parse out the first satellite signal data from it, and then verify the first satellite signal data; S13: If the first satellite signal data cannot be parsed out, or the first satellite signal data does not meet the preset value range, then return to step S12; On the contrary, if the first satellite signal data can be parsed out and the first satellite signal data meets the preset value range, then extract the first time data from the first satellite signal data. The first time data includes the first week count and the first second within the week. Assign the first week count to wn and the first second within the week to tow, that is, wn = the first week count, tow = the first second within the week; When n = 1, assign wn to last_wn and current_wn, and assign tow to last_tow and current_tow, that is, last_wn = current_wn = wn, last_tow = current_tow = tow, and return to step S12; S14: If wn < last_wn or "wn = last_wn and tow <= last_tow", then discard wn and tow, and jump to step S17; S15: If wn = last_wn, calculate the difference between current_tow and tow. If the difference is greater than 2, then discard wn and tow, and jump to step S17; S16: Update last_wn = wn, last_tow = tow; if current_wn is not equal to wn, update current_wn = wn; if current_tow is not equal to tow, update current_tow = tow; at the same time, clear the time counter time_counter; When n = 9, set the temporary week count tmp_wn = 0, the temporary second within the week tmp_tow = 0, set the continuous counter continuous_count = 0, assign wn to tmp_wn, and assign tow to tmp_tow, that is, tmp_wn = wn, tmp_tow = tow; S17: Update the number of cycles n=n+1, and determine whether n is equal to 10. If so, proceed to the next step S18, otherwise, return to step S12; S18: using the second algorithm to calibrate the current week second current_tow and the current week count current_wn; The method of using the second algorithm to calibrate the current week second current_tow and the current week count current_wn includes: S181: Searching for satellite broadcast signals. If the signal strength value CNR of the satellite broadcast signal is less than 40, the satellite broadcast signal is discarded. Otherwise, the satellite broadcast signal is collected. S182: sorting all collected satellite broadcast signals according to signal strength, finding the beam with the strongest signal strength, recording the beam number, recorded as max_cnr_beam, then parsing the second satellite signal data from the beam with beam number = max_cnr_beam, and then verifying the second satellite signal data; S183: If the second satellite signal data cannot be parsed, or the second satellite signal data does not meet the preset value range, return to step S181; conversely, if the second satellite signal data can be parsed and the second satellite signal data meets the preset value range, extract second time data from the second satellite signal data, the second time data includes a second week count and a second week second, assign the second week count to wn, and assign the second week second to tow, that is, wn=the second week count, tow=the second week second; S184: Compare the values of wn and tmp_wn, tow and tmp_tow. If wn is not equal to tmp_wn, update the continuous counter continuous_count=0, update tmp_wn=wn, tmp_tow=tow, and return to step S181; S185: If the value of tow-tmp_tow is not equal to 6 and tow is not equal to tmp_tow, update the continuous counter continuous_count=0, update tmp_wn=wn, tmp_tow=tow, and return to step S181; S186: If tow is equal to tmp_tow, return to step S181; S187: If tow-tmp_tow=6, then update tmp_tow=tow, update the continuous counter continuous_count=continuous_count+1, and go to the next step S188; S188: Determine whether continuous_count is equal to 10, if not, return to step S181, if yes, go to the next step S189; S189: Clear the time counter time_counter, update continuous_count=0, and then determine whether the value of tow-last_tow-time_counter is less than 2. If the value is less than 2, update last_wn=wn, last_tow=tow. If current_wn is not equal to wn, update current_wn=wn; if current_tow is not equal to tow, update current_tow=tow. If the value is greater than or equal to 2, update last_wn=wn, last_tow=tow. Finally, return to step S181.
2. The method according to claim 1, characterized in that The data contents of the first satellite signal data and the second satellite signal data are the same, and the satellite signal data includes a satellite number, a beam number, a week count, and seconds within a week; Verifying satellite signal data in step S12 and step S182 includes: If the satellite number is outside 59-61, it means that the satellite number is wrong and the data is unreliable, and the satellite signal data is discarded; If the beam number is outside 1-7, it means that the beam number is wrong and the data is unreliable, and the satellite signal data is discarded; If the week seconds are greater than 7*24*3600, it means that the week seconds are wrong and the data is unreliable, and the satellite signal data is discarded; If the week count is greater than 8191, it means that the week count is wrong and the data is unreliable, and the satellite signal data is discarded.
3. A device for Beidou short message time calibration, characterized in that: include: Initialization module, used to set initial parameters after the chip is powered on: set the number of cycles n=1, the last week count last_wn=0, the last week seconds last_tow=0, the current week count wn=0, the current week seconds tow=0, the current week count current_wn=0, the current week seconds current_tow=0; set the time counter timecounter to start timing, add 1 per second, and set the current week seconds current_tow to automatically add 1 every 1s. When current_tow reaches 604800, it automatically returns to 0, and current_wn automatically adds 1; A first satellite signal data acquisition module, used for searching satellite broadcast signals, parsing first satellite signal data therefrom, and then verifying the first satellite signal data; a first satellite signal data assignment module, configured to return to the first satellite signal data acquisition module if the first satellite signal data cannot be parsed or the first satellite signal data does not meet a preset value range; conversely, if the first satellite signal data can be parsed and the first satellite signal data meets a preset value range, extract first time data from the first satellite signal data, the first time data including a first week count and first week seconds, assign the first week count to wn, and assign the first week seconds to tow, that is, wn=the first week count, tow=the first week seconds; When n = 1, assign the wn to last_wn and current_wn, and assign the tow to last_tow and current_tow, that is, last_wn = current_wn = wn, last_tow = current_tow = tow, and return to the first satellite signal data acquisition module; The first data comparison module is used to discard the wn and the tow and jump to the loop count update and judgment module if wn < last_wn or "wn = last_wn and tow <= last_tow"; The second data comparison module is used to calculate the difference between current_tow and tow if wn = last_wn, and discard the wn and the tow and jump to the loop count update and judgment module if the difference is greater than 2; The data update module is used to update last_wn = wn, last_tow = tow; If the current_wn is not equal to wn, update current_wn = wn; if the current_tow is not equal to tow, update current_tow = tow; at the same time, clear the time counter time_counter; When n = 9, set the temporary week count tmp_wn = 0, the seconds within the temporary week tmp_tow = 0, set the continuous counter continuous_count = 0, assign wn to tmp_wn, and assign tow to tmp_tow, that is, tmp_wn = wn, tmp_tow = tow; The loop count update and judgment module is used to update the loop count n = n + 1 and judge whether n is equal to 10. If so, enter the second algorithm calibration module; otherwise, return to the first satellite signal data acquisition module; The second algorithm calibration module is used to calibrate the seconds within the current week current_tow and the current week count current_wn using the second algorithm; The second algorithm calibration module includes: The satellite broadcast signal collection unit is used to search for satellite broadcast signals. If the signal strength value CNR of the satellite broadcast signal < 40, discard the satellite broadcast signal; otherwise, collect the satellite broadcast signal; The second satellite signal data acquisition unit is used to sort all received satellite broadcast signals according to the signal strength, find the beam with the strongest signal strength and record the beam number, denoted as max_cnr_beam, then parse the second satellite signal data from the beam with the beam number = max_cnr_beam, and then verify the second satellite signal data; a second satellite signal data assignment unit, configured to return to the satellite broadcast signal collection unit if the second satellite signal data cannot be parsed out or the second satellite signal data does not meet the preset value range; conversely, if the second satellite signal data can be parsed out and the second satellite signal data meets the preset value range, extract second time data from the second satellite signal data, the second time data including a second week count and seconds within a second week, assign the second week count to wn, and assign the second week seconds to tow, that is, wn=the second week count, tow=the second week seconds; A first data comparison unit is used to compare the values of wn and tmp_wn, tow and tmp_tow, if wn is not equal to tmp_wn, then update the continuous counter continuous_count=0, update tmp_wn=wn, tmp_tow=tow, and return to the satellite broadcast signal collection unit; A second data comparison unit is used for updating the continuous counter continuous_count=0, updating tmp_wn=wn, tmp_tow=tow, and returning to the satellite broadcast signal collection unit if the value of tow-tmp_tow is not equal to 6 and tow is not equal to tmp_tow; A third data comparison unit, configured to return to the satellite broadcast signal collection unit if tow is equal to tmp_tow; A first data updating unit, configured to update tmp_tow=tow if tow-tmp_tow=6, update the continuous counter continuous_count=continuous_count+1, and enter the continuous counter data judgment unit; A continuous counter data determination unit, used to determine whether continuous_count is equal to 10, if not, return to the satellite broadcast signal collection unit, if so, enter the second data update unit; The second data updating unit is used to clear the time counter time_counter, update continuous_count=0, and then determine whether the value of tow-last_tow-time_counter is less than 2. If the value is less than 2, last_wn=wn and last_tow=tow are updated. If current_wn is not equal to wn, current_wn=wn is updated; if current_tow is not equal to tow, current_tow=tow is updated. If the value is greater than or equal to 2, last_wn=wn and last_tow=tow are updated. Then the satellite broadcast signal collection unit is returned to perform the next cycle.
4. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the method according to any one of claims 1 to 2.