Restoration of the main 5G information block
This example shows how to use the 5G library to synchronize, demodulate, and decode the gNodeB signal. In the example, the MIB and the first of the system information blocks (SIB1) are decoded.
Decoding MIB and SIB1 requires an integrated receiver capable of demodulating and decoding most of the downlink channels and signals.
Let's start by connecting libraries, declaring auxiliary functions and paths to solve this problem.
# Connecting libraries
neededLibs = ["CSV"]
for lib in neededLibs
try
eval(Meta.parse("using $lib"))
catch ex
Pkg.add(lib)
eval(Meta.parse("using $lib"))
end
end
# Paths to file folders
path_model = "$(@__DIR__)/";
# Connecting libraries
using DataFrames, CSV, Plots
include(path_model*"Fun_CSV.jl");
# Enabling the auxiliary model launch function
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()] # Checking the condition for loading a model into the kernel
model = engee.open( name_model ) # Open the model
model_output = engee.run( model, verbose=true ); # Launch the model
else
model = engee.load( Path, force=true ) # Upload a model
model_output = engee.run( model, verbose=true ); # Launch the model
engee.close( name_model, force=true ); # Close the model
end
return model_output
end;
The model of the implemented system is shown below. It can be divided into three parts:
- generation of the input signal and superimposition of the effects of the communication channel on the generated signal,
- Frequency offset correction followed by SSS search,
- PBCH search, BCH decoding and MIB detection.
Let's run the model and generate data from it.
run_model("MIB_5G", path_model)
Next, we will read the encoded signals from the CSV and analyze in more detail the communication system and the principles on the basis of which it is implemented. We will not focus on the generation of the input signal in this demonstration, but rather consider the receiving path itself.
The receiver performs a PSS search and a rough estimate of the frequency offset based on the frequency shift of the received signal, provided that the possible offsets are spaced by half of the subcarrier.
Next, the received frequency-shifted signal is correlated with each of the three possible PSS (NID) sequences and the strongest correlation peak is extracted.
In addition, the peak indicates which of the three PSS (NID) was detected in the received signal, as well as at what point the channel conditions were better.
NID = CSV.read(path_model * "NID.csv", DataFrame);
print("The strongest correlation peak: " * string(NID[1,2]))
The frequency shift estimate below half of the subcarrier is calculated by correlating the cyclic prefix of each OFDM symbol in the SSB with the corresponding useful parts of the OFDM symbols.
The phase of this correlation is proportional to the frequency shift of the signal.
Frequency_offset = CSV.read(path_model * "Frequency_offset.csv", DataFrame);
print("Frequency offset on the first frame: " * string(Frequency_offset[1,2])* " Hz")
Waveform = Complex_CSV(path_model * "Waveform.csv");
plot(real(Waveform))
plot!(imag(Waveform))
Next, the receiver extracts SSS-related elements from the resulting grid and correlates them with each possible SSS sequence generated locally.
Combining the indexes of the strongest PSS and SSS sequences gives the physical layer cell identity, which is necessary for processing PBCH DM-RS and PBCH.
SSS_search = CSV.read(path_model * "SSS_search.csv", DataFrame);
print("SSS: " * string(SSS_search[1,2]))
The MIB is mandatory system information that is broadcast by gNB at regular intervals. During the initial cell selection procedure, the UE assumes that SSB is transmitted to gNB every 20 ms. The UE obtains the MIB by decoding the PBCH from the SS-PBCH block beam.
MIB = str2num_CSV(path_model * "MIB.csv");
print("MIB: " * string(Int8.(MIB))) ;
Conclusion
We have reviewed the features of the 5G library and the possibilities of interacting with the functionality of this library in the Engee environment.