Summary of the invention
Technical problem to be solved by this invention is to be to provide a kind of pulse matching process, being applied to the demodulation of the baseband signal in the communication system, is in order to solve that baseband signal separates that timing obtains unknown rate pulse signal or given rate but the problem of the bigger signal rate of fluctuation.
In order to solve the problems of the technologies described above, the invention provides a kind of pulse matching process that is applied to the baseband signal demodulation, comprise the steps:
(1) determines the number of pulses m of each coupling needs, so type of each pulse, the data bits that each pulse occupies according to communication protocol;
(2) pulse train that arrives at actual reception, the number of pulses m that mates with needs is the unit, measures the actual measurement width value that obtains each pulse in this unit, and the actual measurement type of each pulse;
(3) with the actual measurement width summation of described each pulse, obtain A as a result; Determine the number of pulses m of each coupling needs and the data bits that each pulse occupies according to communication protocol, obtain the data bits summation N of m pulse, obtain the pulse duration B of forms data position correspondence according to A/N, perhaps for B sets the pulse width range that certain surplus obtains forms data position correspondence, the data bits that occupies according to pulse width range and each pulse of B or forms data position correspondence comes so width value of each pulse in the determining unit;
(4) actual measurement width value, the actual measurement type of so width value of described each pulse in this unit, so each pulse of obtaining of pulse pattern and actual measurement are mated in regular turn, according to matching result determine in this unit that actual measurement arrives pulse on the whole whether with the pulse coupling of needs.
According to above-mentioned pulse matching process, wherein, the described number of pulses m according to the definite each coupling needs of communication protocol of step (1) is all or part of pulse number of lead code correspondence.Based on this, if whole matching success then can be exported lead code the match is successful indication.In addition, further, described partial pulse can comprise lead code and finish pulse.
(21) the number of pulses m with the needs coupling is the unit, and setting up a width is the sliding window that is used to store m actual measurement pulse width values of m, and sets up the sliding window that is used to store the actual measurement pulse pattern that a width is m;
(22) measure the pulse train that actual reception arrives, obtain the actual measurement width value of each pulse this unit in, and the actual measurement type of each pulse, and measurement result is slipped in the described sliding window of correspondence and store.
According to above-mentioned pulse matching process, wherein, the coupling of the described so pulse pattern of step (4) and actual measurement pulse pattern if all conform to or whole when anti-phase, just can be defined as the pulse pattern whole matching.
According to above-mentioned pulse matching process, wherein, described step (4) can comprise:
A counter is set, and initial value is 0;
One by one the width and the type of each pulse in the unit are mated, if the width of a pulse and type are all mated, then Counter Value increases progressively;
After last pulse coupling is finished in the unit, write down this Counter Value C, wherein, C is between 0~m;
If the value of C/m, thinks then that whole matching is successful more than or equal to e, wherein, e is the preset matching coefficient, and this coefficient is smaller or equal to 1.
Adopt the inventive method, can realize the pulse coupling by pulse duration in the pulse sequence and type.Can obtain the speed of baseband signal on this basis, and the data of unknown rate signal are recovered.The inventive method is simple and practical, and is easy to realize.
Embodiment
The present invention is described in further detail below in conjunction with the drawings and specific embodiments.
Thinking of the present invention is, at first determines the number of pulses of each needs coupling according to communication protocol, supposes that this quantity is m, and so type of this m pulse and the occupied data bits of this m pulse; Be the pulse train that the matching unit measurement receives with m number of pulses then, obtain the actual measurement width value and the type of each pulse in the matching unit; Secondly according to the width value of each pulse in the matching unit that obtains and occupied figure place, calculate so width value of each pulse in this matching unit; According to the so width value and the type of each pulse in the matching unit, mate again, whenever finish once coupling, just slide backward a pulse, mate next time with actual measurement width value and type; Whether the match is successful with needed pulse at last can to determine the pulse that measures according to matching result.
Fig. 1 shows a matching unit embodiment schematic diagram, and the matching unit among the figure is an example with 8 pulses; In pulse pattern, with 1 expression high impulse, with the low pulse of 0 expression, pulse pattern is all followed this agreement in other accompanying drawings; In the data bit number, data bit bit of expression between two short dash lines; Glide direction is represented is matching unit after it fails to match at every turn, the glide direction of pulse sequence when proceeding next time to mate, and it is constant to be equivalent to matching unit, and pulse train is slided from right to left.
Fig. 2 shows the inventive method embodiment schematic flow sheet, comprises the steps:
Step 21:, determine the needed number of pulses m of each coupling, so type of each pulse and the occupied data bits of each pulse at first according to communication protocol.
Step 22: at the pulse train that actual reception arrives, the number of pulses m that mates with needs is a matching unit, measures the actual measurement width value that obtains each pulse in this matching unit, and the actual measurement type of each pulse.
Among this, the number of pulses m that can at first mate with needs is a matching unit, and setting up a width is the sliding window that is used to store m actual measurement pulse width values of m, and sets up the sliding window that is used to store the actual measurement pulse pattern that a width is m; And then measure the pulse train that actual reception arrives, obtain the actual measurement width value of each pulse in this matching unit, and the actual measurement type of each pulse, and measurement result slipped in the corresponding sliding window store.
Step 23:, calculate so width value of each pulse in this matching unit according to the actual measurement width value sum of each pulse, the data bits that each pulse occupies.
The specific implementation of this step is earlier the occupied data bits of a determined m pulse in the step 21 to be carried out summation operation, obtains total data bits N; Actual measurement width value to each pulse in the matching unit that is obtained in the step 22 carries out summation operation then, obtains total actual measurement width value A; According to the ratio A/N of total actual measurement width value A and total data bits N, obtain the forms data pairing pulse duration B in position again; At last, determine so width value of each pulse in this matching unit according to the occupied data bits of determined each pulse in the step 21 and the pairing pulse duration B in forms data position of acquisition.So width value of first pulse correspondence is designated as M1, and so width value of second pulse correspondence is designated as M2 ..., so width value of m pulse correspondence is designated as Mm.
In actual applications, all pulses that also can not adopt matching unit and comprised are carried out the pairing pulse duration in forms data position and are calculated, but select a part wherein for use.Suppose to comprise m pulse in the matching unit altogether, adopt L the pulse in back to carry out the single-bit pulse duration and calculate.The data bits that comprise divided by this L pulse with this L pulse width values sum this moment can obtain the pairing pulse duration B in forms data position.
In addition, when the specific implementation of this step, after obtaining the forms data pairing pulse duration B in position according to ratio A/N, also can certain surplus be set for the pairing pulse duration B in forms data position, determine the pairing pulse width range in forms data position, last again according to the occupied data bits of determined each pulse in the step 21 and the pairing pulse width range in forms data position of acquisition, determine so width value of each pulse in this matching unit.This mainly is because general baseband signal speed all can have shake, can strictly not remain a fixed value.The pulse duration that adopts the impulse waveform recognition methods to obtain is unfixing, is a undulating value yet.When carrying out the individual pulse coupling, so width value that can adopt aforementioned calculation to go out carries out the strictness coupling, also is strictly to equate just to think this pulse coupling, and this is mainly used in the highly stable communication of signal rate.Generally speaking, all need the paired pulses matching value to adjust, set a scope.The pulse duration of corresponding single-bit, according to the pulse duration B that calculates, the pulse width range that a single-bit pulse can be mated is set, suppose and be made as 0.5B~1.5B (pulse width values that promptly records is between 0.5B and 1.5B the time, all think correct coupling), the pulse duration that the two bits of data correspondence is set can be 1.8B~2.5B.The rest may be inferred, carries out the pulse coupling.The adjustment coefficient of pulse duration B can determine that it is fixed also can to come according to actual measurement according to the jitter range of communications protocol regulation.
Step 24: with the actual measurement width value of so width value of each pulse in this matching unit, so pulse pattern and each pulse of actual measurement acquisition, survey type and mate in regular turn, determine according to matching result whether the pulse in this matching unit that actual measurement arrives mates with the pulse of needs on the whole.If all conform in the matching result or whole when anti-phase, can be defined as the success of pulse pattern whole matching.All anti-phase mainly is in the part communication system, the baseband signal that demodulation obtains may with the signal inversion of reality regulation.At this situation, pulse pattern can be provided with two templates, promptly anti-phase matching template and homophase matching template.Pulse duration in these two templates is identical, but pulse pattern is anti-phase each other.
The specific implementation of this step is to adopt a counter to carry out pulse coupling counting.An initial value at first is set is 0 counter, one by one the width and the type of each pulse in the matching unit are carried out matching operation then, if the width of a pulse and type are all mated, then this Counter Value increases progressively, also i.e. execution adds 1 operation, otherwise Counter Value is constant.After each pulse of whole matching unit is all finished matching operation, write down the value C of this counter, C is between 0~m for this value.According to different protocol requirements suitable matching factor e can be set, if the value of C/m, thinks then that whole matching is successful more than or equal to this default matching factor e, this matching factor is smaller or equal to 1.
Below in conjunction with accompanying drawing, with lead code pulse coupling is Application Example of the present invention, further elaborate the present invention, lead code wherein is an example with the lead code of FM0 coding in the ISO18000-6C standard of ISO (International Organization forStandardization) organization prescribed.
Lead code pulse number (sliding window window width value) and data bits when the lead code that Fig. 3 shows the FM0 coding of ISO18000-6C standard code adopts complete coupling.When mating fully, comprise 7 pulses in the lead code altogether, i.e. m=7 then should be provided with width and be 7 sliding window window.Simultaneously can obtain the data bits that 7 pulses comprise according to the agreement regulation is 12, i.e. N=12.
Fig. 4 shows corresponding complete lead code matching process, when wherein calculating the pulse duration of each type pulse correspondence, elder generation surveys each pulse duration in the sliding window window and sues for peace, also being about to sequence number is that each pulse duration of N+7 is carried out actual measurement since N+1 up to sequence number, obtain the measured value of these 7 pulse durations, be respectively: 195,330,163,162,324,162 and 490, again these actual measurement pulse width values are carried out summation operation afterwards, obtain total actual measurement width value A=1826.Total actual measurement width value A divided by total data bits N, is obtained the pairing pulse duration B=152 in forms data position (for convenience, all data all round up) after rounding up.Thus, then the pulse width values of the two bits pulse width values that corresponds to 304, three bit data corresponds to 456.From accompanying drawing 3 as can be seen, broad pulse comprises 3 bit data, so as long as calculate the pulse duration of 2 and 3 bit data correspondences according to single bit data.
For certain judgement surplus is provided, 1,2 and the pairing pulse duration calculated value of 3 bit data are suitably adjusted.1,2 and 3 bit data respective pulses width ranges are set to B/2~1.25B, 1.4B~2.3B, 2.6B~3.5B respectively.According to B=152 calculate and round up after obtain 1,2 and 3 bit data correspondences pulse width range be: 76~190,213~350,395~532.The pulse width values scope below of calculating among Fig. 4 is the pulse pattern that obtains according to actual measurement.
According to so width value of each pulse, so pulse pattern can obtain the lead code matching template, with this template successively with sliding window window in corresponding actual measurement width value, actual measurement type mate in regular turn.If the match is successful, then lead code search is finished, output lead code the match is successful indication information and single-bit pulse duration B.B is the corresponding value of baseband signal speed LF (Link Frequency, link rate) that measures, and can calculate actual baseband signal speed according to sample frequency and concrete coding rule.
From Fig. 4, can find, in the present embodiment only the width of N+3 pulse can mate mutually, but type can not be mated.Because this example adopts coupling fully, also is that matching factor is made as 1, each pulse does not all match in the yet promptly sliding window of matching unit so can draw, and it fails to match.
Fig. 5 shows the process that pulse train shown in Figure 3 is slided to the left and mated once more after the pulse.Each pulse width measuring value is respectively in the also promptly sliding window of matching unit: 330,163,162,324,162,490 and 329, obtain total actual measurement width value A=1960 after the summation, divided by total figure place 12 back and round up, obtain the pairing pulse duration B=163 in forms data position, correspondingly the pulse duration respective value of two bits is that the pulse duration respective value of 326, three bit data is 489.As can be seen from Figure 3, broad pulse comprises 3 bit data, so as long as calculate the pulse duration of 2 and 3 bit data correspondences according to single bit data.
For certain judgement surplus is provided, 1,2 and the pairing pulse duration calculated value of 3 bit data are suitably adjusted.1,2 and 3 bit data respective pulses width ranges are set to B/2~1.25B, 1.4B~2.3B, 2.6B~3.5B respectively.According to B=163 calculate and round up after obtain 1,2 and 3 bit data correspondences pulse width range be: 82~204,228~375,424~571.
This example adopts coupling fully, and promptly matching factor is made as 1.If actual measurement pulse duration and pulse pattern all are complementary with so width and type, then the match is successful.The pulse duration that can provide 1 bit data correspondence simultaneously is 163, can draw signal rate according to coding rule and sampling clock.In addition, as shown in Figure 6, if the whole anti-phase couplings of pulse pattern, pulse duration is mated fully, then also is to mate fully.Pulse pattern is all anti-phase to be caused owing to whole burst is anti-phase.
In actual applications, the whole pulses that can adopt lead code to comprise are mated, and also can adopt to guarantee in the lead code that effectively the partial pulse of coupling mates.When adopting partial pulse to mate, this part preferably comprises the end pulse of lead code, the boundary of lead code for confirmation and normal data.Certainly under special circumstances, can not comprise that also lead code finishes pulse, at this moment needs to adopt other means to determine the boundary of lead code and data, so that normally recover valid data.Mate or when adopting the pulse of part lead code to mate just can to confirm that it is lead code, just can adopt this method to finish lead code coupling and baseband signal rate calculations with whole pulses can't realizing.For example: lead code comprises m pulse altogether, characteristics according to lead code, can realize lead code coupling (K<m as long as adopt K the pulse in back to mate, promptly adopt in the lead code and mate to m pulse from m-K+1 pulse) time, then adopt the matching process of this adjustment to mate, the sliding window that only need set up a length this moment and be K gets final product.
Fig. 7 shows the partial pulse matching process based on pulse train shown in Figure 3.Adopt 6 pulses in back to carry out the coupling of lead code in the present embodiment.At first each pulse duration in the sliding window window is sued for peace, obtain A=1630, obtain B=163 behind the data bits 10 divided by correspondence.Then the pulse duration respective value of two bits is that the pulse duration respective value of 326, three bit data is 489.From accompanying drawing 3 as can be seen, broad pulse comprises 3 bit data, so as long as calculate the pulse duration of 2 and 3 bit data correspondences according to single bit data.
For certain judgement surplus is provided, the pulse duration calculated value of 1,2 and 3 bit data correspondences is suitably adjusted.1,2 and 3 bit data respective pulses width ranges are set to B/2~1.25B, 1.4B~2.3B, 2.6B~3.5B respectively.The pulse width range that calculates 1,2 and 3 bit data correspondences according to B=163 is: 82~204,228~375,424~571.
This example also adopts matching factor to be made as 1 coupling fully.Among Fig. 7, pulse duration and pulse pattern mate mutually, and then the match is successful, and the pulse duration that can provide 1 bit data correspondence simultaneously is 163, can draw signal rate according to coding rule and sampling clock.In addition, as shown in Figure 8, if the whole anti-phase couplings of pulse pattern, pulse duration is mated fully, then also is to mate fully.Pulse pattern is all anti-phase also to be caused owing to whole burst is anti-phase.
Fig. 9 shows the partial pulse matching process based on pulse train shown in Figure 3.Adopt the coupling of carrying out lead code from N+2 pulse to the sequence of N+7 pulse in the present embodiment.At first also be that each pulse duration in the sliding window is sued for peace, obtain A=1631, divided by 10 and round up after obtain B=163.Then the pulse duration respective value of two bits is that the pulse duration respective value of 326, three bit data is 489.Also for certain judgement surplus is provided, 1,2 and 3 bit data respective pulses width ranges are set to B/2~1.25B, 1.4B~2.3B, 2.6B~3.5B respectively.The pulse width range that calculates 1,2 and 3 bit data correspondences according to B=163 is: 82~204,228~375,424~571.This example also adopts matching factor to be made as 1 coupling fully.According to shown in Figure 9, pulse duration and pulse pattern mate mutually, and then the match is successful.The pulse duration that can provide 1 bit data correspondence simultaneously is 163, can draw signal rate according to coding rule and sampling clock.
The pulse matching process that the present invention proposes mainly is at first according to the pulse number in the pulse train matching unit to be set, with each pulse that is comprised in the unit wide measured value and pulse number, calculate the pairing so pulse width values of single bit data, and then obtain multi-bit, and their so type separately according to pairing so width value; Afterwards with so width value of calculating and so the actual measurement width value that obtains of type and actual measurement with survey type and mate in regular turn.If type matching, and the actual measurement width value equates with the strictness of right width value or right width value give in the scope, the match is successful then to think pulse train, and this moment, the pulse duration according to signal sampling frequency and single bit data correspondence promptly can obtain signal rate.If the match is successful and the just complete anti-phase coupling of type for pulse width values, assert also that then the match is successful in the position.This situation mainly is because the part system may be with due to the signal inversion of reality regulation when demodulated base band signal.If it fails to match, then matching unit is moved to next position and carry out new matching process.
It is the baseband signal speed measurement that typical case of the present invention uses, and the data of unknown rate signal are recovered, and the search of lead code and coupling.