{'fraction_non_alphanumeric': 0.03601411780831306, 'fraction_numerical': 0.01802419216667238, 'mean_word_length': 4.492941840767927, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Real-Time Distance Measurement for Indoor Positioning System Using Spread Spectrum Ultrasonic Waves

The fields of application for position information have been expanded along with developments in the information-driven society. Outdoor position information systems such as car navigation systems that use the global positioning system (GPS) have spread widely. On the other hand, indoor position information is also important for humans and robots for self-location and guided navigation along routes. However, as the signals from satellites seldom reach indoors, it is hard to convert a directly outdoor positioning system to an indoor one. Therefore, systems that use sensors such as pseudolites (Petrovsky et al., 2004), infrared rays (Lee et al., 2004), or ultrasonic waves (Shih et al., 2001) have been investigated for use in indoor positioning.


Introduction
The fields of application for position information have been expanded along with developments in the information-driven society. Outdoor position information systems such as car navigation systems that use the global positioning system (GPS) have spread widely. On the other hand, indoor position information is also important for humans and robots for self-location and guided navigation along routes. However, as the signals from satellites seldom reach indoors, it is hard to convert a directly outdoor positioning system to an indoor one. Therefore, systems that use sensors such as pseudolites (Petrovsky et al., 2004), infrared rays (Lee et al., 2004), or ultrasonic waves (Shih et al., 2001) have been investigated for use in indoor positioning.
Compared to other methods, systems using ultrasonic waves have the advantage that they can be built at low cost and have comparatively high accuracy, because the propagation speed of ultrasonic waves is slower than that of electromagnetic waves. However, these systems are generally said to be weak in terms of noise resistance, and to take a longer time to acquire data, because they utilize the time-division multiplexed method, which becomes more taxing as the number of objects to be measured is increased. To overcome these drawbacks, positioning systems with spread spectrum (SS) ultrasonic waves have been investigated (Hazas & Hopper, 2006), (Yamane et al., 2004), (Suzuki et al., 2009); they use code division multiple access (CDMA) methods and are more robust to noise, because they use spread spectrum ultrasonic signals. According to these studies, although the procedure of reception and positioning calculation is computed off-line, the systems are shown to be highly effective.
Correlation calculation is one of the most important procedures when measuring a position using SS ultrasonic waves. This calculation (in air) is difficult to carry out using existing methods, which were developed either for ultrasonic signals traveling through solids and liquids or for radio signals such as GPS because of differences in speed, frequency, and susceptibility to signal loss. The process of correlation calculation in the positioning systems also requires many calculations for long signal sequences if it is to maintain CDMA performance and robustness against noise. Therefore, real-time correlation calculation must be realized with efficient use of limited electronic circuits. As the positioning system is required to control moving robots, a study of real-time positioning should be carried out. In the positioning process, correlation calculation is required for detecting an SS signal. Some positioning systems (e.g., GPS) calculate correlation values using a serial search method or using a matched filter with analog elements (e.g., the SAW convolver (Misra & Enge, 2001)). In the case of indoor positioning using SS ultrasonic waves (with approximately 1/100000th of the propagation velocity and 1/38000th of the frequency of electrical waves), it is unlikely that one could directly utilize the conventional methods that are applicable to electrical waves. Although methods of correlation calculation for ultrasonic waves traveling through liquids or solids such as metals have been investigated (Teramoto & Yamasaki, 1988), they are still difficult to apply to indoor positioning systems with ultrasonic waves through the air because of the differences of velocity, wavelength, and attenuation rate of the ultrasonic signal. Therefore, we focused on a digital-matched filter to enable the system to both acquire the signal in a relatively short time and apply ultrasound easily.
The method for correlation calculation uses a digital-matched filter; because it requires product-sum operations on received data within a cycle of SS signals in a sampling period, it needs a large amount of calculation. Compared to outdoor positioning, the phase of SS signals shift more noticeably if the object is moving; thus, measured results must be more accurate. The carrier wavelength of ultrasound used was approximately 8.5 [mm]; filtering is required at a higher frequency than the carrier frequency if one is to apply a digital-matched filter in these conditions. Therefore, correlation calculations can be considered a bottleneck to the realization of real-time processing. S/N ratios and the number of channels in the PN sequence increase, as the length of PN sequences increases. In addition, the longer the PN sequences become, the more time is required for processing. Thus, the relation of noise tolerance and CDMA ability to processing time for correlation calculations is a trade-off.
It is difficult to find research on real-time correlation calculation or real-time positioning using SS ultrasonic signals. In general, methods of correlation calculation using product-sum operations (where pipelines use a number of multipliers that corresponds to the length of the PN sequence) have been considered. In addition, there is a method for sequential calculation using one multiplier. In the former case, a result can be obtained in 1 clock cycle, so that real-time calculation can be realized easily. However, it is unrealistic because of the huge number of logic elements required. In contrast, in the latter case, correlation calculations can be realized with a minimum logic size (i.e., they utilize only one multiplier); however, high-speed computation is required to realize real-time positioning. Therefore, certain innovations were required to allow real-time correlation calculation with SS ultrasonic waves for the purpose of self-positioning of humans and robots.
To achieve this, a new algorithm for real-time correlation calculation that uses external memory is suggested. In this chapter, the effectiveness of the proposed algorithm, named SPCM (Stored Partial Correlation Method), is presented in the form of experimental results of correlation calculations using original hardware. We also describe the effectiveness of real-time indoor positioning using SS ultrasonic waves and SPCM hardware based on experimental results of distance measurement. In our previous study, off-line positioning experiments were conducted that utilized transmitters installed on a positional environment and a receiver mounted on a positioning target (Suzuki et al., 2009). Fig. 1 shows the experimental environment for the indoor positioning system using SS ultrasonic waves. In Fig. 1, there are 4 transmitters Tr 1 ,T r 2 ,T r 3 , and Tr 4 including sensor nodes called SPANs (smart passive / active nodes) (Nonaka et al., 2010), and 1 receiver Rc placed on a robot. This SPAN positioning system can also utilize inverse-GPS based positioning to swap a positional relation between the transmitter and the receiver. There is also a hardware component for controlling the time of transmission and the sampling frequency of the ultrasonic waves, labeled "timing generator" in Fig. 1. We can measure the position of an object with wireless because of the radio transceiver on the timing generator and the receiver unit. In this chapter, real-time correlation calculation is realized at the reception unit in Fig. 1 for real-time positioning.

A method for position calculation
Position calculation for the indoor positioning system with SS ultrasonic waves is outlined in Fig. 2. First, spheres are drawn with radii equal to the distance between a receiver Rc and each transmitter (at the center); 2 pairs of the 2 spheres are selected. In Fig. 2, 2 pairs of spheres centered on Tr 1 and Tr 3 ,T r 2 and Tr 3 are selected. From these pairs of spheres, Plane 13 and Plane 23 in Fig. 2 can be solved as a simultaneous equation. Line of the intersection is also obtained from the 2 planes of Plane 13 and Plane 23 . Last, points at the intersection of Line with an equation of an arbitrary sphere are solved. Although the 2 intersection points are obtained, in the situation in which transmitters are installed in the four corners of a room, one solution is located outside of the room. Thus, the other solution becomes the position of the receiver Rc.  Our specific method of calculation is as follows. First, to obtain equations for Plane 13 and Plane 23 , the coordinates of points Rc 13 and Rc 23 in their respective planes are solved. Here, we focus on Rc 13 , which is between Tr 1 and Tr 3 . In the case in which (x 1 , y 1 , z 1 ) and (x 3 , y 3 , z 3 ) are defined as the coordinates of Tr 1 and Tr 3 , respectively, the distance l 13 between Tr 1 and Tr 3 is given by Equation 1.
In the case of defining l 1 as a distance from Tr 1 to the Rc 13 at the center of Plane 13 ,w e can express this as follow from equations for obtaining radii of Plane 13 using Pythagorean theorem and variables r 1 and r 2 .
Also, Equation 3 can be expressed as follow.
x 31 x − x 1 + x 31 l 1 l 13 + y 31 y − y 1 + y 31 l 1 l 13 The right-hand side of Equation 6 becomes a constant. Let us denote this number by k 31 .
x 31 x + y 31 y + z 31 z = k 31 (7) Thus, an equation for Plane 13 is obtained. In the case of the same height for all transmitters, z 31 =0; then, the equation for Plane 13 can be expressed as follow.
x 32 x + y 32 y = k 32 (9) By solving the simultaneous Equations 8 and 9, one can obtain the x-y coordinates of Rc as follows.
Rc(x, y)= x 32 k 31 − x 31 k 32 x 32 y 31 − x 31 y 32 , y 32 k 31 − y 31 k 32 x 31 y 32 − x 32 y 31 (10) The height of receiver Rc(z) can be also obtained using the coordinates of an arbitrary transmitter Tr i (x i , y i , z i ).
In the situation shown in Fig. 1, 4 results for position are obtained by 4 combinations of transmitters. The measurement position is defined as an average of these results.

Distance measurement hardware structure in the positioning system
A position is calculated from three or more TOF (time of flight, between the transmitters and the receiver) values. An architecture of measurement TOF for the positioning system is shown in Fig. 3. In a transmission unit, a D/A converter and a FPGA, which are used to generate carrier waves and M-sequences, are included. In a reception unit, an A/D converter and a FPGA, which are used to make correlation calculations, perform peak detection, and take time measurements, are included.

177
Real-Time Distance Measurement for Indoor Positioning System Using Spread Spectrum Ultrasonic Waves In this system, a SS signal is generated for the multiplication of carrier waves by M-sequences. The SS signal is dynamically generated by the transmission unit shown in Fig. 3 and is outputted by a transducer, after D/A conversion. At the same time as the transmission starts, the time counter is started so as to measure the TOF. Additionally, correlation values are calculated from the sound data by the correlation calculator and the A/D convertor, shown in Fig. 3, which constitutes the on-line, real-time hardware processing. The next peak detector shown in Fig. 3 finds a peak from among the correlation values. The time counter measures the TOF by counting the number of sampling times that elapse from the beginning of a transmission to the arrival of a peak. Thereafter, the 3D position of the receiver can be calculated from three or more distances using the TOF between the transmitters and the receiver. If the correlation calculation part is installed on the hardware, as shown in Fig. 3, real-time positioning is permissible, because other processing such as positioning calculation from distances can be calculated comparatively quickly in software using optimization expressions. Fig. 3. System architecture for TOF measurement using SS ultrasonic signals

SS signal
In our indoor positioning system, SS signals are modulated by BPSK (binary phase shift keying) using an M-sequence, a pseudorandom code sequence, as used in the DS (direct sequence) method. Although an M-sequence of '0' or '1' is generated by the shift register, we used the value of '-1' in place of '0' to facilitate signal processing. Fig. 4 shows received SS signals. In Fig. 4, the signals corresponding '1' and '-1' are plotted by solid and dashed lines, respectively. Each dot in Fig. 4

Real-time peak detection
From the peak detector in Fig. 3, peaks in the correlation values are obtained. Fig. 5 gives the example of a distribution of correlation values obtained from a distance measurement. In this figure, sample values connected by lines are plotted with height as the vertical axis and sampling number as the horizontal axis. A peak value from among the correlation values is obtained for the situation in which the replica signals match the received signals. Here, s tc is defined as the number of samples corresponding to a chip length t c .F r o ms tc before the peak, the waveform in Fig. 5 becomes am upward sloping line because of the transitional intergradation of the correlation values. The high correlation value of a reflected wave is also shown in Fig. 5, arriving from some indirect pathway, as did the multi pass. The correlation value of the reflected waves can be higher than that of the direct waves; therefore, the sampling with the highest correlation values cannot be decided simply in terms of TOF. We require the detection of measurement time to be defined as the time from the start of a transmission to the first peak, because direct ultrasonic waves have the shortest path.  First, a threshold level is selected, based on the noise level without SS signals. Next, after starting the transmission, the first correlation value that is over the threshold is detected. In this procedure, the sampling number of this correlation value is treated as a central sample s center , and a line is traced around a sample population near to s center . The slope of the line is calculated from the sample population using the least-squares method. In the group of samples, s max and s min refer to the minimum and a maximum sampling number, respectively, and are defined as having the same distance from s center . After this step, the slopes are calculated repeatedly, using the sample population shifted forward at increments of one sample. If a slope becomes negative, because we can consider s center as having reached a peak sample, the sampling number of s center is outputted as the peak position.
In the hardware component, a shift register is used for storage of the sample population. The slope a is obtained as follows. First, Let N and x i (i = 1, 2, 3...) denote the length of the shift register and the sampling distance from s center , respectively. Here, N is restricted to odd numbers. x 1 , x 2 ... are named in ascending order (of sample number) from the minimum onward; x 1 is the sampling distance between s min and s center . x i is given by Equation 12.
Next, y i is defined as the correlation value of x i . The slope a is calculated using the least-squares method as follows.
In Equation 13, a summation of x i 2 will become a constant number for a fixed bit length N.A s K is defined to be a constant and the total of x i becomes 0, Equation 13 can be given as follows.
We select N = 5 for the register length. Peak detection hardware for utilizing this method can be realized comparatively easily using Equation 14.

Hardware of real-time correlator
To obtain a correlation value, one must perform product-sum operations for all samples within an M-sequence cycle. In the proposed positioning system, 8184 product-sum operations are required within 6.25 [microseconds]. We realize a real-time correlation calculation to construct a hardware-utilizing SPCM. In the SPCM, a preliminary part, calculated from received signals, is processed as a pre-correlation value and saved first. Thereafter, the amount of parallelism for the processing of the correlation calculation is improved by repeatedly using the pre-correlation value results. To produce a large number of pre-correlation values, we utilize a general-purpose, active memory system.
Hardware for the correlation calculation (using SPCM and FPGA) is shown in Fig. 6. The hardware is operated at 50 [MHz]. It is mounted on a FPGA of FLEX10KA (1728 LEs) and has an external memory of PB-SRAM. In this hardware, the transmission of ultrasonic signals triggers the start of correlation calculations. Also, the hardware shown in Fig. 6 consists of a multiplier into which the carrier waves and received signal are inputted, accumulators for 1 chip length worth of M-sequence, a 1-chip data memory to save the result of the previous accumulated result, a pre-correlator, a 4-chip data memory, and a correlator with which a whole correlation value is calculated using the 4-chip data. Although 1-chip memory is installed on the FPGA, 4-chip data is installed on the external memory because of the large amount of pre-correlation data gathered. Block 1, 2, and 3 in Fig. 6 are defined as a part for generating 1-chip data, a part for pre-correlation calculation, and a part for correlation calculation using the obtained pre-correlation values, respectively. Processing of these blocks in parallel is conducted with SPCM.  Fig. 7 (a), and the carrier waves generated by a reception unit shown in the second row of Fig. 7 (a). The multiplied data shown in a third row of Fig. 7 Fig. 7). In block 1, segments of M-sequences cannot be detected, because the time for 16 samples is spent on 1 chip. Therefore, 16 accumulators are installed on the hardware to allow the generation of the 1-chip data.

Generation of 4-chip data with pre-correlation calculation
In block 2, the part correlation value for the n-chip time (viz. n-chip data) is generated as a pre-correlation calculation using continuous 1-chip data of n samples for each sampling clock. In this process, the more 'n' increases, the more memory required, and the less time required for calculation. In our hardware, 4-chip data is generated, as n = 4. This is chosen in consideration of the operating frequency of the FPGA and the amount of installed memory. 4-chip data are labeled 'fcd' in Fig. 7 (b). In block 2, first, the 4 generated 1-chip data are multiplied by '1' or '-1' following an M-sequence. Next, the sum of the 4 results obtained from this calculation is saved as 'fcd'. In block 2, 2 4 = 16 patterns of 4-chip data (viz.
In equation 15, s M is to be the sampling number in the cycle of the M-sequence, 2 n is the number of patterns in the n-chip data generated by pre-correlation calculation, and l pc is the data width of the part correlation value. The amount of memory then becomes 261888 words, because of the 32-bit data width of our hardware.
In block 3, the correlation calculation is conducted using the part correlation values. For example, Fig. 8 and Fig. 9 describe calculation processes in block 2 and block 3, respectively, in the case in which we use a SS signal consisting of 12 chips as 1 cycle of the M-sequence. Fig. 8 explains the procedure inside the 4-chip data memory. 16 data entries regarding fcd, generated in 1 sampling time, are shown in Fig. 8 as a group of 4-chip data (viz. 'fcdg'). A part of the product-sum operation in Fig. 8 is also shown as a pre-correlation calculation in Fig. 8 (b).

Fig. 8. Production of 4-chip data from 1-chip data
In Fig. 8, 1-chip data is generated in order from right to left, i.e., fcd 1 , fcd 2 ,... When 1-chip data is obtained, a group of 4-chip data is also generated using the newest 4-data of ocd in the following order: fcdg 1 , fcdg 2 ,... In Fig. 8, fcdg 5 (i.e., a group of 4-chip data) is generated after a time corresponding to 4 chips from ocd 4 . A part correlation value corresponding to 8 chips can be generated if we lay out each fcdg 1 and fcdg 5 using different ocd values, as shown in Fig. 8. Also, fcdg 2 and fcdg 6 , fcdg 3 and fcdg 7 , and fcdg 4 and fcdg 8 can be created from other part correlation values at each 1-chip time. Therefore, Fig. 8 describes 4 groups of (1) fcdg 1 , fcdg 5 ,... to (4) fcdg 4 , fcdg 8 ,... Finally, a correlation value for all chips can be calculated using the obtained fcdg in the combination shown in Fig. 8 (1) to (4).

Correlation calculation using 4-chip data
In block 3, a correlation value is obtained by accumulating 128 continuous, memorized chips of 4-chip data corresponding to replica signals. Fig. 9 depicts the process of correlation calculation on block 3 using 4-chip data. Replica signals of the M-sequence are shown in Fig. 9 (a). The replica signals are divided into 4 sequences from the upper right-most signal in Fig. 9 (a); combinations of 4-sequences {-1,-1,-1,-1} to {1, 1, 1, 1} are named RP 0 to RP 15 . For example, '1, 1, 1, 1', shown in the top group of replica signals, is called RP 15 . Fig. 9 (b) describes the arriving scenes of pre-correlation values in chronological order. Here, although pre-correlated signals are generated as fcdg 1 , fcdg 2 in order, Fig. 9 (b) only describes a certain group (1) fcdg 1 , fcdg 5 ,... in Fig. 8. In Fig. 9, first, because of the correlation calculation with RP 15 from a replica signal, fcd 1 {1,1,1,1} in fcdg 1 generated by block 2 is loaded. After 16 sampling times have elapsed, fcdg 5 is generated. At this time, fcdg 1 must deal with a part correlation value 183 Real-Time Distance Measurement for Indoor Positioning System Using Spread Spectrum Ultrasonic Waves www.intechopen.com corresponding to RP 3 . Therefore, fcd 1 {-1,-1,1,1} in fcdg 1 is loaded. In this case, fcd 5 {1,1,1,1} is loaded from fcdg 5 from within the latest 4-chip data. Part correlation values for 8 chips are obtained by accumulating fcd 1 {-1,-1,1,1} and fcd 5 {1,1,1,1}. Similar processes to those described above occurred for every generation of a 4-chip data group. Finally, the complete correlation values are obtained by accumulating 4 fcds corresponding to RP 15 ,RP 8 ,RP 3 , and RP 15 from 4-chip data groups of fcdg 1 to fcdg 13 , as shown at the bottom of Fig. 9 (b). Fig. 9. Selection of 4-chip data using replica signals in block 3 In this method, a part correlation value generated once and saved previously can be reused in the calculation of the total correlation value. The SPCM is only required to calculate the latest 4-chip data as a part correlation value, represented by the gray block in Fig. 9 (b), for obtaining the whole correlation value of the SS signal. SPCM reduces the calculation to 1/16 of its previous value; however, the amount of saved data increases because of the pre-correlation calculation in block 2. Therefore, a real-time correlation calculation can be conducted comparatively easily using SPCM.
In this algorithm, two kinds of carrier waves (sine and cosine) are utilized for the detection of orthogonal components. The whole correlation values are obtained using a root-mean-square value of both correlation values using sine and cosine waves in block 3.

Experiments of correlation calculation using actual received signals
The accuracies and real-time performance of correlation values with SPCM must be verified to allow a discussion of the effectiveness of this method in indoor positioning applications. The proposed real-time correlation mechanism will be mounted on conventional signal reception hardware. Thus, measuring experiments were conducted using the hardware shown in Fig.  3; the received sound data was inputted into the real-time correlation hardware. Additionally, to compare the resultant correlation values gathered by the real-time processing method to those of the conventional off-line correlation calculation that uses a sequential computation, experiments were conducted using the received sound data.
In these experiments, the ultrasonic signals were transmitted by a super tweeter to a condenser microphone to measure with the distance d between the receiver and the transmitter installed at 1.  Fig. 10(a) and Fig.  10(b), respectively. Each figure represents the differences between (1) off-line sequential computation using software, and (2) the real-time method using hardware. In addition, each figure is arranged on the x-axis from low to high sampling time, and on the y-axis from low to high correlation values.
(a) Setting distance d =1.2m (b) Setting distance d =12.0m Fig. 10. Difference between off-line sequential computation using software and the real-time method using the SPCM hardware Comparing (1) to (2), the experimental results in Fig. 10(a) and Fig. 10( Fig. 11 shows that the errors in distance are within ±1.5 [cm] for all distances measured. We require a 10 [cm] or smaller positioning error for accurate self-location recognition for robots and humans; the obtained experimental measurement error in distance is within this range.

Conclusion
This chapter discussed the real-time correlation calculation for SS ultrasonic signals for use in an indoor positioning system. The experimental results were gathered using an original SPCM hardware system with external memory. In our method, positioning processing, signal receiving, correlation calculation, peak detection, and distance measurement are realized by hardware processing on a FPGA mounted on a PCI board.
Because of the real-time correlation calculation, which requires the most time during hardware processing, we proposed and installed a SPCM system with external memory and comparatively small logic elements. SPCM can be divided into 3 blocks: extraction of M-sequence signal by multiplying a received signal by carrier waves and accumulation of the signal in block 1, pre-correlation calculation with 4 chips in block 2, and calculation for whole correlation values in block 3 using pre-correlation values. The amount of correlation calculation can be reduced by 1/64 by the pre-correlation calculation.
A distance measurement experiment was conducted to evaluate both the correlation values and the real-time performances. Experimental results using the original hardware with SPCM are compared to the results of off-line sequential computation using software. Hardware processing time was measured using a counter based on the hardware clock. Additionally, the measurement distance was calculated from TOF data utilizing the SPCM hardware in real-time.
From the experiments, we found that the real-time hardware computed correctly within 5.76 [microseconds], which was less than the sampling time; the distance errors obtained were within ±1.5 [cm]. Thus, the effectiveness of this hardware has been shown. In the case of 3D indoor positioning with SS ultrasonic signals, more than 3 signals (made by different channels from transmitters using CDMA) must be used. As a correlator is required when calculating signals on 1 channel, downsizing of the logic elements is important for creating useful receivers. At this time, indoor positioning using SPCM is suggested for use in real-time positioning using comparatively small logic elements. This chapter also shows the possibility of real-time position sensing for mobile robots and humans using SS ultrasonic waves.

Ultrasonic Waves
Edited Ultrasonic waves are well-known for their broad range of applications. They can be employed in various fields of knowledge such as medicine, engineering, physics, biology, materials etc. A characteristic presented in all applications is the simplicity of the instrumentation involved, even knowing that the methods are mostly very complex, sometimes requiring analytical and numerical developments. This book presents a number of stateof-the-art applications of ultrasonic waves, developed by the main researchers in their scientific fields from all around the world. Phased array modelling, ultrasonic thrusters, positioning systems, tomography, projection, gas hydrate bearing sediments and Doppler Velocimetry are some of the topics discussed, which, together with materials characterization, mining, corrosion, and gas removal by ultrasonic techniques, form an exciting set of updated knowledge. Theoretical advances on ultrasonic waves analysis are presented in every chapter, especially in those about modelling the generation and propagation of waves, and the influence of Goldberg's number on approximation for finite amplitude acoustic waves. Readers will find this book ta valuable source of information where authors describe their works in a clear way, basing them on relevant bibliographic references and actual challenges of their field of study.