Engee documentation
Notebook

Vehicle radar for single target range estimation

The example discusses the design of a system model of an automotive radar based on a linear frequency modulated (LFM) signal for range estimation of single targets.

Functions used

In [ ]:
Pkg.add(["LinearAlgebra", "DSP", "FileIO" ,"Images" , "ImageShow"])
In [ ]:
using DSP,FFTW,LinearAlgebra

function run_model( name_model, path_to_folder ) # определение функции для прогона модели
    Path = path_to_folder * "/" * name_model * ".engee"
    if name_model in [m.name for m in engee.get_all_models()] # Проверка условия загрузки модели в ядро
        model = engee.open( name_model ) # Открыть модель
        engee.run( model, verbose=true ); # Запустить модель
        engee.close( name_model, force=true ); # Закрыть модель
    else
        model = engee.load( Path, force=true ) # Загрузить модель
        engee.run( model, verbose=true ); # Запустить модель
        engee.close( name_model, force=true ); # Закрыть модель
    end
    return
end;

function DataFrame2Array(X)
    out = collect(X)
    out_data = zeros(eltype(out.value[1]),size(out.value[1],1),size(out.value[1],2),length(out.value))
    [out_data[:,:,i] = out.value[i] for i in 1:length(out.value)]

    return out_data, out.time
end

function calc_spectrogram(x::Array,fs::Real,title::String;
    num_pulses::Int64 = 4,
    window_length::Int64 = 64,
    nfft::Int64=512,
    lap::Int64  = 60,
    thesh::Real = -Inf)

    gr()

    spec_out = DSP.spectrogram(x[:,:,1:num_pulses][:],window_length,lap;window=kaiser(window_length,3.95),nfft=nfft,fs=fs)

    power = DSP.pow2db.(spec_out.power)
    power .= map(x -> x < thesh ? thesh : x,power)

    power_new = zeros(size(power))

    power_new[1:round(Int64,size(power,1)/2),:] .= power[round(Int64,size(power,1)/2)+1:end,:]
    power_new[round(Int64,size(power,1)/2)+1:end,:] .= power[1:round(Int64,size(power,1)/2),:]

    fig = heatmap(fftshift(spec_out.freq).*1e-6,spec_out.time .*1e6, permutedims(power_new),color= :jet,
        gridalpha=0.5,margin=5Plots.mm,size=(900,400))
    xlabel!("Частота, МГц")
    ylabel!("Время, мкс")
    title!(title)

    return fig
end;

1. description of the model structure

1.1 General scheme of the system model

The general structural diagram of the system model is presented below:

image.png

Let's look at the structure of the model in more detail:

  • ** FMCW Waveform*: a continuous FM signal is used as a sounding signal (SS);
  • ** ** Transmitter*: The transmitter amplifies the signal and generates the directional pattern (DN);
  • **Channel*: The signal is propagated to targets and back to the receiver, with attenuation based on the distance to the target;
  • Subject (Car): represents a moving car;
  • **Receiver Preamp*: the signal reflected from the car is fed to the receiving antenna array and amplified, taking into account the receiver's own thermal noise;
  • ** Signal Processing*: estimates the range of the vehicle.

The schematic diagram of the model is shown in the figure below.

image_2.png

1.2 Description of Digital Signal Processing steps

In a radar receiver, the reflected signal undergoes few processing steps before an estimate of the range to the target vehicle is obtained. The Signal Processing process consists of two stages:

  • 1 Stage: Range Processing. The received signal is multiplied with the complex-conjugate input signal, resulting in a difference frequency (or beat frequency) due to target motion between the reflected signal and the sounder. The 64 pulses are then coherently accumulated in a Coherent Integration subsystem, which increases the signal-to-noise ratio. Next, the data is passed to the Range Response unit, which performs a Fast Fourier Transform (FFT) for subsequent range estimation.
  • 2 Stage: Target Detection and Range Estimation consists of 5 parallel processing channels to detect and estimate the range of the target object.

image.png

In step 2, each channel includes 3 processing steps:

  • ** Object Detection: the radar data is first transmitted to a one-dimensional false alarm rate (CFAR)(CFAR)** detector using a sliding-mean-window algorithm. This unit detects the presence of a reflected signal.

  • Clustering: A clustering process is then performed in the "DBSCAN Clusterer " block, which clusters the detection cells into range groups using the data obtained in the CFAR block.

  • Range Estimator is the last step in the final step of identifying detection objects and clusters. This step estimates the range of targets detected using radar data.

image_2.png

1.3 Channel model and targets

The Channel and Target subsystem simulates signal propagation and reflection from the target vehicle.

  • Channel - simulates the signal propagation between the radar vehicle and the target vehicle. The channel can be configured as a free-space channel (Free Space Channel) or as a dual-beam channel, where the signal arrives at the receiver on both the direct and reflected paths (Two-Ray Channel). The free space channel is selected by default.

image_2.png

  • Target - Reflects the incident signal and simulates the path of the target vehicle. The subsystem shown below consists of two parts: a target model to simulate the reflected signal (block - Target) and an object model in space to simulate the dynamics of the target vehicle (block - Platform).

image_4.png

2.Initialisation of input parameters

In the model scenario, a vehicle equipped with a radar starts from a reference point at 100 km/h (27.8 m/s) and a target object starts 43 metres in front of it at 96 km/h (26.7 m/s). The positions and velocities of the radar and target are used in the propagation channel to calculate delay, Doppler effect, and signal attenuation.

To initialise the input parameters of the model we connect the file "FMCWParam.jl". If you need to change the parameter values, open this file and edit the necessary parameters.

In [ ]:
include("$(@__DIR__)/FMCWParam.jl") # подключение файла с входными параметрами
paramRadarFMCW = FMCWParam(); # запись входных параметров в структуру
T = paramRadarFMCW.T; # шаг дискретизации модели
simT = 640*T; # время симуляции модели

3. Running the model

Let's run the model simulation calculation using the run_model function:

In [ ]:
run_model("FMCW_Radar_Range_Estimation",@__DIR__); # Запустить модель
Building...
Progress 0%
Progress 0%
Progress 0%
Progress 5%
Progress 10%
Progress 15%
Progress 20%
Progress 25%
Progress 41%
Progress 46%
Progress 57%
Progress 63%
Progress 69%
Progress 83%
Progress 94%
Progress 100%

4. Reading the output data

Let's extract the simulation results from the variables written to the workspace into an array for further visualisation:

In [ ]:
input_signal, _ = DataFrame2Array(in_sig) # входной ЛЧМ-сигнал
dec_signal, _ = DataFrame2Array(dec_sig) # сигнал после цифровой обработки
range_estimate, slow_time = DataFrame2Array(rng_est) # оценки дальности
RPos, fast_time = DataFrame2Array(RPos) # положение радара
CPos,_ = DataFrame2Array(CPos); # положение объекта

5. Visualisation of radar operation

5.1 Spectrogram of the input signal

First let us consider the spectrogram of the emitted LFM signal.

In [ ]:
calc_spectrogram(
    input_signal, # ЛЧМ-сигнал
    paramRadarFMCW.Fs, # частота дискретизации
    "Cпектрограмма ЛЧМ-сигнала";
    num_pulses=4 # количество импульсов отображения
)
Out[0]:

The spectrogram above shows that the frequency deviation is 150 MHz with a period every 7 microseconds, which corresponds to a resolution of about 1 metre.

5.2 Spectrogram of the signal after digital processing

Next, let's consider the spectrogram of the signal after digital processing:

In [ ]:
calc_spectrogram(
    dec_signal[:,:,2:end], # сигнал после обработки (отображается со 2 импульса)
    paramRadarFMCW.Fs/paramRadarFMCW.NumSweeps, # частота дискретизации
    "Cпектрограмма сигнала после обработки";
    num_pulses=4, # количество импульсов 
    thesh=-300 # порог, дБ
)
Out[0]:

The graph shows that the beat frequency generated by the objects is approximately 100 kHz. Note that after processing, the signal has only one frequency component. The final range estimate is calculated based on the beat frequency, with an accuracy of 1 metre.

5.3 Estimating the range to an object

Finally, let's look at the result of the radar:

In [ ]:
gr()
true_range = [norm(CPos[:,1,i].-RPos[:,1,i]) for i in 1:size(CPos,3)]
p1 = plot(Vector(slow_time)*1e3,range_estimate[:],label="оценка расстояния",margin=5Plots.mm,
    titlefont=font(10,"Computer Modern"),guidefont = font(8,"Computer Modern"),legendfont = font(8,"Computer Modern"))
plot!(Vector(fast_time)*1e3,true_range,label="истинное расстояние")
ylabel!("Расстояние, м")
title!("Зависимость оценки расстояния до цели от времени")

p2 = plot(Vector(slow_time)*1e3,abs.(range_estimate[:].-true_range[1:paramRadarFMCW.NumSweeps:end]),lab="",
titlefont=font(10,"Computer Modern"),guidefont = font(8,"Computer Modern"),legendfont = font(8,"Computer Modern"))
xlabel!("Время, мс")
ylabel!("Расстояние, м")
title!("Отклонение оценки")

plot(p1,p2,layout=(2,1),size=(900,460))
Out[0]:

Thus, the accuracy of estimation of the distance from the radar to the target object corresponds to the declared accuracy - 1 m.

5.4 Analysing the influence of two-beam signal propagation

The result from the previous paragraph is achieved by modelling the direct propagation channel in free space. In reality, multiple paths between transmitter and receiver are often used for propagation between vehicles. Consequently, signals from different paths can be stacked either in phase or in anti-phase.

If you set up a model of propagation over a (Two-Ray) channel, which is the simplest multipath channel, you will notice that the main beat frequency cannot be distinguished against the background of the noise spectrum (see spectrogram below) because the direct signal is stacked with the reflected signal.

image.png

Closure

In the example we have considered modelling of the basic model of atomobile radar with application of continuous LFM-signal as a probing signal. As a result of the model operation, the distance from the radar to the target object (car) was estimated with the accuracy of radar resolution - 1 metre.

The influence of the signal propagation model was also investigated: direct propagation channel and birefringent propagation channel. The results showed that the two-beam propagation model can negatively affect the radar performance by compensating the beat frequency component, thus making range estimation impossible.