Engee documentation
Notebook

Scrambler

A scrambler is a software or hardware device (algorithm) that performs scrambling, i.e. reversible transformation of a digital stream without changing the transmission rate in order to obtain the properties of a random sequence. In this example, scrambling is implemented with a "Pseudo Random Binary Sequence" (PRBS). This sequence is computed due to an LFSR of length 15 given by the associated polynomial 1+ x^14 + x^15 and an initial value of 100101010000000. Also below is a figure describing the formula of the pseudorandom sequence generator.

image.png

Next, let us consider the implemented scrambling and descrambling scheme. It and bitwise comparison of the operation of this algorithm are shown in the figure below.

image_2.png

Let's run this model using the run function we described and save the bit error results.

In [ ]:
function run_model(name_model)
    Path = string(@__DIR__) * "/" * 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 ); # Запустить модель
    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

run_model("Scrambler_descrambler")
Building...
Progress 100%
Out[0]:
Dict{String, DataFrames.DataFrame} with 2 entries:
  "Error Rate Calculation.Out" => 1001×2 DataFrame…
  "Selector.1"                 => 1001×2 DataFrame

Let's analyse the saved values. BER is equal to zero during 1001 steps.

In [ ]:
# Считывание из simout сохранённых сигналов
BER = simout["Scrambler_descrambler/Error Rate Calculation.Out"];
BER = collect(BER)
BER[end-3:end,:]
Out[0]:

4 rows × 2 columns

timevalue
AnyAny
19.97[0.0, 0.0, 998.0]
29.98[0.0, 0.0, 999.0]
39.99[0.0, 0.0, 1000.0]
410.0[0.0, 0.0, 1001.0]

Conclusion

Based on the results of this demonstration we have studied the possibilities of realisation of the scrambling method used in DVB second generation video transmission protocols.

Blocks used in example