Engee documentation
Notebook

Modelling and visualisation of range and Doppler frequency data in a radar system in the presence of multiple targets

This example demonstrates how to simulate a radar system and use the calc_range_doppler_visual function to visualise range and Doppler intensity data over time in Engee. The range-time and Doppler intensity meters help detect a target in the environment by showing how the target range and Doppler parameter change over time.

Functions used

In [ ]:
# функция для прогона модели
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 ) # Открыть модель
        model_output = engee.run( model, verbose=true ); # Запустить модель
        # engee.close( name_model, force=true ); # Закрыть модель
    else
        model = engee.load( Path, force=true ) # Загрузить модель
        model_output = engee.run( model, verbose=true ); # Запустить модель
        # engee.close( name_model, force=true ); # Закрыть модель
    end
    return model_output
end;

# функция построения динамическогой визуализации изменения дальности и частоты Доплера
function calc_range_doppler_visual(out_range,out_doppler,time_simulation,paramRadarVisual) 
    gr()
    out_doppler .= 20log10.(out_doppler .+ eps(1.0))
    max_doppler = maximum(out_doppler)
    out_doppler.= map(x-> x> max_doppler-5 ? x : max_doppler-5,out_doppler)
    num_step = ceil(Int64,size(out_range,3)/20) # шаг по отсчетам в симуляции

    # Выделение памяти для заполнения данных симуляции
    viz_Range = fill(NaN,size(out_range)...)
    viz_Doppler = fill(NaN,size(out_doppler)...)

    # Задание осей для построения динамического графика
    x_axis_range = Vector(range(start=0,stop=paramRadarVisual.max_range,length=size(viz_Range,1)))
    y_axis_range = Vector(range(start=0,stop=time_simulation,length=size(viz_Range,3)))
    x_axis_doppler = Vector(range(start=paramRadarVisual.DopplerOff,
        stop=-paramRadarVisual.DopplerOff,length=size(viz_Doppler,1)))
    y_axis_doppler = Vector(range(start=0,stop=time_simulation,length=size(viz_Doppler,3)))

    plot_range = heatmap(ylabel="Время,с", xlabel="Дальность,м",font_family="Computer Modern",
        title="Изменение дальности целей во времени",title_font=font(12,"Computer Modern"),
        colorbar_title="Мощность, мкВт",color=:viridis,size = (600,400))
    plot_doppler = heatmap(ylabel="Время,с", xlabel="Частота Доплера, Гц",font_family="Computer Modern",
        title="Изменение частоты Доплера целей во времени",title_font=font(12,"Computer Modern"),
        colorbar_title="Мощность, дбВт",color=:viridis,size = (600,400))

    @info "Построение визуализации изменения дальности целей от времени..." 

    anim1 = @animate for i in 1:num_step:size(viz_Range,3)
        @info "$(round(100*i/size(viz_Range,3))) %"
        viz_Range[:,:,1:i] .= out_range[:,:,1:i]*1e6
        heatmap!(plot_range,x_axis_range,y_axis_range,permutedims(viz_Range[:,1,:]),colorscale= :haline)
        (i+num_step > size(viz_Range,3)) && (heatmap!(plot_range,x_axis_range,y_axis_range,
            permutedims(out_range[:,1,:]*1e6),colorscale= :haline); @info "100.0 %")
    end
    @info "Построение визуализации изменения частоты Доплера от времени ..."
    anim2 = @animate for i in 1:num_step:size(viz_Doppler,3)
         @info "$(round(100*i/size(viz_Doppler,3))) %"
        viz_Doppler[:,:,1:i] .= out_doppler[:,:,1:i]
        heatmap!(plot_doppler,x_axis_doppler,y_axis_doppler,permutedims(viz_Doppler[:,1,:]),colorscale= :haline)
        (i+num_step > size(viz_Doppler,3)) && (heatmap!(plot_doppler,x_axis_doppler,y_axis_doppler,
            permutedims(out_doppler[:,1,:]),colorscale= :haline); @info "100.0 %")
    end
    return anim1,anim2
end;

1. description of the model structure

Let's consider the structural scheme of the model in more detail:

Transmitter (Transmitter)

  • Waveform Rectungular: a probing signal source that generates a sequence of rectangular pulses;
  • Transmitter: amplifier of the generated rectangular pulse;
  • Narrowband TX Array: a transmitting antenna element (or antenna array) forming a directional pattern;

Object Motion (Platform)

The platform subsystem models the movement of the radar as well as the target. Radar and target positions and velocities are used by the Free Space block to model propagation and the Range Angle block to calculate signal incidence angles at the target location.

  • Radar Platform: used for modelling radar motion. The radar is mounted on a stationary platform located at the origin. Target Platform: Used to simulate target motion.
  • Range Angle: Used to simulate target movement.

image.png

Channel and Targets

.
  • Free Space: the free space in which the signal propagates to the targets and back to the receiver, undergoing attenuation proportional to the distance to the targets;
  • Target: a target model that reflects the incident signal according to the radar cross section (RCS).
  • Receiver Preamp: the signal reflected from the targets is fed to the receiving antenna array and amplified with the addition of the receiver's own thermal noise.

Receiver

  • Narrowband Rx Array: Simulates the signals received by the antenna.
  • Receiver Preamp: Amplifies the received signal from the target and adds its own thermal noise.
  • Range Processing Subsystem - Performs matched filtering to improve SNR, then a block (Time Varying Gain) performs tunable gain to compensate for range loss and integrates 10 pulses incoherently.

image_3.png

Doppler Processing Subsystem - The received signal is accumulated 10 pulses in a packet, followed by an FFT to estimate the Doppler frequency (velocity) of the targets.

image_4.png

A schematic of the model's operation is shown in the figure below: image.png

Digital processing consists of the following elements: image_2.png

Based on the structural diagram, we developed the radar model shown in the figure below.

image_2.png

2 Initialisation of input parameters

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

In [ ]:
include("$(@__DIR__)/ParamRadarVisual.jl")
paramRadarVisual = calcParamRadarVisual();
pulse_length = paramRadarVisual.pulse_length*100; # Длительность импульса

The model allows flexible adjustment of the antenna array of the transmitter and receiver, including: type of element, geometry of the antenna array (the model uses 1 isotropic radiator, as shown below):

image_2.png

3. Running the model

Let's define the model run function run_model and run the model simulation:

In [ ]:
run_model("RadarSystemVisualExample", @__DIR__);
Building...
Progress 0%
Progress 5%
Progress 8%
Progress 13%
Progress 18%
Progress 23%
Progress 28%
Progress 33%
Progress 38%
Progress 43%
Progress 48%
Progress 53%
Progress 58%
Progress 63%
Progress 68%
Progress 73%
Progress 78%
Progress 83%
Progress 88%
Progress 93%
Progress 98%
Progress 100%
Progress 100%

The results of the simulation can be visualised using the "Intensity Diagram " graph type:

image_2.png

In the Range-Doppler plot, 3 targets can be observed: one approaching the radar, one moving away and 3 standing still. Also, in the range-Doppler diagram, an estimate of the Doppler frequency can be observed

The result of the dynamic visualisation is shown in the video "VizualizeDiagramm.gif"

4. Reading output data

Read the necessary variables (in our case Range and Doppler) from the workspace:

In [ ]:
out_Range = zeros(Float64,size(Range.value[1],1),size(Range.value[2],2),length(Range.value))
[out_Range[:,:,i] = collect(Range.value[i]) for i in eachindex(Range.value)]

out_Doppler = zeros(Float64,size(Doppler.value[1],1),size(Doppler.value[2],2),length(Doppler.value))
[out_Doppler[:,:,i] = collect(Doppler.value[i]) for i in eachindex(Doppler.value)]

time_simulation = Range.time[end];

5. Displaying the results

Using the previously calculated data, let's build a visualisation of the system response in terms of range and Doppler frequency. To do this, call the calc_range_doppler_visual function:

In [ ]:
# сохранения анимации в переменных anim_range,anim_doppler
anim_range,anim_doppler = calc_range_doppler_visual(out_Range,out_Doppler,time_simulation,paramRadarVisual)
# Сохранение визуализации отклика в файле формата .gif
gif(anim_range, "Visual_Range.gif", fps = 1)
gif(anim_doppler, "Visual_Doppler.gif", fps = 1);
[ Info: Построение визуализации изменения дальности целей от времени...
[ Info: 0.0 %
[ Info: 5.0 %
[ Info: 10.0 %
[ Info: 15.0 %
[ Info: 20.0 %
[ Info: 25.0 %
[ Info: 30.0 %
[ Info: 35.0 %
[ Info: 40.0 %
[ Info: 45.0 %
[ Info: 50.0 %
[ Info: 55.0 %
[ Info: 60.0 %
[ Info: 65.0 %
[ Info: 70.0 %
[ Info: 75.0 %
[ Info: 80.0 %
[ Info: 85.0 %
[ Info: 90.0 %
[ Info: 95.0 %
[ Info: 100.0 %
[ Info: Построение визуализации изменения частоты Доплера от времени ...
[ Info: 0.0 %
[ Info: 5.0 %
[ Info: 10.0 %
[ Info: 15.0 %
[ Info: 20.0 %
[ Info: 25.0 %
[ Info: 30.0 %
[ Info: 35.0 %
[ Info: 40.0 %
[ Info: 45.0 %
[ Info: 50.0 %
[ Info: 55.0 %
[ Info: 60.0 %
[ Info: 65.0 %
[ Info: 70.0 %
[ Info: 75.0 %
[ Info: 80.0 %
[ Info: 85.0 %
[ Info: 90.0 %
[ Info: 95.0 %
[ Info: 100.0 %
[ Info: Saved animation to /user/start/examples/radars/radarsystemvisualexample/Visual_Range.gif
[ Info: Saved animation to /user/start/examples/radars/radarsystemvisualexample/Visual_Doppler.gif

After saving the files, 2 files will appear in the contents of the current folder - Visual_Range.gif and Visual_Doppler.gif, storing the dynamics of range and Doppler frequency changes in time:

image_2.png

Examples of visualisations are given below:

In [ ]:
gif(anim_range, "Visual_Range.gif", fps = 1)
[ Info: Saved animation to /user/start/examples/radars/radarsystemvisualexample/Visual_Range.gif
Out[0]:
No description has been provided for this image
In [ ]:
gif(anim_doppler, "Visual_Doppler.gif", fps = 1)
[ Info: Saved animation to /user/start/examples/radars/radarsystemvisualexample/Visual_Doppler.gif
Out[0]:
No description has been provided for this image

Conclusion

In summary, this case study demonstrated the design of a radar system in the Engee environment, and the calculation and construction of a visualisation of range and Doppler frequency information varying over time.

Blocks used in example