Engee documentation
Notebook

Differential Coupled Amplifier

This example will demonstrate the modelling of a differential coupled amplifier.

Schematic of the model:

differential_pair_amplifier_1742910732573.png

Define the function to load and run the model:

In [ ]:
function start_model_engee()
    try
        engee.close("differential_pair_amplifier", force=true) # закрытие модели 
        catch err # в случае, если нет модели, которую нужно закрыть и engee.close() не выполняется, то будет выполнена её загрузка после catch
            m = engee.load("$(@__DIR__)/differential_pair_amplifier.engee") # загрузка модели
        end;

    try
        engee.run(m, verbose=true) # запуск модели
        catch err # в случае, если модель не загружена и engee.run() не выполняется, то будут выполнены две нижние строки после catch
            m = engee.load("$(@__DIR__)/differential_pair_amplifier.engee") # загрузка модели
            engee.run(m, verbose=true) # запуск модели
        end
end
Out[0]:
start_model_engee (generic function with 1 method)

Running the simulation

In [ ]:
start_model_engee();
Building...
Progress 0%
Progress 1%
Progress 8%
Progress 15%
Progress 22%
Progress 29%
Progress 35%
Progress 43%
Progress 49%
Progress 56%
Progress 63%
Progress 68%
Progress 74%
Progress 81%
Progress 88%
Progress 94%
Progress 100%
Progress 100%

Write simulation data to variables:

In [ ]:
t = simout["differential_pair_amplifier/Signal Generator.1"].time[:]
vb1 = simout["differential_pair_amplifier/Signal Generator.1"].value[:]
vb2 = simout["differential_pair_amplifier/Mode Differential.y"].value[:]
vc1 = simout["differential_pair_amplifier/Vd/Voltage Sensor p.1"].value[:]
vc2 = simout["differential_pair_amplifier/Vd/Voltage Sensor n.1"].value[:]
vc2_minus_vc1 = simout["differential_pair_amplifier/Vd/Voltage Sensor d.1"].value[:]
vb2_minus_vb1 = vb2 .- vb1;

Data visualisation

In [ ]:
using Plots

Visualisation of the collector voltages of NPN 1 and NPN2 transistors:

In [ ]:
plot(t, vb1, linewidth=2, label="vb1")
plot!(t, vb2, linewidth=2, label="vb2")
plot!(t, vb2_minus_vb1, linewidth=2, label="vb2-vb1", title="Входное напряжение")
Out[0]:
In [ ]:
plot(t, vc1, linewidth=2, label="vc1")
plot!(t, vc2, linewidth=2, label="vc2")
plot!(t, vc2_minus_vc1, linewidth=2, label="vc2-vc1", title="Выходное напряжение")
Out[0]:

Conclusions:

In this example, we have considered a differential coupled amplifier model. The graphs show the output and input characteristics of the amplifier, which differ by a factor of more than 40.