Engee documentation
Notebook

Beamforming based on phase shift

This example shows how to apply classical phase-shift beamforming to a narrowband signal received by an antenna array. The system model includes the receiver's intrinsic noise.

Auxiliary functions

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_array_out(out, name)
    array = zeros(eltype(out[name].value[1]),size(out[name].value[1],1),size(out[name].value[2],2),length(out[name].value))
    [array[:,:,i] = collect(out[name].value[i]) for i in eachindex(out[name].value)]
    return array
end

# построение выходных графиков
function plot_result(out, title, number, t_step = 0.3)
    t = Vector(0:t_step/size(out, 1):t_step*(1-1/size(out, 1)))*10^3 # сетка времени в мс
    plot(t, out[:, 1, number], label = title, title = title,size=(500,250))
    plot!(t, out_ref_pulse[:, 1, number], label = "Эталонный сигнал", 
        xlabel = "Время (мс)", уlabel = "Амплитуда (В)"
    )
end;

The figures show the output of a single element (without beamforming) with a reference pulse and the output of a beamformer together with a reference pulse. When the received signal is not beamformed, the pulse cannot be detected due to noise. The image of the beamformer output shows that the beamformed signal is much larger than the noise. The output SNR is about 10 times larger than the signal received on a single antenna because the 10-element array gives a gain of 10.

1. description of the model structure

The model simulates the reception of a rectangular pulse with offset delay on a 10-element uniformly linear antenna array (AA). The source of the pulse is located along the direction: azimuth angle of 45 degrees and location angle of 0 degrees. At each array element, 0.5 W noise is added to the signal. A beamformer is then applied that takes into account the phase shift between the AR elements. The example compares the output of the beamformer with the signal received by one antenna element.

The structural diagram of the system is shown below.

image_3.png

The system implementation consists of modelling the received signal, signal reception and signal processing. The following blocks correspond to each stage of the model:

Signal modelling:

  • ** Rectangular Pulse Generator** (Rectangular) - Creates rectangular pulses.

  • Delay (Offset waveform) - The delay unit delays each pulse by 150 samples.

Receive signal:

  • ** Narrowband Rx Array (Narrowband Rx Array) - Simulates the signals received at the AR. The first input to this block is a column vector containing the received pulses. It is assumed that the pulses are narrowband with a carrier frequency equal to the operating frequency specified in the block dialogue box. The second input "Ang" specifies the direction of pulse drop. The configuration of the antenna array is created in the "Sensor Array" tab of the block dialogue panel. Each column of output data corresponds to the signal received at each element of the antenna array.

  • Receiver Preamp (Receiver Preamp) - realises preliminary amplification of the received AR signal. The unit takes into account the intrinsic thermal noise of the receiver.

  • ** Signal direction (Signal direction) - sets the direction of pulses arrival to the Narrowband Rx Array.

Signal processing:

  • ** Angle to beamform (Angle to beamform) - The Constant block sets the direction of signal arrival to the beamformer.

  • ** ** Phase Shift Beamformer** (Phase Shift Beamformer) - performs narrowband beamforming taking into account the phase shift for each element of the antenna array.

Characteristics of the antenna array can be set in the Sensor Array tab of the "Phase Shift Beamformer" block. An example of parameterised initialisation of a linear antenna array of 10 elements is shown in the figure below.

snimok_ekrana_2025_03_21_152100.png

2 Initialisation of model parameters

The model parameters are set in the file ParamBeamformar.jl using the auxiliary function calcParamBeamformer. This function is executed once when the model is loaded. It exports to the workspace a structure whose fields are referenced by the dialogue boxes in the model. To change any parameters, either change the values in the structure from the command line, or edit the helper function and restart it to update the parameter structure.

image.png

In [ ]:
# подключение файла с параметрами модели
include("$(@__DIR__)/ParamBeamformer.jl");

3. Running the model

Use the function run_model to run a simulation of the system model Beamformer_with_noise. The logged simulation results will be written to the variable out.

In [ ]:
out = run_model("Beamformer_with_noise", @__DIR__) # запуск модели
Building...
Progress 0%
Progress 10%
Progress 100%
Progress 100%
Out[0]:
SimulationResult(
    "Эталонный_импульс" => WorkspaceArray{Vector{Float64}}("Beamformer_with_noise/Эталонный_импульс")
,
    "После_формирования" => WorkspaceArray{Matrix{Float64}}("Beamformer_with_noise/После_формирования")
,
    "Без_формирования" => WorkspaceArray{Vector{Float64}}("Beamformer_with_noise/Без_формирования")

)

4. Reading the output data

Use the function calc_array_out to read data from the variable out for each logged output.

In [ ]:
out_ref_pulse = calc_array_out(out, "Эталонный_импульс")
out_beamformer = calc_array_out(out, "После_формирования")
out_not_beamformer = calc_array_out(out, "Без_формирования");

5. Visualisation of the model results

Visualisation of the results is possible in two ways:

  • in the "graphs" tab (by selecting the "array plotting" type of graphs)
  • in a script using the data obtained as a result of simulation

Using the first method we will visualise the model result for the outputs with and without beam forming:

newplot_1.png newplot_2.png

The figures show the output of a single element (without beamforming) with a reference pulse and the output of a beamformer together with a reference pulse. When the received signal is not beamformed, the pulse cannot be detected due to noise.

The situation changes if a beamforming algorithm is used: the bottom graph shows that the beamformed signal is noticeably larger than the noise. This result is achieved by the fact that the output signal-to-noise ratio increases commensurate with the number of antenna elements (by a factor of about 10) compared to the signal before the algorithm was applied.

Similarly, it is possible to visualise the simulation results using the second method.For plotting in the script we will use the auxiliary function plot_result:

In [ ]:
num_puls = length(collect(out["Эталонный_импульс"]).time) # извлечение номера последнего импульса
plot_result(out_not_beamformer, "Без формирования", num_puls, t_step) |> display
plot_result(out_beamformer, "После формирования", num_puls, t_step)
Out[0]:

Comparing the obtained plots, we can notice that the resulting images are identical

Conclusion

In the example we have considered the algorithm of beamforming, taking into account the phase shift between antenna elements ("Phase Shift Beamformer "). The use of the algorithm in the receiving path allowed to successfully detect a useful signal against the background of the receiver's own noise.

Blocks used in example