Engee documentation
Notebook

Modelling of operational amplifier with noise consideration

This example demonstrates one method of modelling noise in electrical circuits. The circuit is an amplifier with a cut-off frequency of 10 MHz, where noise effects are generated by a Band-Limited Operational Amplifier. The voltage source Vn specifies an equivalent noise spectral density of 20 $нВ/\sqrt{Гц}$.

Schematic of the model:

op_amp_with_noise_1743430398910.png

Define the function to load and run the model:

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

    try
        engee.run(m, verbose=true) # запуск модели
        catch err # в случае, если модель не загружена и engee.run() не выполняется, то будут выполнены две нижние строки после catch
            m = engee.load("$(@__DIR__)/op_amp_with_noise.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 5%
Progress 10%
Progress 15%
Progress 20%
Progress 25%
Progress 30%
Progress 35%
Progress 40%
Progress 45%
Progress 50%
Progress 55%
Progress 61%
Progress 66%
Progress 71%
Progress 76%
Progress 81%
Progress 86%
Progress 91%
Progress 96%
Progress 100%

Write simulation data to variables:

In [ ]:
t = simout["op_amp_with_noise/SysOutput_1"].time[:]
amp_voltage = simout["op_amp_with_noise/SysOutput_1"].value[:]
Out[0]:
WorkspaceArray{Float64}("op_amp_with_noise/SysOutput_1").value

Data visualisation

In [ ]:
using Plots

Graph of the voltage across the amplifier:

In [ ]:
plot(t, amp_voltage, linewidth=2, title="Напряжение на усилителе", xlabel="Время, с", ylabel="Напряжение, В", lc=2)
Out[0]:

Frequency response of the amplifier:

newplot_65.png