Many buffering parallel processing method for MZ optical fiber perimeter intrusion detection instrument
Technical field
The invention belongs to sensory field of optic fibre, for the technical field of data processing of MZ optical fiber perimeter intrusion detection instrument, in particular a kind of
Many buffering parallel processing method for MZ optical fiber perimeter intrusion detection instrument.
Background technology
In optical fiber sensing system, MZ optical fiber perimeter intrusion detection instrument is a kind of critically important Fibre Optical Sensor, and it is applied widely, due to
It can carry out distributed vibration location, has simultaneously and has low energy dependency, high environmental resistance, electromagnetism interference, anticorrosive, waterproof, anti-
The characteristics such as moist, thermal adaptability is strong, a MZ optical fiber perimeter intrusion detection instrument can carry out unmanned to tens kilometers of long regions and enter
Invading monitoring, when there being people to swarm into region on duty, MZ optical fiber perimeter intrusion detection instrument can position by swarming into the vibration caused and report to the police.
Compared with traditional electronic monitoring equipment, MZ optical fiber perimeter intrusion detection instrument is more suitable for, environment very long in China and complexity, waste nothing
Signs of human habitation, be not easy on the boundary line of patrol defence lay on a large scale, can go on patrol as frontier guards of China, on duty strong the most supplementary, significantly change
Frontier guards of kind China is merely able to the patrol environment relying on walking, rides etc. severe, arduous;Can be used for the military base of China, core sets
Grant unmanned and the intrusion detection of the important places such as nuclear material, weapons and ammunitions storehouse, airport.
In MZ optical fiber perimeter intrusion detection instrument, for two-way M-Z fibre coherence technique, commonly used broad sense cross correlation algorithm calculates optical fiber and shakes
Dynamic positional information, positions intrusion behavior, and its positioning precision of this computational methods depends on the signal of MZ optical fiber perimeter intrusion detection instrument
Acquisition rate, signal acquisition rate is the highest, and its positioning precision is the best.But raising signal acquisition rate, the amount of calculation of cross correlation algorithm also can be significantly
Increasing, the calculating time needed for calculating invasion positional information is also significantly increased.If occurring twice at short notice or repeatedly vibrating, then owing to calculating
Time is longer, causes the situation missing vibration signal to occur, affects the invasion accuracy of judgement degree of MZ optical fiber perimeter intrusion detection instrument, also affect
The use of MZ optical fiber perimeter intrusion detection instrument.
Therefore, prior art existing defects, need to improve.
Summary of the invention
The technical problem to be solved is for the deficiencies in the prior art, it is provided that a kind of delaying for MZ optical fiber perimeter intrusion detection instrument more
Rush method for parallel processing.
Technical scheme is as follows:
A kind of many buffering parallel processing method for MZ optical fiber perimeter intrusion detection instrument, wherein, comprises the following steps:
Step 101: read the device information of optical fiber perimeter intrusion detection instrument, it is determined that Buffer Pool size M of subsequent calculations structure and Thread Count N,
Thread Count N subtracts 1 equal to processor core quantity, and Buffer Pool size M should be greater than 0.5s* sampling rate;
Step 102: according to Thread Count N and Buffer Pool size M, builds Buffer Pool 1~N, sets up computational threads 1~N;
Step 103: gather the vibration data of optical fiber perimeter intrusion detection instrument;
Step 104: the vibration data gathered is made whether the judgement being to vibrate, then terminates this time to calculate if not vibration, if vibration is then
Enter step 105;Simultaneously regardless of result of determination, continue to repeat step 103 and continue vibration data is acquired;
Step 105: the vibration data comprising this vibration information is put in interim Buffer Pool;
Step 106: whether judge in Buffer Pool 1 with the presence of data, if having data to calculate in Buffer Pool 1, then Buffer Pool 1 is in
Busy condition, enters step 109;If not having data in Buffer Pool 1, then Buffer Pool 1 is in idle condition, enters step 107;
Step 107: the vibration data in interim Buffer Pool is stored in Buffer Pool 1;
Step 108: call thread 1 and calculate the vibration data in Buffer Pool 1, uses cross correlation algorithm to be calculated vibration position information,
Enter step 118;
Step 109: whether judge in Buffer Pool 2 with the presence of data, if having data to calculate in Buffer Pool 2, then Buffer Pool 2 is in
Busy condition, enters step 112;If not having data in Buffer Pool 2, then Buffer Pool 2 is in idle condition, enters step 110;
Step 110: the vibration data in interim Buffer Pool is stored in Buffer Pool 2;
Step 111: call thread 2 and calculate the vibration data in Buffer Pool 2, uses cross correlation algorithm to be calculated vibration position information,
Enter step 118;
Step 112: whether judge in Buffer Pool X with the presence of data, described X is from 3 to N-1;If there being data to carry out in Buffer Pool X
Calculate, then Buffer Pool X is in busy condition, if X < N, then repeats step 112 after X value adds 1;If X >=N, enter step 115;If
Do not have data in Buffer Pool X, then Buffer Pool X is in idle condition, enters step 113;
Step 113: the vibration data in interim Buffer Pool is stored in Buffer Pool X;
Step 114: call thread X and calculate the vibration data in Buffer Pool X, uses cross correlation algorithm to be calculated vibration position information,
Enter step 118;
Step 115: whether judge in Buffer Pool N with the presence of data, if having data to calculate in Buffer Pool N, then Buffer Pool N is in
Busy condition, enters step 119;If not having data in Buffer Pool N, then Buffer Pool N is in idle condition, enters step 116;
Step 116: the vibration data in buffering temporarily is stored in Buffer Pool N;
Step 117: call thread N and calculate the vibration data in Buffer Pool N, uses cross correlation algorithm to be calculated vibration position information,
Enter step 118;
Step 118: calculated vibration position information exported to optical fiber perimeter intrusion detection instrument, this time vibration data calculates and terminates;
Step 119: owing to vibration is too frequent, exceeded many ways to play for time processing speed, it is impossible to complete the calculating of this vibration data, returned mistake
False information.
The described many buffering parallel processing method for MZ optical fiber perimeter intrusion detection instrument, wherein, in described step 101, described instrument is believed
Breath is processor core quantity, system signal acquisition rate.
Use such scheme, vibration signal buffered by repeatedly buffering and carries out parallel processing, giving full play to the polycaryon processor of existing maturation
Multi-core parallel processing capability, create multiple memory buffer pond and the vibration data of continuous acquisition carried out parallel cache process, and each internal memory is delayed
Rush pond and bound a computational threads for calculating, it is possible to achieve to the parallel processing repeatedly vibrated in the short time, optical fiber perimeter can be greatly improved and enter
Invade the monitoring instrument disposal ability to repeatedly vibrating in the short time, and need not increase how many costs, it is to avoid cause when repeatedly vibrating in the short time
Fail to report problem, improve the vibration positional accuracy of MZ optical fiber perimeter intrusion detection instrument.
Accompanying drawing explanation
Fig. 1 is the flow chart of the inventive method.
Detailed description of the invention
Below in conjunction with the drawings and specific embodiments, the present invention is described in detail.
Embodiment 1
As it is shown in figure 1, the present invention provides a kind of many buffering parallel processing method for MZ optical fiber perimeter intrusion detection instrument, wherein, including with
Lower step:
Step 101: read the device information of optical fiber perimeter intrusion detection instrument, it is determined that Buffer Pool size M of subsequent calculations structure and Thread Count N,
Thread Count N subtracts 1 equal to processor core quantity, and Buffer Pool size M should be greater than 0.5s* sampling rate;
Step 102: according to Thread Count N and Buffer Pool size M, builds Buffer Pool 1~N, sets up computational threads 1~N;
Step 103: gather the vibration data of optical fiber perimeter intrusion detection instrument;
Step 104: the vibration data gathered is made whether the judgement being to vibrate, then terminates this time to calculate if not vibration, if vibration is then
Enter step 105;Simultaneously regardless of result of determination, continue to repeat step 103 and continue vibration data is acquired;
Step 105: the vibration data comprising this vibration information is put in interim Buffer Pool;
Step 106: whether judge in Buffer Pool 1 with the presence of data, if having data to calculate in Buffer Pool 1, then Buffer Pool 1 is in
Busy condition, enters step 109;If not having data in Buffer Pool 1, then Buffer Pool 1 is in idle condition, enters step 107;
Step 107: the vibration data in interim Buffer Pool is stored in Buffer Pool 1;
Step 108: call thread 1 and calculate the vibration data in Buffer Pool 1, uses cross correlation algorithm to be calculated vibration position information,
Enter step 118;
Step 109: whether judge in Buffer Pool 2 with the presence of data, if having data to calculate in Buffer Pool 2, then Buffer Pool 2 is in
Busy condition, enters step 112;If not having data in Buffer Pool 2, then Buffer Pool 2 is in idle condition, enters step 110;
Step 110: the vibration data in interim Buffer Pool is stored in Buffer Pool 2;
Step 111: call thread 2 and calculate the vibration data in Buffer Pool 2, uses cross correlation algorithm to be calculated vibration position information,
Enter step 118;
Step 112: whether judge in Buffer Pool X with the presence of data, described X is from 3 to N-1;If there being data to carry out in Buffer Pool X
Calculate, then Buffer Pool X is in busy condition, if X < N, then repeats step 112 after X value adds 1;If X >=N, enter step 115;If
Do not have data in Buffer Pool X, then Buffer Pool X is in idle condition, enters step 113;
Step 113: the vibration data in interim Buffer Pool is stored in Buffer Pool X;
Step 114: call thread X and calculate the vibration data in Buffer Pool X, uses cross correlation algorithm to be calculated vibration position information,
Enter step 118;
Step 115: whether judge in Buffer Pool N with the presence of data, if having data to calculate in Buffer Pool N, then Buffer Pool N is in
Busy condition, enters step 119;If not having data in Buffer Pool N, then Buffer Pool N is in idle condition, enters step 116;
Step 116: the vibration data in buffering temporarily is stored in Buffer Pool N;
Step 117: call thread N and calculate the vibration data in Buffer Pool N, uses cross correlation algorithm to be calculated vibration position information,
Enter step 118;
Step 118: calculated vibration position information exported to optical fiber perimeter intrusion detection instrument, this time vibration data calculates and terminates;
Step 119: owing to vibration is too frequent, exceeded many ways to play for time processing speed, it is impossible to complete the calculating of this vibration data, returned mistake
False information.
In above-mentioned, in described step 101, described device information is processor core quantity, system signal acquisition rate.
Using such scheme, buffer vibration signal by repeatedly buffering and carry out parallel processing, the multinuclear giving full play to existing maturation processes
The multi-core parallel processing capability of device, creates multiple memory buffer pond and the vibration data of continuous acquisition is carried out parallel cache process, and to each internal memory
Buffer Pool has bound a computational threads for calculating, it is possible to achieve to the parallel processing repeatedly vibrated in the short time, can be greatly improved optical fiber perimeter
The intrusion detection instrument disposal ability to repeatedly vibrating in the short time, and need not increase how many costs, it is to avoid lead when repeatedly vibrating in the short time
Cause fails to report problem, improves the vibration positional accuracy of MZ optical fiber perimeter intrusion detection instrument.
It should be appreciated that for those of ordinary skills, can be improved according to the above description or be converted, and all these improvement and
Conversion all should belong to the protection domain of claims of the present invention.