A parameter-adaptive multi-sensor network time synchronization method and related equipment
By building a time synchronization model with parameters adaptive parameters in a multi-sensor network and adjusting sensor time using optimization algorithms, the problem of poor time synchronization reliability in the prior art is solved, and the time synchronization effect with high precision and rapid convergence is achieved.
Patent Information
- Application Number
- CN202510083995.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-20
- Publication Date
- 2025-05-09
- Estimated Expiration
- 2045-01-20
Smart Images

Figure CN119544139B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of time synchronization, and in particular to a parameter-adaptive multi-sensor network time synchronization method and related equipment. Background Art
[0002] Multisensor Networks (MSNs) are networks composed of multiple distributed sensor nodes that are connected wirelessly or wired and are designed to work together to collect, process and transmit data. Due to the reduction in cost, MSNs are increasingly used in a wide range of applications such as data fusion, smart buildings and positioning services, which have promoted the intelligent transformation of various industries and provided more efficient solutions for data-driven decision-making. Usually, hardware differences, network delays and other reasons will lead to differences in clocks between different sensor nodes. Therefore, in order to ensure the consistency of data coordination, acquisition and transmission between nodes, high-precision time synchronization is essential. Distributed clock synchronization schemes such as message-based and master-slave mechanism have been proposed. Although the time synchronization technology based on message passing is simple in structure and easy to implement, it is not suitable for large-scale networks. As the number of nodes increases, the delay and complexity of message passing increase significantly. The time synchronization technology based on the master-slave mechanism can provide high synchronization accuracy when the network delay is small, but it depends on the accuracy of the master node. The failure of the master node will affect the synchronization effect of the entire network. In recent years, the development of consensus theory in multi-intelligent systems has provided new solutions to the time synchronization problem. This technology can resist the impact of single point failures and dynamic network conditions, support the participation of large-scale nodes without significant performance degradation, and allow partial node failures without affecting the synchronization of the entire system. It has advantages in robustness, scalability and synchronization accuracy, and can well solve the problem of time synchronization of MSNs without communication delays.
[0003] However, an important factor affecting the accuracy of MSNs time synchronization is random communication delay. In addition, the reliability of the above time synchronization schemes usually depends on the weighted parameters that control the degree of influence of neighboring nodes on the synchronization process. Inappropriate weighted parameters will lead to more unacceptable time synchronization accuracy. Therefore, it is crucial to develop high-precision and fast-converging time synchronization schemes under communication delay. Metaheuristic optimization algorithms provide an effective solution to the problem of adaptively adjusting the weight parameters of consensus algorithms under communication delay.
[0004] Metaheuristic optimization algorithms are suitable for solving various complex optimization problems and can effectively explore parameter space to improve synchronization performance. However, the tendency to fall into local optimality in the search space is one of the inherent defects of this metaheuristic algorithm. This shortcoming is particularly obvious when solving the time synchronization problem in MSNs. It can be seen that the current multi-sensor time synchronization method has the problem of poor reliability. Summary of the invention
[0005] The present application provides a parameter-adaptive multi-sensor network time synchronization method and related equipment, which can solve the problem of poor reliability of the multi-sensor time synchronization method.
[0006] In a first aspect, the present application provides a parameter-adaptive multi-sensor network time synchronization method, the multi-sensor network time synchronization method comprising:
[0007] Obtain the local time of each sensor in the target multi-sensor network at the current moment, and build a clock model for each sensor based on the deviation and offset of the local time of each sensor relative to the current moment; the clock model is used to describe the relationship between the local time of the sensor and the consensus time;
[0008] Construct an update formula to update the drift and offset of each sensor's consensus time relative to the local time;
[0009] A time synchronization parameter adaptive model is constructed based on the update formula and all clock models, and the time synchronization parameter adaptive model is solved using an optimization algorithm to obtain an optimal parameter set;
[0010] Use the optimal parameter set and update formula to update the drift and offset corresponding to each sensor, and obtain the final drift and final offset of the consensus time of each sensor relative to the local time at the current moment;
[0011] For each sensor, the local time of the sensor is adjusted according to the final drift and final offset corresponding to the sensor, so that the local times of all sensors are synchronized.
[0012] Optionally, the clock model is:
[0013] ;
[0014] in, Indicates The consensus time of each sensor, Indicates The drift of the consensus time of each sensor relative to the local time, Indicates the offset of consensus time relative to local time, , represents the numbered set of sensors in the target multi-sensor network, Indicates The local time of each sensor;
[0015] ;
[0016] in, Indicates the current moment, Indicates The drift of each sensor relative to the current moment, Indicates The offset of each sensor relative to the current moment.
[0017] Optionally, update the formula to:
[0018] ;
[0019] ;
[0020] in, Indicates The drift of the consensus time after each sensor update relative to the local time, Indicates The drift of the consensus time of the last update of each sensor relative to the local time, and represents the tuning parameters, Indicates The set of sensors adjacent to each other. Indicates The offset of the consensus time after each sensor update relative to the local time, Indicates The offset of the consensus time of the last update of each sensor relative to the local time, Indicates The consensus time of the last update of each sensor, Indicates The sensor most recently passed The consensus time after the sensor is updated, Indicates The sensor and Updated relative drift parameters between sensors:
[0021] ;
[0022] in, represents the low-pass filter coefficient, Indicates The sensor and The most recently updated relative drift parameter between the sensors, Indicates The current local time of each sensor, Indicates The sensor receives the The local time when the sensor broadcasts the time packet, Indicates The local time when the sensor was last updated, Indicates The sensor last received The local time recorded when the sensor broadcasts the time packet.
[0023] Optionally, the time synchronization parameter adaptation model is:
[0024]
[0025] in, Represents a parameter set, represents the cost function, express Moment The consensus time of each sensor, express Moment The consensus time of each sensor, Indicates The consensus time of each sensor, Indicates about The function of Indicates The local time of each sensor, represents the drift of consensus time relative to local time, Indicates the offset of consensus time relative to local time, Representation and , , Related The update formula is: Representation and , Related The update formula is: Indicates the current moment, represents the numbered set of sensors in the target multi-sensor network, Indicates the absolute time of the current moment. Indicates the absolute time of the initial moment.
[0026] Optionally, an optimization algorithm is used to solve the time synchronization parameter adaptive model to obtain an optimal parameter set, including:
[0027] Get multiple initial parameter sets;
[0028] Generate a new initial parameter set for each initial parameter set based on mirror reverse learning, substitute each initial parameter set into the time synchronization parameter adaptive model, calculate the value of the cost function corresponding to each initial parameter set, and sort the values of all cost functions from small to large, select the first half of the cost function values as the target values, and take the initial parameter set corresponding to each target value as a parameter set;
[0029] Determine whether the number of iterations reaches the maximum number of iterations;
[0030] If so, the parameter set with the smallest corresponding cost function value is selected from all parameter sets as the optimal parameter set;
[0031] Otherwise, the number of iterations is increased by 1. For each parameter set, a new parameter set based on the parameter set is generated based on horizontal crossover, vertical crossover and mirror reverse learning, and compared with the parameter set. The parameter set and the new parameter set that can make the value of the cost function smaller are taken as candidate parameter sets.
[0032] Using the parameter set update formula to iterate each candidate parameter set in turn, to obtain multiple iterated candidate parameter sets;
[0033] Substituting each iterative candidate parameter set into the time synchronization parameter adaptive model, and calculating the value of the cost function corresponding to each iterative candidate parameter set;
[0034] The candidate parameter set after iteration with the smallest corresponding cost function value is taken as the target parameter set, and all candidate parameter sets after iteration are updated based on the target parameter set to obtain multiple final parameter sets;
[0035] All final parameter sets are taken as multiple parameter sets, and the step of determining whether the number of iterations reaches the maximum number of iterations is returned.
[0036] Optionally, each candidate parameter set is iterated in turn using a parameter set update formula to obtain multiple iterated candidate parameter sets, including:
[0037] By formula:
[0038]
[0039] Get the The nth candidate parameter set after iterations ;
[0040] in, Indicates The nth candidate parameter set after iterations, Indicates The first set of random parameters for the iteration, Indicates The second set of random parameters for the iteration, Indicates The third set of random parameters for the iteration, and Represents a random number, represents the improved Newton-Raphson search rule, and represents two randomly selected candidate parameter sets, Represents the adaptive coefficient:
[0041] ;
[0042] in, Indicates the maximum number of iterations.
[0043] Optionally, all iterated candidate parameter sets are updated based on the target parameter set to obtain multiple final parameter sets, including:
[0044] Generate a random number and determine whether the random number is less than the decision factor;
[0045] If so, then by the formula:
[0046]
[0047] Get the final parameter set ;
[0048] in, and Represents a random number, Indicates For all parameter sets of iterations, It means to find the mean of each parameter in multiple parameter sets respectively;
[0049] Otherwise, the candidate parameter set after each iteration is directly used as a final parameter set.
[0050] Optionally, the drift and offset of each sensor are updated using the optimal parameter set and update formula to obtain the final drift and final offset of the consensus time of each sensor relative to the local time at the current moment, including:
[0051] Substitute the optimal parameter set into the update formula to obtain the final update formula;
[0052] The final update formula is used to calculate the final drift and final offset of the consensus time of each sensor relative to the local time.
[0053] In a second aspect, the present application provides a parameter-adaptive multi-sensor network time synchronization device, comprising:
[0054] The acquisition module obtains the local time of each sensor in the target multi-sensor network at the current moment, and builds a clock model for each sensor based on the deviation and offset of the local time of each sensor relative to the current moment; the clock model is used to describe the relationship between the local time of the sensor and the consensus time;
[0055] Building a module to construct an update formula for updating the drift and offset of each sensor's consensus time relative to the local time;
[0056] The solution module builds a time synchronization parameter adaptive model based on the update formula and all clock models, and uses the optimization algorithm to solve the time synchronization parameter adaptive model to obtain the optimal parameter set;
[0057] The update module uses the optimal parameter set and update formula to update the drift and offset corresponding to each sensor, and obtains the final drift and final offset of the consensus time of each sensor relative to the local time at the current moment;
[0058] The adjustment module adjusts the local time of each sensor according to the final drift and final offset corresponding to the sensor, so as to synchronize the local times of all sensors.
[0059] In a third aspect, an embodiment of the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned parameter-adaptive multi-sensor network time synchronization method when executing the above-mentioned computer program.
[0060] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned parameter-adaptive multi-sensor network time synchronization method is implemented.
[0061] The above solution of the present application has the following beneficial effects:
[0062] In an embodiment of the present application, the local time of each sensor in the target multi-sensor network at the current moment is obtained, and a clock model of each sensor is constructed based on the deviation and offset of the local time of each sensor relative to the current moment, and then an update formula is constructed to update the drift and offset of the consensus time of each sensor relative to the local time, and then a time synchronization parameter adaptive model is constructed based on the update formula and all clock models, and the time synchronization parameter adaptive model is solved using an optimization algorithm to obtain an optimal parameter set, and then the drift and offset corresponding to each sensor are updated using the optimal parameter set and the update formula to obtain the final drift and final offset of the consensus time of each sensor relative to the local time at the current moment, and finally, for each sensor, the local time of the sensor is adjusted according to the final drift and final offset corresponding to the sensor, so that the local time of all sensors is synchronized. Among them, constructing a time synchronization parameter adaptive model and optimally solving the parameters in the update formula can achieve parameter adaptation and improve the accuracy of time synchronization. Using the optimization algorithm for solving can improve the global search capability during the solution, avoid falling into the local optimum during the solution process, improve the accuracy of the optimal parameter set, and thus improve the reliability of time synchronization in multi-sensor networks.
[0063] Other beneficial effects of the present application will be described in detail in the subsequent specific implementation section. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art 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 drawings can be obtained based on these drawings without paying any creative work.
[0065] Figure 1 A flow chart of a parameter-adaptive multi-sensor network time synchronization method provided in an embodiment of the present application;
[0066] Figure 2 A flowchart of an optimization algorithm provided in one embodiment of the present application;
[0067] Figure 3 A variation curve of the adaptive coefficient provided in an embodiment of the present application;
[0068] Figure 4 A schematic diagram of the rules of mirror reverse learning provided in one embodiment of the present application;
[0069] Figure 5 A schematic diagram of a first optimization result provided in an embodiment of the present application;
[0070] Figure 6 A schematic diagram of a second optimization result provided in an embodiment of the present application;
[0071] Figure 7 A comparison diagram of time synchronization results provided in an embodiment of the present application;
[0072] Figure 8 A comparison chart of first time synchronization results of different numbers of sensors provided in an embodiment of the present application;
[0073] Fig. 9 A comparison diagram of second time synchronization results with different numbers of sensors provided in an embodiment of the present application;
[0074] Fig.10 A schematic diagram of the structure of a parameter-adaptive multi-sensor network time synchronization device provided in an embodiment of the present application;
[0075] Fig.11 A schematic diagram of the structure of a terminal device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0076] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0077] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0078] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0079] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0080] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0081] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0082] In view of the problem of poor reliability in existing multi-sensor time synchronization methods, an embodiment of the present application provides a method of acquiring the local time of each sensor in the target multi-sensor network at the current moment, and building a clock model of each sensor based on the deviation and offset of the local time of each sensor relative to the current moment, and then building an update formula for updating the drift and offset of the consensus time of each sensor relative to the local time, and then building a time synchronization parameter adaptive model based on the update formula and all clock models, and using an optimization algorithm to solve the time synchronization parameter adaptive model to obtain an optimal parameter set, and then using the optimal parameter set and the update formula to update the drift and offset corresponding to each sensor to obtain the final drift and final offset of the consensus time of each sensor relative to the local time at the current moment, and finally adjusting the local time of each sensor according to the final drift and final offset corresponding to the sensor, so that the local time of all sensors is synchronized. Among them, constructing a time synchronization parameter adaptive model and optimally solving the parameters in the update formula can achieve parameter adaptation and improve the accuracy of time synchronization. Using the optimization algorithm for solving can improve the global search capability during the solution, avoid falling into the local optimum during the solution process, improve the accuracy of the optimal parameter set, and thus improve the reliability of time synchronization in multi-sensor networks.
[0083] Next, the parameter-adaptive multi-sensor network time synchronization method provided by the present application is exemplified.
[0084] like Figure 1 As shown, the parameter adaptive multi-sensor network time synchronization method provided by the present application includes the following steps:
[0085] Step 11, obtaining the local time of each sensor in the target multi-sensor network at the current moment, and constructing a clock model of each sensor based on the deviation and offset of the local time of each sensor relative to the current moment.
[0086] The above clock model is used to describe the relationship between the local time of the sensor and the consensus time. The above target multi-sensor network is a multi-sensor network that needs time synchronization. The current time is the time that needs time synchronization. For example, the current time is 8 o'clock, the local time is the time of the local clock of the sensor, and the consensus time is the standard time of the sensor network calculated based on the local time of the sensor using the clock model.
[0087] Specifically, the clock model is:
[0088] ;
[0089] in, Indicates The consensus time of each sensor, Indicates The drift of the consensus time of each sensor relative to the local time, Indicates the offset of consensus time relative to local time, , represents the numbered set of sensors in the target multi-sensor network, Indicates The local time of each sensor;
[0090] ;
[0091] in, Indicates the current moment, Indicates The drift of each sensor relative to the current moment, Indicates The offset of each sensor relative to the current moment.
[0092] Based on the local time of each sensor at the current moment, the relative clock relationship between nodes can be expressed as:
[0093] ;
[0094] in, represents the local time of node j, and are the relative clock drift and offset between two nodes, respectively.
[0095] It should be noted that clock synchronization is usually considered to be achieved when the consensus time of all sensors converges to the same stable value, that is: . Indicates The consensus time of each sensor.
[0096] Step 12, construct an update formula for updating the drift and offset of the consensus time of each sensor relative to the local time.
[0097] Specifically, the update formula is:
[0098]
[0099] in, Indicates The drift of the consensus time after each sensor update relative to the local time, Indicates The drift of the consensus time of the last update of each sensor relative to the local time, and represents the tuning parameters, Indicates The set of sensors adjacent to each other. Indicates The offset of the consensus time after each sensor update relative to the local time, Indicates The offset of the consensus time of the last update of each sensor relative to the local time, Indicates The consensus time of the last update of each sensor, Indicates The sensor most recently passed The consensus time after the sensor is updated, Indicates The sensor and Updated relative drift parameters between sensors:
[0100] ;
[0101] in, represents the low-pass filter coefficient, Indicates The sensor and The most recently updated relative drift parameter between the sensors, Indicates The current local time of each sensor, Indicates The local time when the sensor was last updated, Indicates The sensor last received The local time recorded when the sensor broadcasts the time packet, Indicates The sensor receives the The local time when a sensor broadcasts a time packet can be expressed as:
[0102] ;
[0103] in, Indicates The sensor in The local time when the sensor broadcasts the time packet, Indicates The sensor and The communication delay when the sensor communicates. It can be expressed as , Indicates The moment when a sensor broadcasts a time packet, Indicates The sensor receives the The moment of the time packet broadcast by the sensor.
[0104] It should be noted that each sensor updates the drift and offset of its own consensus time relative to the local time, as well as the relative drift parameters between it and other sensors at a certain period of time, and sends relevant data to adjacent nodes in the form of broadcast.
[0105] Step 13: construct a time synchronization parameter adaptive model based on the update formula and all clock models, and solve the time synchronization parameter adaptive model using an optimization algorithm to obtain an optimal parameter set.
[0106] In some embodiments of the present application, the above-mentioned optimization algorithm is an improved Newton-Raphson optimization method. The above-mentioned time synchronization parameter adaptive model is constructed based on the update formula and all clock models, and the time synchronization parameter adaptive model is solved by the optimization algorithm to obtain the optimal parameter set. The steps are:
[0107] In the first step, a time synchronization parameter adaptive model is constructed based on the update formula and all clock models.
[0108] Specifically, the time synchronization parameter adaptive model is:
[0109]
[0110] in, Represents a parameter set, represents the cost function, express Moment The consensus time of each sensor, express Moment The consensus time of each sensor, Indicates The consensus time of each sensor, Indicates about The function of Indicates The local time of each sensor, represents the drift of consensus time relative to local time, Indicates the offset of consensus time relative to local time, Representation and , , Related The update formula is: Representation and , Related The update formula is: Indicates the current moment, represents the numbered set of sensors in the target multi-sensor network, Indicates the absolute time of the current moment. Indicates the absolute time of the initial moment.
[0111] The second step is to obtain multiple initial parameter sets.
[0112] Exemplarily, multiple initial parameter sets can be obtained by randomly generating, each of which includes , and The values of the three parameters.
[0113] The third step is to generate a new initial parameter set for each initial parameter set based on mirror reverse learning, substitute each initial parameter set into the time synchronization parameter adaptive model, calculate the value of the cost function corresponding to each initial parameter set, and sort all the cost function values from small to large, select the first half of the cost function values as the target value, and take the initial parameter set corresponding to each target value as a parameter set. In addition, the initial parameter set corresponding to the second half of the cost function values is discarded.
[0114] The fourth step is to determine whether the number of iterations has reached the maximum number of iterations.
[0115] If so, the parameter set with the smallest corresponding cost function value is selected from all parameter sets as the optimal parameter set.
[0116] Otherwise, the number of iterations is increased by 1. For each parameter set, a new parameter set based on the parameter set is generated based on horizontal cross, vertical cross and mirror reverse learning, and compared with the parameter set. The parameter set and the new parameter set that can make the value of the cost function smaller is taken as the candidate parameter set.
[0117] Specifically, the parameter set is subjected to horizontal crossover, vertical crossover and mirror reverse learning in sequence to generate a new parameter set.
[0118] Then, each candidate parameter set is iterated in turn using the parameter set update formula to obtain multiple iterated candidate parameter sets.
[0119] Specifically, through the formula:
[0120] ;
[0121] ;
[0122] ;
[0123] ;
[0124] ;
[0125] Get the The nth candidate parameter set after iterations ;
[0126] in, Indicates The nth candidate parameter set after iterations, Indicates The first set of random parameters for the iteration, Indicates The second set of random parameters for the iteration, Indicates The third set of random parameters for the iteration, and Represents a random number, and represents two randomly selected candidate parameter sets, Represents the adaptive coefficient:
[0127] ;
[0128] in, Indicates the maximum number of iterations.
[0129] represents the improved Newton-Raphson search rule, and the formula is:
[0130] ;
[0131] ;
[0132] ;
[0133] ;
[0134] ;
[0135] Indicates The candidate parameter set with the largest value of the cost function corresponding to all candidate parameter sets is iterated. Indicates The candidate parameter set with the smallest value of the cost function corresponding to all candidate parameter sets is iterated. Represents the generation of a dim-dimensional random vector, where dim refers to the number of parameters in the parameter set.
[0136] Then, each candidate parameter set after each iteration is substituted into the time synchronization parameter adaptive model, and the value of the cost function corresponding to each candidate parameter set after each iteration is calculated.
[0137] Then, the candidate parameter set after iteration with the smallest value of the corresponding cost function is taken as the target parameter set, and all candidate parameter sets after iteration are updated based on the target parameter set to obtain multiple final parameter sets.
[0138] Specifically, a random number is generated, and it is determined whether the random number is less than the decision factor;
[0139] If so, then by the formula:
[0140]
[0141] Get the final parameter set ;
[0142] in, and Represents a random number, Indicates For all parameter sets of iterations, It means to find the mean of each parameter in multiple parameter sets respectively;
[0143] Otherwise, the candidate parameter set after each iteration is directly used as a final parameter set.
[0144] In the above formula, Indicates The candidate parameter set with the smallest value of the cost function corresponding to all candidate parameter sets in the iteration is the target parameter set.
[0145] Finally, all final parameter sets are taken as multiple parameter sets, and the step of determining whether the number of iterations reaches the maximum number of iterations is returned.
[0146] It should be noted that the initial value of the number of iterations is 0.
[0147] The above optimization algorithm is exemplarily described below with reference to a specific example.
[0148] The optimization process of the optimization algorithm is as follows Figure 2 As shown, after starting, the parameters are initialized ( ), then generate N new individuals based on mirror reverse learning for the randomly generated N individuals (initial parameter set), mix these 2N individuals, and select the first N as the population P[N] of subsequent iterations, and compare to get the best individual in the current population and the worst individual (i.e., the individuals with the smallest and largest corresponding cost functions), if the number of iterations is Greater than the maximum number of iterations , then return the latest (Coming soon As the optimal parameter set output), otherwise, randomly pair the parameter sets in the current population in pairs to form N / 2 groups for horizontal crossover, compare the new individuals and original individuals generated by horizontal crossover, retain the better ones respectively, and after all individuals are updated, update the best and worst individuals of the current population, calculate the adaptive coefficient δ of the current iteration, traverse all current parameter sets for i=1:N, let ζ=2rand(), and use the current individuals to generate new individuals based on mirror reverse learning , then compare the individual with the original individual and update it to determine whether it needs to be updated and , and randomly select a dimension to vertically cross the individual, and update it, randomly select and , and calculate , and then calculate using the formula above and , determine the random number Is it less than the decision factor DF? If so, calculate it using the formula above to obtain the final parameter set Otherwise, directly update the best and worst individuals of the current population, repeat the above steps until all N parameter sets are traversed, and the number of iterations increases by 1, and return to the judgment of the number of iterations. Greater than the maximum number of iterations Continue to the next iteration.
[0149] In the above iterative process, the adaptive coefficient The curve of the change with the number of iterations is as follows Figure 3 As shown, the horizontal axis in the figure represents the number of iterations , the vertical axis represents the adaptive coefficient The value of .
[0150] The rules based on mirror reverse learning are as follows Figure 4 As shown, the horizontal and vertical axes represent the values of the parameters, where ub and lb represent the upper and lower limits of each parameter respectively, and p represents the original parameter. Represents the mean of the upper and lower limits of the parameter. is a random number between 0 and 2. Represents the new parameter after mirroring, and the mathematical expression is:
[0151] ;
[0152] ;
[0153] After generating a new parameter set, compare whether the new parameter set is better than the original parameter set. If the generated cost function is smaller, replace the original parameter set and update the overall parameter set in time. If the performance is worse than the original parameter set, do not change the overall parameter set.
[0154] Horizontal crossover is a crossover operation between two different individuals in all dimensions. First, all parameter sets in the parameter set population are randomly paired, and then the two paired individuals are horizontally crossovered. The expression is:
[0155] ;
[0156] ;
[0157] in, and are two parameter set individuals randomly paired from the population, is a random number between 0 and 1, is a random number between -1 and 1. There are two new parameter sets generated by the horizontal crossover operation. By comparing the cost function value generated by the parameter set before the operation, the better parameter set is selected to stay.
[0158] Vertical crossover is a crossover operation of all individuals in two different dimensions. Through the vertical crossover operation, only one of the parameters is updated for each parameter set. The updated parameter value is updated by the following formula:
[0159] ;
[0160] in, and Respectively represent individuals The i-th and j-th parameter values of is a random number between (0,1). Replace parameter set After the i-th parameter in forms a new parameter set individual, and Compare them and keep the better parameter set individuals to continue iterative calculation.
[0161] It is worth mentioning that the use of an optimization algorithm that combines two advanced strategies, mirror reverse learning and cross search, can improve the global search capability during solution, avoid falling into local optimality during the solution process, and improve the accuracy of the optimal parameter set.
[0162] Step 14, using the optimal parameter set and update formula to update the drift and offset of each sensor, to obtain the final drift and final offset of the consensus time of each sensor relative to the local time at the current moment.
[0163] Specifically, the optimal parameter set is substituted into the update formula to obtain the final update formula, and then the final update formula is used to calculate the final drift and final offset of the consensus time of each sensor relative to the local time.
[0164] It is worth mentioning that constructing a time synchronization parameter adaptive model and optimally solving the parameters in the update formula can achieve parameter adaptation and improve the accuracy of time synchronization.
[0165] Step 15: For each sensor, adjust the local time of the sensor according to the final drift and final offset corresponding to the sensor, so that the local times of all sensors are synchronized.
[0166] Specifically, the final drift, the final offset, and the local time of the sensor at the current moment are substituted into the clock model of the sensor to obtain the final consensus time of the sensor, and the local time of the sensor is adjusted to the consensus time.
[0167] It is worth mentioning that constructing a time synchronization parameter adaptive model and optimally solving the parameters in the update formula can achieve parameter adaptation and improve the accuracy of time synchronization. Using the optimization algorithm for solving can improve the global search capability during the solution, avoid falling into the local optimum during the solution process, improve the accuracy of the optimal parameter set, and thus improve the reliability of time synchronization in multi-sensor networks.
[0168] The method of the present application is illustrated below with reference to a specific example.
[0169] 12 benchmark functions are selected to test the performance of the optimization algorithm. The optimization algorithm of this application is compared with four intelligent optimization algorithms: Albatross Optimizer (AO), Exponential Distribution Optimizer (EDO), Dung Beetle Optimizer (DBO) and Newton-Raphson Optimizer (NRBO). The optimization results of the 12 benchmark functions are as follows: Figure 5 and Figure 6 As shown, Figure 5 and Figure 6 The horizontal axis represents the number of iterations, the vertical axis represents the optimization result of the benchmark function, the solid line with dots represents the optimization result curve of AO, the solid line with black dots represents the optimization result curve of EDO, the solid line with squares represents the optimization result curve of NRBO, the solid line with crosses represents the optimization result curve of DBO, and the solid line with diamonds represents the optimization result curve of INRBO (i.e., the optimization algorithm of this application). The optimization results of the first 6 benchmark functions are shown in Figure 2. Figure 5 As shown, Figure 5 (a) represents the optimization result of the first benchmark function F1. Figure 5 (b) represents the optimization result of the second benchmark function F2. Figure 5 (c) shows the optimization result of the third benchmark function F3. Figure 5 (d) shows the optimization result of the fourth benchmark function F4. Figure 5 (e) shows the optimization result of the fifth benchmark function F5. Figure 5 (f) shows the optimization result of the sixth benchmark function F6. The optimization results of the next six benchmark functions are as follows: Figure 6 As shown, Figure 6 (a) shows the optimization result of the 7th benchmark function F7. Figure 6 (b) shows the optimization result of the 8th benchmark function F8. Figure 6 (c) shows the optimization result of the 9th benchmark function F9. Figure 6 (d) shows the optimization result of the 10th benchmark function F10. Figure 6 (e) shows the optimization result of the 11th benchmark function F11. Figure 6 (f) shows the optimization result of the 12th benchmark function F12.
[0170] It can be seen that the optimization algorithm of the present application has stronger global search capability and faster optimization speed than other intelligent optimization algorithms.
[0171] Use the method of this application to synchronize time, and compare the synchronization results with the standard consensus time synchronization algorithm (STC, Standard Consensus Time Synchronization), such as Figure 7 As shown, Figure 7 The horizontal axis represents time in seconds (s), and the vertical axis represents the maximum time error between nodes (sensors). The curve with dots is the time synchronization result of STC, and the curve with diamonds is the time synchronization result of INRBO-TC (i.e., the method of this application).
[0172] After changing the number of sensors, the time synchronization results of STC are as follows: Figure 8 As shown, Figure 8 The horizontal axis represents time in seconds (s), and the vertical axis represents the maximum time error between nodes (sensors). The curve with dots is the time synchronization result when the number of nodes is 4, and the curve with diamonds is the time synchronization result when the number of nodes is 10. The time synchronization results of the method of the present application are shown in FIG. Fig. 9 As shown, Fig. 9 The horizontal axis represents time in seconds (s), and the vertical axis represents the maximum time error between nodes (sensors). The curve with dots is the time synchronization result when the number of nodes is 4, and the curve with diamonds is the time synchronization result when the number of nodes is 10.
[0173] It can be seen that the method of the present application can achieve time synchronization between sensors faster and with higher synchronization accuracy than STC. The impact of changes in the scale of the multi-sensor network on the method of the present application is also smaller than that of STC, and the method is more robust.
[0174] The following is an exemplary description of the parameter-adaptive multi-sensor network time synchronization device provided by the present application.
[0175] like Fig.10 As shown, the embodiment of the present application provides a parameter-adaptive multi-sensor network time synchronization device, and the parameter-adaptive multi-sensor network time synchronization device 1000 includes:
[0176] Acquisition module 1001, acquires the local time of each sensor in the target multi-sensor network at the current moment, and builds a clock model of each sensor based on the deviation and offset of the local time of each sensor relative to the current moment; the clock model is used to describe the relationship between the local time of the sensor and the consensus time;
[0177] A construction module 1002 is used to construct an update formula for updating the drift and offset of the consensus time of each sensor relative to the local time;
[0178] A solution module 1003 constructs a time synchronization parameter adaptive model based on the update formula and all clock models, and solves the time synchronization parameter adaptive model using an optimization algorithm to obtain an optimal parameter set;
[0179] The updating module 1004 updates the drift and offset corresponding to each sensor using the optimal parameter set and the updating formula to obtain the final drift and final offset of the consensus time of each sensor relative to the local time at the current moment;
[0180] The adjustment module 1005 adjusts the local time of each sensor according to the final drift and final offset corresponding to the sensor, so as to synchronize the local times of all sensors.
[0181] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0182] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0183] like Fig.11 As shown, an embodiment of the present application provides a terminal device. The terminal device D10 of this embodiment includes: at least one processor D100 ( Fig.11 Only one processor is shown in the figure), a memory D101, and a computer program D102 stored in the memory D101 and executable on the at least one processor D100, wherein the processor D100 implements the steps of any of the above-mentioned method embodiments when executing the computer program D102.
[0184] Specifically, when the processor D100 executes the computer program D102, it obtains the local time of each sensor in the target multi-sensor network at the current moment, and builds a clock model of each sensor based on the deviation and offset of the local time of each sensor relative to the current moment, and then builds an update formula for updating the drift and offset of the consensus time of each sensor relative to the local time, and then builds a time synchronization parameter adaptive model based on the update formula and all clock models, and uses an optimization algorithm to solve the time synchronization parameter adaptive model to obtain an optimal parameter set, and then uses the optimal parameter set and the update formula to update the drift and offset corresponding to each sensor to obtain the final drift and final offset of the consensus time of each sensor relative to the local time at the current moment, and finally, for each sensor, the local time of the sensor is adjusted according to the final drift and final offset corresponding to the sensor to synchronize the local time of all sensors. Among them, constructing a time synchronization parameter adaptive model and optimally solving the parameters in the update formula can achieve parameter adaptation and improve the accuracy of time synchronization. Using the optimization algorithm for solving can improve the global search capability during the solution, avoid falling into the local optimum during the solution process, improve the accuracy of the optimal parameter set, and thus improve the reliability of time synchronization in multi-sensor networks.
[0185] The processor D100 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0186] In some embodiments, the memory D101 may be an internal storage unit of the terminal device D10, such as a hard disk or memory of the terminal device D10. In other embodiments, the memory D101 may also be an external storage device of the terminal device D10, such as a plug-in hard disk, a smart memory card (SMC, SmartMedia Card), a secure digital (SD, Secure Digital) card, a flash card (Flash Card), etc. equipped on the terminal device D10. Further, the memory D101 may also include both an internal storage unit of the terminal device D10 and an external storage device. The memory D101 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program, etc. The memory D101 may also be used to temporarily store data that has been output or is to be output.
[0187] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0188] An embodiment of the present application provides a computer program product. When the computer program product runs on a terminal device, the terminal device can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0189] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device, recording medium, computer memory, read-only memory (ROM, Read-OnlyMemory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal and software distribution medium that can carry the computer program code to the parameter adaptive multi-sensor network time synchronization method device / terminal device. For example, a USB flash drive, a mobile hard disk, a disk or an optical disk.
[0190] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0191] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0192] The above is a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles described in the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A parameter-adaptive multi-sensor network time synchronization method, characterized in that: include: Obtain the local time of each sensor in the target multi-sensor network at the current moment, and build a clock model for each sensor based on the deviation and offset of the local time of each sensor relative to the current moment; the clock model is used to describe the relationship between the local time of the sensor and the consensus time; Constructing an update formula for updating the drift and offset of the consensus time of each of the sensors relative to the local time; Building a time synchronization parameter adaptive model based on the update formula and all clock models, and solving the time synchronization parameter adaptive model using an optimization algorithm to obtain an optimal parameter set; Using the optimal parameter set and the update formula, the drift and offset corresponding to each of the sensors are updated to obtain the final drift and final offset of the consensus time of each of the sensors relative to the local time at the current moment; For each of the sensors, the local time of the sensor is adjusted according to the final drift and the final offset corresponding to the sensor, so that the local times of all sensors are synchronized.
2. The multi-sensor network time synchronization method according to claim 1, characterized in that: The clock model is: ; in, Indicates The consensus time of each sensor, Indicates the The drift of the consensus time of each sensor relative to the local time, Indicates the offset of the consensus time relative to the local time, , represents the numbered set of sensors in the target multi-sensor network, Indicates The local time of each sensor; ; in, Indicates the current moment, Indicates the The drift of each sensor relative to the current moment, Indicates the The offset of each sensor relative to the current moment.
3. The multi-sensor network time synchronization method according to claim 1, characterized in that: The update formula is: ; ; in, Indicates The drift of the consensus time after each sensor update relative to the local time, Indicates The drift of the consensus time of the last update of each sensor relative to the local time, and represents the tuning parameter, Indicates that The set of sensors adjacent to each other. Indicates the The offset of the consensus time after each sensor update relative to the local time, Indicates the The offset of the consensus time of the last update of each sensor relative to the local time, Indicates the The consensus time of the last update of each sensor, Indicates the The sensor most recently passed The consensus time after the sensor is updated, Indicates The sensor and Updated relative drift parameters between sensors: ; in, represents the low-pass filter coefficient, Indicates The sensor and The most recently updated relative drift parameter between the sensors, Indicates the The current local time of each sensor, Indicates the The sensor receives the The local time when the sensor broadcasts the time packet, Indicates the The local time when the sensor was last updated, Indicates the The sensor last received the The local time recorded when the sensor broadcasts the time packet.
4. The multi-sensor network time synchronization method according to claim 3, characterized in that: The time synchronization parameter adaptive model is: ; in, Represents a parameter set, represents the cost function, express Moment The consensus time of each sensor, express Moment The consensus time of each sensor, Indicates The consensus time of each sensor, Indicates about The function of Indicates The local time of each sensor, represents the drift of the consensus time relative to the local time, Represents the offset of the consensus time relative to the local time, Representation and , , Related The update formula is: Representation and , Related The update formula is: Indicates the current moment, represents the numbered set of sensors in the target multi-sensor network, Indicates the absolute time of the current moment. Indicates the absolute time of the initial moment.
5. The multi-sensor network time synchronization method according to claim 4, characterized in that: The using of an optimization algorithm to solve the time synchronization parameter adaptive model to obtain an optimal parameter set includes: Get multiple initial parameter sets; Generate a new initial parameter set for each initial parameter set based on mirror reverse learning, substitute each initial parameter set into the time synchronization parameter adaptive model, calculate the value of the cost function corresponding to each initial parameter set, sort the values of all cost functions from small to large, select the first half of the cost function values as target values, and use the initial parameter set corresponding to each target value as a parameter set; Determine whether the number of iterations reaches the maximum number of iterations; If so, the parameter set with the smallest corresponding cost function value is selected from all parameter sets as the optimal parameter set; Otherwise, the number of iterations is increased by 1, and for each parameter set, a new parameter set based on the parameter set is generated based on horizontal crossover, vertical crossover and mirror reverse learning, and compared with the parameter set, and the parameter set and the new parameter set that can make the value of the cost function smaller are taken as candidate parameter sets; Using the parameter set update formula to iterate each candidate parameter set in turn, to obtain multiple iterated candidate parameter sets; Substituting each iterative candidate parameter set into the time synchronization parameter adaptive model, and calculating the value of the cost function corresponding to each iterative candidate parameter set; The candidate parameter set after iteration with the smallest corresponding cost function value is taken as the target parameter set, and all candidate parameter sets after iteration are updated based on the target parameter set to obtain multiple final parameter sets; All final parameter sets are taken as multiple parameter sets, and the process returns to the step of determining whether the number of iterations reaches the maximum number of iterations.
6. The multi-sensor network time synchronization method according to claim 5, characterized in that: The parameter set update formula is used to iterate each candidate parameter set in turn to obtain multiple iterated candidate parameter sets, including: By formula: ; ; ; ; ; Get the The nth candidate parameter set after iterations ; in, Indicates The nth candidate parameter set after iterations, Indicates The first set of random parameters for the iteration, Indicates The second set of random parameters for the iteration, Indicates The third set of random parameters for the iteration, and Represents a random number, represents the improved Newton-Raphson search rule, and represents two randomly selected candidate parameter sets, Represents the adaptive coefficient: ; in, Indicates the maximum number of iterations.
7. The multi-sensor network time synchronization method according to claim 6, characterized in that: The updating of all iterated candidate parameter sets based on the target parameter set to obtain multiple final parameter sets includes: Generate a random number, and determine whether the random number is less than a decision factor; If so, then by the formula: ; Get the final parameter set ; in, and Represents a random number, Indicates For all parameter sets of iterations, It means to find the mean of each parameter in multiple parameter sets respectively; Otherwise, the candidate parameter set after each iteration is directly used as a final parameter set.
8. The multi-sensor network time synchronization method according to claim 1, characterized in that: The method of updating the drift and offset of each sensor by using the optimal parameter set and the updating formula to obtain the final drift and final offset of the consensus time of each sensor relative to the local time at the current moment includes: Substituting the optimal parameter set into the update formula to obtain a final update formula; The final update formula is used to calculate the final drift and final offset of the consensus time of each sensor relative to the local time.
9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the parameter-adaptive multi-sensor network time synchronization method according to any one of claims 1 to 8 is implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the parameter-adaptive multi-sensor network time synchronization method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Clock synchronization method, device and equipment of wireless sensor network and medium
CN115580368A
Clustering-based time synchronization method for electric power Internet of Things sensor network
CN118157804A