To simulate a digital walkie-talkie signal generator and demodulator based on the dPMR standard in Matlab environment, the following conditions must be met:
(Attach the source code link source code here ) If you don’t know, you can send me a private message
1. Designing a signal generator requires the ability to generate the digital IQ signal and digital IF signal of the Start Header of the Traffic channel of dPMR.
2. Designing a demodulator requires the ability to demodulate the messageframe signal from the IF sampled data.
3. Simulate the bit error rate performance of the algorithm under different noise and multipath fading conditions.
4. Correctly analyze the frequency domain characteristics of the signal.
The experiment flow chart is as follows:
(I’m too lazy to do the catalog, please understand. The article is relatively long, there are many pictures, take your time)
Part Ⅰ Building dPMR frame
1.1 Construction sequence
There are mainly 4 basic frame structures in the dPMR protocol, which are payload frame, super frame, header frame and tail frame. This experiment is to construct a header frame signal as the input signal. The structure of the header frame is shown in the figure. It mainly includes four parts: preamble (P) 72bit, frame synchronization code 4 (FS4) 48bit, header frame information (HI0, HI1) 120bit×2, and color code (CC) 24bit. 384 bits.
The preamble (P, Preamble) is mainly used at the receiving end to extract bit synchronization information and keep repeating with 0x5F.
Frame synchronization code 4 (FS4, FrameSync4) is used to obtain timing information consistent with the start and end time of the frame.
Color code (CC, Colour Code), which occupies 24 bits, is used to directly identify radio frequency channel information and distinguish adjacent channel interference.
The header frame information (HI0, HI1, Header Information 0/1) contains the main service signaling information, 4-bit Vung Tau type (HT), 24-bit calling site ID, 24-bit called site ID, 3 1-bit communication mode (M), 2-bit version information (V), 2-bit communication format (F), 1-bit emergency priority (EP), 11-bit message information (MI), 40-bit FEC Forward error correction code W and 8-bit CRC check code. Among them, the MI field contains two values, pdS and pdM.
In fact, the first frame construction is not a big problem. It is just an input signal. If you find it troublesome, you can also construct a random sequence. For
example, here I am building an input signal signal_ini which should be 384bit, but because the subsequent filter will cause delay, So I added 80bit redundancy to adjust the impact of the filter.
Part Ⅱ 4FSK modulation
2.1 Construction of baseband signal
Before modulating the input signal, it needs to be constructed as a baseband signal
2.1.1 Serial to parallel conversion
The known dPMR standard is: the symbol rate is 2.4 kbit/s, and the information rate is 4.8 kbit/s. It can be seen that 1 symbol is 2 bits, so the 384-bit initial signal is converted into a 192-symbol-length sequence through serial-to-parallel conversion. Then map the sequence to quaternary to facilitate the next 4FSK modulation. The maximum frequency deviation of 4FSK is D=3h/2T, where the frequency deviation coefficient is h=0.29, and the symbol period T=1/2400s. The calculation can be D=1.044KHz, taking 1.050KHZ. The mapping relationship is as follows:
01 ↔ +3 4FSK frequency deviation: +1050Hz
00 ↔ +1 4FSK frequency deviation: +
350Hz 10 ↔ -1 4FSK frequency
deviation: -350Hz 11 ↔ -3 4FSK frequency deviation: -1050Hz
modulated The quaternary signal signal_symbol is shown in the figure
2.1.2 Eightfold interpolation
In order to reduce symbol interference and reduce the sampling frequency of the subsequent receiving section, the 8-fold interpolation method can be used to broaden the symbol width. That is, 7 consecutive zero values are inserted between adjacent symbols. As shown in the figure after interpolation: the
eight-fold interpolation appears as an increase in zero value in the time domain, and as a spectrum period extension in the frequency domain.
2.1.3 Shaping filter
In digital communication, the unmodulated digital baseband signal has a wide spectrum range and occupies a large amount of channel bandwidth during transmission. In order to ensure efficient use of channel resources, the original signal must be spectrum compressed to achieve the best detection performance. Above, it can better improve the frequency band utilization on the basis of eliminating inter-symbol interference. Using a pulse shaping filter to filter the original signal ingeniously can achieve this goal well.
For the selection of the shaping filter at the modulation end, the DPM standard stipulates that a raised cosine FIR filter is used to add a sync filter. The purpose of this is to improve the receiver sensitivity. The frequency response of the filter is shown in the figure:
where T is the period of the input pulse signal, α represents the roll-off coefficient, and 0<α<1, and different α values correspond to different roll-off characteristics.
Before matlab simulation design, we must clarify the significance of several key parameters. Such as roll-off coefficient α, sampling frequency Fs, cutoff frequency Fc, filter order N and so on. These parameters have a direct impact on the complexity of the system, the amount of calculation, the quality of the filtered signal, and the bit error rate of the system. As shown in Table 3.2:
the amplitude-frequency characteristics of the above table and the resulting filter design phase frequency characteristics as shown below:
a signal after the interpolation quaternary eight times through the filter, the signal obtained as shown below:
After After the matched filter, through the autocorrelation function convolution judgment method, it can be known that the symbol delay is about 25bit. (Observe the first 140 symbols to see the situation)
2.1.4 CIC interpolation
Since the sampling rate of the intermediate frequency signal is very high, up to tens of megahertz, the signal to be demodulated is very small. At this time, it must be filtered to obtain the signal we need. If the filter is directly designed, the order will be very large, software and hardware The equipment can't stand it. Therefore, the commonly used technique is to perform down-conversion processing, and its main technique is to perform down-conversion through decimation and filtering.
The commonly used filter is CIC decimation, and the modulation end uses a 3-level cascaded CIC interpolation filter. Its structure diagram is shown in the figure. It can be seen from the figure that it is composed of a 3-stage comb filter, a 1-stage interpolator and a 3-stage integrator.
However, I didn’t write the CIC interpolation code myself. I used other people’s code. The effect was not obvious. On the contrary, it was a bit time-consuming to run, so I gave it up in the end, but in theory this step is needed. It may be my simulation system. The noise is not prominent enough to show his effect.
2.2 Modulation
The modulation process is shown in the figure: The
4FSK signal is essentially a frequency modulation signal, which is a kind of angle modulation. It is obtained by modulating the frequency of the carrier through the baseband signal, that is, the instantaneous frequency deviation φ(t) and the modulation signal m( t) satisfies the linear relationship: (dφ(t))/dt=K_f* m(t), where φ(t) is the frequency deviation and K_f is the frequency modulation index. The expression of the frequency modulation signal can be written as shown in the following formula:
Expand and simplify the formula to get the IQ modulation process:
So the phase integration of the baseband signal after CIC interpolation is performed to obtain the I signal and the Q signal. Then generate the carrier cos2πfct and sin2πfct. To ensure compliance with the Nyquist sampling law, the carrier frequency f_c=7000Hz is selected. Finally, multiply to get the signal after quadrature IQ modulation. The specific process is shown in Figure 3-3-2: It
can be seen that the carrier moves the low-frequency IQ signal to near the intermediate frequency, which is consistent with the theory.
Part Ⅲ channel transmission
The channel transmission process is to simulate the situation of noise and interference. First add Guass white noise
and then use the pathfading_loss function to simulate the fading channel. This is more troublesome, and I don't know how to use this function, so I simulated a white noise.
Part Ⅳ 4FSK demodulation
After receiving the 4FSK signal at the receiving end, demodulate the demodulation block diagram as shown in the figure: The
principle of demodulation is a very simple trigonometric function operation. Using coherent demodulation, first frequency domain convolution, and then LPF can get the previous signal.
Set the low-pass filter (use the fdatool tool to set the pass-band cut-off frequency of the low-pass filter 2500Hz; the stop-band cut-off frequency is 400Hz; the maximum attenuation of the passband is 0dB, and the maximum attenuation of the stopband is 30dB, and the amplitude-frequency response of the filter can be obtained as shown in the figure:
Pass the I and Q signals through the low-pass filter to get the orthogonal signal before modulation.
From the figure above, it can be seen that the signal after the carrier has two intermediate frequency components. After the filter, the intermediate frequency component is very good Elimination. At this time, the signal also has a time delay, we leave it to one piece of processing after matched filtering.
Then we need to perform CIC extraction on the signal to eliminate the influence of CIC interpolation. The CIC filter at the demodulation end and the CIC filter at the modulation end are just right On the contrary, it is composed of a 3-stage cascaded integrator, a 1-stage decimator and a 3-stage comb filter. It was
also discarded by me. The arctangent operation of the decimated quadrature component and the in-phase component can be obtained Phase out:
Differentiate the phase information in the above formula, divide it by the coefficient 2πK_f and then discretize it to get the modulation information m(n). However, in the specific implementation, m(n) will have a phase jump. It must be corrected. Since the result of the phase
can be obtained by the arctangent operation, we know that the period of the tangent function is π, so we can get the method of correcting the phase:
The signal after phase correction is shown in the figure:
Part Ⅴ Baseband signal restoration
After the quadrature differential demodulation is completed, the original binary symbol information needs to be recovered. The specific process is as follows:
5.1 matched filtering
The matched filter adopts the same FIR filter as in the modulation process.
5.2 Sampling decision
The performance of sampling decision directly affects the demodulation effect. The sampling decision consists of two parts, one is to determine the location of the sampling decision, and the other is to determine the appropriate threshold. The specific process is as follows:
① After matched filtering, another time delay will occur. We deal with the delay caused by the previous low-pass filtering together. Analysis and comparison of three symbol synchronization methods of sliding window summation, convolution and autocorrelation function. Finally, it is determined as a sliding window summation method to eliminate the influence of time delay and realize symbol synchronization. The specific method is:
save a synchronization code waveform corresponding to a frame of synchronization code in the local storage, and then perform related operations on the local storage waveform and the received waveform, that is, multiply and accumulate the corresponding points (convolution). When the received waveform corresponds to the waveform stored locally, the maximum value of the correlation operation can be obtained, that is, the position of the correlation peak can be found.
After many random sequence tests, there is generally a delay of 35bit (of course, the delay cannot be directly selected as 35bit). The specific effect is shown in the figure:
②After obtaining the synchronized symbols, it is necessary to make a sampling decision. Observe the above picture carefully, and select the judgment points as 1.8 and -1.86. That is, the signal amplitude is greater than 1.8 as 3, and greater than 0 and less than 1.8 is judged as 1. Less than 0 is greater than -1.86, the judgment is -1, and less than -1.86 is judged as -3. The comparison between the signal obtained by decimating the sampled points by eight times and the input quaternary signal is shown in the figure: it
can be seen that the two are almost coincident, and only a small part of the signal is judged incorrectly, which is the cause of the error.
5.3 Demapping
Finally, according to the mapping rules mentioned in 2.1.1, reverse mapping, convert the symbol value into a binary sequence, and restore the original data.
5.4 Calculation of Bit Error Rate
The final output binary sequence is compared with the sequence obtained from the initial construction of the dpmr frame, and the total number of errors in the 384bit is counted to obtain the bit error rate:
under the influence of 100dB signal-to-noise ratio noise, the final bit error rate is 2.0833%.
To explore the relationship between signal to noise ratio and Guass bit error rate, signal to noise ratio taken from -10dB to 10dB, respectively, the error rate is calculated, the relationship between SNR and BER plotted in FIG. As shown in FIG:
enlarge As the signal-to-noise ratio gradually increases, the trend of the system bit error rate is gradually decreasing, which conforms to the actual theory. However, in the process of gradual decrease, there are some fluctuations, which may be caused by two reasons:
①The input signal used is specially constructed and does not contain randomness, so it is not completely adapted to the theory
②Guass white noise has a strong randomness Because of the nature, a single experiment will also produce deviations.
In order to explore the above two conjectures, the input signal is changed to a 384bit random sequence, and the Monte Carlo method is used to increase the number of trials by multiples, take the expectation, and draw the relationship diagram as shown in the figure:
compare the above two diagrams and find The number of fluctuations in the bit error rate is reduced, but slight fluctuations still exist. It can be seen that the decrease of bit error rate with the increase of signal-to-noise ratio is a universal theory for the signal in a large range, and the signal strictly abides by this criterion.
references: