Disclosure of Invention
Aiming at the defects in the prior art, the invention provides a method and a system for analyzing the maximum time interval error, which solve the problem that the calculation efficiency and the calculation accuracy cannot be compatible when the existing maximum time interval error is calculated.
In order to solve the technical problems, the invention is solved by the following technical scheme:
A method of analyzing a maximum time interval error, comprising the steps of:
Obtaining a time error sample sequence, and performing sample clipping treatment on the time error sample sequence to obtain a time error clipping sample sequence with the number of samples meeting the index number of binary decomposition;
Binary decomposition is carried out on the time error cutting sample sequence according to the length of the dynamic sliding window, and the decomposed time error cutting sample sequence is constructed into an extremum matrix;
And calculating the length of the target observation window and the maximum time interval error of each level according to the extremum matrix, and constructing a relation curve of the length of the target observation window and the maximum time interval error.
Optionally, binary decomposition is performed on the time error clipping sample sequence according to a dynamic sliding window length, including the following steps:
Calculating the length of a first layer sliding window, and comparing the maximum value and the minimum value of the time error cutting sample sequence according to the length of the first layer sliding window to obtain a first layer extremum submatrix;
Calculating the current sliding window length according to the current layer number of the extremum matrix, comparing the maximum value of the maximum value submatrices in the extremum submatrices of the previous layer based on the current sliding window length, and comparing the minimum value of the minimum value submatrices in the extremum submatrices of the previous layer to obtain the extremum submatrices of the current layer;
and obtaining extremum submatrices of all layers to obtain an extremum matrix, wherein when only one sample is left in the extremum submatrices of the current layer, binary decomposition is stopped.
Optionally, performing sample clipping processing on the time error sample sequence, including the following steps:
Verifying whether the number of samples of the sequence of time error samples is an integer power of 2;
if so, sample clipping processing is not needed, and if not, the number of samples is clipped to the integer power of 2 nearby.
Optionally, the calculation formula of the extremum submatrix of the current layer is:
Ak/i=max[A(k-1)/i,A(k-1)/(2 k -1+i)];
ak/i=min[a(k-1)/i,a(k-1)/(2 k -1+i)],i=1,2,……,N-2k;
Wherein A k/i represents the maximum value of the ith element of the kth layer, a k/i represents the minimum value of the ith element of the kth layer, N represents the sample number of the time error clipping sample sequence, N=2 k, and when the extremum submatrix of the current layer is positioned on the kth layer, the extremum submatrix of the current layer consists of a k/i set and a k/i set.
Optionally, the formula for calculating the maximum time interval error for each level is:
MTIE (τ·τ 0)=max[Ak/i- ak/i],i=1,2,……,N-2k, where τ represents the target observation window length, τ= k-1;τ0 represents the sampling interval of the time error sample sequence.
Optionally, the method further comprises the following steps:
and outputting the maximum time interval error in the tau target range based on the relation curve, and drawing a logarithmic coordinate curve.
Optionally, the method further comprises the step of carrying out compliance verification on the maximum time interval error, and specifically comprises the following steps:
And comparing the relation curve with the MTIE standard curve, and generating a test report.
An analysis system of maximum time interval error for executing the analysis method of maximum time interval error according to any one of the above, comprising a data processing unit, an extremum matrix constructing unit and a curve generating unit;
The data processing unit is used for acquiring a time error sample sequence, and performing sample clipping processing on the time error sample sequence to obtain a time error clipping sample sequence with the number of samples meeting the index number of binary decomposition;
the extremum matrix constructing unit is used for binary decomposition of the time error cutting sample sequence according to the length of the dynamic sliding window, and constructing the decomposed time error cutting sample sequence into an extremum matrix;
The curve generating unit is used for calculating the target observation window length and the maximum time interval error of each level according to the extremum matrix and constructing a relation curve of the target observation window length and the maximum time interval error.
Optionally, the test system further comprises a verification unit, wherein the verification unit is used for comparing the relation curve with an MTIE standard curve and generating a test report.
A computer storage medium having stored thereon computer program instructions which, when executed by a processor, implement a method of maximum time interval error analysis as claimed in any one of the preceding claims.
Compared with the prior art, the technical scheme provided by the invention has the following beneficial effects:
According to the invention, the extremum submatrix of each layer is constructed in a recursive calculation mode, the construction process of the extremum submatrix of the second layer is taken as an example, when searching the maximum and minimum values of all adjacent three point windows of the extremum submatrix of the first layer, the process is equivalent to searching the maximum and minimum values of all adjacent four point windows in the time error cutting sample sequence x i, the equivalent operation does not need to search the whole time error cutting sample sequence x i, the repeated searching process of extremum in the sliding window process can be reduced based on the principle of bisection, so that the calculation efficiency is improved, meanwhile, compared with the traditional full traversal algorithm, the calculation complexity is reduced from O (N 3) to O (N.log2N), the processing time of a million-level sample is shortened from a small time level to a second level, and the compatibility of the calculation efficiency and the calculation accuracy of the maximum time interval error in calculation is ensured.
Detailed Description
The present invention will be described in further detail with reference to the following examples, which are illustrative of the present invention and are not intended to limit the present invention thereto.
Example 1
As shown in FIG. 1, an analysis method of maximum time interval error includes the steps of firstly obtaining a time error sample sequence, and performing sample clipping processing on the time error sample sequence to obtain a time error clipping sample sequence with the number of samples meeting the index number of binary decomposition.
Specifically, a time error sample sequence is received, the time error sample sequence may be TIE data output by an SDH device, the sampling rate may be set to 30Hz, at this time, the corresponding sampling interval τ 0 =1/30 Hz, after sampling is completed, the number of samples of the received time error sample sequence is not definite, therefore, the number of samples needs to be verified and cut to ensure that the number of samples after cutting meets the requirement of binary decomposition, more specifically, the sample cutting process is performed on the time error sample sequence, including the steps of verifying whether the number of samples of the time error sample sequence is an integer power of 2, if yes, no sample cutting process is required, and if not, the number of samples is cut to an adjacent integer power of 2, thereby ensuring the feasibility of the binary method.
Then, in order to improve the calculation efficiency, the extremum can be recursively taken by using an extremum matrix through a dichotomy method, so that the MTIE calculation efficiency is improved, specifically, the time error clipping sample sequence is subjected to binary decomposition according to the length of a dynamic sliding window, and the decomposed time error clipping sample sequence is constructed as the extremum matrix.
The binary decomposition method comprises the steps of calculating the length of a first layer sliding window, comparing maximum values and minimum values of the time error cutting sample sequence according to the length of the first layer sliding window to obtain a first layer extreme value submatrix, calculating the length of a current sliding window according to the current layer number of the extreme value submatrix, comparing the maximum values of the maximum value submatrix in the previous layer extreme value submatrix based on the length of the current sliding window, comparing the minimum values of the minimum value submatrix in the previous layer extreme value submatrix to obtain a current layer extreme value submatrix, obtaining extreme value submatrix of all layers, and obtaining the extreme value matrix, wherein binary decomposition is stopped when only one sample remains in the current layer extreme value submatrix.
It should be noted that, the calculation formula of the current layer extremum submatrix is :Ak/i=max[A(k-1)/i,A(k-1)/(2 k -1+i)];ak/i=min[a(k-1)/i,a(k-1)/(2 k -1+i)],i=1,2,……,N-2k;, where a k/i represents the maximum value of the ith element of the kth layer, a k/i represents the minimum value of the ith element of the kth layer, N represents the number of samples of the time error clipping sample sequence, n=2 k, and when the current layer extremum submatrix is located at the kth layer, the current layer extremum submatrix is composed of a set of a k/i and a set of a k/i.
As shown in fig. 2, in this embodiment, the number N of samples of the time error clipping sample sequence after clipping is 16, at this time, the time error clipping sample sequence x i is binary-disassembled, according to the calculation formula of the current extremum submatrix, the time error clipping sample sequence x i is used as the previous extremum submatrix as the calculation basis, the value of each element of the first layer maximum value submatrix and the value of each element of the first layer minimum value submatrix can be calculated according to the time error clipping sample sequence x i, the first layer maximum value submatrix and the second layer minimum value submatrix form the first layer extremum submatrix, at this time, the length of the first layer sliding window is 1, and the result of the first layer extremum submatrix represents that the number N of sliding windows is 1 at this time.
When the value of each element of the second-layer maximum value submatrix and the value of each element of the second-layer minimum value submatrix are calculated, the calculation basis of the second-layer maximum value submatrix is changed into the first-layer maximum value submatrix, the calculation basis of the second-layer minimum value submatrix is changed into the first-layer minimum value submatrix, the length of the second-layer sliding window is 3, and the second-layer minimum value submatrix is obtained through calculation through 2 k-1=22 -1, so that the second-layer extreme value submatrix is constructed.
Recursively calculating the extremum submatrices of the higher layers according to the mode and the calculation formula of the extremum submatrices of the current layer until the maximum observation window is covered, wherein,Represents the maximum value in dichotomy, when constructed to the firstAnd when the extreme value submatrices of the last layer are built, building the extreme value submatrices of all layers into an extreme value matrix.
In the invention, the extremum submatrix of each layer is constructed in a recursive calculation mode, taking the construction process of the extremum submatrix of the second layer as an example, when searching the maximum and minimum values of all adjacent three point windows of the extremum submatrix of the first layer, the process is equivalent to searching the maximum and minimum values of all adjacent four point windows in the time error cutting sample sequence x i, the equivalent operation does not need to search the time error cutting sample sequence x i, and the repeated searching process of extremum in the sliding window process can be reduced based on the principle of bisection, thereby improving the calculation efficiency.
After the extremum matrix is built, calculating the target observation window length and the maximum time interval error of each level according to the extremum matrix, and building a relation curve of the target observation window length and the maximum time interval error, wherein the formula for calculating the maximum time interval error of each level is MTIE (tau 0)=max[Ak/i- ak/i],i=1,2,……,N-2k, wherein tau represents the target observation window length, tau= (2 k-1)·τ0;τ0 represents the sampling interval of a time error sample sequence), so that the curve of the target observation window length tau and the maximum time interval error MTIE is obtained through layer-by-layer scanning.
And finally, outputting the maximum time interval error in the tau target range based on the relation curve, drawing a logarithmic coordinate curve, and on the other hand, carrying out compliance verification on the maximum time interval error.
In order to compare the calculation accuracy of the dichotomy proposed by the application with that of the traditional full traversal algorithm, the embodiment adopts a set of actually measured TIE data sequences, the algorithm input condition is that the number of samples N 0 is 98310 time error sample sequences, the sampling frequency=30Hz, at this time, sample clipping is firstly carried out, specifically, since the number of input samples is less than the integer power of 2, the data is clipped to the power of 2 of nearest neighbor, k MAX, namely k MAX = floor(log2(N0), and the number of samples of the time error clipping sample sequences after clipping is N= 16 =65536, so that the calculation feasibility of the dichotomy is ensured.
Secondly, constructing an extremum matrix, firstly constructing a first-layer maximum value submatrix A 1/i= max(xi,xi+1) and a first-layer minimum value submatrix a 1/i= min(xi,xi+1), namely initializing a maximum value matrix, then performing recursive computation :Ak/i=max[A(k-1)/i,A(k-1)/(2 k -1+i)];ak/i=min[a(k-1)/i,a(k-1)/(2 k -1+i)],k=2,……,16;, and finally constructing the extremum matrix according to all calculation results.
Then, calculating a relation curve of τ and MTIE, namely always target observation window length τ= (2 k-1)·τ0,(k=1,2,……,kMAX), and then calculating the maximum value of the difference value between the maximum value submatrix and the minimum value submatrix of the k layer according to a calculation formula of the maximum time interval error, and scanning k=1, 2 as the corresponding maximum time interval error, thereby obtaining the relation curve of τ and MTIE.
Finally, comparing the calculation accuracy of the dichotomy of the application with that of the traditional full-traversal method, as shown in fig. 3 and 4, it can be seen from fig. 3 that the MTIE curve calculated by the dichotomy of the application and the traditional full-traversal method is basically consistent, and further, as can be seen from fig. 4, the MTIE error is less than 3ns, so that the calculation accuracy meets the expectation, and the calculation complexity is reduced from O (N 3) to O (n.log2n) while the calculation accuracy is met, and the processing time of millions of samples is shortened from small-hour level to second level.
Example two
The analysis system of the maximum time interval error comprises a data processing unit, an extremum matrix constructing unit and a curve generating unit, wherein the data processing unit is used for acquiring a time error sample sequence, performing sample cutting processing on the time error sample sequence to obtain a time error cutting sample sequence with the number of samples meeting the index number of binary decomposition, the extremum matrix constructing unit is used for performing binary decomposition on the time error cutting sample sequence according to the dynamic sliding window length and constructing the decomposed time error cutting sample sequence as an extremum matrix, and the curve generating unit is used for calculating the target observation window length and the maximum time interval error of each level according to the extremum matrix and constructing a relation curve of the target observation window length and the maximum time interval error.
In addition, the system further comprises a verification unit, wherein the verification unit is used for comparing the relation curve with the MTIE standard curve and generating a test report, and the analysis system of the maximum time interval error in the present embodiment is used for executing the analysis method of the maximum time interval error in the first embodiment, so that the calculation operation process is shown in the first embodiment and is not repeated here.
A computer storage medium having stored thereon computer program instructions which, when executed by a processor, implement a method of analyzing a maximum time interval error as in the first embodiment.
More specific examples of a computer-readable storage medium may include, but are not limited to, an electrical connection having one or more wire segments, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present application, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless segments, radio lines, fiber optic cables, RF, etc., or any suitable combination of the foregoing.
In the several embodiments provided by the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and the division of modules, or units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units, modules, or components may be combined or integrated into another apparatus, or some features may be omitted, or not performed.
The units may or may not be physically separate, and the components shown as units may be one physical unit or a plurality of physical units, may be located in one place, or may be distributed in a plurality of different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flowcharts. In such embodiments, the computer program may be downloaded and installed from a network via a communication portion, and/or installed from a removable medium. The above-described functions defined in the method of the present application are performed when the computer program is executed by a Central Processing Unit (CPU). The computer readable medium of the present application may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The foregoing is merely illustrative of specific embodiments of the present invention, and the scope of the present invention is not limited thereto, but any changes or substitutions within the technical scope of the present invention should be covered by the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
While the invention has been described with respect to preferred embodiments thereof, it will be understood by those skilled in the art that various modifications and additions may be made without departing from the scope of the invention. Those skilled in the art will appreciate that many modifications, adaptations and variations of the present invention can be made using the techniques disclosed herein without departing from the spirit and scope of the invention, and that many modifications, adaptations and variations of the present invention are within the scope of the invention as defined by the appended claims.