Clock synchronization method and device, computer equipment, readable storage medium and program product
By obtaining and fitting the historical system time data of the equipment, performing time calibration and clock synchronization, the problem of clock differences between devices in the energy storage integrated system is solved, and clock consistency and system stability between devices are achieved.
Patent Information
- Application Number
- CN202410891444.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-04
- Publication Date
- 2024-10-15
AI Technical Summary
In an integrated energy storage system, clock differences between devices lead to inconsistent data and asynchronous operations, affecting the stability and efficiency of the system. In addition, equipment clock deviations from different manufacturers are different, requiring personalized clock synchronization frequencies.
By obtaining the historical system time data of each device, performing polynomial fitting to obtain the time fitting coefficient, calibrating the real-time system time, and performing clock synchronization based on the calibrated time to ensure that the clocks between devices are consistent.
It effectively reduces the clock deviation between various devices, ensures the consistency of time synchronization frequency between devices, and improves the operating accuracy and operational consistency of the system.
Smart Images

Figure CN118778769A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of energy storage integrated systems, and in particular to a clock synchronization method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art
[0002] With the development of energy storage integrated system technology, energy storage systems are playing an increasingly important role in various application scenarios, such as power systems, transportation, data centers, etc. In energy storage integrated systems, multiple devices need to work together to achieve efficient storage and utilization of energy. However, due to clock differences between devices, problems such as inconsistent data and asynchronous operations may occur, thus affecting the stability and efficiency of the system. In addition, the various devices in the entire energy storage integrated system generally come from different manufacturers, and the clock deviation rules are also different. Therefore, the degree of clock deviation is also different, and the frequency of clock synchronization required is also different. Summary of the invention
[0003] Based on this, it is necessary to provide a clock synchronization method, apparatus, computer equipment, computer-readable storage medium and computer program product that can reduce clock deviations between multiple devices in order to address the above technical problems.
[0004] In a first aspect, the present application provides a clock synchronization method, comprising:
[0005] Get historical system time data for each device;
[0006] Performing polynomial fitting on the historical system time data to obtain a time fitting coefficient for each of the devices;
[0007] Performing time calibration on the real-time system time of each of the devices according to the time fitting coefficient to obtain a calibrated device system time;
[0008] The clock of each of the devices is synchronized according to the calibration device system time.
[0009] In one embodiment, before obtaining the historical system time data of each device, the method further includes:
[0010] Obtaining the real-time system time of each of the devices;
[0011] Obtain the energy storage system time of the energy storage system;
[0012] The historical system time data is constructed according to the real-time system time and the energy storage system time.
[0013] In one embodiment, performing polynomial fitting on the historical system time data to obtain a time fitting coefficient for each of the devices includes:
[0014] A polynomial fitting is performed on the historical system time data according to a least squares model to obtain a time fitting coefficient for each of the devices.
[0015] In one embodiment, performing polynomial fitting on the historical system time data according to the least squares model to obtain the time fitting coefficient of each device includes:
[0016] Constructing an augmented matrix for the historical system time data according to the least squares model to obtain a historical time augmented matrix;
[0017] Performing nested loop processing on the historical time augmented matrix according to the least squares model to obtain a cyclic time augmented matrix;
[0018] Performing Gaussian elimination processing on the cyclic time augmented matrix to obtain a system time elimination matrix;
[0019] The system time elimination matrix is subjected to back-strip solution processing to obtain the time fitting coefficient.
[0020] In one embodiment, the step of performing time calibration on the real-time system time of each device according to the time fitting coefficient to obtain the calibrated device system time includes:
[0021] Inputting the time fitting coefficient into a preset multi-order polynomial model to construct a model, thereby obtaining a target multi-order polynomial model;
[0022] The real-time system time of each of the devices is time-calibrated according to the target multi-order polynomial model to obtain the calibrated device system time.
[0023] In one embodiment, the method further comprises:
[0024] Get the real-time energy storage system time of the energy storage system;
[0025] Determine the device time deviation of each device according to the calibration device system time and the real-time energy storage system time;
[0026] When the device time deviation is greater than a preset time deviation threshold, clock synchronization is performed on the device corresponding to the device time deviation.
[0027] In a second aspect, the present application further provides a clock synchronization device, comprising:
[0028] The acquisition module is used to obtain the historical system time data of each device;
[0029] A fitting module, used for performing polynomial fitting according to the historical system time data to obtain a time fitting coefficient for each of the devices;
[0030] A calibration module, used for calibrating the real-time system time of each device according to the time fitting coefficient to obtain a calibrated device system time;
[0031] A clock synchronization module is used to synchronize the clock of each of the devices according to the system time of the calibration device.
[0032] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0033] Get historical system time data for each device;
[0034] Performing polynomial fitting on the historical system time data to obtain a time fitting coefficient for each of the devices;
[0035] Performing time calibration on the real-time system time of each of the devices according to the time fitting coefficient to obtain a calibrated device system time;
[0036] The clock of each of the devices is synchronized according to the calibration device system time.
[0037] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0038] Get historical system time data for each device;
[0039] Performing polynomial fitting on the historical system time data to obtain a time fitting coefficient for each of the devices;
[0040] Performing time calibration on the real-time system time of each of the devices according to the time fitting coefficient to obtain a calibrated device system time;
[0041] The clock of each of the devices is synchronized according to the calibration device system time.
[0042] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0043] Get historical system time data for each device;
[0044] Performing polynomial fitting on the historical system time data to obtain a time fitting coefficient for each of the devices;
[0045] Performing time calibration on the real-time system time of each of the devices according to the time fitting coefficient to obtain a calibrated device system time;
[0046] The clock of each of the devices is synchronized according to the calibration device system time.
[0047] The clock synchronization method, device, computer equipment, computer-readable storage medium and computer program product described above obtain the historical system time data of each device, perform polynomial fitting on the historical system time data, obtain the time fitting coefficient of each device, perform time calibration on the real-time system time of each device according to the time fitting coefficient, obtain the calibrated device system time, and perform clock synchronization on each device according to the calibrated device system time. Therefore, by performing polynomial fitting on the historical system time data of each device obtained, the time fitting coefficient of each device can be accurately obtained, and used to perform time calibration on the real-time system time of each device, and then perform clock synchronization on each device, so that the clock synchronization of each device can be unified, the time synchronization frequency between multiple devices can be guaranteed to be consistent, and the clock deviation between multiple devices can be effectively reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0049] Figure 1 A diagram showing an application environment of a clock synchronization method in an embodiment;
[0050] Figure 2 A schematic diagram of a flow chart of a clock synchronization method in an embodiment;
[0051] Figure 3 A schematic diagram of a flow chart of a clock synchronization method in an embodiment;
[0052] Figure 4 is a flow chart of a clock synchronization method in another embodiment;
[0053] Figure 5 is a structural block diagram of a clock synchronization device in an embodiment;
[0054] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0055] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0056] The clock synchronization method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal device 102 communicates with the industrial computer 104 through a variety of interface communication protocols to ensure the communication between the industrial computer 104 and different terminal devices 102. The industrial computer 104 obtains the historical system time data of each terminal device 102; performs polynomial fitting on the historical system time data to obtain the time fitting coefficient of each terminal device 102; performs time calibration on the real-time system time of each terminal device 102 according to the time fitting coefficient to obtain the calibration device system time; performs clock synchronization on each terminal device 102 according to the calibration device system time. Among them, the terminal device 102 can be but is not limited to a battery BMS, an energy storage inverter PCS, an air conditioner, an electric meter, a DI / DO module, a DI module, a temperature and humidity sensor, and an air conditioner. Among them, the EMS system in the industrial computer 104 is the data acquisition core of the energy storage system. The EMS system can collect information from the battery management system BMS and the energy storage inverter PCS through the CAN bus, and complete data interaction and system control through Ethernet. At the same time, the EMS system is responsible for monitoring and managing the time synchronization status of each terminal device 102 in the system, regularly sending and receiving timestamp information, and adjusting the device clock.
[0057] Among them, the multiple interface communication protocols may be network port, CAN, 485, etc.
[0058] In an exemplary embodiment, Figure 2 As shown, a clock synchronization method is provided, which is applied to Figure 1 The industrial computer 104 is used as an example to illustrate, including the following steps 202 to 208.
[0059] in:
[0060] Step 202, obtaining historical system time data of each device.
[0061] In some embodiments, the historical system time data needs to record the system time of each device and the energy storage system corresponding to each device at a preset time interval to reflect the time deviation change of the system time between each device and the energy storage system at the historical moment.
[0062] In some embodiments, the historical system time data recorded in the system log can be directly read to obtain the historical system time data of each device in the past day. The historical system time data of each device in the past day recorded in the energy storage system can also be obtained from a third-party cloud server, but is not limited thereto.
[0063] In some embodiments, before obtaining the historical system time data of each device, the clock synchronization method also includes: obtaining the real-time system time of each device; obtaining the energy storage system time of the energy storage system; and constructing the historical system time data according to the real-time system time and the energy storage system time.
[0064] The real-time system time refers to the RTC system time of each device at the current moment. The energy storage system may be an EMS system, and the energy storage system time refers to the system time of the EMS system at the current moment.
[0065] In some embodiments, the real-time system time of each device and the energy storage system time of the energy storage system are obtained respectively at preset time intervals, and then the historical system time data is constructed based on the real-time system time and the energy storage system time, and the historical system time data is recorded in the system log. Of course, it can also be uploaded to a cloud server for long-term storage, but is not limited to this.
[0066] The time interval can be recorded every 2.4 hours or every 1.2 hours. The shorter the time interval, the more accurate the recorded historical system time data is, which is more conducive to the subsequent polynomial fitting step. Therefore, the accuracy of the system time can be ensured by controlling the flexible and dynamic adjustment of the recording time interval.
[0067] Step 204: Perform polynomial fitting on the historical system time data to obtain the time fitting coefficient of each device.
[0068] In some embodiments, a polynomial fit is performed on the historical system time data according to a least squares model to obtain a time fitting coefficient for each device.
[0069] Among them, the least squares model is used to find the best matching model of the historical system time data by means of the least square error, so as to determine the time fitting coefficient corresponding to the best matching model.
[0070] In some embodiments, an 8th order polynomial curve fitting implemented in C language may be used, and the coefficients of the polynomial may be solved using a least squares model. The coefficients of the solved polynomial correspond to the time fitting coefficients.
[0071] In some embodiments, polynomial fitting is performed on historical system time data according to a least squares model to obtain a time fitting coefficient for each device, including: constructing an augmented matrix for the historical system time data according to the least squares model to obtain a historical time augmented matrix; performing nested loop processing on the historical time augmented matrix according to the least squares model to obtain a cyclic time augmented matrix; performing Gaussian elimination processing on the cyclic time augmented matrix to obtain a system time elimination matrix; and performing back-strip solution processing on the system time elimination matrix to obtain a time fitting coefficient.
[0072] In some embodiments, 10 sets of historical system time data obtained in the past day can be input separately, and then a historical time augmented matrix of the historical system time data is constructed, a 9x10 two-dimensional array is initialized, and a three-layer nested loop is used to calculate the element values of the historical time augmented matrix, so as to construct a cyclic time augmented matrix according to the obtained element values.
[0073] Among them, using three layers of nested loops to calculate the element values of the historical time augmented matrix includes: first, the outer loop traverses each term of the polynomial corresponding to the two-dimensional array (that is, from the 0th power to the 8th power), then the middle loop calculates the product of each term and the power of all x values, and accumulates them to the corresponding position of the matrix, and then the inner loop traverses all data points and calculates the contribution of each data point to the matrix.
[0074] In some embodiments, by performing Gaussian elimination on the cyclic time augmented matrix to obtain a system time elimination matrix, the calculation process of the polynomial coefficients can be simplified, thereby saving computing resources.
[0075] It should be noted that the Gaussian elimination method used is to find the row of the element with the largest absolute value in the column for each row of the matrix, exchange the current row with the row of the largest element. If the largest element is not in the current row, the matrix is converted to an upper triangular form by elimination, and the elements below the current column are eliminated to 0 using the elimination method.
[0076] In some embodiments, the time fitting coefficient is obtained by performing a back-strip solution process on the system time elimination matrix, thereby improving the accuracy of calculating the time fitting coefficient.
[0077] It should be noted that the back-tracking solution process is to calculate the coefficients of the polynomial starting from the last row by back-tracking, and divide the augmented column elements of the last row by the elements on the diagonal to obtain the last coefficient. Back-tracking upwards, each coefficient is calculated row by row, and the coefficient of each row is obtained by subtracting the sum of the products of the obtained coefficients and the corresponding upper triangular matrix elements from the augmented column elements, and then dividing by the elements on the diagonal.
[0078] Step 206, time calibration is performed on the real-time system time of each device according to the time fitting coefficient to obtain the calibrated device system time.
[0079] In some embodiments, the real-time system time of each device is time-calibrated according to the time fitting coefficient to obtain the calibrated device system time, including: inputting the time fitting coefficient into a preset multi-order polynomial model to build a model to obtain a target multi-order polynomial model; and time-calibrating the real-time system time of each device according to the target multi-order polynomial model to obtain the calibrated device system time.
[0080] Among them, the multi-order polynomial model can be f(x)=a n x n +a n-1 x n-1 +……+a1x n +a0.
[0081] In some embodiments, by inputting the time fitting coefficient into a preset multi-order polynomial model for model construction, a target multi-order polynomial model is obtained, that is, a target multi-order polynomial model that conforms to the most recent clock jitter law can be constructed to improve the accuracy of subsequent time calibration.
[0082] Step 208: synchronize the clock of each device according to the calibration device system time.
[0083] In some embodiments, the clock of the database and log of each device is synchronized according to the calibrated device system time to improve the consistency between the device clock and the system clock, thereby improving the operating accuracy and operation consistency of the system.
[0084] In the above clock synchronization method, the historical system time data of each device is obtained, and a polynomial fitting is performed on the historical system time data to obtain the time fitting coefficient of each device. The real-time system time of each device is time-calibrated according to the time fitting coefficient to obtain the calibrated device system time, and the clock of each device is synchronized according to the calibrated device system time. Therefore, by performing polynomial fitting based on the historical system time data of each device, the time fitting coefficient of each device can be accurately obtained, and used to calibrate the real-time system time of each device, and then the clock of each device is synchronized, so that the clock of each device can be uniformly synchronized, which can ensure the consistency of the time synchronization frequency between multiple devices and effectively reduce the clock deviation between multiple devices.
[0085] In an exemplary embodiment, Figure 3 As shown, the clock synchronization method further includes steps 302 to 306. Among them:
[0086] Step 302: Acquire the real-time energy storage system time of the energy storage system.
[0087] Among them, the real-time energy storage system time is the true system time of the current energy storage system.
[0088] In some embodiments, the real-time energy storage system time of the energy storage system can be monitored during the entire clock synchronization process for accurately detecting the device time deviation of each device in subsequent steps.
[0089] Step 304, determine the device time deviation of each device according to the calibrated device system time and the real-time energy storage system time.
[0090] In some embodiments, the device time deviation is equal to the absolute value of the difference between the calibrated device system time and the real-time energy storage system time, that is, device time deviation = |calibrated device system time - real-time energy storage system time|.
[0091] Step 306, when the device time deviation is greater than the preset time deviation threshold, perform clock synchronization on the device corresponding to the device time deviation.
[0092] In some embodiments, the preset time deviation threshold can be set according to actual application requirements. It can be foreseen that the larger the time deviation threshold, the fewer the number of clock synchronization times, and then the less the clock jitter situation of the corresponding device caused by clock synchronization. The opposite situation can be deduced同理.
[0093] In this embodiment, by designing the time interval of clock synchronization to be dynamically adjusted, when it is detected that the device time deviation exceeds the preset threshold, a clock synchronization operation will be triggered to ensure the accuracy of the system time.
[0094] To more clearly understand the clock synchronization process of the present application, here in combination with Figure 4 it is described as follows:
[0095] Taking the battery system BMS in the energy storage system as an example, Figure 4 Trtc in it is the RTC system time of the BMS, Figure 4Tems is the system time of EMS in the energy storage system. The system time of BMS after software calibration is Taju. The goal is to make Taju close to Tems to reduce clock deviation. The EMS system synchronizes the BMS once a day. After synchronization, EMS records Trtc and Tems every 2.4 hours. A total of 10 sets of data are recorded as raw data. The time fitting coefficient of the BMS on that day is determined using the least squares model. EMS sends the time fitting coefficient to BMS. The next day, BMS brings its Trtc into the target multi-order polynomial model constructed by the time fitting coefficient. The target multi-order polynomial model calibrates Trtc to Taju, and then uses Taju to synchronize the clock of the BMS database and log. Taju is close to the system time Tems of EMS in the energy storage system. The specific steps of the clock synchronization process are as follows: Figure 4 shown.
[0096] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0097] Based on the same inventive concept, the embodiment of the present application also provides a clock synchronization device for implementing the clock synchronization method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more clock synchronization device embodiments provided below can refer to the limitations on the clock synchronization method above, and will not be repeated here.
[0098] In an exemplary embodiment, Figure 5 As shown, a clock synchronization device is provided, including: an acquisition module 502, a fitting module 504, a calibration module 506 and a clock synchronization module 508, wherein:
[0099] An acquisition module 502 is used to acquire historical system time data of each device;
[0100] A fitting module 504 is used to perform polynomial fitting based on historical system time data to obtain a time fitting coefficient for each device;
[0101] A calibration module 506, configured to calibrate the real-time system time of each device according to the time fitting coefficient to obtain a calibrated device system time;
[0102] The clock synchronization module 508 is used to synchronize the clock of each device according to the calibration device system time.
[0103] In some embodiments, the clock synchronization device also includes: a historical data construction module, which is used to obtain the real-time system time of each device; obtain the energy storage system time of the energy storage system; and construct historical system time data based on the real-time system time and the energy storage system time.
[0104] In some embodiments, the fitting module 504 is further used to perform polynomial fitting on the historical system time data according to the least squares model to obtain the time fitting coefficient of each device.
[0105] In some embodiments, the fitting module 504 is also used to construct an augmented matrix for historical system time data according to a least squares model to obtain a historical time augmented matrix; perform nested loop processing on the historical time augmented matrix according to the least squares model to obtain a cyclic time augmented matrix; perform Gaussian elimination processing on the cyclic time augmented matrix to obtain a system time elimination matrix; perform back-band solution processing on the system time elimination matrix to obtain a time fitting coefficient.
[0106] In some embodiments, the calibration module 506 is also used to input the time fitting coefficient into a preset multi-order polynomial model for model construction to obtain a target multi-order polynomial model; and perform time calibration on the real-time system time of each device according to the target multi-order polynomial model to obtain the calibrated device system time.
[0107] In some embodiments, the clock synchronization module 508 is also used to obtain the real-time energy storage system time of the energy storage system; determine the device time deviation of each device according to the calibration device system time and the real-time energy storage system time; when the device time deviation is greater than the preset time deviation threshold, synchronize the clock of the device corresponding to the device time deviation.
[0108] The clock synchronization device obtains the historical system time data of each device, performs polynomial fitting on the historical system time data, obtains the time fitting coefficient of each device, performs time calibration on the real-time system time of each device according to the time fitting coefficient, obtains the calibrated device system time, and performs clock synchronization on each device according to the calibrated device system time. Therefore, by performing polynomial fitting on the historical system time data of each device, the time fitting coefficient of each device can be accurately obtained, and used to calibrate the real-time system time of each device, and then the clock of each device is synchronized, so that the clock of each device can be uniformly synchronized, which can ensure the consistency of the time synchronization frequency between multiple devices and effectively reduce the clock deviation between multiple devices.
[0109] Each module in the above clock synchronization device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0110] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 6 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store historical system time data of each device. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a clock synchronization method is implemented.
[0111] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0112] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0113] Get historical system time data for each device;
[0114] Perform polynomial fitting on historical system time data to obtain the time fitting coefficient of each device;
[0115] Perform time calibration on the real-time system time of each device according to the time fitting coefficient to obtain the calibrated device system time;
[0116] Synchronize the clock of each device according to the calibration device system time.
[0117] In some embodiments, when the processor executes the computer program, it also implements the following steps: obtaining the real-time system time of each device; obtaining the energy storage system time of the energy storage system; and constructing historical system time data based on the real-time system time and the energy storage system time.
[0118] In some embodiments, when the processor executes the computer program, the following steps are also implemented: polynomial fitting is performed on the historical system time data according to the least squares model to obtain the time fitting coefficient of each device.
[0119] In some embodiments, when the processor executes the computer program, the following steps are also implemented: constructing an augmented matrix for historical system time data according to a least squares model to obtain a historical time augmented matrix; performing nested loop processing on the historical time augmented matrix according to the least squares model to obtain a cyclic time augmented matrix; performing Gaussian elimination processing on the cyclic time augmented matrix to obtain a system time elimination matrix; performing back-banding solution processing on the system time elimination matrix to obtain a time fitting coefficient.
[0120] In some embodiments, when the processor executes the computer program, the following steps are also implemented: inputting the time fitting coefficient into a preset multi-order polynomial model to construct the model and obtain a target multi-order polynomial model; calibrating the real-time system time of each device according to the target multi-order polynomial model to obtain the calibrated device system time.
[0121] In some embodiments, when the processor executes the computer program, the following steps are also implemented: obtaining the real-time energy storage system time of the energy storage system; determining the device time deviation of each device based on the calibration device system time and the real-time energy storage system time; when the device time deviation is greater than the preset time deviation threshold, synchronizing the clock of the device corresponding to the device time deviation.
[0122] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0123] Get historical system time data for each device;
[0124] Perform polynomial fitting on historical system time data to obtain the time fitting coefficient of each device;
[0125] Perform time calibration on the real-time system time of each device according to the time fitting coefficient to obtain the calibrated device system time;
[0126] Synchronize the clock of each device according to the calibration device system time.
[0127] In some embodiments, when the computer program is executed by the processor, the following steps are also implemented: obtaining the real-time system time of each device; obtaining the energy storage system time of the energy storage system; and constructing historical system time data based on the real-time system time and the energy storage system time.
[0128] In some embodiments, when the computer program is executed by the processor, the following steps are also implemented: polynomial fitting is performed on the historical system time data according to the least squares model to obtain the time fitting coefficient of each device.
[0129] In some embodiments, when the computer program is executed by the processor, the following steps are also implemented: constructing an augmented matrix for historical system time data according to a least squares model to obtain a historical time augmented matrix; performing nested loop processing on the historical time augmented matrix according to the least squares model to obtain a cyclic time augmented matrix; performing Gaussian elimination processing on the cyclic time augmented matrix to obtain a system time elimination matrix; performing back-banding solution processing on the system time elimination matrix to obtain a time fitting coefficient.
[0130] In some embodiments, when the computer program is executed by the processor, the following steps are also implemented: inputting the time fitting coefficient into a preset multi-order polynomial model for model construction to obtain a target multi-order polynomial model; calibrating the real-time system time of each device according to the target multi-order polynomial model to obtain the calibrated device system time.
[0131] In some embodiments, when the computer program is executed by the processor, the following steps are also implemented: obtaining the real-time energy storage system time of the energy storage system; determining the device time deviation of each device based on the calibration device system time and the real-time energy storage system time; when the device time deviation is greater than a preset time deviation threshold, synchronizing the clock of the device corresponding to the device time deviation.
[0132] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0133] Get historical system time data for each device;
[0134] Perform polynomial fitting on historical system time data to obtain the time fitting coefficient of each device;
[0135] Perform time calibration on the real-time system time of each device according to the time fitting coefficient to obtain the calibrated device system time;
[0136] Synchronize the clock of each device according to the calibration device system time.
[0137] In some embodiments, when the computer program is executed by the processor, the following steps are also implemented: obtaining the real-time system time of each device; obtaining the energy storage system time of the energy storage system; and constructing historical system time data based on the real-time system time and the energy storage system time.
[0138] In some embodiments, when the computer program is executed by the processor, the following steps are also implemented: polynomial fitting is performed on the historical system time data according to the least squares model to obtain the time fitting coefficient of each device.
[0139] In some embodiments, when the computer program is executed by the processor, the following steps are also implemented: constructing an augmented matrix for historical system time data according to a least squares model to obtain a historical time augmented matrix; performing nested loop processing on the historical time augmented matrix according to the least squares model to obtain a cyclic time augmented matrix; performing Gaussian elimination processing on the cyclic time augmented matrix to obtain a system time elimination matrix; performing back-banding solution processing on the system time elimination matrix to obtain a time fitting coefficient.
[0140] In some embodiments, when the computer program is executed by the processor, the following steps are also implemented: inputting the time fitting coefficient into a preset multi-order polynomial model for model construction to obtain a target multi-order polynomial model; calibrating the real-time system time of each device according to the target multi-order polynomial model to obtain the calibrated device system time.
[0141] In some embodiments, when the computer program is executed by the processor, the following steps are also implemented: obtaining the real-time energy storage system time of the energy storage system; determining the device time deviation of each device based on the calibration device system time and the real-time energy storage system time; when the device time deviation is greater than a preset time deviation threshold, synchronizing the clock of the device corresponding to the device time deviation.
[0142] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0143] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited thereto. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited thereto.
[0144] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0145] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be construed as limiting the scope of the present application. It should be noted that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A clock synchronization method, characterized in that: The method comprises: Get historical system time data for each device; Performing polynomial fitting on the historical system time data to obtain a time fitting coefficient for each of the devices; Performing time calibration on the real-time system time of each of the devices according to the time fitting coefficient to obtain a calibrated device system time; The clock of each of the devices is synchronized according to the calibration device system time.
2. The method according to claim 1, characterized in that Before obtaining the historical system time data of each device, the method further includes: Obtaining the real-time system time of each of the devices; Obtain the energy storage system time of the energy storage system; The historical system time data is constructed according to the real-time system time and the energy storage system time.
3. The method according to claim 1, characterized in that The polynomial fitting of the historical system time data to obtain the time fitting coefficient of each device includes: A polynomial fitting is performed on the historical system time data according to a least squares model to obtain a time fitting coefficient for each of the devices.
4. The method according to claim 3, characterized in that The performing polynomial fitting on the historical system time data according to the least squares model to obtain the time fitting coefficient of each device includes: Constructing an augmented matrix for the historical system time data according to the least squares model to obtain a historical time augmented matrix; Performing nested loop processing on the historical time augmented matrix according to the least squares model to obtain a cyclic time augmented matrix; Performing Gaussian elimination processing on the cyclic time augmented matrix to obtain a system time elimination matrix; The system time elimination matrix is subjected to back-strip solution processing to obtain the time fitting coefficient.
5. The method according to claim 1, characterized in that The step of performing time calibration on the real-time system time of each device according to the time fitting coefficient to obtain the calibrated device system time includes: Inputting the time fitting coefficient into a preset multi-order polynomial model to construct a model, thereby obtaining a target multi-order polynomial model; The real-time system time of each of the devices is time-calibrated according to the target multi-order polynomial model to obtain the calibrated device system time.
6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: Get the real-time energy storage system time of the energy storage system; Determine the device time deviation of each device according to the calibration device system time and the real-time energy storage system time; When the device time deviation is greater than a preset time deviation threshold, clock synchronization is performed on the device corresponding to the device time deviation.
7. A clock synchronization device, characterized in that: The device comprises: The acquisition module is used to obtain the historical system time data of each device; A fitting module, used for performing polynomial fitting according to the historical system time data to obtain a time fitting coefficient for each of the devices; A calibration module, used for calibrating the real-time system time of each device according to the time fitting coefficient to obtain a calibrated device system time; A clock synchronization module is used to synchronize the clock of each of the devices according to the system time of the calibration device.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
