Modelling of an inductance coil with hysteresis.
This example shows how changing the coefficients of the Giles-Atherton magnetic hysteresis equation affects the resulting B-H curve. The simulation parameters are set to run four complete AC cycles with the initial field strength (H) and magnetic flux density (B) set to zero.
Schematic of the model:

Define the function to load and run the model:
function start_model_engee()
try
engee.close("inductor_with_hysteresis", force=true) # закрытие модели
catch err # в случае, если нет модели, которую нужно закрыть и engee.close() не выполняется, то будет выполнена её загрузка после catch
m = engee.load("$(@__DIR__)/inductor_with_hysteresis.engee") # загрузка модели
end;
try
engee.run(m) # запуск модели
catch err # в случае, если модель не загружена и engee.run() не выполняется, то будут выполнены две нижние строки после catch
m = engee.load("$(@__DIR__)/inductor_with_hysteresis.engee") # загрузка модели
engee.run(m) # запуск модели
end
end
Running the model:
try
start_model_engee() # запуск симуляции с помощью специальной функции, реализованной выше
catch err
end;
Output the results of the simulation from the simout variable:
res = collect(simout)
Writing results to variables:
H = collect(res[7]) # напряжённость поля
B = collect(res[9]) # плотность магнитного потока
using Plots
plot(H[100:end,2], B[100:end,2], linewidth=3, xlabel= "H, А/м", ylabel= "B, Т", legend=:bottomright)
Determination of the new inverse magnetisation factor:
Output of the parameters of the Nonlinear Inductor block:
engee.get_param("inductor_with_hysteresis/Nonlinear Inductor")
Redefine the values of the coefficients of the magnetic hysteresis equation using the function set_param!
, hidden under the mask:
engee.load("$(@__DIR__)/inductor_with_hysteresis.engee")
# @markdown Коэффициент обратимой намагниченности:
c = 0.2 # @param {type:"slider", min:0, max:1, step:0.1}
# @markdown Коэффициент объемной связи:
K = 200.0 # @param {type:"slider", min:0, max:1000, step:1}
# @markdown Коэффициент междоменной связи:
alpha = 0.0001 # @param {type:"slider", min:0, max:0.001, step:0.0001}
engee.set_param!("inductor_with_hysteresis/Nonlinear Inductor", "c" => c)
engee.set_param!("inductor_with_hysteresis/Nonlinear Inductor", "K" => K)
engee.set_param!("inductor_with_hysteresis/Nonlinear Inductor", "alpha" => alpha)
engee.run("inductor_with_hysteresis")
res1 = collect(simout)
H1 = collect(res1[7])
B1 = collect(res1[9])
engee.close("inductor_with_hysteresis", force = true)
plot(H[100:end,2], B[100:end,2], label = "Исходные параметры модели", xlabel= "H, А/м", ylabel= "B, Т", linewidth=3)
plot!(H1[100:end,2], B1[100:end,2], label = "Изменённые параметры модели", legend=:bottomright, linewidth=3)
Conclusions:
In this example, a model of an inductance coil with hysteresis was simulated using software control. The graphs show how the individual coefficients of the Giles-Atherton equations affect the hysteresis curve.