Digital communication channel
In this example, we demonstrate a block chain for creating a digital communication channel. The model implements a modulator, receiving and transmitting filters for Manchester encoding, a channel with white noise, signal decoding and error counting.
The example uses Engee's ability to work with models in which different simulation rates are set for individual subsystems. In this model, there are subsystems operating at different frequencies.:
- 2.5 Hz – frequency at the “application level” of the model (the generator generates numbers from 0 to 10)
- 10 Hz – frequency of the bit stream after digital modulation (4-bit packets)
- 80 Hz – frequency at the physical level (bipolar digital signal and the Manchester encoding is 1 to 8)
Errors are calculated on the receiving side, both at the number level and at the bit level.
The structure of the model
The model includes:
- Generator of numbers from 0 to 10
- A modulator that translates them into 4-bit sequences
- Converter of a unipolar signal to a bipolar one
- Digital filter for application to the Manchester code signal
- Channel with added Gaussian noise
And a set of reverse operations:
- Paired receiving filter for Manchester code
- Converter from bipolar signal to unipolar
- Bit error counting unit between the sent and received signal
- Demodulator, which makes numbers from 0 to 10 from each group of 4 bits.
General view of the model
This model allows you to look into each communication line and see what the signal is at each stage of transmission.
Launching a model from a script
To automate the analysis, you need to close the model (if it is open on the canvas) and run this model under program control.
Pkg.add(["Measures"])
# Запуск модели
model = engee.open("$(@__DIR__)/simple_digital_channel.engee");
results = engee.run( model )
#engee.close( "simple_digital_channel", force=true );
Conclusion of graphs
Connecting libraries
# Подключение библиотек
using DataFrames, Measures
gr(); # Подключение бэкенда - метода отображения графики
Analysis of input and output information (a series of numbers)
# Загрузка данных
Sin = results["Входной сигнал и задержка"];
Sout = results["Реконструкция сигнала"];
# Построение графиков
plot(
plot( Sin.time, Sin.value, st=:step, xlabel="Время", ylabel="Числа", title="Числа на входе", leg=false ),
plot( Sout.time, Sout.value, st=:step, xlabel="Время", ylabel="Числа", title="Числа на выходе", leg=false ),
layout=grid(1, 2, widths=(4/8,4/8)), size=(900,300), margin=5mm, guidefont = font( 7 )
)
Analysis of input and output bit arrays
# Загрузка данных
Bin = results["Бинарный вектор"]
Bout = results["Выходной бинарный вектор"]
Bin_a = [v[1] for v in Bin.value]
Bin_b = [v[2] for v in Bin.value]
Bin_c = [v[3] for v in Bin.value]
Bin_d = [v[4] for v in Bin.value]
Bout_a = [v[1] for v in Bout.value]
Bout_b = [v[2] for v in Bout.value]
Bout_c = [v[3] for v in Bout.value]
Bout_d = [v[4] for v in Bout.value]
# Построение графиков
plot(
plot( Bin.time, [Bin_a Bin_b.+1.1 Bin_c.+2.2 Bin_d.+3.3], st=:step,
xlabel="Время", ylabel="Биты", title="Входной массив", leg=false ),
plot( Bout.time, [Bout_a Bout_b.+1.1 Bout_c.+2.2 Bout_d.+3.3], st=:step,
xlabel="Время", ylabel="Биты", title="Выходной массив", leg=false ),
layout=grid(1, 2, widths=(4/8,4/8)), size=(900,300), margin=5mm, guidefont = font( 7 )
)
Let's display the number of mistakenly received bits.
# Загрузка данных
ERC = results["Кол-во ошибок передачи"]
# Построение графиков
plot(
plot( ERC.time, ERC.value, st=:step, xlabel="Время", ylabel="Сигнал", title="Количество ошибок приема", leg=false ),
size=(900,400), margin=5mm, guidefont = font( 7 )
)
Let's study the noise in the channel
# Загрузка данных
Fin = results["Формирующий фильтр"];
AWGN_out = results["Сигнал в канале"];
Fout = results["Приемный фильтр"];
# Построение графиков
plot(
plot( Fin.time, Fin.value, st=:step, xlabel="Время", ylabel="Сигнал", title="Сигнал из формирующиего фильтра (идеальный)", leg=false ),
plot( AWGN_out.time, AWGN_out.value, st=:step, xlabel="Время", ylabel="Сигнал", title="Сигнал в канале (с белым шумом)", leg=false ),
plot( Fout.time, Fout.value, st=:step, xlabel="Время", ylabel="Сигнал", title="Сигнал после принимающего фильтра", leg=false ),
layout=grid(3, 1),
size=(900,600), margin=5mm, guidefont = font( 7 )
)
Conclusion
Based on this example, you can calculate coding redundancy parameters, check error correction codes, or check the operation of a communication channel at the physical level with other signal encoding: frequency, phase, make the channel part of a virtual booth, and much more.
The Engee platform allows you to demonstrate the work of digital electronics very clearly, select parameters and debug algorithms, and back up everything with visual illustrations.



