Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

FMCW radar working principle simulation based on python — Chapter 2:Velocity simulation

FMCW radar working principle simulation based on python — Chapter 2:Velocity simulation

Neo_Lu
Moderator
Moderator
Moderator
50 replies posted 5 likes given 100 sign-ins

This article will introduce how to use python to implement the simulation of FMCW working principle, the second chapter content will introduce the principle of velocity detection.

FMCW radar working principle simulation based on python — Chapter 1:Distance simulation 

Part 1: Principle of velocity detection

 

As talked in the end of chapter 1,  small scale movement is hard to be detected by range-frequency relationship, as shown in the picture below, no obvious shifting can be found in the Spectrum during the frame period. Besides, if there several targets with the same distance, we cannot distinguish them by the range-frequency relationship because they have the same IF frequency in the Spectrum.

Neo_Lu_0-1661847382793.png

However, we can detect these small scale movements and distinguish different targets by measuring the phase change of IF signals. The basic idea of velocity estimation by phase changing is shown below:

Neo_Lu_1-1661847969908.png

Part 2: 1D speed estimation

 

 Step_1: Speed Dimension Data Extraction

Extract one sampling point per chirp, for a frame with 128 chirp, there will be a list of 128 points.

chirpamp = []
chirpnum = 1
while(chirpnum<=Nd):
    strat = (chirpnum-1)*1024
    end = chirpnum*1024
    chirpamp.append(IFx[(chirpnum-1)*1024])
    chirpnum = chirpnum + 1

  Step_2: Speed Dimension FFT for Phase difference  and Velocity

doppler = 10*np.log10(np.abs(np.fft.fft(chirpamp)))
FFTfrequency = np.fft.fftfreq(Nd,1/Fs)
velocity = 5*np.arange(0,Nd)/3
Figure_1.png

Part 3: 2D FFT and Velocity-Distance Relationship

 

Z_fft2 = abs(np.fft.fft2(mat2D))
Data_fft2 = Z_fft2[0:64,0:512]
Neo_Lu_3-1661849009768.png

Source code of this chapter:

#Range Spectogram
plt.subplot(4,2,6)
plt.specgram(IFx,1024,Fs)
plt.xlabel('Time')
plt.ylabel('Frequency')
plt.title('Range-Frequency Spectogram')
plt.show()

#Speed Calculate
#速度维数据提取
chirpamp = []
chirpnum = 1
while(chirpnum<=Nd):
    strat = (chirpnum-1)*1024
    end = chirpnum*1024
    chirpamp.append(IFx[(chirpnum-1)*1024])
    chirpnum = chirpnum + 1
#速度维做FFT得到相位差
doppler = 10*np.log10(np.abs(np.fft.fft(chirpamp)))
FFTfrequency = np.fft.fftfreq(Nd,1/Fs)
velocity = 5*np.arange(0,Nd)/3
#plt.subplot(4,2,7)
plt.plot(velocity[0:int(Nd/2)],doppler[0:int(Nd/2)])
plt.xlabel('Velocity')
plt.ylabel('Amplitude')
plt.title('IF Velocity FFT')
plt.show()

#2D plot
mat2D = np.zeros((Nd, Nr))
i = 0
while(i<Nd):
    mat2D[i, :] = IFx[i*1024:(i+1)*1024]
    i = i + 1
#plt.matshow(mat2D)
#plt.title('Original data')

Z_fft2 = abs(np.fft.fft2(mat2D))
Data_fft2 = Z_fft2[0:64,0:512]
#plt.subplot(4,2,8)
plt.imshow(Data_fft2)
plt.xlabel("Range")
plt.ylabel("Velocity")
plt.title('Velocity-Range 2D FFT')

plt.tight_layout(pad=3, w_pad=0.05, h_pad=0.05)
plt.show()

 


 

2808 Views