The differentiating link on the operational amplifier
This example will demonstrate the modeling of the differentiating link using the command control of the model in the Engee script editor, as well as launching the model from the Simulink environment.
The model of the differentiating link on the operational amplifier is assembled using libraries of electrical elements. Electrical elements are represented by a voltage source, resistance, capacitance, as well as an ideal operational amplifier.
Model of the differentiating link (model ssc_differentiator_op_amp.engee) :

Implementation of the model launch using software control:
Pkg.add(["Statistics", "CSV"])
using MATLAB
using CSV
using DataFrames
using Statistics
demoroot = @__DIR__
mat"start_simulink"
mat"p = $demoroot; addpath(p);"
mat"p = '/user/start/examples/helper_units'; addpath(p);"
Loading the model:
modelName = "ssc_differentiator_op_amp";
model = modelName in [m.name for m in engee.get_all_models()] ? engee.open( modelName ) : engee.load( "$(@__DIR__)/$(modelName).engee");
Launching the uploaded model:
results = engee.run( modelName )
Loading and visualizing the data obtained during the simulation.
Obtaining data on the voltage taken from voltmeters:
DiffOpAmp_t = results["V1"].time;
DiffOpAmp_d1 = results["V1"].value;
DiffOpAmp_d2 = results["V2"].value;
Plotting a graph describing the voltage change.
p_adc_da_e = plot(DiffOpAmp_t ,DiffOpAmp_d1 , legend = false)
plot!(DiffOpAmp_t ,DiffOpAmp_d1 , legend = false)
plot!(title = "Результаты моделирования в Engee", ylabel = "Напряжение, В", xlabel="Время, c")
The same scheme can be modeled in SimScape:
Running the model in Simulink and loading the results into variables:
mat"run_test_model('ssc_opamp_differentiator_demo');";
sl_diff_opamp_values = mat"SysOutput.Data";
sl_diff_opamp_times = mat"SysOutput.Time";
Output of simulation results in SimScape:
plot(sl_diff_opamp_times, sl_diff_opamp_values, legend = false)
plot!(title = "Результаты моделирования в Simulink", ylabel = "Напряжение", xlabel="Время, c")
Let's apply differentiated signals:
plot(DiffOpAmp_t ,DiffOpAmp_d2, label = "Engee")
plot!(title = "Сравнение результатов моделирования")
plot!(sl_diff_opamp_times, sl_diff_opamp_values, label = "Simulink")
plot!(legend = :outertopright,ylabel = "Цифровой сигнал", xlabel="Время, c")
Conclusion:
In this example, the model of the differentiating link was demonstrated using the command control of the model in the Engee script editor, as well as launching the model from the Simulink environment. The calculations showed a minimal difference in the results when running the simulation in these two environments.