Adjustable time synchronization system
By designing an adjustable time synchronization system in the power quality analyzer, using the combination of Beidou/GPS module and local RTC module to detect and correct the time difference in real time, the loss of measurement data caused by the power quality analyzer due to the instantaneous correction of time is solved. Time discontinuity problem achieves high-precision time synchronization.
Patent Information
- Application Number
- CN202210479294.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-05
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2042-05-05
AI Technical Summary
The problem of measuring data loss or time discontinuity due to the significant correction of time in a moment cannot be effectively solved by the prior art.
An adjustable time synchronization system was designed to detect satellite signals in real time and measure time difference through the combination of Beidou/GPS module, effective detection module, time error measurement module and time correction module, and configure the local RTC module through the I2C bus. Correct RTC time in multiple steps to ensure time synchronization accuracy.
The time synchronization speed is set and the accuracy is better than 50us, which avoids the problems of measurement data loss and time discontinuity, and meets the requirements of IEC61000-4-30 standard.
Smart Images

Figure CN114928426B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a power quality analysis technology, in particular to an adjustable time synchronization system for a power quality analyzer. Background Art
[0002] Class A power quality analyzers require that the reference time of each device be synchronized to ensure that the measurement results of multiple power quality analyzers on the same power grid are consistent. According to the IEC61000-4-30 standard, Class A power quality analyzers need to be able to achieve UTC time synchronization through the Beidou system or GPS system.
[0003] However, in actual use, the Beidou module or GPS module of the power quality analyzer itself will be affected by the surrounding environment and cannot effectively provide UTC time in real time. When the Beidou module or GPS module cannot provide accurate UTC time, the RTC chip of the power quality analyzer itself is required to provide reference time information. When the Beidou module or GPS module works normally and can provide UTC time, the reference time of the power quality analyzer itself is synchronized with the UTC time.
[0004] During the operation of the power quality analyzer, when the Beidou module or the GPS module searches for a signal, if the reference time of the power quality analyzer is instantly and drastically corrected, the measurement data will be lost and the measurement data will be discontinuous in time. Summary of the invention
[0005] The purpose of the present invention is to provide an adjustable time synchronization system to solve the problem of loss of measurement data or time discontinuity of measurement data caused by large-scale instantaneous correction of time in a power quality analyzer.
[0006] The adjustable time synchronization system of the present invention comprises:
[0007] The Beidou / GPS module is connected to the Beidou / GPS effective detection module and the time error measurement module respectively, and is used to provide UTC time to the local area by receiving satellite signals;
[0008] The Beidou / GPS effective detection module is connected to the Beidou / GPS module and the time correction module respectively, and is used to detect and determine whether the Beidou / GPS module can give the correct UTC time;
[0009] The local RTC module is connected to the RTC configuration module and the time error measurement module respectively to provide the local RTC time;
[0010] The RTC configuration module is connected to the time error measurement module, the time correction module and the local RTC module respectively, and is used to2 C bus, configure the local RTC module;
[0011] A time error measurement module is connected to the Beidou / GPS module, the local RTC module, the RTC configuration module and the time correction module respectively, and is used to measure the time difference between the UTC time provided by the Beidou / GPS module and the RTC time provided by the local RTC module; and
[0012] The time correction module is connected to the Beidou / GPS effective detection module, the time error measurement module and the RTC configuration module respectively, and is used to correct the RTC time provided by the local RTC module in multiple steps according to the time difference information obtained by the time error measurement module.
[0013] Furthermore, the time information provided by the Beidou / GPS module includes: providing time information of year, month, day, hour, minute and second through a serial interface, and the serial interface also contains auxiliary information of the number of satellites searched, and provides an accurate second alignment signal through a second pulse; the time information provided by the serial interface and the second pulse are integrated to obtain high-precision UTC time information.
[0014] Furthermore, the Beidou / GPS validity detection module determines whether the UTC time given by the Beidou / GPS module is correct by receiving the serial port information output by the Beidou / GPS module serial interface, parsing the GPRMC information, and determining whether sufficient satellite signals are found. If sufficient satellite signals are not received, it is determined that the time information of the Beidou / GPS module is invalid.
[0015] Furthermore, the Beidou / GPS validity detection module determines whether the UTC time given by the Beidou / GPS module is correct by using a local crystal oscillator to measure the second pulse interval of the Beidou / GPS module once per second, and performing multiple measurements continuously. If the time interval of the second pulses is consistent or basically consistent, the second pulse signal of the Beidou / GPS module is considered valid. If the time interval of the second pulse signal changes greatly more than once, the second pulse signal of the Beidou / GPS module is considered invalid, and the time information of the Beidou / GPS module is determined to be invalid.
[0016] Furthermore, the time error measurement method of the time error measurement module is:
[0017] a. Using the time error measurement module, first convert the date and time information output by the Beidou / GPS module into a 32-bit second data representing the total number of seconds that have passed since a certain set time, and then convert the RTC time output by the local RTC module into a 32-bit second data;
[0018] b. Use the time error measurement module to receive the serial interface output information of the Beidou / GPS module, interpret the date and time information output by it, convert it into second data, and when the next second pulse of the Beidou / GPS module is generated, record this time, which is recorded as TsBD;
[0019] c. After the last second pulse of the local RTC module is generated, it is transmitted through I 2 C bus reads the time information and converts it into second data. When the next second pulse of the local RTC module is generated, this time is recorded as TsRTC.
[0020] d. Measure the time difference between the second pulses of the Beidou / GPS module and the local RTC module through a counter with an operating frequency of 1MHz; when the second pulse of the Beidou / GPS module arrives, the counter starts counting from 0 until the second pulse of the local RTC module arrives, then stops counting and obtains the time difference between the pulses, recorded as Tus.
[0021] e. Total time error: Terr = (TsBD–TsRTC)×1000000 + Tus; unit is microseconds.
[0022] Furthermore, the time correction module adjusts and corrects the RTC time in the following way: detect the rising edge of the second pulse generated by the local RTC time, and after detecting the rising edge, start the delay device to delay. When the delay time is reached, add 1 second to the local RTC time, and then reconfigure the local RTC module. The local RTC module will start running again with the newly configured RTC time, generating a second pulse every 1 second; the delay device decides whether to adjust this time and the adjustment direction according to the time error information provided by the time error measurement module:
[0023] When the time error is less than the set limit, the local RTC time will not be adjusted;
[0024] When the time error is less than 0, after the delay time (0.5 seconds + adjustment amount), the RTC configuration module is started to configure the local RTC time once;
[0025] When the time error is greater than 0, after the delay time (0.5 seconds - adjustment amount), the RTC configuration module is started to configure the local RTC time.
[0026] Further, the RTC configuration module is based on I 2 C bus clock frequency, calculate the time required to configure the local RTC module in advance, and after receiving the configuration request of the time correction module, delay it through the delayer (0.5 seconds - Ti2c) to start I 2 C bus controller to configure the local RTC module to the new RTC time.
[0027] By adopting the time synchronization system of the present invention, the speed of time synchronization can be set by the user, and the time synchronization accuracy of the system is better than 50us (limited by the crystal oscillator frequency of the local RTC), which is far better than the standard requirement of IEC61000-4-30 for the time synchronization accuracy of Class A power quality analyzers (the standard requires the time synchronization accuracy to be one power line waveform cycle, 20ms or 16.7ms). This not only avoids the problem of measurement data loss caused by large-scale correction of time in the power quality analyzer, but also effectively prevents the occurrence of measurement data time discontinuity caused by large-scale correction of time. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 It is a structural block diagram of the time synchronization system of the present invention.
[0029] Figure 2 This is the workflow diagram of the time error measurement module.
[0030] Figure 3 This is the workflow diagram of the time correction module.
[0031] Figure 4 This is the workflow diagram of the RTC configuration module.
[0032] Figure 5 , Figure 6 It is a timing diagram of two time corrections for calibrating system time according to the present invention. DETAILED DESCRIPTION
[0033] like Figure 1 As shown, the adjustable time synchronization system of the present invention includes Beidou / GPS module, Beidou / GPS effective detection module, local RTC module, RTC configuration module, time error measurement module and time correction module. Among them, the Beidou / GPS module is connected to the Beidou / GPS effective detection module and the time error measurement module respectively, and is used to provide UTC time to the local area by receiving satellite signals; the Beidou / GPS effective detection module is connected to the Beidou / GPS module and the time correction module respectively, and is used to detect and judge whether the Beidou / GPS module can give the correct UTC time; the local RTC module is connected to the RTC configuration module and the time error measurement module respectively, and is used to provide the local RTC time; the RTC configuration module is connected to the time error measurement module, the time correction module and the local RTC module respectively, and is used to receive satellite signals through I 2C bus to configure the local RTC module; the time error measurement module is respectively connected to the Beidou / GPS module, the local RTC module, the RTC configuration module and the time correction module, and is used to measure the time difference between the UTC time provided by the Beidou / GPS module and the RTC time provided by the local RTC module; the time correction module is respectively connected to the Beidou / GPS effective detection module, the time error measurement module and the RTC configuration module, and is used to correct the RTC time provided by the local RTC module in steps and multiple times according to the time difference information obtained by the time error measurement module.
[0034] The working process of the time synchronization system of the present invention is as follows: the Beidou / GPS effective detection module detects in real time whether the Beidou / GPS module has searched for enough satellites and provides accurate time, and sends the detection result to the time correction module; the time error measurement module measures in real time the error between the UTC time output by the Beidou / GPS module and the RTC time output by the local RTC module, and sends the error information to the time correction module; the time correction module corrects the local RTC time according to requirements and settings; the RTC configuration module is responsible for correcting the local RTC time through I 2 C bus to configure the local RTC module and the control bus (I 2 C bus) to correct for the time delay caused by the
[0035] The specific working process is described as follows:
[0036] 1. The Beidou / GPS module provides accurate UTC time to the local area by receiving satellite signals. The time information provided by the Beidou / GPS module includes two parts: one is to provide the time information of year, month, day, hour, minute and second through the serial interface, and the serial interface also contains auxiliary information such as the number of satellites searched; the other is to provide an accurate second alignment signal through a second pulse. By integrating the time information provided by the serial interface and the second pulse, high-precision UTC time information can be obtained.
[0037] 2. The Beidou / GPS valid detection module can specifically determine whether the Beidou / GPS module gives the correct UTC time through two methods. Method 1: By receiving the serial port information sent by the Beidou / GPS module serial interface, parsing the GPRMC information, determine whether enough satellite signals are found, if not enough satellite signals are received, the time information of the Beidou / GPS module is determined to be invalid. Method 2: Use a local crystal oscillator to measure the second pulse interval of the Beidou / GPS module, which is about once every 1s. If multiple measurements are performed continuously and the time interval of the second pulse is basically the same, the second pulse signal of the Beidou / GPS module is considered valid; if the time interval of one or more second pulse signals varies greatly, the second pulse signal of the Beidou / GPS module is considered invalid, and the UTC time information of the Beidou / GPS module is also considered invalid.
[0038] 3. The time error measurement module is responsible for measuring the time difference between the UTC time provided by the Beidou / GPS module and the RTC time output by the local RTC module. Figure 2 As shown, the workflow and working principle of the time error measurement module are:
[0039] 3-1 In order to facilitate the time error calculation, the time error measurement module needs to convert the date and time output by the Beidou / GPS module into a 32-bit data, representing the total number of seconds from 0:0:0 on January 1, 1970 to now. Similarly, the RTC time output by the local RTC module also needs to be converted into 32-bit second data to represent the number of seconds.
[0040] 3-2 The time error measurement module receives the serial interface information of the Beidou / GPS module, interprets the date and time information, converts it into second data, and records the time when the Beidou / GPS module generates the next second pulse, which is recorded as TsBD.
[0041] 3-3 After the last second pulse of the local RTC is generated, the I 2 C bus reads the time, converts it into seconds, and when the next local RTC second pulse is generated, records this time as TsRTC.
[0042] 3-4 Use a counter with a working frequency of 1MHz to measure the time difference between the second pulses of the Beidou / GPS module and the local RTC module. When the second pulse of the Beidou / GPS module arrives, the counter starts counting from 0 until the second pulse of the local RTC module arrives, stops counting, and gets the time difference between the pulses, recorded as Tus.
[0043] 3-5 Total time error: Terr = (TsBD–TsRTC) * 1000000 + Tus; the unit is microseconds.
[0044] 4. The time correction module is mainly responsible for slowly correcting the time of the local RTC module in multiple times according to the time error information, ensuring that the normal operation of the instrument is not affected during the entire correction process. Each adjustment step (correction) is achieved through user settings, and in principle does not exceed 0.5 seconds. Because after the step exceeds 0.5 seconds, the calculation system of the power quality analyzer will have unpredictable abnormal consequences due to serious time discontinuity.
[0045] like Figure 3As shown, the time correction module detects the rising edge of the second pulse generated by the local RTC module. After detecting the rising edge, the delayer is started. After the delay time of the delayer is reached, the RTC time of the local RTC module is increased by 1 second, and then the local RTC module is reconfigured. The local RTC module will start running again with the newly configured RTC time and generate a second pulse every 1 second.
[0046] The delayer decides whether to make adjustments and the direction of adjustment based on the time error information provided by the time error measurement module:
[0047] When the time error is less than the set limit, no adjustment is made;
[0048] When the time error is less than 0, that is, the Beidou / GPS time is later than the local RTC time, the local RTC time needs to be slowed down. After the delayer delays (0.5 seconds + adjustment amount), the RTC configuration module is started to configure the local RTC time once;
[0049] When the time error is greater than 0, that is, the Beidou / GPS time is earlier than the local RTC time, the local RTC time needs to be accelerated. After the delayer delays (0.5 seconds - adjustment amount), the RTC configuration module is started to configure the local RTC time once.
[0050] 5. If Figure 4 As shown, the structure of the RTC configuration module includes a delay and an I 2 C bus controller. The RTC configuration module is connected via I 2 C bus configures the RTC time output by the local RTC module.
[0051] RTC configuration module, according to I 2 C bus clock frequency, calculate the time required to configure the RTC module in advance. After receiving the configuration request of the time correction module, delay (0.5 seconds - Ti2c) through the delayer, where Ti2c is I 2 C bus configuration time. Start I 2 C bus controller, configure the local RTC time to the new RTC time. 2 C-bus configuration command is completed, and the STOP state is aligned with the second pulse of the local RTC time.
[0052] When the RTC configuration module receives the configuration request, it is necessary to shield the current second pulse generated by the local RTC time, otherwise the time synchronization system of the present invention cannot operate correctly.
[0053] Since each configuration process will cause the local RTC module to lose one second pulse, the RTC configuration module 2When the C-bus configuration command ends, a second pulse needs to be generated to replace the second pulse of the local RTC time; at the same time, the new RTC time to be configured is provided to the time error measurement module. When the time correction module starts the configuration, the time error measurement module uses the time information provided by the time correction module and the UTC time information of the Beidou / GPS module to measure the error instead of using the time information of the local RTC module.
[0054] 6. The local RTC module uses I 2 C bus RTC chip, this chip can be powered by a battery after a power outage, and the time information will not be lost after the computer is turned off and then turned on again.
[0055] 7. The time correction sequence of the time synchronization system of the present invention is as follows: Figure 5 and Figure 6 shown.
[0056] Figure 5 Take an example to illustrate the correction timing when the local RTC time is 0.2 seconds later than the UTC time and the adjustment step is 0.2 seconds; Figure 6 An example is given to illustrate the correction timing when the local RTC time is 0.2 seconds earlier than the UTC time and the adjustment step is 0.1 seconds. Through two timing corrections, the adjustability of the present invention for time synchronization correction is illustrated, thereby meeting the use requirements of the power quality analyzer in the power system.
Claims
1. An adjustable time synchronization system, characterized in that: include: The Beidou / GPS module is connected to the Beidou / GPS effective detection module and the time error measurement module respectively, and is used to provide UTC time to the local area by receiving satellite signals; The Beidou / GPS effective detection module is connected to the Beidou / GPS module and the time correction module respectively, and is used to detect and determine whether the Beidou / GPS module gives the correct UTC time; The local RTC module is connected to the RTC configuration module and the time error measurement module respectively to provide the local RTC time; The RTC configuration module is connected to the time error measurement module, the time correction module and the local RTC module respectively, and is used to 2 C bus, configure the local RTC module; The time error measurement module is connected to the Beidou / GPS module, the local RTC module, the RTC configuration module and the time correction module respectively, and is used to measure the time difference between the UTC time provided by the Beidou / GPS module and the RTC time provided by the local RTC module; as well as The time correction module is connected to the Beidou / GPS effective detection module, the time error measurement module and the RTC configuration module respectively, and is used to correct the RTC time provided by the local RTC module in multiple steps according to the time difference information obtained by the time error measurement module; The time correction module adjusts the RTC time in the following way: detect the rising edge of the second pulse generated by the local RTC time, start the delayer delay after detecting the rising edge, and when the delay time is reached, add 1 second to the local RTC time, and then reconfigure the local RTC module. The local RTC module will start running again with the newly configured RTC time, generating a second pulse every 1 second; the delayer decides whether to adjust this time and the adjustment direction according to the time error information provided by the time error measurement module: When the time error is less than the set limit, the local RTC time will not be adjusted; When the time error is less than 0, after the delay time (0.5 seconds + adjustment amount), the RTC configuration module is started to configure the local RTC time once; When the time error is greater than 0, after the delay time (0.5 seconds - adjustment amount), the RTC configuration module is started to configure the local RTC time.
2. The adjustable time synchronization system according to claim 1, characterized in that: The time information provided by the Beidou / GPS module includes: providing year, month, day, hour, minute and second time information through the serial interface. The serial interface also contains auxiliary information on the number of satellites searched, and provides a second alignment signal through a second pulse; the time information provided by the serial interface and the second pulse are integrated to obtain the UTC time information.
3. The adjustable time synchronization system according to claim 1, characterized in that: The Beidou / GPS valid detection module determines whether the UTC time given by the Beidou / GPS module is correct by receiving the serial port information output by the Beidou / GPS module serial interface, parsing the GPRMC information, and determining whether enough satellite signals are found. If not, the time information of the Beidou / GPS module is determined to be invalid.
4. The adjustable time synchronization system according to claim 1, characterized in that: The time error measurement module measures the time error in the following way: a. Using the time error measurement module, first convert the date and time information output by the Beidou / GPS module into a 32-bit second data representing the total number of seconds that have passed since a certain set time, and then convert the RTC time output by the local RTC module into a 32-bit second data; b. Use the time error measurement module to receive the serial interface output information of the Beidou / GPS module, interpret the date and time information output by it, convert it into second data, and when the next second pulse of the Beidou / GPS module is generated, record this time, which is recorded as TsBD; c. After the last second pulse of the local RTC module is generated, it is transmitted through I 2 C bus reads the time information and converts it into second data. When the next second pulse of the local RTC module is generated, this time is recorded as TsRTC. d. Measure the time difference between the second pulses of the Beidou / GPS module and the local RTC module through a counter with an operating frequency of 1MHz; when the second pulse of the Beidou / GPS module arrives, the counter starts counting from 0 until the second pulse of the local RTC module arrives, then stops counting and obtains the time difference between the pulses, recorded as Tus; e. Total time error: Terr = (TsBD–TsRTC)×1000000 + Tus; The unit is microseconds.
5. The adjustable time synchronization system according to claim 1, characterized in that: The RTC configuration module is based on I 2 C bus clock frequency, calculate the time required to configure the local RTC module in advance, and after receiving the configuration request of the time correction module, delay it through the delayer (0.5 seconds - Ti2c) to start I 2 C bus controller to configure the local RTC module to the new RTC time.
Citation Information
Patent Citations
High-precision time synchronization system and method based on Beidou clock signal
CN113934132A
Methods for adjusting time received from GPS on a missile and calculator thereof
KR101820248B1
Method and system for implementing time synchronization in local area network (LAN)
WO2010149088A1
KR20200083030A
